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)
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)
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)
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)
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)
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)
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)
def _show_histdlg(self, wnd, title, candidates, callback): filterlist.show_listdlg(title, candidates, callback)