# -*-coding: utf-8 -*-
# vim: sw=4 ts=4 expandtab ai
+import gtk
+
+class Core_Control(object):
+ def __init__(self):
+ from config import Config_Control
+ self.cfg = Config_Control()
+
+ core_present = Core_Presentation(575, 345, self.chooser)
+ core_present.run()
+
+ def chooser(self, search_type, show_type):
+ if show_type is 'table_view':
+ from outtable import Out_Table_Control
+ out = Out_Table_Control(self.cfg)
+
+ if search_type is 'large_file':
+ from searchfile import Search_File_Control
+ elif search_type is 'large_pkg':
+ from pkgsearch import Search_Pkg_Control
+ search = Search_Pkg_Control(self.cfg, out)
+
+ search.run()
+
+
+class Core_Abstraction(object):
+ pass
+
+
class Core_Presentation(gtk.Window):
- """Main window class."""
-### Window initialization ##################################################
- def __init__(self, win_width, win_height, elem_list):
+ """Main window class."""
+ def __init__(self, win_width, win_height, func_chooser):
gtk.Window.__init__(self)
self.set_default_size(win_width, win_height)
self.set_border_width(4)
- self.fullscreen = False
self.connect('delete_event', gtk.main_quit)
self.set_wmclass('GtkWindow', 'FindIT')
+
+ label1 = gtk.Label('Choice search type')
+ srch_butt1 = gtk.RadioButton(None, 'Search Largest File')
+ srch_butt1.connect('toggled', self.srch_type, 'large_file')
+ srch_butt1.set_active(True)
+ srch_butt2 = gtk.RadioButton(srch_butt1, 'Search Largest Package')
+ srch_butt2.connect('toggled', self.srch_type, 'large_pkg')
+ self.search = 'large_file'
+ separator1 = gtk.HSeparator()
- main_vbox = gtk.VBox(False, 4)
- for elem in elem_list:
- main_vbox.pack_start(elem, False, False, 5)
+ label2 = gtk.Label('Choice show type')
+ show_butt1 = gtk.RadioButton(None, 'Show in Table view')
+ show_butt1.connect('toggled', self.show_type, 'table_view')
+ show_butt1.set_active(True)
+ show_butt2 = gtk.RadioButton(show_butt1, 'Show in Diagram view')
+ show_butt2.connect('toggled', self.show_type, 'table_view')
+ self.show = 'table_view'
+ separator2 = gtk.HSeparator()
+
+ self.butt_next = gtk.Button('Next >')
+ self.butt_next.connect('released', self.next_wind, func_chooser)
+ main_vbox = gtk.VBox(False, 4)
+ main_vbox.pack_start(label1, False, False, 10)
+ main_vbox.pack_start(srch_butt1, False, False, 2)
+ main_vbox.pack_start(srch_butt2, False, False, 2)
+ main_vbox.pack_start(separator1, False, False, 2)
+ main_vbox.pack_start(label2, False, False, 10)
+ main_vbox.pack_start(show_butt1, False, False, 2)
+ main_vbox.pack_start(show_butt2, False, False, 2)
+ main_vbox.pack_start(separator2, False, False, 2)
+ main_vbox.pack_start(self.butt_next, False, False, 20)
self.add(main_vbox)
def run(self):
self.show_all()
gtk.main()
-
+
+ def srch_type(self, widget, data):
+ self.search = data
-class Core_Abstraction(object):
- def __init__(self, config, ui, vvod, search, output):
- self.config = config
- self.ui = ui
- self.vvod = vvod
- self.search = search
- self.output = output
- self.ui.run()
-
- def start_search(self):
- data = self.vvod.get_data()
- query = self.search.run(self.config, data)
- self.output.show()
+ def show_type(self, widget, data):
+ self.show = data
-class Core_Control(object):
- def __init__(self):
- from config.py import Config_Control
- config = Config_Control()
-
- from searchfile import Search_File_Control
- search = Search_File_Control()
-
-
- elem_list = []
- elem_list.append(vvod.get_ui())
- elem_list.append(output.get_ui())
- elem_list.append(search.get_ui())
- core_present = Core_Presentation(575, 345,
- main = Core_Abstraction(config, core_present,
+ def next_wind(self, widget, func_chooser):
+ self.destroy()
+ gtk.main_quit()
+ func_chooser(self.search, self.show)
+
+if __name__ == '__main__':
+ Core_Control()