-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUILineWidget.py
61 lines (53 loc) · 2.18 KB
/
UILineWidget.py
1
2
3
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
55
56
57
58
59
60
61
from PyQt6.QtWidgets import QWidget, QHBoxLayout, QLabel
from UIShipWidget import UIShipWidget
from UIFilterList import UIFilterList
from UISortList import UISortList
import threading
class UILineWidget(QWidget):
def __init__(self, label, parent=None):
QWidget.__init__(self, parent=parent)
self.Label1 = UIShipWidget()
self.Label2 = UIShipWidget()
self.Label3 = UIShipWidget()
self.SortList = UISortList()
self.FilterList = UIFilterList(label)
self.TitleLabel = QLabel(label)
layout = QHBoxLayout(self) # Horizontal box layout
layout.addWidget(self.TitleLabel)
layout.addWidget(self.Label1)
layout.addWidget(self.Label2)
layout.addWidget(self.Label3)
layout.addWidget(self.SortList)
layout.addWidget(self.FilterList)
def set_label(self, new_label):
self.TitleLabel.setText(new_label)
def clear_line(self):
self.Label1.clear_widget()
self.Label2.clear_widget()
self.Label3.clear_widget()
def update_pics(self, image_list, name_list):
# Do a batch update of the images
# TODO/BUG handle case when list < 3
if len(image_list) == 0 or len(name_list) == 0:
return
if len(name_list) == 2:
t1 = threading.Thread(target=self.Label1.update_image, args=(image_list[0], name_list[0]))
t2 = threading.Thread(target=self.Label2.update_image, args=(image_list[1], name_list[1]))
t1.start()
t2.start()
t1.join()
t2.join()
elif len(name_list) == 1:
t1 = threading.Thread(target=self.Label1.update_image, args=(image_list[0], name_list[0]))
t1.start()
t1.join()
else:
t1 = threading.Thread(target=self.Label1.update_image, args=(image_list[0], name_list[0]))
t2 = threading.Thread(target=self.Label2.update_image, args=(image_list[1], name_list[1]))
t3 = threading.Thread(target=self.Label3.update_image, args=(image_list[2], name_list[2]))
t1.start()
t2.start()
t3.start()
t1.join()
t2.join()
t3.join()