def initUI(self): """Initialize the UI.""" layout = QtWidgets.QVBoxLayout() self.setLayout(layout) # ===================================================================== help_layout = QtWidgets.QHBoxLayout() layout.addLayout(help_layout) help_layout.addStretch(1) help_layout.addWidget(widgets.HelpButton("group_dialog")) # ===================================================================== grid_layout = QtWidgets.QGridLayout() layout.addLayout(grid_layout) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Group Name"), 1, 0) self.group_name = QtWidgets.QLineEdit() grid_layout.addWidget(self.group_name, 1, 1) self.group_name.textChanged.connect(self.validateGroupName) self.group_name.setFocus() # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("File Path"), 2, 0) self.file_widget = widgets.FileChooser() grid_layout.addWidget(self.file_widget, 2, 1) self.file_widget.field.textChanged.connect(self.validateFilePath) # ===================================================================== grid_layout.addWidget(QtWidgets.QLabel("Comment"), 3, 0) self.comment = QtWidgets.QLineEdit() grid_layout.addWidget(self.comment, 3, 1) self.comment.setToolTip("Optional comment, eg. 'This group is for X'.") # ==================================================================== grid_layout.addWidget(QtWidgets.QLabel("Priority"), 4, 0) self.priority = widgets.CustomSpinBox() grid_layout.addWidget(self.priority, 4, 1) self.priority.setMinimum(-1) self.priority.setValue(-1) # ==================================================================== self.aov_list = widgets.NewGroupAOVListWidget(self) layout.addWidget(self.aov_list) # Signal triggered when check boxes are toggled. self.aov_list.model().sourceModel().dataChanged.connect( self.validateAOVs) # ===================================================================== self.filter = widgets.FilterWidget() layout.addWidget(self.filter) QtCore.QObject.connect(self.filter.field, QtCore.SIGNAL("textChanged(QString)"), self.aov_list.proxy_model.setFilterWildcard) # ===================================================================== self.status_widget = widgets.StatusMessageWidget() layout.addWidget(self.status_widget) # ===================================================================== self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject)
def __init__(self, parent=None): super(_BaseGroupDialog, self).__init__(parent) self._group_name_valid = False self._file_valid = False self._aovs_valid = False # Initialize UI layout = QtWidgets.QVBoxLayout() self.setLayout(layout) # --------------------------------------------------------------------- help_layout = QtWidgets.QHBoxLayout() layout.addLayout(help_layout) help_layout.addStretch(1) help_layout.addWidget(widgets.HelpButton("group_dialog")) # --------------------------------------------------------------------- grid_layout = QtWidgets.QGridLayout() layout.addLayout(grid_layout) # --------------------------------------------------------------------- grid_layout.addWidget(QtWidgets.QLabel("Group Name"), 1, 0) self.group_name = QtWidgets.QLineEdit() grid_layout.addWidget(self.group_name, 1, 1) self.group_name.textChanged.connect(self.validate_group_name) self.group_name.setFocus() # --------------------------------------------------------------------- grid_layout.addWidget(QtWidgets.QLabel("File Path"), 2, 0) self.file_widget = widgets.FileChooser() grid_layout.addWidget(self.file_widget, 2, 1) self.file_widget.field.textChanged.connect(self.validate_filepath) # --------------------------------------------------------------------- grid_layout.addWidget(QtWidgets.QLabel("Comment"), 3, 0) self.comment = QtWidgets.QLineEdit() grid_layout.addWidget(self.comment, 3, 1) self.comment.setToolTip("Optional comment, eg. 'This group is for X'.") # --------------------------------------------------------------------- grid_layout.addWidget(QtWidgets.QLabel("Priority"), 4, 0) self.priority = QtWidgets.QSpinBox() grid_layout.addWidget(self.priority, 4, 1) self.priority.setMinimum(-1) self.priority.setValue(-1) # --------------------------------------------------------------------- self.aov_list = widgets.NewGroupAOVListWidget(self) layout.addWidget(self.aov_list) # Signal triggered when check boxes are toggled. self.aov_list.model().sourceModel().dataChanged.connect(self.validate_aovs) # --------------------------------------------------------------------- self.filter = widgets.FilterWidget() layout.addWidget(self.filter) self.filter.field.textChanged.connect( self.aov_list.proxy_model.setFilterWildcard ) # --------------------------------------------------------------------- self.status_widget = widgets.StatusMessageWidget() layout.addWidget(self.status_widget) # --------------------------------------------------------------------- self.button_box = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel ) layout.addWidget(self.button_box) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) # -------------------------------------------------------------------- self.resize(450, 475) self.setMinimumWidth(450) self.valid_input_signal.connect(self.enable_creation)