Example #1
0
 def clear(self):
     for c in self:
         self.libraries.l.removeWidget(c)
         c.setParent(None)
         c.restriction_changed.disconnect()
         sip.delete(c)
     self._items = []
 def closed(self, d):
     try:
         d.closed.disconnect(self.closed)
         self.memory.remove(d)
     except ValueError:
         pass
     else:
         sip.delete(d)
         del d
Example #3
0
    def delete_done(self, spine_removals, other_removals):
        removals = []
        for i, (name, remove) in enumerate(spine_removals):
            if remove:
                removals.append(self.categories['text'].child(i))
        for category, parent in iteritems(self.categories):
            if category != 'text':
                for i in range(parent.childCount()):
                    child = parent.child(i)
                    if str(child.data(0, NAME_ROLE) or '') in other_removals:
                        removals.append(child)

        # The sorting by index is necessary otherwise Qt crashes with recursive
        # repaint detected message
        for c in sorted(removals, key=lambda x:x.parent().indexOfChild(x), reverse=True):
            sip.delete(c)

        # A bug in the raster paint engine on linux causes a crash if the scrollbar
        # is at the bottom and the delete happens to cause the scrollbar to
        # update
        b = self.verticalScrollBar()
        if b.value() == b.maximum():
            b.setValue(b.minimum())
            QTimer.singleShot(0, lambda : b.setValue(b.maximum()))
Example #4
0
 def safe_delete(x):
     if not sip.isdeleted(x):
         sip.delete(x)