def __init__(self, parent, client, app_name): super(NodesView, self).__init__(parent, client, app_name) self.node_id = None self.scene = QtGui.QGraphicsScene(0, 0, 30, 30) self.scene.setBackgroundBrush(self.palette().window()) self.setScene(self.scene) widget = QtGui.QGraphicsWidget() layout = QtGui.QGraphicsLinearLayout(QtCore.Qt.Vertical, widget) widget.setLayout(layout) self.scene.addItem(widget) self._path_label = PathLabel() self._path_label.node_id_clicked.connect(self.goto) self._path_label_proxy = QtGui.QGraphicsProxyWidget(widget) self._path_label_proxy.setWidget(self._path_label) layout.addItem(self._path_label_proxy) self._throbber_pix = resources.get_pixmap('gui.icons', 'throbber.gif') header = QtGui.QWidget() header.setLayout(QtGui.QVBoxLayout()) top_layout = QtGui.QHBoxLayout() header.layout().addLayout(top_layout) self._pict_label = QtGui.QLabel(header) top_layout.addWidget(self._pict_label) self._type_label = QtGui.QLabel(header) top_layout.addWidget(self._type_label) top_layout.addStretch(10) bot_layout = QtGui.QHBoxLayout() header.layout().addLayout(bot_layout) self._doc_label = QtGui.QLabel(header) bot_layout.addWidget(self._doc_label) plp = QtGui.QGraphicsProxyWidget(widget) plp.setWidget(header) layout.addItem(plp) self.liner = _Liner(widget) layout.addItem(self.liner) self._proc_items = [] self._many_items = [] self._case_items = [] self._child_items = [] self.client.add_event_handler(self.on_nav_current_changed, 'GUI', ['FLOW', 'Nav', 'current'])
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, item, param_infos): super(SetChoiceAction, self).__init__(parent) self.param_infos = item.get_param_infos(param_infos['name']) choices = self.param_infos['value'] target_value = item.get_param_infos( self.param_infos['editor_options']['target_param'])['value'] self.item = item pWidget = QtGui.QWidget(None) pLayout = QtGui.QVBoxLayout() pWidget.setLayout(pLayout) pLabel = QtGui.QLabel(pWidget) pLayout.addWidget(pLabel) self.setDefaultWidget(pWidget) if not choices: pLabel.setText('%s is %r, cannot change it.' % (self.param_infos['editor_options']['target_param'], target_value)) return if target_value not in choices: pLabel.setText('Change %s from %r to:' % (self.param_infos['editor_options']['target_param'], target_value)) else: pLabel.setText( 'Set %s:' % (self.param_infos['editor_options']['target_param'], )) self._buttons = [] for v in choices: label = v if isinstance(label, tuple): #TODO: this sucks like dyson. find a cleaner way to handle uid choices label = '/'.join(label) elif not isinstance(label, basestring): label = repr(v) if v == target_value: label = '[ %s ]' % (label, ) b = QtGui.QPushButton(label, pWidget) pLayout.layout().addWidget(b) b.clicked.connect( lambda checked=False, v=v: self.on_button_clicked(checked, v)) self._buttons.append(b)
def __init__(self, parent, client, app_name): super(SearchView, self).__init__(parent, client, app_name) self.setLayout(QtGui.QVBoxLayout()) menubar = QtGui.QMenuBar(self) self.layout().addWidget(menubar) self.presets = {} self.preset_menu = menubar.addMenu('Presets') toggleBox = ToggleBox(self, 'Parameters', open=False) self.layout().addWidget(toggleBox) self.qb = NodeQueryBuilder(self, self.client) toggleBox.addWidget(self.qb) waitter = QtGui.QLabel('Loading') wait_movie = QtGui.QMovie(resources.get('gui.icons', 'throbber.gif')) waitter.setMovie(wait_movie) wait_movie.start() waitter.hide() self.layout().addWidget(waitter, alignment=QtCore.Qt.AlignHCenter) self.qb.set_waitter(waitter) self.search_button = QtGui.QPushButton('Search', self) self.search_button.clicked.connect(self.on_search) self.layout().addWidget(self.search_button) self.list = ResultList(self) self.list.itemDoubleClicked.connect(self._on_item_double_clicked) self.layout().addWidget(self.list) # EVENTS self.client.add_event_handler(self._on_nav_current_changed, 'GUI', ['FLOW', 'Nav', 'current']) self.set_error(None) # default is not connected: self.on_disconnect()
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, caption, default_root_name=None, extra_root_names={}): super(NodePicker, self).__init__(parent) self._allow_multiple = True self.setLayout(QtGui.QVBoxLayout()) header = QtGui.QLabel(caption, self) self.layout().addWidget(header) self.tp = NodeTreePanel(self, client, extra_root_names) self.allow_multiple_selection(self._allow_multiple) self.layout().addWidget(self.tp) self.accept_button = QtGui.QPushButton('Accept', self) self.accept_button.clicked.connect(self.accept) self.layout().addWidget(self.accept_button) if client.connected(): self.set_connected() self.tp.set_named_root(default_root_name) else: self.accept_button.setEnabled(False)
def __init__(self, parent, client, app_name): super(VersionsView, self).__init__(parent, client, app_name) self._tags = ['filename'] self._current_node_id = None self._last_param_name = None self.setLayout(QtGui.QVBoxLayout()) top_lo = QtGui.QHBoxLayout() self.layout().addLayout(top_lo) self.param_selector = Selector('Select a file...', self) self.param_selector.setEditable(False) self.param_selector.selected.connect(self._on_select_param) top_lo.addWidget(self.param_selector) butt = QtGui.QPushButton('Show Versions Only', self) butt.setCheckable(True) butt.setChecked(True) top_lo.addWidget(butt) self.status_label = QtGui.QLabel(self) self.layout().addWidget(self.status_label) self.table = VersionsTable(self.client, self) self.table.load_finished.connect(self._on_table_loaded) self.layout().addWidget(self.table) self.table.status_changed.connect(self.status_label.setText) butt.toggled.connect(self.table.show_versions_only) self.client.add_event_handler( self._on_nav_current_changed, 'GUI', ['FLOW', 'Nav', 'current'] ) self.layout().addStretch(10)
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