Skip to content

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..ApplicationApplicationSingletonMainWindowDocumentsDockRehuDocumentRehuDocumentModelDocumentWidgetFieldsFormOS / ShellOS / Shellmain.main()main.main()app.run()app.run()ApplicationApplicationApplicationSingletonApplicationSingletonMainWindowMainWindowDocumentsDockDocumentsDockRehuDocument(core)RehuDocument(core)RehuDocumentModelRehuDocumentModelDocumentWidgetDocumentWidgetFieldsFormFieldsFormexec rehuco-agent a.rehurun(argv)Application(argv)setup(APP_ID)alt[this process becomes primary]Trueconnect other_instance_run -> open_forwardedshow_main_window()new MainWindow()new DocumentsDock()windowopen_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 fieldnew CDockWidget, add + focusraise_and_activate()app.exec() (event loop)[another instance is already primary]False(argv already written to the primary's local socket)return 0On the *other*, already-running process: its ApplicationSingletondecodes 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..ApplicationApplicationSingletonMainWindowDocumentsDockRehuDocumentRehuDocumentModelDocumentWidgetFieldsFormOS / ShellOS / Shellmain.main()main.main()app.run()app.run()ApplicationApplicationApplicationSingletonApplicationSingletonMainWindowMainWindowDocumentsDockDocumentsDockRehuDocument(core)RehuDocument(core)RehuDocumentModelRehuDocumentModelDocumentWidgetDocumentWidgetFieldsFormFieldsFormexec rehuco-agent a.rehurun(argv)Application(argv)setup(APP_ID)alt[this process becomes primary]Trueconnect other_instance_run -> open_forwardedshow_main_window()new MainWindow()new DocumentsDock()windowopen_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 fieldnew CDockWidget, add + focusraise_and_activate()app.exec() (event loop)[another instance is already primary]False(argv already written to the primary's local socket)return 0On the *other*, already-running process: its ApplicationSingletondecodes the forwarded argv and emits other_instance_run(paths),re-entering the "for each path" loop above -- no new process,no new Application.