add open file to file_menu
This commit is contained in:
parent
b89120aaa5
commit
2d952aaa48
|
@ -4,6 +4,22 @@
|
|||
<glade-interface>
|
||||
<widget class="GtkMenu" id="file_tab_menu">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="menuitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">_Open File</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="open_file"/>
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="menu-item-image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="select_all">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -35,7 +35,21 @@ class FilesTabManager(FilesBaseManager):
|
|||
self.compact_allocation_warning()
|
||||
else:
|
||||
super(FilesTabManager, self).priority_clicked(widget)
|
||||
|
||||
|
||||
def open_file(self, widget):
|
||||
self.open_image = gtk.Image()
|
||||
self.open_image.set_from_stock(gtk.STOCK_OPEN)
|
||||
self.open_speed_menuitem = gtk.ImageMenuItem(_("OPen File"))
|
||||
self.open_speed_menuitem.set_image(self.down_image)
|
||||
|
||||
selected_paths = self.file_view.get_selection().get_selected_rows()[1]
|
||||
import os
|
||||
for path in selected_paths:
|
||||
child_path = self.file_store_sorted.\
|
||||
convert_path_to_child_path(path)
|
||||
os.system("xdg-open %s/%s" %(self.manager.unique_IDs[self.file_unique_id].save_dir, \
|
||||
self.file_store.get_value(self.file_store.get_iter(child_path), 0)))
|
||||
|
||||
# From core to UI
|
||||
def prepare_file_store(self):
|
||||
if not self.file_store_dict:
|
||||
|
|
|
@ -49,6 +49,7 @@ class FilesBaseManager(object):
|
|||
domain='deluge')
|
||||
self.file_menu = file_glade.get_widget("file_tab_menu")
|
||||
file_glade.signal_autoconnect({
|
||||
"open_file" : self.open_file,
|
||||
"select_all": self.file_select_all,
|
||||
"unselect_all": self.file_unselect_all,
|
||||
"priority_dont_download": self.priority_clicked,
|
||||
|
@ -64,6 +65,9 @@ class FilesBaseManager(object):
|
|||
# order as we get files from manager.get_torrent_file_info()
|
||||
self.file_store_sorted = gtk.TreeModelSort(self.file_store)
|
||||
|
||||
def open_file(self):
|
||||
pass
|
||||
|
||||
def build_file_view(self):
|
||||
def priority(column, cell, model, iter, data):
|
||||
priority = common.fpriority(model.get_value(iter, data))
|
||||
|
|
Loading…
Reference in New Issue