from os.path import join, abspath, normcase, basename, isdir, getsize
from heapq import nlargest
from os.path import join, abspath, normcase, basename, isdir, getsize
from heapq import nlargest
#==============================================================================
class Control(object):
def __init__(self, ui, config):
#==============================================================================
class Control(object):
def __init__(self, ui, config):
- if ui == 'cli':
- self.present = Cli_Presentation(config)
- elif ui == 'gtk':
- self.present = Gtk_Presentation(config, self.start_search)
- elif ui == 'hildon':
- self.present = Hildon_Presentation(config, self.start_search)
-
- # self.present - for updating windows in interactive presentations
- self.abstrac = Abstraction(config, self.present)
+ self.present = eval(ui + '_Presentation(config, self.start_search)')
+ self.abstrac = Abstraction(self.config, self.present)
#==============================================================================
class Cli_Presentation(object):
#==============================================================================
class Cli_Presentation(object):
- def __init__(self, config):
+ def __init__(self, config, start_func):
+ self.start_func = start_func
+
self.outtype = config['outtype']
self.start_path = config['start_path']
self.count = config['count']
self.outtype = config['outtype']
self.start_path = config['start_path']
self.count = config['count']
- def start_search(self, start_func):
- start_func(self.get_data, self.get_stopit)
+ def run(self):
+ self.start_func(self.get_data, self.get_stopit)
self.stop_btn.set_sensitive(False)
self.stop_btn.connect('clicked', self.stop_btn_clicked)
# Output selection
self.stop_btn.set_sensitive(False)
self.stop_btn.connect('clicked', self.stop_btn_clicked)
# Output selection
- self.outtable_rbtn = gtk.RadioButton(None, 'Table')
- self.outtable_rbtn.set_name('outtable')
- outdiagram_rbtn = gtk.RadioButton(self.outtable_rbtn, 'Diagram')
+ outtable_rbtn = gtk.RadioButton(None, _('Table'))
+ outtable_rbtn.set_name('outtable')
+ outdiagram_rbtn = gtk.RadioButton(outtable_rbtn, _('Diagram'))
- out2_rbtn = gtk.RadioButton(self.outtable_rbtn, 'Another 2')
- out2_rbtn.set_name('outanother2')
- out_rbtns = [self.outtable_rbtn, outdiagram_rbtn, out1_rbtn, out2_rbtn]
+ self.out_rbtns = [outtable_rbtn, outdiagram_rbtn, out1_rbtn]
hbox = gtk.HBox(False, 4)
hbox.pack_start(qty_label, False, False, 0)
hbox.pack_start(self.qty_spin, False, False, 0)
hbox.pack_start(self.start_btn, False, False, 0)
hbox.pack_start(self.stop_btn, False, False, 0)
hbox = gtk.HBox(False, 4)
hbox.pack_start(qty_label, False, False, 0)
hbox.pack_start(self.qty_spin, False, False, 0)
hbox.pack_start(self.start_btn, False, False, 0)
hbox.pack_start(self.stop_btn, False, False, 0)
hbox.pack_end(btn, False, False, 0)
# Activate radio button
if btn.get_name() == self.config['outtype']:
hbox.pack_end(btn, False, False, 0)
# Activate radio button
if btn.get_name() == self.config['outtype']:
out_submodule = __import__('files.' + outtype, None, None, outtype)
try:
out_submodule = __import__('files.' + outtype, None, None, outtype)
try:
- out_toplevel = out_submodule.Gtk_Presentation(results).toplevel
- self.current_outtoplevel = out_toplevel
- self.vbox.add(out_toplevel)
- out_toplevel.show_all()
-# out_submodule.Gtk_Presentation().show_results(results)
+ self.out_toplevel = out_submodule.Gtk_Presentation(results).toplevel
+ self.vbox.add(self.out_toplevel)
+ self.out_toplevel.show_all()
+### out_submodule.Gtk_Presentation().show_results(results)
+
+#==============================================================================
+
+class Hildon_Presentation(object):
+
+ def __init__(self, config, start_func):
+ import gtk
+ import hildon
+
+ self.config = config
+
+ def run(self):
+ pass