Просмотр исходного кода

- 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

Marius Stanciu 6 лет назад
Родитель
Сommit
e349953637
3 измененных файлов с 22 добавлено и 17 удалено
  1. 14 16
      FlatCAMApp.py
  2. 1 0
      README.md
  3. 7 1
      flatcamGUI/PlotCanvasLegacy.py

+ 14 - 16
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 ####################
         # ###############################################

+ 1 - 0
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
 

+ 7 - 1
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):