Ejemplo n.º 1
0
    def __init__(self, parent, mainframe):
        wx.Panel.__init__(self, parent, -1)

        self.mainframe = mainframe
        self.pref = Globals.pref

        self.sizer = sizer = ui.VBox(
            namebinding='widget').create(self).auto_layout()
        box = sizer.add(ui.HBox)
        box.add(ui.Check(self.pref.pylint_convention, tr('Convention')),
                name='convention').bind('check', self.OnCheckConvention)
        box.add(ui.Check(self.pref.pylint_refactor, tr('Refactor')),
                name='refactor').bind('check', self.OnCheckRefactor)
        box.add(ui.Check(self.pref.pylint_warning, tr('Warning')),
                name='warning').bind('check', self.OnCheckWarning)
        box.add(ui.Check(self.pref.pylint_error, tr('Error')),
                name='error').bind('check', self.OnCheckError)
        box.add(ui.Check(self.pref.pylint_fatal, tr('Fatal')),
                name='fatal').bind('check', self.OnCheckFatal)
        self.list = CheckList.List(self,
                                   columns=[
                                       (tr("Filename"), 400, 'left'),
                                       (tr("Type"), 100, 'left'),
                                       (tr("LineNo"), 60, 'left'),
                                       (tr("Description"), 200, 'left'),
                                   ],
                                   style=wx.LC_REPORT | wx.SUNKEN_BORDER
                                   | wx.LC_SINGLE_SEL)

        sizer.add(self.list, proportion=1, flag=wx.EXPAND)

        wx.EVT_LIST_ITEM_ACTIVATED(self.list, self.list.GetId(), self.OnEnter)

        sizer.auto_fit(0)
Ejemplo n.º 2
0
 def __init__(self, parent):
     self.parent = parent
     wx.Panel.__init__(self, parent, -1)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(wx.StaticText(self, -1, tr("Documents")), 0, wx.ALL, 2)
     self.list = CheckList.List(self,
                                columns=[
                                    (tr("Document Name"), 80, 'left'),
                                ],
                                style=wx.LC_REPORT | wx.SUNKEN_BORDER
                                | wx.LC_SINGLE_SEL)
     self.list.Enable(False)
     sizer.Add(self.list, 1, wx.EXPAND | wx.ALL, 2)
     self.SetSizer(sizer)
     self.SetAutoLayout(True)
Ejemplo n.º 3
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           tr('Plugin Manager'),
                           size=(600, 400))
        self.parent = parent
        self.mainframe = parent
        self.state = {}

        self.plugins = self.loadPlugins()
        for key in self.plugins.keys():
            self.state[key] = False
        text = file(self.mainframe.plugin_initfile).read()
        re_i = re.compile("^\s+import\s+(\w+)$", re.M)
        result = re_i.findall(text)
        for key in result:
            self.state[key] = True

        box = wx.BoxSizer(wx.VERTICAL)
        self.list = CheckList.CheckList(self,
                                        columns=[
                                            (tr("Name"), 120, 'left'),
                                            (tr("Description"), 220, 'left'),
                                            (tr("Author"), 80, 'left'),
                                            (tr("Version"), 40, 'center'),
                                            (tr("Date"), 80, 'left'),
                                        ],
                                        style=wx.LC_REPORT | wx.SUNKEN_BORDER)
        self.list.load(self.getdata)

        box.Add(self.list, 1, wx.EXPAND | wx.ALL, 5)
        box2 = wx.BoxSizer(wx.HORIZONTAL)
        self.btnOK = wx.Button(self, wx.ID_OK, tr("OK"), size=(80, -1))
        self.btnOK.SetDefault()
        box2.Add(self.btnOK, 0, 0, 5)
        self.btnCancel = wx.Button(self,
                                   wx.ID_CANCEL,
                                   tr("Cancel"),
                                   size=(80, -1))
        box2.Add(self.btnCancel, 0, 0, 5)
        box.Add(box2, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        wx.EVT_LIST_ITEM_ACTIVATED(self.list, self.list.GetId(), self.OnEnter)
        wx.EVT_BUTTON(self.btnOK, wx.ID_OK, self.OnOK)

        self.SetSizer(box)
        self.SetAutoLayout(True)
Ejemplo n.º 4
0
 def __init__(self, parent, title=tr('Result')):
     wx.Dialog.__init__(self, Globals.mainframe, -1, style = wx.DEFAULT_DIALOG_STYLE, title = title, size=(600, 300))
     
     self.parent = parent
     self.sizer = box = ui.VBox(namebinding='widget').create(self).auto_layout()
     self.list = CheckList.List(self, columns=[
             (tr("Action"), 120, 'left'),
             (tr("Path"), 400, 'left'),
             ], style=wx.LC_REPORT | wx.SUNKEN_BORDER)
     
     box.add(self.list, proportion=1, flag=wx.ALL|wx.EXPAND, border=5)
     box.add(ui.Label, name='message')
     box.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER|wx.BOTTOM)
     
     box.bind('btnCancel', 'click', self.OnCancel)
     box.auto_fit(0)
     self.btnOk.Disable()
     self.btnCancel.Enable()
