def add_context(self, context): if 1 or self._holder.layout().rowCount(): line = QtGui.QFrame(self._holder) line.setFrameShape(line.HLine) self._holder.layout().addRow(line) proc_uid = context['proc_uid'] label = proc_uid[-1] self._holder.layout().addRow( '<h3>%s</h3>' % (label, ), ExecContextWidget(self._holder, self.proc_exec_panel, context))
def __init__(self, parent, anim_duration=250): super(SweepPanel, self).__init__(parent) self.anim_duration = anim_duration self.setLayout(QtGui.QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.screen_parent = QtGui.QFrame(self) self.screen_parent.setLayout(QtGui.QHBoxLayout()) self.screen_parent.layout().setContentsMargins(0, 0, 0, 0) self.layout().addWidget(self.screen_parent) self.current_screen = None
if v == value: label = l if label is None: raise ValueError('Could not find an label for value %r'%(value,)) for i in range(self._cb.count()): if self._cb.itemText(i) == label: self._cb.setCurrentIndex(i) self.selected.emit(label, value) return raise ValueError('Could not find an item with label %r'%(label,)) if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) f = QtGui.QFrame(None) f.resize(500,500) f.setLayout(QtGui.QVBoxLayout()) def on_select(label, data): print 'Selected:', label, data w = Selector('Select One of those...', f) w.selected.connect(on_select) f.layout().addWidget(w) def fill(): items = [ ('Item '+str(i)+' hop', i) for i in range(50) ] w.set_items(items) def fetch():