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

diff --git a/src/output.py b/src/output.py
new file mode 100644 (file)
index 0000000..abcafcd
--- /dev/null
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# -*-coding: utf-8 -*-
+# vim: sw=4 ts=4 expandtab ai
+
+import gtk
+
+class Output_Control(object):
+    def __init__(self):
+
+
+class Output_Abstraction(object):
+    def __init__(self):
+
+
+class Output_Presentation(object):
+    def __init__(self):
+        # Список файлов
+        self.scrollwind = gtk.ScrolledWindow()
+        self.scrollwind.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+
+        # Определяем переменную в которой будет храниться выводимый список
+        self.liststore = gtk.ListStore(str, str, int)
+        self.treeview = gtk.TreeView(self.liststore)
+        # На таблетке не отображаються заголовки столбцов по умолчанию -
+        # след строка заставляет их отображаться принудительно
+        self.treeview.set_headers_visible(1)
+        
+        self.liststore.append(['', '', 0])
+
+        # Создаем и настраиваем колонку с размером файла
+        size_col = gtk.TreeViewColumn( 'Size')
+        cell = gtk.CellRendererText()
+        cell.set_property('width', 90)
+        size_col.pack_start(cell, True)
+        size_col.add_attribute(cell, 'text', 1)
+        self.treeview.append_column(size_col)
+        # Создаем и настраиваем колонку с именем файла
+        path_col = gtk.TreeViewColumn( 'Path')
+        cell2 = gtk.CellRendererText()
+        path_col.pack_start(cell2, True)
+        path_col.add_attribute(cell2, 'text', 0)
+        self.treeview.append_column(path_col)
+
+        # Добавляем сортировку для колонок
+        self.treeview.set_search_column(1)
+        path_col.set_sort_column_id(0)
+        size_col.set_sort_column_id(2)
+
+        self.scrollwind.add(self.treeview)
+
+    def get_ui(self):
+        return self.scrollwind
+
+    def show_result(self, filelist):
+