Ejemplo n.º 1
0
 def __init__(self, root):
     super(VizPane, self).__init__(wx.VERTICAL)
     root.gviz = gviz.gviz(
         root.panel, (120, 120),
         build_dimensions=root.build_dimensions_list,
         grid=(root.settings.preview_grid_step1,
               root.settings.preview_grid_step2),
         extrusion_width=root.settings.preview_extrusion_width)
     root.gviz.SetToolTip(
         wx.ToolTip("Click to examine / edit\n  layers of loaded file"))
     root.gviz.showall = 1
     try:
         raise ""
         import printrun.stlview
         root.gwindow = printrun.stlview.GCFrame(
             None,
             wx.ID_ANY,
             'Gcode view, shift to move view, mousewheel to set layer',
             size=(600, 600))
     except:
         root.gwindow = gviz.window(
             [],
             build_dimensions=root.build_dimensions_list,
             grid=(root.settings.preview_grid_step1,
                   root.settings.preview_grid_step2),
             extrusion_width=root.settings.preview_extrusion_width)
     root.gviz.Bind(wx.EVT_LEFT_DOWN, root.showwin)
     root.gwindow.Bind(wx.EVT_CLOSE, lambda x: root.gwindow.Hide())
     self.Add(root.gviz, 1, flag=wx.SHAPED)
Ejemplo n.º 2
0
    def __init__(self, root):
        super(VizPane, self).__init__(wx.VERTICAL)
        root.gviz = gviz.gviz(
            root.panel,
            (120, 120),
            build_dimensions=root.build_dimensions_list,
            grid=(root.settings.preview_grid_step1, root.settings.preview_grid_step2),
            extrusion_width=root.settings.preview_extrusion_width,
        )
        root.gviz.SetToolTip(wx.ToolTip("Click to examine / edit\n  layers of loaded file"))
        root.gviz.showall = 1
        try:
            raise ""
            import printrun.stlview

            root.gwindow = printrun.stlview.GCFrame(
                None, wx.ID_ANY, "Gcode view, shift to move view, mousewheel to set layer", size=(600, 600)
            )
        except:
            root.gwindow = gviz.window(
                [],
                build_dimensions=root.build_dimensions_list,
                grid=(root.settings.preview_grid_step1, root.settings.preview_grid_step2),
                extrusion_width=root.settings.preview_extrusion_width,
            )
        root.gviz.Bind(wx.EVT_LEFT_DOWN, root.showwin)
        root.gwindow.Bind(wx.EVT_CLOSE, lambda x: root.gwindow.Hide())
        self.Add(root.gviz, 1, flag=wx.SHAPED)
Ejemplo n.º 3
0
 def __init__(self, root, parentpanel = None):
     super(VizPane, self).__init__(wx.VERTICAL)
     if not parentpanel: parentpanel = root.panel
     if root.settings.mainviz == "None":
         root.gviz = NoViz()
     use2dview = root.settings.mainviz == "2D"
     if root.settings.mainviz == "3D":
         try:
             import printrun.gcview
             root.gviz = printrun.gcview.GcodeViewMainWrapper(parentpanel, root.build_dimensions_list)
             root.gviz.clickcb = root.showwin
         except:
             use2dview = True
             print "3D view mode requested, but we failed to initialize it."
             print "Falling back to 2D view, and here is the backtrace:"
             traceback.print_exc()
     if use2dview:
         root.gviz = gviz.gviz(parentpanel, (300, 300),
             build_dimensions = root.build_dimensions_list,
             grid = (root.settings.preview_grid_step1, root.settings.preview_grid_step2),
             extrusion_width = root.settings.preview_extrusion_width)
         root.gviz.SetToolTip(wx.ToolTip("Click to examine / edit\n  layers of loaded file"))
         root.gviz.showall = 1
         root.gviz.Bind(wx.EVT_LEFT_DOWN, root.showwin)
     use3dview = root.settings.viz3d
     if use3dview:
         try:
             import printrun.gcview
             objects = None
             if isinstance(root.gviz, printrun.gcview.GcodeViewMainWrapper):
                 objects = root.gviz.objects
             root.gwindow = printrun.gcview.GcodeViewFrame(None, wx.ID_ANY, 'Gcode view, shift to move view, mousewheel to set layer', size = (600, 600), build_dimensions = root.build_dimensions_list, objects = objects)
         except:
             use3dview = False
             print "3D view mode requested, but we failed to initialize it."
             print "Falling back to 2D view, and here is the backtrace:"
             traceback.print_exc()
     if not use3dview:
         root.gwindow = gviz.window([],
         build_dimensions = root.build_dimensions_list,
         grid = (root.settings.preview_grid_step1, root.settings.preview_grid_step2),
         extrusion_width = root.settings.preview_extrusion_width)
     root.gwindow.Bind(wx.EVT_CLOSE, lambda x: root.gwindow.Hide())
     if not isinstance(root.gviz, NoViz):
         self.Add(root.gviz.widget, 1, flag = wx.SHAPED | wx.ALIGN_CENTER_HORIZONTAL)
     root.centersizer = wx.GridBagSizer()
     self.Add(root.centersizer, 0, flag = wx.ALIGN_CENTER)
