From db551a71d961151cfed1e4f532c26ffaace54728 Mon Sep 17 00:00:00 2001 From: Eugene Gagarin Date: Wed, 20 May 2009 17:21:11 +0400 Subject: [PATCH] Moved filessearch parameters from main to files.search --- src/files/search.py | 20 ++++++++++++-------- src/main.py | 18 ++++-------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/files/search.py b/src/files/search.py index 6a85191..fc6feab 100755 --- a/src/files/search.py +++ b/src/files/search.py @@ -21,8 +21,8 @@ OUTTYPES = [ class Control(object): - def __init__(self, ui, params): - self.present = eval(ui + '_Presentation(self.start_search, params)') + def __init__(self, ui, outtype, params): + self.present = eval(ui + '_Presentation(self.start_search, outtype, params)') self.abstrac = Abstraction(self.present) self.toplevel = self.present.toplevel @@ -89,13 +89,17 @@ class Abstraction(object): #============================================================================== class Cli_Presentation(object): - def __init__(self, start_func, params): + def __init__(self, start_func, outtype, params): self.start_func = start_func - self.outtype = params['outtype'] - self.start_path = params['start_path'] - self.count = params['count'] - self.file_filter = params['file_filter'].split(';') + self.outtype = outtype + self.start_path = params[0] + self.count = params[1] + try: + self.file_filter = params[2].split(';') + except IndexError: + self.file_filter = '*.*' + self.stopit = False self.toplevel = None @@ -128,7 +132,7 @@ class Cli_Presentation(object): class Gtk_Presentation(object): - def __init__(self, start_func, __): + def __init__(self, start_func, *unused): import gtk global gtk # for show_current_status() from misc import NotebookWCloseBtns diff --git a/src/main.py b/src/main.py index e118510..2f65db1 100755 --- a/src/main.py +++ b/src/main.py @@ -59,19 +59,9 @@ class Cli_Presentation(object): parser.add_option('--license', action='callback', callback=self._license) (options, args) = parser.parse_args() - self.search = options.search - - self.options = {} - self.options['outtype'] = options.output - self.options['ignore_dirs'] = config['files']['ignore_dirs'] - - self.params = options.params.split() - self.options['start_path'] = self.params[0] - self.options['count'] = self.params[1] - try: - self.options['file_filter'] = self.params[2] - except IndexError: - self.options['file_filter'] = '*.*' + self.search = options.search + self.outtype = options.output + self.params = options.params.split() def _about(self, *a): print self.abstrac.comments @@ -83,7 +73,7 @@ class Cli_Presentation(object): def show_search_toplevel(self): search_module = __import__(self.search + '.search') - search_toplevel = search_module.search.Control('Cli', self.options).run() + search_toplevel = search_module.search.Control('Cli', self.outtype, self.params).run() def run(self): self.show_search_toplevel() -- 1.7.9.5