AppCommand.py (842B)
1 import os 2 import FreeCAD 3 import FreeCADGui as Gui 4 import PySide 5 from PySide import QtGui 6 from PySide import QtCore 7 8 import ExternalAppsList 9 import Embed 10 11 class AppCommand(): 12 def __init__(self, appName): 13 self.appName = appName 14 15 def GetResources(self): 16 return { 17 'Pixmap': ExternalAppsList.apps[self.appName].Icon, 18 'Accel': "Shit+E", # E for Embed 19 'MenuText': "Start " + self.appName, 20 'ToolTip': "Start " + self.appName, 21 } 22 23 def Activated(self): 24 p = Embed.ExternalAppInstance(self.appName) 25 p.waitForWindow() 26 27 def IsActive(self): 28 # return false to grey out the command in the menus, toolbars etc. 29 return True 30 31 def createCommands(appName): 32 Gui.addCommand('ExternalAppsOpen' + appName + 'Command', AppCommand(appName))