Refactored the Gui package to CQGui to avoid naming conflicts with the Curves workbench and others.

This commit is contained in:
Jeremy Mack Wright 2017-11-17 07:46:54 -05:00
parent b1225cc10c
commit 86c32c1efb
10 changed files with 16 additions and 17 deletions

View File

@ -13,19 +13,19 @@ if open.__module__ == '__builtin__':
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
function is passed to file_reloaded signal and in turn calls the CadQueryExecuteScript.Activated function."""
try:
import CadQuery.Gui.Command
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
except:
import Gui.Command
Gui.Command.CadQueryExecuteScript().Activated()
import CQGui.Command
CQGui.Command.CadQueryExecuteScript().Activated()
def open(filename):
#All of the Gui.* calls in the Python console break after opening if we don't do this
FreeCADGui.doCommand("import FreeCADGui as Gui")
#All of the CQGui.* calls in the Python console break after opening if we don't do this
FreeCADGui.doCommand("import FreeCADGui as CQGui")
# Make sure that we enforce a specific version (2.7) of the Python interpreter
ver = hex(sys.hexversion)

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -3,12 +3,13 @@
# (c) 2014-2016 Jeremy Wright Apache 2.0 License
import FreeCAD, FreeCADGui
try:
from CadQuery.Gui.Command import *
from CadQuery.CQGui.Command import *
except:
from Gui.Command import *
from CQGui.Command import *
import CadQuery_rc
class CadQueryWorkbench (Workbench):
"""CadQuery workbench for FreeCAD"""
"""CadQuery workbench for FreeCAD"""
MenuText = "CadQuery"
ToolTip = "CadQuery workbench"
@ -40,9 +41,9 @@ class CadQueryWorkbench (Workbench):
import os
import module_locator
try:
from CadQuery.Gui import ImportCQ
from CadQuery.CQGui import ImportCQ
except:
from Gui import ImportCQ
from CQGui import ImportCQ
module_base_path = module_locator.module_path()
@ -76,15 +77,15 @@ class CadQueryWorkbench (Workbench):
# ImportCQ.open(template_path)
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
function is passed to file_reloaded signal and in turn calls the CadQueryExecuteScript.Activated function."""
try:
import CadQuery.Gui.Command
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
import CadQuery.CQGui.Command
CadQuery.CQGui.Command.CadQueryExecuteScript().Activated()
except:
from Gui import ImportCQ
Gui.Command.CadQueryExecuteScript().Activated()
from CQGui import ImportCQ
CQGui.Command.CadQueryExecuteScript().Activated()
def Deactivated(self):

View File

@ -80,7 +80,7 @@ class AutohotkeyLexer(RegexLexer):
r'FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|'
r'FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|'
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'IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|'
r'IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|'

View File

@ -103,8 +103,6 @@ def setActiveWindowTitle(title):
def populateParameterEditor(parameters):
"""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()
# If the widget is open, we need to close it