forked from oddtopus/dodo
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathquetzal_config.py
More file actions
39 lines (28 loc) · 1.06 KB
/
Copy pathquetzal_config.py
File metadata and controls
39 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# SPDX-License-Identifier: LGPL-3.0-or-later
import inspect
import os
import FreeCAD
import FreeCADGui
__version__ = "1.8.9"
_dir = os.path.dirname(__file__)
ICONPATH = os.path.join(_dir, "iconz")
TRANSLATIONSPATH = os.path.join(_dir, "translationz")
UIPATH = os.path.join(_dir, "dialogz")
FREECADVERSION = float(FreeCAD.Version()[0] + "." + FreeCAD.Version()[1])
def get_icon_path(icon_name: str) -> str:
"""Returns the path to the SVG icon."""
return os.path.join(ICONPATH, icon_name + ".svg")
# helper -------------------------------------------------------------------
# FreeCAD TemplatePyMod module
# (c) 2007 Juergen Riegel LGPL
def addCommand(name, cmdObject):
(list, num) = inspect.getsourcelines(cmdObject.Activated)
pos = 0
# check for indentation
while list[1][pos] == " " or list[1][pos] == "\t":
pos += 1
source = ""
for i in range(len(list) - 1):
source += list[i + 1][pos:]
FreeCADGui.addCommand(name, cmdObject, source)
# FreeCAD.Console.PrintMessage("Quetzal " + name + "source: <<< " + source + " >>>\n")