Beispiel #1
0
    def __init__(self, parent, pref, dirs=''):
        self.parent = parent
        wx.Panel.__init__(self, parent, -1)

        self.pref = Globals.pref
        self.mainframe = Globals.mainframe
        self.running = 0
        self.stopping = 0
        self.starting = 0

        self.box = box = ui.VBox()
        box.add(
            ui.Label(
                tr("Multiple directories or extensions should be separated by semicolons ';'"
                   )))
        h = ui.HBox()
        h.add(ui.Label(tr("Search for:")))
        h.add(ui.ComboBox(Globals.mainframe.document.GetSelectedText(), choices=self.pref.searchinfile_searchlist), name='search')\
            .bind('enter', self.OnKeyDown)
        h.add(ui.Label(tr("Directories:")))
        h.add(ui.ComboBox(dirs, choices=self.pref.searchinfile_dirlist), name='sdirs')\
            .bind('enter', self.OnKeyDown)
        h.add(ui.Button('...', size=(22, -1)),
              name='btnBrow').bind('click', self.OnDirButtonClick)
        box.add(h, flag=wx.EXPAND)
        h = ui.HBox()
        h.add(ui.Label(tr("Extensions:")))
        if not self.pref.searchinfile_extlist:
            v = '*.*'
        else:
            v = self.pref.searchinfile_extlist[0]
        h.add(ui.ComboBox(v, choices=self.pref.searchinfile_extlist), name='extns')\
            .bind('enter', self.OnKeyDown)
        h.add(ui.Check(self.pref.searchinfile_case, tr("Case sensitive")),
              name='cs')
        h.add(ui.Check(self.pref.searchinfile_subdir,
                       tr("Search subdirectories")),
              name='ss')
        h.add(ui.Check(self.pref.searchinfile_regular,
                       tr("Regular expression")),
              name='re')
        h.add(ui.Check(self.pref.searchinfile_onlyfilename,
                       tr("Only show filename")),
              name='onlyfilename')
        box.add(h, flag=wx.EXPAND)
        box.add(ui.ListBox, name='results').bind(wx.EVT_LISTBOX_DCLICK,
                                                 self.OpenFound)
        h = ui.HBox()
        h.add(ui.Label(tr('Status:')))
        h.add(ui.Text(tr("Ready.")), name='status')
        h.add(ui.Button(tr("Start Search")),
              name='btnRun').bind('click', self.OnFindButtonClick)
        h.add(ui.Button(tr("CopyClipboard"))).bind('click',
                                                   self.OnCopyButtonClick)
        box.add(h, flag=wx.EXPAND)

        ui.create(self, box, namebinding='widget')

        self.status.Enable(False)
Beispiel #2
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           size=(400, 340),
                           style=wx.DEFAULT_DIALOG_STYLE,
                           title=tr('About'))

        #        self.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False))
        #
        box = ui.VBox(padding=6,
                      namebinding='widget').create(self).auto_layout()
        box.add(ui.Label(tr('UliPad %s') % Version.version),
                name='version',
                flag=wx.ALIGN_CENTER | wx.ALL)
        font = self.version.GetFont()
        font.SetPointSize(20)
        self.version.SetFont(font)
        box.add(ui.Label(tr('Author: %s (%s)') % (author, email)))
        box.add(ui.Label(tr('If you have any questions, please contact me.')))

        self.ID_HOMEPAGE = wx.NewId()
        self.homepage = HyperLinkCtrl(self,
                                      self.ID_HOMEPAGE,
                                      "The UliPad project homepage",
                                      URL=homepage)
        box.add(self.homepage).bind(EVT_HYPERLINK_LEFT, self.OnLink)

        self.ID_MAILLIST = wx.NewId()
        self.maillist = HyperLinkCtrl(self,
                                      self.ID_MAILLIST,
                                      "The UliPad maillist",
                                      URL=maillist)
        box.add(self.maillist).bind(EVT_HYPERLINK_LEFT, self.OnLink)

        self.ID_ULISPOT = wx.NewId()
        self.ulispot = HyperLinkCtrl(self,
                                     self.ID_ULISPOT,
                                     "The UliPad Snippets Site",
                                     URL=ulispot)
        box.add(self.ulispot).bind(EVT_HYPERLINK_LEFT, self.OnLink)

        self.ID_BLOG = wx.NewId()
        self.blog = HyperLinkCtrl(self, self.ID_BLOG, "My Blog", URL=blog)
        box.add(self.blog)

        self.ID_EMAIL = wx.NewId()
        self.email = HyperLinkCtrl(self,
                                   self.ID_EMAIL,
                                   "Contact me",
                                   URL='mailto:' + email)
        box.add(self.email)

        box.add(ui.Button(tr("OK"), id=wx.ID_OK),
                name='btnOk',
                flag=wx.ALIGN_RIGHT | wx.ALL,
                border=10)
        self.btnOk.SetDefault()

        box.auto_fit(2)
    def __init__(self, parent, version):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           size=(400, 340),
                           style=wx.DEFAULT_DIALOG_STYLE,
                           title=tr('Check Update'))

        box = ui.VBox(padding=6,
                      namebinding='widget').create(self).auto_layout()
        h = box.add(ui.HBox)
        h.add(ui.Label(tr('There is new version %s of UliPad.') % version))

        self.ID_HOMEPAGE = wx.NewId()
        self.homepage = HyperLinkCtrl(self,
                                      self.ID_HOMEPAGE,
                                      tr("Goto Download page"),
                                      URL=self.homepage)
        h.add(self.homepage).bind(EVT_HYPERLINK_LEFT, self.OnDownload)

        box.add(ui.Check(Globals.pref.check_update,
                         tr("Check for updates at startup")),
                name='chkCheck').bind('check', self.OnCheck)

        box.add(ui.Button(tr("OK"), id=wx.ID_OK),
                name='btnOk',
                flag=wx.ALIGN_CENTER | wx.ALL,
                border=10)
        self.btnOk.SetDefault()

        box.auto_fit(2)
