Просмотр исходного кода

Work in progress on prefs overhaul

David Robertson 5 лет назад
Родитель
Сommit
a00cdd6de7

+ 55 - 0
flatcamGUI/GUIElements.py

@@ -655,6 +655,61 @@ class EvalEntry2(QtWidgets.QLineEdit):
         return QtCore.QSize(EDIT_SIZE_HINT, default_hint_size.height())
 
 
+class FCColorEntry(QtWidgets.QWidget):
+
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+
+        self.entry = FCEntry()
+
+        self.button = QtWidgets.QPushButton()
+        self.button.setFixedSize(15, 15)
+        self.button.setStyleSheet("border-color: dimgray;")
+
+        self.layout = QtWidgets.QHBoxLayout()
+        self.layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
+        self.layout.addWidget(self.entry)
+        self.layout.addWidget(self.button)
+        self.setLayout(self.layout)
+
+        self.entry.editingFinished.connect(self._sync_button_color)
+        self.button.clicked.connect(self._on_button_clicked)
+
+    def get_value(self) -> str:
+        return self.entry.get_value()
+
+    def set_value(self, value: str):
+        self.entry.set_value(value)
+        self._sync_button_color()
+
+    def _sync_button_color(self):
+        value = self.get_value()
+        self.button.setStyleSheet("background-color:%s;" % self._extract_color(value))
+
+    def _on_button_clicked(self):
+        value = self.entry.get_value()
+        current_color = QtGui.QColor(self._extract_color(value))
+
+        color_dialog = QtWidgets.QColorDialog()
+        selected_color = color_dialog.getColor(initial=current_color, options=QtWidgets.QColorDialog.ShowAlphaChannel)
+
+        if selected_color.isValid() is False:
+            return
+
+        new_value = str(selected_color.name()) + self._extract_alpha(value)
+        self.set_value(new_value)
+
+    def _extract_color(self, value: str) -> str:
+        return value[:7]
+
+    def _extract_alpha(self, value: str) -> str:
+        return value[7:9]
+
+
+
+
+
+
 class FCSpinner(QtWidgets.QSpinBox):
 
     returnPressed = QtCore.pyqtSignal()

+ 161 - 0
flatcamGUI/preferences/OptionUI.py

