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)
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)
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])