diff --git a/modules/gui/pymod/init_menubar.py b/modules/gui/pymod/init_menubar.py index 574e7b21925b17a3c20e700f2baef33acbd7d937..e1d3632c1c4fd703242d729667a34101d93e83a9 100644 --- a/modules/gui/pymod/init_menubar.py +++ b/modules/gui/pymod/init_menubar.py @@ -64,6 +64,11 @@ class InitMenuBar(QtCore.QObject): self.connect(gl_win, QtCore.SIGNAL('triggered()'), self.ShowGLWin) window.addAction(gl_win) + reset = QtGui.QAction('Reset View', self) + reset.setStatusTip('Reset the Panels and Widgets') + self.connect(reset, QtCore.SIGNAL('triggered()'), self.ResetView) + window.addAction(reset) + #Options #Add file loader to menu loader_manager = QtGui.QAction('File &Loader', self) @@ -97,8 +102,23 @@ class InitMenuBar(QtCore.QObject): gl_win=gosty.GetGLWin() if gl_win and gl_win.qobject.isHidden(): gl_win.Show() - - + + def ResetView(self): + msg_box = QtGui.QMessageBox() + msg_box.setWindowTitle("Reset the Panels and Widget"); + msg_box.setText("Do you really want to reset the Panels and Widgets?"); + msg_box.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.Cancel); + msg_box.setDefaultButton(QtGui.QMessageBox.Cancel); + ret = msg_box.exec_(); + if(ret == QtGui.QMessageBox.Yes): + settings = QtCore.QSettings() + settings.setValue("restore_settings",QtCore.QVariant(False)) + info_box = QtGui.QMessageBox() + info_box.setStandardButtons(QtGui.QMessageBox.Ok) + info_box.setWindowTitle("Restart OpenStructure") + info_box.setText("You must restart OpenStructure for the changes to take effect!"); + info_box.exec_(); + def _InitMenuBar(app): InitMenuBar(app.perspective.menubar) diff --git a/scripts/init.py b/scripts/init.py index 4c9d779a90f17104e3327d4f8a7e806681e6ec74..d014205864fa5fb87021d500f8185544cdb3fd50 100644 --- a/scripts/init.py +++ b/scripts/init.py @@ -30,6 +30,14 @@ def _InitRuleBasedBuilder(): # switch to rule-based builder for high fidelity if compounds.chemlib is # available _InitRuleBasedBuilder() + +def _CheckRestore(): + settings = QtCore.QSettings() + restore = settings.value("restore_settings",QtCore.QVariant(False)).toBool() + if not restore: + settings.clear() + settings.setValue("restore_settings",QtCore.QVariant(True)) + def _InitPanels(app): panels = app.perspective.panels panels.AddWidgetToPool('ost.gui.FileBrowser', -1) @@ -49,6 +57,7 @@ def _InitPanels(app): return True def _InitFrontEnd(): + _CheckRestore() app=gui.GostyApp.Instance() app.SetAppTitle("DNG") main_area=app.perspective.main_area @@ -64,7 +73,7 @@ def _InitFrontEnd(): __import__(module_name) app.ProcessEvents() _InitInspector(app) - + def _load_files(): for pdb_id in options.pdb_ids: pdb_id, sel=_SplitIDSel(pdb_id)