def vqRestoreGuiSettings(self, settings): guid = self.vw.getVivGuid() dwcls = settings.value('%s/DockClasses' % guid) state = settings.value('%s/DockState' % guid) geom = settings.value('%s/DockGeometry' % guid) stub = '%s/' % guid if compat_isNone(dwcls): names = self.vw.filemeta.keys() names.sort() name = '+'.join(names) dwcls = settings.value('%s/DockClasses' % name) state = settings.value('%s/DockState' % name) geom = settings.value('%s/DockGeometry' % name) stub = '%s/' % name if compat_isNone(dwcls): dwcls = settings.value('DockClasses') state = settings.value('DockState') geom = settings.value('DockGeometry') stub = '' if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup != None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings, name, stub) d.show() except Exception, e: print('Error Building: %s: %s' % (clsname, e))
def vqRestoreGuiSettings(self, settings, stub=''): dwcls = settings.value('DockClasses') if not compat_isNone(dwcls): for i, clsname in enumerate(dwcls): name = 'VQDockWidget%d' % i try: # we haven't loaded the extensions yet, so all we'll have is the base clases if str(clsname) not in self._dock_classes: continue tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup is not None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings, name, stub) d.show() except Exception as e: logger.error('Error Building: %s: %s', clsname, e) # Once dock widgets are loaded, we can restoreState state = settings.value('DockState') if not compat_isNone(state): self.restoreState(state) geom = settings.value('DockGeometry') if not compat_isNone(geom): self.restoreGeometry(geom) # Just get all the resize activities done... vq_main.eatevents() for w in self.vqGetDockWidgets(): w.show() return True
def vqRestoreGuiSettings(self, settings): guid = self.vw.getVivGuid() dwcls = settings.value('%s/DockClasses' % guid) state = settings.value('%s/DockState' % guid) geom = settings.value('%s/DockGeometry' % guid) stub = '%s/' % guid if compat_isNone(dwcls): names = self.vw.filemeta.keys() names.sort() name = '+'.join(names) dwcls = settings.value('%s/DockClasses' % name) state = settings.value('%s/DockState' % name) geom = settings.value('%s/DockGeometry' % name) stub = '%s/' % name if compat_isNone(dwcls): dwcls = settings.value('DockClasses') state = settings.value('DockState') geom = settings.value('DockGeometry') stub = '' if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup != None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings,name,stub) d.show() except Exception, e: print('Error Building: %s: %s' % (clsname,e))
def vqRestoreGuiSettings(self, settings): guid = self.vw.getVivGuid() dwcls = settings.value('%s/DockClasses' % guid) state = settings.value('%s/DockState' % guid) geom = settings.value('%s/DockGeometry' % guid) stub = '%s/' % guid if compat_isNone(dwcls): names = self.vw.filemeta.keys() names.sort() name = '+'.join(names) dwcls = settings.value('%s/DockClasses' % name) state = settings.value('%s/DockState' % name) geom = settings.value('%s/DockGeometry' % name) stub = '%s/' % name if compat_isNone(dwcls): dwcls = settings.value('DockClasses') state = settings.value('DockState') geom = settings.value('DockGeometry') stub = '' if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup is not None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings, name, stub) d.show() except Exception as e: print('Error Building: %s: %s' % (clsname, e)) # Once dock widgets are loaded, we can restoreState if not compat_isNone(state): self.restoreState(compat_toByteArray(state)) if not compat_isNone(geom): self.restoreGeometry(compat_toByteArray(geom)) # Just get all the resize activities done... vq_main.eatevents() for w in self.vqGetDockWidgets(): w.show() return True
def vqRestoreGuiSettings(self, settings, stub=''): dwcls = settings.value('DockClasses') if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup != None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings,name,stub) d.show() except Exception, e: print('Error Building: %s: %s' % (clsname,e))
def vqRestoreGuiSettings(self, settings, stub=''): dwcls = settings.value('DockClasses') if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup != None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings, name, stub) d.show() except Exception, e: print('Error Building: %s: %s' % (clsname, e))
if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup != None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings, name, stub) d.show() except Exception, e: print('Error Building: %s: %s' % (clsname, e)) # Once dock widgets are loaded, we can restoreState if not compat_isNone(state): self.restoreState(compat_toByteArray(state)) if not compat_isNone(geom): self.restoreGeometry(compat_toByteArray(geom)) # Just get all the resize activities done... vq_main.eatevents() for w in self.vqGetDockWidgets(): w.show() return True def vqSaveGuiSettings(self, settings): dock_classes = []
if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup != None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings,name,stub) d.show() except Exception, e: print('Error Building: %s: %s' % (clsname,e)) # Once dock widgets are loaded, we can restoreState if not compat_isNone(state): self.restoreState(compat_toByteArray(state)) if not compat_isNone(geom): self.restoreGeometry(compat_toByteArray(geom)) # Just get all the resize activities done... vq_main.eatevents() for w in self.vqGetDockWidgets(): w.show() return True def vqSaveGuiSettings(self, settings): dock_classes = []
class VQMainCmdWindow(vq_hotkey.HotKeyMixin, QMainWindow): ''' A base class for application window's to inherit from. ''' __cli_widget_class__ = vq_cli.VQCli def __init__(self, appname, cmd, **kwargs): super(QMainWindow, self).__init__(**kwargs) vq_hotkey.HotKeyMixin.__init__(self) self._vq_appname = appname self._vq_dockwidgets = [] self._vq_settings = QtCore.QSettings('invisigoth', application=appname, parent=self) self._vq_histfile = os.path.join(os.path.expanduser('~'), '.%s_history' % appname) self._dock_classes = {} self.vqInitDockWidgetClasses() self._vq_mbar = vq_menu.VQMenuBar() self.setMenuBar(self._vq_mbar) # AnimatedDocks, AllowNestedDocks, AllowTabbedDocks, ForceTabbedDocks, VerticalTabs self.setDockOptions(self.AnimatedDocks | self.AllowTabbedDocks) self._vq_cli = self.__cli_widget_class__(cmd) self._vq_cli.input.loadHistory(self._vq_histfile) self._vq_cli.sigCliQuit.connect(self.close) self.setCentralWidget(self._vq_cli) self.vqRestoreGuiSettings(self._vq_settings) def vqAddMenuField(self, fname, callback, args=()): self._vq_mbar.addField(fname, callback, args=args) def vqAddDynMenu(self, fname, callback): self._vq_mbar.addDynMenu(fname, callback) def vqInitDockWidgetClasses(self): # apps can over-ride pass def vqAddDockWidgetClass(self, cls, args=()): self._dock_classes[cls.__name__] = (cls, args) def vqBuildDockWidget(self, clsname, floating=False, area=QtCore.Qt.TopDockWidgetArea): res = self._dock_classes.get(clsname) if res == None: print('vqBuildDockWidget Failed For: %s' % clsname) return cls, args = res obj = cls(*args) return self.vqDockWidget(obj, area, floating=floating), obj def vqRestoreGuiSettings(self, settings, stub=''): dwcls = settings.value('DockClasses') if not compat_isNone(dwcls): for i, clsname in enumerate(compat_strList(dwcls)): name = 'VQDockWidget%d' % i try: tup = self.vqBuildDockWidget(str(clsname), floating=False) if tup != None: d, obj = tup d.setObjectName(name) d.vqRestoreState(settings, name, stub) d.show() except Exception, e: print('Error Building: %s: %s' % (clsname, e)) # Once dock widgets are loaded, we can restoreState state = settings.value('DockState') if not compat_isNone(state): self.restoreState(compat_toByteArray(state)) geom = settings.value('DockGeometry') if not compat_isNone(geom): self.restoreGeometry(compat_toByteArray(geom)) # Just get all the resize activities done... vq_main.eatevents() for w in self.vqGetDockWidgets(): w.show() return True