www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

ToolCommand.py (1038B)


      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 import XternalAppsParametricTool
     11 
     12 class ToolCommand():
     13     def __init__(self, appName, toolName):
     14         self.Tool = ExternalAppsList.apps[appName].Tools[toolName]
     15 
     16     def GetResources(self):
     17         return {
     18             'Pixmap':   self.Tool.Icon,
     19             #'Accel':    "Shit+T",
     20             'MenuText': self.Tool.ToolName,
     21             'ToolTip':  "Runs the " + self.Tool.ToolName + " tool from " + self.Tool.AppName + "\n\n" + self.Tool.ToolTip,
     22         }
     23 
     24     def Activated(self):
     25         XternalAppsParametricTool.create(self.Tool.AppName, self.Tool.ToolName)
     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     for toolName in ExternalAppsList.apps[appName].Tools:
     33         Gui.addCommand('ExternalAppsTool' + appName + toolName + 'Command', ToolCommand(appName, toolName))