示例#1
0
 def update_collections(self):
     self.clear()
     for id, collection in sorted(user_collections.iteritems(),
                                  key=lambda (k, v):
                                  (locale.strxfrm(v.name.encode('utf-8')), k)):
         action = QtGui.QWidgetAction(self)
         action.setDefaultWidget(CollectionCheckBox(self, collection))
         self.addAction(action)
     self.addSeparator()
     self.refresh_action = self.addAction(_("Refresh List"))
示例#2
0
 def update_collections(self):
     self.clear()
     for id, collection in sorted(user_collections.iteritems(),
                                  key=lambda k_v:
                                  (locale.strxfrm(k_v[1].name.encode('utf-8')), k_v[0])):
         action = QtGui.QWidgetAction(self)
         action.setDefaultWidget(CollectionCheckBox(self, collection))
         self.addAction(action)
     self.addSeparator()
     self.refresh_action = self.addAction(_("Refresh List"))
示例#3
0
    def update_collections(self):
        for id, collection in user_collections.iteritems():
            action = self.actions_by_id.get(collection.id)
            if action:
                action.defaultWidget().updateText()
            else:
                action = QtGui.QWidgetAction(self)
                action.setDefaultWidget(CollectionCheckBox(self, collection))
                self.insertAction(self.separator, action)
                self.actions_by_id[collection.id] = action

        for id, action in self.actions_by_id.items():
            if id not in user_collections:
                self.removeAction(action)
                del self.actions_by_id[id]