Sequence diagram: opening a .rehu path
[[[sequence-open-document]]]
Traces packages/rehuco-agent/src/rehuco_agent/__main__.py's main() through app.py's run()
(app.py:73-94) down to a new dock appearing, covering both cases run() handles: this process
becomes the single-instance primary, or another primary is already running and this process
just forwards its argv and exits ([[nodes#single-instance]] ). Builds the [[plugins#dock-shell]]
described in prose.
OS . Shell __main__.main.. app.run.. Application ApplicationSingleton MainWindow DocumentsDock RehuDocument RehuDocumentModel DocumentWidget FieldsForm OS / Shell OS / Shell main .main() main .main() app.run() app.run() Application Application ApplicationSingleton ApplicationSingleton MainWindow MainWindow DocumentsDock DocumentsDock RehuDocument (core) RehuDocument (core) RehuDocumentModel RehuDocumentModel DocumentWidget DocumentWidget FieldsForm FieldsForm exec rehuco-agent a.rehu run(argv) Application(argv) setup(APP_ID) alt [this process becomes primary] True connect other_instance_run -> open_forwarded show_main_window() new MainWindow() new DocumentsDock() window open_forwarded(argv[1:]) loop [for each path] open_file(path) open_document(path) alt [dock already open for this path] focus existing dock [not yet open] RehuDocument.load(path) new RehuDocumentModel(document) new DocumentWidget(model) build_document_form() make_viewer(model), make_editor(model) bind(field) per field new CDockWidget, add + focus raise_and_activate() app.exec() (event loop) [another instance is already primary] False (argv already written to the primary's local socket) return 0 On the *other*, already-running process: its ApplicationSingleton decodes the forwarded argv and emits other_instance_run(paths), re-entering the "for each path" loop above -- no new process, no new Application. OS . Shell __main__.main.. app.run.. Application ApplicationSingleton MainWindow DocumentsDock RehuDocument RehuDocumentModel DocumentWidget FieldsForm OS / Shell OS / Shell main .main() main .main() app.run() app.run() Application Application ApplicationSingleton ApplicationSingleton MainWindow MainWindow DocumentsDock DocumentsDock RehuDocument (core) RehuDocument (core) RehuDocumentModel RehuDocumentModel DocumentWidget DocumentWidget FieldsForm FieldsForm exec rehuco-agent a.rehu run(argv) Application(argv) setup(APP_ID) alt [this process becomes primary] True connect other_instance_run -> open_forwarded show_main_window() new MainWindow() new DocumentsDock() window open_forwarded(argv[1:]) loop [for each path] open_file(path) open_document(path) alt [dock already open for this path] focus existing dock [not yet open] RehuDocument.load(path) new RehuDocumentModel(document) new DocumentWidget(model) build_document_form() make_viewer(model), make_editor(model) bind(field) per field new CDockWidget, add + focus raise_and_activate() app.exec() (event loop) [another instance is already primary] False (argv already written to the primary's local socket) return 0 On the *other*, already-running process: its ApplicationSingleton decodes the forwarded argv and emits other_instance_run(paths), re-entering the "for each path" loop above -- no new process, no new Application.