Initial layout for print window

master
Daid 2012-03-28 20:36:46 +02:00
parent 0d16ef4bd1
commit 2d79297047
2 changed files with 25 additions and 7 deletions

View File

@ -261,7 +261,13 @@ class mainWindow(configBase.configWindowBase):
self.progressPanelList.append(spp)
def OnPrint(self, e):
printWindow.printWindow()
if self.filename == None:
wx.MessageBox('You need to load a file before you can print it.', 'Print error', wx.OK | wx.ICON_INFORMATION)
return
if not os.path.exists(self.filename[: self.filename.rfind('.')] + "_export.gcode"):
wx.MessageBox('You need to slice the file to GCode before you can print it.', 'Print error', wx.OK | wx.ICON_INFORMATION)
return
printWindow.printFile(self.filename[: self.filename.rfind('.')] + "_export.gcode")
def OnExpertOpen(self, e):
acw = advancedConfig.advancedConfigWindow()

View File

@ -17,14 +17,26 @@ class printWindow(wx.Frame):
"Main user interface window"
def __init__(self):
super(printWindow, self).__init__(None, -1, title='Printing')
self.SetSizer(wx.GridBagSizer(2, 2))
self.SetSizer(wx.BoxSizer())
self.panel = wx.Panel(self)
self.GetSizer().Add(self.panel, 1, flag=wx.EXPAND)
self.sizer = wx.GridBagSizer(2, 2)
self.panel.SetSizer(self.sizer)
self.statsPanel = wx.Panel(self)
self.GetSizer().Add(self.statsPanel, pos=(0,0), span=(4,1), flag=wx.EXPAND)
sb = wx.StaticBox(self.panel, label="Statistics")
boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
boxsizer.Add(wx.StaticText(self.panel, -1, "Filament: #.##m #.##g"), flag=wx.LEFT, border=5)
boxsizer.Add(wx.StaticText(self.panel, -1, "Print time: ##:##"), flag=wx.LEFT, border=5)
self.GetSizer().Add(wx.Button(self, -1, 'Test'), pos=(0,1))
self.GetSizer().Add(wx.Button(self, -1, 'Test'), pos=(1,1))
self.GetSizer().Add(wx.Button(self, -1, 'Test'), pos=(2,1))
self.sizer.Add(boxsizer, pos=(0,0), span=(4,1), flag=wx.EXPAND)
self.sizer.Add(wx.Button(self.panel, -1, 'Connect'), pos=(0,1))
self.sizer.Add(wx.Button(self.panel, -1, 'Load GCode'), pos=(1,1))
self.sizer.Add(wx.Button(self.panel, -1, 'Print GCode'), pos=(2,1))
self.sizer.Add(wx.Button(self.panel, -1, 'Cancel print'), pos=(3,1))
self.sizer.Add(wx.Gauge(self.panel, -1), pos=(4,0), span=(1,2), flag=wx.EXPAND)
self.sizer.AddGrowableRow(3)
self.sizer.AddGrowableCol(0)
self.Bind(wx.EVT_CLOSE, self.OnClose)