FreeCAD

Форк
0
76 строк · 3.4 Кб
1
# ***************************************************************************
2
# *   (c) 2009, 2010 Yorik van Havre <yorik@uncreated.net>                  *
3
# *   (c) 2009, 2010 Ken Cline <cline@frii.com>                             *
4
# *   (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de>           *
5
# *                                                                         *
6
# *   This file is part of the FreeCAD CAx development system.              *
7
# *                                                                         *
8
# *   This program is free software; you can redistribute it and/or modify  *
9
# *   it under the terms of the GNU Lesser General Public License (LGPL)    *
10
# *   as published by the Free Software Foundation; either version 2 of     *
11
# *   the License, or (at your option) any later version.                   *
12
# *   for detail see the LICENCE text file.                                 *
13
# *                                                                         *
14
# *   FreeCAD is distributed in the hope that it will be useful,            *
15
# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
16
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
17
# *   GNU Library General Public License for more details.                  *
18
# *                                                                         *
19
# *   You should have received a copy of the GNU Library General Public     *
20
# *   License along with FreeCAD; if not, write to the Free Software        *
21
# *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
22
# *   USA                                                                   *
23
# *                                                                         *
24
# ***************************************************************************
25
"""Provides GUI tools to repair objects created with older versions."""
26
## @package gui_heal
27
# \ingroup draftguitools
28
# \brief Provides GUI tools to repair objects created with older versions.
29

30
## \addtogroup draftguitools
31
# @{
32
from PySide.QtCore import QT_TRANSLATE_NOOP
33

34
import FreeCADGui as Gui
35
import Draft
36
import draftguitools.gui_base as gui_base
37

38
from draftutils.translate import translate
39

40

41
class Heal(gui_base.GuiCommandSimplest):
42
    """The Draft Heal command definition.
43

44
    Heal faulty Draft objects saved with an earlier version of the program.
45

46
    It inherits `GuiCommandSimplest` to set up the document
47
    and other behavior. See this class for more information.
48
    """
49

50
    def __init__(self):
51
        super(Heal, self).__init__(name=translate("draft","Heal"))
52

53
    def GetResources(self):
54
        """Set icon, menu and tooltip."""
55
        _tip = ()
56

57
        return {'Pixmap': 'Draft_Heal',
58
                'MenuText': QT_TRANSLATE_NOOP("Draft_Heal", "Heal"),
59
                'ToolTip': QT_TRANSLATE_NOOP("Draft_Heal", "Heal faulty Draft objects saved with an earlier version of the program.\nIf an object is selected it will try to heal that object in particular,\notherwise it will try to heal all objects in the active document.")}
60

61
    def Activated(self):
62
        """Execute when the command is called."""
63
        super(Heal, self).Activated()
64

65
        s = Gui.Selection.getSelection()
66
        self.doc.openTransaction("Heal")
67
        if s:
68
            Draft.heal(s)
69
        else:
70
            Draft.heal()
71
        self.doc.commitTransaction()
72

73

74
Gui.addCommand('Draft_Heal', Heal())
75

76
## @}
77

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

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

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

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