Views
This page provides the documentation for the views, panel components, and UI widgets.
Views¶
TiBi.views.BrillouinZonePlotView
¶
Bases: QWidget
A 3D visualization panel for Brillouin Zone using PyQtGraph's OpenGL.
Displays a Brillouin zone as a wireframe with vertices shown as small spheres. The visualization supports rotation and zooming.
Features: - Interactive 3D visualization with mouse rotation and zooming - Colored axes representing the Cartesian coordinate system - BZ visualization with wireframe boundaries - High-symmetry points displayed as colored spheres - Selected high-symmetry points highlighted with a different color
Source code in TiBi/views/bz_plot_view.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
TiBi.views.ComputationView
¶
Bases: QWidget
A multi-tab view for setting up and managing computations.
This view contains the following panels:
- HoppintPanel: For managing hopping parameters
- BandsPanel: For managing band structure and Brillouin grid calculations
Attributes:
Name | Type | Description |
---|---|---|
hopping_panel |
HoppingPanel
|
Panel for editing hopping parameters between states. |
bands_panel |
BandsPanel
|
Panel for managing band and Brillouin grid calculations. |
Source code in TiBi/views/computation_view.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
TiBi.views.MainToolbarView
¶
Bases: QToolBar
Main toolbar view that contains application-wide actions.
This class is a view component that provides a toolbar with common actions such as creating new unit cells, saving/loading projects, etc.
It does not create actions itself, receiving them from an action manager.
Source code in TiBi/views/main_toolbar_view.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
set_actions(action_manager)
¶
Set actions from the action manager to the toolbar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action_manager
|
ActionManager
|
ActionManager instance containing all actions to be added. |
required |
Source code in TiBi/views/main_toolbar_view.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
TiBi.views.MainWindow
¶
Bases: QMainWindow
Main application window that defines the UI layout.
This class is purely a view component that arranges the UI elements and doesn't contain business logic or model manipulation. It creates a four-column layout for organizing the different components of the application, along with menu bar, toolbar, and status bar.
Attributes:
Name | Type | Description |
---|---|---|
uc |
UnitCellView
|
Unit cell editor view |
uc_plot |
UnitCellPlotView
|
Unit cell 3D visualization view |
bz_plot |
BrillouinZonePlotView
|
Brillouin zone 3D visualization view |
plot |
PlotView
|
2D plot view |
computation |
ComputationView
|
Multi-tab view used to set up calculations |
window_closed |
Signal
|
Signals the main app to run the cleanup procedure |
Source code in TiBi/views/main_window.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
TiBi.views.MenuBarView
¶
Bases: QMenuBar
Menu bar view that provides access to application features.
This class is a view component that organizes application actions into menus, providing a standard way to access all functionality.
It does not create actions itself, receiving them from an action manager.
Methods:
Name | Description |
---|---|
set_actions |
Set actions from the action manager to the appropriate menus. |
Source code in TiBi/views/menu_bar_view.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
set_actions(action_manager)
¶
Set actions from the action manager to the appropriate menus.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action_manager
|
ActionManager
|
ActionManager instance containing all actions to be added. |
required |
Source code in TiBi/views/menu_bar_view.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
TiBi.views.PlotView
¶
Bases: QWidget
Widget for displaying 2D plots.
This widget creates a matplotlib figure embedded in a Qt widget to display data as 2D plots. It includes navigation controls for zooming, panning, and saving the plot.
Source code in TiBi/views/plot_view.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
TiBi.views.ProgressDialog
¶
Bases: QDialog
A modal that displays a progress bar and a cancel button.
Attributes:
Name | Type | Description |
---|---|---|
cancel_requested |
Signal
|
Signal emitted when the cancel button is clicked. |
Methods:
Name | Description |
---|---|
update_progress |
Updates the progress bar with the given value. |
Source code in TiBi/views/progress_dialog.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
update_progress(value)
¶
Update the progress bar with the given value.
Source code in TiBi/views/progress_dialog.py
38 39 40 41 42 |
|
TiBi.views.StatusBarView
¶
Bases: QStatusBar
Status bar view that displays application status information.
This class is a view component that shows messages to the user.
Methods:
Name | Description |
---|---|
update_status |
Update the status label. |
Source code in TiBi/views/status_bar_view.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
update_status(text)
¶
Update the status label.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
New status text to display |
required |
Source code in TiBi/views/status_bar_view.py
23 24 25 26 27 28 29 30 31 32 |
|
TiBi.views.UnitCellPlotView
¶
Bases: QWidget
A 3D visualization panel for UnitCell
using PyQtGraph's OpenGL support.
Displays a unit cell as a wireframe parallelepiped with sites as spheres. The visualization supports rotation and zooming.
Features: - Interactive 3D visualization with mouse rotation and zooming - Colored axes representing the Cartesian coordinate system - Unit cell visualization with wireframe parallelepiped - Sites displayed as colored spheres at their fractional positions - Selected sites highlighted with an increased size
Source code in TiBi/views/uc_plot_view.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
TiBi.views.UnitCellView
¶
Bases: QWidget
Main UI component for managing unit cells, sites, and states.
This widget combines a tree view of the unit cell hierarchy with dynamically swappable panels for editing properties of the selected tree node. It handles the data models and coordinates interactions between the tree view and detail panels.
The UI consists of several main parts:
- Tree view panel showing the hierarchy of unit cells, sites, and states
- Button panel with actions for creating, deleting, and modifying items
- Form panels that change depending on what is selected in the tree
- Dimensionality controls for setting periodic boundary conditions
Attributes:
Name | Type | Description |
---|---|---|
unit_cell_panel |
UnitCellPanel
|
Panel for editing |
site_panel |
SitePanel
|
Panel for editing |
tree_view_panel |
TreeViewPanel
|
Panel displaying the tree view of |
Source code in TiBi/views/uc_view.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
Panel Components¶
TiBi.views.panels.BandsPanel
¶
Bases: QWidget
A panel for managing band structure calculations and projections.
This panel allows users to define a path in the Brillouin zone, compute band structures, and project states onto various basis states. The panel also includes options for configuring the Brillouin zone grid and DOS calculations.
Source code in TiBi/views/panels/bands_panel.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
|
TiBi.views.panels.hopping_panel.HoppingMatrix
¶
Bases: QWidget
A grid of buttons representing possible hopping connections between states.
Each button in the grid represents a possible hopping between two states. The rows (columns) represent the destination (source) states. Buttons are colored differently based on whether a hopping exists or not, and whether the hopping is Hermitian.
Source code in TiBi/views/panels/hopping_panel.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
TiBi.views.panels.HoppingPanel
¶
Bases: QWidget
View for editing hopping parameters between quantum states.
This widget combines two main components:
- A matrix grid where each button represents a possible hopping connection between two states [rows (columns) are destination (target) states]
- A table for editing specific hopping parameters when a connection is selected in the matrix
The view uses a stacked widget approach to show different panels based on the current selection state (no unit cell, no states, or states selected).
Attributes:
Name | Type | Description |
---|---|---|
matrix_panel |
HoppingMatrix
|
The panel displaying the hopping matrix as a grid of buttons. |
table_panel |
HoppingTable
|
The panel displaying the hopping parameters in a table format. |
Source code in TiBi/views/panels/hopping_panel.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
|
TiBi.views.panels.hopping_panel.HoppingTable
¶
Bases: QWidget
A table containing hoppings between the selected states.
Each row of the table describes a hopping and contains five columns. The first three columns provide the displacements from the origin site to the destination site in terms of the basis vectors. The last two columns are the real and imaginary parts of the hopping term, respectively.
Source code in TiBi/views/panels/hopping_panel.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
|
TiBi.views.panels.SitePanel
¶
Bases: QWidget
Form panel for editing site properties.
This panel provides a form interface for editing a site's properties:
- Radius for the site marker
- Color for the site marker
- Fractional coordinates (c1, c2, c3) within the unit cell
Source code in TiBi/views/panels/site_panel.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
TiBi.views.panels.tree_view_panel.TreeDelegate
¶
Bases: QStyledItemDelegate
A custom item delegate for the SystemTree
widget.
This delegate requires the user to commit changes to tree item names by pressing "Enter". Clicking away/defocusing resets the tree item name to its pre-edit form. The purpose is to handle the Qt default behavior, where defocusing keeps the new display name in the tree but does not send an updated signal so that the data can be updated internally. Additionally, the delegate draws rectangular "Delete" and "Add" buttons next to the item names.
Attributes:
Name | Type | Description |
---|---|---|
name_edit_finished |
Signal(object)
|
Emitted when the user finishes editing an item name. |
new_unit_cell_requested |
Signal
|
Emitted when the user clicks the "Add Unit Cell" button. |
new_site_requested |
Signal
|
Emitted when the user adds a new |
new_state_requested |
Signal
|
Emitted when the user adds a new |
delete_requested |
Signal
|
Emitted when the user clicks the "Delete" button next to an item. |
Source code in TiBi/views/panels/tree_view_panel.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
TiBi.views.panels.TreeViewPanel
¶
Bases: QWidget
Tree view panel for displaying and selecting the unit cell hierarchy.
This panel displays a hierarchical tree showing UnitCell
s, their Site
s,
and the State
s at each Site
.
It handles selection events and emits signals when different types
of nodes are selected, allowing other components to respond appropriately.
The tree has three levels:
UnitCell
sSites
within aUnitCell
State
s within aSite
Features:
- Hierarchical display of unit cells, sites, and states
- Single selection mode for focused editing
- Double-click to edit names directly in the tree
- Keyboard shortcuts for deletion (Del and Backspace)
- Signal emission on deletion requests
Attributes:
Name | Type | Description |
---|---|---|
delegate |
TreeDelegate
|
Custom tree delegate for handling item editing and button actions. |
tree_view |
SystemTree
|
The tree view widget displaying the unit cell hierarchy. |
name_edit_finished |
Signal(object)
|
Emitted when the user finishes editing an item name.
Re-emitting signal from the |
new_unit_cell_requested |
Signal
|
Emitted when the user clicks the "Add Unit Cell" button.
Re-emitting signal from the |
new_site_requested |
Signal
|
Emitted when the user adds a new |
new_state_requested |
Signal
|
Emitted when the user adds a new |
delete_requested |
Signal
|
Emitted when the user presses the Delete/Backspace key.
Also acts as a re-emitting signal for deletion requests
from the |
Source code in TiBi/views/panels/tree_view_panel.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
|
TiBi.views.panels.UnitCellPanel
¶
Bases: QWidget
Form panel for editing unit cell properties.
This panel provides a form interface for editing a unit cell's properties:
- System dimensionality
- Three basis vectors (v1, v2, v3) with x, y, z components
Methods:
Name | Description |
---|---|
set_basis_vectors |
Set the basis vectors in the UI. |
Source code in TiBi/views/panels/unit_cell_panel.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
set_basis_vectors(v1, v2, v3)
¶
Set the basis vectors in the UI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v1
|
BasisVector
|
Basis vector 1. |
required |
v2
|
BasisVector
|
Basis vector 2. |
required |
v3
|
BasisVector
|
Basis vector 3. |
required |
Source code in TiBi/views/panels/unit_cell_panel.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
UI Widgets¶
TiBi.views.widgets.CheckableComboBox
¶
Bases: QComboBox
Drop-down box that supports multiple selections.
Selected items are denoted by ticks.
Attributes:
Name | Type | Description |
---|---|---|
selection_changed |
Signal(object)
|
Emitted when the selection changes. Even if multiple items are selected/deselected, the signal is emitted once. The signal carries a list of indices of the selected items. |
Methods:
Name | Description |
---|---|
checked_items |
Get the indices of the selected items. |
clear_selection |
Deselect all items. |
refresh_combo |
Reset the menu with a new list of items. |
select_all |
Select all items. |
Source code in TiBi/views/widgets/checkable_combo_box.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
checked_items()
¶
Get the indices of the selected items.
Returns:
Name | Type | Description |
---|---|---|
result |
list[int]
|
List of indices of selected items |
Source code in TiBi/views/widgets/checkable_combo_box.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
clear_selection()
¶
Deselect all items.
Source code in TiBi/views/widgets/checkable_combo_box.py
79 80 81 82 83 84 85 86 87 88 |
|
refresh_combo(items)
¶
Reset the combo box with a new list of items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items
|
list[str]
|
New list of items to be added to the menu. |
required |
Source code in TiBi/views/widgets/checkable_combo_box.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
select_all()
¶
Select all items.
Source code in TiBi/views/widgets/checkable_combo_box.py
90 91 92 93 94 95 96 97 98 99 |
|
TiBi.views.widgets.EnterKeyIntSpinBox
¶
Bases: QSpinBox
Custom QSpinBox
that emits a signal when the Enter key is pressed.
On defocus, the value is reset to the original value and no signal is emitted.
Attributes:
Name | Type | Description |
---|---|---|
editingConfirmed |
Signal
|
Signal emitted when the Enter key is pressed and the value has changed. |
Source code in TiBi/views/widgets/enter_key_int_spin_box.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
TiBi.views.widgets.EnterKeySpinBox
¶
Bases: QDoubleSpinBox
Custom QDoubleSpinBox
that emits a signal when the Enter key is pressed.
On defocus, the value is reset to the original value and no signal is emitted.
Attributes:
Name | Type | Description |
---|---|---|
editingConfirmed |
Signal
|
Signal emitted when the Enter key is pressed and the value has changed. |
Source code in TiBi/views/widgets/enter_key_spin_box.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
TiBi.views.widgets.SystemTree
¶
Bases: QTreeView
Custom QTreeViewtree
for displaying UnitCell
s, Site
s, and State
s.
This tree view is designed to show a hierarchical structure of UnitCell
s,
Site
s, and State
s. It allows for easy navigation and selection of these
elements. The tree is built using a QStandardItemModel
, and each item
in the tree is represented by a QStandardItem
. The tree supports
single selection mode and can be edited by double-clicking on an item.
The tree view emits a signal when the selection changes, providing
information about the selected UnitCell
, Site
, and State
.
Attributes:
Name | Type | Description |
---|---|---|
tree_model |
QStandardItemModel
|
The model used to populate the tree view. |
root_node |
QStandardItem
|
The root item of the tree model, representing the tree's top level. |
tree_selection_changed |
Signal
|
Emitted when the selection in the tree changes. The signal carries
a dictionary with the selected |
Methods:
Name | Description |
---|---|
add_tree_item |
Add and select a tree item without rebuilding the entire tree. |
find_item_by_id |
Find a tree item by its ID. |
refresh_tree |
Rebuilds the entire tree from the current data model. |
remove_tree_item |
Remove an item from the tree. |
Source code in TiBi/views/widgets/system_tree.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
add_tree_item(name, uc_id, site_id=None, state_id=None)
¶
Add and select a tree item without rebuilding the entire tree.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uc_id
|
UUID
|
id of the |
required |
site_id
|
UUID
|
id of the |
None
|
state_id
|
UUID
|
id of the |
None
|
Source code in TiBi/views/widgets/system_tree.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
find_item_by_id(uc_id, site_id=None, state_id=None)
¶
Find a tree item by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uc_id
|
UUID
|
id of the |
required |
site_id
|
UUID
|
id of the |
None
|
state_id
|
UUID
|
id of the |
None
|
Returns:
Type | Description |
---|---|
QStandardItem | None
|
The required item if found, |
Source code in TiBi/views/widgets/system_tree.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
refresh_tree(unit_cells)
¶
Rebuild the entire tree from the current data model.
This method clears the existing tree and reconstructs it based on the current state of the unit_cells dictionary. It creates a hierarchical structure with three levels: unit cells, sites, and states.
Note: For better performance, prefer the more specific update methods:
- add_tree_item()
- For adding or updating a single node
- remove_tree_item()
- For removing a single node
This full refresh is typically only needed during initialization or when multiple components of the tree need to be updated simultaneously.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit_cells
|
dict[UUID, UnitCell]
|
Dictionary of |
required |
Source code in TiBi/views/widgets/system_tree.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
remove_tree_item(uc_id, site_id=None, state_id=None)
¶
Remove an item from the tree.
If the item has a parent
(i.e., is not a UnitCell
), select the parent. Otherwise,
clear the selection
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uc_id
|
UUID
|
id of the |
required |
site_id
|
UUID
|
id of the |
None
|
state_id
|
UUID
|
id of the |
None
|
Source code in TiBi/views/widgets/system_tree.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
|