mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-19 12:22:23 +12:00
Exporter, everything ugly
This commit is contained in:
parent
23b762c482
commit
5ed300929f
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -5,4 +5,5 @@ snowflake*
|
||||||
*.msk
|
*.msk
|
||||||
Notes.t2t
|
Notes.t2t
|
||||||
*.nja
|
*.nja
|
||||||
src/pycallgraph.txt
|
src/pycallgraph.txt
|
||||||
|
ExportTest
|
|
@ -3,6 +3,7 @@ FORMS += ../src/ui/settings.ui
|
||||||
FORMS += ../src/ui/welcome_ui.ui
|
FORMS += ../src/ui/welcome_ui.ui
|
||||||
FORMS += ../src/ui/sldImportance_ui.ui
|
FORMS += ../src/ui/sldImportance_ui.ui
|
||||||
FORMS += ../src/ui/cheatSheet_ui.ui
|
FORMS += ../src/ui/cheatSheet_ui.ui
|
||||||
|
FORMS += ../src/ui/compileDialog_ui.ui
|
||||||
|
|
||||||
FORMS += ../src/ui/editors/editorWidget_ui.ui
|
FORMS += ../src/ui/editors/editorWidget_ui.ui
|
||||||
|
|
||||||
|
@ -21,10 +22,13 @@ SOURCES += ../src/models/plotModel.py
|
||||||
SOURCES += ../src/models/persosModel.py
|
SOURCES += ../src/models/persosModel.py
|
||||||
SOURCES += ../src/models/references.py
|
SOURCES += ../src/models/references.py
|
||||||
|
|
||||||
|
SOURCES += ../src/exporter/__init__.py
|
||||||
|
|
||||||
SOURCES += ../src/ui/helpLabel.py
|
SOURCES += ../src/ui/helpLabel.py
|
||||||
SOURCES += ../src/ui/sldImportance.py
|
SOURCES += ../src/ui/sldImportance.py
|
||||||
SOURCES += ../src/ui/welcome.py
|
SOURCES += ../src/ui/welcome.py
|
||||||
SOURCES += ../src/ui/cheatSheet.py
|
SOURCES += ../src/ui/cheatSheet.py
|
||||||
|
SOURCES += ../src/ui/compileDialog.py
|
||||||
|
|
||||||
SOURCES += ../src/ui/editors/editorWidget.py
|
SOURCES += ../src/ui/editors/editorWidget.py
|
||||||
SOURCES += ../src/ui/editors/fullScreenEditor.py
|
SOURCES += ../src/ui/editors/fullScreenEditor.py
|
||||||
|
|
5987
libs/txt2tags
Normal file
5987
libs/txt2tags
Normal file
File diff suppressed because it is too large
Load diff
31
src/exporter/__init__.py
Normal file
31
src/exporter/__init__.py
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#--!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
import collections
|
||||||
|
from qt import *
|
||||||
|
from .html import htmlExporter
|
||||||
|
from .arbo import arboExporter
|
||||||
|
from .odt import odtExporter
|
||||||
|
|
||||||
|
formats = collections.OrderedDict([
|
||||||
|
#Format
|
||||||
|
# Readable name
|
||||||
|
# Class
|
||||||
|
# QFileDialog filter
|
||||||
|
('html', (
|
||||||
|
qApp.translate("exporter", "HTML"),
|
||||||
|
htmlExporter,
|
||||||
|
qApp.translate("exporter", "HTML Document (*.html)"))),
|
||||||
|
('arbo', (
|
||||||
|
qApp.translate("exporter", "Arborescence"),
|
||||||
|
arboExporter,
|
||||||
|
None)),
|
||||||
|
('odt', (
|
||||||
|
qApp.translate("exporter", "OpenDocument (LibreOffice)"),
|
||||||
|
odtExporter,
|
||||||
|
qApp.translate("exporter", "OpenDocument (*.odt)"))),
|
||||||
|
('epub', (
|
||||||
|
"ePub (not yet)",
|
||||||
|
None,
|
||||||
|
None)),
|
||||||
|
])
|
53
src/exporter/arbo.py
Normal file
53
src/exporter/arbo.py
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#--!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
from qt import *
|
||||||
|
from enums import *
|
||||||
|
from functions import *
|
||||||
|
|
||||||
|
class arboExporter():
|
||||||
|
|
||||||
|
requires = ["path"]
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def doCompile(self, path):
|
||||||
|
#FIXME: overwrites when items have identical names
|
||||||
|
mw = mainWindow()
|
||||||
|
root = mw.mdlOutline.rootItem
|
||||||
|
|
||||||
|
def writeItem(item, path):
|
||||||
|
if item.isFolder():
|
||||||
|
path2 = os.path.join(path, item.title())
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.mkdir(path2)
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
for c in item.children():
|
||||||
|
writeItem(c, path2)
|
||||||
|
|
||||||
|
else:
|
||||||
|
ext = ".t2t" if item.isT2T() else \
|
||||||
|
".html" if item.isHTML() else \
|
||||||
|
".txt"
|
||||||
|
path2 = os.path.join(path, item.title() + ext)
|
||||||
|
f = open(path2, "w")
|
||||||
|
text = self.formatText(item.text(), item.type())
|
||||||
|
f.write(text)
|
||||||
|
|
||||||
|
for c in root.children():
|
||||||
|
writeItem(c, path)
|
||||||
|
|
||||||
|
|
||||||
|
def formatText(self, text, _type):
|
||||||
|
if _type == "t2t":
|
||||||
|
# Empty lines for headers
|
||||||
|
text = "\n\n\n" + text
|
||||||
|
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
|
26
src/exporter/basic.py
Normal file
26
src/exporter/basic.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#--!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
from qt import *
|
||||||
|
from enums import *
|
||||||
|
from functions import *
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
class basicExporter():
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def runT2T(self, text, target="html"):
|
||||||
|
|
||||||
|
cmdl = ['txt2tags', '-t', target, '--enc=utf-8', '--no-headers', '-o', '-', '-']
|
||||||
|
|
||||||
|
cmd = subprocess.Popen(('echo', text), stdout=subprocess.PIPE)
|
||||||
|
try:
|
||||||
|
output = subprocess.check_output(cmdl, stdin=cmd.stdout, stderr=subprocess.STDOUT) # , cwd="/tmp"
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("Error!")
|
||||||
|
return text
|
||||||
|
cmd.wait()
|
||||||
|
|
||||||
|
return output.decode("utf-8")
|
86
src/exporter/html.py
Normal file
86
src/exporter/html.py
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#--!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
from qt import *
|
||||||
|
from enums import *
|
||||||
|
from functions import *
|
||||||
|
from exporter.basic import basicExporter
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
class htmlExporter(basicExporter):
|
||||||
|
|
||||||
|
requires = ["filename"]
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def doCompile(self, filename):
|
||||||
|
mw = mainWindow()
|
||||||
|
root = mw.mdlOutline.rootItem
|
||||||
|
|
||||||
|
html = ""
|
||||||
|
|
||||||
|
def appendItem(item):
|
||||||
|
if item.isFolder():
|
||||||
|
html = ""
|
||||||
|
title = "<h{l}>{t}</h{l}>\n".format(
|
||||||
|
l = str(item.level() + 1),
|
||||||
|
t = item.title())
|
||||||
|
html += title
|
||||||
|
|
||||||
|
for c in item.children():
|
||||||
|
html += appendItem(c)
|
||||||
|
|
||||||
|
return html
|
||||||
|
|
||||||
|
else:
|
||||||
|
text = self.formatText(item.text(), item.type())
|
||||||
|
return text
|
||||||
|
|
||||||
|
for c in root.children():
|
||||||
|
html += appendItem(c)
|
||||||
|
|
||||||
|
|
||||||
|
template = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
<title>{TITLE}</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{BODY}
|
||||||
|
</body>
|
||||||
|
</html>"""
|
||||||
|
|
||||||
|
f = open(filename, "w")
|
||||||
|
f.write(template.format(
|
||||||
|
TITLE="FIXME",
|
||||||
|
BODY=html))
|
||||||
|
|
||||||
|
def formatText(self, text, _type):
|
||||||
|
|
||||||
|
if not text:
|
||||||
|
return text
|
||||||
|
|
||||||
|
if _type == "t2t":
|
||||||
|
text = self.runT2T(text)
|
||||||
|
|
||||||
|
elif _type == "txt":
|
||||||
|
text = text.replace("\n", "<br>")
|
||||||
|
|
||||||
|
return text + "<br>"
|
||||||
|
|
||||||
|
def runT2T(self, text, target="html"):
|
||||||
|
|
||||||
|
cmdl = ['txt2tags', '-t', target, '--enc=utf-8', '--no-headers', '-o', '-', '-']
|
||||||
|
|
||||||
|
cmd = subprocess.Popen(('echo', text), stdout=subprocess.PIPE)
|
||||||
|
try:
|
||||||
|
output = subprocess.check_output(cmdl, stdin=cmd.stdout, stderr=subprocess.STDOUT) # , cwd="/tmp"
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("Error!")
|
||||||
|
return text
|
||||||
|
cmd.wait()
|
||||||
|
|
||||||
|
return output.decode("utf-8")
|
58
src/exporter/odt.py
Normal file
58
src/exporter/odt.py
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#--!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
from qt import *
|
||||||
|
from enums import *
|
||||||
|
from functions import *
|
||||||
|
from exporter.basic import basicExporter
|
||||||
|
|
||||||
|
class odtExporter(basicExporter):
|
||||||
|
|
||||||
|
requires = ["filename"]
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def doCompile(self, filename):
|
||||||
|
mw = mainWindow()
|
||||||
|
root = mw.mdlOutline.rootItem
|
||||||
|
|
||||||
|
doc = QTextDocument()
|
||||||
|
cursor = QTextCursor(doc)
|
||||||
|
|
||||||
|
|
||||||
|
def appendItem(item):
|
||||||
|
if item.isFolder():
|
||||||
|
|
||||||
|
cursor.setPosition(doc.characterCount() - 1)
|
||||||
|
title = "<h{l}>{t}</h{l}><br>\n".format(
|
||||||
|
l = str(item.level() + 1),
|
||||||
|
t = item.title())
|
||||||
|
cursor.insertHtml(title)
|
||||||
|
|
||||||
|
for c in item.children():
|
||||||
|
appendItem(c)
|
||||||
|
|
||||||
|
else:
|
||||||
|
text = self.formatText(item.text(), item.type())
|
||||||
|
cursor.setPosition(doc.characterCount() - 1)
|
||||||
|
cursor.insertHtml(text)
|
||||||
|
|
||||||
|
for c in root.children():
|
||||||
|
appendItem(c)
|
||||||
|
|
||||||
|
dw = QTextDocumentWriter(filename, "odt")
|
||||||
|
dw.write(doc)
|
||||||
|
|
||||||
|
def formatText(self, text, _type):
|
||||||
|
|
||||||
|
if not text:
|
||||||
|
return text
|
||||||
|
|
||||||
|
if _type == "t2t":
|
||||||
|
text = self.runT2T(text)
|
||||||
|
|
||||||
|
elif _type == "txt":
|
||||||
|
text = text.replace("\n", "<br>")
|
||||||
|
|
||||||
|
return text + "<br>"
|
|
@ -5,6 +5,7 @@ from qt import *
|
||||||
|
|
||||||
from ui.mainWindow import *
|
from ui.mainWindow import *
|
||||||
from ui.helpLabel import helpLabel
|
from ui.helpLabel import helpLabel
|
||||||
|
from ui.compileDialog import compileDialog
|
||||||
from loadSave import *
|
from loadSave import *
|
||||||
from enums import *
|
from enums import *
|
||||||
from models.outlineModel import *
|
from models.outlineModel import *
|
||||||
|
@ -82,6 +83,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.actOpen.triggered.connect(self.welcome.openFile)
|
self.actOpen.triggered.connect(self.welcome.openFile)
|
||||||
self.actSave.triggered.connect(self.saveDatas)
|
self.actSave.triggered.connect(self.saveDatas)
|
||||||
self.actSaveAs.triggered.connect(self.welcome.saveAsFile)
|
self.actSaveAs.triggered.connect(self.welcome.saveAsFile)
|
||||||
|
self.actCompile.triggered.connect(self.doCompile)
|
||||||
self.actLabels.triggered.connect(self.settingsLabel)
|
self.actLabels.triggered.connect(self.settingsLabel)
|
||||||
self.actStatus.triggered.connect(self.settingsStatus)
|
self.actStatus.triggered.connect(self.settingsStatus)
|
||||||
self.actSettings.triggered.connect(self.settingsWindow)
|
self.actSettings.triggered.connect(self.settingsWindow)
|
||||||
|
@ -1070,4 +1072,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||||
self.mainEditor.updateTreeView()
|
self.mainEditor.updateTreeView()
|
||||||
self.treePlanOutline.viewport().update()
|
self.treePlanOutline.viewport().update()
|
||||||
if item == "Tree":
|
if item == "Tree":
|
||||||
self.treeRedacOutline.viewport().update()
|
self.treeRedacOutline.viewport().update()
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# COMPILE
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def doCompile(self):
|
||||||
|
self.compileDialog = compileDialog()
|
||||||
|
self.compileDialog.show()
|
|
@ -619,6 +619,9 @@ class outlineItem():
|
||||||
def isText(self):
|
def isText(self):
|
||||||
return self._data[Outline.type] == "txt"
|
return self._data[Outline.type] == "txt"
|
||||||
|
|
||||||
|
def text(self):
|
||||||
|
return self.data(Outline.text.value)
|
||||||
|
|
||||||
def compile(self):
|
def compile(self):
|
||||||
if self._data[Outline.compile] in ["0", 0]:
|
if self._data[Outline.compile] in ["0", 0]:
|
||||||
return False
|
return False
|
||||||
|
|
107
src/ui/compileDialog.py
Normal file
107
src/ui/compileDialog.py
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#--!-- coding: utf8 --!--
|
||||||
|
|
||||||
|
from qt import *
|
||||||
|
from enums import *
|
||||||
|
from models.outlineModel import *
|
||||||
|
from ui.compileDialog_ui import *
|
||||||
|
from functions import *
|
||||||
|
import os
|
||||||
|
import exporter
|
||||||
|
|
||||||
|
class compileDialog(QDialog, Ui_compileDialog):
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
QDialog.__init__(self, parent)
|
||||||
|
self.setupUi(self)
|
||||||
|
|
||||||
|
self.btnPath.clicked.connect(self.getPath)
|
||||||
|
self.btnFilename.clicked.connect(self.getFilename)
|
||||||
|
|
||||||
|
self.btnCompile.clicked.connect(self.doCompile)
|
||||||
|
self.cmbTargets.activated.connect(self.updateUI)
|
||||||
|
|
||||||
|
self.txtPath.setText("/home/olivier/Documents/Travail/Geekeries/Python/manuskript/ExportTest")
|
||||||
|
self.txtFilename.setText("/home/olivier/Documents/Travail/Geekeries/Python/manuskript/ExportTest/test.html")
|
||||||
|
|
||||||
|
|
||||||
|
self.populatesTarget()
|
||||||
|
self.updateUI()
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# UI
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def populatesTarget(self):
|
||||||
|
for code in exporter.formats:
|
||||||
|
self.cmbTargets.addItem(exporter.formats[code][0], code)
|
||||||
|
|
||||||
|
def updateUI(self):
|
||||||
|
target = self.cmbTargets.currentData()
|
||||||
|
|
||||||
|
if not exporter.formats[target][1]:
|
||||||
|
self.btnCompile.setEnabled(False)
|
||||||
|
requires = []
|
||||||
|
else:
|
||||||
|
self.btnCompile.setEnabled(True)
|
||||||
|
requires = exporter.formats[target][1].requires
|
||||||
|
|
||||||
|
self.wPath.setVisible("path" in requires)
|
||||||
|
self.wFilename.setVisible("filename" in requires)
|
||||||
|
|
||||||
|
def startWorking(self):
|
||||||
|
# Setting override cursor
|
||||||
|
qApp.setOverrideCursor(Qt.WaitCursor)
|
||||||
|
|
||||||
|
# Button
|
||||||
|
self.btnCompile.setEnabled(False)
|
||||||
|
self.txtBtn = self.btnCompile.text()
|
||||||
|
self.btnCompile.setText(self.tr("Working..."))
|
||||||
|
|
||||||
|
def stopWorking(self):
|
||||||
|
# Removing override cursor
|
||||||
|
qApp.restoreOverrideCursor()
|
||||||
|
|
||||||
|
# Button
|
||||||
|
self.btnCompile.setEnabled(True)
|
||||||
|
self.btnCompile.setText(self.txtBtn)
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# USER INPUTS
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def getPath(self):
|
||||||
|
path = self.txtPath.text()
|
||||||
|
path = QFileDialog.getExistingDirectory(self, self.tr("Chose export folder"), path)
|
||||||
|
if path:
|
||||||
|
self.txtPath.setText(path)
|
||||||
|
|
||||||
|
def getFilename(self):
|
||||||
|
fn = self.txtFilename.text()
|
||||||
|
target = self.cmbTargets.currentData()
|
||||||
|
fltr = exporter.formats[target][2]
|
||||||
|
fn = QFileDialog.getSaveFileName(self, self.tr("Chose export target"), fn, fltr)
|
||||||
|
|
||||||
|
if fn[0]:
|
||||||
|
self.txtFilename.setText(fn[0])
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# COMPILE
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
def doCompile(self):
|
||||||
|
target = self.cmbTargets.currentData()
|
||||||
|
|
||||||
|
self.startWorking()
|
||||||
|
|
||||||
|
if target == "arbo":
|
||||||
|
compiler = exporter.formats[target][1]()
|
||||||
|
compiler.doCompile(self.txtPath.text())
|
||||||
|
|
||||||
|
elif target in ["html", "odt"]:
|
||||||
|
compiler = exporter.formats[target][1]()
|
||||||
|
compiler.doCompile(self.txtFilename.text())
|
||||||
|
|
||||||
|
self.stopWorking()
|
||||||
|
|
88
src/ui/compileDialog_ui.py
Normal file
88
src/ui/compileDialog_ui.py
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'src/ui/compileDialog_ui.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.4.1
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
class Ui_compileDialog(object):
|
||||||
|
def setupUi(self, compileDialog):
|
||||||
|
compileDialog.setObjectName("compileDialog")
|
||||||
|
compileDialog.resize(627, 343)
|
||||||
|
compileDialog.setModal(True)
|
||||||
|
self.verticalLayout = QtWidgets.QVBoxLayout(compileDialog)
|
||||||
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
|
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||||
|
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem)
|
||||||
|
self.label = QtWidgets.QLabel(compileDialog)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.horizontalLayout.addWidget(self.label)
|
||||||
|
self.cmbTargets = QtWidgets.QComboBox(compileDialog)
|
||||||
|
self.cmbTargets.setObjectName("cmbTargets")
|
||||||
|
self.horizontalLayout.addWidget(self.cmbTargets)
|
||||||
|
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout.addItem(spacerItem1)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
self.wPath = QtWidgets.QWidget(compileDialog)
|
||||||
|
self.wPath.setObjectName("wPath")
|
||||||
|
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.wPath)
|
||||||
|
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||||
|
self.label_2 = QtWidgets.QLabel(self.wPath)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.horizontalLayout_3.addWidget(self.label_2)
|
||||||
|
self.txtPath = QtWidgets.QLineEdit(self.wPath)
|
||||||
|
self.txtPath.setObjectName("txtPath")
|
||||||
|
self.horizontalLayout_3.addWidget(self.txtPath)
|
||||||
|
self.btnPath = QtWidgets.QPushButton(self.wPath)
|
||||||
|
self.btnPath.setObjectName("btnPath")
|
||||||
|
self.horizontalLayout_3.addWidget(self.btnPath)
|
||||||
|
self.verticalLayout.addWidget(self.wPath)
|
||||||
|
self.wFilename = QtWidgets.QWidget(compileDialog)
|
||||||
|
self.wFilename.setObjectName("wFilename")
|
||||||
|
self.horizontalLayout_4 = QtWidgets.QHBoxLayout(self.wFilename)
|
||||||
|
self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||||
|
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||||
|
self.label_3 = QtWidgets.QLabel(self.wFilename)
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.horizontalLayout_4.addWidget(self.label_3)
|
||||||
|
self.txtFilename = QtWidgets.QLineEdit(self.wFilename)
|
||||||
|
self.txtFilename.setObjectName("txtFilename")
|
||||||
|
self.horizontalLayout_4.addWidget(self.txtFilename)
|
||||||
|
self.btnFilename = QtWidgets.QPushButton(self.wFilename)
|
||||||
|
self.btnFilename.setObjectName("btnFilename")
|
||||||
|
self.horizontalLayout_4.addWidget(self.btnFilename)
|
||||||
|
self.verticalLayout.addWidget(self.wFilename)
|
||||||
|
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||||
|
self.verticalLayout.addItem(spacerItem2)
|
||||||
|
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||||
|
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||||
|
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||||
|
self.horizontalLayout_2.addItem(spacerItem3)
|
||||||
|
self.btnCompile = QtWidgets.QPushButton(compileDialog)
|
||||||
|
self.btnCompile.setObjectName("btnCompile")
|
||||||
|
self.horizontalLayout_2.addWidget(self.btnCompile)
|
||||||
|
self.btnCancel = QtWidgets.QPushButton(compileDialog)
|
||||||
|
self.btnCancel.setObjectName("btnCancel")
|
||||||
|
self.horizontalLayout_2.addWidget(self.btnCancel)
|
||||||
|
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||||
|
|
||||||
|
self.retranslateUi(compileDialog)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(compileDialog)
|
||||||
|
|
||||||
|
def retranslateUi(self, compileDialog):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
compileDialog.setWindowTitle(_translate("compileDialog", "Dialog"))
|
||||||
|
self.label.setText(_translate("compileDialog", "Compile as:"))
|
||||||
|
self.label_2.setText(_translate("compileDialog", "Folder:"))
|
||||||
|
self.btnPath.setText(_translate("compileDialog", "..."))
|
||||||
|
self.label_3.setText(_translate("compileDialog", "File name:"))
|
||||||
|
self.btnFilename.setText(_translate("compileDialog", "..."))
|
||||||
|
self.btnCompile.setText(_translate("compileDialog", "Compile"))
|
||||||
|
self.btnCancel.setText(_translate("compileDialog", "Cancel"))
|
||||||
|
|
154
src/ui/compileDialog_ui.ui
Normal file
154
src/ui/compileDialog_ui.ui
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>compileDialog</class>
|
||||||
|
<widget class="QDialog" name="compileDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>627</width>
|
||||||
|
<height>343</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Compile as:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cmbTargets"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="wPath" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Folder:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtPath"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnPath">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="wFilename" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>File name:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtFilename"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnFilename">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnCompile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Compile</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnCancel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -1019,12 +1019,16 @@ class Ui_MainWindow(object):
|
||||||
icon = QtGui.QIcon.fromTheme("window-close")
|
icon = QtGui.QIcon.fromTheme("window-close")
|
||||||
self.actCloseProject.setIcon(icon)
|
self.actCloseProject.setIcon(icon)
|
||||||
self.actCloseProject.setObjectName("actCloseProject")
|
self.actCloseProject.setObjectName("actCloseProject")
|
||||||
|
self.actCompile = QtWidgets.QAction(MainWindow)
|
||||||
|
self.actCompile.setObjectName("actCompile")
|
||||||
self.menuFile.addAction(self.actOpen)
|
self.menuFile.addAction(self.actOpen)
|
||||||
self.menuFile.addAction(self.menuRecents.menuAction())
|
self.menuFile.addAction(self.menuRecents.menuAction())
|
||||||
self.menuFile.addAction(self.actSave)
|
self.menuFile.addAction(self.actSave)
|
||||||
self.menuFile.addAction(self.actSaveAs)
|
self.menuFile.addAction(self.actSaveAs)
|
||||||
self.menuFile.addAction(self.actCloseProject)
|
self.menuFile.addAction(self.actCloseProject)
|
||||||
self.menuFile.addSeparator()
|
self.menuFile.addSeparator()
|
||||||
|
self.menuFile.addAction(self.actCompile)
|
||||||
|
self.menuFile.addSeparator()
|
||||||
self.menuFile.addAction(self.actQuit)
|
self.menuFile.addAction(self.actQuit)
|
||||||
self.menuMode.addAction(self.actModeNorma)
|
self.menuMode.addAction(self.actModeNorma)
|
||||||
self.menuMode.addAction(self.actModeSimple)
|
self.menuMode.addAction(self.actModeSimple)
|
||||||
|
@ -1168,18 +1172,20 @@ class Ui_MainWindow(object):
|
||||||
self.actSettings.setText(_translate("MainWindow", "Settings"))
|
self.actSettings.setText(_translate("MainWindow", "Settings"))
|
||||||
self.actSettings.setShortcut(_translate("MainWindow", "F8"))
|
self.actSettings.setShortcut(_translate("MainWindow", "F8"))
|
||||||
self.actCloseProject.setText(_translate("MainWindow", "Close project"))
|
self.actCloseProject.setText(_translate("MainWindow", "Close project"))
|
||||||
|
self.actCompile.setText(_translate("MainWindow", "Compile"))
|
||||||
|
self.actCompile.setShortcut(_translate("MainWindow", "F6"))
|
||||||
|
|
||||||
from ui.editors.mainEditor import mainEditor
|
from ui.views.persoTreeView import persoTreeView
|
||||||
from ui.views.metadataView import metadataView
|
from ui.cheatSheet import cheatSheet
|
||||||
from ui.search import search
|
from ui.search import search
|
||||||
from ui.views.outlineView import outlineView
|
from ui.views.outlineView import outlineView
|
||||||
from ui.collapsibleGroupBox2 import collapsibleGroupBox2
|
|
||||||
from ui.views.persoTreeView import persoTreeView
|
|
||||||
from ui.sldImportance import sldImportance
|
|
||||||
from ui.views.basicItemView import basicItemView
|
|
||||||
from ui.views.treeView import treeView
|
|
||||||
from ui.cheatSheet import cheatSheet
|
|
||||||
from ui.views.plotTreeView import plotTreeView
|
|
||||||
from ui.welcome import welcome
|
|
||||||
from ui.views.textEditView import textEditView
|
|
||||||
from ui.views.lineEditView import lineEditView
|
from ui.views.lineEditView import lineEditView
|
||||||
|
from ui.sldImportance import sldImportance
|
||||||
|
from ui.views.plotTreeView import plotTreeView
|
||||||
|
from ui.editors.mainEditor import mainEditor
|
||||||
|
from ui.collapsibleGroupBox2 import collapsibleGroupBox2
|
||||||
|
from ui.welcome import welcome
|
||||||
|
from ui.views.basicItemView import basicItemView
|
||||||
|
from ui.views.metadataView import metadataView
|
||||||
|
from ui.views.treeView import treeView
|
||||||
|
from ui.views.textEditView import textEditView
|
||||||
|
|
|
@ -1795,6 +1795,8 @@
|
||||||
<addaction name="actSaveAs"/>
|
<addaction name="actSaveAs"/>
|
||||||
<addaction name="actCloseProject"/>
|
<addaction name="actCloseProject"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actCompile"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="actQuit"/>
|
<addaction name="actQuit"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuMode">
|
<widget class="QMenu" name="menuMode">
|
||||||
|
@ -1996,6 +1998,14 @@
|
||||||
<string>Close project</string>
|
<string>Close project</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actCompile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Compile</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>F6</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -56,6 +56,9 @@ class plotTreeView(QTreeWidget):
|
||||||
if parent == QModelIndex():
|
if parent == QModelIndex():
|
||||||
self.updateItems()
|
self.updateItems()
|
||||||
|
|
||||||
|
elif self._showSubPlot:
|
||||||
|
self.updateItems()
|
||||||
|
|
||||||
def updateNames(self):
|
def updateNames(self):
|
||||||
for i in range(self.topLevelItemCount()):
|
for i in range(self.topLevelItemCount()):
|
||||||
item = self.topLevelItem(i)
|
item = self.topLevelItem(i)
|
||||||
|
|
Loading…
Reference in a new issue