diff options
| author | jvoisin | 2013-05-14 17:00:53 +0200 |
|---|---|---|
| committer | jvoisin | 2013-05-14 17:00:53 +0200 |
| commit | 4fedba444a54a05ac7383b110692926cdcbe3ea3 (patch) | |
| tree | f718359af1ce0c2d848c863e81ec2c998d0f3c3f | |
| parent | 829abb4dac796ea1b782c93f8f13040b7121f7ca (diff) | |
Keyboard shortcuts are now usable
| -rw-r--r-- | data/mat.ui | 16 | ||||
| -rwxr-xr-x | mat-gui | 21 |
2 files changed, 12 insertions, 25 deletions
diff --git a/data/mat.ui b/data/mat.ui index 83d1702..db16d67 100644 --- a/data/mat.ui +++ b/data/mat.ui | |||
| @@ -183,7 +183,6 @@ | |||
| 183 | </child> | 183 | </child> |
| 184 | <child> | 184 | <child> |
| 185 | <object class="GtkToolbar" id="Toolbar"> | 185 | <object class="GtkToolbar" id="Toolbar"> |
| 186 | <property name="visible">True</property> | ||
| 187 | <property name="can_focus">False</property> | 186 | <property name="can_focus">False</property> |
| 188 | <child> | 187 | <child> |
| 189 | <object class="GtkToolButton" id="add"> | 188 | <object class="GtkToolButton" id="add"> |
| @@ -263,8 +262,8 @@ | |||
| 263 | <property name="can_focus">False</property> | 262 | <property name="can_focus">False</property> |
| 264 | <child> | 263 | <child> |
| 265 | <object class="GtkTreeView" id="Treeview"> | 264 | <object class="GtkTreeView" id="Treeview"> |
| 266 | <property name="visible">True</property> | 265 | <property name="can_focus">True</property> |
| 267 | <property name="can_focus">False</property> | 266 | <property name="events"/> |
| 268 | <property name="hexpand">True</property> | 267 | <property name="hexpand">True</property> |
| 269 | <property name="model">Liststore</property> | 268 | <property name="model">Liststore</property> |
| 270 | <property name="rules_hint">True</property> | 269 | <property name="rules_hint">True</property> |
| @@ -273,12 +272,6 @@ | |||
| 273 | <property name="rubber_banding">True</property> | 272 | <property name="rubber_banding">True</property> |
| 274 | <signal name="drag-data-received" handler="cb_drag_data_received" swapped="no"/> | 273 | <signal name="drag-data-received" handler="cb_drag_data_received" swapped="no"/> |
| 275 | <signal name="row-activated" handler="cb_popup_metadata" swapped="no"/> | 274 | <signal name="row-activated" handler="cb_popup_metadata" swapped="no"/> |
| 276 | <signal name="key-press-event" handler="cb_treeview_keyboard_event" swapped="no"/> | ||
| 277 | <child internal-child="selection"> | ||
| 278 | <object class="GtkTreeSelection" id="treeview-selection1"> | ||
| 279 | <property name="mode">multiple</property> | ||
| 280 | </object> | ||
| 281 | </child> | ||
| 282 | <child> | 275 | <child> |
| 283 | <object class="GtkTreeViewColumn" id="tvc_path"> | 276 | <object class="GtkTreeViewColumn" id="tvc_path"> |
| 284 | <property name="resizable">True</property> | 277 | <property name="resizable">True</property> |
| @@ -490,6 +483,11 @@ | |||
| 490 | <property name="entry_text_column">1</property> | 483 | <property name="entry_text_column">1</property> |
| 491 | <property name="id_column">1</property> | 484 | <property name="id_column">1</property> |
| 492 | <signal name="changed" handler="cb_update_supported_popup" swapped="no"/> | 485 | <signal name="changed" handler="cb_update_supported_popup" swapped="no"/> |
| 486 | <child internal-child="entry"> | ||
| 487 | <object class="GtkEntry" id="comboboxtext-entry2"> | ||
| 488 | <property name="can_focus">False</property> | ||
| 489 | </object> | ||
| 490 | </child> | ||
| 493 | </object> | 491 | </object> |
| 494 | <packing> | 492 | <packing> |
| 495 | <property name="left_attach">1</property> | 493 | <property name="left_attach">1</property> |
| @@ -100,8 +100,10 @@ class GUI(object): | |||
| 100 | 100 | ||
| 101 | def __set_drag_treeview(self): | 101 | def __set_drag_treeview(self): |
| 102 | ''' Setup the drag'n'drop handling by the treeview ''' | 102 | ''' Setup the drag'n'drop handling by the treeview ''' |
| 103 | self.treeview.drag_dest_set(Gtk.DestDefaults.MOTION | | 103 | self.treeview.drag_dest_set( |
| 104 | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, | 104 | Gtk.DestDefaults.MOTION | |
| 105 | Gtk.DestDefaults.HIGHLIGHT | | ||
| 106 | Gtk.DestDefaults.DROP, | ||
| 105 | [], Gdk.DragAction.COPY) | 107 | [], Gdk.DragAction.COPY) |
| 106 | targets = Gtk.TargetList.new([]) | 108 | targets = Gtk.TargetList.new([]) |
| 107 | targets.add_uri_targets(80) | 109 | targets.add_uri_targets(80) |
| @@ -123,17 +125,6 @@ class GUI(object): | |||
| 123 | remaining = self.builder.get_object('supported_remaining').get_buffer() | 125 | remaining = self.builder.get_object('supported_remaining').get_buffer() |
| 124 | remaining.set_text(self.supported_dict.list[index]['remaining']) | 126 | remaining.set_text(self.supported_dict.list[index]['remaining']) |
| 125 | 127 | ||
| 126 | def cb_treeview_keyboard_event(self, widget, event): | ||
| 127 | ''' | ||
| 128 | Remove selected files from the treeview | ||
| 129 | when the use hit the 'suppr' key | ||
| 130 | ''' | ||
| 131 | if Gdk.keyval_name(event.keyval) == "Delete": | ||
| 132 | rows = [] | ||
| 133 | self.treeview.get_selection().selected_foreach( | ||
| 134 | lambda model, path, iter: rows.append(iter)) | ||
| 135 | [self.liststore.remove(i) for i in rows] | ||
| 136 | |||
| 137 | def cb_close_application(self, _): | 128 | def cb_close_application(self, _): |
| 138 | ''' Close the application ''' | 129 | ''' Close the application ''' |
| 139 | Gtk.main_quit() | 130 | Gtk.main_quit() |
| @@ -168,8 +159,6 @@ class GUI(object): | |||
| 168 | ''' | 159 | ''' |
| 169 | Popup that display on double-clic | 160 | Popup that display on double-clic |
| 170 | metadata from a file | 161 | metadata from a file |
| 171 | |||
| 172 | FIXME: use a prettier GUI ? | ||
| 173 | ''' | 162 | ''' |
| 174 | label = '<b>%s</b>\'s metadatas:\n' % self.liststore[row][1] | 163 | label = '<b>%s</b>\'s metadatas:\n' % self.liststore[row][1] |
| 175 | meta = '' | 164 | meta = '' |
| @@ -181,7 +170,7 @@ class GUI(object): | |||
| 181 | self.liststore[row][6] = 1 | 170 | self.liststore[row][6] = 1 |
| 182 | iterator = self.liststore[row][0].file.get_meta().iteritems() | 171 | iterator = self.liststore[row][0].file.get_meta().iteritems() |
| 183 | for i, j in iterator: | 172 | for i, j in iterator: |
| 184 | name = '-<b>' + str(i) + '</b> : ' | 173 | name = '-<b>' + str(i) + '</b>: ' |
| 185 | meta += (name + str(j) + '\n') | 174 | meta += (name + str(j) + '\n') |
| 186 | 175 | ||
| 187 | w = Gtk.MessageDialog(self.window, | 176 | w = Gtk.MessageDialog(self.window, |
