def add_pref(preflist): def _get(name): def _f(name=name): from modules import Globals return getattr(Globals.pref, name) return _f mInputAssistant_ia.bind('check', _toggle) from modules import meide as ui box = ui.HBox() box.add(ui.Label( tr("Skip input assistance when typing rate faster than "))) box.add(ui.Int(_get('inputass_typing_rate'), size=(40, -1)), name='inputass_typing_rate') box.add(ui.Label(tr(" milliseconds"))) preflist.extend([ (tr('Input Assistant'), 100, mInputAssistant_ia, 'input_assistant', '', None), (tr('Input Assistant'), 110, mInputAssistant_s1, 'inputass_calltip', '', None), (tr('Input Assistant'), 120, mInputAssistant_s2, 'inputass_autocomplete', '', None), (tr('Input Assistant'), 130, mInputAssistant_s3, 'inputass_identifier', '', None), (tr('Input Assistant'), 140, mInputAssistant_s4, 'inputass_full_identifier', '', None), (tr('Input Assistant'), 150, mInputAssistant_s5, 'inputass_func_parameter_autocomplete', '', None), (tr('Input Assistant'), 160, box, '', '', { 'span': True }), ])
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): 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, 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, 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)
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, value, interpreters): box = ui.VBox(namebinding='element') box.add(ui.Label(tr('Which Lua interpreter do you want to use?'))) box.add(ui.ComboBox(value, choices=interpreters, style=wx.CB_READONLY), name='interpreter') super(SelectInterpreter, self).__init__(parent, box, title=tr('Lua Interpreters List'), fit=2) self.layout.SetFocus()
def __init__(self, parent, title=tr('SVN Settings'), size=(450, -1)): self.pref = Globals.pref try: v = self._get_info() except: raise wx.Dialog.__init__(self, parent, -1, title=title, size=size) self.sizer = sizer = ui.VBox( namebinding='widget').create(self).auto_layout() box = sizer.add(ui.SimpleGrid) box.add(tr('Global ignores'), ui.Text, name='svn_global_ignores')\ .tooltip(tr('Multiple ignores should be delimeted by space')) sizer.add(ui.Check(False, tr('Enable proxy server')), name='proxy')\ .bind('check', self.OnEnable) box = sizer.add(ui.VGroup(tr('Proxy settings'))) grid = box.add(ui.Grid(growablecol=1)) grid.add((0, 0), ui.Label(tr('Server Address') + ':')) grid.add((0, 1), ui.Text, name='server') grid.add((0, 2), ui.Label(tr('Port') + ':')) grid.add((0, 3), ui.Int(0, size=(40, -1)), name='port') grid.add((1, 0), ui.Label(tr('Username') + ':')) grid.add((1, 1), ui.Text, name='username') grid.add((2, 0), ui.Label(tr('Password') + ':')) grid.add((2, 1), ui.Password, name='password') grid.add((3, 0), ui.Label(tr('Proxy timeout in seconds') + ':')) grid.add((3, 1), ui.Int, name='timeout') sizer.add(ui.simple_buttons(), flag=wx.ALIGN_CENTER | wx.BOTTOM) sizer.bind('btnOk', 'click', self.OnOk) self.btnOk.SetDefault() sizer.auto_fit(1) sizer.SetValue(v) self.OnEnable(None)
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): 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 __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)