@@ -0,0 +1,161 @@
+from PyQt5 import QtWidgets
+from flatcamGUI.GUIElements import RadioSet, FCCheckBox, FCButton, FCComboBox, FCEntry, FCSpinner, FCColorEntry
+
+import gettext
+import FlatCAMTranslation as fcTranslate
+import builtins
+fcTranslate.apply_language('strings')
+if '_' not in builtins.__dict__:
+    _ = gettext.gettext
+
+
+class OptionUI:
+
+    def __init__(self, option: str):
+        self.option = option
+
+    def add_to_grid(self, grid: QtWidgets.QGridLayout, row: int) -> int:
+        """
+        Adds the necessary widget to the grid, starting at the supplied row.
+        Returns the number of rows used (normally 1)
+        """
+        raise NotImplementedError()
+
+    def get_field(self):
+        raise NotImplementedError()
+
+
+class BasicOptionUI(OptionUI):
+    """Abstract OptionUI that has a label on the left then some other widget on the right"""
+    def __init__(self, option: str, label_text: str, label_tooltip: str):
+        super().__init__(option=option)
+        self.label_text = label_text
+        self.label_tooltip = label_tooltip
+        self.label_widget = self.build_label_widget()
+        self.entry_widget = self.build_entry_widget()
+
+    def build_label_widget(self) -> QtWidgets.QLabel:
+        label_widget = QtWidgets.QLabel('%s:' % _(self.label_text))
+        if self.label_tooltip is not None:
+            label_widget.setToolTip(_(self.label_tooltip))
+        return label_widget
+
+    def build_entry_widget(self) -> QtWidgets.QWidget:
+        raise NotImplementedError()
+
+    def add_to_grid(self, grid: QtWidgets.QGridLayout, row: int) -> int:
+        grid.addWidget(self.label_widget, row, 0)
+        grid.addWidget(self.entry_widget, row, 1)
+        return 1
+
+    def get_field(self):
+        return self.entry_widget
+
+
+class RadioSetOptionUI(BasicOptionUI):
+
+    def __init__(self, option: str, label_text: str, label_tooltip: str, choices: list, orientation='horizontal'):
+        self.choices = choices
+        self.orientation = orientation
+        super().__init__(option=option, label_text=label_text, label_tooltip=label_tooltip)
+
+    def build_entry_widget(self) -> QtWidgets.QWidget:
+        return RadioSet(choices=self.choices, orientation=self.orientation)
+
+
+class CheckboxOptionUI(OptionUI):
+
+    def __init__(self, option: str, label_text: str, label_tooltip: str):
+        super().__init__(option=option)
+        self.label_text = label_text
+        self.label_tooltip = label_tooltip
+        self.checkbox_widget = self.build_checkbox_widget()
+
+    def build_checkbox_widget(self):
+        checkbox = FCCheckBox('%s' % _(self.label_text))
+        checkbox.setToolTip(_(self.label_tooltip))
+        return checkbox
+
+    def add_to_grid(self, grid: QtWidgets.QGridLayout, row: int) -> int:
+        grid.addWidget(self.checkbox_widget, row, 0, 1, 3)
+        return 1
+
+    def get_field(self):
+        return self.checkbox_widget
+
+
+class ComboboxOptionUI(BasicOptionUI):
+
+    def __init__(self, option: str, label_text: str, label_tooltip: str, choices: list):
+        self.choices = choices
+        super().__init__(option=option, label_text=label_text, label_tooltip=label_tooltip)
+
+    def build_entry_widget(self):
+        combo = FCComboBox()
+        for choice in self.choices:
+            # don't translate the QCombo items as they are used in QSettings and identified by name
+            combo.addItem(choice)
+        return combo
+
+
+class ColorOptionUI(BasicOptionUI):
+    def build_entry_widget(self) -> QtWidgets.QWidget:
+        return FCColorEntry()
+
+
+class HeadingOptionUI(OptionUI):
+    def __init__(self, label_text: str, label_tooltip: str):
+        super().__init__(option="__heading")
+        self.label_text = label_text
+        self.label_tooltip = label_tooltip
+
+    def build_heading_widget(self):
+        heading = QtWidgets.QLabel('<b>%s</b>' % _(self.label_text))
+        heading.setToolTip(_(self.label_tooltip))
+        return heading
+
+    def add_to_grid(self, grid: QtWidgets.QGridLayout, row: int) -> int:
+        grid.addWidget(self.build_heading_widget(), row, 0, 1, 2)
+        return 1
+
+    def get_field(self):
+        return None
+
+
+class SeparatorOptionUI(OptionUI):
+
+    def __init__(self):
+        super().__init__(option="__separator")
+
+    def build_separator_widget(self):
+        separator = QtWidgets.QFrame()
+        separator.setFrameShape(QtWidgets.QFrame.HLine)
+        separator.setFrameShadow(QtWidgets.QFrame.Sunken)
+        return separator
+
+    def add_to_grid(self, grid: QtWidgets.QGridLayout, row: int) -> int:
+        grid.addWidget(self.build_separator_widget(), row, 0, 1, 2)
+        return 1
+
+    def get_field(self):
+        return None
+
+
+class FullWidthButtonOptionUI(OptionUI):
+    def __init__(self, option: str, label_text: str, label_tooltip: str):
+        super().__init__(option=option)
+        self.label_text = label_text
+        self.label_tooltip = label_tooltip
+        self.button_widget = self.build_button_widget()
+
+    def build_button_widget(self):
+        button = FCButton(_(self.label_text))
+        button.setToolTip(_(self.label_tooltip))
+        return button
+
+    def add_to_grid(self, grid: QtWidgets.QGridLayout, row: int) -> int:
+        grid.addWidget(self.button_widget, row, 0, 1, 3)
+        return 1
+
+    def get_field(self):
+        return self.button_widget

