From 55d0ad5c5c67d38795e615b4a5a3d593229b6761 Mon Sep 17 00:00:00 2001 From: jriegel Date: Thu, 17 Apr 2014 05:57:05 +0200 Subject: [PATCH] Some fixes for ProfileLib --- src/Mod/Sketcher/App/CMakeLists.txt | 1 + src/Mod/Sketcher/InitGui.py | 8 +++++--- src/Mod/Sketcher/Profiles.py | 16 +++++++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Mod/Sketcher/App/CMakeLists.txt b/src/Mod/Sketcher/App/CMakeLists.txt index 1e6bf27c1c22..e6a6ff5197d3 100644 --- a/src/Mod/Sketcher/App/CMakeLists.txt +++ b/src/Mod/Sketcher/App/CMakeLists.txt @@ -105,6 +105,7 @@ SET(Sketcher_Scripts TestSketcherApp.py Profiles.py ProfileLib/Hexagon.py + ProfileLib/__init__.py ) add_library(Sketcher SHARED ${Sketcher_SRCS}) diff --git a/src/Mod/Sketcher/InitGui.py b/src/Mod/Sketcher/InitGui.py index 453d357cdc0f..09e4c5f4eac5 100644 --- a/src/Mod/Sketcher/InitGui.py +++ b/src/Mod/Sketcher/InitGui.py @@ -70,9 +70,11 @@ def Initialize(self): # load the module import SketcherGui import Sketcher - #try: - # import Profiles - #except: pass + try: + import Profiles + except: + print "Error in Profiles module" + def GetClassName(self): return "SketcherGui::Workbench" diff --git a/src/Mod/Sketcher/Profiles.py b/src/Mod/Sketcher/Profiles.py index 7646372b954b..fb469ad00d9c 100644 --- a/src/Mod/Sketcher/Profiles.py +++ b/src/Mod/Sketcher/Profiles.py @@ -20,8 +20,14 @@ #* * #*************************************************************************** -import FreeCAD, FreeCADGui, Sketcher +import FreeCAD, Sketcher +if FreeCAD.GuiUp: + import FreeCADGui,SketcherGui + from PySide import QtCore, QtGui + from PySide.QtCore import Qt + from PySide.QtGui import QApplication, QCursor + from FreeCADGui import PySideUic as uic __title__="Sketcher profile lib handling" __author__ = "Juergen Riegel" @@ -35,7 +41,7 @@ class _CommandProfileHexagon1: "The basis hexagon profile command definition" def GetResources(self): return {'Pixmap' : 'Sketcher_Hexagon', - 'MenuText': QtCore.QT_TRANSLATE_NOOP("Creates a hexagon profile in the sketch"), + 'MenuText': QtCore.QT_TRANSLATE_NOOP("Sketcher_ProfilesHexagon1","Creates a hexagon profile in the sketch"), 'Accel': "", 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Sketcher_ProfilesHexagon1","Creates a hexagon profile in the sketch")} @@ -43,11 +49,11 @@ def Activated(self): FreeCAD.ActiveDocument.openTransaction("Create hexagon profile") FreeCADGui.addModule("ProfileLib.Hexagon") - FreeCADGui.doCommand("Hexagon.makeHexagonSimple()") + FreeCADGui.doCommand("ProfileLib.Hexagon.makeHexagonSimple()") def IsActive(self): return isProfileActive() - - + + FreeCADGui.addCommand('Sketcher_ProfilesHexagon1',_CommandProfileHexagon1())