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

- added some prints to work on issue 349

Marius Stanciu 6 лет назад
Родитель
Сommit
8c33f6e0be
2 измененных файлов с 29 добавлено и 4 удалено
  1. 11 1
      FlatCAMApp.py
  2. 18 3
      flatcamGUI/PlotCanvas.py

+ 11 - 1
FlatCAMApp.py

@@ -1786,6 +1786,8 @@ class App(QtCore.QObject):
         self.app_cursor = None
         self.app_cursor = None
         self.hover_shapes = None
         self.hover_shapes = None
 
 
+        self.log.debug("Setting up canvas: %s" % str(self.defaults["global_graphic_engine"]))
+
         # setup the PlotCanvas
         # setup the PlotCanvas
         self.on_plotcanvas_setup()
         self.on_plotcanvas_setup()
 
 
@@ -11981,7 +11983,7 @@ class App(QtCore.QObject):
             plot_container = container
             plot_container = container
         else:
         else:
             plot_container = self.ui.right_layout
             plot_container = self.ui.right_layout
-
+        print("step_1")
         if self.is_legacy is False:
         if self.is_legacy is False:
             try:
             try:
                 self.plotcanvas = PlotCanvas(plot_container, self)
                 self.plotcanvas = PlotCanvas(plot_container, self)
@@ -11997,9 +11999,11 @@ class App(QtCore.QObject):
                 return 'fail'
                 return 'fail'
         else:
         else:
             self.plotcanvas = PlotCanvasLegacy(plot_container, self)
             self.plotcanvas = PlotCanvasLegacy(plot_container, self)
+        print("step_2")
 
 
         # So it can receive key presses
         # So it can receive key presses
         self.plotcanvas.native.setFocus()
         self.plotcanvas.native.setFocus()
+        print("step_3")
 
 
         self.mm = self.plotcanvas.graph_event_connect('mouse_move', self.on_mouse_move_over_plot)
         self.mm = self.plotcanvas.graph_event_connect('mouse_move', self.on_mouse_move_over_plot)
         self.mp = self.plotcanvas.graph_event_connect('mouse_press', self.on_mouse_click_over_plot)
         self.mp = self.plotcanvas.graph_event_connect('mouse_press', self.on_mouse_click_over_plot)
@@ -12008,22 +12012,28 @@ class App(QtCore.QObject):
 
 
         # Keys over plot enabled
         # Keys over plot enabled
         self.kp = self.plotcanvas.graph_event_connect('key_press', self.ui.keyPressEvent)
         self.kp = self.plotcanvas.graph_event_connect('key_press', self.ui.keyPressEvent)
+        print("step_4")
 
 
         if self.defaults['global_cursor_type'] == 'small':
         if self.defaults['global_cursor_type'] == 'small':
             self.app_cursor = self.plotcanvas.new_cursor()
             self.app_cursor = self.plotcanvas.new_cursor()
         else:
         else:
             self.app_cursor = self.plotcanvas.new_cursor(big=True)
             self.app_cursor = self.plotcanvas.new_cursor(big=True)
 
 
+        print("step_5")
+
         if self.ui.grid_snap_btn.isChecked():
         if self.ui.grid_snap_btn.isChecked():
             self.app_cursor.enabled = True
             self.app_cursor.enabled = True
         else:
         else:
             self.app_cursor.enabled = False
             self.app_cursor.enabled = False
 
 
+        print("step_6")
+
         if self.is_legacy is False:
         if self.is_legacy is False:
             self.hover_shapes = ShapeCollection(parent=self.plotcanvas.view.scene, layers=1)
             self.hover_shapes = ShapeCollection(parent=self.plotcanvas.view.scene, layers=1)
         else:
         else:
             # will use the default Matplotlib axes
             # will use the default Matplotlib axes
             self.hover_shapes = ShapeCollectionLegacy(obj=self, app=self, name='hover')
             self.hover_shapes = ShapeCollectionLegacy(obj=self, app=self, name='hover')
+        print("step_7")
 
 
     def on_zoom_fit(self, event):
     def on_zoom_fit(self, event):
         """
         """

+ 18 - 3
flatcamGUI/PlotCanvas.py

@@ -32,9 +32,11 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
         :param container: The parent container in which to draw plots.
         :param container: The parent container in which to draw plots.
         :rtype: PlotCanvas
         :rtype: PlotCanvas
         """
         """
