add src/config.py - first approximation
authorAlexandr Popov <popov2al@gmail.com>
Sat, 28 Mar 2009 20:56:31 +0000 (23:56 +0300)
committerAlexandr Popov <popov2al@gmail.com>
Sat, 28 Mar 2009 20:56:31 +0000 (23:56 +0300)
src/config.py [new file with mode: 0644]

diff --git a/src/config.py b/src/config.py
new file mode 100644 (file)
index 0000000..b2dab48
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+# -*-coding: utf-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+
+import gtk
+
+class Config_Control(object):
+    def __init__(self):
+        config = Config_Abstraction('findit.cfg')
+        conf_ui = Config_Presentation()
+
+
+class Config_Abstraction(object):
+    def __init__(self, config_file):
+        self.load_config(config_file)
+
+    def get_val(self, param):
+        return self.conf[param]
+
+    def set_val(self, param, value):
+        self.conf[param] = value
+
+    def load_config(self, config_file):
+        # Здесь планируется загрузка конфига из файла - пока так присваивается
+        self.conf = {}
+        self.conf['default_start_dir'] = '/home/'
+        self.conf['default_count'] = 10
+        self.conf['ignore_dir_list'] = ['/dev', '/proc', '/sys', '/mnt']
+
+    def save_config(self, config_file):
+        pass
+
+
+class Config_Presentation(gtk.Window):
+    def __init__(self):
+        gtk.Window.__init__(self)
+        self.set_border_width(4)
+        self.connect('delete_event', gtk.main_quit)
+
+    def run(self):
+        self.show_all()
+        gtk.main()