microscope-cockpit / cockpit

Cockpit is a microscope graphical user interface. It is a flexible and easy to extend platform aimed at life scientists using bespoke microscopes.
https://microscope-cockpit.org
GNU General Public License v3.0
35 stars 26 forks source link

automate the import of depot in the pyshell. #866

Closed iandobbie closed 10 months ago

iandobbie commented 1 year ago

The pyshell is only really used as a debug or other extension tool by experts. Every time I use it the first thing I do is import the depot to grab a device or similar. I suggest we automate the import of depot, possibly some other modules, or maybe a configurable set.

The default behavior is to run the users PYTHONSTARTUP, but I mostly don't wont to import the cockpit depot for other python processes so I think using this is a non-starter. I did a quick hack to add

window.shell.run('from cockpit import depot')

in the shellwindow.makeWindow function, which is equivalent to typing the text in the shell.

Maybe we could add a config option to execute a list of commands at shell startup?

iandobbie commented 11 months ago

I think few people use the pyshell and starting with the depot imported is a real winner for 99% of my use so I am going to pull this.

iandobbie commented 10 months ago

Pulled into master in 59816dfafe00460befa97c2e4b536dd81dd94d8d