Ejemplo n.º 5
0
 def __init__(self, parent, title, path):
     wx.Dialog.__init__(self, parent, -1, style = wx.DEFAULT_DIALOG_STYLE, title = title, size=(400, 300))
     self.path = path
     
     self.sizer = box = ui.VBox(namebinding='widget').create(self).auto_layout()
     self.list = CheckList.CheckList(self, columns=[
             (tr("File"), 380, 'left'),
             ], style=wx.LC_REPORT | wx.SUNKEN_BORDER)
     
     box.add(self.list, proportion=1, flag=wx.ALL|wx.EXPAND, border=5)
     self.list.on_check = self.OnCheck
     
     #add selection switch checkbox
     box.add(ui.Check3D(2, tr('Select / deselect All')), name='select').bind('check', self.OnSelect)
     
     box.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER|wx.BOTTOM)
     self.btnOk.SetDefault()
     
     self.init()
Ejemplo n.º 6
0
    def __init__(self, parent, mainframe):
        self.initmixin()

        self.parent = parent

        wx.Panel.__init__(self, parent, -1)

        self.publisher = pubsub.Publisher()

        box = wx.BoxSizer(wx.VERTICAL)
        self.list = CheckList.CheckList(self, columns=[
            (tr("Subject"), 400, 'left'),
            (tr("Date"), 120, 'left'),
            ], check_image=images.getCheckBitmap(), uncheck_image=images.getUncheckBitmap(),
            style=wx.LC_REPORT | wx.SUNKEN_BORDER)

        self.list.on_check = self.OnCheck

        box.Add(self.list, 1, wx.EXPAND|wx.ALL)
        self.SetSizer(box)
        self.SetAutoLayout(True)

        wx.EVT_LIST_ITEM_SELECTED(self.list, self.list.GetId(), self.OnChanged)
Ejemplo n.º 7
0
    def __init__(self, title, path):
        wx.Dialog.__init__(self, Globals.mainframe, -1, style = wx.DEFAULT_DIALOG_STYLE, title = title, size=(600, 500))
        self.pref = Globals.pref
        self.path = path
        self.fileinfos = {}
        self.filelist = []
        
        self.sizer = box = ui.VBox(namebinding='widget').create(self).auto_layout()
        
        box1 = box.add(ui.VGroup(tr("Message")))
        box1.add(ui.Button(tr("Recent Messages"))).bind('click', self.OnHisMsg)
        box1.add(ui.MultiText, name='message')

        #add filenames list
        self.list = CheckList.CheckList(self, columns=[
                (tr("File"), 390, 'left'),
                (tr("Extension"), 70, 'left'),
                (tr("Status"), 100, 'left'),
                ], style=wx.LC_REPORT | wx.SUNKEN_BORDER)
        
        box.add(self.list, proportion=2, flag=wx.EXPAND|wx.ALL, border=5)
        self.list.on_check = self.OnCheck
        
        box.add(
            ui.Check(True, tr('Show unversioned files')), 
            name='chkShowUnVersion').bind('check', self.OnShowUnVersion)
        box.add(
            ui.Check3D(False, tr('Select / deselect All')),
            name='select').bind('check', self.OnSelect)
        
        box.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER|wx.BOTTOM)
        self.btnOk.SetDefault()
        
        box.auto_fit(0)
        
        wx.CallAfter(self.init)