Beispiel #4
0
    def _create_replace(self):
        if 'replace_sizer' not in self.sizer:
            box = ui.HBox(2)
            box2 = self.sizer.find('box2')
            box2.add(box, name='replace_sizer')

            box.add(ui.ComboBox, name='replacetext').bind('enter', self.OnReplace1)\
                .bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
            box.add(ui.Button(tr('Replace')),
                    name='replace_btn').bind('click', self.OnReplace)
            box.add(ui.Button(tr('Replace all'))).bind('click',
                                                       self.OnReplaceAll)
            box.add(ui.Button(tr('Count'))).bind('click', self.OnCount)
            box.add(ui.Radio(False, tr('Whole file'), style=wx.RB_GROUP),
                    name='rdoWhole')
            box.add(ui.Radio(False, tr('Selected text')), name='rdoSelection')
            self.parent.sizer.layout()
    def __init__(self, parent):
        self.parent = parent
        wx.Panel.__init__(self, parent, -1)
        
        self.pref = Globals.pref

        self.sizer = sizer = ui.VBox(padding=0, namebinding='widget').create(self).auto_layout()
        h = sizer.add(ui.HBox)
        h.add(ui.Label(tr("Replace with") + ':'))
        h.add(ui.Text('', size=(150, -1)), name='text')
        h.add(ui.Button(tr('Start')), name='btnRun').bind('click', self.OnRun)
        h.add(ui.Button(tr('Replace')), name='btnReplace').bind('click', self.OnReplace)
        h.add(ui.Button(tr('Replace All')), name='btnReplaceAll').bind('click', self.OnReplaceAll)
        h.add(ui.Button(tr('Ignore')), name='btnIgnore').bind('click', self.OnIgnore)
        h.add(ui.Button(tr('Ignore All')), name='btnIgnoreAll').bind('click', self.OnIgnoreAll)
        h.add(ui.Button(tr('Add')), name='btnAdd').bind('click', self.OnAdd)

        h = sizer.add(ui.HBox, proportion=1)
        h.add(ui.Label(tr("Suggest") + ':'))
        h.add(ui.ListBox(size=(250, -1)), name='list').binds(
                (wx.EVT_LISTBOX, self._OnReplSelect),
                (wx.EVT_LISTBOX_DCLICK, self.OnReplace),
            )
        h.add(ui.Label(tr("Available Dict") + ':'))
        h.add(ui.ListBox(size=(100, -1), choices=enchant.list_languages()), name='dict_list').bind(
            wx.EVT_LISTBOX, self.OnDictSelect
            )

        sizer.auto_fit(0)

        self.init()

        self._DisableButtons()