+        print("step_1_1")
 
 
         super(PlotCanvas, self).__init__()
         super(PlotCanvas, self).__init__()
         # VisPyCanvas.__init__(self)
         # VisPyCanvas.__init__(self)
+        print("step_1_2")
 
 
         # VisPyCanvas does not allow new attributes. Override.
         # VisPyCanvas does not allow new attributes. Override.
         self.unfreeze()
         self.unfreeze()
@@ -44,6 +46,8 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
         # Parent container
         # Parent container
         self.container = container
         self.container = container
 
 
+        print("step_1_3")
+
         settings = QtCore.QSettings("Open Source", "FlatCAM")
         settings = QtCore.QSettings("Open Source", "FlatCAM")
         if settings.contains("theme"):
         if settings.contains("theme"):
             theme = settings.value('theme', type=str)
             theme = settings.value('theme', type=str)
@@ -113,6 +117,8 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
             }
             }
         )
         )
 
 
+        print("step_1_4")
+
         # <VisPyCanvas>
         # <VisPyCanvas>
         self.create_native()
         self.create_native()
         self.native.setParent(self.fcapp.ui)
         self.native.setParent(self.fcapp.ui)
@@ -120,6 +126,8 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
         # <QtCore.QObject>
         # <QtCore.QObject>
         self.container.addWidget(self.native)
         self.container.addWidget(self.native)
 
 
+        print("step_1_5")
+
         # ## AXIS # ##
         # ## AXIS # ##
         self.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=True,
         self.v_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=True,
                                    parent=self.view.scene)
                                    parent=self.view.scene)
@@ -127,25 +135,28 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
         self.h_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=False,
         self.h_line = InfiniteLine(pos=0, color=(0.70, 0.3, 0.3, 0.8), vertical=False,
                                    parent=self.view.scene)
                                    parent=self.view.scene)
 
 
+        print("step_1_6")
+
         # draw a rectangle made out of 4 lines on the canvas to serve as a hint for the work area
         # 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
         # all CNC have a limited workspace
         if self.fcapp.defaults['global_workspace'] is True:
         if self.fcapp.defaults['global_workspace'] is True:
             self.draw_workspace(workspace_size=self.fcapp.defaults["global_workspaceT"])
             self.draw_workspace(workspace_size=self.fcapp.defaults["global_workspaceT"])
 
 
+        print("step_1_7")
+
         self.line_parent = None
         self.line_parent = None
         if self.fcapp.defaults["global_cursor_color_enabled"]:
         if self.fcapp.defaults["global_cursor_color_enabled"]:
             c_color = Color(self.fcapp.defaults["global_cursor_color"]).rgba
             c_color = Color(self.fcapp.defaults["global_cursor_color"]).rgba
         else:
         else:
             c_color = self.line_color
             c_color = self.line_color
+
         self.cursor_v_line = InfiniteLine(pos=None, color=c_color, vertical=True,
         self.cursor_v_line = InfiniteLine(pos=None, color=c_color, vertical=True,
                                           parent=self.line_parent)
                                           parent=self.line_parent)
 
 
         self.cursor_h_line = InfiniteLine(pos=None, color=c_color, vertical=False,
         self.cursor_h_line = InfiniteLine(pos=None, color=c_color, vertical=False,
                                           parent=self.line_parent)
                                           parent=self.line_parent)
 
 
-        # if self.app.defaults['global_workspace'] is True:
-        #     if self.app.ui.general_defaults_form.general_app_group.units_radio.get_value().upper() == 'MM':
-        #         self.wkspace_t = Line(pos=)
+        print("step_1_8")
 
 
         self.shape_collections = []
         self.shape_collections = []
 
 
@@ -160,7 +171,11 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
         self.big_cursor = None
         self.big_cursor = None
         # Keep VisPy canvas happy by letting it be "frozen" again.
         # Keep VisPy canvas happy by letting it be "frozen" again.
         self.freeze()
         self.freeze()
+        print("step_1_9")
+
         self.fit_view()
         self.fit_view()
+        print("step_1_10")
+
         self.graph_event_connect('mouse_wheel', self.on_mouse_scroll)
         self.graph_event_connect('mouse_wheel', self.on_mouse_scroll)
 
 
     def draw_workspace(self, workspace_size):
     def draw_workspace(self, workspace_size):