From a3a8fbf8d5ce83603d4f909e2543c1f951e3e471 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Fri, 11 Mar 2022 14:48:22 +0200 Subject: [PATCH] - in the Grid Toolbar, the Grid Y entry is now by default hidden and shown only when there is a need (grid gap link is disabled) in order to maximize the status bar space availability --- CHANGELOG.md | 1 + appGUI/GUIElements.py | 21 ++++++++++++++++----- appGUI/MainGUI.py | 10 +++++++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fd48a0f..e3bf0355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ CHANGELOG for FlatCAM beta - 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) - made sure that on canvas context menu pop-up, some actions are disabled if there is no object selected - made sure that on canvas context menu pop-up, if 'Properties' action is clicked and there is no object selected then the Properties tab is selected +- in the Grid Toolbar, the Grid Y entry is now by default hidden and shown only when there is a need (grid gap link is disabled) in order to maximize the status bar space availability 10.03.2022 diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index 58346d53..169e4ca7 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -3706,19 +3706,30 @@ class OptionalHideInputSection: self.cb.stateChanged.connect(self.on_cb_change) def on_cb_change(self): - if self.cb.checkState() is Qt.CheckState.Checked: for widget in self.optinputs: if self.logic is True: - widget.show() + try: + widget.setVisible(True) + except Exception: + widget.show() else: - widget.hide() + try: + widget.setVisible(False) + except Exception: + widget.hide() else: for widget in self.optinputs: if self.logic is True: - widget.hide() + try: + widget.setVisible(False) + except Exception: + widget.hide() else: - widget.show() + try: + widget.setVisible(True) + except Exception: + widget.show() class FCTable(QtWidgets.QTableWidget): diff --git a/appGUI/MainGUI.py b/appGUI/MainGUI.py index 4ada23ad..fcd4faa6 100644 --- a/appGUI/MainGUI.py +++ b/appGUI/MainGUI.py @@ -1326,11 +1326,15 @@ class MainGUI(QtWidgets.QMainWindow): self.grid_gap_y_entry = FCEntry2() self.grid_gap_y_entry.setMaximumWidth(70) self.grid_gap_y_entry.setToolTip(_("Grid Y snapping distance")) - self.grid_toolbar.addWidget(self.grid_gap_y_entry) + + self.grid_gap_y_entry.setVisible(False) + + self.gridy_entry_action = self.grid_toolbar.addWidget(self.grid_gap_y_entry) self.grid_toolbar.addWidget(FCLabel(" ")) - self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False) - + # self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False) + self.grid_gap_link_cb.clicked.connect( + lambda x: self.gridy_entry_action.setVisible(False) if x else self.gridy_entry_action.setVisible(True)) self.corner_snap_btn = self.grid_toolbar.addAction( QtGui.QIcon(self.app.resource_location + '/corner32.png'), _('Snap to corner'))