def __init__(self, control, edit_mode='edit'): QtGui.QWidget.__init__(self) self.setupUi(self) text = 'interface: %s, preferred widget: %s, edit mode: %s' % ( control.interface, control.widget, edit_mode) self.l_title.setText(text) self._control = control self._qcontainer = QControlContainer() self._qcontainer.add_control(self._control) self._qcontainer.create_actions(self) # m = getattr(scontrol, '%s_qt' % edit_mode) m = getattr(scontrol, 'qt_editor') self._qtcontrols = [] valid_widget_shape = None for shape in ['vline', 'hline', 'small', 'large', 'responsive']: layout = getattr(self, 'l_%s' % shape) widget = m(self._control, shape=shape) if widget: layout.addWidget(widget) valid_widget_shape = shape self._qtcontrols.append(widget) else: layout.addWidget(QtGui.QLabel("X")) if valid_widget_shape: self._test_widget = m(self._control, shape=valid_widget_shape) self.layout_sample.addWidget(self._test_widget) self.cb_read.toggled.connect(self.on_mode_changed) self.cb_apply.toggled.connect(self.on_mode_changed) self._model = ControlModel(manager=self._qcontainer) self._view = ControlView() self._view.setModel(self._model) self._view.hideColumn(0) self.l_large_box.addWidget(self._view, 1, 1, 2, 1)
def __init__(self, manager=None, parent=None): AbstractListener.__init__(self) Splitter.__init__(self, parent=parent) if manager is None: self._manager = ControlManager() else: self._manager = manager self.model = ControlModel(self._manager) self.view = ControlView() self.view.setModel(self.model) self.view.controlsSelected.connect(self.on_controls_selected) self.model.rowsInserted.connect(self.view.onRowsInserted) self.addWidget(self.view) self._i = 1 self._index = None self._widget_edit = None