Exemplo 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)
Exemplo 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)
Exemplo n.º 3
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()
Exemplo n.º 4
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)
Exemplo n.º 5
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()
Exemplo n.º 6
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)
Exemplo n.º 7
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)