Centralize collection directory#299
Conversation
* use this as the source of truth for both GUI and server
* on startup. if not started there, show an error and exit
* if it has changed, kill the GUI, and do this check in a separate thread
* use QThread to allow ability to repeat
* make this a configurable value
* the GUI should terminate quickly after the visit directory is changed to prevent the user collecting data in an undesired place
* user is not likely to have the GUI log open, so also ensure the message is printed out to the terminal
Added checks for server: - Checks to if env file exists - Checks if CURRENT_VISIT_DIR has a value and is valid
e29e862 to
713237f
Compare
|
@vshekar - some information about the branches of LSDC in the current condition with the fixes from this pull request vs. what was running before current branches containing the fixes: previous branches that we must roll back to if necessary (pre-fix branches): |
gui/control_main.py
Outdated
| hutchTopCamThread.start() | ||
| serverCheckThread = ServerCheckThread( | ||
| parent=self, delay=SERVER_CHECK_DELAY) | ||
| serverCheckThread.visit_dir_changed.connect(self.close) |
There was a problem hiding this comment.
is app.exit (or similar) a better choice here? It does look like def closeEvent will exit, but directly exiting the app here may be more reliable?
tacaswell
left a comment
There was a problem hiding this comment.
I left a few comments that I think would reduce edge cases, but as-is this PR achieves the goals of:
- only starting the server if it is in a directory with the correct structure
- the GUI exits with in 2 seconds of the server directory being different than the cwd
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
* the object in question is a QLabel(), which is not editable
Inspired by: ``` if the goal is murder the app...just murder the app -Tom Caswell ```
|
@tacaswell output with self.close(): After: merged in latest centralize-collection-directory into 2023-2-amxfmx-production-dev. this includes the QApplication fix, in addition to top view fix for cwd. The latter was not checked. The GUI application does stop so it still works. |
That suggests that you have a slot someplace that does not check if the application is doing down before it does some work |
|
That is most likely from a QThread that is getting camera images in the background to put in the UI. I can add a fix to clean up these threads before the quit is called either in this PR or a separate one |
- Using already existing closeAll() method - Threads are stopped cleanly and quit
|
I'm still getting |
current_visit_lsdc_<tla>file does not exist or theCURRENT_VISIT_DIRvariable does not point to a proposal directory-like name