Ejemplo n.º 4
0
 def __init__(self, root, parentpanel=None):
     super(VizPane, self).__init__(wx.VERTICAL)
     if not parentpanel: parentpanel = root.panel
     if root.settings.mainviz == "None":
         root.gviz = NoViz()
     use2dview = root.settings.mainviz == "2D"
     if root.settings.mainviz == "3D":
         try:
             import printrun.gcview
             root.gviz = printrun.gcview.GcodeViewMainWrapper(
                 parentpanel, root.build_dimensions_list)
             root.gviz.clickcb = root.showwin
         except:
             use2dview = True
             print "3D view mode requested, but we failed to initialize it."
             print "Falling back to 2D view, and here is the backtrace:"
             traceback.print_exc()
     if use2dview:
         root.gviz = gviz.gviz(
             parentpanel, (300, 300),
             build_dimensions=root.build_dimensions_list,
             grid=(root.settings.preview_grid_step1,
                   root.settings.preview_grid_step2),
             extrusion_width=root.settings.preview_extrusion_width)
         root.gviz.SetToolTip(
             wx.ToolTip("Click to examine / edit\n  layers of loaded file"))
         root.gviz.showall = 1
         root.gviz.Bind(wx.EVT_LEFT_DOWN, root.showwin)
     use3dview = root.settings.viz3d
     if use3dview:
         try:
             import printrun.gcview
             objects = None
             if isinstance(root.gviz, printrun.gcview.GcodeViewMainWrapper):
                 objects = root.gviz.objects
             root.gwindow = printrun.gcview.GcodeViewFrame(
                 None,
                 wx.ID_ANY,
                 'Gcode view, shift to move view, mousewheel to set layer',
                 size=(600, 600),
                 build_dimensions=root.build_dimensions_list,
                 objects=objects)
         except:
             use3dview = False
             print "3D view mode requested, but we failed to initialize it."
             print "Falling back to 2D view, and here is the backtrace:"
             traceback.print_exc()
     if not use3dview:
         root.gwindow = gviz.window(
             [],
             build_dimensions=root.build_dimensions_list,
             grid=(root.settings.preview_grid_step1,
                   root.settings.preview_grid_step2),
             extrusion_width=root.settings.preview_extrusion_width)
     root.gwindow.Bind(wx.EVT_CLOSE, lambda x: root.gwindow.Hide())
     if not isinstance(root.gviz, NoViz):
         self.Add(root.gviz.widget,
                  1,
                  flag=wx.SHAPED | wx.ALIGN_CENTER_HORIZONTAL)
     root.centersizer = wx.GridBagSizer()
     self.Add(root.centersizer, 0, flag=wx.ALIGN_CENTER)