sgtlib 3.3.9__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.
- StructuralGT/__init__.py +31 -0
- StructuralGT/apps/__init__.py +0 -0
- StructuralGT/apps/cli_main.py +258 -0
- StructuralGT/apps/gui_main.py +69 -0
- StructuralGT/apps/gui_mcw/__init__.py +0 -0
- StructuralGT/apps/gui_mcw/checkbox_model.py +91 -0
- StructuralGT/apps/gui_mcw/controller.py +1073 -0
- StructuralGT/apps/gui_mcw/image_provider.py +74 -0
- StructuralGT/apps/gui_mcw/imagegrid_model.py +75 -0
- StructuralGT/apps/gui_mcw/qthread_worker.py +102 -0
- StructuralGT/apps/gui_mcw/table_model.py +79 -0
- StructuralGT/apps/gui_mcw/tree_model.py +154 -0
- StructuralGT/apps/sgt_qml/CenterMainContent.qml +19 -0
- StructuralGT/apps/sgt_qml/LeftContent.qml +48 -0
- StructuralGT/apps/sgt_qml/MainWindow.qml +762 -0
- StructuralGT/apps/sgt_qml/RightLoggingPanel.qml +125 -0
- StructuralGT/apps/sgt_qml/assets/icons/.DS_Store +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/back_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/brightness_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/cancel_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/crop_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/edit_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/graph_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/hide_panel.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/next_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/notify_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/rescale_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/show_panel.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/square_icon.png +0 -0
- StructuralGT/apps/sgt_qml/assets/icons/undo_icon.png +0 -0
- StructuralGT/apps/sgt_qml/components/ImageFilters.qml +82 -0
- StructuralGT/apps/sgt_qml/components/ImageProperties.qml +112 -0
- StructuralGT/apps/sgt_qml/components/ProjectNav.qml +127 -0
- StructuralGT/apps/sgt_qml/widgets/BinaryFilterWidget.qml +151 -0
- StructuralGT/apps/sgt_qml/widgets/BrightnessControlWidget.qml +103 -0
- StructuralGT/apps/sgt_qml/widgets/CreateProjectWidget.qml +112 -0
- StructuralGT/apps/sgt_qml/widgets/GTWidget.qml +94 -0
- StructuralGT/apps/sgt_qml/widgets/GraphComputeWidget.qml +77 -0
- StructuralGT/apps/sgt_qml/widgets/GraphExtractWidget.qml +175 -0
- StructuralGT/apps/sgt_qml/widgets/GraphPropertyWidget.qml +77 -0
- StructuralGT/apps/sgt_qml/widgets/ImageFilterWidget.qml +137 -0
- StructuralGT/apps/sgt_qml/widgets/ImagePropertyWidget.qml +78 -0
- StructuralGT/apps/sgt_qml/widgets/ImageViewWidget.qml +585 -0
- StructuralGT/apps/sgt_qml/widgets/MenuBarWidget.qml +137 -0
- StructuralGT/apps/sgt_qml/widgets/MicroscopyPropertyWidget.qml +80 -0
- StructuralGT/apps/sgt_qml/widgets/ProjectWidget.qml +141 -0
- StructuralGT/apps/sgt_qml/widgets/RescaleControlWidget.qml +83 -0
- StructuralGT/apps/sgt_qml/widgets/RibbonWidget.qml +406 -0
- StructuralGT/apps/sgt_qml/widgets/StatusBarWidget.qml +173 -0
- StructuralGT/compute/__init__.py +0 -0
- StructuralGT/compute/c_lang/include/sgt_base.h +21 -0
- StructuralGT/compute/graph_analyzer.py +1499 -0
- StructuralGT/entrypoints.py +49 -0
- StructuralGT/imaging/__init__.py +0 -0
- StructuralGT/imaging/base_image.py +403 -0
- StructuralGT/imaging/image_processor.py +780 -0
- StructuralGT/modules.py +29 -0
- StructuralGT/networks/__init__.py +0 -0
- StructuralGT/networks/fiber_network.py +490 -0
- StructuralGT/networks/graph_skeleton.py +425 -0
- StructuralGT/networks/sknw_mod.py +199 -0
- StructuralGT/utils/__init__.py +0 -0
- StructuralGT/utils/config_loader.py +244 -0
- StructuralGT/utils/configs.ini +97 -0
- StructuralGT/utils/progress_update.py +67 -0
- StructuralGT/utils/sgt_utils.py +291 -0
- sgtlib-3.3.9.dist-info/METADATA +789 -0
- sgtlib-3.3.9.dist-info/RECORD +72 -0
- sgtlib-3.3.9.dist-info/WHEEL +5 -0
- sgtlib-3.3.9.dist-info/entry_points.txt +3 -0
- sgtlib-3.3.9.dist-info/licenses/LICENSE +674 -0
- sgtlib-3.3.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,406 @@
|
|
1
|
+
import QtQuick
|
2
|
+
import QtQuick.Controls
|
3
|
+
import QtQuick.Controls.Basic as Basic
|
4
|
+
import QtQuick.Layouts
|
5
|
+
//import Qt5Compat.GraphicalEffects
|
6
|
+
import "../widgets"
|
7
|
+
|
8
|
+
// Icons retrieved from Iconfinder.com and used under the CC0 1.0 Universal Public Domain Dedication.
|
9
|
+
|
10
|
+
Rectangle {
|
11
|
+
id: rectRibbon
|
12
|
+
width: parent.width
|
13
|
+
height: 40
|
14
|
+
radius: 5
|
15
|
+
color: "#f0f0f0"
|
16
|
+
border.color: "#c0c0c0"
|
17
|
+
border.width: 1
|
18
|
+
|
19
|
+
/*DropShadow {
|
20
|
+
anchors.fill: rectRibbon
|
21
|
+
source: rectRibbon
|
22
|
+
horizontalOffset: 0
|
23
|
+
verticalOffset: 5
|
24
|
+
radius: 1
|
25
|
+
samples: 16
|
26
|
+
color: "black"
|
27
|
+
opacity: 0.5
|
28
|
+
}
|
29
|
+
|
30
|
+
Rectangle {
|
31
|
+
anchors.fill: rectRibbon
|
32
|
+
radius: 5
|
33
|
+
color: "#f0f0f0" // the rectangle's own background
|
34
|
+
border.color: "#d0d0d0"
|
35
|
+
border.width: 1
|
36
|
+
}*/
|
37
|
+
|
38
|
+
RowLayout {
|
39
|
+
anchors.left: parent.left
|
40
|
+
anchors.verticalCenter: parent.verticalCenter
|
41
|
+
|
42
|
+
RowLayout {
|
43
|
+
Layout.leftMargin: 5
|
44
|
+
|
45
|
+
Basic.Button {
|
46
|
+
id: btnHideLeftPane
|
47
|
+
Layout.preferredWidth: 40
|
48
|
+
Layout.preferredHeight: 36
|
49
|
+
text: ""
|
50
|
+
property bool hidePane: true
|
51
|
+
icon.source: hidePane ? "../assets/icons/hide_panel.png" : "../assets/icons/show_panel.png"
|
52
|
+
icon.width: 28
|
53
|
+
icon.height: 28
|
54
|
+
background: Rectangle { color: "transparent" }
|
55
|
+
ToolTip.text: hidePane ? "Hide left pane" : "Show left pane"
|
56
|
+
ToolTip.visible: btnHideLeftPane.hovered
|
57
|
+
visible: true
|
58
|
+
onClicked: {
|
59
|
+
if (hidePane) {
|
60
|
+
hidePane = false;
|
61
|
+
} else {
|
62
|
+
hidePane = true;
|
63
|
+
}
|
64
|
+
toggleLeftPane(hidePane);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
RowLayout {
|
72
|
+
anchors.right: parent.right
|
73
|
+
anchors.verticalCenter: parent.verticalCenter
|
74
|
+
|
75
|
+
RowLayout {
|
76
|
+
|
77
|
+
Basic.Button {
|
78
|
+
id: btnRescale
|
79
|
+
Layout.preferredWidth: 36
|
80
|
+
Layout.preferredHeight: 36
|
81
|
+
text: ""
|
82
|
+
icon.source: "../assets/icons/rescale_icon.png" // Path to your icon
|
83
|
+
icon.width: 20 // Adjust as needed
|
84
|
+
icon.height: 20
|
85
|
+
background: Rectangle { color: "transparent" }
|
86
|
+
ToolTip.text: "Re-scale large images"
|
87
|
+
ToolTip.visible: btnRescale.hovered
|
88
|
+
enabled: true
|
89
|
+
onClicked: drpDownRescale.open()
|
90
|
+
|
91
|
+
|
92
|
+
Popup {
|
93
|
+
id: drpDownRescale
|
94
|
+
width: 180
|
95
|
+
//height: colRadioButtons.implicitHeight + 10
|
96
|
+
height: 50
|
97
|
+
modal: false
|
98
|
+
focus: true
|
99
|
+
x: 2
|
100
|
+
y: 32
|
101
|
+
background: Rectangle {
|
102
|
+
color: "#f0f0f0"
|
103
|
+
border.color: "#d0d0d0"
|
104
|
+
border.width: 1
|
105
|
+
radius: 2
|
106
|
+
}
|
107
|
+
|
108
|
+
ColumnLayout {
|
109
|
+
anchors.fill: parent
|
110
|
+
|
111
|
+
RowLayout {
|
112
|
+
id: allowScalingContainer
|
113
|
+
spacing: 2
|
114
|
+
//Layout.alignment: Qt.AlignHCenter
|
115
|
+
visible: !mainController.display_image()
|
116
|
+
|
117
|
+
Label {
|
118
|
+
text: "Auto Scale Image"
|
119
|
+
color: "#2244bc"
|
120
|
+
}
|
121
|
+
|
122
|
+
Switch {
|
123
|
+
id: toggleAllowScaling
|
124
|
+
checked: true
|
125
|
+
onCheckedChanged: {
|
126
|
+
if (checked) {
|
127
|
+
// Actions when switched on
|
128
|
+
mainController.set_auto_scale(true)
|
129
|
+
} else {
|
130
|
+
// Actions when switched off
|
131
|
+
mainController.set_auto_scale(false)
|
132
|
+
}
|
133
|
+
}
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
RescaleControlWidget{}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
Basic.Button {
|
145
|
+
id: btnBrightness
|
146
|
+
Layout.preferredWidth: 36
|
147
|
+
Layout.preferredHeight: 36
|
148
|
+
text: ""
|
149
|
+
icon.source: "../assets/icons/brightness_icon.png" // Path to your icon
|
150
|
+
icon.width: 21 // Adjust as needed
|
151
|
+
icon.height: 21
|
152
|
+
background: Rectangle { color: "transparent" }
|
153
|
+
ToolTip.text: "Adjust brightness/contrast"
|
154
|
+
ToolTip.visible: btnBrightness.hovered
|
155
|
+
onClicked: drpDownBrightness.open()
|
156
|
+
enabled: mainController.display_image()
|
157
|
+
|
158
|
+
Popup {
|
159
|
+
id: drpDownBrightness
|
160
|
+
width: 260
|
161
|
+
height: 100
|
162
|
+
modal: false
|
163
|
+
focus: true
|
164
|
+
x: 2
|
165
|
+
y: 32
|
166
|
+
background: Rectangle {
|
167
|
+
color: "#f0f0f0"
|
168
|
+
border.color: "#d0d0d0"
|
169
|
+
border.width: 1
|
170
|
+
radius: 2
|
171
|
+
}
|
172
|
+
|
173
|
+
ColumnLayout {
|
174
|
+
anchors.fill: parent
|
175
|
+
BrightnessControlWidget{}
|
176
|
+
}
|
177
|
+
|
178
|
+
}
|
179
|
+
|
180
|
+
}
|
181
|
+
|
182
|
+
Basic.Button {
|
183
|
+
id: btnSelect
|
184
|
+
text: ""
|
185
|
+
Layout.preferredWidth: 32
|
186
|
+
Layout.preferredHeight: 32
|
187
|
+
background: Rectangle { color: "transparent"}
|
188
|
+
ToolTip.text: "Select area to crop"
|
189
|
+
ToolTip.visible: btnSelect.hovered
|
190
|
+
visible: mainController.display_image()
|
191
|
+
onClicked: enableRectangularSelect()
|
192
|
+
|
193
|
+
Rectangle {
|
194
|
+
id: btnSelectBorder
|
195
|
+
width: 18
|
196
|
+
height: 18
|
197
|
+
//width: parent.width
|
198
|
+
//height: parent.height
|
199
|
+
anchors.centerIn: parent
|
200
|
+
radius: 2
|
201
|
+
color: "transparent"
|
202
|
+
border.width: 1
|
203
|
+
border.color: "black"
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
Basic.Button {
|
208
|
+
id: btnCrop
|
209
|
+
text: ""
|
210
|
+
Layout.preferredWidth: 36
|
211
|
+
Layout.preferredHeight: 36
|
212
|
+
icon.source: "../assets/icons/crop_icon.png" // Path to your icon
|
213
|
+
icon.width: 21 // Adjust as needed
|
214
|
+
icon.height: 21
|
215
|
+
background: Rectangle { color: "transparent"}
|
216
|
+
ToolTip.text: "Crop to selection"
|
217
|
+
ToolTip.visible: btnCrop.hovered
|
218
|
+
visible: false
|
219
|
+
onClicked: mainController.perform_cropping(true)
|
220
|
+
}
|
221
|
+
|
222
|
+
Basic.Button {
|
223
|
+
id: btnUndo
|
224
|
+
text: ""
|
225
|
+
Layout.preferredWidth: 36
|
226
|
+
Layout.preferredHeight: 36
|
227
|
+
icon.source: "../assets/icons/undo_icon.png" // Path to your icon
|
228
|
+
icon.width: 24 // Adjust as needed
|
229
|
+
icon.height: 24
|
230
|
+
background: Rectangle { color: "transparent"}
|
231
|
+
ToolTip.text: "Undo crop"
|
232
|
+
ToolTip.visible: btnUndo.hovered
|
233
|
+
onClicked: mainController.undo_cropping(true)
|
234
|
+
visible: false
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
Rectangle {
|
239
|
+
width: 1
|
240
|
+
height: 24
|
241
|
+
color: "#d0d0d0"
|
242
|
+
}
|
243
|
+
|
244
|
+
RowLayout {
|
245
|
+
Layout.rightMargin: 5
|
246
|
+
|
247
|
+
ComboBox {
|
248
|
+
id: cbImageType
|
249
|
+
Layout.minimumWidth: 150
|
250
|
+
model: ListModel {
|
251
|
+
id: imgTypeModel
|
252
|
+
ListElement { text: "Original Image"; value: "original" }
|
253
|
+
ListElement { text: "Binary Image"; value: "binary" }
|
254
|
+
ListElement { text: "Processed Image"; value: "processed" }
|
255
|
+
ListElement { text: "Extracted Graph"; value: "graph" }
|
256
|
+
}
|
257
|
+
implicitContentWidthPolicy: ComboBox.WidestTextWhenCompleted
|
258
|
+
textRole: "text"
|
259
|
+
valueRole: "value"
|
260
|
+
ToolTip.text: "Change image type"
|
261
|
+
ToolTip.visible: cbImageType.hovered
|
262
|
+
enabled: mainController.display_image()
|
263
|
+
onCurrentIndexChanged: mainController.toggle_current_img_view(valueAt(currentIndex))
|
264
|
+
}
|
265
|
+
|
266
|
+
Basic.Button {
|
267
|
+
id: btnShowGraph
|
268
|
+
text: ""
|
269
|
+
Layout.preferredWidth: 36
|
270
|
+
Layout.preferredHeight: 36
|
271
|
+
icon.source: "../assets/icons/graph_icon.png" // Path to your icon
|
272
|
+
icon.width: 24 // Adjust as needed
|
273
|
+
icon.height: 24
|
274
|
+
background: Rectangle { color: "transparent"}
|
275
|
+
ToolTip.text: "Show graph"
|
276
|
+
ToolTip.visible: btnShowGraph.hovered
|
277
|
+
onClicked: drpDownGraph.open()
|
278
|
+
enabled: mainController.display_image()
|
279
|
+
|
280
|
+
Popup {
|
281
|
+
id: drpDownGraph
|
282
|
+
width: 250
|
283
|
+
height: 400
|
284
|
+
modal: true
|
285
|
+
focus: false
|
286
|
+
x: -225
|
287
|
+
y: 32
|
288
|
+
background: Rectangle {
|
289
|
+
color: "#f0f0f0"
|
290
|
+
border.color: "#d0d0d0"
|
291
|
+
border.width: 1
|
292
|
+
radius: 2
|
293
|
+
}
|
294
|
+
|
295
|
+
ColumnLayout {
|
296
|
+
anchors.fill: parent
|
297
|
+
|
298
|
+
GraphExtractWidget{}
|
299
|
+
|
300
|
+
RowLayout {
|
301
|
+
spacing: 10
|
302
|
+
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
303
|
+
|
304
|
+
Button {
|
305
|
+
Layout.preferredWidth: 54
|
306
|
+
Layout.preferredHeight: 30
|
307
|
+
text: ""
|
308
|
+
onClicked: drpDownGraph.close()
|
309
|
+
|
310
|
+
Rectangle {
|
311
|
+
anchors.fill: parent
|
312
|
+
radius: 5
|
313
|
+
color: "#bc0000"
|
314
|
+
|
315
|
+
Label {
|
316
|
+
text: "Cancel"
|
317
|
+
color: "#ffffff"
|
318
|
+
anchors.centerIn: parent
|
319
|
+
}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
Button {
|
324
|
+
Layout.preferredWidth: 40
|
325
|
+
Layout.preferredHeight: 30
|
326
|
+
text: ""
|
327
|
+
onClicked: {
|
328
|
+
mainController.run_extract_graph();
|
329
|
+
drpDownGraph.close();
|
330
|
+
}
|
331
|
+
|
332
|
+
Rectangle {
|
333
|
+
anchors.fill: parent
|
334
|
+
radius: 5
|
335
|
+
color: "#22bc55"
|
336
|
+
|
337
|
+
Label {
|
338
|
+
text: "OK"
|
339
|
+
color: "#ffffff"
|
340
|
+
anchors.centerIn: parent
|
341
|
+
}
|
342
|
+
}
|
343
|
+
}
|
344
|
+
}
|
345
|
+
}
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
}
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
function enableRectangularSelect() {
|
354
|
+
if (btnSelectBorder.enabled) {
|
355
|
+
mainController.enable_rectangular_selection(false)
|
356
|
+
btnSelectBorder.border.color = "black"
|
357
|
+
btnSelectBorder.enabled = false
|
358
|
+
} else {
|
359
|
+
mainController.enable_rectangular_selection(true)
|
360
|
+
btnSelectBorder.border.color = "red"
|
361
|
+
btnSelectBorder.enabled = true
|
362
|
+
}
|
363
|
+
}
|
364
|
+
|
365
|
+
Connections {
|
366
|
+
target: mainController
|
367
|
+
|
368
|
+
function onShowCroppingToolSignal(allow) {
|
369
|
+
if (allow) {
|
370
|
+
btnCrop.visible = true;
|
371
|
+
} else {
|
372
|
+
btnCrop.visible = false
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
function onShowUnCroppingToolSignal(allow) {
|
377
|
+
if (allow) {
|
378
|
+
btnUndo.visible = true
|
379
|
+
} else {
|
380
|
+
btnUndo.visible = false
|
381
|
+
}
|
382
|
+
}
|
383
|
+
|
384
|
+
function onImageChangedSignal() {
|
385
|
+
// Force refresh
|
386
|
+
btnSelect.visible = mainController.display_image();
|
387
|
+
allowScalingContainer.visible = !mainController.display_image();
|
388
|
+
btnBrightness.enabled = mainController.display_image();
|
389
|
+
cbImageType.enabled = mainController.display_image();
|
390
|
+
btnShowGraph.enabled = mainController.display_image();
|
391
|
+
|
392
|
+
drpDownRescale.height = mainController.display_image() ? 180 : 50;
|
393
|
+
//if (drpDownRescale.opened ) { drpDownRescale.close(); }
|
394
|
+
|
395
|
+
let curr_view = mainController.get_selected_img_type();
|
396
|
+
for (let i=0; i < cbImageType.model.count; i++) {
|
397
|
+
if (cbImageType.model.get(i).value === curr_view){
|
398
|
+
cbImageType.currentIndex = i;
|
399
|
+
}
|
400
|
+
}
|
401
|
+
}
|
402
|
+
}
|
403
|
+
|
404
|
+
}
|
405
|
+
|
406
|
+
|
@@ -0,0 +1,173 @@
|
|
1
|
+
import QtQuick
|
2
|
+
import QtQuick.Controls
|
3
|
+
import QtQuick.Controls.Basic as Basic
|
4
|
+
import QtQuick.Layouts
|
5
|
+
|
6
|
+
// Icons retrieved from Iconfinder.com and used under the CC0 1.0 Universal Public Domain Dedication.
|
7
|
+
|
8
|
+
Rectangle {
|
9
|
+
id: statusBar
|
10
|
+
width: parent.width
|
11
|
+
height: 72
|
12
|
+
color: "#f0f0f0"
|
13
|
+
border.color: "#d0d0d0"
|
14
|
+
|
15
|
+
ColumnLayout {
|
16
|
+
anchors.fill: parent
|
17
|
+
spacing: 2
|
18
|
+
|
19
|
+
// First Row: Progress Bar
|
20
|
+
RowLayout {
|
21
|
+
Layout.fillWidth: true // Make the row take the full width of the column
|
22
|
+
Layout.leftMargin: 36
|
23
|
+
Layout.rightMargin: 36 // Progress bar covers 80% of the width
|
24
|
+
spacing: 5
|
25
|
+
|
26
|
+
ProgressBar {
|
27
|
+
id: progressBar
|
28
|
+
Layout.fillWidth: true
|
29
|
+
visible: mainController.is_task_running()
|
30
|
+
value: 0 // Example value (50% progress)
|
31
|
+
from: 0
|
32
|
+
to: 100
|
33
|
+
}
|
34
|
+
|
35
|
+
Basic.Button {
|
36
|
+
id: btnCancel
|
37
|
+
text: ""
|
38
|
+
Layout.preferredWidth: 40
|
39
|
+
Layout.preferredHeight: 40
|
40
|
+
icon.source: "../assets/icons/cancel_icon.png"
|
41
|
+
icon.width: 21
|
42
|
+
icon.height: 21
|
43
|
+
ToolTip.text: "Cancel task!"
|
44
|
+
ToolTip.visible: btnCancel.hovered
|
45
|
+
background: Rectangle { color: "transparent"}
|
46
|
+
visible: mainController.is_task_running()
|
47
|
+
enabled: mainController.is_task_running()
|
48
|
+
onClicked: {
|
49
|
+
btnCancel.visible = false;
|
50
|
+
lblStatusMsg.text = "initiating abort...";
|
51
|
+
console.log("Progress canceled")
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
// Second Row: Label and Button
|
57
|
+
RowLayout {
|
58
|
+
Layout.fillWidth: true
|
59
|
+
Layout.leftMargin: 36
|
60
|
+
Layout.rightMargin: 36
|
61
|
+
Layout.bottomMargin: 10
|
62
|
+
spacing: 5
|
63
|
+
|
64
|
+
Label {
|
65
|
+
id: lblStatusMsg
|
66
|
+
Layout.alignment: Qt.AlignLeft
|
67
|
+
text: mainController.get_sgt_version()
|
68
|
+
Layout.fillWidth: true
|
69
|
+
color: "#2222bc"
|
70
|
+
}
|
71
|
+
|
72
|
+
Basic.Button {
|
73
|
+
id: btnNotify
|
74
|
+
Layout.preferredWidth: 36
|
75
|
+
Layout.preferredHeight: 36
|
76
|
+
text: ""
|
77
|
+
icon.source: "../assets/icons/notify_icon.png"
|
78
|
+
icon.width: 21
|
79
|
+
icon.height: 21
|
80
|
+
background: Rectangle { color: "transparent" }
|
81
|
+
ToolTip.text: "Check for updates"
|
82
|
+
ToolTip.visible: btnNotify.hovered
|
83
|
+
onClicked: drpDownNotify.open()
|
84
|
+
enabled: true
|
85
|
+
visible: !mainController.is_task_running()
|
86
|
+
|
87
|
+
Popup {
|
88
|
+
id: drpDownNotify
|
89
|
+
width: 128
|
90
|
+
height: 64
|
91
|
+
modal: false
|
92
|
+
focus: true
|
93
|
+
x: -60
|
94
|
+
y: -60
|
95
|
+
background: Rectangle {
|
96
|
+
color: "#f0f0f0"
|
97
|
+
border.color: "#d0d0d0"
|
98
|
+
border.width: 1
|
99
|
+
radius: 2
|
100
|
+
}
|
101
|
+
|
102
|
+
ColumnLayout {
|
103
|
+
anchors.fill: parent
|
104
|
+
|
105
|
+
Label {
|
106
|
+
id: lblNotifyMsg
|
107
|
+
font.pixelSize: 10
|
108
|
+
wrapMode: Text.Wrap
|
109
|
+
textFormat: Text.RichText // Enable HTML formatting
|
110
|
+
onLinkActivated: (link) => Qt.openUrlExternally(link) // Opens links in default browser
|
111
|
+
text: mainController.check_for_updates()
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
Connections {
|
122
|
+
target: mainController
|
123
|
+
|
124
|
+
function onUpdateProgressSignal(val, msg) {
|
125
|
+
if (val <= 100) {
|
126
|
+
progressBar.value = val;
|
127
|
+
} else {
|
128
|
+
progressBar.value = 50;
|
129
|
+
}
|
130
|
+
lblStatusMsg.text = msg;
|
131
|
+
lblStatusMsg.color = "#008b00";
|
132
|
+
progressBar.visible = mainController.is_task_running();
|
133
|
+
btnCancel.visible = mainController.is_task_running();
|
134
|
+
btnNotify.visible = !mainController.is_task_running();
|
135
|
+
btnCancel.enabled = mainController.is_task_running();
|
136
|
+
}
|
137
|
+
|
138
|
+
function onErrorSignal (msg) {
|
139
|
+
progressBar.value = 0;
|
140
|
+
lblStatusMsg.text = msg;
|
141
|
+
lblStatusMsg.color = "#bc2222";
|
142
|
+
progressBar.visible = mainController.is_task_running();
|
143
|
+
btnCancel.visible = mainController.is_task_running();
|
144
|
+
btnNotify.visible = !mainController.is_task_running();
|
145
|
+
btnCancel.enabled = mainController.is_task_running();
|
146
|
+
}
|
147
|
+
|
148
|
+
function onTaskTerminatedSignal(success_val, msg_data){
|
149
|
+
//console.log(success_val);
|
150
|
+
if (success_val) {
|
151
|
+
lblStatusMsg.color = "#2222bc";
|
152
|
+
lblStatusMsg.text = mainController.get_sgt_version();
|
153
|
+
} else {
|
154
|
+
lblStatusMsg.color = "#bc2222";
|
155
|
+
lblStatusMsg.text = "Task terminated due to an error. Try again.";
|
156
|
+
}
|
157
|
+
|
158
|
+
if (msg_data.length > 0) {
|
159
|
+
dialogAlert.title = msg_data[0];
|
160
|
+
lblAlertMsg.text = msg_data[1];
|
161
|
+
lblAlertMsg.color = success_val ? "#2222bc" : "#bc2222";
|
162
|
+
dialogAlert.open();
|
163
|
+
}
|
164
|
+
|
165
|
+
lblNotifyMsg.text = mainController.check_for_updates();
|
166
|
+
progressBar.visible = mainController.is_task_running();
|
167
|
+
btnCancel.visible = mainController.is_task_running();
|
168
|
+
btnNotify.visible = !mainController.is_task_running();
|
169
|
+
btnCancel.enabled = mainController.is_task_running();
|
170
|
+
}
|
171
|
+
|
172
|
+
}
|
173
|
+
}
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#ifndef THREAD_ARGS_H
|
2
|
+
#define THREAD_ARGS_H
|
3
|
+
|
4
|
+
#include <igraph.h>
|
5
|
+
#include <pthread.h>
|
6
|
+
|
7
|
+
// Structure to hold thread arguments
|
8
|
+
typedef struct {
|
9
|
+
igraph_t *graph;
|
10
|
+
igraph_integer_t i;
|
11
|
+
igraph_integer_t j;
|
12
|
+
igraph_integer_t *total_nc; // Pointer to store the result
|
13
|
+
igraph_integer_t *total_count;
|
14
|
+
pthread_mutex_t *mutex; // Pointer to mutex
|
15
|
+
} ThreadArgsLNC;
|
16
|
+
|
17
|
+
#endif /* THREAD_ARGS_H */
|
18
|
+
|
19
|
+
void* compute_lnc(void *arg);
|
20
|
+
igraph_matrix_t* str_to_matrix(char* str_adj_mat, igraph_integer_t num_vertices);
|
21
|
+
|