From b3140283cc0cc78c0b0d70670b965734a8be95a4 Mon Sep 17 00:00:00 2001 From: Ernesto Corbellini Date: Wed, 6 Nov 2024 11:08:39 +0100 Subject: [PATCH 1/3] Always allow ROS arguments --- qt_gui/src/qt_gui/main.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/qt_gui/src/qt_gui/main.py b/qt_gui/src/qt_gui/main.py index c5c246e7..02b990f6 100755 --- a/qt_gui/src/qt_gui/main.py +++ b/qt_gui/src/qt_gui/main.py @@ -270,14 +270,6 @@ def main(self, argv=None, standalone=None, plugin_argument_provider=None, # check option dependencies try: - if self._options.plugin_args and \ - not self._options.standalone_plugin and \ - not self._options.command_start_plugin and \ - not self._options.embed_plugin: - raise RuntimeError( - 'Option --args can only be used together with either --standalone, ' - '--command-start-plugin or --embed-plugin option') - if self._options.freeze_layout and not self._options.lock_perspective: raise RuntimeError( 'Option --freeze_layout can only be used together with the ' From 1a0b1ac8879b95175523bc19b8e11a3e7e3c8780 Mon Sep 17 00:00:00 2001 From: Ernesto Corbellini Date: Wed, 6 Nov 2024 15:26:37 +0100 Subject: [PATCH 2/3] Allow passing plugin args in standalone mode --- qt_gui/src/qt_gui/main.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/qt_gui/src/qt_gui/main.py b/qt_gui/src/qt_gui/main.py index 02b990f6..cc37253e 100755 --- a/qt_gui/src/qt_gui/main.py +++ b/qt_gui/src/qt_gui/main.py @@ -122,13 +122,13 @@ def add_arguments(self, parser, standalone=False, plugin_argument_provider=None) '-v', '--verbose', dest='verbose', default=False, action='store_true', help='output qDebug messages') - if not standalone: - common_group.add_argument( - '--args', dest='plugin_args', nargs='*', type=str, - help='arbitrary arguments which are passes to the plugin ' - '(only with -s, --command-start-plugin or --embed-plugin). ' - 'It must be the last option since it collects all following options.') + common_group.add_argument( + '--args', dest='plugin_args', nargs='*', type=str, + help='arbitrary arguments which are passes to the plugin ' + '(only with -s, --command-start-plugin or --embed-plugin). ' + 'It must be the last option since it collects all following options.') + if not standalone: group = parser.add_argument_group( 'Options to query information without starting a GUI instance', 'These options can be used to query information about valid arguments for various ' @@ -232,12 +232,11 @@ def main(self, argv=None, standalone=None, plugin_argument_provider=None, arguments = argv[1:] # extract plugin specific args when not being invoked in standalone mode programmatically - if not standalone: - plugin_args = [] - if '--args' in arguments: - index = arguments.index('--args') - plugin_args = arguments[index + 1:] - arguments = arguments[0:index + 1] + plugin_args = [] + if '--args' in arguments: + index = arguments.index('--args') + plugin_args = arguments[index + 1:] + arguments = arguments[0:index + 1] parser = ArgumentParser(os.path.basename(Main.main_filename), add_help=False) self.add_arguments(parser, standalone=bool(standalone), From 54697627831adc502be14d14dc2152307d986f6b Mon Sep 17 00:00:00 2001 From: Ernesto Corbellini Date: Thu, 7 Nov 2024 10:55:50 +0100 Subject: [PATCH 3/3] Fix indentation --- qt_gui/src/qt_gui/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt_gui/src/qt_gui/main.py b/qt_gui/src/qt_gui/main.py index cc37253e..d1995947 100755 --- a/qt_gui/src/qt_gui/main.py +++ b/qt_gui/src/qt_gui/main.py @@ -125,8 +125,8 @@ def add_arguments(self, parser, standalone=False, plugin_argument_provider=None) common_group.add_argument( '--args', dest='plugin_args', nargs='*', type=str, help='arbitrary arguments which are passes to the plugin ' - '(only with -s, --command-start-plugin or --embed-plugin). ' - 'It must be the last option since it collects all following options.') + '(only with -s, --command-start-plugin or --embed-plugin). ' + 'It must be the last option since it collects all following options.') if not standalone: group = parser.add_argument_group(