Remove --qt-* arguments
This commit is contained in:
parent
f75f45addc
commit
9ff3f6810a
@ -112,26 +112,10 @@ def get_argparser():
|
|||||||
"temporary basedir.")
|
"temporary basedir.")
|
||||||
debug.add_argument('--no-err-windows', action='store_true', help="Don't "
|
debug.add_argument('--no-err-windows', action='store_true', help="Don't "
|
||||||
"show any error windows (used for tests/smoke.py).")
|
"show any error windows (used for tests/smoke.py).")
|
||||||
# For the Qt args, we use store_const with const=True rather than
|
debug.add_argument('--qt-arg', help="Pass an argument with a value to Qt.",
|
||||||
# store_true because we want the default to be None, to make
|
nargs=2)
|
||||||
# utils.qt:get_args easier.
|
debug.add_argument('--qt-flag', help="Pass a argument to Qt as flag.",
|
||||||
debug.add_argument('--qt-name', help="Set the window name.",
|
nargs=1)
|
||||||
metavar='NAME')
|
|
||||||
debug.add_argument('--qt-style', help="Set the Qt GUI style to use.",
|
|
||||||
metavar='STYLE')
|
|
||||||
debug.add_argument('--qt-stylesheet', help="Override the Qt application "
|
|
||||||
"stylesheet.", metavar='STYLESHEET')
|
|
||||||
debug.add_argument('--qt-widgetcount', help="Print debug message at the "
|
|
||||||
"end about number of widgets left undestroyed and "
|
|
||||||
"maximum number of widgets existed at the same time.",
|
|
||||||
action='store_const', const=True)
|
|
||||||
debug.add_argument('--qt-reverse', help="Set the application's layout "
|
|
||||||
"direction to right-to-left.", action='store_const',
|
|
||||||
const=True)
|
|
||||||
debug.add_argument('--qt-qmljsdebugger', help="Activate the QML/JS "
|
|
||||||
"debugger with a specified port. 'block' is optional "
|
|
||||||
"and will make the application wait until a debugger "
|
|
||||||
"connects to it.", metavar='port:PORT[,block]')
|
|
||||||
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
parser.add_argument('command', nargs='*', help="Commands to execute on "
|
||||||
"startup.", metavar=':command')
|
"startup.", metavar=':command')
|
||||||
# URLs will actually be in command
|
# URLs will actually be in command
|
||||||
|
@ -129,17 +129,11 @@ def get_args(namespace):
|
|||||||
The argv list to be passed to Qt.
|
The argv list to be passed to Qt.
|
||||||
"""
|
"""
|
||||||
argv = [sys.argv[0]]
|
argv = [sys.argv[0]]
|
||||||
for argname, val in vars(namespace).items():
|
if namespace.qt_flag is not None:
|
||||||
if not argname.startswith('qt_'):
|
argv.append('-' + namespace.qt_flag[0])
|
||||||
continue
|
if namespace.qt_arg is not None:
|
||||||
elif val is None:
|
argv.append('-' + namespace.qt_arg[0])
|
||||||
# flag/argument not given
|
argv.append(namespace.qt_arg[1])
|
||||||
continue
|
|
||||||
elif val is True:
|
|
||||||
argv.append('-' + argname[3:])
|
|
||||||
else:
|
|
||||||
argv.append('-' + argname[3:])
|
|
||||||
argv.append(val)
|
|
||||||
return argv
|
return argv
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,9 +108,10 @@ class TestGetQtArgs:
|
|||||||
# No Qt arguments
|
# No Qt arguments
|
||||||
(['--debug'], [sys.argv[0]]),
|
(['--debug'], [sys.argv[0]]),
|
||||||
# Qt flag
|
# Qt flag
|
||||||
(['--debug', '--qt-reverse', '--nocolor'], [sys.argv[0], '-reverse']),
|
(['--debug', '--qt-flag', 'reverse'], [sys.argv[0], '-reverse']),
|
||||||
# Qt argument with value
|
# Qt argument with value
|
||||||
(['--qt-stylesheet', 'foo'], [sys.argv[0], '-stylesheet', 'foo']),
|
(['--qt-arg', 'stylesheet', 'foo'],
|
||||||
|
[sys.argv[0], '-stylesheet', 'foo']),
|
||||||
])
|
])
|
||||||
def test_qt_args(self, args, expected, parser):
|
def test_qt_args(self, args, expected, parser):
|
||||||
"""Test commandline with no Qt arguments given."""
|
"""Test commandline with no Qt arguments given."""
|
||||||
@ -119,7 +120,8 @@ class TestGetQtArgs:
|
|||||||
|
|
||||||
def test_qt_both(self, parser):
|
def test_qt_both(self, parser):
|
||||||
"""Test commandline with a Qt argument and flag."""
|
"""Test commandline with a Qt argument and flag."""
|
||||||
args = parser.parse_args(['--qt-stylesheet', 'foobar', '--qt-reverse'])
|
args = parser.parse_args(['--qt-arg', 'stylesheet',
|
||||||
|
'foobar', '--qt-flag', 'reverse'])
|
||||||
qt_args = qtutils.get_args(args)
|
qt_args = qtutils.get_args(args)
|
||||||
assert qt_args[0] == sys.argv[0]
|
assert qt_args[0] == sys.argv[0]
|
||||||
assert '-reverse' in qt_args
|
assert '-reverse' in qt_args
|
||||||
|
Loading…
Reference in New Issue
Block a user