def __init__( cltw, col_data_list=None, col_name_list=None, niceheader_list=None, col_type_list=None, col_edit_list=None, display_indices=False, col_sort_index=None, parent=None, ): super(ColumnListTableWidget, cltw).__init__(parent) # QtWidgets.QWidget.__init__(cltw, parent) # Create vertical layout for the table to go into cltw.vert_layout = QtWidgets.QVBoxLayout(cltw) # Instansiate the AbstractItemModel cltw.model = ColumnListItemModel(parent=cltw) # Create a ColumnListTableView for the AbstractItemModel cltw.view = ColumnListTableView(cltw) cltw.view.setModel(cltw.model) cltw.vert_layout.addWidget(cltw.view) # Make sure we don't call a childs method ColumnListTableWidget.change_data( cltw, col_data_list, col_name_list, niceheader_list, col_type_list, col_edit_list, display_indices, col_sort_index, )
def setupUi(self, editPrefSkel): editPrefSkel.setObjectName(_fromUtf8('editPrefSkel')) editPrefSkel.resize(668, 530) # Add Pane for TreeView self.verticalLayout = QtWidgets.QVBoxLayout(editPrefSkel) self.verticalLayout.setObjectName(_fromUtf8('verticalLayout')) # The TreeView for QtCore.QAbstractItemModel to attach to self.prefTreeView = QtWidgets.QTreeView(editPrefSkel) self.prefTreeView.setObjectName(_fromUtf8('prefTreeView')) self.verticalLayout.addWidget(self.prefTreeView) # Add Pane for buttons self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8('horizontalLayout')) # # self.redrawBUT = QtWidgets.QPushButton(editPrefSkel) # self.redrawBUT.setObjectName(_fromUtf8('redrawBUT')) # self.horizontalLayout.addWidget(self.redrawBUT) ## # self.unloadFeaturesAndModelsBUT = QtWidgets.QPushButton(editPrefSkel) # self.unloadFeaturesAndModelsBUT.setObjectName(_fromUtf8('unloadFeaturesAndModelsBUT')) # self.horizontalLayout.addWidget(self.unloadFeaturesAndModelsBUT) # self.defaultPrefsBUT = QtWidgets.QPushButton(editPrefSkel) self.defaultPrefsBUT.setObjectName(_fromUtf8('defaultPrefsBUT')) self.horizontalLayout.addWidget(self.defaultPrefsBUT) # Buttons are a child of the View self.verticalLayout.addLayout(self.horizontalLayout) self.retranslateUi(editPrefSkel) QtCore.QMetaObject.connectSlotsByName(editPrefSkel)
def __init__(co_wgt, ibs, gid_list, parent=None, hack=False): logger.info('[co_gui] Initializing') logger.info('[co_gui] gid_list = %r' % (gid_list, )) QtWidgets.QWidget.__init__(co_wgt, parent=parent) co_wgt.fnum = pt.next_fnum() co_wgt.main_layout = QtWidgets.QVBoxLayout(co_wgt) co_wgt.text_layout = gt.newWidget(co_wgt, orientation=Qt.Vertical, verticalStretch=10) co_wgt.main_layout.addWidget(co_wgt.text_layout) co_wgt.control_layout = gt.newWidget( co_wgt, orientation=Qt.Vertical, verticalSizePolicy=QtWidgets.QSizePolicy.MinimumExpanding, ) co_wgt.main_layout.addWidget(co_wgt.control_layout) co_wgt.button_layout = gt.newWidget(co_wgt, orientation=Qt.Horizontal) co_wgt.control_layout.addWidget(co_wgt.button_layout) co_wgt.combo_layout = gt.newWidget(co_wgt, orientation=Qt.Horizontal) co_wgt.control_layout.addWidget(co_wgt.combo_layout) co_wgt.hack = hack # hack for edting the time of a single image co_wgt.imfig = None co_wgt.imax = None co_wgt.dtime = None co_wgt.ibs = ibs co_wgt.gid_list = gid_list co_wgt.current_gindex = 0 co_wgt.offset = 0 # Set image datetime with first image co_wgt.get_image_datetime_() co_wgt.add_label() co_wgt.add_combo_boxes() co_wgt.add_buttons() co_wgt.update_ui()
def __init__( widget, headers=None, parent=None, model_class=APIItemModel, view_class=APITableView, tblnice='APIItemWidget', doubleClicked=None, ): WIDGET_BASE.__init__(widget, parent) if isinstance(view_class, six.string_types): if view_class == 'tree': view_class = APITreeView elif view_class == 'table': view_class = APITableView else: raise ValueError('Unknown view_class=%r' % (view_class,)) # Create vertical layout for the table to go into widget.vert_layout = QtWidgets.QVBoxLayout(widget) # Create a ColumnListTableView for the AbstractItemModel widget.view = view_class(parent=widget) # Instantiate the AbstractItemModel # FIXME: It is very bad to give the model a view. # Only the view should have a model # Also the model should not be an attribute because # it might live in another thread widget._model = model_class(parent=widget.view) widget.view.setModel(widget._model) widget.vert_layout.addWidget(widget.view) widget.tblnice = tblnice if headers is not None: # Make sure we don't call a subclass method APIItemWidget.change_headers(widget, headers) widget.connect_signals() widget.api = None if doubleClicked: widget.view.doubleClicked.connect(doubleClicked)
def init_layout(self): import wbia.guitool as gt # Create the tree view and buttons self.tree_view = QtWidgets.QTreeView(self) self.delegate = ConfigValueDelegate(self.tree_view) self.tree_view.setItemDelegateForColumn(1, self.delegate) if self._with_buttons: buttons = [] self.default_but = gt.newButton( self, 'Defaults', pressed=self.reset_to_default ) buttons.append(self.default_but) self.orig_but = gt.newButton(self, 'Original', pressed=self.reset_to_original) buttons.append(self.orig_but) if not self.user_mode: self.print_internals = gt.newButton( self, 'Print Internals', pressed=self.print_internals ) buttons.append(self.print_internals) # Add compoments to the layout self.hbox = QtWidgets.QHBoxLayout() for button in buttons: self.hbox.addWidget(button) button.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Maximum ) self.vbox = QtWidgets.QVBoxLayout(self) self.vbox.addWidget(self.tree_view) if self._with_buttons: self.vbox.addLayout(self.hbox) self.setWindowTitle(_translate('self', 'Edit Config Widget', None))