pymmcore-plus / pymmcore-widgets

A set of Qt-based widgets onto the pymmcore-plus model
https://pymmcore-plus.github.io/pymmcore-widgets
Other
12 stars 7 forks source link

Add a Console Widget #370

Open gselzer opened 1 month ago

gselzer commented 1 month ago

It would be nice if we had a centralized console widget. For now, the main thing that would be nice is access to the CMMCore(Plus) instance, although we should certainly also have the API to add additional variables.

There are already a couple prototypes we could draw from. I added a RichJupyterWidget-based console to my sandbox here, but this may be overkill. @simonecoppola has additionally filed https://github.com/fdrgsp/micromanager-gui/pull/22, but that would require additional effort and bugfixes.

Thoughts @tlambert03 @fdrgsp @marktsuchida?

fdrgsp commented 1 month ago

I agree, @gselzer. After @simonecoppola mentioned it in https://github.com/fdrgsp/micromanager-gui/pull/22, I also thought that pymmcore-widgets would be a good place for it.

tlambert03 commented 1 month ago

naive question (having not looked at anyone's code). In a sense, isn't qtconsole already this widget? And then, inasmuch as pymmcore-widgets is a component library (and not the final composed gui), what additional "wrapping" do we need to provide? Given that it brings in enough extra dependencies to make it a somewhat heavy addition, I think it should likely only be done by the final gui application (like @fdrgsp's app or https://github.com/pymmcore-plus/pymmcore-gui/issues). in napari, we actually eventually extracted our console into an independent package for exactly this reason.

edit: answering my own question - i guess @gselzer's point was that the additional wrapping would be injection of global variables into the console namespace. but there too, I think that's an application-level concern, not a library concern

gselzer commented 1 month ago

Yup, for the reasons you mentioned I nearly filed this issue within pymmcore-gui, but I guess the reason I filed it here is because at the end of the day we're talking about adding a new widget, and all the widgets (currently) live here.

My main concern is avoiding duplicated effort, since we've already seen the beginnings of that. I think that the solution could occur here or on the application level, and see no problems with moving this issue over to pymmcore-gui.

tlambert03 commented 1 month ago

let's leave this here for the moment. but if it gets added, I would only want it as an extra pip install pymmcore-widgets[console]