Autofold/unfold when enabling/disabling

Fixes #93
This commit is contained in:
mailchuck 2015-11-09 18:45:35 +01:00 committed by Peter Surda
parent d9401c7180
commit 2783a1c1e5

View File

@ -29,6 +29,8 @@ class AccountMixin (object):
def setEnabled(self, enabled): def setEnabled(self, enabled):
self.isEnabled = enabled self.isEnabled = enabled
if hasattr(self, "setExpanded"):
self.setExpanded(enabled)
self.updateText() self.updateText()
def setType(self): def setType(self):
@ -107,9 +109,8 @@ class Ui_AddressWidget(QtGui.QTreeWidgetItem, AccountMixin):
self.setAddress(address) self.setAddress(address)
self.setEnabled(enabled) self.setEnabled(enabled)
self.setUnreadCount(unreadCount) self.setUnreadCount(unreadCount)
self.setType()
self.initialised = True self.initialised = True
self.setExpanded(enabled) # does updateText self.setType() # does updateText
def setAddress(self, address): def setAddress(self, address):
super(Ui_AddressWidget, self).setAddress(address) super(Ui_AddressWidget, self).setAddress(address)
@ -182,9 +183,8 @@ class Ui_SubscriptionWidget(Ui_AddressWidget, AccountMixin):
self.setEnabled(enabled) self.setEnabled(enabled)
self.setType() self.setType()
self.setLabel(label) self.setLabel(label)
self.setUnreadCount (unreadCount)
self.initialised = True self.initialised = True
self.setExpanded(enabled) # does updateText self.setUnreadCount (unreadCount) # does updateText
def setLabel(self, label): def setLabel(self, label):
self.label = label self.label = label