From d7677b5e08d90203451875cc42ece49b122fd115 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 11 May 2020 18:02:34 +0300 Subject: [PATCH 1/6] - remade the Snap Toolbar presence; now it is always active and situated in the Status Bar --- CHANGELOG.md | 1 + FlatCAMApp.py | 12 ++- FlatCAMCommon.py | 2 +- flatcamEditors/FlatCAMExcEditor.py | 3 +- flatcamEditors/FlatCAMGeoEditor.py | 3 +- flatcamEditors/FlatCAMGrbEditor.py | 3 +- flatcamGUI/FlatCAMGUI.py | 92 +++---------------- flatcamGUI/PlotCanvas.py | 8 +- .../general/GeneralGUIPrefGroupUI.py | 13 --- flatcamTools/ToolCopperThieving.py | 2 +- flatcamTools/ToolDistance.py | 2 +- flatcamTools/ToolNCC.py | 2 +- flatcamTools/ToolPaint.py | 2 +- 13 files changed, 32 insertions(+), 113 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f6c6b3d..0392dee2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ CHANGELOG for FlatCAM beta - removed the labels in status bar that display X,Y positions and replaced it with a HUD display on canvas (combo key SHIFT+H) will toggle the display of the HUD - made the HUD work in Legacy2D mode - fixed situation when the mouse cursor is outside of the canvas and no therefore returning None values +- remade the Snap Toolbar presence; now it is always active and situated in the Status Bar 10.05.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 5864bb2a..14e5b141 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -2064,18 +2064,22 @@ class App(QtCore.QObject): """ # Toolbar + + # File Toolbar Signals # self.ui.file_new_btn.triggered.connect(self.on_file_new) self.ui.file_open_btn.triggered.connect(self.on_file_openproject) self.ui.file_save_btn.triggered.connect(self.on_file_saveproject) self.ui.file_open_gerber_btn.triggered.connect(self.on_fileopengerber) self.ui.file_open_excellon_btn.triggered.connect(self.on_fileopenexcellon) + # View Toolbar Signals self.ui.clear_plot_btn.triggered.connect(self.clear_plots) self.ui.replot_btn.triggered.connect(self.plot_all) self.ui.zoom_fit_btn.triggered.connect(self.on_zoom_fit) self.ui.zoom_in_btn.triggered.connect(lambda: self.plotcanvas.zoom(1 / 1.5)) self.ui.zoom_out_btn.triggered.connect(lambda: self.plotcanvas.zoom(1.5)) + # Edit Toolbar Signals self.ui.newgeo_btn.triggered.connect(self.new_geometry_object) self.ui.newgrb_btn.triggered.connect(self.new_gerber_object) self.ui.newexc_btn.triggered.connect(self.new_excellon_object) @@ -2092,6 +2096,7 @@ class App(QtCore.QObject): self.ui.jmp_btn.triggered.connect(self.on_jump_to) self.ui.locate_btn.triggered.connect(lambda: self.on_locate(obj=self.collection.get_active())) + # Scripting Toolbar Signals self.ui.shell_btn.triggered.connect(self.toggle_shell) self.ui.new_script_btn.triggered.connect(self.on_filenewscript) self.ui.open_script_btn.triggered.connect(self.on_fileopenscript) @@ -4573,7 +4578,6 @@ class App(QtCore.QObject): self.defaults.report_usage("on_toggle_grid()") self.ui.grid_snap_btn.trigger() - self.ui.on_grid_snap_triggered(state=True) def on_toggle_grid_lines(self): self.defaults.report_usage("on_toggle_grd_lines()") @@ -5390,7 +5394,7 @@ class App(QtCore.QObject): units = self.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( dx, units, dy, units, location[0], units, location[1], units) self.inform.emit('[success] %s' % _("Done.")) @@ -5544,7 +5548,7 @@ class App(QtCore.QObject): units = self.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.dx, units, self.dy, units, location[0], units, location[1], units) self.inform.emit('[success] %s' % _("Done.")) @@ -6773,7 +6777,7 @@ class App(QtCore.QObject): units = self.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.dx, units, self.dy, units, pos[0], units, pos[1], units) self.mouse = [pos[0], pos[1]] diff --git a/FlatCAMCommon.py b/FlatCAMCommon.py index bcd61a98..ea6c3f78 100644 --- a/FlatCAMCommon.py +++ b/FlatCAMCommon.py @@ -478,7 +478,7 @@ class ExclusionAreas(QtCore.QObject): units = self.app.defaults["units"].lower() self.app.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units) if self.obj_type == 'excellon': diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py index 7b68f11c..e598cc20 100644 --- a/flatcamEditors/FlatCAMExcEditor.py +++ b/flatcamEditors/FlatCAMExcEditor.py @@ -2837,7 +2837,6 @@ class FlatCAMExcEditor(QtCore.QObject): # start with GRID toolbar activated if self.app.ui.grid_snap_btn.isChecked() is False: self.app.ui.grid_snap_btn.trigger() - self.app.ui.on_grid_snap_triggered(state=True) self.app.ui.popmenu_disable.setVisible(False) self.app.ui.cmenu_newmenu.menuAction().setVisible(False) @@ -3815,7 +3814,7 @@ class FlatCAMExcEditor(QtCore.QObject): units = self.app.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, x, units, y, units) # ## Utility geometry (animated) diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index e8d969cb..f897af79 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -4110,7 +4110,6 @@ class FlatCAMGeoEditor(QtCore.QObject): # start with GRID toolbar activated if self.app.ui.grid_snap_btn.isChecked() is False: self.app.ui.grid_snap_btn.trigger() - self.app.ui.on_grid_snap_triggered(state=True) def on_buffer_tool(self): buff_tool = BufferSelectionTool(self.app, self) @@ -4286,7 +4285,7 @@ class FlatCAMGeoEditor(QtCore.QObject): units = self.app.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, x, units, y, units) if event.button == 1 and event_is_dragging and isinstance(self.active_tool, FCEraser): diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index d5659fbf..adcb5c9f 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -3703,7 +3703,6 @@ class FlatCAMGrbEditor(QtCore.QObject): # start with GRID toolbar activated if self.app.ui.grid_snap_btn.isChecked() is False: self.app.ui.grid_snap_btn.trigger() - self.app.ui.on_grid_snap_triggered(state=True) # adjust the visibility of some of the canvas context menu self.app.ui.popmenu_edit.setVisible(False) @@ -4789,7 +4788,7 @@ class FlatCAMGrbEditor(QtCore.QObject): units = self.app.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, x, units, y, units) self.update_utility_geometry(data=(x, y)) diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index aeb7b86d..86dfb23f 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -819,15 +819,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.snap_toolbar = QtWidgets.QToolBar(_('Grid Toolbar')) self.snap_toolbar.setObjectName('Snap_TB') - self.addToolBar(self.snap_toolbar) - - flat_settings = QSettings("Open Source", "FlatCAM") - if flat_settings.contains("layout"): - layout = flat_settings.value('layout', type=str) - if layout == 'compact': - self.removeToolBar(self.snap_toolbar) - self.snap_toolbar.setMaximumHeight(30) - self.splitter_left.addWidget(self.snap_toolbar) + # self.addToolBar(self.snap_toolbar) + self.snap_toolbar.setStyleSheet( + """ + QToolBar { padding: 0; } + QToolBar QToolButton { padding: -2; margin: -2; } + """ + ) # ######################################################################## # ########################## File Toolbar# ############################### @@ -2302,10 +2300,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.fcinfo = FlatCAMInfoBar(app=self.app) self.infobar.addWidget(self.fcinfo, stretch=1) - self.snap_infobar_label = FCLabel() - self.snap_infobar_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/snap_16.png')) - self.infobar.addWidget(self.snap_infobar_label) - # self.rel_position_label = QtWidgets.QLabel( # "Dx: 0.0000   Dy: 0.0000    ") # self.rel_position_label.setMinimumWidth(110) @@ -2318,6 +2312,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # self.position_label.setToolTip(_("Absolute measurement.\nReference is (X=0, Y= 0) position")) # self.infobar.addWidget(self.position_label) + self.snap_toolbar.setMaximumHeight(24) + self.infobar.addWidget(self.snap_toolbar) + self.units_label = QtWidgets.QLabel("[in]") self.units_label.setMargin(2) self.infobar.addWidget(self.units_label) @@ -2438,14 +2435,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow): del qsettings self.lock_toolbar(lock=lock_state) - self.on_grid_snap_triggered(state=True) self.lock_action.triggered[bool].connect(self.lock_toolbar) self.pref_open_button.clicked.connect(self.on_preferences_open_folder) self.clear_btn.clicked.connect(self.on_gui_clear) - self.grid_snap_btn.triggered.connect(self.on_grid_snap_triggered) - self.snap_infobar_label.clicked.connect(self.on_grid_icon_snap_clicked) # to be used in the future # self.plot_tab_area.tab_attached.connect(lambda x: print(x)) @@ -2455,29 +2449,6 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # %%%%%%%%%%%%%%%%% GUI Building FINISHED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - def on_grid_snap_triggered(self, state): - """ - - :param state: A parameter with the state of the grid, boolean - - :return: - """ - if state: - self.snap_infobar_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/snap_filled_16.png')) - else: - self.snap_infobar_label.setPixmap(QtGui.QPixmap(self.app.resource_location + '/snap_16.png')) - - self.snap_infobar_label.clicked_state = state - - def on_grid_icon_snap_clicked(self): - """ - Slot called by clicking a GUI element, in this case a FCLabel - - :return: - """ - if isinstance(self.sender(), FCLabel): - self.grid_snap_btn.trigger() - def eventFilter(self, obj, event): """ Filter the ToolTips display based on a Preferences setting @@ -2786,52 +2757,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.aperture_move_btn = self.grb_edit_toolbar.addAction( QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move")) - # ######################################################################## - # ## Snap Toolbar # ## - # ######################################################################## - - # Snap GRID toolbar is always active to facilitate usage of measurements done on GRID - # self.addToolBar(self.snap_toolbar) - self.grid_snap_btn = self.snap_toolbar.addAction( - QtGui.QIcon(self.app.resource_location + '/grid32.png'), _('Snap to grid')) - self.grid_gap_x_entry = FCEntry2() - self.grid_gap_x_entry.setMaximumWidth(70) - self.grid_gap_x_entry.setToolTip(_("Grid X snapping distance")) - self.snap_toolbar.addWidget(self.grid_gap_x_entry) - - self.grid_gap_y_entry = FCEntry2() - self.grid_gap_y_entry.setMaximumWidth(70) - self.grid_gap_y_entry.setToolTip(_("Grid Y snapping distance")) - self.snap_toolbar.addWidget(self.grid_gap_y_entry) - - self.grid_space_label = QtWidgets.QLabel(" ") - self.snap_toolbar.addWidget(self.grid_space_label) - self.grid_gap_link_cb = FCCheckBox() - self.grid_gap_link_cb.setToolTip(_("When active, value on Grid_X\n" - "is copied to the Grid_Y value.")) - self.snap_toolbar.addWidget(self.grid_gap_link_cb) - - self.ois_grid = OptionalInputSection(self.grid_gap_link_cb, [self.grid_gap_y_entry], logic=False) - - self.corner_snap_btn = self.snap_toolbar.addAction( - QtGui.QIcon(self.app.resource_location + '/corner32.png'), _('Snap to corner')) - - self.snap_max_dist_entry = FCEntry() - self.snap_max_dist_entry.setMaximumWidth(70) - self.snap_max_dist_entry.setToolTip(_("Max. magnet distance")) - self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry) - - self.grid_snap_btn.setCheckable(True) - self.corner_snap_btn.setCheckable(True) - self.update_obj_btn.setEnabled(False) - # start with GRID activated - self.grid_snap_btn.trigger() - qsettings = QSettings("Open Source", "FlatCAM") if qsettings.contains("layout"): layout = qsettings.value('layout', type=str) - if layout == 'standard': + if layout == 'standard' or layout == 'minimal': self.corner_snap_btn.setVisible(False) self.snap_magnet.setVisible(False) else: diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py index a1be6099..75cba1da 100644 --- a/flatcamGUI/PlotCanvas.py +++ b/flatcamGUI/PlotCanvas.py @@ -150,17 +150,17 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): self.cursor_h_line = InfiniteLine(pos=None, color=c_color, vertical=False, parent=self.line_parent) - self.rect_hud = Rectangle(center=(90,45), color=self.rect_hud_color, border_color=self.rect_hud_color, - width=170, height=80, radius=[5, 5, 5, 5], parent=None) + self.rect_hud = Rectangle(center=(95,50), color=self.rect_hud_color, border_color=self.rect_hud_color, + width=180, height=90, radius=[5, 5, 5, 5], parent=None) self.rect_hud.set_gl_state(depth_test=False) # HUD Display self.hud_enabled = False - self.text_hud = Text('', color=self.text_hud_color, pos=(8, 45), method='gpu', anchor_x='left', parent=None) + self.text_hud = Text('', color=self.text_hud_color, pos=(10, 50), method='gpu', anchor_x='left', parent=None) self.text_hud.font_size = 8 units = self.fcapp.defaults["units"].lower() - self.text_hud.text = 'Dx:\t%s [%s]\nDy:\t%s [%s]\nX: \t%s [%s]\nY: \t%s [%s]' % \ + self.text_hud.text = 'Dx:\t%s [%s]\nDy:\t%s [%s]\n\nX: \t%s [%s]\nY: \t%s [%s]' % \ ('0.0000', units, '0.0000', units, '0.0000', units, '0.0000', units) if self.fcapp.defaults['global_hud'] is True: diff --git a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py index baedacc7..914fc75f 100644 --- a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py +++ b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py @@ -654,7 +654,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.removeToolBar(self.app.ui.exc_edit_toolbar) self.app.ui.removeToolBar(self.app.ui.geo_edit_toolbar) self.app.ui.removeToolBar(self.app.ui.grb_edit_toolbar) - self.app.ui.removeToolBar(self.app.ui.snap_toolbar) self.app.ui.removeToolBar(self.app.ui.toolbarshell) except Exception: pass @@ -697,11 +696,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB') self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.exc_edit_toolbar) - self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar') - self.app.ui.snap_toolbar.setObjectName('Snap_TB') - self.app.ui.snap_toolbar.setMaximumHeight(30) - self.app.ui.splitter_left.addWidget(self.app.ui.snap_toolbar) - self.app.ui.corner_snap_btn.setVisible(True) self.app.ui.snap_magnet.setVisible(True) else: @@ -743,18 +737,12 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB') self.app.ui.addToolBar(self.app.ui.grb_edit_toolbar) - self.app.ui.snap_toolbar = QtWidgets.QToolBar('Grid Toolbar') - self.app.ui.snap_toolbar.setObjectName('Snap_TB') - # self.app.ui.snap_toolbar.setMaximumHeight(30) - self.app.ui.addToolBar(self.app.ui.snap_toolbar) - self.app.ui.corner_snap_btn.setVisible(False) self.app.ui.snap_magnet.setVisible(False) if current_layout == 'minimal': self.app.ui.toolbarview.setVisible(False) self.app.ui.toolbarshell.setVisible(False) - self.app.ui.snap_toolbar.setVisible(False) self.app.ui.geo_edit_toolbar.setVisible(False) self.app.ui.grb_edit_toolbar.setVisible(False) self.app.ui.exc_edit_toolbar.setVisible(False) @@ -767,7 +755,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.connect_toolbar_signals() self.app.ui.grid_snap_btn.setChecked(True) - self.app.ui.on_grid_snap_triggered(state=True) self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"])) self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"])) diff --git a/flatcamTools/ToolCopperThieving.py b/flatcamTools/ToolCopperThieving.py index f6c85731..2b3b447c 100644 --- a/flatcamTools/ToolCopperThieving.py +++ b/flatcamTools/ToolCopperThieving.py @@ -924,7 +924,7 @@ class ToolCopperThieving(FlatCAMTool): units = self.app.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units) # draw the utility geometry diff --git a/flatcamTools/ToolDistance.py b/flatcamTools/ToolDistance.py index bcc506fb..7c28ed84 100644 --- a/flatcamTools/ToolDistance.py +++ b/flatcamTools/ToolDistance.py @@ -552,7 +552,7 @@ class Distance(FlatCAMTool): units = self.app.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( 0.0000, units, 0.0000, units, pos[0], units, pos[1], units) if self.rel_point1 is not None: diff --git a/flatcamTools/ToolNCC.py b/flatcamTools/ToolNCC.py index d01f02de..0a89be0e 100644 --- a/flatcamTools/ToolNCC.py +++ b/flatcamTools/ToolNCC.py @@ -1839,7 +1839,7 @@ class NonCopperClear(FlatCAMTool, Gerber): units = self.app.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units) # draw the utility geometry diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index ae1b23cc..60abee34 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -1738,7 +1738,7 @@ class ToolPaint(FlatCAMTool, Gerber): units = self.app.defaults["units"].lower() self.plotcanvas.text_hud.text = \ - 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( + 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units) # draw the utility geometry From 3c0ee97c61a0de7d9c8d68dcb1f77ef9d1effd6d Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 11 May 2020 20:10:27 +0300 Subject: [PATCH 2/6] - Snap Toolbar is now visible in Fullscreen - in Fullscreen now the Notebook is available but it will be hidden on Fullscreen launch - fixed some minor issues (in the HUD added a separating line, missing an icon in toolbars on first launch) --- CHANGELOG.md | 3 +++ FlatCAMApp.py | 6 ++++-- flatcamEditors/FlatCAMExcEditor.py | 2 +- flatcamEditors/FlatCAMGeoEditor.py | 2 +- flatcamEditors/FlatCAMGrbEditor.py | 9 ++++----- flatcamGUI/FlatCAMGUI.py | 2 ++ flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py | 3 +++ flatcamTools/ToolCopperThieving.py | 2 +- flatcamTools/ToolDistance.py | 2 +- flatcamTools/ToolNCC.py | 2 +- flatcamTools/ToolPaint.py | 2 +- 11 files changed, 22 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0392dee2..62d94acc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ CHANGELOG for FlatCAM beta - made the HUD work in Legacy2D mode - fixed situation when the mouse cursor is outside of the canvas and no therefore returning None values - remade the Snap Toolbar presence; now it is always active and situated in the Status Bar +- Snap Toolbar is now visible in Fullscreen +- in Fullscreen now the Notebook is available but it will be hidden on Fullscreen launch +- fixed some minor issues (in the HUD added a separating line, missing an icon in toolbars on first launch) 10.05.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 14e5b141..106b1496 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -4508,14 +4508,16 @@ class App(QtCore.QObject): for tb in self.ui.findChildren(QtWidgets.QToolBar): tb.setVisible(False) - self.ui.splitter_left.setVisible(False) + self.ui.snap_toolbar.setVisible(True) # This is always visible + # self.ui.splitter_left.setVisible(False) + self.ui.splitter.setSizes([0, 1]) self.toggle_fscreen = True elif self.toggle_fscreen is True or disable is True: self.ui.setWindowFlags(flags & ~Qt.FramelessWindowHint) self.ui.setGeometry(self.x_pos, self.y_pos, self.width, self.height) self.ui.showNormal() self.restore_toolbar_view() - self.ui.splitter_left.setVisible(True) + # self.ui.splitter_left.setVisible(True) self.toggle_fscreen = False def on_toggle_plotarea(self): diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py index e598cc20..5023386c 100644 --- a/flatcamEditors/FlatCAMExcEditor.py +++ b/flatcamEditors/FlatCAMExcEditor.py @@ -3813,7 +3813,7 @@ class FlatCAMExcEditor(QtCore.QObject): # "%.4f    " % (self.app.dx, self.app.dy)) units = self.app.defaults["units"].lower() - self.plotcanvas.text_hud.text = \ + self.app.plotcanvas.text_hud.text = \ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, x, units, y, units) diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index f897af79..d3675cfb 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -4284,7 +4284,7 @@ class FlatCAMGeoEditor(QtCore.QObject): # "%.4f    " % (self.app.dx, self.app.dy)) units = self.app.defaults["units"].lower() - self.plotcanvas.text_hud.text = \ + self.app.plotcanvas.text_hud.text = \ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, x, units, y, units) diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index adcb5c9f..54dd72b4 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -4536,8 +4536,8 @@ class FlatCAMGrbEditor(QtCore.QObject): self.pos = (self.pos[0], self.pos[1]) if event.button == 1: - self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " - "%.4f    " % (0, 0)) + # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " + # "%.4f    " % (0, 0)) # Selection with left mouse button if self.active_tool is not None: @@ -4549,8 +4549,7 @@ class FlatCAMGrbEditor(QtCore.QObject): self.app.defaults["global_point_clipboard_format"] % (self.decimals, self.pos[0], self.decimals, self.pos[1]) ) - self.app.inform.emit('[success] %s' % - _("Coordinates copied to clipboard.")) + self.app.inform.emit('[success] %s' % _("Coordinates copied to clipboard.")) return # Dispatch event to active_tool @@ -4787,7 +4786,7 @@ class FlatCAMGrbEditor(QtCore.QObject): # "%.4f    " % (self.app.dx, self.app.dy)) units = self.app.defaults["units"].lower() - self.plotcanvas.text_hud.text = \ + self.app.plotcanvas.text_hud.text = \ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, x, units, y, units) diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 86dfb23f..62eeaa13 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2555,6 +2555,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow): QtGui.QIcon(self.app.resource_location + '/distance_min32.png'), _("Distance Min Tool")) self.origin_btn = self.toolbargeo.addAction( QtGui.QIcon(self.app.resource_location + '/origin32.png'), _('Set Origin')) + self.move2origin_btn = self.toolbargeo.addAction( + QtGui.QIcon(self.app.resource_location + '/origin2_32.png'), _('Move to Origin')) self.jmp_btn = self.toolbargeo.addAction( QtGui.QIcon(self.app.resource_location + '/jump_to16.png'), _('Jump to Location')) self.locate_btn = self.toolbargeo.addAction( diff --git a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py index 914fc75f..3815bed7 100644 --- a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py +++ b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py @@ -748,6 +748,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.exc_edit_toolbar.setVisible(False) self.app.ui.lock_toolbar(lock=True) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) + # add all the actions to the toolbars self.app.ui.populate_toolbars() diff --git a/flatcamTools/ToolCopperThieving.py b/flatcamTools/ToolCopperThieving.py index 2b3b447c..8adb9fc4 100644 --- a/flatcamTools/ToolCopperThieving.py +++ b/flatcamTools/ToolCopperThieving.py @@ -923,7 +923,7 @@ class ToolCopperThieving(FlatCAMTool): # "%.4f    " % (self.app.dx, self.app.dy)) units = self.app.defaults["units"].lower() - self.plotcanvas.text_hud.text = \ + self.app.plotcanvas.text_hud.text = \ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units) diff --git a/flatcamTools/ToolDistance.py b/flatcamTools/ToolDistance.py index 7c28ed84..ef239454 100644 --- a/flatcamTools/ToolDistance.py +++ b/flatcamTools/ToolDistance.py @@ -551,7 +551,7 @@ class Distance(FlatCAMTool): # ) units = self.app.defaults["units"].lower() - self.plotcanvas.text_hud.text = \ + self.app.plotcanvas.text_hud.text = \ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( 0.0000, units, 0.0000, units, pos[0], units, pos[1], units) diff --git a/flatcamTools/ToolNCC.py b/flatcamTools/ToolNCC.py index 0a89be0e..b3ab7fa5 100644 --- a/flatcamTools/ToolNCC.py +++ b/flatcamTools/ToolNCC.py @@ -1838,7 +1838,7 @@ class NonCopperClear(FlatCAMTool, Gerber): # "%.4f    " % (self.app.dx, self.app.dy)) units = self.app.defaults["units"].lower() - self.plotcanvas.text_hud.text = \ + self.app.plotcanvas.text_hud.text = \ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units) diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index 60abee34..131e025b 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -1737,7 +1737,7 @@ class ToolPaint(FlatCAMTool, Gerber): # "%.4f    " % (self.app.dx, self.app.dy)) units = self.app.defaults["units"].lower() - self.plotcanvas.text_hud.text = \ + self.app.plotcanvas.text_hud.text = \ 'Dx:\t{:<.4f} [{:s}]\nDy:\t{:<.4f} [{:s}]\n\nX: \t{:<.4f} [{:s}]\nY: \t{:<.4f} [{:s}]'.format( self.app.dx, units, self.app.dy, units, curr_pos[0], units, curr_pos[1], units) From 40c52455e1ee32e64701a94180283c0f06f0ccdf Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 11 May 2020 22:56:06 +0300 Subject: [PATCH 3/6] - made sure that the corner snap buttons are shown only in Editors - changed the HUD color when using Dark theme --- CHANGELOG.md | 2 ++ flatcamEditors/FlatCAMExcEditor.py | 30 ++----------------- flatcamEditors/FlatCAMGeoEditor.py | 27 ++--------------- flatcamEditors/FlatCAMGrbEditor.py | 29 ++---------------- flatcamGUI/FlatCAMGUI.py | 29 ++++++------------ flatcamGUI/PlotCanvas.py | 2 +- .../general/GeneralGUIPrefGroupUI.py | 11 ++----- 7 files changed, 24 insertions(+), 106 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62d94acc..938e7d72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ CHANGELOG for FlatCAM beta - Snap Toolbar is now visible in Fullscreen - in Fullscreen now the Notebook is available but it will be hidden on Fullscreen launch - fixed some minor issues (in the HUD added a separating line, missing an icon in toolbars on first launch) +- made sure that the corner snap buttons are shown only in Editors +- changed the HUD color when using Dark theme 10.05.2020 diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py index 5023386c..e77d0928 100644 --- a/flatcamEditors/FlatCAMExcEditor.py +++ b/flatcamEditors/FlatCAMExcEditor.py @@ -2819,10 +2819,8 @@ class FlatCAMExcEditor(QtCore.QObject): self.tool_shape.enabled = True # self.app.app_cursor.enabled = True - self.app.ui.snap_max_dist_entry.setEnabled(True) - self.app.ui.corner_snap_btn.setEnabled(True) - self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) + self.app.ui.snap_magnet.setVisible(True) self.app.ui.exc_editor_menu.setDisabled(False) self.app.ui.exc_editor_menu.menuAction().setVisible(True) @@ -2868,30 +2866,8 @@ class FlatCAMExcEditor(QtCore.QObject): self.clear() self.app.ui.exc_edit_toolbar.setDisabled(True) - settings = QSettings("Open Source", "FlatCAM") - if settings.contains("layout"): - layout = settings.value('layout', type=str) - if layout == 'standard': - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - else: - # self.app.ui.exc_edit_toolbar.setVisible(True) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(True) - self.app.ui.corner_snap_btn.setVisible(True) - else: - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) # set the Editor Toolbar visibility to what was before entering in the Editor self.app.ui.exc_edit_toolbar.setVisible(False) if self.toolbar_old_state is False \ diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index d3675cfb..6e4b616b 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -3654,10 +3654,8 @@ class FlatCAMGeoEditor(QtCore.QObject): self.tool_shape.enabled = True self.app.app_cursor.enabled = True - self.app.ui.snap_max_dist_entry.setEnabled(True) - self.app.ui.corner_snap_btn.setEnabled(True) - self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) + self.app.ui.snap_magnet.setVisible(True) self.app.ui.geo_editor_menu.setDisabled(False) self.app.ui.geo_editor_menu.menuAction().setVisible(True) @@ -3713,27 +3711,8 @@ class FlatCAMGeoEditor(QtCore.QObject): self.app.ui.geo_edit_toolbar.setDisabled(True) settings = QSettings("Open Source", "FlatCAM") - if settings.contains("layout"): - layout = settings.value('layout', type=str) - if layout == 'standard': - # self.app.ui.geo_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - else: - # self.app.ui.geo_edit_toolbar.setVisible(True) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - else: - # self.app.ui.geo_edit_toolbar.setVisible(False) - - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) # set the Editor Toolbar visibility to what was before entering in the Editor self.app.ui.geo_edit_toolbar.setVisible(False) if self.toolbar_old_state is False \ diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index 54dd72b4..0658926b 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -3685,10 +3685,8 @@ class FlatCAMGrbEditor(QtCore.QObject): self.shapes.enabled = True self.tool_shape.enabled = True - self.app.ui.snap_max_dist_entry.setEnabled(True) - self.app.ui.corner_snap_btn.setEnabled(True) - self.app.ui.snap_magnet.setVisible(True) self.app.ui.corner_snap_btn.setVisible(True) + self.app.ui.snap_magnet.setVisible(True) self.app.ui.grb_editor_menu.setDisabled(False) self.app.ui.grb_editor_menu.menuAction().setVisible(True) @@ -3735,29 +3733,8 @@ class FlatCAMGrbEditor(QtCore.QObject): self.app.ui.grb_edit_toolbar.setDisabled(True) settings = QSettings("Open Source", "FlatCAM") - if settings.contains("layout"): - layout = settings.value('layout', type=str) - if layout == 'standard': - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) - else: - # self.app.ui.exc_edit_toolbar.setVisible(True) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(True) - self.app.ui.corner_snap_btn.setVisible(True) - else: - # self.app.ui.exc_edit_toolbar.setVisible(False) - - self.app.ui.snap_max_dist_entry.setEnabled(False) - self.app.ui.corner_snap_btn.setEnabled(False) - self.app.ui.snap_magnet.setVisible(False) - self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) # set the Editor Toolbar visibility to what was before entering in the Editor self.app.ui.grb_edit_toolbar.setVisible(False) if self.toolbar_old_state is False \ diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 62eeaa13..08821168 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -1110,6 +1110,9 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.snap_max_dist_entry.setToolTip(_("Max. magnet distance")) self.snap_magnet = self.snap_toolbar.addWidget(self.snap_max_dist_entry) + self.corner_snap_btn.setVisible(False) + self.snap_magnet.setVisible(False) + # ######################################################################## # ########################## Notebook # ################################## # ######################################################################## @@ -2384,29 +2387,21 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.restoreState(saved_gui_state) log.debug("FlatCAMGUI.__init__() --> UI state restored from QSettings.") + self.corner_snap_btn.setVisible(False) + self.snap_magnet.setVisible(False) + if flat_settings.contains("layout"): layout = flat_settings.value('layout', type=str) self.exc_edit_toolbar.setDisabled(True) self.geo_edit_toolbar.setDisabled(True) self.grb_edit_toolbar.setDisabled(True) - if layout == 'standard': - self.corner_snap_btn.setVisible(False) - self.snap_magnet.setVisible(False) - else: - self.snap_magnet.setVisible(True) - self.corner_snap_btn.setVisible(True) - self.snap_magnet.setDisabled(True) - self.corner_snap_btn.setDisabled(True) log.debug("FlatCAMGUI.__init__() --> UI layout restored from QSettings. Layout = %s" % str(layout)) else: self.exc_edit_toolbar.setDisabled(True) self.geo_edit_toolbar.setDisabled(True) self.grb_edit_toolbar.setDisabled(True) - self.corner_snap_btn.setVisible(False) - self.snap_magnet.setVisible(False) - flat_settings.setValue('layout', "standard") # This will write the setting to the platform specific storage. del flat_settings @@ -2759,19 +2754,13 @@ class FlatCAMGUI(QtWidgets.QMainWindow): self.aperture_move_btn = self.grb_edit_toolbar.addAction( QtGui.QIcon(self.app.resource_location + '/move32.png'), _("Move")) + self.corner_snap_btn.setVisible(False) + self.snap_magnet.setVisible(False) + qsettings = QSettings("Open Source", "FlatCAM") if qsettings.contains("layout"): layout = qsettings.value('layout', type=str) - if layout == 'standard' or layout == 'minimal': - self.corner_snap_btn.setVisible(False) - self.snap_magnet.setVisible(False) - else: - self.corner_snap_btn.setVisible(True) - self.snap_magnet.setVisible(True) - self.corner_snap_btn.setDisabled(True) - self.snap_magnet.setDisabled(True) - # on 'minimal' layout only some toolbars are active if layout != 'minimal': self.exc_edit_toolbar.setVisible(True) diff --git a/flatcamGUI/PlotCanvas.py b/flatcamGUI/PlotCanvas.py index 75cba1da..acd342ca 100644 --- a/flatcamGUI/PlotCanvas.py +++ b/flatcamGUI/PlotCanvas.py @@ -58,7 +58,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas): self.text_hud_color = 'black' else: self.line_color = (0.4, 0.4, 0.4, 1.0) - self.rect_hud_color = Color('#0000FF10') + self.rect_hud_color = Color('#80808040') self.text_hud_color = 'white' # workspace lines; I didn't use the rectangle because I didn't want to add another VisPy Node, diff --git a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py index 3815bed7..f9e86bf3 100644 --- a/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py +++ b/flatcamGUI/preferences/general/GeneralGUIPrefGroupUI.py @@ -696,8 +696,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.exc_edit_toolbar.setObjectName('ExcEditor_TB') self.app.ui.addToolBar(Qt.RightToolBarArea, self.app.ui.exc_edit_toolbar) - self.app.ui.corner_snap_btn.setVisible(True) - self.app.ui.snap_magnet.setVisible(True) else: # ## TOOLBAR INSTALLATION # ## self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar') @@ -737,9 +735,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.grb_edit_toolbar.setObjectName('GrbEditor_TB') self.app.ui.addToolBar(self.app.ui.grb_edit_toolbar) - self.app.ui.corner_snap_btn.setVisible(False) - self.app.ui.snap_magnet.setVisible(False) - if current_layout == 'minimal': self.app.ui.toolbarview.setVisible(False) self.app.ui.toolbarshell.setVisible(False) @@ -748,9 +743,6 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.exc_edit_toolbar.setVisible(False) self.app.ui.lock_toolbar(lock=True) - self.app.ui.corner_snap_btn.setVisible(False) - self.app.ui.snap_magnet.setVisible(False) - # add all the actions to the toolbars self.app.ui.populate_toolbars() @@ -759,6 +751,9 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI): self.app.ui.grid_snap_btn.setChecked(True) + self.app.ui.corner_snap_btn.setVisible(False) + self.app.ui.snap_magnet.setVisible(False) + self.app.ui.grid_gap_x_entry.setText(str(self.app.defaults["global_gridx"])) self.app.ui.grid_gap_y_entry.setText(str(self.app.defaults["global_gridy"])) self.app.ui.snap_max_dist_entry.setText(str(self.app.defaults["global_snap_max"])) From 3a337212f0c0d4f289fafee8d20bc25f8cdca800 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 12 May 2020 01:09:00 +0300 Subject: [PATCH 4/6] - fix issue in Legacy2D graphic mode where the snap function was not accessible when the PlotCanvasLegacy class was created - modified the HUD in Legacy2D when using Dark Theme to use different colors - modified how the graphic engine change act in Preferences: now only by clicking Apply(or Save) the change will happen. And there is also a message asking for confirmation --- CHANGELOG.md | 3 + FlatCAMApp.py | 3 +- flatcamGUI/PlotCanvasLegacy.py | 86 +++++++++++++++---- .../preferences/PreferencesUIManager.py | 28 ++++-- 4 files changed, 93 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 938e7d72..8e1866d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ CHANGELOG for FlatCAM beta - fixed some minor issues (in the HUD added a separating line, missing an icon in toolbars on first launch) - made sure that the corner snap buttons are shown only in Editors - changed the HUD color when using Dark theme +- fix issue in Legacy2D graphic mode where the snap function was not accessible when the PlotCanvasLegacy class was created +- modified the HUD in Legacy2D when using Dark Theme to use different colors +- modified how the graphic engine change act in Preferences: now only by clicking Apply(or Save) the change will happen. And there is also a message asking for confirmation 10.05.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 106b1496..c0007c80 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -981,7 +981,6 @@ class App(QtCore.QObject): # ########################################################################################################### # ######################################## GUI SETTINGS SIGNALS ############################################# # ########################################################################################################### - self.ui.general_defaults_form.general_app_group.ge_radio.activated_custom.connect(self.on_app_restart) self.ui.general_defaults_form.general_app_set_group.cursor_radio.activated_custom.connect(self.on_cursor_type) # ######################################## Tools related signals ############################################ @@ -4621,7 +4620,7 @@ class App(QtCore.QObject): if self.is_legacy is False: # HACK: enabling/disabling the cursor seams to somehow update the shapes on screen # - perhaps is a bug in VisPy implementation - if self.grid_status() is True: + if self.grid_status(): self.app_cursor.enabled = False self.app_cursor.enabled = True else: diff --git a/flatcamGUI/PlotCanvasLegacy.py b/flatcamGUI/PlotCanvasLegacy.py index 7856bb8f..0fabff1e 100644 --- a/flatcamGUI/PlotCanvasLegacy.py +++ b/flatcamGUI/PlotCanvasLegacy.py @@ -19,6 +19,8 @@ from shapely.geometry import Polygon, LineString, LinearRing from copy import deepcopy import logging +import numpy as np + import gettext import FlatCAMTranslation as fcTranslate import builtins @@ -153,8 +155,8 @@ class PlotCanvasLegacy(QtCore.QObject): else: theme_color = '#000000' tick_color = '#FFFFFF' - self.rect_hud_color = '#0000FF10' - self.text_hud_color = '#000000' + self.rect_hud_color = '#80808040' + self.text_hud_color = '#FFFFFF' # workspace lines; I didn't use the rectangle because I didn't want to add another VisPy Node, # which might decrease performance @@ -306,11 +308,6 @@ class PlotCanvasLegacy(QtCore.QObject): self.hud_enabled = False self.text_hud = self.Thud(plotcanvas=self) - # bbox_props = dict(boxstyle="round,pad=0.3", fc="blue", ec="b", lw=0) - # self.text_hud = self.figure.text(0, 0, "Direction", ha="left", va="center", rotation=0, - # size=15, - # bbox=bbox_props) - # draw a rectangle made out of 4 lines on the canvas to serve as a hint for the work area # all CNC have a limited workspace if self.app.defaults['global_workspace'] is True: @@ -336,19 +333,21 @@ class PlotCanvasLegacy(QtCore.QObject): self.p = plotcanvas units = self.p.app.defaults['units'] - self._text = 'Dx: %s [%s]\nDy: %s [%s]\nX: %s [%s]\nY: %s [%s]' % \ + self._text = 'Dx: %s [%s]\nDy: %s [%s]\n\nX: %s [%s]\nY: %s [%s]' % \ ('0.0000', units, '0.0000', units, '0.0000', units, '0.0000', units) - self.hud_holder = AnchoredText(self._text, - prop=dict(size=20), frameon=True, - loc='upper left', - ) + self.hud_holder = AnchoredText(self._text, prop=dict(size=20), frameon=True, loc='upper left') self.hud_holder.patch.set_boxstyle("round,pad=0.,rounding_size=0.2") - self.hud_holder.patch.set_facecolor('blue') - self.hud_holder.patch.set_alpha(0.3) + fc_color = self.p.rect_hud_color[:-2] + fc_alpha = int(self.p.rect_hud_color[-2:], 16) / 255 + text_color = self.p.text_hud_color + + self.hud_holder.patch.set_facecolor(fc_color) + self.hud_holder.patch.set_alpha(fc_alpha) self.hud_holder.patch.set_edgecolor((0, 0, 0, 0)) + self. hud_holder.txt._text.set_color(color=text_color) self.text_changed.connect(self.on_text_changed) @property @@ -496,7 +495,7 @@ class PlotCanvasLegacy(QtCore.QObject): if self.big_cursor is False: try: - x, y = self.app.geo_editor.snap(x_pos, y_pos) + x, y = self.snap(x_pos, y_pos) # Pointer (snapped) # The size of the cursor is multiplied by 1.65 because that value made the cursor similar with the @@ -529,7 +528,7 @@ class PlotCanvasLegacy(QtCore.QObject): pass self.canvas.draw_idle() - self.canvas.blit(self.axes.bbox) + self.canvas.blit(self.axes.bbox) def clear_cursor(self, state): if state is True: @@ -931,7 +930,7 @@ class PlotCanvasLegacy(QtCore.QObject): self.canvas.draw_idle() # #### Temporary place-holder for cached update ##### - self.update_screen_request.emit([0, 0, 0, 0, 0]) + # self.update_screen_request.emit([0, 0, 0, 0, 0]) if self.app.defaults["global_cursor_color_enabled"] is True: self.draw_cursor(x_pos=x, y_pos=y, color=self.app.cursor_color_3D) @@ -983,6 +982,59 @@ class PlotCanvasLegacy(QtCore.QObject): return width / xpx, height / ypx + def snap(self, x, y): + """ + Adjusts coordinates to snap settings. + + :param x: Input coordinate X + :param y: Input coordinate Y + :return: Snapped (x, y) + """ + + snap_x, snap_y = (x, y) + snap_distance = np.Inf + + # ### Grid snap + if self.app.grid_status(): + if self.app.defaults["global_gridx"] != 0: + try: + snap_x_ = round(x / float(self.app.defaults["global_gridx"])) * \ + float(self.app.defaults["global_gridx"]) + except TypeError: + snap_x_ = x + else: + snap_x_ = x + + # If the Grid_gap_linked on Grid Toolbar is checked then the snap distance on GridY entry will be ignored + # and it will use the snap distance from GridX entry + if self.app.ui.grid_gap_link_cb.isChecked(): + if self.app.defaults["global_gridx"] != 0: + try: + snap_y_ = round(y / float(self.app.defaults["global_gridx"])) * \ + float(self.app.defaults["global_gridx"]) + except TypeError: + snap_y_ = y + else: + snap_y_ = y + else: + if self.app.defaults["global_gridy"] != 0: + try: + snap_y_ = round(y / float(self.app.defaults["global_gridy"])) * \ + float(self.app.defaults["global_gridy"]) + except TypeError: + snap_y_ = y + else: + snap_y_ = y + nearest_grid_distance = self.distance((x, y), (snap_x_, snap_y_)) + if nearest_grid_distance < snap_distance: + snap_x, snap_y = (snap_x_, snap_y_) + + return snap_x, snap_y + + @staticmethod + def distance(pt1, pt2): + return np.sqrt((pt1[0] - pt2[0]) ** 2 + (pt1[1] - pt2[1]) ** 2) + class FakeCursor(QtCore.QObject): """ diff --git a/flatcamGUI/preferences/PreferencesUIManager.py b/flatcamGUI/preferences/PreferencesUIManager.py index c49841ba..3b7306fa 100644 --- a/flatcamGUI/preferences/PreferencesUIManager.py +++ b/flatcamGUI/preferences/PreferencesUIManager.py @@ -921,8 +921,12 @@ class PreferencesUIManager: theme = 'white' should_restart = False - val = self.ui.general_defaults_form.general_gui_group.theme_radio.get_value() - if val != theme: + theme_new_val = self.ui.general_defaults_form.general_gui_group.theme_radio.get_value() + + ge = self.defaults["global_graphic_engine"] + ge_val = self.ui.general_defaults_form.general_app_group.ge_radio.get_value() + + if theme_new_val != theme or ge != ge_val: msgbox = QtWidgets.QMessageBox() msgbox.setText(_("Are you sure you want to continue?")) msgbox.setWindowTitle(_("Application restart")) @@ -935,15 +939,22 @@ class PreferencesUIManager: msgbox.exec_() response = msgbox.clickedButton() - if response == bt_yes: - theme_settings.setValue('theme', val) + if theme_new_val != theme: + if response == bt_yes: + theme_settings.setValue('theme', theme_new_val) - # This will write the setting to the platform specific storage. - del theme_settings + # This will write the setting to the platform specific storage. + del theme_settings - should_restart = True + should_restart = True + else: + self.ui.general_defaults_form.general_gui_group.theme_radio.set_value(theme) else: - self.ui.general_defaults_form.general_gui_group.theme_radio.set_value(theme) + if response == bt_yes: + self.defaults["global_graphic_engine"] = ge_val + should_restart = True + else: + self.ui.general_defaults_form.general_app_group.ge_radio.set_value(ge) if save_to_file or should_restart is True: self.save_defaults(silent=False) @@ -1035,6 +1046,7 @@ class PreferencesUIManager: :return: None """ self.defaults.report_usage("save_defaults") + log.debug("App.PreferencesUIManager.save_defaults()") if data_path is None: data_path = self.data_path From d739a5b05da2e5c058da53ec6c1e925bf710c72c Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 12 May 2020 01:21:29 +0300 Subject: [PATCH 5/6] - re-added the position labels in the status bar; they will be useful if HUD is Off (Altium does the same :) so learn from the best) --- CHANGELOG.md | 1 + FlatCAMApp.py | 28 ++++++++++++++-------------- FlatCAMCommon.py | 4 ++-- Utils/vispy_example.py | 2 +- flatcamEditors/FlatCAMExcEditor.py | 4 ++-- flatcamEditors/FlatCAMGeoEditor.py | 4 ++-- flatcamEditors/FlatCAMGrbEditor.py | 4 ++-- flatcamGUI/FlatCAMGUI.py | 10 +++++----- flatcamObjects/FlatCAMCNCJob.py | 2 +- flatcamTools/ToolCalibration.py | 2 +- flatcamTools/ToolCopperThieving.py | 4 ++-- flatcamTools/ToolDistance.py | 12 ++++++------ flatcamTools/ToolNCC.py | 4 ++-- flatcamTools/ToolPaint.py | 4 ++-- 14 files changed, 43 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e1866d9..39b42859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ CHANGELOG for FlatCAM beta - fix issue in Legacy2D graphic mode where the snap function was not accessible when the PlotCanvasLegacy class was created - modified the HUD in Legacy2D when using Dark Theme to use different colors - modified how the graphic engine change act in Preferences: now only by clicking Apply(or Save) the change will happen. And there is also a message asking for confirmation +- re-added the position labels in the status bar; they will be useful if HUD is Off (Altium does the same :) so learn from the best) 10.05.2020 diff --git a/FlatCAMApp.py b/FlatCAMApp.py index c0007c80..e551d704 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -3480,7 +3480,7 @@ class App(QtCore.QObject): # delete the absolute and relative position and messages in the infobar self.ui.position_label.setText("") - self.ui.rel_position_label.setText("") + # self.ui.rel_position_label.setText("") # Switch plot_area to preferences page self.ui.plot_tab_area.setCurrentWidget(self.book_dialog_tab) @@ -5386,8 +5386,8 @@ class App(QtCore.QObject): # Set the relative position label dx = location[0] - float(self.rel_point1[0]) dy = location[1] - float(self.rel_point1[1]) - # self.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (location[0], location[1])) + self.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (location[0], location[1])) # # Set the position label # # self.ui.rel_position_label.setText("Dx: %.4f   Dy: " @@ -5542,8 +5542,8 @@ class App(QtCore.QObject): self.dx = location[0] - float(self.rel_point1[0]) self.dy = location[1] - float(self.rel_point1[1]) # Set the position label - # self.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (location[0], location[1])) + self.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (location[0], location[1])) # self.ui.rel_position_label.setText("Dx: %.4f   Dy: " # "%.4f    " % (self.dx, self.dy)) @@ -5859,7 +5859,7 @@ class App(QtCore.QObject): self.ui.plot_tab_area.addTab(self.ui.preferences_tab, _("Preferences")) # delete the absolute and relative position and messages in the infobar - # self.ui.position_label.setText("") + self.ui.position_label.setText("") # self.ui.rel_position_label.setText("") # Switch plot_area to preferences page @@ -5957,7 +5957,7 @@ class App(QtCore.QObject): # delete the absolute and relative position and messages in the infobar self.ui.position_label.setText("") - self.ui.rel_position_label.setText("") + # self.ui.rel_position_label.setText("") # Switch plot_area to preferences page self.ui.plot_tab_area.setCurrentWidget(self.tools_db_tab) @@ -6623,7 +6623,7 @@ class App(QtCore.QObject): # delete the absolute and relative position and messages in the infobar self.ui.position_label.setText("") - self.ui.rel_position_label.setText("") + # self.ui.rel_position_label.setText("") # Switch plot_area to preferences page self.ui.plot_tab_area.setCurrentWidget(self.ui.shortcuts_tab) @@ -6771,8 +6771,8 @@ class App(QtCore.QObject): self.dx = pos[0] - float(self.rel_point1[0]) self.dy = pos[1] - float(self.rel_point1[1]) - # self.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (pos[0], pos[1])) + self.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (pos[0], pos[1])) # self.ui.rel_position_label.setText("Dx: %.4f   Dy: " # "%.4f    " % (self.dx, self.dy)) @@ -6831,7 +6831,7 @@ class App(QtCore.QObject): except Exception as e: log.debug("App.on_mouse_move_over_plot() - rel_point1 is not None -> %s" % str(e)) - # self.ui.position_label.setText("") + self.ui.position_label.setText("") # self.ui.rel_position_label.setText("") self.mouse = None @@ -8142,7 +8142,7 @@ class App(QtCore.QObject): # delete the absolute and relative position and messages in the infobar self.ui.position_label.setText("") - self.ui.rel_position_label.setText("") + # self.ui.rel_position_label.setText("") # first clear previous text in text editor (if any) self.text_editor_tab.code_editor.clear() @@ -8193,7 +8193,7 @@ class App(QtCore.QObject): # delete the absolute and relative position and messages in the infobar self.ui.position_label.setText("") - self.ui.rel_position_label.setText("") + # self.ui.rel_position_label.setText("") # first clear previous text in text editor (if any) self.source_editor_tab.code_editor.clear() @@ -8317,7 +8317,7 @@ class App(QtCore.QObject): # delete the absolute and relative position and messages in the infobar self.ui.position_label.setText("") - self.ui.rel_position_label.setText("") + # self.ui.rel_position_label.setText("") self.new_script_object() diff --git a/FlatCAMCommon.py b/FlatCAMCommon.py index ea6c3f78..f7bfae9e 100644 --- a/FlatCAMCommon.py +++ b/FlatCAMCommon.py @@ -471,8 +471,8 @@ class ExclusionAreas(QtCore.QObject): self.app.dx = curr_pos[0] - float(self.cursor_pos[0]) self.app.dy = curr_pos[1] - float(self.cursor_pos[1]) - # self.app.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (curr_pos[0], curr_pos[1])) + self.app.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (curr_pos[0], curr_pos[1])) # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " # "%.4f    " % (self.app.dx, self.app.dy)) diff --git a/Utils/vispy_example.py b/Utils/vispy_example.py index a9eaee12..980d2b10 100644 --- a/Utils/vispy_example.py +++ b/Utils/vispy_example.py @@ -182,7 +182,7 @@ class MyApp(QtCore.QObject): # we don't need all the info in the tuple returned by the translate_coords() # only first 2 elements pos_canvas = [pos_canvas[0], pos_canvas[1]] - # self.ui.position_label.setText("Position: X: %.4f\tY: %.4f" % (pos_canvas[0], pos_canvas[1])) + self.ui.position_label.setText("Position: X: %.4f\tY: %.4f" % (pos_canvas[0], pos_canvas[1])) # pos_text = 'Coordinates: \nX: {:<7.4f}\nY: {:<7.4f}'.format(pos_canvas[0], pos_canvas[1]) pos_text = 'Coordinates: \nX: {:<.4f}\nY: {:<.4f}'.format(pos_canvas[0], pos_canvas[1]) self.plot.vispy_canvas.text.text = pos_text diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py index e77d0928..cbcd55b8 100644 --- a/flatcamEditors/FlatCAMExcEditor.py +++ b/flatcamEditors/FlatCAMExcEditor.py @@ -3782,8 +3782,8 @@ class FlatCAMExcEditor(QtCore.QObject): self.app.dy = y - self.pos[1] # # update the position label in the infobar since the APP mouse event handlers are disconnected - # self.app.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (x, y)) + self.app.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (x, y)) # # update the reference position label in the infobar since the APP mouse event handlers are disconnected # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " # "%.4f    " % (self.app.dx, self.app.dy)) diff --git a/flatcamEditors/FlatCAMGeoEditor.py b/flatcamEditors/FlatCAMGeoEditor.py index 6e4b616b..c8ded16a 100644 --- a/flatcamEditors/FlatCAMGeoEditor.py +++ b/flatcamEditors/FlatCAMGeoEditor.py @@ -4255,8 +4255,8 @@ class FlatCAMGeoEditor(QtCore.QObject): self.app.dy = y - self.pos[1] # # update the position label in the infobar since the APP mouse event handlers are disconnected - # self.app.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (x, y)) + self.app.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (x, y)) # # # update the reference position label in the infobar since the APP mouse event handlers are disconnected # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py index 0658926b..bd330d40 100644 --- a/flatcamEditors/FlatCAMGrbEditor.py +++ b/flatcamEditors/FlatCAMGrbEditor.py @@ -4755,8 +4755,8 @@ class FlatCAMGrbEditor(QtCore.QObject): self.app.dy = y - self.pos[1] # # update the position label in the infobar since the APP mouse event handlers are disconnected - # self.app.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (x, y)) + self.app.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (x, y)) # # # update the reference position label in the infobar since the APP mouse event handlers are disconnected # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 08821168..078f8f9d 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -2309,11 +2309,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow): # self.rel_position_label.setToolTip(_("Relative measurement.\nReference is last click position")) # self.infobar.addWidget(self.rel_position_label) # - # self.position_label = QtWidgets.QLabel( - # "    X: 0.0000   Y: 0.0000") - # self.position_label.setMinimumWidth(110) - # self.position_label.setToolTip(_("Absolute measurement.\nReference is (X=0, Y= 0) position")) - # self.infobar.addWidget(self.position_label) + self.position_label = QtWidgets.QLabel( + " X: 0.0000   Y: 0.0000 ") + self.position_label.setMinimumWidth(110) + self.position_label.setToolTip(_("Absolute measurement.\nReference is (X=0, Y= 0) position")) + self.infobar.addWidget(self.position_label) self.snap_toolbar.setMaximumHeight(24) self.infobar.addWidget(self.snap_toolbar) diff --git a/flatcamObjects/FlatCAMCNCJob.py b/flatcamObjects/FlatCAMCNCJob.py index c9a47076..b75ec21d 100644 --- a/flatcamObjects/FlatCAMCNCJob.py +++ b/flatcamObjects/FlatCAMCNCJob.py @@ -564,7 +564,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): # delete the absolute and relative position and messages in the infobar self.app.ui.position_label.setText("") - self.app.ui.rel_position_label.setText("") + # self.app.ui.rel_position_label.setText("") # first clear previous text in text editor (if any) self.gcode_editor_tab.code_editor.clear() diff --git a/flatcamTools/ToolCalibration.py b/flatcamTools/ToolCalibration.py index 98b487cf..c1e6b14d 100644 --- a/flatcamTools/ToolCalibration.py +++ b/flatcamTools/ToolCalibration.py @@ -1069,7 +1069,7 @@ class ToolCalibration(FlatCAMTool): # delete the absolute and relative position and messages in the infobar self.app.ui.position_label.setText("") - self.app.ui.rel_position_label.setText("") + # self.app.ui.rel_position_label.setText("") # first clear previous text in text editor (if any) self.gcode_editor_tab.code_editor.clear() diff --git a/flatcamTools/ToolCopperThieving.py b/flatcamTools/ToolCopperThieving.py index 8adb9fc4..0b43f71a 100644 --- a/flatcamTools/ToolCopperThieving.py +++ b/flatcamTools/ToolCopperThieving.py @@ -917,8 +917,8 @@ class ToolCopperThieving(FlatCAMTool): self.app.dy = curr_pos[1] - float(self.cursor_pos[1]) # # update the positions on status bar - # self.app.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (curr_pos[0], curr_pos[1])) + self.app.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (curr_pos[0], curr_pos[1])) # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " # "%.4f    " % (self.app.dx, self.app.dy)) diff --git a/flatcamTools/ToolDistance.py b/flatcamTools/ToolDistance.py index ef239454..1e61d782 100644 --- a/flatcamTools/ToolDistance.py +++ b/flatcamTools/ToolDistance.py @@ -544,11 +544,11 @@ class Distance(FlatCAMTool): else: pos = (pos_canvas[0], pos_canvas[1]) - # self.app.ui.position_label.setText( - # "    X: {}   Y: {}".format( - # '%.*f' % (self.decimals, pos[0]), '%.*f' % (self.decimals, pos[1]) - # ) - # ) + self.app.ui.position_label.setText( + "    X: {}   Y: {}".format( + '%.*f' % (self.decimals, pos[0]), '%.*f' % (self.decimals, pos[1]) + ) + ) units = self.app.defaults["units"].lower() self.app.plotcanvas.text_hud.text = \ @@ -583,7 +583,7 @@ class Distance(FlatCAMTool): except Exception as e: log.debug("Distance.on_mouse_move_meas() --> %s" % str(e)) self.app.ui.position_label.setText("") - self.app.ui.rel_position_label.setText("") + # self.app.ui.rel_position_label.setText("") def utility_geometry(self, pos): # first delete old shape diff --git a/flatcamTools/ToolNCC.py b/flatcamTools/ToolNCC.py index b3ab7fa5..e83d4bdb 100644 --- a/flatcamTools/ToolNCC.py +++ b/flatcamTools/ToolNCC.py @@ -1832,8 +1832,8 @@ class NonCopperClear(FlatCAMTool, Gerber): self.app.dy = curr_pos[1] - float(self.cursor_pos[1]) # # update the positions on status bar - # self.app.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (curr_pos[0], curr_pos[1])) + self.app.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (curr_pos[0], curr_pos[1])) # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " # "%.4f    " % (self.app.dx, self.app.dy)) diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py index 131e025b..c06b6666 100644 --- a/flatcamTools/ToolPaint.py +++ b/flatcamTools/ToolPaint.py @@ -1731,8 +1731,8 @@ class ToolPaint(FlatCAMTool, Gerber): self.app.dy = curr_pos[1] - float(self.cursor_pos[1]) # # update the positions on status bar - # self.app.ui.position_label.setText("    X: %.4f   " - # "Y: %.4f" % (curr_pos[0], curr_pos[1])) + self.app.ui.position_label.setText(" X: %.4f   " + "Y: %.4f " % (curr_pos[0], curr_pos[1])) # self.app.ui.rel_position_label.setText("Dx: %.4f   Dy: " # "%.4f    " % (self.app.dx, self.app.dy)) From 086526441d5b52719dbc9d50208f38dc8f9b882e Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 12 May 2020 01:26:35 +0300 Subject: [PATCH 6/6] - pass --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b42859..05256956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ CHANGELOG for FlatCAM beta - modified how the graphic engine change act in Preferences: now only by clicking Apply(or Save) the change will happen. And there is also a message asking for confirmation - re-added the position labels in the status bar; they will be useful if HUD is Off (Altium does the same :) so learn from the best) + 10.05.2020 - fixed the problem with using comma as decimal separator in Grid Snap fields