Ejemplo n.º 8
0
    def __init__(self, parent):
        self.parent = parent
        wx.Panel.__init__(self, parent, -1)

        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer1 = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(sizer1, 0, wx.EXPAND | wx.ALL, 2)

        regex_title = wx.StaticBox(self, -1, tr("Regular expression"))
        box1 = wx.StaticBoxSizer(regex_title, wx.VERTICAL)
        self.text = wx.TextCtrl(self, -1, "", style=wx.TE_MULTILINE)
        box1.Add(self.text, 1, wx.EXPAND | wx.ALL, 2)
        sizer1.Add(box1, 1, wx.EXPAND | wx.RIGHT, 4)

        box = wx.BoxSizer(wx.VERTICAL)
        self.btnRun = wx.Button(self, -1, tr('Run'))
        box.Add(self.btnRun, 0, wx.ALL, 2)
        self.btnCreate = wx.Button(self, -1, tr('Create'))
        box.Add(self.btnCreate, 0, wx.ALL, 2)
        sizer1.Add(box, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 4)

        find_title = wx.StaticBox(self, -1, tr("Methods"))
        box2 = wx.StaticBoxSizer(find_title, wx.VERTICAL)
        self.rdoFindFirst = wx.RadioButton(self,
                                           -1,
                                           tr("Find First"),
                                           style=wx.RB_GROUP)
        self.rdoFindAll = wx.RadioButton(self, -1, tr("Find All"))
        box2.Add(self.rdoFindFirst, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        box2.Add(self.rdoFindAll, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        sizer1.Add(box2, 0, wx.EXPAND | wx.RIGHT, 4)

        from_title = wx.StaticBox(self, -1, tr("From"))
        box3 = wx.StaticBoxSizer(from_title, wx.VERTICAL)
        self.rdoFromBeginning = wx.RadioButton(self,
                                               -1,
                                               tr("From beginning"),
                                               style=wx.RB_GROUP)
        self.rdoFromCaret = wx.RadioButton(self, -1, tr("From caret"))
        self.rdoInSelection = wx.RadioButton(self, -1, tr("In Selection"))
        box3.Add(self.rdoFromBeginning, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                 2)
        box3.Add(self.rdoFromCaret, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        box3.Add(self.rdoInSelection, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        sizer1.Add(box3, 0, wx.EXPAND | wx.RIGHT, 4)

        flag_title = wx.StaticBox(self, -1, tr("Flags"))
        box4 = wx.StaticBoxSizer(flag_title, wx.VERTICAL)
        grid1 = wx.FlexGridSizer(0, 2, 0, 0)
        box4.Add(grid1, 1, wx.EXPAND | wx.ALL, 2)
        sizer1.Add(box4, 0, wx.EXPAND | wx.RIGHT, 4)

        groups = [
            ('ignore', tr("Ignore Case(I)"), re.I, 're.I'),
            ('locale', tr("Locale(L)"), re.L, 're.L'),
            ('multiline', tr("Multi Line(M)"), re.M, 're.M'),
            ('dotall', tr("Dot All(S)"), re.S, 're.S'),
            ('unicode', tr("Unicode(U)"), re.U, 're.U'),
            ('verbose', tr("Verbose(V)"), re.X, 're.X'),
        ]
        self.checks = {}
        k = 0
        for i, v in enumerate(groups):
            ctrl_name, label, flag, strflag = v
            obj = wx.CheckBox(self, -1, label)
            wx.EVT_CHECKBOX(obj, obj.GetId(), self.OnChange)
            self.checks[ctrl_name] = obj, flag, strflag
            grid1.Add(obj, k, wx.ALL, 2)
            if i % 2 == 0:
                k += 1

        self.splitter = splitter = MultiSplitterWindow(self)
        self.result = CheckList.List(splitter,
                                     columns=[
                                         (tr("Items"), 150, 'left'),
                                         (tr("Values"), 300, 'left'),
                                     ],
                                     style=wx.LC_REPORT | wx.SUNKEN_BORDER
                                     | wx.LC_SINGLE_SEL)
        splitter.AppendWindow(self.result, 450)
        self.matches = wx.TextCtrl(splitter,
                                   -1,
                                   "",
                                   style=wx.TE_MULTILINE | wx.TE_RICH2)
        splitter.AppendWindow(self.matches, 150)

        splitter.SetOrientation(wx.HORIZONTAL)
        sizer.Add(splitter, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 4)

        self.load()

        wx.EVT_BUTTON(self.btnRun, self.btnRun.GetId(), self.OnChange)
        wx.EVT_BUTTON(self.btnCreate, self.btnCreate.GetId(),
                      self.OnCreateExpression)
        wx.EVT_TEXT(self.text, self.text.GetId(), self.OnChange)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
Ejemplo n.º 9
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           tr('Mixins Reload Manage'),
                           size=(400, 300))
        self.parent = parent
        self.mainframe = parent
        self.state = {}

        self.mixins = self.loadMixins()

        for key in self.mixins.keys():
            self.state[key] = False

        reload_name = self.mainframe.pref.mixin_reload_name or []
        for key in reload_name:
            self.state[key] = True
        box = wx.BoxSizer(wx.VERTICAL)
        self.list = CheckList.CheckList(self,
                                        columns=[
                                            (tr("Name"), 120, 'left'),
                                        ],
                                        style=wx.LC_REPORT | wx.SUNKEN_BORDER)

        self.list.load(self.getdata)
        box.Add(self.list, 1, wx.EXPAND | wx.ALL, 5)

        self.list_text = wx.StaticText(
            self, -1,
            tr("if you select nothing, All mixins will be reloaded or\n"
               "only selected mixins will be reloaded.\n\n"
               "right_click item will open the mixin file."), (0, 0))
        text_box = wx.BoxSizer(wx.HORIZONTAL)
        text_box.Add(self.list_text, 0, 0, 5)
        self.warn_text = wx.StaticText(
            self, -1,
            tr("after restarting this program, the changes will be taken effect!"
               ), (0, 0))
        self.warn_text.SetForegroundColour('Red')
        text2_box = wx.BoxSizer(wx.HORIZONTAL)
        text2_box.Add(self.warn_text, 0, 0, 0)
        box2 = wx.BoxSizer(wx.HORIZONTAL)
        self.btnOK = wx.Button(self, wx.ID_OK, tr("OK"), size=(80, -1))
        self.btnOK.SetDefault()
        box2.Add(self.btnOK, 0, 0, 5)
        self.btnCancel = wx.Button(self,
                                   wx.ID_CANCEL,
                                   tr("Cancel"),
                                   size=(80, -1))
        box2.Add(self.btnCancel, 0, 0, 5)
        box.Add(text_box, 0, wx.ALIGN_LEFT | wx.ALL, 5)
        box.Add(text2_box, 0, wx.ALIGN_LEFT | wx.ALL, 5)
        box.Add(box2, 0, wx.ALIGN_CENTER | wx.ALL, 5)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED,
                  self.OnEnter,
                  id=self.list.GetId())
        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK,
                  self.open_mixins_file,
                  id=self.list.GetId())
        self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK, id=wx.ID_OK)
        self.SetSizer(box)
        self.SetAutoLayout(True)
