Skip to content
Snippets Groups Projects
Commit b1d3c9ef authored by Andreas Bolin's avatar Andreas Bolin
Browse files

added menu option to hide exit dialog

parent d2b76693
No related branches found
No related tags found
1 merge request!78Add scheduler GUI
Pipeline #72853 passed
......@@ -138,6 +138,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.menu_save_as .triggered .connect(self.save_as)
self.menu_quit .triggered .connect(self.close)
self.menu_node_info .triggered .connect(self.toggle_component_info)
self.menu_exit_dialog .triggered .connect(self.toggle_exit_dialog)
self.splitter_center .splitterMoved .connect(self._splitter_center_moved)
# Setup event member functions
......@@ -226,6 +227,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
#TODO: self.open(schedule_obj_list[ret_tuple[0])
self._schedules[self._schedule_id] = schedule
self._schedule_id += 1
print(self._schedule_id)
pprint(self._schedules)
self.printButtonPressed('load_sfg()')
......@@ -258,6 +260,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
else:
settings.setValue("mainwindow/splitter_center/last_state", self.splitter_center.saveState())
self.splitter_center.moveSplitter(range[1], 1)
@Slot(bool)
def toggle_exit_dialog(self, checked: bool):
s = QSettings()
s.setValue("mainwindow/hide_exit_dialog", checked)
@Slot(int, int)
def _splitter_center_moved(self, pos: int, index: int) -> None:
......@@ -344,11 +352,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if s.value('mainwindow/maximized', defaultValue=False, type=bool):
self.showMaximized()
else:
self.move( s.value('mainwindow/pos', defaultValue=self.pos()))
self.resize( s.value('mainwindow/size', defaultValue=self.size()))
self.restoreState( s.value('mainwindow/state', defaultValue=QByteArray()))
self.menu_node_info.setChecked( s.value('mainwindow/menu/node_info', defaultValue=True, type=bool))
self.splitter_center.restoreState( s.value('mainwindow/splitter/state', defaultValue=QByteArray()))
self.move( s.value('mainwindow/pos', self.pos()))
self.resize( s.value('mainwindow/size', self.size()))
self.restoreState( s.value('mainwindow/state', QByteArray()))
self.menu_node_info.setChecked( s.value('mainwindow/menu/node_info', True, bool))
self.splitter_center.restoreState( s.value('mainwindow/splitter/state', QByteArray()))
self.menu_exit_dialog.setChecked(s.value('mainwindow/hide_exit_dialog', False, bool))
log.debug('Settings read from \'{}\'.'.format(s.fileName()))
......
......@@ -100,9 +100,16 @@
<string>&amp;Edit</string>
</property>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
<string>&amp;Window</string>
</property>
<addaction name="menu_exit_dialog"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menu_Edit"/>
<addaction name="menuView"/>
<addaction name="menuWindow"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="dockWidget_2">
......@@ -166,8 +173,7 @@
</widget>
<action name="menu_load_from_file">
<property name="icon">
<iconset theme="document-open-folder">
<normaloff>.</normaloff>.</iconset>
<iconset theme="document-open-folder"/>
</property>
<property name="text">
<string>&amp;Load Schedule From File...</string>
......@@ -184,8 +190,7 @@
</action>
<action name="menu_save">
<property name="icon">
<iconset theme="document-save">
<normaloff>.</normaloff>.</iconset>
<iconset theme="document-save"/>
</property>
<property name="text">
<string>&amp;Save</string>
......@@ -204,6 +209,9 @@
<property name="checked">
<bool>true</bool>
</property>
<property name="icon">
<iconset theme="application-menu"/>
</property>
<property name="text">
<string>&amp;Node Info</string>
</property>
......@@ -213,6 +221,9 @@
<property name="shortcut">
<string>Ctrl+I</string>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>
</property>
</action>
<action name="menu_quit">
<property name="icon">
......@@ -228,13 +239,23 @@
</action>
<action name="menu_save_as">
<property name="icon">
<iconset theme="document-save-as">
<normaloff>.</normaloff>.</iconset>
<iconset theme="document-save-as"/>
</property>
<property name="text">
<string>Save &amp;As...</string>
</property>
</action>
<action name="menu_exit_dialog">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Hide exit dialog</string>
</property>
<property name="toolTip">
<string>Hide exit dialog</string>
</property>
</action>
</widget>
<resources>
<include location="resources.qrc"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment