"""
import os,sys,traceback
-from qtsalome import *
import salome
+sgPyQt = None
+
+def GetSgPyQt():
+ global sgPyQt
+ if sgPyQt is None:
+ import SalomePyQt
+ sgPyQt = SalomePyQt.SalomePyQt()
+ return sgPyQt
+
SEP=":"
if sys.platform == "win32":
SEP = ";"
-# Get SALOME PyQt interface
-import SalomePyQt
-sgPyQt = SalomePyQt.SalomePyQt()
-
# Get SALOME Swig interface
import libSALOME_Swig
sg = libSALOME_Swig.SALOMEGUI_Swig()
current_plugins_manager=None
def initialize(module,name,basemenuname,menuname):
+ # Get SALOME PyQt interface
+ sgPyQt = GetSgPyQt()
if name not in plugins:
if module:
plugins[name]={}
def find_menu(smenu):
lmenus=smenu.split("|")
# Take first element from the list
+ sgPyQt = GetSgPyQt()
main=lmenus.pop(0).strip()
menu=sgPyQt.getPopupMenu(main)
return findMenu(lmenus,menu)
class PluginsManager:
def __init__(self,module,name,basemenuname,menuname):
+ import qtsalome
+ sgPyQt = GetSgPyQt()
self.name=name
self.basemenuname=basemenuname
self.menuname=menuname
self.basemenu = find_menu(self.basemenuname)
if self.module:
- self.menu=QMenu(self.menuname)
+ self.menu=qtsalome.QMenu(self.menuname)
mid=sgPyQt.createMenu(self.menu.menuAction(),self.basemenuname)
else:
- self.menu=QMenu(self.menuname,self.basemenu)
+ self.menu=qtsalome.QMenu(self.menuname,self.basemenu)
self.basemenu.addMenu(self.menu)
self.toolbar=sgPyQt.createTool(self.menuname)
self.entries.append(name)
def handler(obj=self,script=script):
+ sgPyQt = GetSgPyQt()
try:
script(Context(sgPyQt))
except:
def updateMenu(self):
"""Update the Plugins menu"""
self.menu.clear()
+ sgPyQt = GetSgPyQt()
sgPyQt.clearTool(self.menuname)
for entry in self.entries:
names=entry.split("/")