def __init__(self, title=tr('Wrap Text'), values=None): wx.Dialog.__init__(self, Globals.mainframe, -1, style=wx.DEFAULT_DIALOG_STYLE, title=title, size=(600, 300)) self.sizer = box = ui.VBox( namebinding='widget').create(self).auto_layout() grid = box.add(ui.SimpleGrid) grid.add(tr('Width'), ui.Int(75), name='width') grid.add(tr('Indent'), ui.Text(''), name='indent') grid.add(tr('First Line Indent'), ui.Text(''), name='firstindent') grid.add(tr('Skip Beginning Characters'), ui.Text(''), name='skipchar') grid.add(tr('Remove Tailing Characters'), ui.Text(''), name='remove_tailingchar') grid.add(tr('Add Tailing Characters'), ui.Text(''), name='add_tailingchar') box.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER | wx.BOTTOM) box.auto_fit(2) if values: box.SetValue(values)
def add_pref(preflist): def _get(name): def _f(name=name): from modules import Globals return getattr(Globals.pref, name) return _f from modules import meide as ui box = ui.VGroup(tr('Network')) grid = ui.SimpleGrid() grid.add('', ui.Check(_get('use_proxy'), tr('Use a proxy')), name='use_proxy', span=True) grid.add(tr('IP address:'), ui.Text(_get('proxy')), name='proxy') grid.add(tr('Port number:'), ui.Int(_get('proxy_port')), name='proxy_port') grid.add(tr('Username:'******'proxy_user')), name='proxy_user') grid.add(tr('Password:'******'proxy_password')), name='proxy_password') box.add(grid) # preflist.extend([ # (tr('Network'), 100, 'check', 'use_proxy', tr('Use proxy'), None), # (tr('Network'), 110, 'text', 'proxy', tr('Proxy URL:'), None), # (tr('Network'), 120, 'text', 'proxy_user', tr('Proxy User:'******'Network'), 130, 'password', 'proxy_password', tr('Proxy Password:'******'Network'), 100, box, '', '', { 'span': True }), ])
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()
def __init__(self, parent, title, defaultvalue, defaultchkvalue): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE, title=title) self.pref = Globals.pref self.sizer = sizer = ui.VBox( namebinding='widget').create(self).auto_layout() box = sizer.add(ui.VGroup(tr('Lua interpreter'))) h = box.add(ui.HBox()) h.add(ui.Label(tr('Select:'))) interpreters = dict(self.pref.lua_interpreter) default_lua_interpreter = self.pref.default_lua_interpreter if not default_lua_interpreter in interpreters: default_lua_interpreter = self.pref.default_lua_interpreter[0][0] h.add(ui.SingleChoice(default_lua_interpreter, sorted(interpreters.keys())), name='interpreter').bind(wx.EVT_COMBOBOX, self.OnChanged) h.add(ui.Label(tr('Parameters:'))) h.add(ui.Text( self.pref.lua_default_paramters.get(default_lua_interpreter, '')), name='parameter') h = self.sizer.add(ui.HBox()) h.add(ui.Label(tr('Parameters of script:'))) h.add(ui.Text(defaultvalue), name='command_line').tooltip( "$file will be replaced with the filename of the current document\n" "$path will be replaced with the filename's directory of the current document" ) self.sizer.add(ui.Check(defaultchkvalue, tr('Redirect input and output')), name='redirect') self.sizer.add(ui.Check( self.pref.lua_show_args, tr('Show the Select Arguments dialog at Lua program run')), name='show_args') sizer.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER | wx.BOTTOM) self.sizer.bind('btnOk', 'click', self.OnOK) self.btnOk.SetDefault() sizer.auto_fit(1)
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)
def __init__(self, parent, realm, info_list, may_save): wx.Dialog.__init__( self, parent, -1, tr('Trust server %s') % realm ) self.sizer = sizer = ui.VBox(namebinding='widget').create(self).auto_layout() box = sizer.add(ui.VGroup(tr('Server Certificate'))) box1 = box.add(ui.SimpleGrid) for key, value in info_list: box1.add(key, ui.Text(value, style=wx.TE_READONLY)) sizer.add(ui.Check(may_save, tr("Always trust this server")), name='save') sizer.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER|wx.BOTTOM) sizer.auto_fit(1) self.CentreOnParent()
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)
def __init__(self, parent, ftpname, user, password): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE, title=tr("FTP site: %s") % ftpname, size=(200, 50)) self.sizer = box = ui.SimpleGrid( namebinding='widget').create(self).auto_layout() box.add(tr('Username:'******'txtUser') box.add(tr('Password:'******'txtPassword') box.add('', ui.simple_buttons(), flag=wx.ALIGN_CENTER | wx.BOTTOM, span=True) self.btnOk.SetDefault() box.auto_fit(2) box.bind('btnOk', wx.EVT_UPDATE_UI, self.OnUpdateUI)
def __init__(self, title=tr('Checkout'), size=(450, -1)): wx.Dialog.__init__(self, Globals.mainframe, -1, title=title, size=size) self.pref = Globals.pref self.sizer = sizer = ui.VBox( namebinding='widget').create(self).auto_layout() box = sizer.add(ui.VGroup(tr('Repository'))) box.add(ui.Label(tr('URL of repository:'))) box.add(ui.ComboBox('', self.pref.svn_urls), name='url') box.add(ui.Label(tr('Checkout Directory'))) box.add(ui.Dir(self.pref.svn_checkout_folder), name='dir') box = sizer.add(ui.VGroup(tr('Revision'))) box1 = box.add(ui.HBox) box1.add(ui.Check(False, tr('Revision'), name='chk_revision')).bind('check', self.OnCheck) box1.add(ui.Text('', size=(80, -1)), name='revision').get_widget().Disable() sizer.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER | wx.BOTTOM) sizer.bind('btnOk', 'click', self.OnOk) self.btnOk.SetDefault() sizer.auto_fit(1)
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)