diff options
| author | jvoisin | 2011-07-19 17:01:26 +0200 |
|---|---|---|
| committer | jvoisin | 2011-07-19 17:01:26 +0200 |
| commit | d6b91d5d21f49030b5fe28bf62881b03b802b2c0 (patch) | |
| tree | d7fd8528446a6662bbc05ee692f2231e1cb88277 /gui.py | |
| parent | 62eedbf87b2740dbf51720a84a16e6db2a0be6a2 (diff) | |
Smoother way for creating columns
Diffstat (limited to 'gui.py')
| -rw-r--r-- | gui.py | 27 |
1 files changed, 6 insertions, 21 deletions
| @@ -108,28 +108,13 @@ class ListStoreApp: | |||
| 108 | ''' | 108 | ''' |
| 109 | Create the columns | 109 | Create the columns |
| 110 | ''' | 110 | ''' |
| 111 | model = treeview.get_model() | 111 | colname = ['Filename', 'Mimetype', 'cleaned'] |
| 112 | 112 | ||
| 113 | # column for filename | 113 | for i, j in enumerate(colname): |
| 114 | filenameColumn = Gtk.CellRendererText() | 114 | filenameColumn = Gtk.CellRendererText() |
| 115 | column = Gtk.TreeViewColumn("Filename", filenameColumn, | 115 | column = Gtk.TreeViewColumn(j, filenameColumn, text=i+1) |
| 116 | text=self.COLUMN_NAME) | 116 | column.set_sort_column_id(i+1) |
| 117 | column.set_sort_column_id(self.COLUMN_NAME) | 117 | treeview.append_column(column) |
| 118 | treeview.append_column(column) | ||
| 119 | |||
| 120 | # column for fileformat | ||
| 121 | fileformatColumn = Gtk.CellRendererText() | ||
| 122 | column = Gtk.TreeViewColumn("Fileformat", fileformatColumn, | ||
| 123 | text=self.COLUMN_FILEFORMAT) | ||
| 124 | column.set_sort_column_id(self.COLUMN_FILEFORMAT) | ||
| 125 | treeview.append_column(column) | ||
| 126 | |||
| 127 | # column for cleaned | ||
| 128 | cleanedColumn = Gtk.CellRendererText() | ||
| 129 | column = Gtk.TreeViewColumn("Cleaned", cleanedColumn, | ||
| 130 | text=self.COLUMN_CLEANED) | ||
| 131 | column.set_sort_column_id(self.COLUMN_CLEANED) | ||
| 132 | treeview.append_column(column) | ||
| 133 | 118 | ||
| 134 | def create_menu_item(self, name, func, menu, pix): | 119 | def create_menu_item(self, name, func, menu, pix): |
| 135 | ''' | 120 | ''' |
