Commit 3d0f4985 authored by Guillaume Seguin's avatar Guillaume Seguin

Revert to an older version of projectlayer.py

parent 3e49b61d
...@@ -23,8 +23,8 @@ import svg.document as wxpsvgdocument ...@@ -23,8 +23,8 @@ import svg.document as wxpsvgdocument
import imghdr import imghdr
class dispframe(wx.Frame): class dispframe(wx.Frame):
def __init__(self, parent, title, res = (800, 600), printer = None): def __init__(self, parent, title, res=(800, 600), printer=None):
wx.Frame.__init__(self, parent = parent, title = title) wx.Frame.__init__(self, parent=parent, title=title)
self.p = printer self.p = printer
self.pic = wx.StaticBitmap(self) self.pic = wx.StaticBitmap(self)
self.bitmap = wx.EmptyBitmap(*res) self.bitmap = wx.EmptyBitmap(*res)
...@@ -101,7 +101,7 @@ class dispframe(wx.Frame): ...@@ -101,7 +101,7 @@ class dispframe(wx.Frame):
wx.CallAfter(self.ShowFullScreen, 0) wx.CallAfter(self.ShowFullScreen, 0)
wx.CallAfter(self.timer.Stop) wx.CallAfter(self.timer.Stop)
def present(self, layers, interval = 0.5, pause = 0.2, thickness = 0.4, scale = 20, size = (800, 600), offset = (0, 0)): def present(self, layers, interval=0.5, pause=0.2, thickness=0.4, scale=20, size=(800, 600), offset=(0, 0)):
wx.CallAfter(self.pic.Hide) wx.CallAfter(self.pic.Hide)
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
self.layers = layers self.layers = layers
...@@ -118,47 +118,47 @@ class dispframe(wx.Frame): ...@@ -118,47 +118,47 @@ class dispframe(wx.Frame):
class setframe(wx.Frame): class setframe(wx.Frame):
def __init__(self, parent, printer = None): def __init__(self, parent, printer=None):
wx.Frame.__init__(self, parent, title = "Projector setup") wx.Frame.__init__(self, parent, title="Projector setup")
self.f = dispframe(None, "", printer = printer) self.f = dispframe(None, "", printer=printer)
self.panel = wx.Panel(self) self.panel = wx.Panel(self)
self.panel.SetBackgroundColour("orange") self.panel.SetBackgroundColour("orange")
self.bload = wx.Button(self.panel, -1, "Load", pos = (0, 0)) self.bload = wx.Button(self.panel, -1, "Load", pos=(0, 0))
self.bload.Bind(wx.EVT_BUTTON, self.loadfile) self.bload.Bind(wx.EVT_BUTTON, self.loadfile)
wx.StaticText(self.panel, -1, "Layer:", pos = (0, 30)) wx.StaticText(self.panel, -1, "Layer:", pos=(0, 30))
wx.StaticText(self.panel, -1, "mm", pos = (130, 30)) wx.StaticText(self.panel, -1, "mm", pos=(130, 30))
self.thickness = wx.TextCtrl(self.panel, -1, "0.5", pos = (50, 30)) self.thickness = wx.TextCtrl(self.panel, -1, "0.5", pos=(50, 30))
wx.StaticText(self.panel, -1, "Exposure:", pos = (0, 60)) wx.StaticText(self.panel, -1, "Exposure:", pos=(0, 60))
wx.StaticText(self.panel, -1, "s", pos = (130, 60)) wx.StaticText(self.panel, -1, "s", pos=(130, 60))
self.interval = wx.TextCtrl(self.panel, -1, "0.5", pos = (50, 60)) self.interval = wx.TextCtrl(self.panel, -1, "0.5", pos=(50, 60))
wx.StaticText(self.panel, -1, "Blank:", pos = (0, 90)) wx.StaticText(self.panel, -1, "Blank:", pos=(0, 90))
wx.StaticText(self.panel, -1, "s", pos = (130, 90)) wx.StaticText(self.panel, -1, "s", pos=(130, 90))
self.delay = wx.TextCtrl(self.panel, -1, "0.5", pos = (50, 90)) self.delay = wx.TextCtrl(self.panel, -1, "0.5", pos=(50, 90))
wx.StaticText(self.panel, -1, "Scale:", pos = (0, 120)) wx.StaticText(self.panel, -1, "Scale:", pos=(0, 120))
wx.StaticText(self.panel, -1, "x", pos = (130, 120)) wx.StaticText(self.panel, -1, "x", pos=(130, 120))
self.scale = wx.TextCtrl(self.panel, -1, "5", pos = (50, 120)) self.scale = wx.TextCtrl(self.panel, -1, "5", pos=(50, 120))
wx.StaticText(self.panel, -1, "X:", pos = (160, 30)) wx.StaticText(self.panel, -1, "X:", pos=(160, 30))
self.X = wx.TextCtrl(self.panel, -1, "1024", pos = (210, 30)) self.X = wx.TextCtrl(self.panel, -1, "1024", pos=(210, 30))
wx.StaticText(self.panel, -1, "Y:", pos = (160, 60)) wx.StaticText(self.panel, -1, "Y:", pos=(160, 60))
self.Y = wx.TextCtrl(self.panel, -1, "768", pos = (210, 60)) self.Y = wx.TextCtrl(self.panel, -1, "768", pos=(210, 60))
wx.StaticText(self.panel, -1, "OffsetX:", pos = (160, 90)) wx.StaticText(self.panel, -1, "OffsetX:", pos=(160, 90))
self.offsetX = wx.TextCtrl(self.panel, -1, "50", pos = (210, 90)) self.offsetX = wx.TextCtrl(self.panel, -1, "50", pos=(210, 90))
wx.StaticText(self.panel, -1, "OffsetY:", pos = (160, 120)) wx.StaticText(self.panel, -1, "OffsetY:", pos=(160, 120))
self.offsetY = wx.TextCtrl(self.panel, -1, "50", pos = (210, 120)) self.offsetY = wx.TextCtrl(self.panel, -1, "50", pos=(210, 120))
self.bload = wx.Button(self.panel, -1, "Present", pos = (0, 150)) self.bload = wx.Button(self.panel, -1, "Present", pos=(0, 150))
self.bload.Bind(wx.EVT_BUTTON, self.startdisplay) self.bload.Bind(wx.EVT_BUTTON, self.startdisplay)
wx.StaticText(self.panel, -1, "Fullscreen:", pos = (160, 150)) wx.StaticText(self.panel, -1, "Fullscreen:", pos=(160, 150))
self.fullscreen = wx.CheckBox(self.panel, -1, pos = (220, 150)) self.fullscreen = wx.CheckBox(self.panel, -1, pos=(220, 150))
self.fullscreen.SetValue(True) self.fullscreen.SetValue(True)
self.Show() self.Show()
...@@ -168,7 +168,7 @@ class setframe(wx.Frame): ...@@ -168,7 +168,7 @@ class setframe(wx.Frame):
shutil.rmtree(self.image_dir) shutil.rmtree(self.image_dir)
def parsesvg(self, name): def parsesvg(self, name):
et = xml.etree.ElementTree.ElementTree(file = name) et = xml.etree.ElementTree.ElementTree(file=name)
#xml.etree.ElementTree.dump(et) #xml.etree.ElementTree.dump(et)
slicer = 'Slic3r' if et.getroot().find('{http://www.w3.org/2000/svg}metadata') == None else 'Skeinforge' slicer = 'Slic3r' if et.getroot().find('{http://www.w3.org/2000/svg}metadata') == None else 'Skeinforge'
zlast = 0 zlast = 0
...@@ -214,7 +214,7 @@ class setframe(wx.Frame): ...@@ -214,7 +214,7 @@ class setframe(wx.Frame):
return ol, -1, "bitmap" return ol, -1, "bitmap"
def loadfile(self, event): def loadfile(self, event):
dlg = wx.FileDialog(self, ("Open file to print"), style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) dlg = wx.FileDialog(self, ("Open file to print"), style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard(("Slic3r or Skeinforge svg files (;*.svg;*.SVG;);3DLP Zip (;*.3dlp.zip;)")) dlg.SetWildcard(("Slic3r or Skeinforge svg files (;*.svg;*.SVG;);3DLP Zip (;*.3dlp.zip;)"))
if(dlg.ShowModal() == wx.ID_OK): if(dlg.ShowModal() == wx.ID_OK):
name = dlg.GetPath() name = dlg.GetPath()
...@@ -240,12 +240,12 @@ class setframe(wx.Frame): ...@@ -240,12 +240,12 @@ class setframe(wx.Frame):
self.f.ShowFullScreen(1) self.f.ShowFullScreen(1)
l = self.layers[0][:] l = self.layers[0][:]
self.f.present(l, self.f.present(l,
thickness = float(self.thickness.GetValue()), thickness=float(self.thickness.GetValue()),
interval = float(self.interval.GetValue()), interval=float(self.interval.GetValue()),
scale = float(self.scale.GetValue()), scale=float(self.scale.GetValue()),
pause = float(self.delay.GetValue()), pause=float(self.delay.GetValue()),
size = (float(self.X.GetValue()), float(self.Y.GetValue())), size=(float(self.X.GetValue()), float(self.Y.GetValue())),
offset = (float(self.offsetX.GetValue()), float(self.offsetY.GetValue()))) offset=(float(self.offsetX.GetValue()), float(self.offsetY.GetValue())))
if __name__ == "__main__": if __name__ == "__main__":
a = wx.App() a = wx.App()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment