add template for Python workbench
This commit is contained in:
40
src/Tools/_TEMPLATEPY_/CMakeLists.txt
Normal file
40
src/Tools/_TEMPLATEPY_/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
IF (BUILD_GUI)
|
||||
PYSIDE_WRAP_RC(_TEMPLATEPY__QRC_SRCS Resources/_TEMPLATEPY_.qrc)
|
||||
ENDIF (BUILD_GUI)
|
||||
|
||||
SET(_TEMPLATEPY__SRCS
|
||||
Init.py
|
||||
InitGui.py
|
||||
_TEMPLATEPY_.py
|
||||
_TEMPLATEPY_Gui.py
|
||||
)
|
||||
SOURCE_GROUP("" FILES ${_TEMPLATEPY__SRCS})
|
||||
|
||||
ADD_CUSTOM_TARGET(_TEMPLATEPY_ ALL
|
||||
SOURCES ${_TEMPLATEPY__SRCS} ${_TEMPLATEPY__QRC_SRCS}
|
||||
)
|
||||
|
||||
fc_copy_sources(_TEMPLATEPY_ "${CMAKE_BINARY_DIR}/Mod/_TEMPLATEPY_" ${_TEMPLATEPY__SRCS})
|
||||
|
||||
IF (BUILD_GUI)
|
||||
fc_target_copy_resource(_TEMPLATEPY_
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}/Mod/_TEMPLATEPY_
|
||||
_TEMPLATEPY__rc.py)
|
||||
ENDIF (BUILD_GUI)
|
||||
|
||||
INSTALL(
|
||||
FILES
|
||||
${_TEMPLATEPY__SRCS}
|
||||
${_TEMPLATEPY__QRC_SRCS}
|
||||
DESTINATION
|
||||
Mod/_TEMPLATEPY_
|
||||
)
|
||||
|
||||
SET(_TEMPLATEPY_GuiIcon_SVG
|
||||
Resources/icons/_TEMPLATEPY_Workbench.svg
|
||||
)
|
||||
|
||||
fc_copy_sources(_TEMPLATEPY_ "${CMAKE_BINARY_DIR}/Mod/_TEMPLATEPY_" ${_TEMPLATEPY_GuiIcon_SVG})
|
||||
INSTALL(FILES ${_TEMPLATEPY_GuiIcon_SVG} DESTINATION "Mod/_TEMPLATEPY_/Resources/icons")
|
||||
4
src/Tools/_TEMPLATEPY_/Init.py
Normal file
4
src/Tools/_TEMPLATEPY_/Init.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# FreeCAD init script of the _TEMPLATEPY_ module
|
||||
# (c) 2001 Juergen Riegel
|
||||
# License LGPL
|
||||
21
src/Tools/_TEMPLATEPY_/InitGui.py
Normal file
21
src/Tools/_TEMPLATEPY_/InitGui.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# _TEMPLATEPY_ gui init module
|
||||
# (c) 2001 Juergen Riegel
|
||||
# License LGPL
|
||||
|
||||
class _TEMPLATEPY_Workbench ( Workbench ):
|
||||
"_TEMPLATEPY_ workbench object"
|
||||
Icon = FreeCAD.getHomePath() + "Mod/_TEMPLATEPY_/Resources/icons/_TEMPLATEPY_Workbench.svg"
|
||||
MenuText = "_TEMPLATEPY_"
|
||||
ToolTip = "_TEMPLATEPY_ workbench"
|
||||
|
||||
def Initialize(self):
|
||||
# load the module
|
||||
import _TEMPLATEPY_Gui
|
||||
self.appendToolbar('_TEMPLATEPY_',['_TEMPLATEPY__HelloWorld'])
|
||||
self.appendMenu('_TEMPLATEPY_',['_TEMPLATEPY__HelloWorld'])
|
||||
|
||||
def GetClassName(self):
|
||||
return "Gui::PythonWorkbench"
|
||||
|
||||
Gui.addWorkbench(_TEMPLATEPY_Workbench())
|
||||
5
src/Tools/_TEMPLATEPY_/Resources/_TEMPLATEPY_.qrc
Normal file
5
src/Tools/_TEMPLATEPY_/Resources/_TEMPLATEPY_.qrc
Normal file
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>icons/_TEMPLATEPY_Workbench.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
159
src/Tools/_TEMPLATEPY_/Resources/icons/_TEMPLATEPY_Workbench.svg
Normal file
159
src/Tools/_TEMPLATEPY_/Resources/icons/_TEMPLATEPY_Workbench.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.6 KiB |
3
src/Tools/_TEMPLATEPY_/_TEMPLATEPY_.dox
Normal file
3
src/Tools/_TEMPLATEPY_/_TEMPLATEPY_.dox
Normal file
@@ -0,0 +1,3 @@
|
||||
/** \defgroup TEMPLATE _TEMPLATEPY_
|
||||
* \ingroup WORKBENCHES */
|
||||
|
||||
0
src/Tools/_TEMPLATEPY_/_TEMPLATEPY_.py
Normal file
0
src/Tools/_TEMPLATEPY_/_TEMPLATEPY_.py
Normal file
16
src/Tools/_TEMPLATEPY_/_TEMPLATEPY_Gui.py
Normal file
16
src/Tools/_TEMPLATEPY_/_TEMPLATEPY_Gui.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# FreeCAD tools of the _TEMPLATEPY_ workbench
|
||||
# (c) 2001 Juergen Riegel
|
||||
# License LGPL
|
||||
|
||||
import FreeCAD, FreeCADGui
|
||||
|
||||
class CmdHelloWorld:
|
||||
def Activated(self):
|
||||
FreeCAD.Console.PrintMessage("Hello, World!\n")
|
||||
def IsActive(self):
|
||||
return True
|
||||
def GetResources(self):
|
||||
return {'Pixmap': 'freecad', 'MenuText': 'Hello World', 'ToolTip': 'Print Hello World'}
|
||||
|
||||
FreeCADGui.addCommand('_TEMPLATEPY__HelloWorld', CmdHelloWorld())
|
||||
Reference in New Issue
Block a user