+ 60 - 4
flatcamGUI/preferences/OptionsGroupUI.py

@@ -1,12 +1,34 @@
+from typing import Dict
+
 from PyQt5 import QtWidgets
 
 
+
+from PyQt5.QtCore import QSettings
+
+import gettext
+import FlatCAMTranslation as fcTranslate
+import builtins
+
+from flatcamGUI.preferences.OptionUI import OptionUI
+
+fcTranslate.apply_language('strings')
+if '_' not in builtins.__dict__:
+    _ = gettext.gettext
+
+settings = QSettings("Open Source", "FlatCAM")
+if settings.contains("machinist"):
+    machinist_setting = settings.value('machinist', type=int)
+else:
+    machinist_setting = 0
+
+
 class OptionsGroupUI(QtWidgets.QGroupBox):
     app = None
 
-    def __init__(self, title, parent=None):
-        # QtGui.QGroupBox.__init__(self, title, parent=parent)
-        super(OptionsGroupUI, self).__init__()
+    def __init__(self, fixme_get_rid_of_this=None, **kwargs):
+        super().__init__(**kwargs)
+
         self.setStyleSheet("""
         QGroupBox
         {
@@ -16,4 +38,38 @@ class OptionsGroupUI(QtWidgets.QGroupBox):
         """)
 
         self.layout = QtWidgets.QVBoxLayout()
-        self.setLayout(self.layout)
+        self.setLayout(self.layout)
+
+    def option_dict(self) -> Dict[str, OptionUI]:
+        # FIXME!
+        return {}
+
+
+class OptionsGroupUI2(OptionsGroupUI):
+
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+
+        self.grid = QtWidgets.QGridLayout()
+        self.layout.addLayout(self.grid)
+        self.grid.setColumnStretch(0, 0)
+        self.grid.setColumnStretch(1, 1)
+
+        self.options = self.build_options()
+
+        row = 0
+        for option in self.options:
+            row += option.add_to_grid(grid=self.grid, row=row)
+
+        self.layout.addStretch()
+
+    def build_options(self) -> [OptionUI]:
+        return []
+
+    def option_dict(self) -> Dict[str, OptionUI]:
+        result = {}
+        for optionui in self.options:
+            result[optionui.option] = optionui
+        return result
+
+

+ 10 - 0
flatcamGUI/preferences/PreferencesSectionUI.py

@@ -1,5 +1,8 @@
+from typing import Dict
+
 from PyQt5 import QtWidgets
 
+from flatcamGUI.preferences.OptionUI import OptionUI
 from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
 
 
@@ -20,3 +23,10 @@ class PreferencesSectionUI(QtWidgets.QWidget):
 
     def build_groups(self) -> [OptionsGroupUI]:
         return []
+
+    def option_dict(self) -> Dict[str, OptionUI]:
+        result = {}
+        for group in self.groups:
+            groupoptions = group.option_dict()
+            result.update(groupoptions)
+        return result

+ 20 - 78
flatcamGUI/preferences/PreferencesUIManager.py

@@ -10,6 +10,8 @@ import gettext
 import FlatCAMTranslation as fcTranslate
 import builtins
 
+from flatcamGUI.preferences.OptionUI import OptionUI
+
 fcTranslate.apply_language('strings')
 if '_' not in builtins.__dict__:
     _ = gettext.gettext
@@ -74,24 +76,6 @@ class PreferencesUIManager:
             "global_tpdf_lmargin": self.ui.general_defaults_form.general_app_group.lmargin_entry,
             "global_tpdf_rmargin": self.ui.general_defaults_form.general_app_group.rmargin_entry,
 
