From 37e31b01590c0bad560cb94c1060bf76f999a934 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 12 Mar 2022 01:05:54 +0200 Subject: [PATCH] - added to the application an older contribution by another user: Columnar Layout for the Preferences Tab. It can be set in Preferences -> General -> GUI section --- CHANGELOG.md | 4 +++ appGUI/ColumnarFlowLayout.py | 13 +++++++++ appGUI/MainGUI.py | 9 ++++++ appGUI/preferences/PreferencesUIManager.py | 1 + .../cncjob/CNCJobOptPrefGroupUI.py | 2 +- .../preferences/cncjob/CNCJobPreferencesUI.py | 9 +++++- .../excellon/ExcellonPreferencesUI.py | 7 ++++- .../general/GeneralGUIPrefGroupUI.py | 16 ++++++++++- .../general/GeneralPreferencesUI.py | 10 ++++++- .../geometry/GeometryGenPrefGroupUI.py | 2 +- .../geometry/GeometryPreferencesUI.py | 11 ++++++-- .../preferences/gerber/GerberPreferencesUI.py | 13 ++++++--- .../tools/Plugins2PreferencesUI.py | 25 ++++++++++------- .../tools/PluginsEngravingPreferencesUI.py | 17 +++++++---- .../preferences/tools/PluginsPreferencesUI.py | 28 +++++++++++-------- .../preferences/tools/ToolsISOPrefGroupUI.py | 2 +- .../preferences/tools/ToolsNCCPrefGroupUI.py | 2 +- .../utilities/UtilPreferencesUI.py | 7 ++++- defaults.py | 1 + 19 files changed, 136 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d9047a..5427ea24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta ================================================= +12.03.2022 + +- added to the application an older contribution by another user: Columnar Layout for the Preferences Tab. It can be set in Preferences -> General -> GUI section + 11.03.2022 - added a new feature: now in the context menu (and main menu -> Edit) there is a new command that allow to move a selection of objects at specified numeric coordinates (either absolute or relative to current position) diff --git a/appGUI/ColumnarFlowLayout.py b/appGUI/ColumnarFlowLayout.py index fdfab2d2..ea3e285e 100644 --- a/appGUI/ColumnarFlowLayout.py +++ b/appGUI/ColumnarFlowLayout.py @@ -8,6 +8,7 @@ import sys from PyQt6.QtCore import QRect, QSize, Qt +from PyQt6 import QtWidgets from PyQt6.QtWidgets import QLayout import math @@ -85,6 +86,7 @@ class ColumnarFlowLayout(QLayout): column_count = math.floor(rect.width() / (widest + spacing)) column_count = min(column_count, len(self.itemList)) column_count = max(1, column_count) + # TODO somehow this should be adjusted to introduce a kind of stretch to the right of the layout column_width = math.floor((rect.width() - (column_count-1)*spacing - 1) / column_count) # Get the heights for all of our items @@ -179,3 +181,14 @@ class ColumnarFlowLayout(QLayout): # Return the overall height return max(column_heights) + + def addStretch(self, val=None): + wdg = QtWidgets.QWidget() + wdg.setMinimumWidth(0) + return wdg + + def addLayout(self, layout): + for idx in range(layout.count()): + wdg = layout.itemAt(idx).widget() + if wdg: + self.addWidget(wdg) diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index fcd4faa6..1dfdf8d2 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -1516,6 +1516,7 @@ class MainGUI(QtWidgets.QMainWindow): self.hlay1.addStretch() self.general_scroll_area = QtWidgets.QScrollArea() + self.general_scroll_area.setWidgetResizable(True) self.general_tab_lay.addWidget(self.general_scroll_area) self.gerber_tab = QtWidgets.QWidget() @@ -1526,6 +1527,7 @@ class MainGUI(QtWidgets.QMainWindow): self.gerber_tab.setLayout(self.gerber_tab_lay) self.gerber_scroll_area = QtWidgets.QScrollArea() + self.gerber_scroll_area.setWidgetResizable(True) self.gerber_tab_lay.addWidget(self.gerber_scroll_area) self.excellon_tab = QtWidgets.QWidget() @@ -1536,6 +1538,7 @@ class MainGUI(QtWidgets.QMainWindow): self.excellon_tab.setLayout(self.excellon_tab_lay) self.excellon_scroll_area = QtWidgets.QScrollArea() + self.excellon_scroll_area.setWidgetResizable(True) self.excellon_tab_lay.addWidget(self.excellon_scroll_area) self.geometry_tab = QtWidgets.QWidget() @@ -1546,6 +1549,7 @@ class MainGUI(QtWidgets.QMainWindow): self.geometry_tab.setLayout(self.geometry_tab_lay) self.geometry_scroll_area = QtWidgets.QScrollArea() + self.geometry_scroll_area.setWidgetResizable(True) self.geometry_tab_lay.addWidget(self.geometry_scroll_area) self.text_editor_tab = QtWidgets.QWidget() @@ -1556,6 +1560,7 @@ class MainGUI(QtWidgets.QMainWindow): self.text_editor_tab.setLayout(self.cncjob_tab_lay) self.cncjob_scroll_area = QtWidgets.QScrollArea() + self.cncjob_scroll_area.setWidgetResizable(True) self.cncjob_tab_lay.addWidget(self.cncjob_scroll_area) self.plugins_eng_tab = QtWidgets.QWidget() @@ -1565,6 +1570,7 @@ class MainGUI(QtWidgets.QMainWindow): self.plugins_eng_tab.setLayout(self.plugins_eng_tab_lay) self.plugins_engraving_scroll_area = QtWidgets.QScrollArea() + self.plugins_engraving_scroll_area.setWidgetResizable(True) self.plugins_eng_tab_lay.addWidget(self.plugins_engraving_scroll_area) self.tools_tab = QtWidgets.QWidget() @@ -1574,6 +1580,7 @@ class MainGUI(QtWidgets.QMainWindow): self.tools_tab.setLayout(self.tools_tab_lay) self.tools_scroll_area = QtWidgets.QScrollArea() + self.tools_scroll_area.setWidgetResizable(True) self.tools_tab_lay.addWidget(self.tools_scroll_area) self.tools2_tab = QtWidgets.QWidget() @@ -1583,6 +1590,7 @@ class MainGUI(QtWidgets.QMainWindow): self.tools2_tab.setLayout(self.tools2_tab_lay) self.tools2_scroll_area = QtWidgets.QScrollArea() + self.tools2_scroll_area.setWidgetResizable(True) self.tools2_tab_lay.addWidget(self.tools2_scroll_area) self.fa_tab = QtWidgets.QWidget() @@ -1593,6 +1601,7 @@ class MainGUI(QtWidgets.QMainWindow): self.fa_tab.setLayout(self.fa_tab_lay) self.fa_scroll_area = QtWidgets.QScrollArea() + self.fa_scroll_area.setWidgetResizable(True) self.fa_tab_lay.addWidget(self.fa_scroll_area) self.pref_tab_bottom_layout = QtWidgets.QHBoxLayout() diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index 2f2d80e7..49f5e9da 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -77,6 +77,7 @@ class PreferencesUIManager: "global_layout": self.ui.general_pref_form.general_gui_group.layout_combo, "global_hover_shape": self.ui.general_pref_form.general_gui_group.hover_cb, "global_selection_shape": self.ui.general_pref_form.general_gui_group.selection_cb, + "global_gui_layout": self.ui.general_pref_form.general_gui_group.gui_lay_combo, "global_sel_fill": self.ui.general_pref_form.general_gui_group.sf_color_entry, "global_sel_line": self.ui.general_pref_form.general_gui_group.sl_color_entry, diff --git a/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py b/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py index 5c88905c..f2a83337 100644 --- a/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py +++ b/appGUI/preferences/cncjob/CNCJobOptPrefGroupUI.py @@ -75,4 +75,4 @@ class CNCJobOptPrefGroupUI(OptionsGroupUI): gcode_grid.addWidget(self.annotation_cb, 2, 0, 1, 2) - # self.layout.addStretch() + self.layout.addStretch(2) diff --git a/appGUI/preferences/cncjob/CNCJobPreferencesUI.py b/appGUI/preferences/cncjob/CNCJobPreferencesUI.py index 257e8bc6..162e04b1 100644 --- a/appGUI/preferences/cncjob/CNCJobPreferencesUI.py +++ b/appGUI/preferences/cncjob/CNCJobPreferencesUI.py @@ -6,11 +6,17 @@ from appGUI.preferences.cncjob.CNCJobGenPrefGroupUI import CNCJobGenPrefGroupUI from appGUI.preferences.cncjob.CNCJobEditorPrefGroupUI import CNCJobEditorPrefGroupUI from appGUI.preferences.cncjob.CNCJobPPGroupUI import CNCJobPPGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + + class CNCJobPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.cncjob_gen_group = CNCJobGenPrefGroupUI(app=app) @@ -31,6 +37,7 @@ class CNCJobPreferencesUI(QtWidgets.QWidget): vlay.addWidget(self.cncjob_opt_group) vlay.addWidget(self.cncjob_adv_opt_group) vlay.addWidget(self.cncjob_pp_group) + vlay.addStretch() self.layout.addWidget(self.cncjob_gen_group) self.layout.addLayout(vlay) diff --git a/appGUI/preferences/excellon/ExcellonPreferencesUI.py b/appGUI/preferences/excellon/ExcellonPreferencesUI.py index 6269f39e..6d1018d4 100644 --- a/appGUI/preferences/excellon/ExcellonPreferencesUI.py +++ b/appGUI/preferences/excellon/ExcellonPreferencesUI.py @@ -6,6 +6,8 @@ from appGUI.preferences.excellon.ExcellonAdvOptPrefGroupUI import ExcellonAdvOpt from appGUI.preferences.excellon.ExcellonOptPrefGroupUI import ExcellonOptPrefGroupUI from appGUI.preferences.excellon.ExcellonGenPrefGroupUI import ExcellonGenPrefGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + import gettext import appTranslation as fcTranslate import builtins @@ -19,7 +21,10 @@ class ExcellonPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.excellon_gen_group = ExcellonGenPrefGroupUI(app=app) diff --git a/appGUI/preferences/general/GeneralGUIPrefGroupUI.py b/appGUI/preferences/general/GeneralGUIPrefGroupUI.py index c99c5715..f97ad50c 100644 --- a/appGUI/preferences/general/GeneralGUIPrefGroupUI.py +++ b/appGUI/preferences/general/GeneralGUIPrefGroupUI.py @@ -2,7 +2,7 @@ from PyQt6 import QtWidgets, QtCore, QtGui from PyQt6.QtCore import QSettings from appGUI.GUIElements import RadioSet, FCCheckBox, FCComboBox, FCSliderWithSpinner, FCColorEntry, FCLabel, \ - FCGridLayout, FCFrame + FCGridLayout, FCFrame, FCComboBox2 from appGUI.preferences.OptionsGroupUI import OptionsGroupUI import gettext @@ -129,6 +129,20 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): ) grid0.addWidget(self.selection_cb, 12, 0, 1, 3) + # Select the GUI layout + self.ui_lay_lbl = FCLabel('%s:' % _('GUI Layout')) + self.ui_lay_lbl.setToolTip( + _("Select a GUI layout for the Preferences.\n" + "Can be:\n" + "'Normal' -> a normal and compact layout.\n" + "'Columnar' -> a layout the auto-adjust such\n" + "that columns are preferentially showed in columns") + ) + self.gui_lay_combo = FCComboBox2() + self.gui_lay_combo.addItems([_("Normal"), _("Columnar")]) + grid0.addWidget(self.ui_lay_lbl, 14, 0) + grid0.addWidget(self.gui_lay_combo, 14, 1, 1, 2) + # ############################################################################################################# # Grid1 Frame # ############################################################################################################# diff --git a/appGUI/preferences/general/GeneralPreferencesUI.py b/appGUI/preferences/general/GeneralPreferencesUI.py index b68252a7..67ebbaf2 100644 --- a/appGUI/preferences/general/GeneralPreferencesUI.py +++ b/appGUI/preferences/general/GeneralPreferencesUI.py @@ -4,6 +4,8 @@ from appGUI.preferences.general.GeneralAppPrefGroupUI import GeneralAppPrefGroup from appGUI.preferences.general.GeneralAPPSetGroupUI import GeneralAPPSetGroupUI from appGUI.preferences.general.GeneralGUIPrefGroupUI import GeneralGUIPrefGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + import gettext import appTranslation as fcTranslate import builtins @@ -16,17 +18,23 @@ if '_' not in builtins.__dict__: class GeneralPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.general_app_group = GeneralAppPrefGroupUI(app=app) self.general_app_group.setMinimumWidth(250) + # self.general_app_group.setMaximumWidth(250) self.general_gui_group = GeneralGUIPrefGroupUI(app=app) self.general_gui_group.setMinimumWidth(250) + # self.general_gui_group.setMaximumWidth(250) self.general_app_set_group = GeneralAPPSetGroupUI(app=app) self.general_app_set_group.setMinimumWidth(250) + # self.general_app_set_group.setMaximumWidth(250) self.layout.addWidget(self.general_app_group) self.layout.addWidget(self.general_gui_group) diff --git a/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py b/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py index 98947b98..c01fa6d0 100644 --- a/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryGenPrefGroupUI.py @@ -159,7 +159,7 @@ class GeometryGenPrefGroupUI(OptionsGroupUI): FCGridLayout.set_common_column_size([plot_grid, opt_grid, obj_grid, fuse_grid], 0) - self.layout.addStretch() + self.layout.addStretch(1) current_platform = platform.architecture()[0] if current_platform == '64bit': diff --git a/appGUI/preferences/geometry/GeometryPreferencesUI.py b/appGUI/preferences/geometry/GeometryPreferencesUI.py index ad351bce..a3347584 100644 --- a/appGUI/preferences/geometry/GeometryPreferencesUI.py +++ b/appGUI/preferences/geometry/GeometryPreferencesUI.py @@ -6,6 +6,8 @@ from appGUI.preferences.geometry.GeometryExpPrefGroupUI import GeometryExpPrefGr from appGUI.preferences.geometry.GeometryOptPrefGroupUI import GeometryOptPrefGroupUI from appGUI.preferences.geometry.GeometryGenPrefGroupUI import GeometryGenPrefGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + import gettext import appTranslation as fcTranslate import builtins @@ -19,7 +21,10 @@ class GeometryPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.geometry_gen_group = GeometryGenPrefGroupUI(app=app) @@ -27,11 +32,11 @@ class GeometryPreferencesUI(QtWidgets.QWidget): self.geometry_exp_group = GeometryExpPrefGroupUI(app=app) self.geometry_exp_group.setMinimumWidth(220) self.geometry_opt_group = GeometryOptPrefGroupUI(app=app) - self.geometry_opt_group.setMinimumWidth(300) + self.geometry_opt_group.setMinimumWidth(250) self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI(app=app) self.geometry_adv_opt_group.setMinimumWidth(270) self.geometry_editor_group = GeometryEditorPrefGroupUI(app=app) - self.geometry_editor_group.setMinimumWidth(250) + self.geometry_editor_group.setMinimumWidth(270) self.layout.addWidget(self.geometry_gen_group) diff --git a/appGUI/preferences/gerber/GerberPreferencesUI.py b/appGUI/preferences/gerber/GerberPreferencesUI.py index 3e39f6e3..eaf47e0c 100644 --- a/appGUI/preferences/gerber/GerberPreferencesUI.py +++ b/appGUI/preferences/gerber/GerberPreferencesUI.py @@ -6,6 +6,8 @@ from appGUI.preferences.gerber.GerberAdvOptPrefGroupUI import GerberAdvOptPrefGr from appGUI.preferences.gerber.GerberOptPrefGroupUI import GerberOptPrefGroupUI from appGUI.preferences.gerber.GerberGenPrefGroupUI import GerberGenPrefGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + import gettext import appTranslation as fcTranslate import builtins @@ -19,19 +21,22 @@ class GerberPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.gerber_gen_group = GerberGenPrefGroupUI(app=app) - self.gerber_gen_group.setMinimumWidth(200) + self.gerber_gen_group.setMinimumWidth(250) self.gerber_opt_group = GerberOptPrefGroupUI(app=app) self.gerber_opt_group.setMinimumWidth(250) self.gerber_exp_group = GerberExpPrefGroupUI(app=app) self.gerber_exp_group.setMinimumWidth(230) self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI(app=app) - self.gerber_adv_opt_group.setMinimumWidth(200) + self.gerber_adv_opt_group.setMinimumWidth(220) self.gerber_editor_group = GerberEditorPrefGroupUI(app=app) - self.gerber_editor_group.setMinimumWidth(200) + self.gerber_editor_group.setMinimumWidth(270) self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.gerber_opt_group) diff --git a/appGUI/preferences/tools/Plugins2PreferencesUI.py b/appGUI/preferences/tools/Plugins2PreferencesUI.py index ba016d24..4a701976 100644 --- a/appGUI/preferences/tools/Plugins2PreferencesUI.py +++ b/appGUI/preferences/tools/Plugins2PreferencesUI.py @@ -10,6 +10,8 @@ from appGUI.preferences.tools.Tools2QRCodePrefGroupUI import Tools2QRCodePrefGro from appGUI.preferences.tools.Tools2OptimalPrefGroupUI import Tools2OptimalPrefGroupUI from appGUI.preferences.tools.Tools2RulesCheckPrefGroupUI import Tools2RulesCheckPrefGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + import gettext import appTranslation as fcTranslate import builtins @@ -22,35 +24,38 @@ class Plugins2PreferencesUI(QtWidgets.QWidget): def __init__(self,app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI(app=app) - self.tools2_checkrules_group.setMinimumWidth(150) + self.tools2_checkrules_group.setMinimumWidth(250) self.tools2_optimal_group = Tools2OptimalPrefGroupUI(app=app) - self.tools2_optimal_group.setMinimumWidth(220) + self.tools2_optimal_group.setMinimumWidth(250) self.tools2_qrcode_group = Tools2QRCodePrefGroupUI(app=app) - self.tools2_qrcode_group.setMinimumWidth(220) + self.tools2_qrcode_group.setMinimumWidth(280) self.tools2_cfill_group = Tools2CThievingPrefGroupUI(app=app) - self.tools2_cfill_group.setMinimumWidth(220) + self.tools2_cfill_group.setMinimumWidth(250) self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(app=app) - self.tools2_fiducials_group.setMinimumWidth(220) + self.tools2_fiducials_group.setMinimumWidth(250) self.tools2_cal_group = Tools2CalPrefGroupUI(app=app) - self.tools2_cal_group.setMinimumWidth(220) + self.tools2_cal_group.setMinimumWidth(250) self.tools2_edrills_group = Tools2EDrillsPrefGroupUI(app=app) - self.tools2_edrills_group.setMinimumWidth(220) + self.tools2_edrills_group.setMinimumWidth(250) self.tools2_punch_group = Tools2PunchGerberPrefGroupUI(app=app) - self.tools2_punch_group.setMinimumWidth(220) + self.tools2_punch_group.setMinimumWidth(250) self.tools2_invert_group = Tools2InvertPrefGroupUI(app=app) - self.tools2_invert_group.setMinimumWidth(220) + self.tools2_invert_group.setMinimumWidth(250) self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.tools2_checkrules_group) diff --git a/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py b/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py index 7bba2893..42e5224a 100644 --- a/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py +++ b/appGUI/preferences/tools/PluginsEngravingPreferencesUI.py @@ -7,6 +7,8 @@ from appGUI.preferences.tools.ToolsNCCPrefGroupUI import ToolsNCCPrefGroupUI from appGUI.preferences.tools.ToolsPaintPrefGroupUI import ToolsPaintPrefGroupUI from appGUI.preferences.tools.ToolsISOPrefGroupUI import ToolsISOPrefGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + import gettext import appTranslation as fcTranslate import builtins @@ -20,23 +22,26 @@ class PluginsEngravingPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.tools_iso_group = ToolsISOPrefGroupUI(app=app) - self.tools_iso_group.setMinimumWidth(220) + self.tools_iso_group.setMinimumWidth(270) self.tools_ncc_group = ToolsNCCPrefGroupUI(app=app) - self.tools_ncc_group.setMinimumWidth(220) + self.tools_ncc_group.setMinimumWidth(270) self.tools_paint_group = ToolsPaintPrefGroupUI(app=app) - self.tools_paint_group.setMinimumWidth(220) + self.tools_paint_group.setMinimumWidth(250) self.tools_2sided_group = Tools2sidedPrefGroupUI(app=app) - self.tools_2sided_group.setMinimumWidth(220) + self.tools_2sided_group.setMinimumWidth(250) self.tools_level_group = ToolsLevelPrefGroupUI(app=app) - self.tools_level_group.setMinimumWidth(220) + self.tools_level_group.setMinimumWidth(250) self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.tools_iso_group) diff --git a/appGUI/preferences/tools/PluginsPreferencesUI.py b/appGUI/preferences/tools/PluginsPreferencesUI.py index fcd01eb1..8143cfe6 100644 --- a/appGUI/preferences/tools/PluginsPreferencesUI.py +++ b/appGUI/preferences/tools/PluginsPreferencesUI.py @@ -13,6 +13,9 @@ from appGUI.preferences.tools.ToolsFilmPrefGroupUI import ToolsFilmPrefGroupUI from appGUI.preferences.tools.ToolsCutoutPrefGroupUI import ToolsCutoutPrefGroupUI from appGUI.preferences.tools.ToolsDrillPrefGroupUI import ToolsDrillPrefGroupUI from appGUI.preferences.tools.ToolsMillPrefGroupUI import ToolsMillPrefGroupUI + +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + import gettext import appTranslation as fcTranslate import builtins @@ -26,38 +29,41 @@ class PluginsPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.tools_drill_group = ToolsDrillPrefGroupUI(app=app) - self.tools_drill_group.setMinimumWidth(180) + self.tools_drill_group.setMinimumWidth(250) self.tools_mill_group = ToolsMillPrefGroupUI(app=app) - self.tools_mill_group.setMinimumWidth(180) + self.tools_mill_group.setMinimumWidth(250) self.tools_cutout_group = ToolsCutoutPrefGroupUI(app=app) - self.tools_cutout_group.setMinimumWidth(220) + self.tools_cutout_group.setMinimumWidth(250) self.tools_film_group = ToolsFilmPrefGroupUI(app=app) - self.tools_film_group.setMinimumWidth(220) + self.tools_film_group.setMinimumWidth(250) self.tools_panelize_group = ToolsPanelizePrefGroupUI(app=app) - self.tools_panelize_group.setMinimumWidth(220) + self.tools_panelize_group.setMinimumWidth(250) self.tools_calculators_group = ToolsCalculatorsPrefGroupUI(app=app) - self.tools_calculators_group.setMinimumWidth(220) + self.tools_calculators_group.setMinimumWidth(250) self.tools_transform_group = ToolsTransformPrefGroupUI(app=app) - self.tools_transform_group.setMinimumWidth(200) + self.tools_transform_group.setMinimumWidth(250) self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI(app=app) - self.tools_solderpaste_group.setMinimumWidth(200) + self.tools_solderpaste_group.setMinimumWidth(250) self.tools_markers_group = ToolsMarkersPrefGroupUI(app=app) - self.tools_markers_group.setMinimumWidth(200) + self.tools_markers_group.setMinimumWidth(250) self.tools_sub_group = ToolsSubPrefGroupUI(app=app) - self.tools_sub_group.setMinimumWidth(200) + self.tools_sub_group.setMinimumWidth(250) self.vlay = QtWidgets.QVBoxLayout() self.vlay.addWidget(self.tools_drill_group) diff --git a/appGUI/preferences/tools/ToolsISOPrefGroupUI.py b/appGUI/preferences/tools/ToolsISOPrefGroupUI.py index caa30428..238ed8be 100644 --- a/appGUI/preferences/tools/ToolsISOPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsISOPrefGroupUI.py @@ -359,4 +359,4 @@ class ToolsISOPrefGroupUI(OptionsGroupUI): FCGridLayout.set_common_column_size([par_grid, tool_grid, gen_grid], 0) - # self.layout.addStretch() + self.layout.addStretch(1) diff --git a/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py b/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py index e0d697c9..a473c701 100644 --- a/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py +++ b/appGUI/preferences/tools/ToolsNCCPrefGroupUI.py @@ -357,4 +357,4 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI): FCGridLayout.set_common_column_size([par_grid, tool_grid, gen_grid], 0) - # self.layout.addStretch() + self.layout.addStretch(1) diff --git a/appGUI/preferences/utilities/UtilPreferencesUI.py b/appGUI/preferences/utilities/UtilPreferencesUI.py index 0fcea020..e47d3034 100644 --- a/appGUI/preferences/utilities/UtilPreferencesUI.py +++ b/appGUI/preferences/utilities/UtilPreferencesUI.py @@ -6,12 +6,17 @@ from appGUI.preferences.utilities.FAGrbPrefGroupUI import FAGrbPrefGroupUI from appGUI.preferences.utilities.FAGcoPrefGroupUI import FAGcoPrefGroupUI from appGUI.preferences.utilities.FAExcPrefGroupUI import FAExcPrefGroupUI +from appGUI.ColumnarFlowLayout import ColumnarFlowLayout + class UtilPreferencesUI(QtWidgets.QWidget): def __init__(self, app, parent=None): QtWidgets.QWidget.__init__(self, parent=parent) - self.layout = QtWidgets.QHBoxLayout() + if app.defaults['global_gui_layout'] == 0: + self.layout = QtWidgets.QHBoxLayout() + else: + self.layout = ColumnarFlowLayout() self.setLayout(self.layout) self.fa_excellon_group = FAExcPrefGroupUI(app=app) diff --git a/defaults.py b/defaults.py index 216dd62a..9515952d 100644 --- a/defaults.py +++ b/defaults.py @@ -43,6 +43,7 @@ class AppDefaults: "global_move_ref": 'abs', "global_toolbar_view": 511, + "global_gui_layout": 0, # can be 0:"normal" or 1:"columnar" "global_background_timeout": 300000, # Default value is 5 minutes "global_verbose_error_level": 0, # Shell verbosity 0 = default