From 146767418a400df3d5c80b4cce6b76ee594b4700 Mon Sep 17 00:00:00 2001 From: looooo Date: Thu, 25 Jun 2015 08:37:02 +0200 Subject: [PATCH] integration --- freecad_gear/freecad/__init__.py | 7 +++++- setup.py | 41 +------------------------------- 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/freecad_gear/freecad/__init__.py b/freecad_gear/freecad/__init__.py index 6040b79..9861ef8 100644 --- a/freecad_gear/freecad/__init__.py +++ b/freecad_gear/freecad/__init__.py @@ -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 diff --git a/setup.py b/setup.py index bc4ddba..6d8b9f3 100644 --- a/setup.py +++ b/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() +) \ No newline at end of file