Ticket #259: country-name-tooltip-in-peers-tab.patch

File country-name-tooltip-in-peers-tab.patch, 17.3 KB (added by Plisk, 15 years ago)

Patch to show countries in a tooltip

  • deluge/i18n/POTFILES.in

     
    1212deluge/ui/gtkui/glade/queuedtorrents.glade 
    1313deluge/ui/gtkui/glade/move_storage_dialog.glade 
    1414deluge/ui/gtkui/glade/connection_manager.glade 
    15 deluge/ui/gtkui/glade/wizard.glade 
    1615deluge/ui/gtkui/glade/create_torrent_dialog.glade 
    1716deluge/ui/gtkui/glade/dgtkpopups.glade 
    1817deluge/ui/gtkui/glade/tray_menu.glade 
     
    2221deluge/core/autoadd.py 
    2322deluge/core/preferencesmanager.py 
    2423deluge/core/filtermanager.py 
    25 deluge/core/signalmanager.py 
    2624deluge/core/torrentmanager.py 
    2725deluge/core/daemon.py 
    2826deluge/core/torrent.py 
     
    3331deluge/core/alertmanager.py 
    3432deluge/core/rpcserver.py 
    3533deluge/config.py 
     34deluge/countries.py 
    3635deluge/metafile.py 
    3736deluge/pluginmanagerbase.py 
    38 deluge/SimpleXMLRPCServer.py 
    3937deluge/plugins/label/label/webui.py 
    4038deluge/plugins/label/label/test.py 
    4139deluge/plugins/label/label/gtkui/label_config.py 
    4240deluge/plugins/label/label/gtkui/sidebar_menu.py 
    4341deluge/plugins/label/label/gtkui/submenu.py 
    44 deluge/plugins/label/label/gtkui/ui.py 
    4542deluge/plugins/label/label/gtkui/__init__.py 
    4643deluge/plugins/label/label/__init__.py 
    4744deluge/plugins/label/label/core.py 
    4845deluge/plugins/label/setup.py 
    49 deluge/plugins/corepluginbase.py 
     46deluge/plugins/pluginbase.py 
    5047deluge/plugins/init.py 
    5148deluge/plugins/blocklist/setup.py 
    5249deluge/plugins/blocklist/blocklist/webui.py 
    5350deluge/plugins/blocklist/blocklist/gtkui.py 
    54 deluge/plugins/blocklist/blocklist/ui.py 
    5551deluge/plugins/blocklist/blocklist/text.py 
    5652deluge/plugins/blocklist/blocklist/peerguardian.py 
    5753deluge/plugins/blocklist/blocklist/__init__.py 
    5854deluge/plugins/blocklist/blocklist/core.py 
    59 deluge/plugins/coreclient.py 
    6055deluge/plugins/__init__.py 
    6156deluge/plugins/webuipluginbase.py 
    6257deluge/plugins/stats/setup.py 
     
    7166deluge/ui/tracker_icons.py 
    7267deluge/ui/client.py 
    7368deluge/ui/ui.py 
    74 deluge/ui/console/mapping.py 
    7569deluge/ui/console/colors.py 
    7670deluge/ui/console/commands/resume.py 
    7771deluge/ui/console/commands/config.py 
     
    9286deluge/ui/gtkui/statusbar.py 
    9387deluge/ui/gtkui/status_tab.py 
    9488deluge/ui/gtkui/addtorrentdialog.py 
    95 deluge/ui/gtkui/coreconfig.py 
    9689deluge/ui/gtkui/sidebar.py 
    9790deluge/ui/gtkui/gtkui.py 
    9891deluge/ui/gtkui/aboutdialog.py 
    9992deluge/ui/gtkui/systemtray.py 
    100 deluge/ui/gtkui/dbusinterface.py 
    10193deluge/ui/gtkui/files_tab.py 
    10294deluge/ui/gtkui/menubar.py 
    10395deluge/ui/gtkui/peers_tab.py 
     
    110102deluge/ui/gtkui/mainwindow.py 
    111103deluge/ui/gtkui/removetorrentdialog.py 
    112104deluge/ui/gtkui/common.py 
    113 deluge/ui/gtkui/signals.py 
    114105deluge/ui/gtkui/torrentdetails.py 
    115106deluge/ui/gtkui/__init__.py 
    116107deluge/ui/gtkui/edittrackersdialog.py 
     
    120111deluge/ui/gtkui/connectionmanager.py 
    121112deluge/ui/gtkui/createtorrentdialog.py 
    122113deluge/ui/gtkui/details_tab.py 
    123 deluge/ui/signalreceiver.py 
    124114deluge/ui/common.py 
    125115deluge/ui/__init__.py 
    126 deluge/ui/webui/components.py 
    127 deluge/ui/webui/render.py 
    128 deluge/ui/webui/page_decorators.py 
    129 deluge/ui/webui/webui.py 
    130 deluge/ui/webui/debugerror.py 
    131 deluge/ui/webui/webserver_common.py 
    132 deluge/ui/webui/config_forms.py 
    133 deluge/ui/webui/deluge_webserver.py 
    134 deluge/ui/webui/json_api.py 
    135 deluge/ui/webui/register_menu.py 
    136 deluge/ui/webui/config_tabs_deluge.py 
    137 deluge/ui/webui/lib/webpy022/request.py 
    138 deluge/ui/webui/lib/webpy022/wsgiserver/__init__.py 
    139 deluge/ui/webui/lib/webpy022/db.py 
    140 deluge/ui/webui/lib/webpy022/template.py 
    141 deluge/ui/webui/lib/webpy022/cheetah.py 
    142 deluge/ui/webui/lib/webpy022/debugerror.py 
    143 deluge/ui/webui/lib/webpy022/http.py 
    144 deluge/ui/webui/lib/webpy022/httpserver.py 
    145 deluge/ui/webui/lib/webpy022/utils.py 
    146 deluge/ui/webui/lib/webpy022/__init__.py 
    147 deluge/ui/webui/lib/webpy022/net.py 
    148 deluge/ui/webui/lib/webpy022/wsgi.py 
    149 deluge/ui/webui/lib/webpy022/webapi.py 
    150 deluge/ui/webui/lib/webpy022/form.py 
    151 deluge/ui/webui/lib/json.py 
    152 deluge/ui/webui/lib/newforms_plus.py 
    153 deluge/ui/webui/lib/egg_render.py 
    154 deluge/ui/webui/lib/static_handler.py 
    155 deluge/ui/webui/lib/__init__.py 
    156 deluge/ui/webui/lib/web.py 
    157 deluge/ui/webui/lib/newforms_portable/django/core/__init__.py 
    158 deluge/ui/webui/lib/newforms_portable/django/core/exceptions.py 
    159 deluge/ui/webui/lib/newforms_portable/django/utils/html.py 
    160 deluge/ui/webui/lib/newforms_portable/django/utils/http.py 
    161 deluge/ui/webui/lib/newforms_portable/django/utils/encoding.py 
    162 deluge/ui/webui/lib/newforms_portable/django/utils/translation.py 
    163 deluge/ui/webui/lib/newforms_portable/django/utils/safestring.py 
    164 deluge/ui/webui/lib/newforms_portable/django/utils/__init__.py 
    165 deluge/ui/webui/lib/newforms_portable/django/utils/datastructures.py 
    166 deluge/ui/webui/lib/newforms_portable/django/utils/functional.py 
    167 deluge/ui/webui/lib/newforms_portable/django/__init__.py 
    168 deluge/ui/webui/lib/newforms_portable/forms.py 
    169 deluge/ui/webui/lib/newforms_portable/models.py 
    170 deluge/ui/webui/lib/newforms_portable/widgets.py 
    171 deluge/ui/webui/lib/newforms_portable/fields.py 
    172 deluge/ui/webui/lib/newforms_portable/__init__.py 
    173 deluge/ui/webui/lib/newforms_portable/util.py 
    174 deluge/ui/webui/lib/egg_handler.py 
    175 deluge/ui/webui/utils.py 
    176 deluge/ui/webui/pages.py 
    177 deluge/ui/webui/__init__.py 
    178 deluge/ui/webui/tests/test_all.py 
    179 deluge/ui/webui/apache.py 
    180 deluge/ui/webui/web.py 
    181 deluge/ui/webui/torrent_move.py 
    182 deluge/ui/webui/config_tabs_webui.py 
    183 deluge/ui/webui/torrent_options.py 
    184 deluge/ui/webui/torrent_add.py 
    185 deluge/ui/webui/scripts/template_strings.py 
    186 deluge/ui/webui/scripts/extract_ajax_strings.py 
    187 deluge/ui/webui/scripts/copy_icons.py 
    188 deluge/ui/webui/scripts/extract_template_strings.py 
     116deluge/ui/web/auth.py 
     117deluge/ui/web/common.py 
     118deluge/ui/web/gen_gettext.py 
     119deluge/ui/web/__init__.py 
     120deluge/ui/web/json_api.py 
     121deluge/ui/web/pluginmanager.py 
     122deluge/ui/web/server.py 
     123deluge/ui/web/web.py 
    189124deluge/common.py 
    190125deluge/component.py 
    191126deluge/main.py 
     
    198133deluge/tests/test_stats.py 
    199134deluge/tests/test_client.py 
    200135deluge/log.py 
    201 deluge/xmlrpclib.py 
    202136deluge/scripts/deluge_remote.py 
    203137deluge/scripts/wiki_docgen.py 
    204138deluge/scripts/create_plugin.py 
  • deluge/countries.py

     
     1# 
     2# countries.py 
     3# 
     4# **** copyright placeholder **** 
     5# 
     6# Deluge is free software. 
     7# 
     8# You may redistribute it and/or modify it under the terms of the 
     9# GNU General Public License, as published by the Free Software 
     10# Foundation; either version 3 of the License, or (at your option) 
     11# any later version. 
     12# 
     13# deluge is distributed in the hope that it will be useful, 
     14# but WITHOUT ANY WARRANTY; without even the implied warranty of 
     15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
     16# See the GNU General Public License for more details. 
     17# 
     18# You should have received a copy of the GNU General Public License 
     19# along with deluge.    If not, write to: 
     20#     The Free Software Foundation, Inc., 
     21#     51 Franklin Street, Fifth Floor 
     22#     Boston, MA    02110-1301, USA. 
     23# 
     24 
     25# ISO 3166-1 country names and codes 
     26COUNTRIES = { 
     27    'AF': _('Afghanistan'),  
     28    'AX': _('Aland Islands'),  
     29    'AL': _('Albania'),  
     30    'DZ': _('Algeria'),  
     31    'AS': _('American Samoa'),  
     32    'AD': _('Andorra'),  
     33    'AO': _('Angola'),  
     34    'AI': _('Anguilla'),  
     35    'AQ': _('Antarctica'),  
     36    'AG': _('Antigua and Barbuda'),  
     37    'AR': _('Argentina'),  
     38    'AM': _('Armenia'),  
     39    'AW': _('Aruba'),  
     40    'AU': _('Australia'),  
     41    'AT': _('Austria'),  
     42    'AZ': _('Azerbaijan'),  
     43    'BS': _('Bahamas'),  
     44    'BH': _('Bahrain'),  
     45    'BD': _('Bangladesh'),  
     46    'BB': _('Barbados'),  
     47    'BY': _('Belarus'),  
     48    'BE': _('Belgium'),  
     49    'BZ': _('Belize'),  
     50    'BJ': _('Benin'),  
     51    'BM': _('Bermuda'),  
     52    'BT': _('Bhutan'),  
     53    'BO': _('Bolivia'),  
     54    'BA': _('Bosnia and Herzegovina'),  
     55    'BW': _('Botswana'),  
     56    'BV': _('Bouvet Island'),  
     57    'BR': _('Brazil'),  
     58    'IO': _('British Indian Ocean Territory'),  
     59    'BN': _('Brunei Darussalam'),  
     60    'BG': _('Bulgaria'),  
     61    'BF': _('Burkina Faso'),  
     62    'BI': _('Burundi'),  
     63    'KH': _('Cambodia'),  
     64    'CM': _('Cameroon'),  
     65    'CA': _('Canada'),  
     66    'CV': _('Cape Verde'),  
     67    'KY': _('Cayman Islands'),  
     68    'CF': _('Central African Republic'),  
     69    'TD': _('Chad'),  
     70    'CL': _('Chile'),  
     71    'CN': _('China'),  
     72    'CX': _('Christmas Island'),  
     73    'CC': _('Cocos (Keeling) Islands'),  
     74    'CO': _('Colombia'),  
     75    'KM': _('Comoros'),  
     76    'CG': _('Congo'),  
     77    'CD': _('Congo, The Democratic Republic of the'),  
     78    'CK': _('Cook Islands'),  
     79    'CR': _('Costa Rica'),  
     80    'CI': _('Cote d\'Ivoire'),  
     81    'HR': _('Croatia'),  
     82    'CU': _('Cuba'),  
     83    'CY': _('Cyprus'),  
     84    'CZ': _('Czech Republic'),  
     85    'DK': _('Denmark'),  
     86    'DJ': _('Djibouti'),  
     87    'DM': _('Dominica'),  
     88    'DO': _('Dominican Republic'),  
     89    'EC': _('Ecuador'),  
     90    'EG': _('Egypt'),  
     91    'SV': _('El Salvador'),  
     92    'GQ': _('Equatorial Guinea'),  
     93    'ER': _('Eritrea'),  
     94    'EE': _('Estonia'),  
     95    'ET': _('Ethiopia'),  
     96    'FK': _('Falkland Islands (Malvinas)'),  
     97    'FO': _('Faroe Islands'),  
     98    'FJ': _('Fiji'),  
     99    'FI': _('Finland'),  
     100    'FR': _('France'),  
     101    'GF': _('French Guiana'),  
     102    'PF': _('French Polynesia'),  
     103    'TF': _('French Southern Territories'),  
     104    'GA': _('Gabon'),  
     105    'GM': _('Gambia'),  
     106    'GE': _('Georgia'),  
     107    'DE': _('Germany'),  
     108    'GB': _('United Kingdom'),  
     109    'GH': _('Ghana'),  
     110    'GI': _('Gibraltar'),  
     111    'GR': _('Greece'),  
     112    'GL': _('Greenland'),  
     113    'GD': _('Grenada'),  
     114    'GP': _('Guadeloupe'),  
     115    'GU': _('Guam'),  
     116    'GT': _('Guatemala'),  
     117    'GG': _('Guernsey'),  
     118    'GN': _('Guinea'),  
     119    'GW': _('Guinea-Bissau'),  
     120    'GY': _('Guyana'),  
     121    'HT': _('Haiti'),  
     122    'HM': _('Heard Island and McDonald Islands'),  
     123    'VA': _('Holy See (Vatican City State)'),  
     124    'HN': _('Honduras'),  
     125    'HK': _('Hong Kong'),  
     126    'HU': _('Hungary'),  
     127    'IS': _('Iceland'),  
     128    'IN': _('India'),  
     129    'ID': _('Indonesia'),  
     130    'IR': _('Iran, Islamic Republic of'),  
     131    'IQ': _('Iraq'),  
     132    'IE': _('Ireland'),  
     133    'IM': _('Isle of Man'),  
     134    'IL': _('Israel'),  
     135    'IT': _('Italy'),  
     136    'JM': _('Jamaica'),  
     137    'JP': _('Japan'),  
     138    'JE': _('Jersey'),  
     139    'JO': _('Jordan'),  
     140    'KZ': _('Kazakhstan'),  
     141    'KE': _('Kenya'),  
     142    'KI': _('Kiribati'),  
     143    'KP': _('Korea, Democratic People\'s Republic of'),  
     144    'KR': _('Korea, Republic of'),  
     145    'KW': _('Kuwait'),  
     146    'KG': _('Kyrgyzstan'),  
     147    'LA': _('Lao People\'s Democratic Republic'),  
     148    'LV': _('Latvia'),  
     149    'LB': _('Lebanon'),  
     150    'LS': _('Lesotho'),  
     151    'LR': _('Liberia'),  
     152    'LY': _('Libyan Arab Jamahiriya'),  
     153    'LI': _('Liechtenstein'),  
     154    'LT': _('Lithuania'),  
     155    'LU': _('Luxembourg'),  
     156    'MO': _('Macao'),  
     157    'MK': _('Macedonia, The Former Yugoslav Republic of'),  
     158    'MG': _('Madagascar'),  
     159    'MW': _('Malawi'),  
     160    'MY': _('Malaysia'),  
     161    'MV': _('Maldives'),  
     162    'ML': _('Mali'),  
     163    'MT': _('Malta'),  
     164    'MH': _('Marshall Islands'),  
     165    'MQ': _('Martinique'),  
     166    'MR': _('Mauritania'),  
     167    'MU': _('Mauritius'),  
     168    'YT': _('Mayotte'),  
     169    'MX': _('Mexico'),  
     170    'FM': _('Micronesia, Federated States of'),  
     171    'MD': _('Moldova'),  
     172    'MC': _('Monaco'),  
     173    'MN': _('Mongolia'),  
     174    'ME': _('Montenegro'),  
     175    'MS': _('Montserrat'),  
     176    'MA': _('Morocco'),  
     177    'MZ': _('Mozambique'),  
     178    'MM': _('Myanmar'),  
     179    'NA': _('Namibia'),  
     180    'NR': _('Nauru'),  
     181    'NP': _('Nepal'),  
     182    'NL': _('Netherlands'),  
     183    'AN': _('Netherlands Antilles'),  
     184    'NC': _('New Caledonia'),  
     185    'NZ': _('New Zealand'),  
     186    'NI': _('Nicaragua'),  
     187    'NE': _('Niger'),  
     188    'NG': _('Nigeria'),  
     189    'NU': _('Niue'),  
     190    'NF': _('Norfolk Island'),  
     191    'MP': _('Northern Mariana Islands'),  
     192    'NO': _('Norway'),  
     193    'OM': _('Oman'),  
     194    'PK': _('Pakistan'),  
     195    'PW': _('Palau'),  
     196    'PS': _('Palestinian Territory, Occupied'),  
     197    'PA': _('Panama'),  
     198    'PG': _('Papua New Guinea'),  
     199    'PY': _('Paraguay'),  
     200    'PE': _('Peru'),  
     201    'PH': _('Philippines'),  
     202    'PN': _('Pitcairn'),  
     203    'PL': _('Poland'),  
     204    'PT': _('Portugal'),  
     205    'PR': _('Puerto Rico'),  
     206    'QA': _('Qatar'),  
     207    'RE': _('Reunion'),  
     208    'RO': _('Romania'),  
     209    'RU': _('Russian Federation'),  
     210    'RW': _('Rwanda'),  
     211    'BL': _('Saint Barthelemy'),  
     212    'SH': _('Saint Helena'),  
     213    'KN': _('Saint Kitts and Nevis'),  
     214    'LC': _('Saint Lucia'),  
     215    'MF': _('Saint Martin'),  
     216    'PM': _('Saint Pierre and Miquelon'),  
     217    'VC': _('Saint Vincent and the Grenadines'),  
     218    'WS': _('Samoa'),  
     219    'SM': _('San Marino'),  
     220    'ST': _('Sao Tome and Principe'),  
     221    'SA': _('Saudi Arabia'),  
     222    'SN': _('Senegal'),  
     223    'RS': _('Serbia'),  
     224    'SC': _('Seychelles'),  
     225    'SL': _('Sierra Leone'),  
     226    'SG': _('Singapore'),  
     227    'SK': _('Slovakia'),  
     228    'SI': _('Slovenia'),  
     229    'SB': _('Solomon Islands'),  
     230    'SO': _('Somalia'),  
     231    'ZA': _('South Africa'),  
     232    'GS': _('South Georgia and the South Sandwich Islands'),  
     233    'ES': _('Spain'),  
     234    'LK': _('Sri Lanka'),  
     235    'SD': _('Sudan'),  
     236    'SR': _('Suriname'),  
     237    'SJ': _('Svalbard and Jan Mayen'),  
     238    'SZ': _('Swaziland'),  
     239    'SE': _('Sweden'),  
     240    'CH': _('Switzerland'),  
     241    'SY': _('Syrian Arab Republic'),  
     242    'TW': _('Taiwan, Province of China'),  
     243    'TJ': _('Tajikistan'),  
     244    'TZ': _('Tanzania, United Republic of'),  
     245    'TH': _('Thailand'),  
     246    'TL': _('Timor-Leste'),  
     247    'TG': _('Togo'),  
     248    'TK': _('Tokelau'),  
     249    'TO': _('Tonga'),  
     250    'TT': _('Trinidad and Tobago'),  
     251    'TN': _('Tunisia'),  
     252    'TR': _('Turkey'),  
     253    'TM': _('Turkmenistan'),  
     254    'TC': _('Turks and Caicos Islands'),  
     255    'TV': _('Tuvalu'),  
     256    'UG': _('Uganda'),  
     257    'UA': _('Ukraine'),  
     258    'AE': _('United Arab Emirates'),  
     259    'GB': _('United Kingdom'),  
     260    'US': _('United States'),  
     261    'UM': _('United States Minor Outlying Islands'),  
     262    'UY': _('Uruguay'),  
     263    'UZ': _('Uzbekistan'),  
     264    'VU': _('Vanuatu'),  
     265    'VE': _('Venezuela'),  
     266    'VN': _('Viet Nam'),  
     267    'VG': _('Virgin Islands, British'),  
     268    'VI': _('Virgin Islands, U.S.'),  
     269    'WF': _('Wallis and Futuna'),  
     270    'EH': _('Western Sahara'),  
     271    'YE': _('Yemen'),  
     272    'ZM': _('Zambia'),  
     273    'ZW': _('Zimbabwe'),  
     274} 
  • deluge/ui/gtkui/peers_tab.py

     
    3939from deluge.ui.gtkui.listview import cell_data_speed as cell_data_speed 
    4040from deluge.ui.gtkui.torrentdetails import Tab 
    4141from deluge.log import LOG as log 
     42from deluge.countries import COUNTRIES 
    4243 
    4344def cell_data_progress(column, cell, model, row, data): 
    4445    value = model.get_value(row, data) 
     
    5960            }) 
    6061 
    6162        self.listview = glade.get_widget("peers_listview") 
     63        self.listview.props.has_tooltip = True 
    6264        self.listview.connect("button-press-event", self._on_button_press_event) 
     65        self.listview.connect("query-tooltip", self._on_query_tooltip) 
    6366        # country pixbuf, ip, client, downspeed, upspeed, country code, int_ip, seed/peer icon, progress 
    6467        self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str, str, int, int, str, float, gtk.gdk.Pixbuf, float) 
    6568        self.cached_flag_pixbufs = {} 
     
    342345            self.peer_menu.popup(None, None, None, event.button, event.time) 
    343346            return True 
    344347 
     348    def _on_query_tooltip(self, widget, x, y, keyboard_tip, tooltip): 
     349        if not widget.get_tooltip_context(x, y, keyboard_tip): 
     350            return False 
     351        else: 
     352            model, path, iter = widget.get_tooltip_context(x, y, keyboard_tip) 
     353             
     354            country_code = model.get(iter, 5)[0] 
     355            if country_code != "  " and country_code in COUNTRIES: 
     356                tooltip.set_text(COUNTRIES[country_code]) 
     357                # widget here is self.listview 
     358                widget.set_tooltip_cell(tooltip, path, widget.get_column(0),  
     359                                        None) 
     360                return True 
     361            else: 
     362                return False 
     363 
    345364    def _on_menuitem_add_peer_activate(self, menuitem): 
    346365        """This is a callback for manually adding a peer""" 
    347366        log.debug("on_menuitem_add_peer") 
  • ChangeLog

     
    99  * Implemented a cross-platform IPC method thus removing the DBUS dependency 
    1010  * Implement a "True" Classic Mode where there is no longer a separate daemon process 
    1111  * Add preferences option "Add torrent in paused state" 
     12  * Show tooltip with country name in the peers tab   
    1213 
    1314==== WebUI ==== 
    1415  * Move over to using Twisted-Web for the webserver. 
    1516  * Move to only AJAX interface built upon Ext-JS. 
    1617 
     18==== Misc ==== 
     19 
     20  * PyGTK dependency bumped to => 2.12 to use new tooltip system 
     21 
    1722=== Deluge 1.1.0 - "Time gas!" (10 January 2009) === 
    1823==== Core ==== 
    1924  * Implement #79 ability to change outgoing port range 
  • README

     
    5151  Gtk: 
    5252    python-notify (libnotify python wrapper) 
    5353    pygame 
    54     pygtk >= 2.10 
     54    pygtk >= 2.12 
    5555    librsvg 
    5656    xdg-utils 
    5757    chardet