Merged in new_snap_widget (pull request #10)

New snap widget
This commit is contained in:
Marius Stanciu 2020-05-11 22:29:32 +00:00
commit 4ff5fb6b55
18 changed files with 210 additions and 296 deletions

View File

@ -12,6 +12,17 @@ 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
- 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
- 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

View File

@ -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 ############################################
@ -2064,18 +2063,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 +2095,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)
@ -3476,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)
@ -4503,14 +4507,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):
@ -4573,7 +4579,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()")
@ -4615,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:
@ -5381,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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (location[0], location[1]))
self.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (location[0], location[1]))
# # Set the position label
#
# self.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
@ -5390,7 +5395,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."))
@ -5537,14 +5542,14 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (location[0], location[1]))
self.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (location[0], location[1]))
# self.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.dx, self.dy))
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."))
@ -5854,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
@ -5952,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)
@ -6618,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)
@ -6766,14 +6771,14 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (pos[0], pos[1]))
self.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (pos[0], pos[1]))
# self.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.dx, self.dy))
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]]
@ -6826,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
@ -8137,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()
@ -8188,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()
@ -8312,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()

View File

@ -471,14 +471,14 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
# self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
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':

View File

@ -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

View File

@ -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)
@ -2837,7 +2835,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)
@ -2869,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 \
@ -3807,15 +3782,15 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (x, y))
self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (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("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
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(
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)
# ## Utility geometry (animated)

View File

@ -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 \
@ -4110,7 +4089,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)
@ -4277,16 +4255,16 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (x, y))
self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (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("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
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(
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)
if event.button == 1 and event_is_dragging and isinstance(self.active_tool, FCEraser):

View File

@ -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)
@ -3703,7 +3701,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)
@ -3736,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 \
@ -4537,8 +4513,8 @@ class FlatCAMGrbEditor(QtCore.QObject):
self.pos = (self.pos[0], self.pos[1])
if event.button == 1:
self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
"%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (0, 0))
# self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (0, 0))
# Selection with left mouse button
if self.active_tool is not None:
@ -4550,8 +4526,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
@ -4780,16 +4755,16 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (x, y))
self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (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("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
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(
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)
self.update_utility_geometry(data=(x, y))

View File

@ -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# ###############################
@ -1112,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 # ##################################
# ########################################################################
@ -2302,21 +2303,20 @@ 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(
# "<b>Dx</b>: 0.0000&nbsp;&nbsp; <b>Dy</b>: 0.0000&nbsp;&nbsp;&nbsp;&nbsp;")
# self.rel_position_label.setMinimumWidth(110)
# self.rel_position_label.setToolTip(_("Relative measurement.\nReference is last click position"))
# self.infobar.addWidget(self.rel_position_label)
#
# self.position_label = QtWidgets.QLabel(
# "&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: 0.0000&nbsp;&nbsp; <b>Y</b>: 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(
"&nbsp;<b>X</b>: 0.0000&nbsp;&nbsp; <b>Y</b>: 0.0000&nbsp;")
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)
self.units_label = QtWidgets.QLabel("[in]")
self.units_label.setMargin(2)
@ -2387,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
@ -2438,14 +2430,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 +2444,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
@ -2584,6 +2550,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(
@ -2786,60 +2754,13 @@ 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()
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':
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)

View File

@ -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,
@ -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:

View File

@ -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):
"""

View File

@ -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

View File

@ -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,13 +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:
# ## TOOLBAR INSTALLATION # ##
self.app.ui.toolbarfile = QtWidgets.QToolBar('File Toolbar')
@ -743,18 +735,9 @@ 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 +750,9 @@ 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.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"]))

View File

@ -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()

View File

@ -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()

View File

@ -917,14 +917,14 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
# self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
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(
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)
# draw the utility geometry

View File

@ -544,15 +544,15 @@ class Distance(FlatCAMTool):
else:
pos = (pos_canvas[0], pos_canvas[1])
# self.app.ui.position_label.setText(
# "&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: {}&nbsp;&nbsp; <b>Y</b>: {}".format(
# '%.*f' % (self.decimals, pos[0]), '%.*f' % (self.decimals, pos[1])
# )
# )
self.app.ui.position_label.setText(
"&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: {}&nbsp;&nbsp; <b>Y</b>: {}".format(
'%.*f' % (self.decimals, pos[0]), '%.*f' % (self.decimals, pos[1])
)
)
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(
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)
if self.rel_point1 is not None:
@ -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

View File

@ -1832,14 +1832,14 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
# self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
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(
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)
# draw the utility geometry

View File

@ -1731,14 +1731,14 @@ 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("&nbsp;&nbsp;&nbsp;&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
# "<b>Y</b>: %.4f" % (curr_pos[0], curr_pos[1]))
self.app.ui.position_label.setText("&nbsp;<b>X</b>: %.4f&nbsp;&nbsp; "
"<b>Y</b>: %.4f&nbsp;" % (curr_pos[0], curr_pos[1]))
# self.app.ui.rel_position_label.setText("<b>Dx</b>: %.4f&nbsp;&nbsp; <b>Dy</b>: "
# "%.4f&nbsp;&nbsp;&nbsp;&nbsp;" % (self.app.dx, self.app.dy))
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(
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)
# draw the utility geometry