mirror of https://gitlab.com/pamhyr/pamhyr2
Configure: Add debug mode.
parent
39f6baf1a9
commit
29986079f3
|
|
@ -140,6 +140,7 @@ class ConfigureWindow(ASubWindow, ListedSubWindow):
|
||||||
def setup_sc(self):
|
def setup_sc(self):
|
||||||
self._undo_stack = QUndoStack()
|
self._undo_stack = QUndoStack()
|
||||||
|
|
||||||
|
self.debug_sc = QShortcut(QKeySequence("Ctrl+G"), self)
|
||||||
self.undo_sc = QShortcut(QKeySequence.Undo, self)
|
self.undo_sc = QShortcut(QKeySequence.Undo, self)
|
||||||
self.redo_sc = QShortcut(QKeySequence.Redo, self)
|
self.redo_sc = QShortcut(QKeySequence.Redo, self)
|
||||||
self.copy_sc = QShortcut(QKeySequence.Copy, self)
|
self.copy_sc = QShortcut(QKeySequence.Copy, self)
|
||||||
|
|
@ -173,6 +174,8 @@ class ConfigureWindow(ASubWindow, ListedSubWindow):
|
||||||
for button in buttons:
|
for button in buttons:
|
||||||
self.find(QPushButton, button).clicked.connect(buttons[button])
|
self.find(QPushButton, button).clicked.connect(buttons[button])
|
||||||
|
|
||||||
|
self.debug_sc.activated.connect(self.set_debug)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
# Solvers
|
# Solvers
|
||||||
self.conf.solvers = self.solver_table_model.rows.copy()
|
self.conf.solvers = self.solver_table_model.rows.copy()
|
||||||
|
|
@ -209,6 +212,11 @@ class ConfigureWindow(ASubWindow, ListedSubWindow):
|
||||||
self.conf.save()
|
self.conf.save()
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
def set_debug(self):
|
||||||
|
self.conf.debug = not self.conf.debug
|
||||||
|
print(f"[DEBUG] Debug mode set : {self.conf.debug}")
|
||||||
|
|
||||||
# Solvers
|
# Solvers
|
||||||
|
|
||||||
def edit_solver(self):
|
def edit_solver(self):
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
self.findChild(QAction, action).setEnabled(enable)
|
self.findChild(QAction, action).setEnabled(enable)
|
||||||
|
|
||||||
def setup_sc(self):
|
def setup_sc(self):
|
||||||
self._run_sc = QShortcut(QKeySequence("F5"), self)
|
# self._run_sc = QShortcut(QKeySequence("F5"), self)
|
||||||
|
return
|
||||||
|
|
||||||
def setup_connection(self):
|
def setup_connection(self):
|
||||||
"""Connect action to callback function
|
"""Connect action to callback function
|
||||||
|
|
@ -165,7 +166,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
.triggered.connect(actions[action])
|
.triggered.connect(actions[action])
|
||||||
# action.triggered.connect(actions[action])
|
# action.triggered.connect(actions[action])
|
||||||
|
|
||||||
self._run_sc.activated.connect(self.run_solver)
|
# self._run_sc.activated.connect(self.run_solver)
|
||||||
|
|
||||||
def changeEvent(self, event):
|
def changeEvent(self, event):
|
||||||
if event.type() == QEvent.LanguageChange:
|
if event.type() == QEvent.LanguageChange:
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -37,6 +40,9 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_solvers">
|
<widget class="QWidget" name="tab_solvers">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Solvers</string>
|
<string>Solvers</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
@ -224,6 +230,9 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="tab_backup">
|
<widget class="QWidget" name="tab_backup">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Backup</string>
|
<string>Backup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
|
@ -414,6 +423,19 @@
|
||||||
<string>Editor</string>
|
<string>Editor</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_8">
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<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 row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_11">
|
<widget class="QLabel" name="label_11">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
|
@ -422,11 +444,11 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>This value must be used for reading or editing files in speficic case</string>
|
<string>This value must be used for reading or editing files in speficic case.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
|
@ -444,18 +466,12 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="1" column="0">
|
||||||
<spacer name="verticalSpacer_5">
|
<widget class="QLabel" name="label_12">
|
||||||
<property name="orientation">
|
<property name="text">
|
||||||
<enum>Qt::Vertical</enum>
|
<string> - The "@file" keyworkd is replace by the path of file to open.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
||||||
|
|
@ -597,6 +597,9 @@
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Run solver</string>
|
<string>Run solver</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>F5</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_stop_solver">
|
<action name="action_stop_solver">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
@ -746,9 +749,6 @@
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Run solver on current study</string>
|
<string>Run solver on current study</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+X</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
</action>
|
||||||
<action name="action_toolBar_kill_solver">
|
<action name="action_toolBar_kill_solver">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ class Config(SQL):
|
||||||
self.filename = Config.filename()
|
self.filename = Config.filename()
|
||||||
self.set_default_value()
|
self.set_default_value()
|
||||||
|
|
||||||
print(self.filename)
|
|
||||||
|
|
||||||
super(Config, self).__init__(filename = self.filename)
|
super(Config, self).__init__(filename = self.filename)
|
||||||
|
|
||||||
def _create(self):
|
def _create(self):
|
||||||
|
|
@ -135,6 +133,10 @@ class Config(SQL):
|
||||||
v = self.execute("SELECT value FROM data WHERE key='lang'")
|
v = self.execute("SELECT value FROM data WHERE key='lang'")
|
||||||
self.lang = v[0]
|
self.lang = v[0]
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
v = self.execute("SELECT value FROM data WHERE key='debug'")
|
||||||
|
self.debug = v[0] == "True"
|
||||||
|
|
||||||
self._load_solver()
|
self._load_solver()
|
||||||
self._load_stricklers()
|
self._load_stricklers()
|
||||||
|
|
||||||
|
|
@ -183,6 +185,7 @@ class Config(SQL):
|
||||||
"backup_max": self.backup_max,
|
"backup_max": self.backup_max,
|
||||||
"editor": self.editor,
|
"editor": self.editor,
|
||||||
"lang": self.lang,
|
"lang": self.lang,
|
||||||
|
"debug": self.debug,
|
||||||
}
|
}
|
||||||
|
|
||||||
for key in data:
|
for key in data:
|
||||||
|
|
@ -226,6 +229,9 @@ class Config(SQL):
|
||||||
# Stricklers
|
# Stricklers
|
||||||
self.stricklers = StricklersList()
|
self.stricklers = StricklersList()
|
||||||
|
|
||||||
|
# Debug
|
||||||
|
self.debug = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def filename(cls):
|
def filename(cls):
|
||||||
file = ""
|
file = ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue