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
import imghdr
class dispframe(wx.Frame):
def __init__(self, parent, title, res = (800, 600), printer = None):
wx.Frame.__init__(self, parent = parent, title = title)
def __init__(self, parent, title, res=(800, 600), printer=None):
wx.Frame.__init__(self, parent=parent, title=title)
self.p = printer
self.pic = wx.StaticBitmap(self)
self.bitmap = wx.EmptyBitmap(*res)
......@@ -101,7 +101,7 @@ class dispframe(wx.Frame):
wx.CallAfter(self.ShowFullScreen, 0)
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.Refresh)
self.layers = layers
......@@ -118,47 +118,47 @@ class dispframe(wx.Frame):
class setframe(wx.Frame):
def __init__(self, parent, printer = None):
wx.Frame.__init__(self, parent, title = "Projector setup")
self.f = dispframe(None, "", printer = printer)
def __init__(self, parent, printer=None):
wx.Frame.__init__(self, parent, title="Projector setup")
self.f = dispframe(None, "", printer=printer)
self.panel = wx.Panel(self)
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)
wx.StaticText(self.panel, -1, "Layer:", pos = (0, 30))
wx.StaticText(self.panel, -1, "mm", pos = (130, 30))
self.thickness = wx.TextCtrl(self.panel, -1, "0.5", pos = (50, 30))
wx.StaticText(self.panel, -1, "Layer:", pos=(0, 30))
wx.StaticText(self.panel, -1, "mm", pos=(130, 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, "s", pos = (130, 60))
self.interval = wx.TextCtrl(self.panel, -1, "0.5", pos = (50, 60))
wx.StaticText(self.panel, -1, "Exposure:", pos=(0, 60))
wx.StaticText(self.panel, -1, "s", pos=(130, 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, "s", pos = (130, 90))
self.delay = wx.TextCtrl(self.panel, -1, "0.5", pos = (50, 90))
wx.StaticText(self.panel, -1, "Blank:", pos=(0, 90))
wx.StaticText(self.panel, -1, "s", pos=(130, 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, "x", pos = (130, 120))
self.scale = wx.TextCtrl(self.panel, -1, "5", pos = (50, 120))
wx.StaticText(self.panel, -1, "Scale:", pos=(0, 120))
wx.StaticText(self.panel, -1, "x", pos=(130, 120))
self.scale = wx.TextCtrl(self.panel, -1, "5", pos=(50, 120))
wx.StaticText(self.panel, -1, "X:", pos = (160, 30))
self.X = wx.TextCtrl(self.panel, -1, "1024", pos = (210, 30))
wx.StaticText(self.panel, -1, "X:", pos=(160, 30))
self.X = wx.TextCtrl(self.panel, -1, "1024", pos=(210, 30))
wx.StaticText(self.panel, -1, "Y:", pos = (160, 60))
self.Y = wx.TextCtrl(self.panel, -1, "768", pos = (210, 60))
wx.StaticText(self.panel, -1, "Y:", pos=(160, 60))
self.Y = wx.TextCtrl(self.panel, -1, "768", pos=(210, 60))
wx.StaticText(self.panel, -1, "OffsetX:", pos = (160, 90))
self.offsetX = wx.TextCtrl(self.panel, -1, "50", pos = (210, 90))
wx.StaticText(self.panel, -1, "OffsetX:", pos=(160, 90))
self.offsetX = wx.TextCtrl(self.panel, -1, "50", pos=(210, 90))
wx.StaticText(self.panel, -1, "OffsetY:", pos = (160, 120))
self.offsetY = wx.TextCtrl(self.panel, -1, "50", pos = (210, 120))
wx.StaticText(self.panel, -1, "OffsetY:", pos=(160, 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)
wx.StaticText(self.panel, -1, "Fullscreen:", pos = (160, 150))
self.fullscreen = wx.CheckBox(self.panel, -1, pos = (220, 150))
wx.StaticText(self.panel, -1, "Fullscreen:", pos=(160, 150))
self.fullscreen = wx.CheckBox(self.panel, -1, pos=(220, 150))
self.fullscreen.SetValue(True)
self.Show()
......@@ -168,7 +168,7 @@ class setframe(wx.Frame):
shutil.rmtree(self.image_dir)
def parsesvg(self, name):
et = xml.etree.ElementTree.ElementTree(file = name)
et = xml.etree.ElementTree.ElementTree(file=name)
#xml.etree.ElementTree.dump(et)
slicer = 'Slic3r' if et.getroot().find('{http://www.w3.org/2000/svg}metadata') == None else 'Skeinforge'
zlast = 0
......@@ -214,7 +214,7 @@ class setframe(wx.Frame):
return ol, -1, "bitmap"
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;)"))
if(dlg.ShowModal() == wx.ID_OK):
name = dlg.GetPath()
......@@ -240,12 +240,12 @@ class setframe(wx.Frame):
self.f.ShowFullScreen(1)
l = self.layers[0][:]
self.f.present(l,
thickness = float(self.thickness.GetValue()),
interval = float(self.interval.GetValue()),
scale = float(self.scale.GetValue()),
pause = float(self.delay.GetValue()),
size = (float(self.X.GetValue()), float(self.Y.GetValue())),
offset = (float(self.offsetX.GetValue()), float(self.offsetY.GetValue())))
thickness=float(self.thickness.GetValue()),
interval=float(self.interval.GetValue()),
scale=float(self.scale.GetValue()),
pause=float(self.delay.GetValue()),
size=(float(self.X.GetValue()), float(self.Y.GetValue())),
offset=(float(self.offsetX.GetValue()), float(self.offsetY.GetValue())))
if __name__ == "__main__":
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