def __init__(self, parent, package): QtGui.QDialog.__init__(self, parent) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.setWindowTitle('Configuration for package "%s"' % package.name) self._package = package c = package.configuration self._configuration_object = c assert c is not None layout = QtGui.QVBoxLayout(self) self.setLayout(layout) self._status_bar = QtGui.QStatusBar(self) self._configuration_widget = QConfigurationWidget( self, c, c, self._status_bar) layout.addWidget(self._configuration_widget) btns = (QtGui.QDialogButtonBox.Close | QtGui.QDialogButtonBox.RestoreDefaults) self._button_box = QtGui.QDialogButtonBox(btns, QtCore.Qt.Horizontal, self) self.connect(self._button_box, QtCore.SIGNAL('clicked(QAbstractButton *)'), self.button_clicked) self.connect(self._configuration_widget._tree.treeWidget, QtCore.SIGNAL('configuration_changed'), self.configuration_changed) layout.addWidget(self._status_bar) layout.addWidget(self._button_box)
def __init__(self, parent, package): QtGui.QDialog.__init__(self, parent) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.setWindowTitle('Configuration for package "%s"' % package.name) self._package = package c = package.configuration self._configuration_object = c assert c is not None layout = QtGui.QVBoxLayout(self) self.setLayout(layout) self._status_bar = QtGui.QStatusBar(self) self._configuration_widget = QConfigurationWidget(self, c, c, self._status_bar) layout.addWidget(self._configuration_widget) btns = (QtGui.QDialogButtonBox.Close | QtGui.QDialogButtonBox.RestoreDefaults) self._button_box = QtGui.QDialogButtonBox(btns, QtCore.Qt.Horizontal, self) self.connect(self._button_box, QtCore.SIGNAL('clicked(QAbstractButton *)'), self.button_clicked) self.connect(self._configuration_widget._tree.treeWidget, QtCore.SIGNAL('configuration_changed'), self.configuration_changed) layout.addWidget(self._status_bar) layout.addWidget(self._button_box)
class QPackageConfigurationDialog(QtGui.QDialog): def __init__(self, parent, package): QtGui.QDialog.__init__(self, parent) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.setWindowTitle('Configuration for package "%s"' % package.name) self._package = package c = package.configuration self._configuration_object = c assert c is not None layout = QtGui.QVBoxLayout(self) self.setLayout(layout) self._status_bar = QtGui.QStatusBar(self) self._configuration_widget = QConfigurationWidget(self, c, c, self._status_bar) layout.addWidget(self._configuration_widget) btns = (QtGui.QDialogButtonBox.Close | QtGui.QDialogButtonBox.RestoreDefaults) self._button_box = QtGui.QDialogButtonBox(btns, QtCore.Qt.Horizontal, self) self.connect(self._button_box, QtCore.SIGNAL('clicked(QAbstractButton *)'), self.button_clicked) self.connect(self._configuration_widget._tree.treeWidget, QtCore.SIGNAL('configuration_changed'), self.configuration_changed) layout.addWidget(self._status_bar) layout.addWidget(self._button_box) def button_clicked(self, button): role = self._button_box.buttonRole(button) if role == QtGui.QDialogButtonBox.ResetRole: txt = ("This will reset all configuration values of " + "this package to their default values. Do you " + "want to proceed?") msg_box = QtGui.QMessageBox(QtGui.QMessageBox.Question, "Really reset?", txt, (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) if msg_box.exec_() == QtGui.QMessageBox.Yes: self.reset_configuration() else: assert role == QtGui.QDialogButtonBox.RejectRole self.close_dialog() def reset_configuration(self): self._package.reset_configuration() conf = self._package.configuration self._configuration_widget.configuration_changed(conf) def close_dialog(self): self.done(0) def configuration_changed(self, item, new_value): self._package.set_persistent_configuration()
def create_configuration_tab(self): return QConfigurationWidget(self, get_vistrails_persistent_configuration(), get_vistrails_configuration(), self._status_bar)
class QPackageConfigurationDialog(QtGui.QDialog): def __init__(self, parent, package): QtGui.QDialog.__init__(self, parent) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.setWindowTitle('Configuration for package "%s"' % package.name) self._package = package c = package.configuration self._configuration_object = c assert c is not None layout = QtGui.QVBoxLayout(self) self.setLayout(layout) self._status_bar = QtGui.QStatusBar(self) self._configuration_widget = QConfigurationWidget( self, c, c, self._status_bar) layout.addWidget(self._configuration_widget) btns = (QtGui.QDialogButtonBox.Close | QtGui.QDialogButtonBox.RestoreDefaults) self._button_box = QtGui.QDialogButtonBox(btns, QtCore.Qt.Horizontal, self) self.connect(self._button_box, QtCore.SIGNAL('clicked(QAbstractButton *)'), self.button_clicked) self.connect(self._configuration_widget._tree.treeWidget, QtCore.SIGNAL('configuration_changed'), self.configuration_changed) layout.addWidget(self._status_bar) layout.addWidget(self._button_box) def button_clicked(self, button): role = self._button_box.buttonRole(button) if role == QtGui.QDialogButtonBox.ResetRole: txt = ("This will reset all configuration values of " + "this package to their default values. Do you " + "want to proceed?") msg_box = QtGui.QMessageBox( QtGui.QMessageBox.Question, "Really reset?", txt, (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) if msg_box.exec_() == QtGui.QMessageBox.Yes: self.reset_configuration() else: assert role == QtGui.QDialogButtonBox.RejectRole self.close_dialog() def reset_configuration(self): self._package.reset_configuration() conf = self._package.configuration self._configuration_widget.configuration_changed(conf) def close_dialog(self): self.done(0) def configuration_changed(self, item, new_value): self._package.set_persistent_configuration()