- worked on the NCC Tool; added a new clear method named 'Combo' which will go through all methods until the clear is done
- added a Preferences parameter for font size used in HUD
This commit is contained in:
@@ -150,19 +150,38 @@ 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=(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=(10, 50), method='gpu', anchor_x='left', parent=None)
|
||||
self.text_hud.font_size = 8
|
||||
# font size
|
||||
qsettings = QtCore.QSettings("Open Source", "FlatCAM")
|
||||
if qsettings.contains("hud_font_size"):
|
||||
fsize = qsettings.value('hud_font_size', type=int)
|
||||
else:
|
||||
fsize = 8
|
||||
|
||||
# units
|
||||
units = self.fcapp.defaults["units"].lower()
|
||||
|
||||
# coordinates and anchors
|
||||
height = fsize * 11 # 90. Constant 11 is something that works
|
||||
width = height * 2 # width is double the height = it is something that works
|
||||
center_x = (width / 2) + 5
|
||||
center_y = (height / 2) + 5
|
||||
|
||||
# text
|
||||
self.text_hud = Text('', color=self.text_hud_color, pos=(10, center_y), method='gpu', anchor_x='left',
|
||||
parent=None)
|
||||
self.text_hud.font_size = fsize
|
||||
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)
|
||||
|
||||
# rectangle
|
||||
self.rect_hud = Rectangle(center=(center_x, center_y), width=width, height=height, radius=[5, 5, 5, 5],
|
||||
border_color=self.rect_hud_color, color=self.rect_hud_color, parent=None)
|
||||
self.rect_hud.set_gl_state(depth_test=False)
|
||||
|
||||
# enable the HUD if it is activated in FlatCAM Preferences
|
||||
if self.fcapp.defaults['global_hud'] is True:
|
||||
self.on_toggle_hud(state=True)
|
||||
|
||||
|
||||
@@ -343,7 +343,16 @@ class PlotCanvasLegacy(QtCore.QObject):
|
||||
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')
|
||||
# set font size
|
||||
qsettings = QtCore.QSettings("Open Source", "FlatCAM")
|
||||
if qsettings.contains("hud_font_size"):
|
||||
# I multiply with 2.5 because this seems to be the difference between the value taken by the VisPy (3D)
|
||||
# and Matplotlib (Legacy2D FlatCAM graphic engine)
|
||||
fsize = int(qsettings.value('hud_font_size', type=int) * 2.5)
|
||||
else:
|
||||
fsize = 20
|
||||
|
||||
self.hud_holder = AnchoredText(self._text, prop=dict(size=fsize), frameon=True, loc='upper left')
|
||||
self.hud_holder.patch.set_boxstyle("round,pad=0.,rounding_size=0.2")
|
||||
|
||||
fc_color = self.p.rect_hud_color[:-2]
|
||||
|
||||
@@ -978,6 +978,10 @@ class PreferencesUIManager:
|
||||
tb_fsize = self.ui.general_defaults_form.general_app_set_group.textbox_font_size_spinner.get_value()
|
||||
settgs.setValue('textbox_font_size', tb_fsize)
|
||||
|
||||
# save the HUD font size
|
||||
hud_fsize = self.ui.general_defaults_form.general_app_set_group.hud_font_size_spinner.get_value()
|
||||
settgs.setValue('hud_font_size', hud_fsize)
|
||||
|
||||
settgs.setValue(
|
||||
'machinist',
|
||||
1 if self.ui.general_defaults_form.general_app_set_group.machinist_cb.get_value() else 0
|
||||
|
||||
@@ -257,10 +257,29 @@ class GeneralAPPSetGroupUI(OptionsGroupUI):
|
||||
grid0.addWidget(self.textbox_font_size_label, 13, 0)
|
||||
grid0.addWidget(self.textbox_font_size_spinner, 13, 1)
|
||||
|
||||
# HUD Font Size
|
||||
self.hud_font_size_label = QtWidgets.QLabel('%s:' % _('HUD'))
|
||||
self.hud_font_size_label.setToolTip(
|
||||
_("This sets the font size for the Heads Up Display.")
|
||||
)
|
||||
|
||||
self.hud_font_size_spinner = FCSpinner()
|
||||
self.hud_font_size_spinner.set_range(8, 40)
|
||||
self.hud_font_size_spinner.setWrapping(True)
|
||||
|
||||
qsettings = QSettings("Open Source", "FlatCAM")
|
||||
if qsettings.contains("hud_font_size"):
|
||||
self.hud_font_size_spinner.set_value(settings.value('hud_font_size', type=int))
|
||||
else:
|
||||
self.hud_font_size_spinner.set_value(8)
|
||||
|
||||
grid0.addWidget(self.hud_font_size_label, 14, 0)
|
||||
grid0.addWidget(self.hud_font_size_spinner, 14, 1)
|
||||
|
||||
separator_line = QtWidgets.QFrame()
|
||||
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
grid0.addWidget(separator_line, 14, 0, 1, 2)
|
||||
grid0.addWidget(separator_line, 16, 0, 1, 2)
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# -------------- MOUSE SETTINGS -----------------------------
|
||||
|
||||
@@ -227,7 +227,7 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
|
||||
# ], orientation='vertical', stretch=False)
|
||||
self.ncc_method_combo = FCComboBox()
|
||||
self.ncc_method_combo.addItems(
|
||||
[_("Standard"), _("Seed"), _("Lines")]
|
||||
[_("Standard"), _("Seed"), _("Lines"), _("Combo")]
|
||||
)
|
||||
|
||||
grid0.addWidget(methodlabel, 12, 0)
|
||||
|
||||
Reference in New Issue
Block a user