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

jpcgt/flatcam/Beta слито с Beta

Camellan 6 лет назад
Родитель
Сommit
b827a014d3
3 измененных файлов с 28 добавлено и 6 удалено
  1. 2 0
      FlatCAMApp.py
  2. 5 5
      flatcamGUI/PlotCanvas.py
  3. 21 1
      flatcamGUI/VisPyCanvas.py

+ 2 - 0
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()
 
 

+ 5 - 5
flatcamGUI/PlotCanvas.py

@@ -33,8 +33,10 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
         :rtype: PlotCanvas
         :rtype: PlotCanvas
         """
         """
 
 
-        super(PlotCanvas, self).__init__()
+        # super(PlotCanvas, self).__init__()
+        # QtCore.QObject.__init__(self)
         # VisPyCanvas.__init__(self)
         # VisPyCanvas.__init__(self)
+        super().__init__()
 
 
         # VisPyCanvas does not allow new attributes. Override.
         # VisPyCanvas does not allow new attributes. Override.
         self.unfreeze()
         self.unfreeze()
@@ -137,16 +139,13 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
             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=)
-
         self.shape_collections = []
         self.shape_collections = []
 
 
         self.shape_collection = self.new_shape_collection()
         self.shape_collection = self.new_shape_collection()
@@ -161,6 +160,7 @@ class PlotCanvas(QtCore.QObject, VisPyCanvas):
         # Keep VisPy canvas happy by letting it be "frozen" again.
         # Keep VisPy canvas happy by letting it be "frozen" again.
         self.freeze()
         self.freeze()
         self.fit_view()
         self.fit_view()
+
         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):

+ 21 - 1
flatcamGUI/VisPyCanvas.py

@@ -24,15 +24,24 @@ black = Color("#000000")
 class VisPyCanvas(scene.SceneCanvas):
 class VisPyCanvas(scene.SceneCanvas):
 
 
     def __init__(self, config=None):
     def __init__(self, config=None):
-        scene.SceneCanvas.__init__(self, keys=None, config=config)
+        print("vp_1")
+        try:
+            # scene.SceneCanvas.__init__(self, keys=None, config=config)
+            super().__init__(config=config, keys=None)
+        except Exception as e:
+            print("VisPyCanvas.__init__() -> %s" % str(e))
+
+        print("vp_2")
 
 
         self.unfreeze()
         self.unfreeze()
+        print("vp_3")
 
 
         settings = QSettings("Open Source", "FlatCAM")
         settings = QSettings("Open Source", "FlatCAM")
         if settings.contains("axis_font_size"):
         if settings.contains("axis_font_size"):
             a_fsize = settings.value('axis_font_size', type=int)
             a_fsize = settings.value('axis_font_size', type=int)
         else:
         else:
             a_fsize = 8
             a_fsize = 8
+        print("vp_4")
 
 
         if settings.contains("theme"):
         if settings.contains("theme"):
             theme = settings.value('theme', type=str)
             theme = settings.value('theme', type=str)
@@ -50,6 +59,8 @@ class VisPyCanvas(scene.SceneCanvas):
             # back_color = Color('#272822') # darker
             # back_color = Color('#272822') # darker
             # back_color = Color('#3c3f41') # lighter
             # back_color = Color('#3c3f41') # lighter
 
 
+        print("vp_5")
+
         self.central_widget.bgcolor = back_color
         self.central_widget.bgcolor = back_color
         self.central_widget.border_color = back_color
         self.central_widget.border_color = back_color
 
 
@@ -59,6 +70,8 @@ class VisPyCanvas(scene.SceneCanvas):
         top_padding = self.grid_widget.add_widget(row=0, col=0, col_span=2)
         top_padding = self.grid_widget.add_widget(row=0, col=0, col_span=2)
         top_padding.height_max = 0
         top_padding.height_max = 0
 
 
+        print("vp_6")
+
         self.yaxis = scene.AxisWidget(
         self.yaxis = scene.AxisWidget(
             orientation='left', axis_color=tick_color, text_color=tick_color, font_size=a_fsize, axis_width=1
             orientation='left', axis_color=tick_color, text_color=tick_color, font_size=a_fsize, axis_width=1
         )
         )
@@ -76,9 +89,13 @@ class VisPyCanvas(scene.SceneCanvas):
         # right_padding.width_max = 24
         # right_padding.width_max = 24
         right_padding.width_max = 0
         right_padding.width_max = 0
 
 
+        print("vp_7")
+
         view = self.grid_widget.add_view(row=1, col=1, border_color=tick_color, bgcolor=theme_color)
         view = self.grid_widget.add_view(row=1, col=1, border_color=tick_color, bgcolor=theme_color)
         view.camera = Camera(aspect=1, rect=(-25, -25, 150, 150))
         view.camera = Camera(aspect=1, rect=(-25, -25, 150, 150))
 
 
+        print("vp_8")
+
         # Following function was removed from 'prepare_draw()' of 'Grid' class by patch,
         # Following function was removed from 'prepare_draw()' of 'Grid' class by patch,
         # it is necessary to call manually
         # it is necessary to call manually
         self.grid_widget._update_child_widget_dim()
         self.grid_widget._update_child_widget_dim()
@@ -101,7 +118,10 @@ class VisPyCanvas(scene.SceneCanvas):
         else:
         else:
             self.grid = scene.GridLines(parent=self.view.scene, color='#dededeff')
             self.grid = scene.GridLines(parent=self.view.scene, color='#dededeff')
 
 
+        print("vp_9")
+
         self.grid.set_gl_state(depth_test=False)
         self.grid.set_gl_state(depth_test=False)
+        print("vp_10")
 
 
         self.freeze()
         self.freeze()