Example #1
0
    def _select_recentry_used_dirs(self, callback):
        files = []
        for p, info in kaa.app.config.hist('dirname').get():
            path = kaa.utils.shorten_filename(p)
            files.append(path if len(path) < len(p) else p)

        from kaa.ui.selectlist import filterlist
        filterlist.show_listdlg('Recently used directories:', files, callback)
Example #2
0
    def _select_recentry_used_dirs(self, callback):
        files = []
        for p, info in kaa.app.config.hist('dirname').get():
            path = kaa.utils.shorten_filename(p)
            files.append(path if len(path) < len(p) else p)

        from kaa.ui.selectlist import filterlist
        filterlist.show_listdlg('Recently used directories:',
                                files, callback)
Example #3
0
    def input_history(self, wnd):
        if not self.history:
            return

        def callback(result):
            if result:
                self.set_input_ext(wnd, result)

        filterlist.show_listdlg(self.caption, self.history, callback)
Example #4
0
    def _select_recentry_used_files(self, callback):
        files = []
        for p, info in kaa.app.config.hist('filename').get():
            path = os.path.relpath(p)
            files.append(path if len(path) < len(p) else p)

        from kaa.ui.selectlist import filterlist
        filterlist.show_listdlg('Recently used files:',
                                files, callback)
Example #5
0
    def input_history(self, wnd):
        if not self.history:
            return

        def callback(result):
            if result:
                self.set_input_ext(wnd, result)

        filterlist.show_listdlg(self.caption, self.history, callback)
Example #6
0
    def file_recently_used_dirs(self, wnd):

        def cb(filename):
            if filename:
                self.file_open(wnd, filename)

        files = []
        for p in kaa.app.config.hist_dirs.get():
            path = os.path.relpath(p)
            files.append(path if len(path) < len(p) else p)

        from kaa.ui.selectlist import filterlist
        filterlist.show_listdlg('Recently used directories', 
            files, cb)
Example #7
0
    def grep_history(self, wnd):
        searchfrom, searchto = wnd.document.marks['searchtext']
        dirfrom, dirto = wnd.document.marks['directory']
        filefrom, fileto = wnd.document.marks['filenames']

        if searchfrom <= wnd.cursor.pos <= searchto:
            def callback(result):
                if result:
                    f, t = wnd.document.marks['searchtext']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
       
            filterlist.show_listdlg('Recent searches', 
                kaa.app.config.hist_grepstr.get(), callback)

        elif dirfrom <= wnd.cursor.pos <= dirto:
            def callback(result):
                if result:
                    f, t = wnd.document.marks['directory']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
       
            filterlist.show_listdlg('Recent directories', 
                kaa.app.config.hist_grepdir.get(), callback)

        else:
            def callback(result):
                if result:
                    f, t = wnd.document.marks['filenames']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
                    
            filterlist.show_listdlg('Recent filenames', 
                kaa.app.config.hist_grepfiles.get(), callback)
Example #8
0
    def grep_history(self, wnd):
        searchfrom, searchto = wnd.document.marks['searchtext']
        dirfrom, dirto = wnd.document.marks['directory']
        filefrom, fileto = wnd.document.marks['filenames']

        if searchfrom <= wnd.cursor.pos <= searchto:
            def callback(result):
                if result:
                    f, t = wnd.document.marks['searchtext']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
                    f, t = wnd.document.marks['searchtext']
                    wnd.screen.selection.set_range(f, t)

            filterlist.show_listdlg('Recent searches',
                                    [s for s,
                                        info in kaa.app.config.hist('grep_text').get(
                                        )],
                                    callback)

        elif dirfrom <= wnd.cursor.pos <= dirto:
            def callback(result):
                if result:
                    f, t = wnd.document.marks['directory']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
                    f, t = wnd.document.marks['directory']
                    wnd.screen.selection.set_range(f, t)

            hist = []
            for p, info in kaa.app.config.hist('grep_dirname').get():
                path = kaa.utils.shorten_filename(p)
                hist.append(path if len(path) < len(p) else p)

            filterlist.show_listdlg('Recent directories',
                                    hist, callback)

        else:
            def callback(result):
                if result:
                    f, t = wnd.document.marks['filenames']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
                    f, t = wnd.document.marks['filenames']
                    wnd.screen.selection.set_range(f, t)

            filterlist.show_listdlg('Recent filenames',
                                    [s for s,
                                        info in kaa.app.config.hist('grep_filename').get(
                                        )],
                                    callback)
Example #9
0
    def grep_history(self, wnd):
        searchfrom, searchto = wnd.document.marks['searchtext']
        dirfrom, dirto = wnd.document.marks['directory']
        filefrom, fileto = wnd.document.marks['filenames']

        if searchfrom <= wnd.cursor.pos <= searchto:

            def callback(result):
                if result:
                    f, t = wnd.document.marks['searchtext']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
                    f, t = wnd.document.marks['searchtext']
                    wnd.screen.selection.set_range(f, t)

            filterlist.show_listdlg(
                'Recent searches',
                [s for s, info in kaa.app.config.hist('grep_text').get()],
                callback)

        elif dirfrom <= wnd.cursor.pos <= dirto:

            def callback(result):
                if result:
                    f, t = wnd.document.marks['directory']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
                    f, t = wnd.document.marks['directory']
                    wnd.screen.selection.set_range(f, t)

            hist = []
            for p, info in kaa.app.config.hist('grep_dirname').get():
                path = kaa.utils.shorten_filename(p)
                hist.append(path if len(path) < len(p) else p)

            filterlist.show_listdlg('Recent directories', hist, callback)

        else:

            def callback(result):
                if result:
                    f, t = wnd.document.marks['filenames']
                    wnd.document.replace(f, t, result)
                    wnd.cursor.setpos(f)
                    f, t = wnd.document.marks['filenames']
                    wnd.screen.selection.set_range(f, t)

            filterlist.show_listdlg(
                'Recent filenames',
                [s for s, info in kaa.app.config.hist('grep_filename').get()],
                callback)
Example #10
0
 def _show_histdlg(self, wnd, title, candidates, callback):
     filterlist.show_listdlg(title, candidates, callback)
Example #11
0
 def _show_histdlg(self, wnd, title, candidates, callback):
     filterlist.show_listdlg(title, candidates, callback)