- fixed the workspace being always A4

- added a label in the status bar to show if the workplace is active and what size it is
This commit is contained in:
Marius Stanciu
2020-05-17 15:53:13 +03:00
committed by Marius
parent 29ce53b577
commit 0aeef246ea
6 changed files with 29 additions and 8 deletions

View File

@@ -2326,7 +2326,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.snap_toolbar.setMaximumHeight(24)
self.infobar.addWidget(self.snap_toolbar)
self.units_label = QtWidgets.QLabel("[in]")
self.wplace_label = FCLabel("A4")
self.wplace_label.setMargin(2)
self.infobar.addWidget(self.wplace_label)
self.wplace_label.hide()
self.units_label = QtWidgets.QLabel("[mm]")
self.units_label.setMargin(2)
self.infobar.addWidget(self.units_label)

View File

@@ -235,17 +235,24 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
a = np.array([(0, 0), (dims[0], 0), (dims[0], dims[1]), (0, dims[1])])
if not self.workspace_line:
self.workspace_line = Line(pos=np.array((a[0], a[1], a[2], a[3], a[0])), color=(0.70, 0.3, 0.3, 0.7),
antialias=True, method='agg', parent=self.view.scene)
else:
self.workspace_line.parent = self.view.scene
# if not self.workspace_line:
# self.workspace_line = Line(pos=np.array((a[0], a[1], a[2], a[3], a[0])), color=(0.70, 0.3, 0.3, 0.7),
# antialias=True, method='agg', parent=self.view.scene)
# else:
# self.workspace_line.parent = self.view.scene
self.workspace_line = Line(pos=np.array((a[0], a[1], a[2], a[3], a[0])), color=(0.70, 0.3, 0.3, 0.7),
antialias=True, method='agg', parent=self.view.scene)
self.fcapp.ui.wplace_label.set_value(workspace_size[:3])
self.fcapp.ui.wplace_label.setToolTip(workspace_size)
self.fcapp.ui.wplace_label.show()
def delete_workspace(self):
try:
self.workspace_line.parent = None
except Exception:
pass
self.fcapp.ui.wplace_label.hide()
# redraw the workspace lines on the plot by re adding them to the parent view.scene
def restore_workspace(self):

View File

@@ -417,12 +417,17 @@ class PlotCanvasLegacy(QtCore.QObject):
self.axes.add_line(self.workspace_line)
self.canvas.draw()
self.app.ui.wplace_label.set_value(workspace_size[:3])
self.app.ui.wplace_label.setToolTip(workspace_size)
self.app.ui.wplace_label.show()
def delete_workspace(self):
try:
self.axes.lines.remove(self.workspace_line)
self.canvas.draw()
except Exception:
pass
self.app.ui.wplace_label.hide()
def graph_event_connect(self, event_name, callback):
"""