mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround bug in optparse that causes it to not handle unicode group names
This commit is contained in:
parent
00eca123da
commit
691783ef37
@ -8,7 +8,7 @@ Manage application-wide preferences.
|
||||
'''
|
||||
import os, cPickle, base64, datetime, json, plistlib
|
||||
from copy import deepcopy
|
||||
from optparse import OptionParser as _OptionParser
|
||||
from optparse import OptionParser as _OptionParser, OptionGroup
|
||||
from optparse import IndentedHelpFormatter
|
||||
|
||||
from calibre.constants import (config_dir, CONFIG_DIR_MODE, __appname__,
|
||||
@ -159,6 +159,10 @@ class OptionParser(_OptionParser):
|
||||
upper.__dict__[dest] == opt.default:
|
||||
upper.__dict__[dest] = lower.__dict__[dest]
|
||||
|
||||
def add_option_group(self, *args, **kwargs):
|
||||
if isinstance(args[0], type(u'')):
|
||||
args = [OptionGroup(self, *args, **kwargs)] + list(args[1:])
|
||||
return _OptionParser.add_option_group(self, *args, **kwargs)
|
||||
|
||||
class DynamicConfig(dict):
|
||||
'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user