Beispiel #1
0
 def next(self):
     self.sweep_panel.clear()
     screen = self.sweep_panel.new_screen()
     screen.setLayout(QtGui.QFormLayout())
     for i in range(10):
         self.index += 1
         screen.layout().addRow('Row #' + str(self.index),
                                QtGui.QLineEdit(i * 'blah ', screen))
Beispiel #2
0
    def __init__(self, parent, client):
        super(UserPanel, self).__init__(parent)
        self.client = client

        self.setWidgetResizable(True)
        self.setWidget(QtGui.QWidget(self))
        self.setFrameStyle(self.NoFrame)

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

        self.definition = None
Beispiel #3
0
    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
Beispiel #4
0
    def __init__(self, parent, proc_exec_panel, context):
        super(ExecContextWidget, self).__init__(parent)
        self.proc_exec_panel = proc_exec_panel
        self.context = context

        self.setLayout(QtGui.QVBoxLayout())

        if context['proc_doc']:
            doc_label = QtGui.QTextEdit(self)
            doc_label.setReadOnly(True)
            doc_label.setPlainText(context['proc_doc'])
            self.layout().addWidget(doc_label)

        self.param_layout = QtGui.QFormLayout()
        self.param_layout.setLabelAlignment(QtCore.Qt.AlignRight)
        self.layout().addLayout(self.param_layout)

        lb = QtGui.QLabel(', '.join(context['needed_features']) or 'None',
                          self)
        self.param_layout.addRow('Worker Features', lb)

        lb = QtGui.QLabel(context['document'] or 'None', self)
        self.param_layout.addRow('Document', lb)

        why = context[
            'why_needs_to_run'] and ': ' + context['why_needs_to_run'] or ''
        lb = QtGui.QLabel(
            context['needs_to_run'] and 'Yes' + why or 'No' + why, self)
        self.param_layout.addRow('Needed', lb)

        why = context['why'] and ': ' + context['why'] or ''
        lb = QtGui.QLabel(
            (context['allow_exec'] and 'Yes' or '<font color="#FF8888">No') +
            str(why), self)
        self.param_layout.addRow('Ready', lb)

        input_controler = ContextAttrController(self, 'run',
                                                self.context['run'])
        value_editor = self.proc_exec_panel.EDITOR_FACTORY.create(
            self, 'bool', input_controler)
        #        value_editor.set_editable()
        #        value_editor.set_busy = lambda: None
        #        value_editor._input_controler = input_controler
        #        input_controler.value_editor = value_editor
        #        value_editor.set_value(self.context['run'])
        self.param_layout.addRow('Run', value_editor)

        self.param_layout.addRow(' ', QtGui.QWidget(self))

        for param in self.context['params']:
            controller = ContextParamController(self, param['name'], param)
            value_editor = self.proc_exec_panel.EDITOR_FACTORY.create(
                self,
                param['editor'],
                controller,
                options=param['editor_options'])

            self.param_layout.addRow(param['name'], value_editor)
Beispiel #5
0
    def build(self, parent):
        parent_lo = parent.layout()
        lo = QtGui.QHBoxLayout()
        parent_lo.addLayout(lo)

        for widget in self.widgets:
            widget.build(parent, lo)
Beispiel #6
0
 def __init__(self, model, relation_name, parent, related_type, icon_name):
     super(ManyRelationItem, self).__init__(
         model,
         relation_name,
         parent,
         node_type=related_type,
         icon_name=icon_name,
         color=QtGui.QColor(
             *get_style_value('node_colors', 'MANY', (128, 128, 200))))
Beispiel #7
0
 def __init__(self, model, item_id, parent, node_type, icon_name):
     super(ProcItem, self).__init__(
         model,
         item_id,
         parent,
         node_type,
         icon_name,
         color=QtGui.QColor(
             *get_style_value('node_colors', 'PROC', (200, 128, 200))))
Beispiel #8
0
    def __init__(self, parent, client):
        super(ProcExecDialog, self).__init__(parent)

        self.setLayout(QtGui.QVBoxLayout())

        self.pep = ProcExecPanel(self, client)
        self.pep.context_updated.connect(self._on_context_update)
        self.layout().addWidget(self.pep)

        buttons_layout = QtGui.QHBoxLayout()
        self.layout().addLayout(buttons_layout)

        self.execute_button = QtGui.QPushButton('Execute', self)
        self.execute_button.clicked.connect(self.execute)
        buttons_layout.addWidget(self.execute_button)

        b = QtGui.QPushButton('Close', self)
        b.clicked.connect(self.close)
        buttons_layout.addWidget(b)
Beispiel #9
0
 def __init__(self, parent, manager, config):
     super(Tools, self).__init__(parent)
     self.manager = manager
     self._config = config
     
     self.setText(config.get('label', ''))
     self.setPopupMode(self.InstantPopup)
     
     self._action_names = config.get('actions',[])
     for name in self._action_names:
         self.addAction(QtGui.QAction(name, self))
