|
@@ -57,6 +57,9 @@ class NameButton(QPushButton):
|
57
|
57
|
self.consumption_created.connect(self.window().consumption_added)
|
58
|
58
|
|
59
|
59
|
self.clicked.connect(self.process_click)
|
|
60
|
+ self.setContextMenuPolicy(Qt.CustomContextMenu)
|
|
61
|
+ self.customContextMenuRequested.connect(self.confirm_hide)
|
|
62
|
+
|
60
|
63
|
|
61
|
64
|
@Slot(str)
|
62
|
65
|
def new_active_id(self, new_id: str) -> None:
|
|
@@ -91,6 +94,20 @@ class NameButton(QPushButton):
|
91
|
94
|
else:
|
92
|
95
|
print("Jantoeternuitje, kapot")
|
93
|
96
|
|
|
97
|
+ def confirm_hide(self) -> None:
|
|
98
|
+ ok = QMessageBox.warning(
|
|
99
|
+ self.window(),
|
|
100
|
+ 'Persoon verbergen?',
|
|
101
|
+ f'Wil je {self.person.name} verbergen?',
|
|
102
|
+ QMessageBox.Yes,
|
|
103
|
+ QMessageBox.Cancel,
|
|
104
|
+ )
|
|
105
|
+
|
|
106
|
+ if ok == QMessageBox.Yes:
|
|
107
|
+ LOG.warning('Hiding person %s', self.person.name)
|
|
108
|
+ self.person.set_active(False)
|
|
109
|
+ self.parent().init_ui()
|
|
110
|
+
|
94
|
111
|
|
95
|
112
|
class NameButtons(QWidget):
|
96
|
113
|
""" Main widget responsible for capturing presses and registering them.
|
|
@@ -114,6 +131,7 @@ class NameButtons(QWidget):
|
114
|
131
|
self.active_consumption_type_id = new_id
|
115
|
132
|
self.new_id_set.emit(new_id)
|
116
|
133
|
|
|
134
|
+
|
117
|
135
|
def init_ui(self) -> None:
|
118
|
136
|
""" Initialize UI: build GridLayout, retrieve People and build a button
|
119
|
137
|
for each. """
|
|
@@ -287,7 +305,7 @@ class PiketMainWindow(QMainWindow):
|
287
|
305
|
|
288
|
306
|
if name in inactive_names:
|
289
|
307
|
person = inactive_persons[inactive_names.index(name)]
|
290
|
|
- person.make_active()
|
|
308
|
+ person.set_active(True)
|
291
|
309
|
|
292
|
310
|
else:
|
293
|
311
|
person = Person(name=name)
|