Ejemplo n.º 10
0
    def __init__(self, parent, mainframe):
        self.parent = parent
        self.mainframe = mainframe
        self.defm3u = os.path.join(Globals.userpath, 'default.m3u')
        if not os.path.isfile(self.defm3u):
            fout = open(self.defm3u, 'w')
            fout.write('#EXTM3U\n')
            fout.close()
        self.m3u = PyM3u.M3u(self.defm3u)
        self.mainframe.m3u = self.m3u
        self.m3u.Load()
        self.mainframe.selectedid = -1
        wx.Panel.__init__(self, parent, -1)
        box = wx.BoxSizer(wx.VERTICAL)
        box1 = wx.BoxSizer(wx.HORIZONTAL)

        self.m3u_filename = wx.StaticText(self, -1, '')
        self.playingname = wx.StaticText(self, -1, '')
        box.Add(self.m3u_filename, 0, wx.ALL | wx.EXPAND, 3)
        box.Add(self.playingname, 0, wx.ALL | wx.EXPAND, 3)

        #add button
        self.ID_ADD = wx.NewId()
        self.btnAdd = wx.Button(self, self.ID_ADD, tr('Add'))
        box1.Add(self.btnAdd, 0, wx.RIGHT, 2)

        self.ID_ADDDIR = wx.NewId()
        self.btnAddDir = wx.Button(self, self.ID_ADDDIR, tr('AddDir'))
        box1.Add(self.btnAddDir, 0, wx.RIGHT, 2)

        self.ID_DEL = wx.NewId()
        self.btnDel = wx.Button(self, self.ID_DEL, tr('Delete'))
        box1.Add(self.btnDel, 0, wx.RIGHT, 2)

        self.ID_OPEN = wx.NewId()
        self.btnOpen = wx.Button(self, self.ID_OPEN, tr('OpenList'))
        box1.Add(self.btnOpen, 0, wx.RIGHT, 2)

        self.ID_SAVE = wx.NewId()
        self.btnSave = wx.Button(self, self.ID_SAVE, tr('SaveList'))
        box1.Add(self.btnSave, 0, wx.RIGHT, 2)

        box.Add(box1, 0, wx.ALL, 3)

        #create listctrl
        self.musiclist = CheckList.List(self,
                                        columns=[
                                            (tr("Id"), 30, 'left'),
                                            (tr("Author - Title"), 280,
                                             'left'),
                                            (tr("Time"), 80, 'right'),
                                            (tr("Path"), 400, 'left'),
                                        ],
                                        style=wx.LC_REPORT | wx.SUNKEN_BORDER)

        box.Add(self.musiclist, 1, wx.EXPAND)

        wx.EVT_BUTTON(self.btnAdd, self.ID_ADD, self.OnAdd)
        wx.EVT_BUTTON(self.btnAddDir, self.ID_ADDDIR, self.OnAddDir)
        wx.EVT_BUTTON(self.btnDel, self.ID_DEL, self.OnDel)
        wx.EVT_BUTTON(self.btnOpen, self.ID_OPEN, self.OnOpen)
        wx.EVT_BUTTON(self.btnSave, self.ID_SAVE, self.OnSave)
        wx.EVT_LIST_ITEM_ACTIVATED(self.musiclist, self.musiclist.GetId(),
                                   self.OnActivated)
        wx.EVT_LIST_ITEM_SELECTED(self.musiclist, self.musiclist.GetId(),
                                  self.OnSelected)

        self.SetSizer(box)
        self.SetAutoLayout(True)
        self.OnUpdateData()