Beispiel #10
0
    def __init__(self, parent, proc_exec_panel, node_id, open=True):
        super(NodeBox, self).__init__(parent)
        self.proc_exec_panel = proc_exec_panel
        self.node_id = node_id

        self.setStyleSheet(self._SS)

        self.update_label()

        lo = QtGui.QVBoxLayout()
        lo.setContentsMargins(0, 10, 0, 0)
        lo.setSpacing(0)
        self.setLayout(lo)

        self._holder = QtGui.QWidget(self)
        self._holder.setLayout(QtGui.QFormLayout())
        lo.addWidget(self._holder)

        self.setCheckable(True)
        self.toggled.connect(self._on_toggled)
        self.setChecked(open)
Beispiel #11
0
    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))
Beispiel #12
0
    def __init__(self, parent, client, extra_root_names={}):
        super(NodeTreePanel, self).__init__(parent)

        self.client = client
        self.current_node_id = None

        self._item_menu_filler_func = None
        self._on_current_changed_func = None
        self._extra_root_names = extra_root_names
        self._root_names = {}

        self._bookmarks = {}  # user bookmarks
        self._live_bookmarks = {
        }  # dynamic/programatic/non-persistent bookmarks

        self.model = FlowModel(parent=self, client=self.client)

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

        # MENUS
        self.menu_bar = TreeViewMenuBar(self)
        self.layout().addWidget(self.menu_bar)

        # TREE
        self.tree = QtGui.QTreeView(self)
        self.tree.setAlternatingRowColors(False)
        self.tree.setDragEnabled(True)
        self.tree.setItemDelegate(FlowItemDelegate(self))
        self.tree.setRootIsDecorated(True)
        self.layout().addWidget(self.tree)

        self.tree.setModel(self.model)

        self.sel_model = QtGui.QItemSelectionModel(self.model)
        self.sel_model.currentChanged.connect(self._on_current_changed)
        self.tree.setSelectionModel(self.sel_model)
Beispiel #13
0
    def __init__(self, help_text, parent):
        super(Selector, self).__init__(parent)
        
        self._label_to_data = {} # we don't use Qt's data because it returns a QVariant when queried :/
        
        self.setLayout(QtGui.QHBoxLayout())
        self.layout().setContentsMargins(0,0,0,0)

        self._cb = QtGui.QComboBox(self)
        self.layout().addWidget(self._cb, stretch=10)
        self._cb.setEditable(True)
        
        self._help_text = help_text
    
        self.waitter = QtGui.QLabel('Loading')
        wait_movie = QtGui.QMovie(resources.get('gui.icons', 'throbber.gif'))
        self.waitter.setMovie(wait_movie)
        wait_movie.start()
        #self.waitter.hide()
        self.layout().addWidget(self.waitter)
        
        self.set_items([])
        
        self._cb.activated.connect(self._on_activated)
Beispiel #14
0
 def __init__(self,
              model,
              item_id,
              parent,
              node_type,
              icon_name,
              color=None):
     color = color or QtGui.QColor(
         *get_style_value('node_colors', 'CHILD', (200, 200, 200)))
     super(NodeItem, self).__init__(model,
                                    item_id,
                                    parent,
                                    node_type=node_type,
                                    icon_name=icon_name,
                                    color=color)
Beispiel #15
0
    def show_item_menu(self, index):
        if not index.isValid():
            return

        self.sel_model.select(index, self.sel_model.ClearAndSelect)

        item = index.internalPointer()

        menu = QtGui.QMenu()

        if self._item_menu_filler_func is not None:
            self._item_menu_filler_func(item, menu)

        if menu.isEmpty():
            menu.addAction('No action here :/')

        menu.exec_(QtGui.QCursor.pos())
Beispiel #16
0
    def __init__(self, parent=None):
        super(KabaretPanel, self).__init__(parent)
        self.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
                              QtGui.QSizePolicy.Expanding))

        client = kabaret.core.ro.client.Client(None)
        client.connect_from_env()
        self.__class__._CLIENT = client
        main_window_manager = MainWindowManager(self, client)

        # Fine tune for Nuke:
        main_window_manager.USE_VIEW_MENU = False
        main_window_manager.SHOW_VIEW_TOOLBAR = True
        main_window_manager.TITLE_HAS_APP_NAME = False

        main_window_manager.install_parented()

        # install tree view
        main_window_manager.create_docked_view('FLOW', 'Tree',
                                               tree_view.TreeView,
                                               QtCore.Qt.LeftDockWidgetArea,
                                               True, None)

        # install params view
        main_window_manager.create_docked_view('FLOW', 'Params',
                                               params_view.ParamsView,
                                               QtCore.Qt.RightDockWidgetArea,
                                               True, None)

        from kabaret.gui.widgets import views
        listener = main_window_manager.create_docked_view(
            u"\u20AD", 'Listener', views.ListenerView,
            QtCore.Qt.BottomDockWidgetArea, False, None)
        console = main_window_manager.create_docked_view(
            u"\u20AD", 'Console', views.ConsoleView,
            QtCore.Qt.BottomDockWidgetArea, False, None)
        script = main_window_manager.create_docked_view(
            u"\u20AD", 'Script', views.ScriptView,
            QtCore.Qt.BottomDockWidgetArea, False, None)
        main_window_manager.tabify_docked_view(listener, console, script)

        # goto current node:
        main_window_manager.client.set_focus_id_from_env()
