Exemplo n.º 1
0
 def __init__(self,
              size=(800, 580),
              callback=None,
              parent=None,
              initdir="."):
     wx.Frame.__init__(self,
                       parent,
                       title=_("Plate building tool"),
                       size=size)
     self.SetIcon(wx.Icon(pixmapfile("plater.ico"), wx.BITMAP_TYPE_ICO))
     self.mainsizer = wx.BoxSizer(wx.HORIZONTAL)
     self.panel = wx.Panel(self, -1, size=(150, 600), pos=(0, 0))
     #self.panel.SetBackgroundColour((10, 10, 10))
     self.l = wx.ListBox(self.panel, size=(300, 180), pos=(0, 30))
     self.cl = wx.Button(self.panel, label=_("Clear"), pos=(0, 205))
     self.lb = wx.Button(self.panel, label=_("Load"), pos=(0, 0))
     if (callback is None):
         self.eb = wx.Button(self.panel, label=_("Export"), pos=(100, 0))
         self.eb.Bind(wx.EVT_BUTTON, self.export)
     else:
         self.eb = wx.Button(self.panel, label=_("Export"), pos=(200, 205))
         self.eb.Bind(wx.EVT_BUTTON, self.export)
         self.edb = wx.Button(self.panel, label=_("Done"), pos=(100, 0))
         self.edb.Bind(wx.EVT_BUTTON, lambda e: self.done(e, callback))
         self.eb = wx.Button(self.panel, label=_("Cancel"), pos=(200, 0))
         self.eb.Bind(wx.EVT_BUTTON, lambda e: self.Destroy())
     self.sb = wx.Button(self.panel,
                         label=_("Snap to Z = 0"),
                         pos=(00, 255))
     self.cb = wx.Button(self.panel,
                         label=_("Put at 100, 100"),
                         pos=(0, 280))
     self.db = wx.Button(self.panel, label=_("Delete"), pos=(0, 305))
     self.ab = wx.Button(self.panel, label=_("Auto"), pos=(0, 330))
     self.cl.Bind(wx.EVT_BUTTON, self.clear)
     self.lb.Bind(wx.EVT_BUTTON, self.right)
     self.sb.Bind(wx.EVT_BUTTON, self.snap)
     self.cb.Bind(wx.EVT_BUTTON, self.center)
     self.db.Bind(wx.EVT_BUTTON, self.delete)
     self.ab.Bind(wx.EVT_BUTTON, self.autoplate)
     self.basedir = initdir
     print self.basedir
     self.models = {}
     #self.SetBackgroundColour((10, 10, 10))
     self.mainsizer.Add(self.panel)
     #self.mainsizer.AddSpacer(10)
     if glview:
         self.s = stlview.TestGlPanel(self, (580, 580))
     else:
         self.s = showstl(self, (580, 580), (0, 0))
     self.mainsizer.Add(self.s, 1, wx.EXPAND)
     self.SetSizer(self.mainsizer)
     #self.mainsizer.Fit(self)
     self.Layout()
Exemplo n.º 2
0
 def __init__(self, filenames = [], size = (800, 580), callback = None, parent = None, build_dimensions = None):
     wx.Frame.__init__(self, parent, title = _("Plate building tool"), size = size)
     self.filenames = filenames
     if hasattr(sys,"frozen") and sys.frozen=="windows_exe":
         self.SetIcon(wx.Icon(sys.executable, wx.BITMAP_TYPE_ICO))
     else:
         self.SetIcon(wx.Icon(pixmapfile("plater.ico"), wx.BITMAP_TYPE_ICO))
     self.mainsizer = wx.BoxSizer(wx.HORIZONTAL)
     self.panel = wx.Panel(self, -1, size = (150, 600), pos = (0, 0))
     #self.panel.SetBackgroundColour((10, 10, 10))
     self.l = wx.ListBox(self.panel, size = (300, 180), pos = (0, 30))
     self.cl = wx.Button(self.panel, label = _("Clear"), pos = (0, 205))
     self.lb = wx.Button(self.panel, label = _("Load"), pos = (0, 0))
     if(callback is None):
         self.eb = wx.Button(self.panel, label = _("Export"), pos = (100, 0))
         self.eb.Bind(wx.EVT_BUTTON, self.export)
     else:
         self.eb = wx.Button(self.panel, label = _("Export"), pos = (200, 205))
         self.eb.Bind(wx.EVT_BUTTON, self.export)
         self.edb = wx.Button(self.panel, label = _("Done"), pos = (100, 0))
         self.edb.Bind(wx.EVT_BUTTON, lambda e: self.done(e, callback))
         self.eb = wx.Button(self.panel, label = _("Cancel"), pos = (200, 0))
         self.eb.Bind(wx.EVT_BUTTON, lambda e: self.Destroy())
     self.sb = wx.Button(self.panel, label = _("Snap to Z = 0"), pos = (00, 255))
     self.cb = wx.Button(self.panel, label = _("Put at 100, 100"), pos = (0, 280))
     self.db = wx.Button(self.panel, label = _("Delete"), pos = (0, 305))
     self.ab = wx.Button(self.panel, label = _("Auto"), pos = (0, 330))
     self.cl.Bind(wx.EVT_BUTTON, self.clear)
     self.lb.Bind(wx.EVT_BUTTON, self.right)
     self.sb.Bind(wx.EVT_BUTTON, self.snap)
     self.cb.Bind(wx.EVT_BUTTON, self.center)
     self.db.Bind(wx.EVT_BUTTON, self.delete)
     self.ab.Bind(wx.EVT_BUTTON, self.autoplate)
     self.basedir = "."
     self.models = {}
     #self.SetBackgroundColour((10, 10, 10))
     self.mainsizer.Add(self.panel)
     #self.mainsizer.AddSpacer(10)
     if build_dimensions:
         self.build_dimensions = build_dimensions
     else:
         self.build_dimensions = [200, 200, 100, 0, 0, 0]
     if glview:
         self.s = stlview.StlViewPanel(self, (580, 580), build_dimensions = self.build_dimensions)
     else:
         self.s = showstl(self, (580, 580), (0, 0))
     self.mainsizer.Add(self.s, 1, wx.EXPAND)
     self.SetSizer(self.mainsizer)
     #self.mainsizer.Fit(self)
     self.Layout()