diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a3d8028..6dbf69ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ CHANGELOG for FlatCAM beta 10.09.2021 - minor changes in Film Plugin +- fixed the FCGridLayout (in GUI elements) method that synchronize the column width for multiple grid layouts when the item on column is spanning multiple columns 9.09.2021 @@ -24,7 +25,7 @@ CHANGELOG for FlatCAM beta - on Coppper Thieving Plugin some UI updates - updated the GCGridLayout GUi element to automatically stretch the first column but offered also configuration; updated the use throughout the app - in Copper Thieving Plugin more UI changes -- in GUI Elements the FCGridLayout has now a class method that allow adjusting column size in multiple grid layouts to the highest on that column; still work to d oto take care of the situation when widgets are spanning multiple cells +- in GUI Elements the FCGridLayout has now a class method that allow adjusting column size in multiple grid layouts to the highest on that column; still work to do to take care of the situation when widgets are spanning multiple cells - in Fiducials Plugin added the support for ESCAPE key from manual mode and also exit by right clicking - in Fiducials Plugin addressed the situation when no object is selected but there are available - in Fiducials Plugin when adding manual fiducials now panning is allowed without cancelling the process of adding diff --git a/appGUI/GUIElements.py b/appGUI/GUIElements.py index c84c0112..5c8d3356 100644 --- a/appGUI/GUIElements.py +++ b/appGUI/GUIElements.py @@ -5309,36 +5309,34 @@ class FCGridLayout(QtWidgets.QGridLayout): self.blockSignals(False) - @classmethod - def set_common_column_size(cls, grid_layout_list, column, only_wdg=None): + @staticmethod + def set_common_column_size(grid_layout_list, column): """ :param grid_layout_list: list of FCGridLayout :type grid_layout_list list :param column: the column for which to make the size the same in all grid_grid_layout_list; int - :param only_wdg: use only Widgets of this kind - :type only_wdg: + :return: """ - def get_max_cell_width(layout, column_no, only_this_widget=None): + def get_max_cell_width(layout, column_no): width_list = [] for row in range(layout.rowCount()): item = layout.itemAtPosition(row, column_no) if item: - item_width = item.sizeHint().width() - - if not only_this_widget: - width_list.append(item_width) - elif isinstance(item.widget(), only_this_widget): - width_list.append(item_width) + index = layout.indexOf(item.widget()) + # getItemPosition will return a tuple: (row, col, rosSpan, colSpan) + col_span = layout.getItemPosition(index)[3] + if col_span == 1: + width_list.append(item.sizeHint().width()) return max(width_list) if width_list else None # find the maximum width for all grid layouts on the specified column all_col_size_list = [] for grid_lay in grid_layout_list: - lay_m_size = get_max_cell_width(grid_lay, column_no=column, only_this_widget=only_wdg) + lay_m_size = get_max_cell_width(grid_lay, column_no=column) if lay_m_size: all_col_size_list.append(lay_m_size) diff --git a/appPlugins/ToolDrilling.py b/appPlugins/ToolDrilling.py index 035c8010..59242d55 100644 --- a/appPlugins/ToolDrilling.py +++ b/appPlugins/ToolDrilling.py @@ -2879,6 +2879,8 @@ class DrillingUI: # separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) # grid3.addWidget(separator_line, 25, 0, 1, 2) + FCGridLayout.set_common_column_size([grid0, grid1, grid2, grid3, grid_a1], 0) + self.generate_cnc_button = QtWidgets.QPushButton(_('Generate CNCJob object')) self.generate_cnc_button.setIcon(QtGui.QIcon(self.app.resource_location + '/cnc16.png')) self.generate_cnc_button.setToolTip( diff --git a/appPlugins/ToolMilling.py b/appPlugins/ToolMilling.py index f8b10fb1..95b2d7d4 100644 --- a/appPlugins/ToolMilling.py +++ b/appPlugins/ToolMilling.py @@ -563,7 +563,8 @@ class ToolMilling(AppTool, Excellon): self.ui.pp_geo_name_cb.addItem(name) # and add ToolTips (useful when names are too long) for it in range(self.ui.pp_geo_name_cb.count()): - self.ui.pp_geo_name_cb.setItemData(it, self.ui.pp_geo_name_cb.itemText(it), QtCore.Qt.ItemDataRole.ToolTipRole) + self.ui.pp_geo_name_cb.setItemData(it, self.ui.pp_geo_name_cb.itemText(it), + QtCore.Qt.ItemDataRole.ToolTipRole) # Fill form fields self.to_form() @@ -670,12 +671,7 @@ class ToolMilling(AppTool, Excellon): """) # Add Tool section - self.ui.tool_sel_label.hide() - self.ui.addtool_entry_lbl.hide() - self.ui.addtool_entry.hide() - self.ui.search_and_add_btn.hide() - self.ui.addtool_from_db_btn.hide() - self.ui.deltool_btn.hide() + self.ui.add_tool_frame.hide() # Tool parameters section if self.ui.target_radio.get_value() == 'geo': @@ -685,7 +681,7 @@ class ToolMilling(AppTool, Excellon): tool_data['tools_mill_offset_type'] = 0 # 'Path' tool_data['tools_mill_offset_value'] = 0.0 - tool_data['tools_mill_job_type'] = 0 #_('Roughing') + tool_data['tools_mill_job_type'] = 0 # _('Roughing') tool_data['tools_mill_multidepth'] = False tool_data['tools_mill_extracut'] = False @@ -733,12 +729,7 @@ class ToolMilling(AppTool, Excellon): """) # Add Tool section - self.ui.tool_sel_label.show() - self.ui.addtool_entry_lbl.show() - self.ui.addtool_entry.show() - self.ui.search_and_add_btn.show() - self.ui.addtool_from_db_btn.show() - self.ui.deltool_btn.show() + self.ui.add_tool_frame.show() # Tool parameters section if self.ui.target_radio.get_value() == 'geo': @@ -3790,12 +3781,17 @@ class MillingUI: self.add_tool_frame.setContentsMargins(0, 0, 0, 0) grid1.addWidget(self.add_tool_frame, 6, 0, 1, 2) - grid__add_tool = FCGridLayout(v_spacing=5, h_spacing=3) - grid__add_tool.setContentsMargins(0, 0, 0, 0) - self.add_tool_frame.setLayout(grid__add_tool) + grid_add_tool = FCGridLayout(v_spacing=5, h_spacing=3) + grid_add_tool.setContentsMargins(0, 0, 0, 0) + self.add_tool_frame.setLayout(grid_add_tool) + + separator_line = QtWidgets.QFrame() + separator_line.setFrameShape(QtWidgets.QFrame.Shape.HLine) + separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) + grid_add_tool.addWidget(separator_line, 0, 0, 1, 2) self.tool_sel_label = FCLabel('%s' % _("Add from DB")) - grid__add_tool.addWidget(self.tool_sel_label, 2, 0, 1, 2) + grid_add_tool.addWidget(self.tool_sel_label, 2, 0, 1, 2) self.addtool_entry_lbl = FCLabel('%s:' % _('Tool Dia')) self.addtool_entry_lbl.setToolTip( @@ -3807,8 +3803,8 @@ class MillingUI: self.addtool_entry.setSingleStep(0.1) self.addtool_entry.setObjectName("mill_cnctooldia") - grid__add_tool.addWidget(self.addtool_entry_lbl, 3, 0) - grid__add_tool.addWidget(self.addtool_entry, 3, 1) + grid_add_tool.addWidget(self.addtool_entry_lbl, 3, 0) + grid_add_tool.addWidget(self.addtool_entry, 3, 1) # ############################################################################################################# # ################################ Button Grid ########################################################### @@ -3816,7 +3812,7 @@ class MillingUI: button_grid = FCGridLayout(v_spacing=5, h_spacing=3) button_grid.setColumnStretch(0, 1) button_grid.setColumnStretch(1, 0) - grid__add_tool.addLayout(button_grid, 5, 0, 1, 2) + grid_add_tool.addLayout(button_grid, 5, 0, 1, 2) self.search_and_add_btn = FCButton(_('Search and Add')) self.search_and_add_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/plus16.png')) @@ -4597,6 +4593,9 @@ class MillingUI: # -------------------------- EXCLUSION AREAS END ------------------------------------------------------------- # ------------------------------------------------------------------------------------------------------------ + FCGridLayout.set_common_column_size( + [grid0, grid_title_tool_table, grid1, grid_add_tool, button_grid, grid2, grid3, grid_a1], 0) + # ############################################################################################################# # Generate CNC Job object # ############################################################################################################# diff --git a/appPlugins/ToolPanelize.py b/appPlugins/ToolPanelize.py index 3b1a1748..4c21438d 100644 --- a/appPlugins/ToolPanelize.py +++ b/appPlugins/ToolPanelize.py @@ -1369,7 +1369,7 @@ class PanelizeUI: self.separator_line.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) grid3.addWidget(self.separator_line, 10, 0, 1, 2) - # FCGridLayout.set_common_column_size([grid0, grid1, grid2, grid3], 0, FCLabel) + FCGridLayout.set_common_column_size([grid0, grid1, grid2, grid3], 0) # ############################################################################################################# # Generate Panel Button