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 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, 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 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, 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)