Merge pull request #88 from easyw/master

better compatibility for Linux
This commit is contained in:
Jeremy Wright 2017-07-03 16:58:50 -04:00 committed by GitHub
commit 2d7344e07d
2 changed files with 21 additions and 9 deletions

View File

@ -16,10 +16,12 @@ def AutoExecute(self):
"""We should be able to pass the Gui.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."""
import CadQuery.Gui.Command
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
try:
import CadQuery.Gui.Command
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
except:
import Gui.Command
Gui.Command.CadQueryExecuteScript().Activated()
def open(filename):
#All of the Gui.* calls in the Python console break after opening if we don't do this

View File

@ -2,7 +2,10 @@
This adds a workbench with a scripting editor to FreeCAD's GUI."""
# (c) 2014-2016 Jeremy Wright Apache 2.0 License
import FreeCAD, FreeCADGui
from CadQuery.Gui.Command import *
try:
from CadQuery.Gui.Command import *
except:
from Gui.Command import *
import CadQuery_rc
class CadQueryWorkbench (Workbench):
@ -36,7 +39,10 @@ class CadQueryWorkbench (Workbench):
def Activated(self):
import os
import module_locator
from CadQuery.Gui import ImportCQ
try:
from CadQuery.Gui import ImportCQ
except:
from Gui import ImportCQ
module_base_path = module_locator.module_path()
@ -74,9 +80,13 @@ class CadQueryWorkbench (Workbench):
"""We should be able to pass the Gui.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."""
import CadQuery.Gui.Command
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
try:
import CadQuery.Gui.Command
CadQuery.Gui.Command.CadQueryExecuteScript().Activated()
except:
from Gui import ImportCQ
Gui.Command.CadQueryExecuteScript().Activated()
def Deactivated(self):
pass