diff --git a/deluge/common.py b/deluge/common.py index b26a3d269..0ec886be2 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -56,21 +56,6 @@ TORRENT_STATE = [ 'Moving' ] -FILE_PRIORITY = { - 0: 'Do Not Download', - 1: 'Normal Priority', - 2: 'High Priority', - 3: 'High Priority', - 4: 'High Priority', - 5: 'High Priority', - 6: 'High Priority', - 7: 'Highest Priority', - 'Do Not Download': 0, - 'Normal Priority': 1, - 'High Priority': 5, - 'Highest Priority': 7 -} - def get_version(): """ diff --git a/deluge/ui/common.py b/deluge/ui/common.py index 38848c8bf..7f33b7b20 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -24,7 +24,7 @@ from deluge.common import utf8_encoded log = logging.getLogger(__name__) -# Dummy translation dicts so Torrent and Tracker states are available for Translators. +# Dummy translation dicts so the text is available for Translators. # # All entries in deluge.common.TORRENT_STATE should be added here. # @@ -90,13 +90,28 @@ TORRENT_DATA_FIELD = { 'owner': {'name': _('Owner'), 'status': ['owner']} } - TRACKER_STATUS_TRANSLATION = [ _('Error'), _('Warning'), _('Announce OK'), _('Announce Sent') ] + +FILE_PRIORITY = { + 0: 'Ignore', + 1: 'Low', + 2: 'Low', + 3: 'Low', + 4: 'Normal', + 5: 'High', + 6: 'High', + 7: 'High', + _('Ignore'): 0, + _('Low'): 1, + _('Normal'): 4, + _('High'): 7, +} + del _ DEFAULT_HOST = '127.0.0.1' diff --git a/deluge/ui/console/cmdline/commands/info.py b/deluge/ui/console/cmdline/commands/info.py index d6fd21fcd..ce4333ac9 100644 --- a/deluge/ui/console/cmdline/commands/info.py +++ b/deluge/ui/console/cmdline/commands/info.py @@ -16,6 +16,7 @@ import deluge.common as common import deluge.component as component import deluge.ui.console.utils.colors as colors from deluge.ui.client import client +from deluge.ui.common import FILE_PRIORITY from deluge.ui.console.utils import format_utils from . import BaseCommand @@ -198,7 +199,7 @@ class Command(BaseCommand): col_priority = ' {!info!}Priority: ' - file_priority = common.FILE_PRIORITY[status['file_priorities'][index]].replace('Priority', '') + file_priority = FILE_PRIORITY[status['file_priorities'][index]].replace('Priority', '') if status['file_progress'][index] != 1.0: if file_priority == 'Do Not Download': col_priority += '{!error!}' diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py index ed6283fde..e7bc9e4cb 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -12,9 +12,10 @@ from __future__ import division import logging import deluge.component as component -from deluge.common import FILE_PRIORITY, fsize +from deluge.common import fsize from deluge.decorators import overrides from deluge.ui.client import client +from deluge.ui.common import FILE_PRIORITY from deluge.ui.console.modes.basemode import BaseMode from deluge.ui.console.modes.torrentlist.torrentactions import ACTION, torrent_actions_popup from deluge.ui.console.utils import curses_util as util @@ -308,16 +309,19 @@ class TorrentDetail(BaseMode, PopupsHandler): bg = 'black' attr = '' - if fl[6] == -2: - pass # Mixed - elif fl[6] == 0: - fg = 'red' # Do Not Download - elif fl[6] == 1: - pass # Normal - elif fl[6] <= 6: - fg = 'yellow' # High - elif fl[6] == 7: - fg = 'green' # Highest + priority_fg_color = { + -2: 'white', # Mixed + 0: 'red', # Ignore + 1: 'yellow', # Low + 2: 'yellow', + 3: 'yellow', + 4: 'white', # Normal + 5: 'green', + 6: 'green', + 7: 'green' # High + } + + fg = priority_fg_color[fl[6]] if idx >= self.file_off: # set fg/bg colors based on whether the file is selected/marked or not @@ -581,13 +585,14 @@ class TorrentDetail(BaseMode, PopupsHandler): if self.marked: popup = SelectablePopup(self, 'Set File Priority', popup_func, border_off_north=1) - popup.add_line('do_not_download', '_Do Not Download', - cb_arg=FILE_PRIORITY['Do Not Download'], foreground='red') - popup.add_line('normal_priority', '_Normal Priority', cb_arg=FILE_PRIORITY['Normal Priority']) + popup.add_line('ignore_priority', '_Ignore', + cb_arg=FILE_PRIORITY['Ignore'], foreground='red') + popup.add_line('low_priority', '_Low Priority', + cb_arg=FILE_PRIORITY['Low Priority'], foreground='yellow') + popup.add_line('normal_priority', '_Normal Priority', + cb_arg=FILE_PRIORITY['Normal Priority']) popup.add_line('high_priority', '_High Priority', - cb_arg=FILE_PRIORITY['High Priority'], foreground='yellow') - popup.add_line('highest_priority', 'H_ighest Priority', - cb_arg=FILE_PRIORITY['Highest Priority'], foreground='green') + cb_arg=FILE_PRIORITY['High Priority'], foreground='green') popup._selected = 1 self.push_popup(popup) diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index 845601cf7..8c5b74e7c 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -18,8 +18,9 @@ from gobject import TYPE_UINT64 from gtk.gdk import ACTION_DEFAULT, ACTION_MOVE, BUTTON1_MASK, keyval_name # pylint: disable=ungrouped-imports import deluge.component as component -from deluge.common import FILE_PRIORITY, open_file, show_file +from deluge.common import open_file, show_file from deluge.ui.client import client +from deluge.ui.common import FILE_PRIORITY from deluge.ui.gtkui.common import (listview_replace_treestore, load_pickled_state_file, reparent_iter, save_pickled_state_file) from deluge.ui.gtkui.torrentdetails import Tab @@ -27,24 +28,12 @@ from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size log = logging.getLogger(__name__) - -def _(message): - return message - - -TRANSLATE = { - 'Do Not Download': _('Do Not Download'), - 'Normal Priority': _('Normal Priority'), - 'High Priority': _('High Priority'), - 'Highest Priority': _('Highest Priority'), +CELL_PRIORITY_ICONS = { + 'Ignore': gtk.STOCK_NO, + 'Low': gtk.STOCK_GO_DOWN, + 'Normal': gtk.STOCK_OK, + 'High': gtk.STOCK_GO_UP } -del _ - - -def _t(text): - if text in TRANSLATE: - text = TRANSLATE[text] - return _(text) def cell_priority(column, cell, model, row, data): @@ -53,7 +42,7 @@ def cell_priority(column, cell, model, row, data): cell.set_property('text', '') return priority = model.get_value(row, data) - cell.set_property('text', _t(FILE_PRIORITY[priority])) + cell.set_property('text', _(FILE_PRIORITY[priority])) def cell_priority_icon(column, cell, model, row, data): @@ -62,14 +51,7 @@ def cell_priority_icon(column, cell, model, row, data): cell.set_property('stock-id', None) return priority = model.get_value(row, data) - if FILE_PRIORITY[priority] == 'Do Not Download': - cell.set_property('stock-id', gtk.STOCK_NO) - elif FILE_PRIORITY[priority] == 'Normal Priority': - cell.set_property('stock-id', gtk.STOCK_YES) - elif FILE_PRIORITY[priority] == 'High Priority': - cell.set_property('stock-id', gtk.STOCK_GO_UP) - elif FILE_PRIORITY[priority] == 'Highest Priority': - cell.set_property('stock-id', gtk.STOCK_GOTO_TOP) + cell.set_property('stock-id', CELL_PRIORITY_ICONS[FILE_PRIORITY[priority]]) def cell_filename(column, cell, model, row, data): @@ -175,10 +157,10 @@ class FilesTab(Tab): self.file_menu = main_builder.get_object('menu_file_tab') self.file_menu_priority_items = [ - main_builder.get_object('menuitem_donotdownload'), + main_builder.get_object('menuitem_ignore'), + main_builder.get_object('menuitem_low'), main_builder.get_object('menuitem_normal'), main_builder.get_object('menuitem_high'), - main_builder.get_object('menuitem_highest'), main_builder.get_object('menuitem_priority_sep') ] @@ -202,10 +184,10 @@ class FilesTab(Tab): component.get('MainWindow').connect_signals({ 'on_menuitem_open_file_activate': self._on_menuitem_open_file_activate, 'on_menuitem_show_file_activate': self._on_menuitem_show_file_activate, - 'on_menuitem_donotdownload_activate': self._on_menuitem_donotdownload_activate, + 'on_menuitem_ignore_activate': self._on_menuitem_ignore_activate, + 'on_menuitem_low_activate': self._on_menuitem_low_activate, 'on_menuitem_normal_activate': self._on_menuitem_normal_activate, 'on_menuitem_high_activate': self._on_menuitem_high_activate, - 'on_menuitem_highest_activate': self._on_menuitem_highest_activate, 'on_menuitem_expand_all_activate': self._on_menuitem_expand_all_activate }) @@ -543,25 +525,21 @@ class FilesTab(Tab): log.debug('priorities: %s', priorities) client.core.set_torrent_options([self.torrent_id], {'file_priorities': priorities}) - def _on_menuitem_donotdownload_activate(self, menuitem): + def _on_menuitem_ignore_activate(self, menuitem): self._set_file_priorities_on_user_change( - self.get_selected_files(), - FILE_PRIORITY['Do Not Download']) + self.get_selected_files(), FILE_PRIORITY['Ignore']) + + def _on_menuitem_low_activate(self, menuitem): + self._set_file_priorities_on_user_change( + self.get_selected_files(), FILE_PRIORITY['Low']) def _on_menuitem_normal_activate(self, menuitem): self._set_file_priorities_on_user_change( - self.get_selected_files(), - FILE_PRIORITY['Normal Priority']) + self.get_selected_files(), FILE_PRIORITY['Normal']) def _on_menuitem_high_activate(self, menuitem): self._set_file_priorities_on_user_change( - self.get_selected_files(), - FILE_PRIORITY['High Priority']) - - def _on_menuitem_highest_activate(self, menuitem): - self._set_file_priorities_on_user_change( - self.get_selected_files(), - FILE_PRIORITY['Highest Priority']) + self.get_selected_files(), FILE_PRIORITY['High']) def _on_menuitem_expand_all_activate(self, menuitem): self.listview.expand_all() diff --git a/deluge/ui/gtkui/glade/main_window.tabs.menu_file.ui b/deluge/ui/gtkui/glade/main_window.tabs.menu_file.ui index 3bece83a3..5606763f0 100644 --- a/deluge/ui/gtkui/glade/main_window.tabs.menu_file.ui +++ b/deluge/ui/gtkui/glade/main_window.tabs.menu_file.ui @@ -29,7 +29,7 @@ True False - gtk-goto-top + gtk-go-down 1 @@ -82,15 +82,27 @@ - - _Do Not Download + + _Ignore False True False True image2 False - + + + + + + _Low Priority + False + True + False + True + image5 + False + @@ -114,19 +126,7 @@ True image4 False - - - - - - Hi_ghest Priority - False - True - False - True - image5 - False - + diff --git a/deluge/ui/web/css/deluge.css b/deluge/ui/web/css/deluge.css index a5539f59d..53a22ffb7 100644 --- a/deluge/ui/web/css/deluge.css +++ b/deluge/ui/web/css/deluge.css @@ -346,7 +346,7 @@ dl.singleline dd { } /* Filepriority styles */ -.x-no-download, .x-normal-download, .x-high-download, .x-highest-download, .x-mixed-download { +.x-no-download, .x-low-download, .x-normal-download, .x-high-download, .x-mixed-download { padding-left: 20px; background-repeat: no-repeat; line-height: 16px; @@ -356,6 +356,10 @@ dl.singleline dd { background-image: url(../icons/no_download.png); } +.x-low-download { + background-image: url(../icons/low.png); +} + .x-normal-download { background-image: url(../icons/normal.png); } @@ -364,10 +368,6 @@ dl.singleline dd { background-image: url(../icons/high.png); } -.x-highest-download { - background-image: url(../icons/highest.png); -} - .x-mixed-download { /*background-image: url(../icons/mixed.png);*/ } @@ -485,6 +485,10 @@ dl.singleline dd { background-image: url('../icons/no_download.png') !important; } +.icon-low { + background-image: url('../icons/low.png') !important; +} + .icon-normal { background-image: url('../icons/normal.png') !important; } @@ -492,7 +496,3 @@ dl.singleline dd { .icon-high { background-image: url('../icons/high.png') !important; } - -.icon-highest { - background-image: url('../icons/highest.png') !important; -} diff --git a/deluge/ui/web/js/deluge-all/Deluge.js b/deluge/ui/web/js/deluge-all/Deluge.js index 225cee853..0a09e349d 100644 --- a/deluge/ui/web/js/deluge-all/Deluge.js +++ b/deluge/ui/web/js/deluge-all/Deluge.js @@ -1,6 +1,6 @@ /*! * Deluge.js - * + * * Copyright (c) Damien Churchill 2009-2010 * * This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with @@ -41,7 +41,7 @@ Ext.apply(Ext, { } return equal; }, - + keys: function(obj) { var keys = []; for (var i in obj) if (obj.hasOwnProperty(i)) @@ -60,7 +60,7 @@ Ext.apply(Ext, { } return values; }, - + splat: function(obj) { var type = Ext.type(obj); return (type) ? ((type != 'array') ? [obj] : obj) : []; @@ -75,7 +75,7 @@ Ext.apply(Deluge, { // private pluginStore: {}, - + // private progressTpl: '
' + '
' + @@ -90,7 +90,7 @@ Ext.apply(Deluge, { '
' + '
', - + /** * A method to create a progress bar that can be used by renderers * to display a bar within a grid or tree. @@ -131,36 +131,42 @@ Ext.apply(Deluge, { registerPlugin: function(name, plugin) { Deluge.pluginStore[name] = plugin; } - + }); // Setup a space for plugins to insert themselves deluge.plugins = {}; // Hinting for gettext_gen.py -// _('Do Not Download') -// _('Normal Priority') -// _('High Priority') -// _('Highest Priority') +// _('Ignore') +// _('Low') +// _('Normal') +// _('High') FILE_PRIORITY = { + 0: 'Ignore', + 1: 'Low', + 2: 'Low', + 3: 'Low', + 4: 'Normal', + 5: 'High', + 6: 'High', + 7: 'High', 9: 'Mixed', - 0: 'Do Not Download', - 1: 'Normal Priority', - 2: 'High Priority', - 5: 'High Priority', - 7: 'Highest Priority', - 'Mixed': 9, - 'Do Not Download': 0, - 'Normal Priority': 1, - 'High Priority': 5, - 'Highest Priority': 7 + 'Ignore': 0, + 'Low': 1, + 'Normal': 4, + 'High': 7, + 'Mixed': 9 } FILE_PRIORITY_CSS = { - 9: 'x-mixed-download', 0: 'x-no-download', - 1: 'x-normal-download', - 2: 'x-high-download', + 1: 'x-low-download', + 2: 'x-low-download', + 3: 'x-low-download', + 4: 'x-normal-download', 5: 'x-high-download', - 7: 'x-highest-download' + 6: 'x-high-download', + 7: 'x-high-download', + 9: 'x-mixed-download' } diff --git a/deluge/ui/web/js/deluge-all/Menus.js b/deluge/ui/web/js/deluge-all/Menus.js index 9d96b11b0..c5fc69f8e 100644 --- a/deluge/ui/web/js/deluge-all/Menus.js +++ b/deluge/ui/web/js/deluge-all/Menus.js @@ -301,24 +301,24 @@ deluge.menus.filePriorities = new Ext.menu.Menu({ text: _('Expand All'), iconCls: 'icon-expand-all' }, '-', { - id: 'no_download', - text: _('Do Not Download'), + id: 'ignore', + text: _('Ignore'), iconCls: 'icon-do-not-download', - filePriority: FILE_PRIORITY['Do Not Download'] + filePriority: FILE_PRIORITY['Ignore'] + }, { + id: 'low', + text: _('Low'), + iconCls: 'icon-low', + filePriority: FILE_PRIORITY['Low'] }, { id: 'normal', - text: _('Normal Priority'), + text: _('Normal'), iconCls: 'icon-normal', - filePriority: FILE_PRIORITY['Normal Priority'] + filePriority: FILE_PRIORITY['Normal'] }, { id: 'high', - text: _('High Priority'), + text: _('High'), iconCls: 'icon-high', - filePriority: FILE_PRIORITY['High Priority'] - }, { - id: 'highest', - text: _('Highest Priority'), - iconCls: 'icon-highest', - filePriority: FILE_PRIORITY['Highest Priority'] + filePriority: FILE_PRIORITY['High'] }] });