GUI architecture for scientifjc workfmow spaghetti-free, lazy-responsive, with capture & replay Joachim Wuttke Forschungszentrum Jülich GmbH, JCNS-MLZ Garching
Google image search for “model view” 1
https://blogs.msdn.microsoft.com/erwinvandervalk 2
Qt5 model/view classes view is based on QAbstractItemView - QListView - QTableView - QTreeView model inherits from QAbstractItemModel - QAbstractListModel - QAbstractProxyModel - QAbstractTableModel 3
by Juanpe Bolivar (CppCon 2017) 4
by Juanpe Bolivar (CppCon 2017) 5
by Juanpe Bolivar (CppCon 2017) 6
by Juanpe Bolivar (CppCon 2017) 7
8 VIEW VIEW VIEWMODEL VIEWMODEL DATA
9 VIEW VIEW VIEWMODEL VIEWMODEL gui DATA core
10 VIEW VIEW VIEWMODEL VIEWMODEL gui DATA core LOGGER PARAMETER WRAPPERS services
11 VIEW user script VIEWMODEL gui Python API DATA core LOGGER PARAMETER WRAPPERS services
generated by Doxygen 12
generated by Doxygen 13
generated by Doxygen 14
15 GUI: Core: qApp gSession gMainWindow settings settings data widgets menu raw reduced metadata parameters triggers, toggles images results = global variable
• prefer plain global variables over equivalent singletons • prefer one global variable gSession over function calls like f(session.Data, session.Parameters); which calls g(datafiles[iFile], parameterX , parameterZ); which calls h(datafile.metadata.A, parameterZ); 16
How to keep this up to date? 17
• to restrict GUI redrawing to Widgets that have changed. • to restrict Core recomputation to data that have changed, Both are premature optimizations. 18 Signalling spaghetti (GUI ↔ Core) has its root in efgorts
• to restrict Core recomputation to data that have changed, • to restrict GUI redrawing to Widgets that have changed. Both are premature optimizations. They do not even preclude duplication of Core computations. 18 Signalling spaghetti (GUI ↔ Core) has its root in efgorts
19 application view 1 view 2 data 1 data 2 data 3 data 4 parameter
20 application view 1 view 2 data 1 data 2 data 3 data 4 parameter
21 application view 1 view 2 data 1 data 2 data 3 data 4 declare invalid request refresh parameter lazy evaluate
22 GUI: Core: qApp gSession gMainWindow settings settings data widgets menu raw reduced metadata parameters triggers, toggles images results request redisplay request recompute
Bonus section: capture & replay
Logging Why? • to debug, • to profjle, • to document provenance, and to replay • tests during development, • functional tests, • user sessions, especially upon bug reports. Also related: • Undo/Redo. 23
Logging How? By recording • keyboard and mouse events, • interrupts, • user actions at widget level, • GUI-to-core calls. 24
Logging How? By recording • interrupts, • user actions at widget level, 24 • keyboard and mouse events, • GUI-to-core calls.
25 user tester GUI textual action command control command test case test case test case widgets interpreter test case test case test case undo/redo core command stack application test suite log file text editor
26 jugit.fz-juelich.de:mlz/libQCR QcrMixin QAction QcrTrigger QcrToggle QcrControl<bool> QCheckButton QcrCheckButton QSpinBox QcrSpinBox QcrControl<int> QComboBox QcrComboBox QTabWidget QcrTabWidget QDoubleSpinBox QcrDoubleSpinBox QcrControl<double> QLineEdit QcrLineEdit QcrControl<QString> QDialog QcrModelessDialog QcrModalDialog QcrModal QFileDialog QcrFileDialog
Recommend
More recommend