xstack 2.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xstack/__init__.py +167 -0
- xstack/address.py +137 -0
- xstack/app/__init__.py +36 -0
- xstack/app/__main__.py +5 -0
- xstack/app/application.py +692 -0
- xstack/app/config.py +139 -0
- xstack/app/delegate.py +292 -0
- xstack/app/demo.py +42 -0
- xstack/app/dialogs.py +492 -0
- xstack/app/log_view.py +632 -0
- xstack/app/menu.py +362 -0
- xstack/app/options.py +664 -0
- xstack/app/resources.py +20 -0
- xstack/app/runner.py +35 -0
- xstack/app/settings.py +89 -0
- xstack/app/tree.py +582 -0
- xstack/attributes.py +212 -0
- xstack/compat.py +96 -0
- xstack/component.py +1175 -0
- xstack/constants.py +16 -0
- xstack/stack.py +1078 -0
- xstack/test/__init__.py +0 -0
- xstack/test/components.py +360 -0
- xstack/test/test_stack.py +1314 -0
- xstack-2.0.2.dist-info/METADATA +162 -0
- xstack-2.0.2.dist-info/RECORD +29 -0
- xstack-2.0.2.dist-info/WHEEL +5 -0
- xstack-2.0.2.dist-info/licenses/LICENSE +21 -0
- xstack-2.0.2.dist-info/top_level.txt +1 -0
xstack/app/config.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
from Qt import QtCore, QtWidgets, QtGui
|
|
2
|
+
import scribble
|
|
3
|
+
from . import resources
|
|
4
|
+
|
|
5
|
+
from .. import stack
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# --------------------------------------------------------------------------------------
|
|
9
|
+
class AppConfig:
|
|
10
|
+
"""
|
|
11
|
+
This class allows you to tailor how the Ui Application will present itself
|
|
12
|
+
to the user.
|
|
13
|
+
|
|
14
|
+
Typically, if you inherit from the AppWidget within StackX you will find it
|
|
15
|
+
useful to also subclass this config class, and use it to tailor how the ui
|
|
16
|
+
is presented.
|
|
17
|
+
"""
|
|
18
|
+
# -- These allow applications to tailor their appearance and
|
|
19
|
+
# -- terminology
|
|
20
|
+
label = "Stack"
|
|
21
|
+
component_label = "Component"
|
|
22
|
+
execute_label = "Execute"
|
|
23
|
+
header_label = None
|
|
24
|
+
show_tree_header = True
|
|
25
|
+
splitter_bias = None # -- Percentage along the splitter should be by default
|
|
26
|
+
show_menu_bar = True
|
|
27
|
+
forced_orientation = None # -- Can be None, "vertical" or "horizontal"
|
|
28
|
+
|
|
29
|
+
# -- The Log tab. It always shows records from these loggers (and their
|
|
30
|
+
# -- children), and while a build runs it shows every log record and
|
|
31
|
+
# -- everything printed. It is cleared when each build starts.
|
|
32
|
+
show_log_tab = True
|
|
33
|
+
log_logger_names = ["xstack"]
|
|
34
|
+
|
|
35
|
+
# -- These let you tailor the icons which will be displayed for various
|
|
36
|
+
# -- items and actions
|
|
37
|
+
icon = resources.get("icon.png")
|
|
38
|
+
open_icon = resources.get("open.png")
|
|
39
|
+
save_icon = resources.get("save.png")
|
|
40
|
+
component_icon = resources.get("component.png")
|
|
41
|
+
validate_icon = resources.get("validate.png")
|
|
42
|
+
execute_icon = resources.get("execute.png")
|
|
43
|
+
add_icon = resources.get("add.png")
|
|
44
|
+
remove_icon = resources.get("remove.png")
|
|
45
|
+
duplicate_icon = resources.get("duplicate.png")
|
|
46
|
+
|
|
47
|
+
# -- These are how the background of the stack should show
|
|
48
|
+
splash_image = resources.get("icon.png")
|
|
49
|
+
stack_background = resources.get("stack_background.png")
|
|
50
|
+
|
|
51
|
+
# -- Different screens have different sizes which affect how our
|
|
52
|
+
# -- delegates draw etc. This property is dynamic and changes whenever
|
|
53
|
+
# -- the window moves - allowing it to display nicely on monitors with
|
|
54
|
+
# -- varying screen sizes
|
|
55
|
+
screen_size = 1024
|
|
56
|
+
|
|
57
|
+
# -- This is the base class of the stack. This is useful if you are inheriting
|
|
58
|
+
# -- and subclassing from xstack.Stack and want to ensure that when the app
|
|
59
|
+
# -- creates a new stack it creates your base class
|
|
60
|
+
stack_class: "xstack.Stack" = stack.Stack
|
|
61
|
+
|
|
62
|
+
# -- These allow you to tailor exactly how the tree will will visually
|
|
63
|
+
item_highlight_color = [255, 0, 255]
|
|
64
|
+
|
|
65
|
+
drop_target_width = 5
|
|
66
|
+
drag_target_color = [255, 255, 255]
|
|
67
|
+
default_text_color = [0, 0, 0]
|
|
68
|
+
border_color = [0, 0, 0]
|
|
69
|
+
|
|
70
|
+
status_success_color = [0, 255, 0]
|
|
71
|
+
status_failed_color = [255, 0, 0]
|
|
72
|
+
status_invalid_color = [255, 200, 50]
|
|
73
|
+
status_unknown_color = [100, 100, 255]
|
|
74
|
+
status_disabled_color = [0, 0, 0]
|
|
75
|
+
|
|
76
|
+
text_font = "Arial"
|
|
77
|
+
text_size = 8
|
|
78
|
+
item_size = 40
|
|
79
|
+
component_paths = []
|
|
80
|
+
|
|
81
|
+
# -- These let an application restrict what the user can do with the
|
|
82
|
+
# -- stack. When the structure is read only, components cannot be
|
|
83
|
+
# -- dragged, added, removed, duplicated, renamed, switched or edited
|
|
84
|
+
# -- through the Actions menu, but items can still be expanded and
|
|
85
|
+
# -- collapsed. The build actions are the entries offered in a
|
|
86
|
+
# -- component's execute and validate menus ("section", "up_to" and
|
|
87
|
+
# -- "only"), and the stack build actions are the "execute/validate the
|
|
88
|
+
# -- whole stack" entries.
|
|
89
|
+
read_only_structure = False
|
|
90
|
+
component_build_actions = ("section", "up_to", "only")
|
|
91
|
+
show_stack_build_actions = True
|
|
92
|
+
|
|
93
|
+
# -- This lets you specify a custom application widget class
|
|
94
|
+
app_widget = None
|
|
95
|
+
|
|
96
|
+
# -- This lets you specify a custom tree widget class. It should inherit
|
|
97
|
+
# -- from xstack.app.tree.BuildTreeWidget
|
|
98
|
+
tree_widget = None
|
|
99
|
+
|
|
100
|
+
# -- This allows you to specify a unique settings id to store settings specific
|
|
101
|
+
# -- to your deployment
|
|
102
|
+
settings_id = "xstack_app_settings"
|
|
103
|
+
additional_settings = {}
|
|
104
|
+
|
|
105
|
+
# ----------------------------------------------------------------------------------
|
|
106
|
+
@classmethod
|
|
107
|
+
def default_settings(cls):
|
|
108
|
+
internal_settings = {
|
|
109
|
+
"auto_adjust_orientation": False,
|
|
110
|
+
"use_vertical_alignment": True,
|
|
111
|
+
"switch_to_log_on_failure": True,
|
|
112
|
+
}
|
|
113
|
+
internal_settings.update(cls.additional_settings)
|
|
114
|
+
return internal_settings
|
|
115
|
+
|
|
116
|
+
# ----------------------------------------------------------------------------------
|
|
117
|
+
@classmethod
|
|
118
|
+
def get_setting(cls, key):
|
|
119
|
+
return scribble.get(cls.settings_id).get(
|
|
120
|
+
key,
|
|
121
|
+
cls.default_settings()[key],
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
# ----------------------------------------------------------------------------------
|
|
125
|
+
@classmethod
|
|
126
|
+
def store_setting(cls, key, value):
|
|
127
|
+
settings = scribble.get(cls.settings_id)
|
|
128
|
+
settings[key] = value
|
|
129
|
+
settings.save()
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# ----------------------------------------------------------------------------------
|
|
133
|
+
@classmethod
|
|
134
|
+
def all_settings(cls):
|
|
135
|
+
settings = cls.default_settings()
|
|
136
|
+
settings.update(scribble.get(cls.settings_id))
|
|
137
|
+
return settings
|
|
138
|
+
|
|
139
|
+
|
xstack/app/delegate.py
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from Qt import QtWidgets, QtGui, QtCore
|
|
3
|
+
|
|
4
|
+
from . import resources
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# --------------------------------------------------------------------------------------
|
|
8
|
+
# noinspection PyUnresolvedReferences,PyPep8Naming
|
|
9
|
+
class ComponentItemDelegate(QtWidgets.QStyledItemDelegate):
|
|
10
|
+
"""
|
|
11
|
+
This delegate defines how we draw out components in the tree view.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
bfr = 5
|
|
15
|
+
STATUS_WIDTH = 10
|
|
16
|
+
|
|
17
|
+
# ----------------------------------------------------------------------------------
|
|
18
|
+
def __init__(self, stack: "xstack.Stack", app_config, parent=None):
|
|
19
|
+
super().__init__(parent)
|
|
20
|
+
|
|
21
|
+
# -- When we instance this class, we need to construct all our brushes
|
|
22
|
+
self.icon_pixmap = QtGui.QPixmap(
|
|
23
|
+
app_config.component_icon or resources.get("component.png")
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
self.root_icon_pixmap = QtGui.QPixmap(
|
|
27
|
+
app_config.icon or resources.get("icon.png"),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
self.app_config = app_config
|
|
31
|
+
self.stack: "xstack.Stack" = stack
|
|
32
|
+
|
|
33
|
+
self.factor = 1.0
|
|
34
|
+
self.item_size = self.app_config.item_size
|
|
35
|
+
self.border_pen = QtGui.QPen(QtGui.QColor(*self.app_config.border_color))
|
|
36
|
+
self.text_pen = QtGui.QPen(QtGui.QColor(*self.app_config.default_text_color))
|
|
37
|
+
self.drag_target_pen = QtGui.QPen(QtGui.QColor(*self.app_config.drag_target_color))
|
|
38
|
+
self.drag_target_pen.setWidth(self.app_config.drop_target_width)
|
|
39
|
+
|
|
40
|
+
self.success_brush = QtGui.QBrush(QtGui.QColor(*self.app_config.status_success_color))
|
|
41
|
+
self.failed_brush = QtGui.QBrush(QtGui.QColor(*self.app_config.status_failed_color))
|
|
42
|
+
self.invalid_brush = QtGui.QBrush(QtGui.QColor(*self.app_config.status_invalid_color))
|
|
43
|
+
self.unknown_brush = QtGui.QBrush(QtGui.QColor(*self.app_config.status_unknown_color))
|
|
44
|
+
self.disabled_brush = QtGui.QBrush(QtGui.QColor(*self.app_config.status_disabled_color))
|
|
45
|
+
|
|
46
|
+
self.text_font = QtGui.QFont(
|
|
47
|
+
self.app_config.text_font,
|
|
48
|
+
self.app_config.text_size,
|
|
49
|
+
QtGui.QFont.Normal,
|
|
50
|
+
)
|
|
51
|
+
self.descriptive_pen = QtGui.QPen(
|
|
52
|
+
QtGui.QColor(
|
|
53
|
+
self.app_config.default_text_color[0],
|
|
54
|
+
self.app_config.default_text_color[1],
|
|
55
|
+
self.app_config.default_text_color[2],
|
|
56
|
+
150.
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
# ----------------------------------------------------------------------------------
|
|
60
|
+
def paint_status(self, component, painter, option, index):
|
|
61
|
+
"""
|
|
62
|
+
Draws the status section of the widget
|
|
63
|
+
"""
|
|
64
|
+
status = component.status()
|
|
65
|
+
|
|
66
|
+
if status == self.stack.status.Success:
|
|
67
|
+
status_color = self.success_brush
|
|
68
|
+
|
|
69
|
+
elif status == self.stack.status.Failed:
|
|
70
|
+
status_color = self.failed_brush
|
|
71
|
+
|
|
72
|
+
elif status == self.stack.status.Invalid:
|
|
73
|
+
status_color = self.invalid_brush
|
|
74
|
+
|
|
75
|
+
elif status == self.stack.status.Disabled:
|
|
76
|
+
status_color = self.disabled_brush
|
|
77
|
+
|
|
78
|
+
else:
|
|
79
|
+
status_color = self.unknown_brush
|
|
80
|
+
|
|
81
|
+
painter.setBrush(status_color)
|
|
82
|
+
painter.setPen(self.border_pen)
|
|
83
|
+
|
|
84
|
+
painter.drawRect(
|
|
85
|
+
QtCore.QRect(
|
|
86
|
+
option.rect.x(),
|
|
87
|
+
option.rect.y(),
|
|
88
|
+
self.STATUS_WIDTH,
|
|
89
|
+
option.rect.height(),
|
|
90
|
+
),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
# ----------------------------------------------------------------------------------
|
|
94
|
+
def paint_border(self, component, painter, option, index):
|
|
95
|
+
"""
|
|
96
|
+
Draws the border
|
|
97
|
+
"""
|
|
98
|
+
painter.setPen(self.border_pen)
|
|
99
|
+
painter.setBrush(QtCore.Qt.transparent)
|
|
100
|
+
painter.drawRect(
|
|
101
|
+
option.rect,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
# ----------------------------------------------------------------------------------
|
|
105
|
+
def paint_text(self, component, painter, option, index):
|
|
106
|
+
"""
|
|
107
|
+
Draws the text label
|
|
108
|
+
"""
|
|
109
|
+
painter.setFont(self.text_font)
|
|
110
|
+
painter.setPen(self.text_pen)
|
|
111
|
+
|
|
112
|
+
start_point = sum(
|
|
113
|
+
[
|
|
114
|
+
option.rect.x(),
|
|
115
|
+
self.item_size,
|
|
116
|
+
self.bfr,
|
|
117
|
+
self.STATUS_WIDTH,
|
|
118
|
+
self.bfr,
|
|
119
|
+
],
|
|
120
|
+
)
|
|
121
|
+
# -- Draw the main entry name
|
|
122
|
+
painter.drawText(
|
|
123
|
+
start_point,
|
|
124
|
+
option.rect.y() + (25 * self.factor),
|
|
125
|
+
f"{component.label()}"
|
|
126
|
+
)
|
|
127
|
+
start_point += (QtGui.QFontMetrics(self.text_font).horizontalAdvance(component.label()) * self.factor)
|
|
128
|
+
|
|
129
|
+
painter.setPen(self.descriptive_pen)
|
|
130
|
+
painter.drawText(
|
|
131
|
+
start_point + (self.bfr * self.factor),
|
|
132
|
+
option.rect.y() + (25 * self.factor),
|
|
133
|
+
f"({component.identifier})"
|
|
134
|
+
)
|
|
135
|
+
# ----------------------------------------------------------------------------------
|
|
136
|
+
def paint_icon(self, component, painter, option, index):
|
|
137
|
+
"""
|
|
138
|
+
Paints the icon
|
|
139
|
+
"""
|
|
140
|
+
size = self.item_size * self.factor
|
|
141
|
+
# -- Build the pixmap
|
|
142
|
+
if component.icon and os.path.exists(component.icon):
|
|
143
|
+
pixmap = QtGui.QPixmap(component.icon).scaled(
|
|
144
|
+
size,
|
|
145
|
+
size,
|
|
146
|
+
mode=QtCore.Qt.SmoothTransformation,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
else:
|
|
150
|
+
pixmap = self.icon_pixmap.scaled(
|
|
151
|
+
size,
|
|
152
|
+
size,
|
|
153
|
+
mode=QtCore.Qt.SmoothTransformation,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# -- Draw the icon
|
|
157
|
+
painter.drawPixmap(
|
|
158
|
+
QtCore.QRect(
|
|
159
|
+
option.rect.x() + self.STATUS_WIDTH + (self.bfr * self.factor),
|
|
160
|
+
option.rect.y(),
|
|
161
|
+
size,
|
|
162
|
+
size,
|
|
163
|
+
),
|
|
164
|
+
pixmap,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
# ----------------------------------------------------------------------------------
|
|
168
|
+
def paint_highlight(self, component, painter, option, index):
|
|
169
|
+
"""
|
|
170
|
+
Paints the background based on the overlay state
|
|
171
|
+
"""
|
|
172
|
+
gradient = QtGui.QLinearGradient(
|
|
173
|
+
QtCore.QPoint(
|
|
174
|
+
option.rect.x(),
|
|
175
|
+
option.rect.y(),
|
|
176
|
+
),
|
|
177
|
+
QtCore.QPoint(
|
|
178
|
+
option.rect.x() + option.rect.width(),
|
|
179
|
+
option.rect.y(),
|
|
180
|
+
),
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
# -- Add extra details for the selected item
|
|
184
|
+
if option.state & QtWidgets.QStyle.State_Selected:
|
|
185
|
+
gradient.setColorAt(0, QtGui.QColor(255, 255, 255, a=75))
|
|
186
|
+
gradient.setColorAt(1, QtGui.QColor(255, 255, 255, a=0))
|
|
187
|
+
|
|
188
|
+
elif option.state & QtWidgets.QStyle.State_MouseOver:
|
|
189
|
+
gradient.setColorAt(0, QtGui.QColor(255, 255, 255, a=50))
|
|
190
|
+
gradient.setColorAt(1, QtGui.QColor(255, 255, 255, a=0))
|
|
191
|
+
|
|
192
|
+
else:
|
|
193
|
+
gradient.setColorAt(0, QtGui.QColor(255, 255, 255, a=25))
|
|
194
|
+
gradient.setColorAt(1, QtGui.QColor(255, 255, 255, a=0))
|
|
195
|
+
|
|
196
|
+
painter.fillRect(
|
|
197
|
+
option.rect,
|
|
198
|
+
gradient
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
# ----------------------------------------------------------------------------------
|
|
202
|
+
def paint_stack_node(self, painter, option, index):
|
|
203
|
+
"""
|
|
204
|
+
The only item we paint differently is the stack node
|
|
205
|
+
"""
|
|
206
|
+
# -- Paint the icon
|
|
207
|
+
pixmap = self.root_icon_pixmap.scaled(
|
|
208
|
+
self.item_size,
|
|
209
|
+
self.item_size,
|
|
210
|
+
mode=QtCore.Qt.SmoothTransformation,
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
# -- Draw the icon
|
|
214
|
+
painter.drawPixmap(
|
|
215
|
+
QtCore.QRect(
|
|
216
|
+
option.rect.x(),
|
|
217
|
+
option.rect.y(),
|
|
218
|
+
self.item_size,
|
|
219
|
+
self.item_size,
|
|
220
|
+
),
|
|
221
|
+
pixmap,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
painter.setFont(self.text_font)
|
|
225
|
+
painter.setPen(self.text_pen)
|
|
226
|
+
|
|
227
|
+
# -- Draw the main entry name
|
|
228
|
+
if self.app_config.header_label is not None:
|
|
229
|
+
label = self.app_config.header_label
|
|
230
|
+
else:
|
|
231
|
+
label = f"{self.app_config.label} : {self.stack.label}"
|
|
232
|
+
|
|
233
|
+
painter.drawText(
|
|
234
|
+
option.rect.x() + (self.item_size ) + self.bfr + self.STATUS_WIDTH,
|
|
235
|
+
option.rect.y() + 25,
|
|
236
|
+
label
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
gradient = QtGui.QLinearGradient(
|
|
240
|
+
QtCore.QPoint(
|
|
241
|
+
option.rect.x(),
|
|
242
|
+
option.rect.y(),
|
|
243
|
+
),
|
|
244
|
+
QtCore.QPoint(
|
|
245
|
+
option.rect.x(),
|
|
246
|
+
option.rect.y() + option.rect.height(),
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
gradient.setColorAt(0, QtGui.QColor(255, 255, 255, a=25))
|
|
251
|
+
gradient.setColorAt(1, QtGui.QColor(255, 255, 255, a=0))
|
|
252
|
+
|
|
253
|
+
painter.setBrush(
|
|
254
|
+
gradient
|
|
255
|
+
)
|
|
256
|
+
painter.setPen(QtGui.QPen(QtCore.Qt.transparent))
|
|
257
|
+
painter.drawRect(
|
|
258
|
+
option.rect,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
# ----------------------------------------------------------------------------------
|
|
262
|
+
def paint(self, painter, option, index):
|
|
263
|
+
"""
|
|
264
|
+
This is called when the item requires repainting
|
|
265
|
+
"""
|
|
266
|
+
|
|
267
|
+
if not index.column() == 0:
|
|
268
|
+
return
|
|
269
|
+
display_data = index.data(role=QtCore.Qt.DisplayRole)
|
|
270
|
+
component = self.stack.get_component_by_uuid(display_data)
|
|
271
|
+
|
|
272
|
+
if not component or isinstance(component, str):
|
|
273
|
+
self.paint_stack_node(painter, option, index)
|
|
274
|
+
return
|
|
275
|
+
|
|
276
|
+
# -- Calculate the factor
|
|
277
|
+
base_height = 2160
|
|
278
|
+
# self.factor = self.app_config.screen_size / base_height
|
|
279
|
+
# print("factor : %s" % self.factor)
|
|
280
|
+
self.paint_highlight(component, painter, option, index)
|
|
281
|
+
|
|
282
|
+
self.paint_status(component, painter, option, index)
|
|
283
|
+
|
|
284
|
+
self.paint_icon(component, painter, option, index)
|
|
285
|
+
|
|
286
|
+
self.paint_text(component, painter, option, index)
|
|
287
|
+
|
|
288
|
+
self.paint_border(component, painter, option, index)
|
|
289
|
+
|
|
290
|
+
# ----------------------------------------------------------------------------------
|
|
291
|
+
def sizeHint(self, option, index):
|
|
292
|
+
return QtCore.QSize(1, self.item_size * self.factor)
|
xstack/app/demo.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import qtility
|
|
3
|
+
|
|
4
|
+
from .config import AppConfig
|
|
5
|
+
from .application import AppWindow
|
|
6
|
+
from .. import stack
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# --------------------------------------------------------------------------------------
|
|
10
|
+
class DemoAppConfig(AppConfig):
|
|
11
|
+
|
|
12
|
+
label = "Stack Demo"
|
|
13
|
+
|
|
14
|
+
component_paths = [
|
|
15
|
+
os.path.join(
|
|
16
|
+
os.path.dirname(os.path.dirname(__file__)),
|
|
17
|
+
"test",
|
|
18
|
+
)
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
stack_class = stack.Stack
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# --------------------------------------------------------------------------------------
|
|
25
|
+
# noinspection PyUnresolvedReferences,PyUnusedLocal
|
|
26
|
+
def launch_demo(blocking: bool = True, load_file: str = None, run_on_launch: bool = False):
|
|
27
|
+
"""
|
|
28
|
+
This function should be called to invoke the app ui in demonstration
|
|
29
|
+
mode, which exposes all the components used by xstacks unit tests.
|
|
30
|
+
"""
|
|
31
|
+
q_app = qtility.app.get()
|
|
32
|
+
w = AppWindow(app_config=DemoAppConfig)
|
|
33
|
+
w.show()
|
|
34
|
+
|
|
35
|
+
if load_file:
|
|
36
|
+
w.core.open(filepath=load_file, silent=True)
|
|
37
|
+
|
|
38
|
+
if run_on_launch and w.core.stack:
|
|
39
|
+
w.core.build()
|
|
40
|
+
|
|
41
|
+
if blocking:
|
|
42
|
+
q_app.exec_()
|