|
@@ -17,7 +17,7 @@ import http.server
|
|
import threading
|
|
import threading
|
|
|
|
|
|
from PyQt5 import QtCore
|
|
from PyQt5 import QtCore
|
|
-from PyQt5.QtCore import QCoreApplication, QUrl, QFileSystemWatcher, pyqtSlot
|
|
|
|
|
|
+from PyQt5.QtCore import QCoreApplication, QUrl, QFileSystemWatcher, pyqtSlot, QSettings
|
|
from PyQt5.QtGui import QKeySequence
|
|
from PyQt5.QtGui import QKeySequence
|
|
from PyQt5.QtWidgets import QMainWindow, QWidget, QApplication, QShortcut, QGridLayout, QLabel, QTabWidget, QHBoxLayout, QVBoxLayout, QSplitter, QSplitterHandle
|
|
from PyQt5.QtWidgets import QMainWindow, QWidget, QApplication, QShortcut, QGridLayout, QLabel, QTabWidget, QHBoxLayout, QVBoxLayout, QSplitter, QSplitterHandle
|
|
# from PyQt5.QtNetwork import QNetworkProxyFactory, QNetworkRequest
|
|
# from PyQt5.QtNetwork import QNetworkProxyFactory, QNetworkRequest
|
|
@@ -30,6 +30,7 @@ class Core():
|
|
def __init__(self, parent=None):
|
|
def __init__(self, parent=None):
|
|
self.server = Server()
|
|
self.server = Server()
|
|
self.compiler = Compiler()
|
|
self.compiler = Compiler()
|
|
|
|
+ self.settings = QSettings('FiguresLibres', 'Cascade')
|
|
|
|
|
|
class Server():
|
|
class Server():
|
|
|
|
|
|
@@ -52,7 +53,6 @@ class Server():
|
|
def port(self):
|
|
def port(self):
|
|
return self._port
|
|
return self._port
|
|
|
|
|
|
-
|
|
|
|
class Compiler():
|
|
class Compiler():
|
|
def __init__(self,parent=None):
|
|
def __init__(self,parent=None):
|
|
paths = [
|
|
paths = [
|
|
@@ -74,7 +74,6 @@ class Compiler():
|
|
with open('assets/scss/main.css', 'w') as fp:
|
|
with open('assets/scss/main.css', 'w') as fp:
|
|
fp.write(scss.decode('utf8'))
|
|
fp.write(scss.decode('utf8'))
|
|
|
|
|
|
-
|
|
|
|
class WebkitView(QWebView):
|
|
class WebkitView(QWebView):
|
|
def __init__(self, port):
|
|
def __init__(self, port):
|
|
self.port = port
|
|
self.port = port
|
|
@@ -83,7 +82,6 @@ class WebkitView(QWebView):
|
|
self.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
|
|
self.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
|
|
# self.settings().setAttribute(QWebSettings.PluginsEnabled, True)
|
|
# self.settings().setAttribute(QWebSettings.PluginsEnabled, True)
|
|
|
|
|
|
-
|
|
|
|
class WebkitInspector(QWebInspector):
|
|
class WebkitInspector(QWebInspector):
|
|
def __init__(self, webkitview):
|
|
def __init__(self, webkitview):
|
|
super().__init__()
|
|
super().__init__()
|
|
@@ -122,12 +120,15 @@ class ViewTab(QWidget):
|
|
self.lbl.setText(text)
|
|
self.lbl.setText(text)
|
|
self.lbl.adjustSize()
|
|
self.lbl.adjustSize()
|
|
|
|
|
|
-
|
|
|
|
class MainWindow(QMainWindow):
|
|
class MainWindow(QMainWindow):
|
|
def __init__(self, core):
|
|
def __init__(self, core):
|
|
super(MainWindow, self).__init__()
|
|
super(MainWindow, self).__init__()
|
|
|
|
|
|
- self.setWindowFlags(QtCore.Qt.WindowTitleHint)
|
|
|
|
|
|
+ self.core = core
|
|
|
|
+
|
|
|
|
+ self.restorePreferences()
|
|
|
|
+
|
|
|
|
+ # self.setWindowFlags(QtCore.Qt.WindowTitleHint)
|
|
# QtCore.Qt.CustomizeWindowHint
|
|
# QtCore.Qt.CustomizeWindowHint
|
|
# | QtCore.Qt.Tool
|
|
# | QtCore.Qt.Tool
|
|
# | QtCore.Qt.FramelessWindowHint
|
|
# | QtCore.Qt.FramelessWindowHint
|
|
@@ -136,7 +137,6 @@ class MainWindow(QMainWindow):
|
|
|
|
|
|
|
|
|
|
self.tabwidget = QTabWidget()
|
|
self.tabwidget = QTabWidget()
|
|
-
|
|
|
|
# self.tabwidget.setStyleSheet("""
|
|
# self.tabwidget.setStyleSheet("""
|
|
# .QWidget {
|
|
# .QWidget {
|
|
# border: 1px solid black;
|
|
# border: 1px solid black;
|
|
@@ -162,19 +162,30 @@ class MainWindow(QMainWindow):
|
|
|
|
|
|
self.show()
|
|
self.show()
|
|
|
|
|
|
|
|
+ def restorePreferences(self):
|
|
|
|
+ try:
|
|
|
|
+ self.resize(self.core.settings.value('mainwindow/size', QtCore.QSize(1024, 768)))
|
|
|
|
+ self.move(self.core.settings.value('mainwindow/pos', QtCore.QPoint(0, 0)))
|
|
|
|
+ except:
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+ def savePreferences(self):
|
|
|
|
+ self.core.settings.beginGroup("mainwindow")
|
|
|
|
+ self.core.settings.setValue('size', self.size())
|
|
|
|
+ self.core.settings.setValue('pos', self.pos())
|
|
|
|
+ self.core.settings.endGroup()
|
|
|
|
+
|
|
@pyqtSlot()
|
|
@pyqtSlot()
|
|
def on_quit(self):
|
|
def on_quit(self):
|
|
print("Quit!")
|
|
print("Quit!")
|
|
|
|
+ self.savePreferences()
|
|
QCoreApplication.instance().quit()
|
|
QCoreApplication.instance().quit()
|
|
|
|
|
|
|
|
|
|
def main():
|
|
def main():
|
|
- # app = QtCore.QCoreApplication(sys.argv)
|
|
|
|
app = QApplication(sys.argv)
|
|
app = QApplication(sys.argv)
|
|
core = Core()
|
|
core = Core()
|
|
-
|
|
|
|
mainappwindow = MainWindow(core)
|
|
mainappwindow = MainWindow(core)
|
|
-
|
|
|
|
sys.exit(app.exec_())
|
|
sys.exit(app.exec_())
|
|
|
|
|
|
|
|
|