Draft: Fix "Show groups in layer list drop-down button" preference

The code that was intended to handle this preference looked inside
Mod/BIM instad of Mod/Draft for the preference. This seems to have been
broken since the preference was first introduced in commit 9976a5ece0
(Draft: Turned autogroup button into layers selector (added pref option
to restore old groups-based system)).

This also removes a stray "-" that was probably a leftover from a merge
conflict, introduced in commit 0547d23660 (Draft: move Draft_AutoGroup to
gui_groups module). Since -True is still true and -False is still false,
this did not actually break the code, though.

See https://forum.freecadweb.org/viewtopic.php?t=42018 for related
discussion.
This commit is contained in:
Matthijs Kooijman
2021-05-22 18:24:56 +02:00
parent dbd7dbd332
commit d928f37761

View File

@@ -258,7 +258,7 @@ class SetAutoGroup(gui_base.GuiCommandSimplest):
s = Gui.Selection.getSelection()
if len(s) == 1:
if (utils.get_type(s[0]) == "Layer") or \
- (App.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM").GetBool("AutogroupAddGroups", False)
(App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("AutogroupAddGroups", False)
and (s[0].isDerivedFrom("App::DocumentObjectGroup")
or utils.get_type(s[0]) in ["Site", "Building",
"Floor", "BuildingPart"])):
@@ -269,7 +269,7 @@ class SetAutoGroup(gui_base.GuiCommandSimplest):
# including the options "None" and "Add new layer".
self.groups = ["None"]
gn = [o.Name for o in self.doc.Objects if utils.get_type(o) == "Layer"]
if App.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM").GetBool("AutogroupAddGroups", False):
if App.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft").GetBool("AutogroupAddGroups", False):
gn.extend(groups.get_group_names())
if gn:
self.groups.extend(gn)