Beispiel #17
0
        for l, v in self._label_to_data.items():
            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)
        
Beispiel #18
0
            self.next()

        def next(self):
            self.sweep_panel.clear()
            screen = self.sweep_panel.new_screen()
            screen.setLayout(QtGui.QFormLayout())
            for i in range(10):
                self.index += 1
                screen.layout().addRow('Row #' + str(self.index),
                                       QtGui.QLineEdit(i * 'blah ', screen))

        def clear(self):
            self.sweep_panel.clear()

    import sys
    app = QtGui.QApplication(sys.argv)
    f = QtGui.QFrame(None)
    f.resize(500, 500)
    f.setLayout(QtGui.QVBoxLayout())

    bn = QtGui.QPushButton('next', f)
    f.layout().addWidget(bn)

    bc = QtGui.QPushButton('clear', f)
    f.layout().addWidget(bc)

    w = Tester(f)
    f.layout().addWidget(w)

    bn.clicked.connect(w.next)
    bc.clicked.connect(w.clear)
Beispiel #19
0
    def __init__(self, parent, client):
        super(ProcExecPanel, self).__init__(parent)
        if self.__class__.EDITOR_FACTORY is None:
            self.__class__.EDITOR_FACTORY = get_global_factory()

        self.client = client

        self._context = None

        self.setLayout(QtGui.QVBoxLayout())

        #
        #    HEADER
        #
        self.header = QtGui.QLabel(self)
        self.layout().addWidget(self.header)

        if self.USE_SPLITTER:
            splitter = QtGui.QSplitter(self)
            self.layout().addWidget(splitter, stretch=100)
        else:
            splitter = QtGui.QHBoxLayout()
            self.layout().addLayout(splitter)

        #
        #    INPUT COLUMN
        #
        input_scroll = QtGui.QScrollArea(self)
        input_scroll.setFrameStyle(input_scroll.NoFrame)
        input_scroll.setWidgetResizable(True)
        self.input_parent = QtGui.QWidget()
        lo = QtGui.QVBoxLayout()
        self.input_layout = QtGui.QVBoxLayout()
        lo.addLayout(self.input_layout)
        lo.addStretch(100)
        self.input_parent.setLayout(lo)
        input_scroll.setWidget(self.input_parent)
        splitter.addWidget(input_scroll)

        self._node_boxes = {}
        self._node_boxes_open = {}

        #
        #    WORKER COLUMN
        #
        column = QtGui.QWidget(self)
        column.setLayout(QtGui.QVBoxLayout())
        column.layout().setContentsMargins(0, 0, 0, 0)
        splitter.addWidget(column)

        self.workers_table = WorkersTable(self.client, self)
        self.workers_table.show_mine_only(True)
        self.workers_table.selectionModel().selectionChanged.connect(
            self._on_worker_changed)
        self.workers_table.refresh_done.connect(self._on_worker_changed)

        self.workers_tb = WorkerToolBar(self, self.workers_table)

        column.layout().addWidget(self.workers_tb)
        column.layout().addWidget(self.workers_table)

        self.workers_table.on_connect()
        self.workers_tb.on_connect()

        self.depth_needed_features_label = QtGui.QLabel(
            'Overall Features Needed: <no context loaded>', self)
        column.layout().addWidget(self.depth_needed_features_label)

        self.acceptable_docs_label = QtGui.QLabel(
            'Acceptable Document: <no context loaded>', self)
        column.layout().addWidget(self.acceptable_docs_label)

        self.selected_worker_features_label = QtGui.QLabel(
            'Selected Features: <No Worker Selected>', self)
        column.layout().addWidget(self.selected_worker_features_label)

        self.selected_worker_doc_label = QtGui.QLabel(
            'Selected Document: <No Worker Seleced>', self)
        column.layout().addWidget(self.selected_worker_doc_label)

        if self.USE_SPLITTER:
            if 0:
                # make the detail panel hidden but resizable:
                splitter.setSizes([1, 0])
            else:
                splitter.setSizes([100, 100])