def __init__(self, plugin): logging.debug(__name__ + ": __init__") BrowserTabController.__init__(self, plugin) self._editorName = "" self._thread = None self._originalSizes=[100,1,200] self._toolDialog=None self._updateCenterView=False self.setEditable(False) self._configMenu = self.plugin().application().createPluginMenu('&Config') self._configToolBar = self.plugin().application().createPluginToolBar('&Config') openEditorAction = self.plugin().application().createAction('&Open in custom editor', self.openEditor, "F6") self._configMenu.addAction(openEditorAction) chooseEditorAction = self.plugin().application().createAction('&Choose custom editor...', self.chooseEditor, "Ctrl+T") self._configMenu.addAction(chooseEditorAction) self._configMenu.addSeparator() self._dumpAction = self.plugin().application().createAction('&Dump python config to single file...', self.dumpPython, "Ctrl+D") self._configMenu.addAction(self._dumpAction) self._dotExportAction = self.plugin().application().createAction('&Export dot graphic...', self.exportDot, "Ctrl+G") self._configMenu.addAction(self._dotExportAction) self._historyAction = self.plugin().application().createAction('&Show history...', self.history, "Ctrl+H") self._configMenu.addAction(self._historyAction) self._eventContentAction = self.plugin().application().createAction('&Browse event content...', self.eventContent, "Ctrl+Shift+C") self._configMenu.addAction(self._eventContentAction) self._configMenu.addSeparator() self._editorAction = self.plugin().application().createAction('&Edit using ConfigEditor', self.startEditMode, "F8") self._configMenu.addAction(self._editorAction) self._configToolBar.addAction(self._editorAction)
def __init__(self, plugin): logging.debug(__name__ + ": __init__") BrowserTabController.__init__(self, plugin) self.setEditable(False) self._thread = None self._navigateTo = None self.connect(self, SIGNAL("navigate"), self.navigate)
def activated(self): """ Show event menu when tab is shown. """ BrowserTabController.activated(self) self.updateEventNumberDisplay() if not self.isEditable(): self.plugin().application().showPluginMenu(self.plugin().navigateMenu()) self.plugin().application().showPluginToolBar(self.plugin().navigateToolBar())
def __init__(self, plugin): logging.debug(__name__ + ": __init__") BrowserTabController.__init__(self, plugin) self.setEditable(False) self._thread=None self._navigateTo=None self.connect(self,SIGNAL("navigate"),self.navigate)
def activated(self): """ Show event menu when tab is shown. """ BrowserTabController.activated(self) self.updateEventNumberDisplay() if not self.isEditable(): self.plugin().application().showPluginMenu( self.plugin().navigateMenu()) self.plugin().application().showPluginToolBar( self.plugin().navigateToolBar())
def activated(self): """ Shows plugin menus when user selects tab. """ logging.debug(__name__ + ": activated()") BrowserTabController.activated(self) self.plugin().application().showPluginMenu(self._configMenu) self.plugin().application().showPluginToolBar(self._configToolBar) self._editorAction.setVisible(not self.tab().editorSplitter()) if self.tab().editorSplitter(): self._applyPatToolAction.setVisible(self.dataAccessor().process()!=None) self.tab().mainWindow().application().showZoomToolBar()
def activated(self): """ Shows plugin menus when user selects tab. """ logging.debug(__name__ + ": activated()") BrowserTabController.activated(self) self.plugin().application().showPluginMenu(self._configMenu) self.plugin().application().showPluginToolBar(self._configToolBar) self._editorAction.setVisible(not self.tab().editorSplitter()) if self.tab().editorSplitter(): self._applyPatToolAction.setVisible( self.dataAccessor().process() != None) self.tab().mainWindow().application().showZoomToolBar()
def save(self, filename=''): logging.debug(__name__ + ': save') self.startEditMode() if filename != "": if os.path.basename(filename) == os.path.basename(self.dataAccessor().configFile()): logging.error(self.__class__.__name__ +": save() - "+"Cannot use name of original configuration file: "+str(filename)) self.plugin().application().errorMessage("Cannot use name of original configuration file.") elif BrowserTabController.save(self, filename): self.dataAccessor().setIsReplaceConfig() return True else: return False elif self.dataAccessor().isReplaceConfig(): return BrowserTabController.save(self, filename) return self.tab().mainWindow().application().saveFileAsDialog()
def testBrowser(self): logging.debug(self.__class__.__name__ +': testRun()') self.app=Application(sys.argv) self.app.mainWindow().setWindowTitle("test Browser") self.plugin=BrowserPlugin(self.app) self.plugin.startUp() self.tab = BrowserTab(self.app.mainWindow()) self.controller = BrowserTabController(self.plugin) self.controller.setDataAccessor(TestDataAccessor()) self.tab.setController(self.controller) self.app.mainWindow().addTab(self.tab) self.controller.updateContent() self.controller.updateViewMenu() if not hasattr(unittest,"NO_GUI_TEST"): self.app.run()
def close(self): """ Close data file. """ result = BrowserTabController.close(self) if result: self.dataAccessor().close() return result
def close(self): """ Close data file. """ result=BrowserTabController.close(self) if result: self.dataAccessor().close() return result
def save(self, filename=''): logging.debug(__name__ + ': save') self.startEditMode() if filename != "": if os.path.basename(filename) == os.path.basename( self.dataAccessor().configFile()): logging.error( self.__class__.__name__ + ": save() - " + "Cannot use name of original configuration file: " + str(filename)) self.plugin().application().errorMessage( "Cannot use name of original configuration file.") elif BrowserTabController.save(self, filename): self.dataAccessor().setIsReplaceConfig() return True else: return False elif self.dataAccessor().isReplaceConfig(): return BrowserTabController.save(self, filename) return self.tab().mainWindow().application().saveFileAsDialog()
def __init__(self, plugin): logging.debug(__name__ + ": __init__") BrowserTabController.__init__(self, plugin) self._editorName = "" self._thread = None self._originalSizes = [100, 1, 200] self._toolDialog = None self._updateCenterView = False self.setEditable(False) self._configMenu = self.plugin().application().createPluginMenu( '&Config') self._configToolBar = self.plugin().application().createPluginToolBar( '&Config') openEditorAction = self.plugin().application().createAction( '&Open in custom editor', self.openEditor, "F6") self._configMenu.addAction(openEditorAction) chooseEditorAction = self.plugin().application().createAction( '&Choose custom editor...', self.chooseEditor, "Ctrl+T") self._configMenu.addAction(chooseEditorAction) self._configMenu.addSeparator() self._dumpAction = self.plugin().application().createAction( '&Dump python config to single file...', self.dumpPython, "Ctrl+D") self._configMenu.addAction(self._dumpAction) self._dotExportAction = self.plugin().application().createAction( '&Export dot graphic...', self.exportDot, "Ctrl+G") self._configMenu.addAction(self._dotExportAction) self._historyAction = self.plugin().application().createAction( '&Show history...', self.history, "Ctrl+H") self._configMenu.addAction(self._historyAction) self._eventContentAction = self.plugin().application().createAction( '&Browse event content...', self.eventContent, "Ctrl+Shift+C") self._configMenu.addAction(self._eventContentAction) self._configMenu.addSeparator() self._editorAction = self.plugin().application().createAction( '&Edit using ConfigEditor', self.startEditMode, "F8") self._configMenu.addAction(self._editorAction) self._configToolBar.addAction(self._editorAction)
def refresh(self): self.tab().propertyView().setDataObject(None) BrowserTabController.refresh(self)
def setDataAccessor(self, accessor): if not isinstance(accessor, EventFileAccessor): raise TypeError(__name__ + " requires data accessor of type EventFileAccessor.") BrowserTabController.setDataAccessor(self, accessor)
def scriptChanged(self, script): BrowserTabController.scriptChanged(self, script) self.saveIni()
def isBusy(self): return BrowserTabController.isBusy(self) or\ (self._thread and self._thread.isRunning())
def isBusy(self): return BrowserTabController.isBusy(self) or\ (self._thread and self._thread.isRunning())
def scriptChanged(self, script): BrowserTabController.scriptChanged(self, script) self.saveIni()
def setDataAccessor(self, accessor): if not isinstance(accessor, EventFileAccessor): raise TypeError( __name__ + " requires data accessor of type EventFileAccessor.") BrowserTabController.setDataAccessor(self, accessor)
def open(self, filename=None, update=True): if BrowserTabController.open(self, filename, update): if self.dataAccessor().isReplaceConfig(): self.startEditMode() return True return False
def onSelected(self, select): self.selectDataAccessor(select) BrowserTabController.onSelected(self, select)
def select(self, object): self.selectDataAccessor(object) BrowserTabController.select(self, object)
def refresh(self): self.tab().propertyView().setDataObject(None) BrowserTabController.refresh(self)
def open(self, filename=None, update=True): if BrowserTabController.open(self, filename, update): if self.dataAccessor().isReplaceConfig(): self.startEditMode() return True return False
def onSelected(self, select): self.selectDataAccessor(select) BrowserTabController.onSelected(self, select)
def updateContent(self, filtered=False, propertyView=True): if import_tools_error==None and isinstance(object,ConfigToolBase): propertyView=False else: self.tab().propertyView().setDataAccessor(self.dataAccessor()) BrowserTabController.updateContent(self, filtered, propertyView)
def updateContent(self, filtered=False, propertyView=True): if import_tools_error == None and isinstance(object, ConfigToolBase): propertyView = False else: self.tab().propertyView().setDataAccessor(self.dataAccessor()) BrowserTabController.updateContent(self, filtered, propertyView)
def select(self, object): self.selectDataAccessor(object) BrowserTabController.select(self, object)
def updateViewMenu(self): BrowserTabController.updateViewMenu(self) self.disconnect(self.tab().centerView(), SIGNAL("doubleClicked"), self.onCenterViewDoubleClicked) self.connect(self.tab().centerView(), SIGNAL("doubleClicked"), self.onCenterViewDoubleClicked)
def updateViewMenu(self): BrowserTabController.updateViewMenu(self) self.disconnect(self.tab().centerView(), SIGNAL("doubleClicked"), self.onCenterViewDoubleClicked) self.connect(self.tab().centerView(), SIGNAL("doubleClicked"), self.onCenterViewDoubleClicked)