from heapq import nlargest
from misc import size_hum_read, _
+from config import config
#==============================================================================
class Control(object):
- def __init__(self, ui, config):
+ def __init__(self, ui):
if ui == 'cli':
- self.present = Cli_Presentation(config)
+ self.present = Cli_Presentation()
elif ui == 'gtk':
- self.present = Gtk_Presentation(config, self.start_search)
+ self.present = Gtk_Presentation(self.start_search)
elif ui == 'hildon':
- self.present = Hildon_Presentation(config, self.start_search)
+ self.present = Hildon_Presentation(self.start_search)
# self.present - for updating windows in interactive presentations
- self.abstrac = Abstraction(config, self.present)
+ self.abstrac = Abstraction(self.present)
# Used only in non-interactive presentations
self.present.start_search(self.start_search)
class Abstraction(object):
- def __init__(self, config, presentation):
- self.ignore_dirs = config['ignore_dirs']
+ def __init__(self, presentation):
+ self.ignore_dirs = config['files']['ignore_dirs']
self.presentation = presentation
def filegetter(self, startdir, get_stopit):
#==============================================================================
class Cli_Presentation(object):
- def __init__(self, config):
- self.outtype = config['outtype']
- self.start_path = config['start_path']
- self.count = config['count']
+ def __init__(self):
+ self.outtype = config['files']['outtype']
+ self.start_path = config['files']['start_path']
+ self.count = config['files']['count']
self.stopit = False
self.toplevel = None
class Gtk_Presentation(object):
- def __init__(self, config, start_func):
+ def __init__(self, start_func):
import gtk
- self.config = config
-
# "Start path" entry
self.path_entry = gtk.Entry()
- self.path_entry.set_text(self.config['start_path'])
+ self.path_entry.set_text(config['files']['start_path'])
# "Files quantity" label
qty_label = gtk.Label(_('Files quantity'))
self.qty_spin.set_numeric(True)
self.qty_spin.set_range(0, 65536)
self.qty_spin.set_increments(1, 10)
- self.qty_spin.set_value(self.config['count'])
+ self.qty_spin.set_value(config['files']['count'])
# "Start" button
self.start_btn = gtk.Button(_('Start'))
for btn in reversed(self.out_rbtns):
hbox.pack_end(btn, False, False, 0)
# Activate radio button
- if btn.get_name() == self.config['outtype']:
+ if btn.get_name() == config['outtype']:
btn.set_active(True)
self.statusbar = gtk.Statusbar()
gtk.main_iteration()
self.show_current_status = show_current_status
- self.show_out_toplevel(None, self.config['outtype'], [(1, 'path', 'bytesize')])
+ self.show_out_toplevel(None, config['outtype'], [(1, 'path', 'bytesize')])
#=== Functions ============================================================
def start_btn_released(self, btn, start_func):
class Hildon_Presentation(object):
- def __init__(self, config, start_func):
+ def __init__(self, start_func):
import gtk
import hildon
- self.config = config
-
def start_search(self, start_func):
pass