示例#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)
示例#2
0
    def _create(self, replace):
        from modules.wxctrl import FlatButtons

        self.sizer = sizer = ui.HBox(
            padding=0, namebinding='widget').create(self).auto_layout()

        box1 = ui.HBox(2)
        sizer.add(box1, proportion=0, flag=0)
        btn = FlatButtons.FlatBitmapButton(
            self, -1, common.getpngimage('images/closewin.gif'))
        btn.SetToolTip(wx.ToolTip(tr("Close")))
        box1.add(btn).bind('click', self.OnClose)
        self.btnToggleReplace = btn = FlatButtons.FlatBitmapButton(
            self, -1, common.getpngimage('images/replace.gif'))
        btn.SetToolTip(wx.ToolTip(tr("Show Replace Pane")))
        box1.add(btn).bind('click', self.OnOpenReplace)

        box2 = ui.VBox(0)
        sizer.add(box2, name='box2')

        box = ui.HBox(2)
        box2.add(box)

        #add find widgets

        box.add(ui.ComboBox, name='findtext').bind('enter', self.OnNext1)\
            .bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        btn = FlatButtons.FlatBitmapButton(
            self, -1, common.getpngimage('images/next.gif'))
        btn.SetToolTip(wx.ToolTip(tr("Next")))
        box.add(btn, name='btn_next').bind('click', self.OnNext)
        btn = FlatButtons.FlatBitmapButton(
            self, -1, common.getpngimage('images/prev.gif'))
        btn.SetToolTip(wx.ToolTip(tr("Prev")))
        box.add(btn).bind('click', self.OnPrev)
        box.add(ui.Check(False, tr("Match case")), name="chkCase")
        box.add(ui.Check(False, tr("Whole word")), name="chkWhole")
        box.add(ui.Check(False, tr("Regular expression")), name="chkRe")
        box.add(ui.Check(False, tr("Wrap search")), name="chkWrap")

        #add replace widgets
        if replace:
            self._create_replace()
            self.btnToggleReplace.SetToolTip(
                wx.ToolTip(tr("Hide Replace Pane")))

        # last_controls tracks the control / controls that are last in
        # navigation.
        self.last_controls = []
        self._navigation_hack()
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
        }),
    ])
示例#4
0
    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)
示例#5
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        self.sizer = sizer = ui.VBox(
            padding=0, namebinding='widget').create(self).auto_layout()
        box = sizer.add(ui.HBox(padding=2))
        self.btnRefresh = FlatButtons.FlatBitmapButton(
            self, -1, common.getpngimage('images/classbrowserrefresh.gif'))
        box.add(self.btnRefresh)
        self.code = TextEditor(self, None, 'canvas test', 'texteditor', True)
        self.code.cansavefileflag = False
        self.code.needcheckfile = False
        self.code.savesession = False
        sizer.add(self.code, proportion=1, flag=wx.EXPAND | wx.ALL, border=3)
        sizer.auto_fit(0)
示例#6
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()
示例#7
0
    def __init__(self, parent, id=-1, treewidth=150):
        wx.Panel.__init__(self, parent, id, size=wx.DefaultSize)

        self._id = 0
        self.last = None

        self.sizer = sizer = ui.HBox(
            namebinding='widget').create(self).auto_layout()
        sizer.add(ui.Tree(size=(treewidth, -1),
                          style=wx.TR_HAS_BUTTONS
                          | wx.TR_LINES_AT_ROOT
                          | wx.TR_HIDE_ROOT),
                  name='tree',
                  flag=wx.EXPAND | wx.ALL)

        self.panels = sizer.add(ui.VBox)

        sizer.auto_fit(0)

        self.init()