diff options
| author | jvoisin | 2011-07-12 16:09:01 +0200 |
|---|---|---|
| committer | jvoisin | 2011-07-12 16:09:01 +0200 |
| commit | 761e7f98270242e23c5dcd515817667aed0a8a6d (patch) | |
| tree | 216bd3192352259e48019d8b7e14a2fad7fa2a1a /gui.py | |
| parent | c614e8a30e90e7177f22627c11d00f2d768a4084 (diff) | |
Mock up of the filechooser dialog
Diffstat (limited to 'gui.py')
| -rw-r--r-- | gui.py | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -32,6 +32,8 @@ class ListStoreApp: | |||
| 32 | NUM_COLUMNS) = range(4) | 32 | NUM_COLUMNS) = range(4) |
| 33 | 33 | ||
| 34 | def __init__(self): | 34 | def __init__(self): |
| 35 | self.filenames = [] | ||
| 36 | |||
| 35 | self.window = Gtk.Window() | 37 | self.window = Gtk.Window() |
| 36 | self.window.set_title('Metadata Anonymisation Toolkit %s' % __version__) | 38 | self.window.set_title('Metadata Anonymisation Toolkit %s' % __version__) |
| 37 | self.window.connect('destroy', Gtk.main_quit) | 39 | self.window.connect('destroy', Gtk.main_quit) |
| @@ -63,11 +65,16 @@ class ListStoreApp: | |||
| 63 | toolbar = Gtk.Toolbar() | 65 | toolbar = Gtk.Toolbar() |
| 64 | 66 | ||
| 65 | toolbutton = Gtk.ToolButton(label = 'Add', stock_id=Gtk.STOCK_ADD) | 67 | toolbutton = Gtk.ToolButton(label = 'Add', stock_id=Gtk.STOCK_ADD) |
| 68 | toolbutton.connect('clicked', self.add_file) | ||
| 66 | toolbar.add(toolbutton) | 69 | toolbar.add(toolbutton) |
| 67 | 70 | ||
| 68 | toolbutton = Gtk.ToolButton(label = 'Clean', stock_id=Gtk.STOCK_CLEAR) | 71 | toolbutton = Gtk.ToolButton(label = 'Clean', stock_id=Gtk.STOCK_CLEAR) |
| 69 | toolbar.add(toolbutton) | 72 | toolbar.add(toolbutton) |
| 70 | 73 | ||
| 74 | toolbutton = Gtk.ToolButton(label='Brute Clean', | ||
| 75 | stock_id=Gtk.STOCK_CLEAR) | ||
| 76 | toolbar.add(toolbutton) | ||
| 77 | |||
| 71 | toolbutton = Gtk.ToolButton(label='Check', stock_id=Gtk.STOCK_FIND) | 78 | toolbutton = Gtk.ToolButton(label='Check', stock_id=Gtk.STOCK_FIND) |
| 72 | toolbar.add(toolbutton) | 79 | toolbar.add(toolbutton) |
| 73 | 80 | ||
| @@ -118,6 +125,27 @@ class ListStoreApp: | |||
| 118 | column.set_sort_column_id(self.COLUMN_CLEANED) | 125 | column.set_sort_column_id(self.COLUMN_CLEANED) |
| 119 | treeview.append_column(column) | 126 | treeview.append_column(column) |
| 120 | 127 | ||
| 128 | def add_file(self, button): | ||
| 129 | chooser = Gtk.FileChooserDialog( | ||
| 130 | title='Choose files', | ||
| 131 | parent=None, | ||
| 132 | action=Gtk.FileChooserAction.OPEN, | ||
| 133 | buttons=(Gtk.STOCK_OK, 0, Gtk.STOCK_CANCEL, 1) | ||
| 134 | ) | ||
| 135 | chooser.set_select_multiple(True) | ||
| 136 | response = chooser.run() | ||
| 137 | |||
| 138 | if response is 0: | ||
| 139 | self.filenames = chooser.get_filenames() | ||
| 140 | self.populate() | ||
| 141 | elif response is 1: | ||
| 142 | pass | ||
| 143 | chooser.destroy() | ||
| 144 | |||
| 145 | def populate(self): | ||
| 146 | for item in self.filenames: | ||
| 147 | self.model.append([item, 'pouet', 'dirty']) | ||
| 148 | |||
| 121 | def main(): | 149 | def main(): |
| 122 | app = ListStoreApp() | 150 | app = ListStoreApp() |
| 123 | Gtk.main() | 151 | Gtk.main() |
