from wxPython.wx import * import wx from multimatic import * START_STR = """# Multimatic: image composition tool # enter your Multimatic options here # anything after a hash (#) is a comment # See the Multimatic webpage for a description of the options: # http://projects.caseyporn.com/multimatic # A basic layout example is given below dir: images/ choose: random 4 layout: ActionSampler resize: 50% vignette: 2 output: my_fake_lomo # There's a lot more you can do! See the manual for details. """ class MyPanel(wxPanel): def __init__(self, parent, log): wxPanel.__init__(self, parent, log) self.log = log self.optsText = wx.TextCtrl(self, -1, START_STR, size=(300, 300), style=wx.TE_MULTILINE) self.gobut = wx.Button(self, 10, "Run Multimatic!" , (0, 300)) self.gobut.SetSize(wxSize(300,30)) self.Bind(wx.EVT_BUTTON, self.onClick, self.gobut) def onClick(self, event): s = self.optsText.GetValue() print s try: opts = parseOptsStr(s) m = Multimatic(opts) fnames = m.go() msg = "Multimatic completed: files saved: %s" %(",".join(fnames)) dlg = wx.MessageDialog(self, msg, 'Development Complete', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() except ConfigError, e: dlg = wx.MessageDialog(self, str(e), 'Configuration Error', wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() class MultimaticWindow(wxFrame): def __init__(self, parent, ID, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE): size = wxSize(310, 360) wx.Frame.__init__(self, parent, ID, title, pos, size, style) panel = MyPanel(self, -1) class MyApp(wxApp): def OnInit(self): panel = MultimaticWindow(NULL, -1, "Multimatic") panel.Show(true) self.SetTopWindow(panel) return true app = MyApp(0) app.MainLoop()