-            # General GUI Preferences
-            "global_theme": self.ui.general_defaults_form.general_gui_group.theme_radio,
-            "global_gray_icons": self.ui.general_defaults_form.general_gui_group.gray_icons_cb,
-            "global_layout": self.ui.general_defaults_form.general_gui_group.layout_combo,
-            "global_hover": self.ui.general_defaults_form.general_gui_group.hover_cb,
-            "global_selection_shape": self.ui.general_defaults_form.general_gui_group.selection_cb,
-
-            "global_sel_fill": self.ui.general_defaults_form.general_gui_group.sf_color_entry,
-            "global_sel_line": self.ui.general_defaults_form.general_gui_group.sl_color_entry,
-            "global_alt_sel_fill": self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry,
-            "global_alt_sel_line": self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry,
-            "global_draw_color": self.ui.general_defaults_form.general_gui_group.draw_color_entry,
-            "global_sel_draw_color": self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry,
-
-            "global_proj_item_color": self.ui.general_defaults_form.general_gui_group.proj_color_entry,
-            "global_proj_item_dis_color": self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry,
-            "global_project_autohide": self.ui.general_defaults_form.general_gui_group.project_autohide_cb,
-
             # General GUI Settings
             "global_gridx": self.ui.general_defaults_form.general_app_set_group.gridx_entry,
             "global_gridy": self.ui.general_defaults_form.general_app_set_group.gridy_entry,
@@ -605,13 +589,30 @@ class PreferencesUIManager:
             "util": ui.fa_scroll_area
         }
 
+        self.sections = [
+            # FIXME!
+            ui.general_defaults_form
+        ]
+
     def get_form_fields(self) -> Dict[str, Any]:
-        return self.defaults_form_fields
+        result = {}
+        result.update(self.defaults_form_fields)
+        result.update(self._option_field_dict())
+        return result
 
     def get_form_field(self, option: str) -> Any:
         return self.get_form_fields()[option]
 
+    def option_dict(self) -> Dict[str, OptionUI]:
+        result = {}
+        for section in self.sections:
+            sectionoptions = section.option_dict()
+            result.update(sectionoptions)
+        return result
 