Beispiel #6
0
    def init(self):
        mainframe = Globals.mainframe
        self.pref = Globals.pref

        self.sizer = box = ui.Grid(
            growablecol=1, namebinding='widget').create(self).auto_layout()
        box1 = box.add((0, 0), ui.VBox)
        box1.add(ui.Label(tr('FTP sites:')))
        box1.add(ui.ListBox, name='listbox').bind(wx.EVT_LISTBOX,
                                                  self.OnFtpSelected)
        box1.add(ui.Check(True, tr('Passive FTP')), name='chkPass')
        box2 = box.add((0, 1), ui.SimpleGrid)
        box2.add(tr('Site name:'), ui.Text, name='txtName')
        box2.add(tr('Host IP:'), ui.Text, name='txtHost')
        box2.add(tr('Port:'), ui.IntSpin(21, min=0, max=65535), name='txtPort')
        box2.add(tr('Username:'******'txtUsername')
        box2.add(tr('Password:'******'txtPassword')
        box2.add(tr('Remote path:'), ui.Text, name='txtPath')
        box3 = box.add((0, 2), ui.VBox)
        box3.add(ui.Button(tr('Add')), name='btnAdd').bind('click', self.OnAdd)
        box3.add(ui.Button(tr('Delete')),
                 name='btnDelete').bind('click', self.OnDelete)
        box3.add(ui.Button(tr('Update')),
                 name='btnUpdate').bind('click', self.OnUpdate)
        box3.add(ui.Button(tr('Close'), id=wx.ID_CANCEL,
                           name='btnClose')).bind(wx.EVT_CLOSE,
                                                  self.OnClose).bind(
                                                      'click', self.OnClose)

        self.lastindex = self.pref.last_ftp_site
        self.load()

        box.bind('btnDelete', wx.EVT_UPDATE_UI, self.OnUpdateUI)
        box.bind('btnUpdate', wx.EVT_UPDATE_UI, self.OnUpdateUI)
        box.bind('btnAdd', wx.EVT_UPDATE_UI, self.OnUpdateUI)

        box.auto_fit(2)
    def addItem(self, page, kind, prefname, prefvalue, message, extern):
        #        if self.execplugin("additem", self, page, kind, prefname, prefvalue, message, extern):
        #            return
        #
        obj = None
        label = message
        kwargs = None
        if not isinstance(kind, str):
            obj = kind
            kwargs = extern
        else:
            if kind == 'check':
                obj = ui.Check(prefvalue, label=message)
                label = ''
#            elif kind == 'num':
#                obj = ui.IntSpin(prefvalue, max=100000, min=1, size=(60, -1))
            elif kind in ('num', 'int'):
                obj = ui.Int(prefvalue)
            elif kind == 'choice':
                obj = ui.SingleChoice(prefvalue, choices=extern)
            elif kind == 'text':
                obj = ui.Text(prefvalue)
            elif kind == 'password':
                obj = ui.Password(prefvalue)
            elif kind == 'openfile':
                obj = ui.OpenFile(prefvalue)
            elif kind == 'opendir':
                obj = ui.Dir(prefvalue)
            elif kind == 'button':
                label = ''
                func = getattr(self, extern)
                obj = ui.Button(message).bind('click', func)

        if not kwargs:
            if isinstance(extern, dict):
                span = extern.get('span', True)
            else:
                if label:
                    span = False
                else:
                    span = True
            page.box.add(label, obj, name=prefname, span=span)
        else:
            page.box.add(label, obj, name=prefname, **kwargs)
Beispiel #8
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)
Beispiel #9
0
    def __init__(self, parent, mainframe):
        self.initmixin()
        self.parent = parent
        self.mainframe = mainframe
        self.pref = self.mainframe.pref
        wx.Panel.__init__(self, parent, -1)

        self.alive = False
        self.running = False

        self.box = box = ui.VBox(
            namebinding='widget').create(self).auto_layout()
        box1 = box.add(ui.HBox)
        box1.add(ui.Label(tr('Sites:')))
        box1.add(ui.ComboBox("", self.mainframe.pref.ftp_sites),
                 name='cmbSite').bind(wx.EVT_COMBOBOX, self.OnSiteChanged)
        box1.add(ui.Label(tr('Username:'******'', size=(100, -1)), name='txtUser')
        box1.add(ui.Label(tr('Password:'******'', size=(100, -1)), name='txtPassword')
        box1.add(ui.Button(tr('Connect')),
                 name='btnConnect').bind('click', self.OnConnect)
        box1.add(ui.Button(tr('Disconnect')),
                 name='btnDisconnect').bind('click', self.OnDisconnect)

        box.add(ui.List(columns=[
            (tr("Name"), 500, 'left'),
            (tr("Size"), 80, 'right'),
            (tr("Format"), 80, 'left'),
        ],
                        style=wx.LC_REPORT | wx.SUNKEN_BORDER
                        | wx.LC_SINGLE_SEL),
                name='list')

        box2 = box.add(ui.HBox)
        box2.add(ui.Label(tr('Encoding:')))
        box2.add(ui.ComboBox("Default", ['Default', 'UTF-8', 'Custom'],
                             size=(100, -1)),
                 name='txtEncoding')
        box2.add(ui.Label(tr('Remote path:')))
        box2.add(ui.ComboBox("", self.mainframe.pref.remote_paths),
                 name='txtPath')
        box2.add(ui.Button(tr('Refresh')),
                 name='btnRefresh').bind('click', self.OnRefresh)
        box2.add(ui.Button(tr('Set FTP site...')),
                 name='btnSite').bind('click', self.OnSite)

        self.load()
        self.initlist()

        box.bind('btnConnect', wx.EVT_UPDATE_UI, self.OnUpdateUI)
        box.bind('btnDisconnect', wx.EVT_UPDATE_UI, self.OnUpdateUI)
        box.bind('btnRefresh', wx.EVT_UPDATE_UI, self.OnUpdateUI)
        box.bind('btnSite', wx.EVT_UPDATE_UI, self.OnUpdateUI)
        box.bind('list', wx.EVT_LIST_ITEM_ACTIVATED, self.OnEnter)

        #@add_menu menulist
        self.callplugin_once('add_menu', Ftp.popmenulist)
        #make popup menu
        if self.popmenulist:
            self.popmenu = makemenu.makepopmenu(self, self.popmenulist,
                                                self.imagelist)
            wx.EVT_LIST_ITEM_RIGHT_CLICK(self.list, self.list.GetId(),
                                         self.OnRClick)
            wx.EVT_RIGHT_UP(self.list, self.OnRClick)