From e3499536371b2ad843e2d149b06403719fefcd84 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Mon, 23 Sep 2019 00:17:45 +0300 Subject: [PATCH] - fixed crash when trying to set a workspace in FlatCAM in the Legacy engine 2D mode by disabling this function for the case of 2D mode - updated the translation files --- FlatCAMApp.py | 30 ++++++++++++++---------------- README.md | 1 + flatcamGUI/PlotCanvasLegacy.py | 8 +++++++- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 4cec4996..ad163d94 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -1586,6 +1586,19 @@ class App(QtCore.QObject): # ### End of Data #### + # ############################################## + # ######### SETUP OBJECT COLLECTION ############ + # ############################################## + + self.collection = ObjectCollection(self) + self.ui.project_tab_layout.addWidget(self.collection.view) + + # ### Adjust tabs width ## ## + # self.collection.view.setMinimumWidth(self.ui.options_scroll_area.widget().sizeHint().width() + + # self.ui.options_scroll_area.verticalScrollBar().sizeHint().width()) + self.collection.view.setMinimumWidth(290) + self.log.debug("Finished creating Object Collection.") + # ############################################### # ############# SETUP Plot Area ################# # ############################################### @@ -1607,9 +1620,7 @@ class App(QtCore.QObject): start_plot_time = time.time() # debug self.plotcanvas = None - # this is a list just because when in legacy it is needed to add multiple cursors - # each gets deleted when the axes are deleted therefore there is a need of one for each - self.app_cursor = [] + self.app_cursor = None self.hover_shapes = None self.on_plotcanvas_setup() @@ -1639,19 +1650,6 @@ class App(QtCore.QObject): self.trayIcon = FlatCAMSystemTray(app=self, icon=QtGui.QIcon('share/flatcam_icon32_green.png'), parent=self.parent_w) - # ############################################## - # ######### SETUP OBJECT COLLECTION ############ - # ############################################## - - self.collection = ObjectCollection(self) - self.ui.project_tab_layout.addWidget(self.collection.view) - - # ### Adjust tabs width ## ## - # self.collection.view.setMinimumWidth(self.ui.options_scroll_area.widget().sizeHint().width() + - # self.ui.options_scroll_area.verticalScrollBar().sizeHint().width()) - self.collection.view.setMinimumWidth(290) - self.log.debug("Finished creating Object Collection.") - # ############################################### # ############# Worker SETUP #################### # ############################################### diff --git a/README.md b/README.md index 8de8d2a6..320f73c7 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ CAD program, and create G-Code for Isolation routing. - updated and corrected the Romanian and Spanish translations - updated the .PO files for the rest of the translations, they need to be filled in. - fixed crash when trying to set a workspace in FlatCAM in the Legacy engine 2D mode by disabling this function for the case of 2D mode +- fixed exception when trying to Fit View (shortcut key 'V') with no object loaded, in legacy graphic engine 21.09.2019 diff --git a/flatcamGUI/PlotCanvasLegacy.py b/flatcamGUI/PlotCanvasLegacy.py index f91b33a8..05a8dadc 100644 --- a/flatcamGUI/PlotCanvasLegacy.py +++ b/flatcamGUI/PlotCanvasLegacy.py @@ -329,6 +329,12 @@ class PlotCanvasLegacy(QtCore.QObject): # FlatCAMApp.App.log.debug("PC.adjust_axes()") + if not self.app.collection.get_list(): + xmin = -10 + ymin = -10 + xmax = 100 + ymax = 100 + width = xmax - xmin height = ymax - ymin try: @@ -588,7 +594,7 @@ class PlotCanvasLegacy(QtCore.QObject): :param position: Mouse event position :return: Tuple with mouse position """ - return (position[0], position[1]) + return position[0], position[1] def on_draw(self, renderer):