+    def _option_field_dict(self):
+        result = {k: v.get_field() for k, v in self.option_dict().items()}
+        return result
 
     def defaults_read_form(self):
         """
@@ -772,65 +773,6 @@ class PreferencesUIManager:
             "background-color:%s;"
             "border-color: dimgray" % str(self.defaults['cncjob_plot_line'])[:7])
 
-        # Init Left-Right Selection colors
-        self.ui.general_defaults_form.general_gui_group.sf_color_entry.set_value(self.defaults['global_sel_fill'])
-        self.ui.general_defaults_form.general_gui_group.sf_color_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_sel_fill'])[:7])
-        self.ui.general_defaults_form.general_gui_group.sf_color_alpha_spinner.set_value(
-            int(self.defaults['global_sel_fill'][7:9], 16))
-        self.ui.general_defaults_form.general_gui_group.sf_color_alpha_slider.setValue(
-            int(self.defaults['global_sel_fill'][7:9], 16))
-
-        self.ui.general_defaults_form.general_gui_group.sl_color_entry.set_value(self.defaults['global_sel_line'])
-        self.ui.general_defaults_form.general_gui_group.sl_color_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_sel_line'])[:7])
-
-        # Init Right-Left Selection colors
-        self.ui.general_defaults_form.general_gui_group.alt_sf_color_entry.set_value(
-            self.defaults['global_alt_sel_fill'])
-        self.ui.general_defaults_form.general_gui_group.alt_sf_color_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_alt_sel_fill'])[:7])
-        self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_spinner.set_value(
-            int(self.defaults['global_sel_fill'][7:9], 16))
-        self.ui.general_defaults_form.general_gui_group.alt_sf_color_alpha_slider.setValue(
-            int(self.defaults['global_sel_fill'][7:9], 16))
-
-        self.ui.general_defaults_form.general_gui_group.alt_sl_color_entry.set_value(
-            self.defaults['global_alt_sel_line'])
-        self.ui.general_defaults_form.general_gui_group.alt_sl_color_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_alt_sel_line'])[:7])
-
-        # Init Draw color and Selection Draw Color
-        self.ui.general_defaults_form.general_gui_group.draw_color_entry.set_value(
-            self.defaults['global_draw_color'])
-        self.ui.general_defaults_form.general_gui_group.draw_color_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_draw_color'])[:7])
-
-        self.ui.general_defaults_form.general_gui_group.sel_draw_color_entry.set_value(
-            self.defaults['global_sel_draw_color'])
-        self.ui.general_defaults_form.general_gui_group.sel_draw_color_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_sel_draw_color'])[:7])
-
-        # Init Project Items color
-        self.ui.general_defaults_form.general_gui_group.proj_color_entry.set_value(
-            self.defaults['global_proj_item_color'])
-        self.ui.general_defaults_form.general_gui_group.proj_color_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_proj_item_color'])[:7])
-
-        # Init Project Disabled Items color
-        self.ui.general_defaults_form.general_gui_group.proj_color_dis_entry.set_value(
-            self.defaults['global_proj_item_dis_color'])
-        self.ui.general_defaults_form.general_gui_group.proj_color_dis_button.setStyleSheet(
-            "background-color:%s;"
-            "border-color: dimgray" % str(self.defaults['global_proj_item_dis_color'])[:7])
-
         # Init Project Disabled Items color
         self.ui.general_defaults_form.general_app_set_group.mouse_cursor_entry.set_value(
             self.defaults['global_cursor_color'])

+ 2 - 2
flatcamGUI/preferences/general/GeneralAPPSetGroupUI.py

@@ -22,8 +22,8 @@ else:
 
 
 class GeneralAPPSetGroupUI(OptionsGroupUI):
-    def __init__(self, decimals=4, parent=None):
-        super(GeneralAPPSetGroupUI, self).__init__(self, parent=parent)
+    def __init__(self, decimals=4, **kwargs):
+        super().__init__(**kwargs)
 
         self.setTitle(str(_("App Settings")))
         self.decimals = decimals

+ 2 - 2
flatcamGUI/preferences/general/GeneralAppPrefGroupUI.py

@@ -23,8 +23,8 @@ else:
 
 
 class GeneralAppPrefGroupUI(OptionsGroupUI):
-    def __init__(self, decimals=4, parent=None):
-        super(GeneralAppPrefGroupUI, self).__init__(self, parent=parent)
+    def __init__(self, decimals=4, **kwargs):
+        super().__init__(**kwargs)
 
         self.setTitle(_("App Preferences"))
         self.decimals = decimals

+ 152 - 4
flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py

@@ -2,12 +2,15 @@ from PyQt5 import QtWidgets, QtCore, QtGui
 from PyQt5.QtCore import QSettings, Qt
 
 from flatcamGUI.GUIElements import RadioSet, FCCheckBox, FCButton, FCComboBox, FCEntry, FCSpinner
-from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
+from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI, OptionsGroupUI2
 
 import gettext
 import FlatCAMTranslation as fcTranslate
 import builtins
 
+from flatcamGUI.preferences.OptionUI import OptionUI, BasicOptionUI, CheckboxOptionUI, RadioSetOptionUI, \
+    SeparatorOptionUI, HeadingOptionUI, ComboboxOptionUI, ColorOptionUI, FullWidthButtonOptionUI
+
 fcTranslate.apply_language('strings')
 if '_' not in builtins.__dict__:
     _ = gettext.gettext
@@ -19,9 +22,150 @@ else:
     machinist_setting = 0
 
 
+class GeneralGUIPrefGroupUI2(OptionsGroupUI2):
+
+    def __init__(self, decimals=4, **kwargs):
+        super().__init__(**kwargs)
+        self.decimals = decimals
+        self.setTitle(str(_("GUI Preferences 2")))
+
+    def build_options(self) -> [OptionUI]:
+        return [
+            RadioSetOptionUI(
+                option="global_theme",
+                label_text="Theme",
+                label_tooltip="Select a theme for FlatCAM.\nIt will theme the plot area.",
+                choices=[
+                    {"label": _("Light"), "value": "white"},
+                    {"label": _("Dark"), "value": "black"}
+                ],
+                orientation='vertical'
+            ),
+            CheckboxOptionUI(
+                option="global_gray_icons",
+                label_text="Use Gray Icons",
+                label_tooltip="Check this box to use a set of icons with\na lighter (gray) color. To be used when a\nfull dark theme is applied."
+            ),
+            FullWidthButtonOptionUI(
+                option="__button_apply_theme",
+                label_text="Apply Theme",
+                label_tooltip="Select a theme for FlatCAM.\n"
+                              "It will theme the plot area.\n"
+                              "The application will restart after change."
+            ),
+            SeparatorOptionUI(),
+
+
+            ComboboxOptionUI(
+                # FIXME!
+                option="layout",
+                label_text="Layout",
+                label_tooltip="Select an layout for FlatCAM.\nIt is applied immediately.",
+                choices=[
+                    "standard",
+                    "compact",
+                    "minimal"
+                ]
+            ),
+            ComboboxOptionUI(
+                #FIXME!
+                option="style",
+                label_text="Style",
+                label_tooltip="Select an style for FlatCAM.\nIt will be applied at the next app start.",
+                choices=QtWidgets.QStyleFactory.keys()
+            ),
+            CheckboxOptionUI(
+                # FIXME
+                option="hdpi",
+                label_text='Activate HDPI Support',
+                label_tooltip="Enable High DPI support for FlatCAM.\nIt will be applied at the next app start.",
+            ),
+            CheckboxOptionUI(
+                option="global_hover",
+                label_text='Display Hover Shape',
+                label_tooltip="Enable display of a hover shape for FlatCAM objects.\nIt is displayed whenever the mouse cursor is hovering\nover any kind of not-selected object.",
+            ),
+            CheckboxOptionUI(
+                option="global_selection_shape",
+                label_text='Display Selection Shape',
+                label_tooltip="Enable the display of a selection shape for FlatCAM objects.\n"
+                  "It is displayed whenever the mouse selects an object\n"
+                  "either by clicking or dragging mouse from left to right or\n"
+                  "right to left."
+            ),
+            SeparatorOptionUI(),
+
+            HeadingOptionUI(label_text="Left-Right Selection Color", label_tooltip=None),
+            ColorOptionUI(
+                option="global_sel_line",
+                label_text="Outline",
+                label_tooltip="Set the line color for the 'left to right' selection box."
+            ),
+            ColorOptionUI(
+                option="global_sel_fill",
+                label_text="Fill",
+                label_tooltip="Set the fill color for the selection box\n"
+                              "in case that the selection is done from left to right.\n"
+                              "First 6 digits are the color and the last 2\n"
+                              "digits are for alpha (transparency) level."
+            ),
+
+            HeadingOptionUI(label_text="Right-Left Selection Color", label_tooltip=None),
+            ColorOptionUI(
+                option="global_alt_sel_line",
+                label_text="Outline",
+                label_tooltip="Set the line color for the 'right to left' selection box."
+            ),
+            ColorOptionUI(
+                option="global_alt_sel_fill",
+                label_text="Fill",
+                label_tooltip="Set the fill color for the selection box\n"
+                              "in case that the selection is done from right to left.\n"
+                              "First 6 digits are the color and the last 2\n"
+                              "digits are for alpha (transparency) level."
+            ),
+            # FIXME: opacity slider?
+            SeparatorOptionUI(),
+
+            HeadingOptionUI(label_text='Editor Color', label_tooltip=None),
+            ColorOptionUI(
+                option="global_draw_color",
+                label_text="Drawing",
+                label_tooltip="Set the color for the shape."
+            ),
+            ColorOptionUI(
+                option="global_sel_draw_color",
+                label_text="Selection",
+                label_tooltip="Set the color of the shape when selected."
+            ),
+            SeparatorOptionUI(),
+
+            HeadingOptionUI(label_text='Project Items Color', label_tooltip=None),
+            ColorOptionUI(
+                option="global_proj_item_color",
+                label_text="Enabled",
+                label_tooltip="Set the color of the items in Project Tab Tree."
+            ),
+            ColorOptionUI(
+                option="global_proj_item_dis_color",
+                label_text="Disabled",
+                label_tooltip="Set the color of the items in Project Tab Tree,\n"
+                              "for the case when the items are disabled."
+            ),
+            CheckboxOptionUI(
+                option="global_project_autohide",
+                label_text="Project AutoHide",
+                label_tooltip="Check this box if you want the project/selected/tool tab area to\n"
+                              "hide automatically when there are no objects loaded and\n"
+                              "to show whenever a new object is created."
+            ),
+        ]
+
+
 class GeneralGUIPrefGroupUI(OptionsGroupUI):
-    def __init__(self, decimals=4, parent=None):
-        super(GeneralGUIPrefGroupUI, self).__init__(self, parent=parent)
+    def __init__(self, decimals=4, **kwargs):
+        # region Description
+        super().__init__(**kwargs)
 
         self.setTitle(str(_("GUI Preferences")))
         self.decimals = decimals
@@ -151,10 +295,12 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
         self.sel_lr_label = QtWidgets.QLabel('<b>%s</b>' % _('Left-Right Selection Color'))
         grid0.addWidget(self.sel_lr_label, 15, 0, 1, 2)
 
+
         self.sl_color_label = QtWidgets.QLabel('%s:' % _('Outline'))
         self.sl_color_label.setToolTip(
             _("Set the line color for the 'left to right' selection box.")
         )
+
         self.sl_color_entry = FCEntry()
         self.sl_color_button = QtWidgets.QPushButton()
         self.sl_color_button.setFixedSize(15, 15)
@@ -212,6 +358,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
         separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
         grid0.addWidget(separator_line, 19, 0, 1, 2)
 
+
         # Plot Selection (left - right) Color
         self.sel_rl_label = QtWidgets.QLabel('<b>%s</b>' % _('Right-Left Selection Color'))
         grid0.addWidget(self.sel_rl_label, 20, 0, 1, 2)
@@ -279,6 +426,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
         separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
         grid0.addWidget(separator_line, 24, 0, 1, 2)
 
+
         # ------------------------------------------------------------------
         # ----------------------- Editor Color -----------------------------
         # ------------------------------------------------------------------
@@ -324,7 +472,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
         separator_line.setFrameShape(QtWidgets.QFrame.HLine)
         separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
         grid0.addWidget(separator_line, 28, 0, 1, 2)
-
+        # endregion
         # ------------------------------------------------------------------
         # ----------------------- Project Settings -----------------------------
         # ------------------------------------------------------------------

+ 1 - 1
flatcamGUI/preferences/general/GeneralPreferencesUI.py

@@ -26,7 +26,7 @@ class GeneralPreferencesUI(PreferencesSectionUI):
     def __init__(self, decimals, **kwargs):
         self.decimals = decimals
         self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals)
-        #self.general_gui_group2 = GeneralGUIPrefGroupUI2(decimals=self.decimals)
+        self.general_gui_group2 = GeneralGUIPrefGroupUI2(decimals=self.decimals)
         self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals)
         self.general_app_set_group = GeneralAPPSetGroupUI(decimals=self.decimals)
         super().__init__(**kwargs)

+ 0 - 1
flatcamGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py

@@ -21,7 +21,6 @@ else:
 
 class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
     def __init__(self, decimals=4, parent=None):
-        # OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
         super(GeometryAdvOptPrefGroupUI, self).__init__(self, parent=parent)
 
         self.setTitle(str(_("Geometry Adv. Options")))