Skip to content

Commit

Permalink
do not hide any drawing elements when entering edit mode of a sketch
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jul 15, 2017
1 parent 2b82bc6 commit 1d83d17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Mod/Show/TempoVis.py
Expand Up @@ -87,9 +87,13 @@ def hide(self, doc_obj_or_list):
'''hide(doc_obj_or_list): hides objects (sets their Visibility to False). doc_obj_or_list can be a document object, or a list of document objects'''
self.modifyVPProperty(doc_obj_or_list, "Visibility", False)

def get_all_dependent(self, doc_obj):
'''get_all_dependent(doc_obj): gets all objects that depend on doc_obj. Groups, Parts and Bodies are not hidden by this.'''
return [o for o in getAllDependent(doc_obj) if not isContainer(o)]

def hide_all_dependent(self, doc_obj):
'''hide_all_dependent(doc_obj): hides all objects that depend on doc_obj. Groups, Parts and Bodies are not hidden by this.'''
self.hide( [o for o in getAllDependent(doc_obj) if not isContainer(o)])
self.hide( self.get_all_dependent(doc_obj) )

def show_all_dependent(self, doc_obj):
'''show_all_dependent(doc_obj): shows all objects that depend on doc_obj. This method is probably useless.'''
Expand Down
5 changes: 4 additions & 1 deletion src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Expand Up @@ -5081,7 +5081,10 @@ bool ViewProviderSketch::setEdit(int ModNum)
"ActiveSketch = App.ActiveDocument.getObject('{sketch_name}')\n"
"tv = Show.TempoVis(App.ActiveDocument)\n"
"if ActiveSketch.ViewObject.HideDependent:\n"
" tv.hide_all_dependent(ActiveSketch)\n"
" objs = tv.get_all_dependent(ActiveSketch)\n"
" objs = filter(lambda x: not x.TypeId.startswith(\"TechDraw::\"), objs)\n"
" objs = filter(lambda x: not x.TypeId.startswith(\"Drawing::\"), objs)\n"
" tv.hide(objs)\n"
"if ActiveSketch.ViewObject.ShowSupport:\n"
" tv.show([ref[0] for ref in ActiveSketch.Support])\n"
"if ActiveSketch.ViewObject.ShowLinks:\n"
Expand Down
3 changes: 2 additions & 1 deletion src/Mod/TechDraw/Gui/ViewProviderPage.cpp
Expand Up @@ -117,7 +117,8 @@ void ViewProviderPage::show(void)
void ViewProviderPage::hide(void)
{
if (!m_mdiView.isNull()) { //m_mdiView is a QPointer
Gui::getMainWindow()->activatePreviousWindow();
// https://forum.freecadweb.org/viewtopic.php?f=3&t=22797&p=182614#p182614
//Gui::getMainWindow()->activatePreviousWindow();
Gui::getMainWindow()->removeWindow(m_mdiView);
}
ViewProviderDocumentObject::hide();
Expand Down

0 comments on commit 1d83d17

Please sign in to comment.