1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-01-01 19:41:18 +01:00

feat(generate_cli): added support for property and qproperty setter

This commit is contained in:
2024-09-06 15:55:17 +02:00
parent 6731b655e7
commit a52182dca9
2 changed files with 27 additions and 5 deletions

View File

@@ -86,10 +86,15 @@ class BECWidgetsCLIServer:
return obj
def run_rpc(self, obj, method, args, kwargs):
logger.debug(f"Running RPC instruction: {method} with args: {args}, kwargs: {kwargs}")
method_obj = getattr(obj, method)
# check if the method accepts args and kwargs
if not callable(method_obj):
res = method_obj
if not args:
res = method_obj
else:
setattr(obj, method, args[0])
res = None
else:
sig = inspect.signature(method_obj)
if sig.parameters:
@@ -245,5 +250,5 @@ def main():
if __name__ == "__main__": # pragma: no cover
sys.argv = ["bec_widgets.cli.server", "--id", "test", "--gui_class", "BECDockArea"]
sys.argv = ["bec_widgets.cli.server", "--id", "e2860", "--gui_class", "BECDockArea"]
main()