- added the possibility to display text annotation for the CNC travel lines. The setting is both in Preferences and in the CNC object properties

This commit is contained in:
Marius Stanciu
2019-05-31 12:43:30 +03:00
parent b35ac779bd
commit 9abb9c5df2
7 changed files with 76 additions and 14 deletions

View File

@@ -5443,15 +5443,30 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.cncplot_method_radio, 1, 1)
grid0.addWidget(QtWidgets.QLabel(''), 1, 2)
# Display Annotation
self.annotation_label = QtWidgets.QLabel(_("Display Annotation:"))
self.annotation_label.setToolTip(
_(
"This selects if to display text annotation on the plot.\n"
"When checked it will display numbers in order for each end\n"
"of a travel line."
)
)
self.annotation_cb = FCCheckBox()
grid0.addWidget(self.annotation_label, 2, 0)
grid0.addWidget(self.annotation_cb, 2, 1)
grid0.addWidget(QtWidgets.QLabel(''), 2, 2)
# Number of circle steps for circular aperture linear approximation
self.steps_per_circle_label = QtWidgets.QLabel(_("Circle Steps:"))
self.steps_per_circle_label.setToolTip(
_("The number of circle steps for <b>GCode</b> \n"
"circle and arc shapes linear approximation.")
)
grid0.addWidget(self.steps_per_circle_label, 2, 0)
grid0.addWidget(self.steps_per_circle_label, 3, 0)
self.steps_per_circle_entry = IntEntry()
grid0.addWidget(self.steps_per_circle_entry, 2, 1)
grid0.addWidget(self.steps_per_circle_entry, 3, 1)
# Tool dia for plot
tdlabel = QtWidgets.QLabel(_('Tool dia:'))
@@ -5459,9 +5474,9 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
_("Diameter of the tool to be\n"
"rendered in the plot.")
)
grid0.addWidget(tdlabel, 3, 0)
grid0.addWidget(tdlabel, 4, 0)
self.tooldia_entry = LengthEntry()
grid0.addWidget(self.tooldia_entry, 3, 1)
grid0.addWidget(self.tooldia_entry,4, 1)
# Number of decimals to use in GCODE coordinates
cdeclabel = QtWidgets.QLabel(_('Coords dec.:'))
@@ -5469,9 +5484,9 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
_("The number of decimals to be used for \n"
"the X, Y, Z coordinates in CNC code (GCODE, etc.)")
)
grid0.addWidget(cdeclabel, 4, 0)
grid0.addWidget(cdeclabel, 5, 0)
self.coords_dec_entry = IntEntry()
grid0.addWidget(self.coords_dec_entry, 4, 1)
grid0.addWidget(self.coords_dec_entry, 5, 1)
# Number of decimals to use in GCODE feedrate
frdeclabel = QtWidgets.QLabel(_('Feedrate dec.:'))
@@ -5479,9 +5494,9 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
_("The number of decimals to be used for \n"
"the Feedrate parameter in CNC code (GCODE, etc.)")
)
grid0.addWidget(frdeclabel, 5, 0)
grid0.addWidget(frdeclabel, 6, 0)
self.fr_dec_entry = IntEntry()
grid0.addWidget(self.fr_dec_entry, 5, 1)
grid0.addWidget(self.fr_dec_entry, 6, 1)
self.layout.addStretch()

View File

@@ -1366,6 +1366,16 @@ class CNCObjectUI(ObjectUI):
{"label": "Cut", "value": "cut"}
], stretch=False)
self.annotation_label = QtWidgets.QLabel(_("<b>Display Annotation:</b>"))
self.annotation_label.setToolTip(
_(
"This selects if to display text annotation on the plot.\n"
"When checked it will display numbers in order for each end\n"
"of a travel line."
)
)
self.annotation_cb = FCCheckBox()
# ## Object name
self.name_hlay = QtWidgets.QHBoxLayout()
self.custom_box.addLayout(self.name_hlay)
@@ -1399,9 +1409,12 @@ class CNCObjectUI(ObjectUI):
f_lay.addWidget(self.cncplot_method_label, 0, 0)
f_lay.addWidget(self.cncplot_method_combo, 0, 1)
f_lay.addWidget(QtWidgets.QLabel(''), 0, 2)
f_lay.addWidget(self.t_distance_label, 1, 0)
f_lay.addWidget(self.t_distance_entry, 1, 1)
f_lay.addWidget(self.units_label, 1, 2)
f_lay.addWidget(self.annotation_label, 1, 0)
f_lay.addWidget(self.annotation_cb, 1, 1)
f_lay.addWidget(QtWidgets.QLabel(''), 1, 2)
f_lay.addWidget(self.t_distance_label, 2, 0)
f_lay.addWidget(self.t_distance_entry, 2, 1)
f_lay.addWidget(self.units_label, 2, 2)
self.t_distance_label.hide()
self.t_distance_entry.setVisible(False)

View File

@@ -74,7 +74,7 @@ class PlotCanvas(QtCore.QObject):
self.text_collection = self.new_text_collection()
# TODO: Should be setting to show/hide CNC job annotations (global or per object)
self.text_collection.enabled = False
self.text_collection.enabled = True
# 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