Ticket #719: deluge-1.1.0-national-flags.patch
File deluge-1.1.0-national-flags.patch, 7.3 KB (added by mtasaka, 14 years ago) |
---|
-
deluge-1.1.0/deluge/ui/gtkui/peers_tab.py
old new 45 45 cell.set_property("value", value * 100) 46 46 cell.set_property("text", "%.2f%%" % (value * 100)) 47 47 48 # Use national flags if national flags are installed 49 def use_national_flags(): 50 pixmap_dir = pkg_resources.resource_filename( 51 "deluge", os.path.join("data", "pixmaps", "flags")) 52 try: 53 pixmap_number = len(os.listdir(pixmap_dir)) 54 if pixmap_number > 3 : 55 return True 56 else : 57 return False 58 except OSError: 59 return False 60 48 61 class PeersTab(Tab): 49 62 def __init__(self): 50 63 Tab.__init__(self) … … 71 84 self.peers = {} 72 85 73 86 # Country column 74 column = gtk.TreeViewColumn() 75 render = gtk.CellRendererPixbuf() 76 column.pack_start(render, False) 77 column.add_attribute(render, "pixbuf", 0) 87 self.use_national_flags = use_national_flags() 88 if self.use_national_flags: 89 column = gtk.TreeViewColumn() 90 render = gtk.CellRendererPixbuf() 91 column.pack_start(render, False) 92 column.add_attribute(render, "pixbuf", 0) 93 else: 94 column = gtk.TreeViewColumn("Country") 95 render = gtk.CellRendererText() 96 column.pack_start(render, False) 97 column.add_attribute(render, "text", 5) 78 98 column.set_sort_column_id(5) 79 99 column.set_clickable(True) 80 100 column.set_resizable(True) … … 249 269 def get_flag_pixbuf(self, country): 250 270 if country == " ": 251 271 return None 272 if not self.use_national_flags : 273 return None 252 274 253 275 if not self.cached_flag_pixbufs.has_key(country): 254 276 # We haven't created a pixbuf for this country yet -
deluge-1.1.0/setup.py
old new 33 33 import msgfmt 34 34 import os 35 35 import platform 36 import sys 36 37 37 38 python_version = platform.python_version()[0:3] 38 39 … … 202 203 203 204 _ext_modules = [libtorrent] 204 205 206 # Some distribution has a policy that national flags cannot 207 # be installed. 208 # This part parses the argument --without-national-flags 209 # and if it is found set use_national_flags as False 210 # 211 use_national_flags = True 212 for argc in range(1, len(sys.argv)): 213 str = sys.argv[argc] 214 if str == '--without-national-flags' : 215 use_national_flags = False 216 # Remove this argument 217 del sys.argv[argc] 218 break 219 205 220 class build_trans(cmd.Command): 206 221 description = 'Compile .po files into .mo files' 207 222 … … 342 357 ('share/man/man1', ['deluge/docs/man/deluge.1', 'deluge/docs/man/deluged.1']) 343 358 ] 344 359 360 _package_data = [ 361 "ui/gtkui/glade/*.glade", 362 "data/pixmaps/*.png", 363 "data/pixmaps/*.svg", 364 "data/pixmaps/*.ico", 365 "data/revision", 366 "data/GeoIP.dat", 367 "plugins/*.egg", 368 "i18n/*.pot", 369 "i18n/*/LC_MESSAGES/*.mo", 370 "ui/webui/scripts/*", 371 "ui/webui/ssl/*", 372 "ui/webui/static/*.css", 373 "ui/webui/static/*.js", 374 "ui/webui/static/images/*.png", 375 "ui/webui/static/images/*.jpg", 376 "ui/webui/static/images/*.gif", 377 "ui/webui/static/images/16/*.png", 378 "ui/webui/templates/deluge/*", 379 "ui/webui/templates/classic/*", 380 "ui/webui/templates/white/*", 381 "ui/webui/templates/ajax/*.cfg", 382 "ui/webui/templates/ajax/*.js", 383 "ui/webui/templates/ajax/*.html", 384 "ui/webui/templates/ajax/*.css", 385 "ui/webui/templates/ajax/render/html/*.html", 386 "ui/webui/templates/ajax/render/js/*", 387 "ui/webui/templates/ajax/static/css/*.css", 388 "ui/webui/templates/ajax/static/icons/16/*.png", 389 "ui/webui/templates/ajax/static/icons/32/*.png", 390 "ui/webui/templates/ajax/static/images/*.gif", 391 "ui/webui/templates/ajax/static/js/*.js", 392 "ui/webui/templates/ajax/static/themes/classic/*.png", 393 "ui/webui/templates/ajax/static/themes/classic/*.css", 394 "ui/webui/templates/ajax/static/themes/classic/mime_icons/*.png", 395 "ui/webui/templates/ajax/static/themes/white/*.png", 396 "ui/webui/templates/ajax/static/themes/white/*.css", 397 "ui/webui/templates/ajax/static/themes/white/mime_icons/*.png", 398 ] 399 if use_national_flags : 400 _package_data.append("data/pixmaps/flags/*.png") 401 345 402 # Main setup 346 403 setup( 347 404 author = "Andrew Resch, Marcos Pinto, Martijn Voncken, Damien Churchill", … … 365 422 include_package_data = True, 366 423 license = "GPLv3", 367 424 name = "deluge", 368 package_data = {"deluge": ["ui/gtkui/glade/*.glade", 369 "data/pixmaps/*.png", 370 "data/pixmaps/*.svg", 371 "data/pixmaps/*.ico", 372 "data/pixmaps/flags/*.png", 373 "data/revision", 374 "data/GeoIP.dat", 375 "plugins/*.egg", 376 "i18n/*.pot", 377 "i18n/*/LC_MESSAGES/*.mo", 378 "ui/webui/scripts/*", 379 "ui/webui/ssl/*", 380 "ui/webui/static/*.css", 381 "ui/webui/static/*.js", 382 "ui/webui/static/images/*.png", 383 "ui/webui/static/images/*.jpg", 384 "ui/webui/static/images/*.gif", 385 "ui/webui/static/images/16/*.png", 386 "ui/webui/templates/deluge/*", 387 "ui/webui/templates/classic/*", 388 "ui/webui/templates/white/*", 389 "ui/webui/templates/ajax/*.cfg", 390 "ui/webui/templates/ajax/*.js", 391 "ui/webui/templates/ajax/*.html", 392 "ui/webui/templates/ajax/*.css", 393 "ui/webui/templates/ajax/render/html/*.html", 394 "ui/webui/templates/ajax/render/js/*", 395 "ui/webui/templates/ajax/static/css/*.css", 396 "ui/webui/templates/ajax/static/icons/16/*.png", 397 "ui/webui/templates/ajax/static/icons/32/*.png", 398 "ui/webui/templates/ajax/static/images/*.gif", 399 "ui/webui/templates/ajax/static/js/*.js", 400 "ui/webui/templates/ajax/static/themes/classic/*.png", 401 "ui/webui/templates/ajax/static/themes/classic/*.css", 402 "ui/webui/templates/ajax/static/themes/classic/mime_icons/*.png", 403 "ui/webui/templates/ajax/static/themes/white/*.png", 404 "ui/webui/templates/ajax/static/themes/white/*.css", 405 "ui/webui/templates/ajax/static/themes/white/mime_icons/*.png", 406 ]}, 425 package_data = {"deluge": _package_data}, 407 426 packages = find_packages(exclude=["plugins"]), 408 427 url = "http://deluge-torrent.org", 409 428 version = "1.1.0",