Merge branch 'Add-F2' into 1.3-stable
This commit is contained in:
commit
b0e38d7bde
|
@ -165,6 +165,18 @@ def get_default_download_dir():
|
|||
if windows_check():
|
||||
return os.path.expanduser("~")
|
||||
else:
|
||||
from xdg.BaseDirectory import xdg_config_home
|
||||
userdir_file = os.path.join(xdg_config_home, 'user-dirs.dirs')
|
||||
try:
|
||||
for line in open(userdir_file, 'r'):
|
||||
if not line.startswith('#') and 'XDG_DOWNLOAD_DIR' in line:
|
||||
download_dir = os.path.expandvars(\
|
||||
line.partition("=")[2].rstrip().strip('"'))
|
||||
if os.path.isdir(download_dir):
|
||||
return download_dir
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
return os.environ.get("HOME")
|
||||
|
||||
def windows_check():
|
||||
|
|
|
@ -271,7 +271,7 @@ class GtkUI(GtkPluginBase):
|
|||
|
||||
def create_columns(self, treeView):
|
||||
rendererToggle = gtk.CellRendererToggle()
|
||||
column = gtk.TreeViewColumn("On", rendererToggle, activatable=True, active=1)
|
||||
column = gtk.TreeViewColumn("On", rendererToggle, activatable=1, active=1)
|
||||
column.set_sort_column_id(1)
|
||||
treeView.append_column(column)
|
||||
tt = gtk.Tooltip()
|
||||
|
|
|
@ -42,7 +42,7 @@ from setuptools import setup
|
|||
__plugin_name__ = "AutoAdd"
|
||||
__author__ = "Chase Sterling"
|
||||
__author_email__ = "chase.sterling@gmail.com"
|
||||
__version__ = "1.02"
|
||||
__version__ = "1.03"
|
||||
__url__ = "http://dev.deluge-torrent.org/wiki/Plugins/AutoAdd"
|
||||
__license__ = "GPLv3"
|
||||
__description__ = "Monitors folders for .torrent files."
|
||||
|
|
|
@ -119,7 +119,8 @@ class FilesTab(Tab):
|
|||
self._editing_index = None
|
||||
|
||||
# Filename column
|
||||
column = gtk.TreeViewColumn(_("Filename"))
|
||||
self.filename_column_name = _("Filename")
|
||||
column = gtk.TreeViewColumn(self.filename_column_name)
|
||||
render = gtk.CellRendererPixbuf()
|
||||
column.pack_start(render, False)
|
||||
column.add_attribute(render, "stock-id", 6)
|
||||
|
@ -437,9 +438,8 @@ class FilesTab(Tab):
|
|||
"""
|
||||
Go through the tree and update the folder complete percentages.
|
||||
"""
|
||||
|
||||
root = self.treestore.get_iter_root()
|
||||
if self.treestore[root][5] != -1:
|
||||
if root is None or self.treestore[root][5] != -1:
|
||||
return
|
||||
|
||||
def get_completed_bytes(row):
|
||||
|
@ -482,7 +482,10 @@ class FilesTab(Tab):
|
|||
if self._editing_index == row[5]:
|
||||
continue
|
||||
|
||||
try:
|
||||
progress_string = "%.2f%%" % (status["file_progress"][index] * 100)
|
||||
except IndexError:
|
||||
continue
|
||||
if row[2] != progress_string:
|
||||
row[2] = progress_string
|
||||
progress_value = status["file_progress"][index] * 100
|
||||
|
@ -501,17 +504,15 @@ class FilesTab(Tab):
|
|||
# We only care about right-clicks
|
||||
if event.button == 3:
|
||||
x, y = event.get_coords()
|
||||
path = self.listview.get_path_at_pos(int(x), int(y))
|
||||
if not path:
|
||||
cursor_path = self.listview.get_path_at_pos(int(x), int(y))
|
||||
if not cursor_path:
|
||||
return
|
||||
row = self.treestore.get_iter(path[0])
|
||||
|
||||
if self.get_selected_files():
|
||||
if self.treestore.get_value(row, 5) not in self.get_selected_files():
|
||||
paths = self.listview.get_selection().get_selected_rows()[1]
|
||||
if cursor_path[0] not in paths:
|
||||
row = self.treestore.get_iter(cursor_path[0])
|
||||
self.listview.get_selection().unselect_all()
|
||||
self.listview.get_selection().select_iter(row)
|
||||
else:
|
||||
self.listview.get_selection().select_iter(row)
|
||||
|
||||
for widget in self.file_menu_priority_items:
|
||||
widget.set_sensitive(not self.__compact)
|
||||
|
@ -520,16 +521,25 @@ class FilesTab(Tab):
|
|||
return True
|
||||
|
||||
def _on_key_press_event(self, widget, event):
|
||||
# Menu key
|
||||
if gtk.gdk.keyval_name(event.keyval) != "Menu":
|
||||
return
|
||||
|
||||
if not self.get_selected_files():
|
||||
keyname = gtk.gdk.keyval_name(event.keyval)
|
||||
func = getattr(self, 'keypress_' + keyname, None)
|
||||
selected_rows = self.listview.get_selection().get_selected_rows()[1]
|
||||
if func and selected_rows:
|
||||
return func(event)
|
||||
else:
|
||||
return
|
||||
|
||||
def keypress_Menu(self, event):
|
||||
self.file_menu.popup(None, None, None, 3, event.time)
|
||||
return True
|
||||
|
||||
def keypress_F2(self, event):
|
||||
path, col = self.listview.get_cursor()
|
||||
for column in self.listview.get_columns():
|
||||
if column.get_title() == self.filename_column_name:
|
||||
self.listview.set_cursor(path, column, True)
|
||||
return True
|
||||
|
||||
def _on_menuitem_open_file_activate(self, menuitem):
|
||||
self._on_row_activated(None, None, None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue