rawpython / remi

Python REMote Interface library. Platform independent. In about 100 Kbytes, perfect for your diet.
Apache License 2.0
3.51k stars 401 forks source link

Problem with Cancel button of GenericDialog? #504

Closed WC802 closed 1 year ago

WC802 commented 1 year ago

Hi! I've been trying to use the GenericDialog function but when clicking the Cancel button the following error appears: 'NoneType' object has no attribute 'set_root_widget'. Reading the function this seems to come from this lines: self._base_app_instance = None

self._old_root_widget = None

I don't know if I'm using it wrong. Thank you very much.

dddomodossola commented 1 year ago

Hello @WC802 ,

I'm unable to reproduce the problem. Can you show me how you use the GenericDialog? However an usage example is within the widgets_overview_app.py (https://github.com/rawpython/remi/blob/06808ad6c332f2a4cb3ed33fa834474c66e2d7d9/examples/widgets_overview_app.py#L171) Note that when you call dialog.show you must pass the application instance as argument (https://github.com/rawpython/remi/blob/06808ad6c332f2a4cb3ed33fa834474c66e2d7d9/examples/widgets_overview_app.py#L203).

Have a nice day, Davide

WC802 commented 1 year ago

Thank you very much for your answer! I was able to solve it with the example, which I didn't find earlier. Also, I was trying to do a widget for error handling to make a warning pop up with a message that the user can dismiss. This is what GenericDialog does, except it has two buttons. Although I managed to add the class myself, was there already a class that did this? I couldn't find it in the documentation. Or a way to remove the button.

dddomodossola commented 1 year ago

The dialog buttons are 'cancel' and 'conf'. To hide the cancel button you can do:

mydialog.cancel.css_display = 'none'
WC802 commented 1 year ago

Thank you very much for answering so fast!