Refactored the Gui package to CQGui to avoid naming conflicts with the Curves workbench and others.
This commit is contained in:
parent
b1225cc10c
commit
86c32c1efb
|
@ -13,19 +13,19 @@ if open.__module__ == '__builtin__':
|
||||||
|
|
||||||
|
|
||||||
def AutoExecute():
|
def AutoExecute():
|
||||||
"""We should be able to pass the Gui.Commands.CadQueryExecuteScript function directly to the file_reloaded
|
"""We should be able to pass the CQGui.Commands.CadQueryExecuteScript function directly to the file_reloaded
|
||||||
connect function, but that causes a segfault in FreeCAD. This function is a work-around for that. This
|
connect function, but that causes a segfault in FreeCAD. This function is a work-around for that. This
|
||||||
function is passed to file_reloaded signal and in turn calls the CadQueryExecuteScript.Activated function."""
|
function is passed to file_reloaded signal and in turn calls the CadQueryExecuteScript.Activated function."""
|
||||||
try:
|
try:
|
||||||
import CadQuery.Gui.Command
|
import CadQuery.Gui.Command
|
||||||
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
|
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
|
||||||
except:
|
except:
|
||||||
import Gui.Command
|
import CQGui.Command
|
||||||
Gui.Command.CadQueryExecuteScript().Activated()
|
CQGui.Command.CadQueryExecuteScript().Activated()
|
||||||
|
|
||||||
def open(filename):
|
def open(filename):
|
||||||
#All of the Gui.* calls in the Python console break after opening if we don't do this
|
#All of the CQGui.* calls in the Python console break after opening if we don't do this
|
||||||
FreeCADGui.doCommand("import FreeCADGui as Gui")
|
FreeCADGui.doCommand("import FreeCADGui as CQGui")
|
||||||
|
|
||||||
# Make sure that we enforce a specific version (2.7) of the Python interpreter
|
# Make sure that we enforce a specific version (2.7) of the Python interpreter
|
||||||
ver = hex(sys.hexversion)
|
ver = hex(sys.hexversion)
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
19
InitGui.py
19
InitGui.py
|
@ -3,12 +3,13 @@
|
||||||
# (c) 2014-2016 Jeremy Wright Apache 2.0 License
|
# (c) 2014-2016 Jeremy Wright Apache 2.0 License
|
||||||
import FreeCAD, FreeCADGui
|
import FreeCAD, FreeCADGui
|
||||||
try:
|
try:
|
||||||
from CadQuery.Gui.Command import *
|
from CadQuery.CQGui.Command import *
|
||||||
except:
|
except:
|
||||||
from Gui.Command import *
|
from CQGui.Command import *
|
||||||
import CadQuery_rc
|
import CadQuery_rc
|
||||||
|
|
||||||
class CadQueryWorkbench (Workbench):
|
class CadQueryWorkbench (Workbench):
|
||||||
|
"""CadQuery workbench for FreeCAD"""
|
||||||
"""CadQuery workbench for FreeCAD"""
|
"""CadQuery workbench for FreeCAD"""
|
||||||
MenuText = "CadQuery"
|
MenuText = "CadQuery"
|
||||||
ToolTip = "CadQuery workbench"
|
ToolTip = "CadQuery workbench"
|
||||||
|
@ -40,9 +41,9 @@ class CadQueryWorkbench (Workbench):
|
||||||
import os
|
import os
|
||||||
import module_locator
|
import module_locator
|
||||||
try:
|
try:
|
||||||
from CadQuery.Gui import ImportCQ
|
from CadQuery.CQGui import ImportCQ
|
||||||
except:
|
except:
|
||||||
from Gui import ImportCQ
|
from CQGui import ImportCQ
|
||||||
|
|
||||||
module_base_path = module_locator.module_path()
|
module_base_path = module_locator.module_path()
|
||||||
|
|
||||||
|
@ -76,15 +77,15 @@ class CadQueryWorkbench (Workbench):
|
||||||
# ImportCQ.open(template_path)
|
# ImportCQ.open(template_path)
|
||||||
|
|
||||||
def AutoExecute(self):
|
def AutoExecute(self):
|
||||||
"""We should be able to pass the Gui.Commands.CadQueryExecuteScript function directly to the file_reloaded
|
"""We should be able to pass the CQGui.Commands.CadQueryExecuteScript function directly to the file_reloaded
|
||||||
connect function, but that causes a segfault in FreeCAD. This function is a work-around for that. This
|
connect function, but that causes a segfault in FreeCAD. This function is a work-around for that. This
|
||||||
function is passed to file_reloaded signal and in turn calls the CadQueryExecuteScript.Activated function."""
|
function is passed to file_reloaded signal and in turn calls the CadQueryExecuteScript.Activated function."""
|
||||||
try:
|
try:
|
||||||
import CadQuery.Gui.Command
|
import CadQuery.CQGui.Command
|
||||||
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
|
CadQuery.CQGui.Command.CadQueryExecuteScript().Activated()
|
||||||
except:
|
except:
|
||||||
from Gui import ImportCQ
|
from CQGui import ImportCQ
|
||||||
Gui.Command.CadQueryExecuteScript().Activated()
|
CQGui.Command.CadQueryExecuteScript().Activated()
|
||||||
|
|
||||||
|
|
||||||
def Deactivated(self):
|
def Deactivated(self):
|
||||||
|
|
|
@ -80,7 +80,7 @@ class AutohotkeyLexer(RegexLexer):
|
||||||
r'FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|'
|
r'FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|'
|
||||||
r'FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|'
|
r'FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|'
|
||||||
r'FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|'
|
r'FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|'
|
||||||
r'GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|'
|
r'GroupAdd|GroupClose|GroupDeactivate|CQGui|GuiControl|'
|
||||||
r'GuiControlGet|Hotkey|IfEqual|IfExist|IfGreaterOrEqual|IfGreater|'
|
r'GuiControlGet|Hotkey|IfEqual|IfExist|IfGreaterOrEqual|IfGreater|'
|
||||||
r'IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|'
|
r'IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|'
|
||||||
r'IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|'
|
r'IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|'
|
||||||
|
|
|
@ -103,8 +103,6 @@ def setActiveWindowTitle(title):
|
||||||
def populateParameterEditor(parameters):
|
def populateParameterEditor(parameters):
|
||||||
"""Puts the proper controls in the script variable editor pane based on the parameters found"""
|
"""Puts the proper controls in the script variable editor pane based on the parameters found"""
|
||||||
|
|
||||||
FreeCAD.Console.PrintMessage("Script Variables:\r\n")
|
|
||||||
|
|
||||||
mw = FreeCADGui.getMainWindow()
|
mw = FreeCADGui.getMainWindow()
|
||||||
|
|
||||||
# If the widget is open, we need to close it
|
# If the widget is open, we need to close it
|
||||||
|
|
Loading…
Reference in New Issue
Block a user