예제 #1
0
 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)
예제 #2
0
    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))