Пример #1
0
 def create(self, pluginDefinition):
     name = pluginDefinition[PluginManager.NAME]
     module = importlib.import_module(pluginDefinition[PluginManager.MODULE])
     panelClass = getattr(module, pluginDefinition[PluginManager.CLASS])
     size = pluginDefinition[PluginManager.SIZE]
     panel = panelClass(util.getMainFrame(), pluginDefinition)
     location = pluginDefinition[PluginManager.LOCATION] if PluginManager.LOCATION in pluginDefinition else PluginManager.FLOAT
     auiManager = util.auiManager()
     paneInfo = aui.AuiPaneInfo()
     paneInfo = paneInfo.Caption(name).Name(name).BestSize(size)
     if location == PluginManager.TOP:
         paneInfo = paneInfo.Top()
     elif location == PluginManager.BOTTOM:
         paneInfo = paneInfo.Bottom()
     elif location == PluginManager.LEFT:
         paneInfo = paneInfo.Left()
     elif location == PluginManager.RIGHT:
         paneInfo = paneInfo.Right()
     elif location == PluginManager.FLOAT:
         paneInfo = paneInfo.Float()
     elif location == PluginManager.CENTER:
         paneInfo = paneInfo.Center()
     else:
         logging.error("Unknown Location: %s", location)
         paneInfo = paneInfo.Float()
     auiManager.AddPane(panel, paneInfo)
     if PluginManager.VISIBLE in pluginDefinition:
         self.showPlugin(name, pvscomm.PVSCommandManager().pvsMode in pluginDefinition[PluginManager.VISIBLE])
     else:
         self.showPlugin(name, False)            
     auiManager.Update()
     pub.sendMessage(PUB_ADDITEMTOVIEWMENU, name=name, callBackFunction=(lambda ce: self.togglePluginVisibility(name)))
     return None
Пример #2
0
 def create(self, pluginDefinition):
     name = pluginDefinition[PluginManager.NAME]
     module = importlib.import_module(
         pluginDefinition[PluginManager.MODULE])
     panelClass = getattr(module, pluginDefinition[PluginManager.CLASS])
     size = pluginDefinition[PluginManager.SIZE]
     panel = panelClass(util.getMainFrame(), pluginDefinition)
     location = pluginDefinition[
         PluginManager.
         LOCATION] if PluginManager.LOCATION in pluginDefinition else PluginManager.FLOAT
     auiManager = util.auiManager()
     paneInfo = aui.AuiPaneInfo()
     paneInfo = paneInfo.Caption(name).Name(name).BestSize(size)
     if location == PluginManager.TOP:
         paneInfo = paneInfo.Top()
     elif location == PluginManager.BOTTOM:
         paneInfo = paneInfo.Bottom()
     elif location == PluginManager.LEFT:
         paneInfo = paneInfo.Left()
     elif location == PluginManager.RIGHT:
         paneInfo = paneInfo.Right()
     elif location == PluginManager.FLOAT:
         paneInfo = paneInfo.Float()
     elif location == PluginManager.CENTER:
         paneInfo = paneInfo.Center()
     else:
         logging.error("Unknown Location: %s", location)
         paneInfo = paneInfo.Float()
     auiManager.AddPane(panel, paneInfo)
     if PluginManager.VISIBLE in pluginDefinition:
         self.showPlugin(
             name,
             pvscomm.PVSCommandManager().pvsMode
             in pluginDefinition[PluginManager.VISIBLE])
     else:
         self.showPlugin(name, False)
     auiManager.Update()
     pub.sendMessage(
         PUB_ADDITEMTOVIEWMENU,
         name=name,
         callBackFunction=(lambda ce: self.togglePluginVisibility(name)))
     return None
Пример #3
0
 def destroy(self, name):
     plugin = self.getPlugin(name)
     plugin.Destroy()
     util.auiManager().Update()
Пример #4
0
 def getPlugin(self, name):
     paneInfo = util.auiManager().GetPane(name)
     if not paneInfo.IsOk():
         raise util.PVSIDEException("There is no panel with the name '%s'" %
                                    name)
     return paneInfo
Пример #5
0
 def showPlugin(self, name, visible):
     logging.debug("Name: %s Visibility: %s", name, visible)
     paneInfo = self.getPlugin(name)
     paneInfo.Show(visible)
     util.auiManager().Update()
Пример #6
0
 def getPlugin(self, name):
     paneInfo = util.auiManager().GetPane(name)
     if not paneInfo.IsOk():
         raise util.PVSIDEException("There is no panel with the name '%s'"%name)
     return paneInfo
Пример #7
0
 def showPlugin(self, name, visible):
     logging.debug("Name: %s Visibility: %s", name, visible)
     paneInfo = self.getPlugin(name)
     paneInfo.Show(visible)
     util.auiManager().Update()
Пример #8
0
 def destroy(self, name):
     plugin = self.getPlugin(name)
     plugin.Destroy()
     util.auiManager().Update()