The History header is now only shown if there are items again, and the clear history button resets everything. Also, reset hides individual items because, for some reason, they still show up otherwise.

This commit is contained in:
Micah Lee 2018-10-07 18:20:13 -07:00
parent bc573209d9
commit 38e62d8528
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -165,6 +165,7 @@ class HistoryItemList(QtWidgets.QScrollArea):
"""
for item in self.items.values():
self.items_layout.removeWidget(item)
item.hide()
self.items = {}
@ -222,6 +223,7 @@ class History(QtWidgets.QWidget):
# When there are items
self.item_list = HistoryItemList(self.common)
self.not_empty_layout = QtWidgets.QVBoxLayout()
self.not_empty_layout.addLayout(header_layout)
self.not_empty_layout.addWidget(self.item_list)
self.not_empty = QtWidgets.QWidget()
self.not_empty.setLayout(self.not_empty_layout)
@ -229,15 +231,12 @@ class History(QtWidgets.QWidget):
# Layout
layout = QtWidgets.QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.addLayout(header_layout)
layout.addWidget(self.empty)
layout.addWidget(self.not_empty)
self.setLayout(layout)
# Reset once at the beginning
self.reset()
self.update_completed()
self.update_in_progress()
def add(self, id, item):
"""
@ -252,7 +251,6 @@ class History(QtWidgets.QWidget):
# Add it to the list
self.item_list.add(id, item)
def update(self, id, data):
"""
Update an item.