tTried intro dialog, doesn't work - cross-stitch - interactively turn images into patterns for cross stitching
 (HTM) git clone git://src.adamsgaard.dk/cross-stitch
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 837beae0660c1a09a79f0caddf44c06d97c000f8
 (DIR) parent 13c1658e6245e8819802b7c911aa7af274130221
 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
       Date:   Sat, 15 Feb 2014 00:00:13 +0100
       
       Tried intro dialog, doesn't work
       
       Diffstat:
         M cross-stitch.py                     |      69 ++++++++++++++++++++++++++++---
       
       1 file changed, 63 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/cross-stitch.py b/cross-stitch.py
       t@@ -52,6 +52,53 @@ class CrossStitch:
                return self.img
        
        
       +class DownSampleDialog(wx.Dialog):
       +
       +    def __init__(self, *args, **kw):
       +        super(DownSampleDialog, self).__init__(*args, **kw)
       +
       +        self.InitUI()
       +        self.SetSize((250, 200))
       +        self.SetTitle('Downsample image')
       +
       +    def InitUI(self):
       +
       +        pnl = wx.Panel(self)
       +        vbox = wx.BoxSizer(wx.VERTICAL)
       +
       +        sb = wx.StaticBox(pnl, label='New width')
       +        sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL)
       +        sbs.Add(wx.Radiobutton(pnl, label='120 squares'))
       +        sbs.Add(wx.Radiobutton(pnl, label='80 squares', style=wx.RB_GROUP))
       +        sbs.Add(wx.Radiobutton(pnl, label='40 squares'))
       +
       +        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
       +        hbox1.Add(wx.RadioButton(pnl, label='Custom'))
       +        hbox1.Add(wx.TextCtrl(pnl), flag=wx.LEFT, border=5)
       +        sbs.Add(hbox1)
       +
       +        pnl.SetSizer(sbs)
       +
       +        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
       +        okButton = wx.Button(self, label='Ok')
       +        closeButton = wx.Button(self, label='Close')
       +        hbox2.Add(okButton)
       +        hbox2.Add(closeButton, flag=wx.LEFT, border=5)
       +
       +        vbox.Add(pnl, proportion=1, flag=wx.ALL|wx.EXPAND, border=5)
       +        vbox.Add(hbox2, flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=10)
       +
       +        self.SetSiezr(vbox)
       +
       +
       +        okButton.Bind(wx.EVT_BUTTON, self.OnClose)
       +        closeButton.BIND(wx.EVT_BUTTON, self.OnClose)
       +
       +    def OnClose(self, event):
       +        self.Destroy()
       +
       +
       +
        class MainScreen(wx.Frame):
        
            def __init__(self, *args, **kwargs):
       t@@ -62,6 +109,8 @@ class MainScreen(wx.Frame):
        
            def InitUI(self):
        
       +        self.ID_DOWNSAMPLING = wx.NewID()
       +
                self.InitMenu()
                #self.InitToolbar()
                self.InitPreview()
       t@@ -86,9 +135,12 @@ class MainScreen(wx.Frame):
                menubar.Append(fileMenu, '&File')
        
                processingMenu = wx.Menu()
       -        fitem = processingMenu.Append(wx.ID_ANY, 'Down sample',
       -                'Down sample image')
       -        self.Bind(wx.EVT_MENU, self.OnDownSample, fitem)
       +        #fitem = processingMenu.Append(wx.ID_ANY, 'Down sample',
       +        #        'Down sample image')
       +        #self.Bind(wx.EVT_MENU, self.OnDownSample, fitem)
       +        fitem = processingMenu.Append(id=self.ID_DOWNSAMPLING,
       +                label='Down sample')
       +        self.Bind(wx.EVT_TOOL, self.OnDownSample, id=self.ID_DOWNSAMPLING)
                fitem = processingMenu.Append(wx.ID_ANY, 'Reduce number of colors',
                        'Reduce number of colors in image')
                self.Bind(wx.EVT_MENU, self.OnLimitColors, fitem)
       t@@ -159,9 +211,12 @@ class MainScreen(wx.Frame):
                self.contentNotSaved = False
        
            def OnDownSample(self, event):
       -        self.cs.down_sample(80)
       -        self.contentNotSaved = True
       -        self.DrawPreview()
       +        dwnsmpl = DownSampleDialog(None, title='Downsample image')
       +        dwnsmpl.ShowModal()
       +        dwnsmpl.Destroy()
       +        #self.cs.down_sample(80)
       +        #self.contentNotSaved = True
       +        #self.DrawPreview()
        
            def OnLimitColors(self, event):
                self.cs.limit_colors(16)
       t@@ -208,6 +263,8 @@ the Free Software Foundation, Inc., 59 Temple Palace, Suite 330, Boston, MA
        
                wx.AboutBox(info)
        
       +
       +
        def main():
            app = wx.App()
            MainScreen(None, title='Cross Stitch')