Simplify _get_qt_args
This commit is contained in:
parent
1179d84ee8
commit
1dbd84b963
@ -159,16 +159,12 @@ class Application(QApplication):
|
|||||||
qt_args = ['style', 'stylesheet', 'widget-count', 'reverse',
|
qt_args = ['style', 'stylesheet', 'widget-count', 'reverse',
|
||||||
'qmljsdebugger']
|
'qmljsdebugger']
|
||||||
for argname in qt_args:
|
for argname in qt_args:
|
||||||
try:
|
val = getattr(namespace, 'qt_' + argname, None)
|
||||||
val = getattr(namespace, 'qt_' + argname)
|
if val is None:
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
if val is True:
|
|
||||||
argv.append('-' + argname)
|
|
||||||
elif val in [False, None]:
|
|
||||||
# flag/argument not given
|
# flag/argument not given
|
||||||
pass
|
continue
|
||||||
|
elif val is True:
|
||||||
|
argv.append('-' + argname)
|
||||||
else:
|
else:
|
||||||
argv.append('-' + argname)
|
argv.append('-' + argname)
|
||||||
argv.append(val)
|
argv.append(val)
|
||||||
|
@ -49,6 +49,11 @@ def _parse_args():
|
|||||||
debug.add_argument('--harfbuzz', choices=['old', 'new', 'system', 'auto'],
|
debug.add_argument('--harfbuzz', choices=['old', 'new', 'system', 'auto'],
|
||||||
default='auto', help="HarfBuzz engine version to use. "
|
default='auto', help="HarfBuzz engine version to use. "
|
||||||
"Default: auto.")
|
"Default: auto.")
|
||||||
|
# Some notes on the Qt options:
|
||||||
|
# - If a new option is added, it also needs to be added to _get_qt_args in
|
||||||
|
# app.py.
|
||||||
|
# - We use store_const with const=True rather than store_true because we
|
||||||
|
# want the default to be None.
|
||||||
debug.add_argument('--qt-style', help="Set the Qt GUI style to use.",
|
debug.add_argument('--qt-style', help="Set the Qt GUI style to use.",
|
||||||
metavar='STYLE')
|
metavar='STYLE')
|
||||||
debug.add_argument('--qt-stylesheet', help="Override the Qt application "
|
debug.add_argument('--qt-stylesheet', help="Override the Qt application "
|
||||||
@ -56,9 +61,10 @@ def _parse_args():
|
|||||||
debug.add_argument('--qt-widget-count', help="Print debug message at the "
|
debug.add_argument('--qt-widget-count', help="Print debug message at the "
|
||||||
"end about number of widgets left undestroyed and "
|
"end about number of widgets left undestroyed and "
|
||||||
"maximum number of widgets existed at the same time.",
|
"maximum number of widgets existed at the same time.",
|
||||||
action='store_true')
|
action='store_const', const=True)
|
||||||
debug.add_argument('--qt-reverse', help="Set the application's layout "
|
debug.add_argument('--qt-reverse', help="Set the application's layout "
|
||||||
"direction to right-to-left.", action='store_true')
|
"direction to right-to-left.", action='store_const',
|
||||||
|
const=True)
|
||||||
debug.add_argument('--qt-qmljsdebugger', help="Activate the QML/JS "
|
debug.add_argument('--qt-qmljsdebugger', help="Activate the QML/JS "
|
||||||
"debugger with a specified port. 'block' is optional "
|
"debugger with a specified port. 'block' is optional "
|
||||||
"and will make the application wait until a debugger "
|
"and will make the application wait until a debugger "
|
||||||
|
Loading…
Reference in New Issue
Block a user