integration
This commit is contained in:
@@ -47,7 +47,7 @@ class gearToolBox(object):
|
||||
self.cycloidGearAction] = [None, None, None, None]
|
||||
self.add_gear_wb()
|
||||
mw.workbenchActivated.connect(self.add_gear_wb)
|
||||
timer = mw.findChild(QtCore.QTimer)
|
||||
timer = mw.findChild(QtCore.QTimer, "activityTimer")
|
||||
timer.connect(timer, QtCore.SIGNAL("timeout()"), self.checkDocument)
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ class gearToolBox(object):
|
||||
mainWindow = Gui.getMainWindow()
|
||||
|
||||
# add the module to Freecad
|
||||
try:
|
||||
if App.gear.gear_toolbar:
|
||||
App.gear.gear_toolbar.show()
|
||||
except:
|
||||
pass
|
||||
App.gear = gear
|
||||
|
||||
# create toolbar
|
||||
|
||||
41
setup.py
41
setup.py
@@ -3,43 +3,6 @@ import os
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
def check_path(path):
|
||||
_dir = os.path.dirname(path)
|
||||
if not os.path.exists(_dir):
|
||||
os.makedirs(_dir)
|
||||
return path
|
||||
|
||||
|
||||
def setup_freecad():
|
||||
sys.path.append("/usr/lib/freecad/lib")
|
||||
try:
|
||||
import FreeCAD
|
||||
except:
|
||||
print("FreeCad is not found!!!")
|
||||
return
|
||||
fileName = check_path("/usr/lib/freecad/Mod/start_up/InitGui.py")
|
||||
try:
|
||||
with open(fileName, "r") as startFile:
|
||||
lines = startFile.readlines()
|
||||
startFile.close()
|
||||
start_file_exists = True
|
||||
except Exception as e:
|
||||
print(e)
|
||||
start_file_exists = False
|
||||
if start_file_exists:
|
||||
for line in lines:
|
||||
if "import freecad_gear" in line:
|
||||
start_input_exists = True
|
||||
break
|
||||
else:
|
||||
start_input_exists = False
|
||||
else:
|
||||
start_input_exists = False
|
||||
print(fileName)
|
||||
if not start_input_exists:
|
||||
with open(fileName, "a") as start_file:
|
||||
start_file.write("\nimport freecad_gear")
|
||||
|
||||
setup(
|
||||
name = 'freecad_gear',
|
||||
packages = ['freecad_gear'],
|
||||
@@ -51,6 +14,4 @@ setup(
|
||||
download_url = 'https://github.com/looooo/FCGear/tarball/0.1',
|
||||
keywords = ['gear', 'freecad'],
|
||||
classifiers = [],
|
||||
)
|
||||
|
||||
setup_freecad()
|
||||
)
|
||||
Reference in New Issue
Block a user