Exemple #1
0
    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)
Exemple #2
0
    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)
Exemple #3
0
    def __init__(self, parent, client, app_name):
        super(UserView, self).__init__(parent, client, app_name)

        self.setLayout(QtGui.QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        menubar = QtGui.QMenuBar(self)
        self.layout().addWidget(menubar)

        self.up = UserPanel(self, self.client)
        self.layout().addWidget(self.up)

        self._user_view_definitions = []
        self.load_definitions()
        view_menu = menubar.addMenu('Select View')
        for view_definition in self._user_view_definitions:
            view_menu.addAction(view_definition.title,
                                lambda view_definition=view_definition: self.up
                                .set_view(view_definition))
Exemple #4
0
    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()
Exemple #5
0
    def __init__(self, parent, title, open=True):
        super(ToggleBox, self).__init__(parent)
        self.setStyleSheet(self._SS)

        self.setTitle(title)

        lo = QtGui.QVBoxLayout()
        self.setLayout(lo)

        self.setCheckable(True)
        self.toggled.connect(self._on_toggled)
        self.setChecked(open)
Exemple #6
0
 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)
Exemple #7
0
    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)
Exemple #8
0
 def data(self, index, role=QtCore.Qt.DisplayRole):
     if not index.isValid():
         return None
     
     row = index.row()
     column = index.column()
     
     if role == QtCore.Qt.DisplayRole:
         return self._data[row].label(column+1)
     
     elif role == QtCore.Qt.BackgroundRole:
         color = self._data[row].bg_color
         return color and QtGui.QColor(color) or None
     
     elif role == QtCore.Qt.ToolTipRole:
         return self._data[row].tooltip(column+1)
     
     return None
Exemple #9
0
    def _update_attrs_menu(self, attrs):
        self._attr_menu.clear()
        menus = {}
        self._sub_path_menu.clear()
        sp_menus = set()
        for attr in ['node_id'] + attrs:
            if '.' in attr:
                path, param = attr.rsplit('.', 1)
                if path not in sp_menus:
                    self._sub_path_menu.addAction(
                        path, lambda path=path: self.add_sub_path(path))
                    sp_menus.add(path)
                menu = menus.get(path)
                if menu is None:
                    menu_path = []
                    parent_menu = self._attr_menu
                    for name in path.split('.'):
                        menu_path += name
                        menu = menus.get('.'.join(menu_path))
                        if menu is None:
                            menu = QtGui.QMenu(name, parent_menu)
                            parent_menu.addMenu(menu)
                            menus['.'.join(menu_path)] = menu
                        parent_menu = menu
                label = param.replace('_', ' ')
            else:
                menu = self._attr_menu
                label = attr.replace('_', ' ')
            menu.addAction(label, lambda attr=attr: self.add_where(attr))

        for where in list(
                self._wheres
        ):  # copy the list so it can be altered by where.drop()!
            if not where.get_attr() in attrs:
                where.drop()

        for sp in list(
                self._sub_path_ws
        ):  # copy the list so it can be altered by where.drop()!
            if sp.get_label() not in sp_menus:
                sp.drop()

        self.hide_wait()
Exemple #10
0
    def __init__(self, parent, client, app_name):
        super(TreeView, self).__init__(parent, client, app_name)

        self.setLayout(QtGui.QVBoxLayout())
        self.layout().setContentsMargins(0, 0, 0, 0)

        self.tp = NodeTreePanel(self, self.client)
        self.tp.set_item_menu_filler(self._add_action_to_item_menu)
        self.tp.set_on_current_node_id_change_func(self.goto)
        self.layout().addWidget(self.tp)

        # EVENTS
        self.client.add_event_handler(self._on_nav_current_changed, 'GUI',
                                      ['FLOW', 'Nav', 'current'])
        self.client.add_event_handler(self._on_nav_root_changed, 'GUI',
                                      ['FLOW', 'Nav', 'root'],
                                      Event.TYPE.UPDATED)
        self.client.add_event_handler(self._on_live_bookmark_changed, 'GUI',
                                      ['FLOW', 'Nav', 'live_bookmark'],
                                      Event.TYPE.UPDATED)
Exemple #11
0
    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)
Exemple #12
0
    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
Exemple #13
0
    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'])
Exemple #14
0
 def _create_widget(self):
     self._button = QtGui.QPushButton('???', None)
     self._button.clicked.connect(self._on_click)
     self.setWidget(self._button)
Exemple #15
0
 def _on_table_menu(self, pos):
     menu = QtGui.QMenu(self)
     menu.addAction('Refresh', self.refresh)        
     menu.exec_(self.mapToGlobal(pos))