82
82
self.quitting = False
83
83
self.loading = True
84
(self.options, self.args) = self.get_options().parse_args()
86
(self.options, self.args) = self.get_options().parse_args()
87
except UnicodeDecodeError:
88
(self.options, self.args) = self.get_options(unicode_bug_happened=True).parse_args()
86
90
if self.options.ShowVersion:
422
426
logfile.setFormatter(formatter)
423
427
logging.getLogger("").addHandler(logfile)
425
def get_options(self):
429
def get_options(self, unicode_bug_happened=False):
427
431
Get the options for exaile
429
433
from optparse import OptionParser, OptionGroup, IndentedHelpFormatter
431
class OverrideHelpFormatter(IndentedHelpFormatter):
433
Merely for translation purposes
435
def format_usage(self, usage):
436
return '%s\n' % usage
435
if unicode_bug_happened:
438
# Bug: https://bugs.launchpad.net/exaile/+bug/1154420
440
# For some locales, python doesn't merge the options and
441
# the headings and our translated text correctly. Unfortunately,
442
# there doesn't seem to be a good way to deal with the problem
443
# on Python 2.x . If we disable the usage/heading, at least
444
# the options will display, despite filling all the text as ???.
447
print >> sys.stderr, "exaile: Warning: Unicode error displaying --help, check locale settings"
449
class OverrideHelpFormatter(IndentedHelpFormatter):
450
def format_usage(self, usage):
452
def format_heading(self, heading):
455
class OverrideHelpFormatter(IndentedHelpFormatter):
457
Merely for translation purposes
459
def format_usage(self, usage):
460
return '%s\n' % usage
438
462
usage = _("Usage: exaile [OPTION]... [URI]")
439
463
optionlabel = _('Options') # Merely for translation purposes
440
464
p = OptionParser(usage=usage, add_help_option=False,