def rearrange(self): """ Set the backplate size, arrange the SelectorItems on it. """ biggest_width = 0 total_height = 0 # sort the containers by type grooveContainers = [] miscContainers = [] for path in self.containerItems: c = self.containerItems[path] if c.__class__ == GrooveContainerItem: grooveContainers.append(c) else: miscContainers.append(c) # use this to order the containers groups = [miscContainers, grooveContainers] for g in groups: for c in g: c.move(0,total_height) total_height += c.height() if biggest_width < c.width(): biggest_width = c.width() self.backplate.resize(biggest_width, total_height) # set the scroll cursor if necessary if Globals.qVersion() >= 3: if total_height > self.height(): self.setCursor(QCursor(Qt.SizeVerCursor)) else: self.setCursor(QCursor(Qt.PointingHandCursor))
def __init__(self, parent=None, name=None, f=0): QLabel.__init__(self, parent, name, f) self.setFrameStyle(QFrame.Box | QFrame.Plain) self.setLineWidth(1) if Globals.qVersion() >= 3: self.setCursor(QCursor(Qt.PointingHandCursor)) self.original_size = QSize(200,30) self.resize(self.original_size)
def mouseMoveEvent(self, e): """ Scroll/Drag the SelectorItems. """ # first move in a while if self.last_y == -1: self.initial_y_time = QTime.currentTime() self.processScrollEvent(e.y()) # test time against first move elif self.initial_y_time.addMSecs(bounce_padding) < QTime.currentTime(): self.processScrollEvent(e.y()) if Globals.qVersion() >= 3: e.accept()
def mouseReleaseEvent(self, e): self.last_y = -1 self.moveTickTally = 0 if Globals.qVersion() >= 3: e.accept()
def mouseReleaseEvent(self, e): # no ignore/accept in < qt < 3 if Globals.qVersion() >= 3: e.accept() if e.x() > 0 and e.y() > 0 and e.x() < self.width() and e.y() < self.height(): self.toggleOpen()
def mouseMoveEvent(self, e): # no ignore/accept in < qt < 3 if Globals.qVersion() >= 3: e.ignore()
def mousePressEvent(self, e): # no ignore/accept in < qt < 3 if Globals.qVersion() >= 3: e.accept()
def mouseReleaseEvent(self, e): if Globals.qVersion() >= 3: e.accept() self.emit(PYSIGNAL("clicked"), ())