def __init__(self, parent, sup_path, on_remove): super(SubPath, self).__init__(parent) self.setLayout(QtGui.QHBoxLayout()) self.layout().setContentsMargins(16, 0, 0, 0) self.label = QtGui.QLabel(sup_path, self) self.layout().addWidget(self.label) self._on_remove_func = on_remove self.remove_butt = QtGui.QToolButton(self) self.remove_butt.setText('X') self.remove_butt.clicked.connect(self._on_remove) self.layout().addWidget(self.remove_butt) self.layout().addStretch(100)
def __init__(self, parent, attr, on_remove): super(WhereField, self).__init__(parent) self.setLayout(QtGui.QHBoxLayout()) self.layout().setContentsMargins(16, 0, 0, 0) self.label = QtGui.QLabel(attr, self) self.layout().addWidget(self.label) self._op = self.op_eq self.op_butt = QtGui.QPushButton(self) got_default = False menu = QtGui.QMenu(self.op_butt) self.op_butt.setMenu(menu) for name, op in self.OPS: if name is None: menu.addSeparator() continue action = QtGui.QAction(name, self.op_butt) action.triggered.connect( lambda name=name, op=op: self.set_op(name, op)) menu.addAction(action) if not got_default: self.set_op(name, op) got_default = True self.layout().addWidget(self.op_butt) self.le = QtGui.QLineEdit(self) self.le.setAcceptDrops(True) self.le.dragEnterEvent = self._le_dragEnterEvent self.le.dropEvent = self._le_dropEvent self.le.dragMoveEvent = self._le_dragMoveEvent self.layout().addWidget(self.le) self._on_remove_func = on_remove self.remove_butt = QtGui.QToolButton(self) self.remove_butt.setText('X') self.remove_butt.clicked.connect(self._on_remove) self.layout().addWidget(self.remove_butt)
def __init__(self, parent, client): super(NodeQueryBuilder, self).__init__(parent) self.client = client self.setLayout(QtGui.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) under_lo = QtGui.QHBoxLayout() lb = QtGui.QLabel('Under:', self) under_lo.addWidget(lb) self.under_id_le = QtGui.QLineEdit(self) self.under_id_le.setToolTip( 'Specify the path like:\n Project/work/films:FILM/seqs:S01\nor None' ) self.under_id_le.returnPressed.connect(self._on_under_changed) self.under_id_le.setAcceptDrops(True) self.under_id_le.dragEnterEvent = self._under_id_le_dragEnterEvent self.under_id_le.dropEvent = self._under_id_le_dropEvent self.under_id_le.dragMoveEvent = self._under_id_le_dragMoveEvent under_lo.addWidget(self.under_id_le) tb = QtGui.QToolButton(self) tb.setText('...') tb.setIcon(resources.get_icon(('flow.icons.nodes', 'casting'))) tb.pressed.connect(self._on_under_dialog) under_lo.addWidget(tb) self.layout().addLayout(under_lo) find_lo = QtGui.QHBoxLayout() lb = QtGui.QLabel('Find:', self) find_lo.addWidget(lb) self._type_name = None self.type_name_select = Selector('Select Node Type', self) self.type_name_select.setEditable(False) self.type_name_select.selected.connect(self._on_select_type_name) find_lo.addWidget(self.type_name_select) self.layout().addLayout(find_lo) self.where_bt = QtGui.QToolButton(self) self.where_bt.setText('Where ') self.where_bt.setPopupMode(self.where_bt.InstantPopup) self._attr_menu = QtGui.QMenu(self.where_bt) self.where_bt.setMenu(self._attr_menu) self.layout().addWidget(self.where_bt) self.where_lo = QtGui.QVBoxLayout() self._wheres = [] self.layout().addLayout(self.where_lo) self.sub_path_bt = QtGui.QToolButton(self) self.sub_path_bt.setText('Select ') self.sub_path_bt.setPopupMode(self.sub_path_bt.InstantPopup) self._sub_path_menu = QtGui.QMenu(self.sub_path_bt) self.sub_path_bt.setMenu(self._sub_path_menu) self.layout().addWidget(self.sub_path_bt) self.sub_path_lo = QtGui.QVBoxLayout() self._sub_path_ws = [] self.layout().addLayout(self.sub_path_lo) self.waitter = None