FreeCAD

Форк
0
/
InitGui.py 
73 строки · 3.4 Кб
1
# ***************************************************************************
2
# *   Copyright (c) 2002 Juergen Riegel <juergen.riegel@web.de>             *
3
# *                                                                         *
4
# *   This file is part of the FreeCAD CAx development system.              *
5
# *                                                                         *
6
# *   This program is free software; you can redistribute it and/or modify  *
7
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
8
# *   as published by the Free Software Foundation; either version 2 of     *
9
# *   the License, or (at your option) any later version.                   *
10
# *   for detail see the LICENCE text file.                                 *
11
# *                                                                         *
12
# *   FreeCAD is distributed in the hope that it will be useful,            *
13
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
# *   GNU Lesser General Public License for more details.                   *
16
# *                                                                         *
17
# *   You should have received a copy of the GNU Library General Public     *
18
# *   License along with FreeCAD; if not, write to the Free Software        *
19
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
20
# *   USA                                                                   *
21
# *                                                                         *
22
# ***************************************************************************
23
"""Initialization of the Part Workbench graphical interface."""
24

25
import FreeCAD as App
26
import FreeCADGui as Gui
27
import os
28

29

30
class PartWorkbench(Gui.Workbench):
31
    """Part workbench object."""
32

33
    def __init__(self):
34
        self.__class__.Icon = os.path.join(App.getResourceDir(),
35
                                           "Mod", "Part",
36
                                           "Resources", "icons",
37
                                           "PartWorkbench.svg")
38
        self.__class__.MenuText = "Part"
39
        self.__class__.ToolTip = "Part workbench"
40

41
    def Initialize(self):
42
        # load the module
43
        import PartGui
44

45
        try:
46
            import BasicShapes.CommandShapes
47
        except ImportError as err:
48
            App.Console.PrintError("'BasicShapes' package cannot be loaded. "
49
                                   "{err}\n".format(err=str(err)))
50

51
        try:
52
            import CompoundTools._CommandCompoundFilter
53
            import CompoundTools._CommandExplodeCompound
54
        except ImportError as err:
55
            App.Console.PrintError("'CompoundTools' package cannot be loaded. "
56
                                   "{err}\n".format(err=str(err)))
57

58
        try:
59
            bop = __import__("BOPTools")
60
            bop.importAll()
61
            bop.addCommands()
62
            PartGui.BOPTools = bop
63
        except Exception as err:
64
            App.Console.PrintError("'BOPTools' package cannot be loaded. "
65
                                   "{err}\n".format(err=str(err)))
66

67
    def GetClassName(self):
68
        return "PartGui::Workbench"
69

70

71
Gui.addWorkbench(PartWorkbench())
72

73
App.__unit_test__ += ["TestPartGui"]
74

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.