FreeCAD
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# @{
32from PySide.QtCore import QT_TRANSLATE_NOOP33
34import FreeCADGui as Gui35import Draft36import draftguitools.gui_base as gui_base37
38from draftutils.translate import translate39
40
41class Heal(gui_base.GuiCommandSimplest):42"""The Draft Heal command definition.43
44Heal faulty Draft objects saved with an earlier version of the program.
45
46It inherits `GuiCommandSimplest` to set up the document
47and other behavior. See this class for more information.
48"""
49
50def __init__(self):51super(Heal, self).__init__(name=translate("draft","Heal"))52
53def GetResources(self):54"""Set icon, menu and tooltip."""55_tip = ()56
57return {'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
61def Activated(self):62"""Execute when the command is called."""63super(Heal, self).Activated()64
65s = Gui.Selection.getSelection()66self.doc.openTransaction("Heal")67if s:68Draft.heal(s)69else:70Draft.heal()71self.doc.commitTransaction()72
73
74Gui.addCommand('Draft_Heal', Heal())75
76## @}
77