Ejemplo n.º 11
0
    def __init__(self, parent, title=''):
        if hasattr(Globals.pref, 'searchwin_pos') and hasattr(
                Globals.pref, 'searchwin_size'):
            searchwin_pos = Globals.pref.searchwin_pos
            searchwin_size = Globals.pref.searchwin_size
            wx.Dialog.__init__(self,
                               parent,
                               -1,
                               title,
                               searchwin_pos,
                               searchwin_size,
                               style=wx.RESIZE_BORDER
                               | wx.DEFAULT_DIALOG_STYLE)
        else:
            wx.Dialog.__init__(self,
                               parent,
                               -1,
                               title,
                               size=(600, 400),
                               style=wx.RESIZE_BORDER
                               | wx.DEFAULT_DIALOG_STYLE)
            self.Center()

        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer1 = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, tr("Search for:"))
        sizer1.Add(label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.text = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_ENTER)
        self.impact_check = wx.CheckBox(self, -1, tr("Impact Mode"))
        self.autoclose_check = wx.CheckBox(self, -1, tr("Auto Close"))
        sizer1.Add(self.text, 1, wx.ALL, 2)
        sizer1.Add(self.impact_check, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        sizer1.Add(self.autoclose_check, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                   2)

        self.list = CheckList.List(self,
                                   columns=[
                                       (tr("Function"), 300, 'left'),
                                       (tr("ShortCuts"), 120, 'left'),
                                       (tr("Impact"), 80, 'left'),
                                   ],
                                   style=wx.LC_REPORT | wx.SUNKEN_BORDER
                                   | wx.LC_SINGLE_SEL)
        self.commandar = Commands.getinstance()
        self.cmdbuf = {}
        self.load(self.commandar.search(''))

        sizer.Add(sizer1, 0, wx.EXPAND)
        sizer.Add(self.list, 1, wx.EXPAND, 2)

        btnCancel = wx.Button(self, wx.ID_CANCEL, tr("Cancel"))
        sizer.Add(btnCancel, 0, wx.ALIGN_CENTER, 2)

        wx.EVT_CLOSE(self, self.OnClose)
        wx.EVT_SIZE(self, self.OnSize)
        wx.EVT_BUTTON(self, wx.ID_CANCEL, self.OnClose)
        wx.EVT_TEXT(self.text, self.text.GetId(), self.OnChange)
        wx.EVT_KEY_DOWN(self.text, self.OnKeyDown)
        wx.EVT_LIST_ITEM_ACTIVATED(self.list, self.list.GetId(), self.OnEnter)
        wx.EVT_CHECKBOX(self.impact_check, self.impact_check.GetId(),
                        self.OnCheckImpact)
        wx.EVT_CHECKBOX(self.autoclose_check, self.autoclose_check.GetId(),
                        self.OnCheckAutoClose)

        self.impact_check.SetValue(Globals.pref.commands_impact)
        self.autoclose_check.SetValue(Globals.pref.commands_autoclose)

        Globals.mainframe.command_mode = True

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
Ejemplo n.º 12
0
    def __init__(self, parent, pref):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           tr('Script Manager'),
                           size=(600, 300))
        self.parent = parent
        self.pref = pref

        box = wx.BoxSizer(wx.VERTICAL)
        self.list = CheckList.List(self,
                                   columns=[
                                       (tr("Description"), 150, 'left'),
                                       (tr("Filename"), 330, 'left'),
                                       (tr("Shortcut"), 80, 'center'),
                                   ],
                                   style=wx.LC_REPORT | wx.SUNKEN_BORDER
                                   | wx.LC_EDIT_LABELS)

        for i, item in enumerate(pref.scripts):
            description, filename = item
            pos = description.find('\t')
            if pos > -1:
                shortcut = description[pos + 1:]
                description = description[:pos]
            else:
                shortcut = ''
            self.list.addline([description, filename, shortcut])

        box.Add(self.list, 1, wx.EXPAND | wx.ALL, 5)
        box2 = wx.BoxSizer(wx.HORIZONTAL)
        self.ID_UP = wx.NewId()
        self.ID_DOWN = wx.NewId()
        self.ID_ADD = wx.NewId()
        self.ID_EDIT = wx.NewId()
        self.ID_REMOVE = wx.NewId()
        self.btnUp = wx.Button(self, self.ID_UP, tr("Up"))
        box2.Add(self.btnUp, 0, 0, 5)
        self.btnDown = wx.Button(self, self.ID_DOWN, tr("Down"))
        box2.Add(self.btnDown, 0, 0, 5)
        self.btnAdd = wx.Button(self, self.ID_ADD, tr("Add"))
        box2.Add(self.btnAdd, 0, 0, 5)
        self.btnEdit = wx.Button(self, self.ID_EDIT, tr("Edit"))
        box2.Add(self.btnEdit, 0, 0, 5)
        self.btnRemove = wx.Button(self, self.ID_REMOVE, tr("Remove"))
        box2.Add(self.btnRemove, 0, 0, 5)
        self.btnOK = wx.Button(self, wx.ID_OK, tr("OK"))
        self.btnOK.SetDefault()
        box2.Add(self.btnOK, 0, 0, 5)
        self.btnCancel = wx.Button(self, wx.ID_CANCEL, tr("Cancel"))
        box2.Add(self.btnCancel, 0, 0, 5)
        box.Add(box2, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        wx.EVT_BUTTON(self.btnUp, self.ID_UP, self.OnUp)
        wx.EVT_BUTTON(self.btnDown, self.ID_DOWN, self.OnDown)
        wx.EVT_BUTTON(self.btnAdd, self.ID_ADD, self.OnAdd)
        wx.EVT_BUTTON(self.btnEdit, self.ID_EDIT, self.OnEdit)
        wx.EVT_BUTTON(self.btnRemove, self.ID_REMOVE, self.OnRemove)
        wx.EVT_BUTTON(self.btnOK, wx.ID_OK, self.OnOK)
        wx.EVT_LIST_ITEM_ACTIVATED(self.list, self.list.GetId(), self.OnEdit)
        wx.EVT_UPDATE_UI(self.btnEdit, self.ID_EDIT, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.btnUp, self.ID_UP, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.btnDown, self.ID_DOWN, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.btnRemove, self.ID_REMOVE, self.OnUpdateUI)

        self.SetSizer(box)
        self.SetAutoLayout(True)
Ejemplo n.º 13
0
    def __init__(self, parent):
        self.parent = parent
        wx.Panel.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)

        self.fileinfos = {}

        #add filenames ctrl
        self.filenames = CheckList.CheckList(
            self,
            columns=[
                (tr("Directory"), 200, 'left'),
                (tr("Source Filenames"), 350, 'left'),
                (tr("Results"), 300, 'left'),
            ],
            style=wx.LC_REPORT | wx.SUNKEN_BORDER)

        sizer.Add(self.filenames, 1, wx.ALL | wx.EXPAND, 2)

        box1 = wx.BoxSizer(wx.HORIZONTAL)
        self.ID_ADDFILES = wx.NewId()
        self.addfile = wx.Button(self, self.ID_ADDFILES, tr("Add Files"))
        box1.Add(self.addfile, 0, wx.ALL, 2)

        self.ID_REMOVEFILES = wx.NewId()
        self.removefile = wx.Button(self, self.ID_REMOVEFILES,
                                    tr("Remove Files"))
        box1.Add(self.removefile, 0, wx.ALL, 2)

        self.ID_CLEAR = wx.NewId()
        self.clear = wx.Button(self, self.ID_CLEAR, tr("Clear Results"))
        box1.Add(self.clear, 0, wx.ALL, 2)

        self.chk_all = wx.CheckBox(self, -1, tr("Select All"))
        box1.Add(self.chk_all, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.chk_select = wx.CheckBox(self, -1, tr("Select"))
        box1.Add(self.chk_select, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.chk_remainsufix = wx.CheckBox(self, -1,
                                           tr('Skip filename suffix'))
        self.chk_remainsufix.SetValue(True)
        box1.Add(self.chk_remainsufix, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        box1.AddStretchSpacer()

        self.ID_APPLY = wx.NewId()
        self.apply = wx.Button(self, self.ID_APPLY, tr("Apply"))
        box1.Add(self.apply, 0, wx.ALL | wx.ALIGN_RIGHT, 2)

        sizer.Add(box1, 0, wx.EXPAND)

        box2 = wx.BoxSizer(wx.HORIZONTAL)
        box2.Add(wx.StaticText(self, -1,
                               tr("Template") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.text = wx.TextCtrl(self, -1, "", size=(150, -1))
        box2.Add(self.text, 1, wx.ALL | wx.EXPAND, 2)

        box2.Add(wx.StaticText(self, -1,
                               tr("Start Num") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.startnum = wx.SpinCtrl(self,
                                    -1,
                                    "1",
                                    size=(40, -1),
                                    min=1,
                                    max=100,
                                    initial=1)
        box2.Add(self.startnum, 0, wx.ALL, 2)

        self.ID_CREATE = wx.NewId()
        self.create = wx.Button(self, self.ID_CREATE, tr("Create"))
        box2.Add(self.create, 0, wx.ALL, 2)

        sizer.Add(box2, 0, wx.EXPAND)

        box3 = wx.BoxSizer(wx.HORIZONTAL)
        box3.Add(wx.StaticText(self, -1,
                               tr("Current Result") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.result = wx.TextCtrl(self, -1, "", size=(150, -1))
        box3.Add(self.result, 1, wx.ALL | wx.EXPAND, 2)

        self.ID_UPDATE = wx.NewId()
        self.update = wx.Button(self, self.ID_UPDATE, tr("Update"))
        box3.Add(self.update, 0, wx.ALL, 2)

        sizer.Add(box3, 0, wx.EXPAND)

        box4 = wx.StaticBoxSizer(wx.StaticBox(self, -1, tr("Group Mode")),
                                 wx.HORIZONTAL)
        box4.Add(wx.StaticText(self, -1,
                               tr("Find") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.find = wx.TextCtrl(self, -1, "", size=(150, -1))
        box4.Add(self.find, 1, wx.ALL | wx.EXPAND, 2)

        box4.Add(wx.StaticText(self, -1,
                               tr("Replace") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.replace_text = wx.TextCtrl(self, -1, "", size=(150, -1))
        box4.Add(self.replace_text, 1, wx.ALL | wx.EXPAND, 2)

        self.chk_regular = wx.CheckBox(self, -1, tr('Regular Mode'))
        self.chk_regular.SetValue(False)
        box4.Add(self.chk_regular, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.chk_cursor = wx.CheckBox(self, -1, tr('Start from cursor'))
        self.chk_cursor.SetValue(False)
        self.chk_cursor.SetToolTip(
            wx.ToolTip(
                tr('If you set this, the process will begin from \nthe cursor position of "Current Result" field'
                   )))
        box4.Add(self.chk_cursor, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.ID_DELETE = wx.NewId()
        self.delete = wx.Button(self, self.ID_DELETE, tr("Delete"))
        box4.Add(self.delete, 0, wx.ALL, 2)

        self.ID_REPLACE = wx.NewId()
        self.replace = wx.Button(self, self.ID_REPLACE, tr("Replace"))
        box4.Add(self.replace, 0, wx.ALL, 2)

        self.ID_INSERT = wx.NewId()
        self.insert = wx.Button(self, self.ID_INSERT, tr("Insert"))
        box4.Add(self.insert, 0, wx.ALL, 2)

        sizer.Add(box4, 0, wx.EXPAND | wx.ALL, 2)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)

        #bind event
        wx.EVT_BUTTON(self.addfile, self.ID_ADDFILES, self.OnAddFiles)
        wx.EVT_BUTTON(self.removefile, self.ID_REMOVEFILES, self.OnRemoveFiles)
        wx.EVT_BUTTON(self.clear, self.ID_CLEAR, self.OnClear)
        wx.EVT_BUTTON(self.create, self.ID_CREATE, self.OnCreate)
        wx.EVT_BUTTON(self.apply, self.ID_APPLY, self.OnApply)
        wx.EVT_BUTTON(self.update, self.ID_UPDATE, self.OnUpdate)
        wx.EVT_BUTTON(self.delete, self.ID_DELETE, self.OnDelete)
        wx.EVT_BUTTON(self.insert, self.ID_INSERT, self.OnInsert)
        wx.EVT_BUTTON(self.replace, self.ID_REPLACE, self.OnReplace)
        wx.EVT_CHECKBOX(self.chk_all, self.chk_all.GetId(), self.OnAll)
        wx.EVT_CHECKBOX(self.chk_select, self.chk_select.GetId(),
                        self.OnSelect)
        wx.EVT_LIST_ITEM_ACTIVATED(self.filenames, self.filenames.GetId(),
                                   self.OnEnterItem)
        wx.EVT_LIST_ITEM_SELECTED(self.filenames, self.filenames.GetId(),
                                  self.OnSelectItem)
        wx.EVT_UPDATE_UI(self.removefile, self.ID_REMOVEFILES, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.chk_select, self.chk_select.GetId(),
                         self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.update, self.ID_UPDATE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.result, self.result.GetId(), self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.find, self.find.GetId(), self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.replace_text, self.replace_text.GetId(),
                         self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.delete, self.ID_DELETE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.replace, self.ID_REPLACE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.insert, self.ID_INSERT, self.OnUpdateUI)