예제 #1
0
    def create_radiobutton(self,
                           text,
                           option,
                           default=NoDefault,
                           tip=None,
                           msg_warning=None,
                           msg_info=None,
                           msg_if_enabled=False,
                           button_group=None):
        radiobutton = QRadioButton(text)
        if button_group is None:
            if self.default_button_group is None:
                self.default_button_group = QButtonGroup(self)
            button_group = self.default_button_group
        button_group.addButton(radiobutton)
        if tip is not None:
            radiobutton.setToolTip(tip)
        self.radiobuttons[radiobutton] = option
        if msg_warning is not None or msg_info is not None:

            def show_message(is_checked):
                if is_checked or not msg_if_enabled:
                    if msg_warning is not None:
                        QMessageBox.warning(self, self.get_name(), msg_warning,
                                            QMessageBox.Ok)
                    if msg_info is not None:
                        QMessageBox.information(self, self.get_name(),
                                                msg_info, QMessageBox.Ok)

            self.connect(radiobutton, SIGNAL("toggled(bool)"), show_message)
        return radiobutton
예제 #2
0
 def _initialize(self):
     ## self.paramTPerm = self.field("paramTPerm")
     self.tabs.clear()
     self.total_answers = 0
     self.radioGroups = {}
     filas = int(self.paramNPerm.toString())
     for x in range(filas):
         mygroupbox = QScrollArea()
         mygroupbox.setWidget(QWidget())
         mygroupbox.setWidgetResizable(True)
         myform = QHBoxLayout(mygroupbox.widget())
         cols = self.paramNCols.toString().split(',')
         ansID = 0
         radioGroupList = {}
         for col in cols:
             mygroupboxCol = QGroupBox()
             myformCol = QFormLayout()
             mygroupboxCol.setLayout(myformCol)
             for y in range(int(col)):
                 ansID += 1
                 radioGroupList[ansID] = QButtonGroup()
                 layoutRow = QHBoxLayout()
                 for j in range(int(self.paramNAlts.toString())):
                     myradio = QRadioButton(chr(97 + j).upper())
                     layoutRow.addWidget(myradio)
                     radioGroupList[ansID].addButton(myradio)
                 self.total_answers += 1
                 myformCol.addRow(str(ansID), layoutRow)
             myform.addWidget(mygroupboxCol)
         self.radioGroups[chr(97 + x).upper()] = radioGroupList
         self.tabs.addTab(mygroupbox, _('Model ') + chr(97 + x).upper())
예제 #3
0
    def __init__(self, parent=None, iface=None):
        """Constructor for import dialog.

        .. versionadded: 3.3

        :param parent: Optional widget to use as parent.
        :type parent: QWidget

        :param iface: An instance of QGisInterface.
        :type iface: QGisInterface
        """
        QDialog.__init__(self, parent)
        self.parent = parent
        self.setupUi(self)

        title = self.tr('PetaBencana Downloader')
        self.setWindowTitle(title)
        icon = resources_path('img', 'icons', 'add-petabencana-layer.svg')
        self.setWindowIcon(QtGui.QIcon(icon))

        self.iface = iface

        self.source = None

        self.radio_button_group = QButtonGroup()
        self.radio_button_group.addButton(self.radio_button_production)
        self.radio_button_group.addButton(self.radio_button_development)

        self.radio_button_group.setExclusive(True)
        self.radio_button_production.setChecked(True)
        self.populate_combo_box()

        developer_mode = setting('developer_mode', False, bool)
        if not developer_mode:
            self.radio_button_widget.hide()
            self.source_label.hide()
            self.output_group.adjustSize()

        # signals
        self.radio_button_production.clicked.connect(self.populate_combo_box)
        self.radio_button_development.clicked.connect(self.populate_combo_box)

        # creating progress dialog for download
        self.progress_dialog = QProgressDialog(self)
        self.progress_dialog.setAutoClose(False)
        self.progress_dialog.setWindowTitle(title)

        # Set up things for context help
        self.help_button = self.button_box.button(QtGui.QDialogButtonBox.Help)
        # Allow toggling the help button
        self.help_button.setCheckable(True)
        self.help_button.toggled.connect(self.help_toggled)
        self.main_stacked_widget.setCurrentIndex(1)

        # set up the validator for the file name prefix
        expression = QRegExp('^[A-Za-z0-9-_]*$')
        validator = QRegExpValidator(expression, self.filename_prefix)
        self.filename_prefix.setValidator(validator)
        self.time_stamp = None
        self.restore_state()
예제 #4
0
    def __init__(self, mode="DateTime"):
        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = Ui_datatimerpicker()
        self.ui.setupUi(self)
        self.mode = mode
        self.group = QButtonGroup()
        self.group.setExclusive(True)
        self.group.addButton(self.ui.ambutton)
        self.group.addButton(self.ui.pmbutton)

        self.ui.ambutton.toggled.connect(self.isDirty)
        self.ui.pmbutton.toggled.connect(self.isDirty)
        self.ui.datepicker.selectionChanged.connect(self.isDirty)
        self.ui.hourpicker.itemSelectionChanged.connect(self.isDirty)
        self.ui.minutepicker.itemSelectionChanged.connect(self.isDirty)

        self.ui.buttonBox.accepted.connect(self.accept)
        self.ui.buttonBox.rejected.connect(self.reject)
        self.ui.setasnowbutton.pressed.connect(self.setAsNow)
        self.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint)

        if mode == "Date":
            self.ui.timesection.hide()
            self.ui.setasnowbutton.setText("Set as current date")
        elif mode == "Time":
            self.ui.datepicker.hide()
            self.ui.setasnowbutton.setText("Set as current time")
예제 #5
0
    def __init__(self, parent=None):
        super(PreferencesView, self).__init__(parent)

        self.setWindowTitle("Preferences")
        # self.setFixedSize(self.maximumSize())
        # self.setMinimumSize(self.maximumSize())
        # self.setMaximumSize(self.maximumSize())

        # self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
        self.chemicalSimulationDt = self.createFloatingPointEditor()
        self.chemicalDiffusionDt = self.createFloatingPointEditor()
        self.chemicalPlotUpdateInterval = self.createFloatingPointEditor()
        self.chemicalDefaultSimulationRuntime = self.createFloatingPointEditor(
        )
        self.chemicalGuiUpdateInterval = self.createFloatingPointEditor()
        self.chemicalSolver = QButtonGroup()
        self.chemicalSolvers = {
            "Exponential Euler": QRadioButton("Exponential Euler"),
            "Gillespie": QRadioButton("Gillespie"),
            "Runge Kutta": QRadioButton("Runge Kutta")
        }
        self.chemicalSimulationApply = QPushButton("Apply")
        self.chemicalSimulationCancel = QPushButton("Cancel")
        self.electricalSimulationDt = self.createFloatingPointEditor()
        self.electricalPlotUpdateInterval = self.createFloatingPointEditor()
        self.electricalDefaultSimulationRuntime = self.createFloatingPointEditor(
        )
        self.electricalGuiUpdateInterval = self.createFloatingPointEditor()
        self.electricalSolver = QButtonGroup()
        self.electricalSolvers = {
            "Gillespie": QRadioButton("Gillespie"),
            "Runge Kutta": QRadioButton("Runge Kutta")
        }
        self.electricalSimulationApply = QPushButton("Apply")
        self.electricalSimulationCancel = QPushButton("Cancel")
        self.electricalVisualizationApply = QPushButton("Apply")
        self.electricalVisualizationCancel = QPushButton("Cancel")
        self.electricalBaseColorButton = QPushButton()
        self.electricalBaseColorDialog = QColorDialog()
        self.electricalPeakColorButton = QPushButton()
        self.electricalPeakColorDialog = QColorDialog()
        self.electricalBackgroundColorButton = QPushButton()
        self.electricalBackgroundColorDialog = QColorDialog()
        self.electricalBaseMembraneVoltage = self.createFloatingPointEditor()
        self.electricalPeakMembraneVoltage = self.createFloatingPointEditor()

        self.create()
예제 #6
0
    def __init__(self, names):
        """
        Constructor
        """
        QDialog.__init__(self)
        self.__names = names
        self.setWindowTitle(
            QCoreApplication.translate("VDLTools", "Choose Controls"))
        self.__layout = QGridLayout()

        self.__confirmLabel = QLabel(
            QCoreApplication.translate(
                "VDLTools", "Choose which controls you want to process :"))

        self.__layout.addWidget(self.__confirmLabel, 0, 0, 1, 2)

        self.__group = QButtonGroup()

        self.__controlsLabels = []
        self.__controlsChecks = []

        self.__scrollLayout = QGridLayout()

        for i in range(len(self.__names)):
            label = QLabel(self.__names[i])
            label.setMinimumHeight(20)
            label.setMinimumWidth(50)
            self.__controlsLabels.append(label)
            self.__scrollLayout.addWidget(self.__controlsLabels[i], i + 1, 0)
            check = QCheckBox()
            check.setChecked(False)
            self.__controlsChecks.append(check)
            self.__scrollLayout.addWidget(self.__controlsChecks[i], i + 1, 1)

        widget = QWidget()
        widget.setLayout(self.__scrollLayout)

        scroll = QScrollArea()
        scroll.setWidgetResizable(True)
        scroll.setWidget(widget)

        self.__layout.addWidget(scroll, 1, 0, 1, 2)

        self.__okButton = QPushButton(
            QCoreApplication.translate("VDLTools", "Ok"))
        self.__okButton.setMinimumHeight(20)
        self.__okButton.setMinimumWidth(100)

        self.__cancelButton = QPushButton(
            QCoreApplication.translate("VDLTools", "Cancel"))
        self.__cancelButton.setMinimumHeight(20)
        self.__cancelButton.setMinimumWidth(100)

        self.__layout.addWidget(self.__okButton, 100, 0)
        self.__layout.addWidget(self.__cancelButton, 100, 1)

        self.setLayout(self.__layout)
예제 #7
0
    def __init__(self, isComplexPolygon):
        """
        Constructor
        :param isComplexPolygon: for a polygon, if it has interior ring(s)
        """
        QDialog.__init__(self)
        self.setWindowTitle(QCoreApplication.translate("VDLTools","Duplicate"))
        self.resize(300, 100)
        self.__distanceLabel = QLabel(QCoreApplication.translate("VDLTools","distance :"))
        self.__distanceLabel.setMinimumHeight(20)
        self.__distanceLabel.setMinimumWidth(50)

        self.__distanceEdit = QLineEdit("inputMask")
        self.__distanceEdit.setMinimumHeight(20)
        self.__distanceEdit.setMinimumWidth(120)
        self.__distanceEdit.setValidator(QDoubleValidator(-1000, 1000, 4, self))

        self.__distanceDirection = QCheckBox(QCoreApplication.translate("VDLTools","invert direction"))

        self.__previewButton = QPushButton(QCoreApplication.translate("VDLTools","Preview"))
        self.__previewButton.setMinimumHeight(20)
        self.__previewButton.setMinimumWidth(100)

        self.__okButton = QPushButton(QCoreApplication.translate("VDLTools","OK"))
        self.__okButton.setMinimumHeight(20)
        self.__okButton.setMinimumWidth(100)

        self.__cancelButton = QPushButton(QCoreApplication.translate("VDLTools","Cancel"))
        self.__cancelButton.setMinimumHeight(20)
        self.__cancelButton.setMinimumWidth(100)

        self.__layout = QGridLayout()
        self.__layout.addWidget(self.__distanceLabel, 0, 0)
        self.__layout.addWidget(self.__distanceEdit, 0, 1)
        self.__layout.addWidget(self.__distanceDirection, 0, 2)

        if isComplexPolygon:
            self.__polygonLabel = QLabel(
                QCoreApplication.translate("VDLTools","In which direction the internal part has to be duplicated ?"))
            self.__polygonLabel.setMinimumHeight(20)
            self.__polygonLabel.setMinimumWidth(50)
            self.__layout.addWidget(self.__polygonLabel, 1, 0, 1, 3)

            self.__directions = [QRadioButton(QCoreApplication.translate("VDLTools","same")),
                                 QRadioButton(QCoreApplication.translate("VDLTools","opposite"))]
            self.__directions[0].setChecked(True)
            self.__direction_button_group = QButtonGroup()
            for i in xrange(len(self.__directions)):
                self.__layout.addWidget(self.__directions[i], 2, i+1)
                self.__direction_button_group.addButton(self.__directions[i], i)

        self.__layout.addWidget(self.__previewButton, 3, 0)
        self.__layout.addWidget(self.__okButton, 3, 1)
        self.__layout.addWidget(self.__cancelButton, 3, 2)
        self.setLayout(self.__layout)
예제 #8
0
    def __init__(self):
        """
        Constructor
        """
        QDialog.__init__(self)
        self.setWindowTitle(
            QCoreApplication.translate("VDLTools", "Edition Confirmation"))
        self.resize(300, 100)
        self.__layout = QGridLayout()

        self.__confirmLabel = QLabel(
            QCoreApplication.translate(
                "VDLTools",
                "This LineString layer is not editable, what do you want to do ?"
            ))

        self.__layout.addWidget(self.__confirmLabel, 0, 0, 1, 2)

        self.__radios = []

        self.__radios.append(
            QRadioButton(
                QCoreApplication.translate(
                    "VDLTools",
                    "Create point, and edit line with new vertex")))
        self.__radios.append(
            QRadioButton(
                QCoreApplication.translate("VDLTools",
                                           "Create only the point")))
        self.__radios.append(
            QRadioButton(
                QCoreApplication.translate("VDLTools",
                                           "Just edit line with new vertex")))

        self.__radios[0].setChecked(True)
        self.__radio_button_group = QButtonGroup()
        for i in xrange(len(self.__radios)):
            self.__layout.addWidget(self.__radios[i], i + 1, 0, 1, 2)
            self.__radio_button_group.addButton(self.__radios[i], i)

        self.__okButton = QPushButton(
            QCoreApplication.translate("VDLTools", "OK"))
        self.__okButton.setMinimumHeight(20)
        self.__okButton.setMinimumWidth(100)

        self.__layout.addWidget(self.__okButton, 4, 0)

        self.__cancelButton = QPushButton(
            QCoreApplication.translate("VDLTools", "Cancel"))
        self.__cancelButton.setMinimumHeight(20)
        self.__cancelButton.setMinimumWidth(100)

        self.__layout.addWidget(self.__cancelButton, 4, 1)

        self.setLayout(self.__layout)
예제 #9
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.debug = False

        self.connections = {}

        self.setWindowTitle("Servers")
        #s#elf.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)

        self.mainLayout = QVBoxLayout()
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)
        self.setLayout(self.mainLayout)

        #=============================================
        ## Top Toolbar
        topBar = QToolBar()
        topBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        self.mainLayout.addWidget(topBar)

        ## Add the action buttons
        topBar.addAction(Ico.icon(Ico.ServerAdd), "Add", self.on_server_add)
        self.actionServerEdit = topBar.addAction(Ico.icon(Ico.ServerEdit),
                                                 "Edit", self.on_server_edit)
        self.actionServerDelete = topBar.addAction(Ico.icon(Ico.ServerDelete),
                                                   "Delete",
                                                   self.on_server_delete)

        #=============================================
        ## Tree
        self.tree = QTreeWidget()
        self.mainLayout.addWidget(self.tree)
        self.tree.setUniformRowHeights(True)
        self.tree.setRootIsDecorated(True)

        self.tree.setHeaderLabels(["Server",
                                   "Butt"])  # set header, but hide anyway
        self.tree.header().hide()
        self.tree.header().setResizeMode(C.node, QHeaderView.Stretch)
        self.tree.setColumnWidth(C.butt, 20)

        self.connect(self.tree, SIGNAL('itemSelectionChanged()'),
                     self.on_tree_selection_changed)
        self.connect(self.tree,
                     SIGNAL('itemDoubleClicked (QTreeWidgetItem *,int)'),
                     self.on_tree_double_clicked)

        self.buttGroup = QButtonGroup(self)
        self.connect(self.buttGroup, SIGNAL("buttonClicked(QAbstractButton*)"),
                     self.on_open_server)

        self.on_tree_selection_changed()

        self.load_servers()
예제 #10
0
 def __init__(self, parent=None, option_list=None, default_select=0):
     super(InputRadioGroup, self).__init__(parent=parent)
     layout = QHBoxLayout(self)
     self.group = QButtonGroup()
     for idx, op in enumerate(option_list):
         self.op = QRadioButton(_(op))
         if idx == default_select:
             self.op.setChecked(True)
         layout.addWidget(self.op)
         self.group.addButton(self.op)
     self.setLayout(layout)
예제 #11
0
파일: preferences.py 프로젝트: urkh/Turpial
    def __init__(self, base):
        QWidget.__init__(self)

        current_browser = base.core.get_default_browser()

        description = QLabel(i18n.get('web_browser_tab_description'))
        description.setWordWrap(True)

        self.command = QLineEdit()

        self.default_browser = RadioButton(i18n.get('use_default_browser'),
                                           self)
        self.default_browser.selected.connect(self.__on_defaul_selected)
        self.custom_browser = RadioButton(i18n.get('set_custom_browser'), self)
        self.custom_browser.selected.connect(self.__on_custom_selected)

        custom_label = QLabel(i18n.get('command'))
        self.open_button = QPushButton(i18n.get('open'))
        self.test_button = QPushButton(i18n.get('test'))
        self.test_button.clicked.connect(self.__on_test)

        command_box = QHBoxLayout()
        command_box.setSpacing(5)
        command_box.addWidget(custom_label)
        command_box.addWidget(self.command, 1)
        #command_box.addWidget(self.open_button)
        command_box.addWidget(self.test_button)

        self.button_group = QButtonGroup()
        self.button_group.addButton(self.default_browser.radiobutton)
        self.button_group.addButton(self.custom_browser.radiobutton)
        self.button_group.setExclusive(True)

        vbox = QVBoxLayout()
        vbox.setSpacing(0)
        vbox.setContentsMargins(5, 5, 5, 0)
        vbox.addWidget(description)
        vbox.addSpacing(15)
        vbox.addWidget(self.default_browser)
        vbox.addSpacing(10)
        vbox.addWidget(self.custom_browser)
        vbox.addLayout(command_box)
        vbox.addStretch(1)

        self.setLayout(vbox)

        if current_browser == '':
            self.default_browser.set_value(True)
            self.command.setText('')
            self.__on_defaul_selected()
        else:
            self.custom_browser.set_value(True)
            self.command.setText(current_browser)
            self.__on_custom_selected()
예제 #12
0
    def setup_page(self):

        dirs_group = QGroupBox(u"Répertoires de sauvegarde")
        cas_type_dir = self.create_browsedir(u'Cas types', 'cas_type_dir')
        reformes_dir = self.create_browsedir(u'Réformes', 'reformes_dir')
        calib_dir = self.create_browsedir(u'Calages', 'calib_dir')
        data_dir = self.create_browsedir(u'Données internes', 'data_dir')

        survey_group = QGroupBox(u"Données d'enquête")
        survey_bg = QButtonGroup(self)
        survey_label = QLabel(
            u"Emplacement des données d'enquête pour la microsimulation")

        bareme_only_radio = self.create_radiobutton(u"Mode barème uniquement",
                                                    'survey_data/bareme_only',
                                                    False,
                                                    u"Mode barème uniquement",
                                                    button_group=survey_bg)
        survey_radio = self.create_radiobutton(
            "le fichier suivant",
            'survey_data/survey_enabled',
            True,
            "Fichier de données pour la microsimulation",
            button_group=survey_bg)
        survey_file = self.create_browsefile("",
                                             'survey_data/file',
                                             filters='*.csv')
        self.connect(bareme_only_radio, SIGNAL("toggled(bool)"),
                     survey_file.setDisabled)
        self.connect(survey_radio, SIGNAL("toggled(bool)"),
                     survey_file.setEnabled)
        survey_file_layout = QHBoxLayout()
        survey_file_layout.addWidget(survey_radio)
        survey_file_layout.addWidget(survey_file)

        survey_layout = QVBoxLayout()
        survey_layout.addWidget(survey_label)
        survey_layout.addWidget(bareme_only_radio)
        survey_layout.addLayout(survey_file_layout)
        survey_group.setLayout(survey_layout)

        dirs_layout = QVBoxLayout()
        dirs_layout.addWidget(cas_type_dir)
        dirs_layout.addWidget(reformes_dir)
        dirs_layout.addWidget(calib_dir)
        dirs_group.setLayout(dirs_layout)

        paths_layout = QVBoxLayout()
        paths_layout.addWidget(dirs_group)
        paths_layout.addWidget(survey_group)
        paths_layout.addWidget(data_dir)

        paths_layout.addStretch(1)
        self.setLayout(paths_layout)
예제 #13
0
    def __init__(self, parent=None):
        super(CategoriesTab, self).__init__(parent)
        loadUi(__file__, self)
        self.__parent = parent

        self.removeFromMonthButtons = QButtonGroup()
        self.removeFromMonthButtons.addButton(self.removeAllMonthsButton)
        self.removeFromMonthButtons.addButton(
            self.removeAllMonthsFromNowButton)
        self.removeFromMonthButtons.addButton(self.removeCurrentMonthButton)
        self.addToMonthButtons = QButtonGroup()
        self.addToMonthButtons.addButton(self.addAllMonthsButton)
        self.addToMonthButtons.addButton(self.addAllMonthsFromNowButton)
        self.addToMonthButtons.addButton(self.addCurrentMonthButton)
        self.expAndRecButtons = QButtonGroup()
        self.expAndRecButtons.addButton(self.expendituresButton)
        self.expAndRecButtons.addButton(self.receiptsButton)
        self.removeCategoryCombo.addItems(self.categoriesStringList())
        # CONNECTIONS
        self.addCategoryGroup.clicked.connect(
            self.newCategoryLineEdit.setFocus)
예제 #14
0
    def __init__(self):
        super(IntroductionPage, self).__init__()
        self.setTitle(self.tr("Creación de un nuevo Proyecto"))
        self.setSubTitle(self.tr("Información básica del Proyecto"))
        container = QVBoxLayout(self)
        hbox = QHBoxLayout()
        # Nombre
        hbox.addWidget(QLabel(self.tr("Nombre del Proyecto:")))
        self.line_name = QLineEdit()
        hbox.addWidget(self.line_name)
        container.addLayout(hbox)
        # Ubicación
        group = QGroupBox(self.tr("Ubicación:"))
        box = QVBoxLayout(group)
        button_group = QButtonGroup(self)
        radio_buttons = [
            self.tr("Directorio por defecto"),
            self.tr("Otro")
            ]
        for _id, radiob in enumerate(radio_buttons):
            radio_button = QRadioButton(radiob)
            button_group.addButton(radio_button, _id)
            box.addWidget(radio_button)
            if _id == 0:
                # El primero checked por defecto
                radio_button.setChecked(True)
        container.addWidget(group)

        self.line_location = QLineEdit()
        container.addWidget(self.line_location)

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(self.tr("Archivo del Proyecto: ")))
        self._project_filename = QLineEdit()
        hbox.addWidget(self._project_filename)
        container.addLayout(hbox)

        hbox = QHBoxLayout()
        hbox.addWidget(QLabel(self.tr("Archivo resultante: ")))
        self._resulting_filename = QLineEdit()
        hbox.addWidget(self._resulting_filename)
        container.addLayout(hbox)

        # Conexiones
        self.connect(button_group, SIGNAL("buttonClicked(int)"),
                     self._update_location)
        self.connect(self.line_name, SIGNAL("textChanged(const QString&)"),
                     self._on_project_name_changed)
        self.connect(self.line_name, SIGNAL("textChanged(const QString&)"),
                     lambda: self.emit(SIGNAL("completeChanged()")))

        self._update_location(0)
 def __init__(self, model, key, radiobuttonswithvalues):
     Mapping.__init__(self, model, key)
     self.radiobuttonswithvalues = radiobuttonswithvalues
     
     buttongroup = None
     for radiobutton, correspondingvalue in self.radiobuttonswithvalues.items():
         # Tiresome extra setup to ensure that exactly one button is ever checked
         if buttongroup is None:
             buttongroup = QButtonGroup(radiobutton.parent())
         buttongroup.addButton(radiobutton)
         
         # NB: default-argument indirection below to solve closure capture issues
         radiobutton.connect(radiobutton, SIGNAL("clicked()"), lambda cv=correspondingvalue: self.updateModelValue(cv))
예제 #16
0
    def __init__(self, tree, dataset, master, parent=None):
        QWidget.__init__(self, parent)
        Control.__init__(self, tree, dataset, master)

        self.setLayout(QVBoxLayout())
        self.buttonGroup = QButtonGroup(self)
        self.values = []
        for i, option in enumerate(tree.subelements_top("Option")):
            rb = QRadioButton(option.displayName, self)
            self.buttonGroup.addButton(rb)
            self.buttonGroup.setId(rb, i)
            self.layout().addWidget(rb)
            self.values.append(option.value)
        self.buttonGroup.button(0).setChecked(True)
예제 #17
0
    def setupUi(self):
        grid = QGridLayout()
        grid.setSpacing(GRID_SPACING)
        self.setLayout(grid)

        self.buttonGroup = QButtonGroup()
        for position in self.engine.board.positions:
            button = GameButton(position)
            self.buttonGroup.addButton(button, position)
            grid.addWidget(button, position / 3, position % 3)
        self.buttonGroup.buttonClicked['int'].connect(self.engine.handleInput)

        size = 4 * GRID_SPACING + 3 * BUTTON_SIZE
        self.setFixedSize(size, size)
예제 #18
0
 def addLogOrLogTypeOption(self):
     self.logsInWellRadioButton = QRadioButton()
     if self._logSet is None:
         self.logsInWellRadioButton.setText(self.SHOW_LOGS_IN_WELL)
     else:
         self.logsInWellRadioButton.setText(self.SHOW_LOGS_IN_LOG_SET)
     self.allLogTypesRadioButton = QRadioButton()
     self.allLogTypesRadioButton.setText(self.SHOW_ALL_LOG_TYPES)
     topButtonLayout = QHBoxLayout()
     self._dataListToListWidget.topButtonHolderWidget.setLayout(topButtonLayout)
     topButtonLayout.addWidget(self.logsInWellRadioButton)
     topButtonLayout.addWidget(self.allLogTypesRadioButton)
     topButtonGroup = QButtonGroup()
     topButtonGroup.addButton(self.logsInWellRadioButton)
     topButtonGroup.addButton(self.allLogTypesRadioButton)
     self.logsInWellRadioButton.setChecked(True)
예제 #19
0
    def __init__(self, data):
        data = data or self.DEFAULT_SETTINGS
        PreprocessorModule.__init__(self, 'Stemming', True,
                                    data.get('is_enabled'))

        self.group = QButtonGroup(self, exclusive=True)
        for method in [
                self.PorterStemmer, self.SnowballStemmer, self.Lemmatizer
        ]:
            rb = QRadioButton(self,
                              text=self.transformation_values[method].name)
            self.add_to_content_area(rb)
            self.group.addButton(rb, method)
        self.group.buttonClicked.connect(self.group_button_clicked)

        # Restore the previous state, after starting off the layout.
        self.restore_data(data)
예제 #20
0
    def __init__(self, data):
        data = data or self.DEFAULT_SETTINGS
        PreprocessorModule.__init__(self, 'Tokenizer', False,
                                    data.get('is_enabled'))

        self.group = QButtonGroup(self, exclusive=True)
        for method in [
                self.NLTKTokenizer,
                self.NLTKPunctTokenizer,
                self.TwitterTokenizer,
        ]:
            rb = QRadioButton(self, text=self.tokenizer_names[method])
            self.add_to_content_area(rb)
            self.group.addButton(rb, method)
        self.group.buttonClicked.connect(self.group_button_clicked)

        # Restore the previous state, after starting off the layout.
        self.restore_data(data)
예제 #21
0
    def __init__(self, parameter, parent=None):
        """Constructor.

        :param parameter: A DefaultValueParameter object.
        :type parameter: DefaultValueParameter

        """
        super(DefaultValueParameterWidget, self).__init__(parameter, parent)

        self.radio_button_layout = QHBoxLayout()

        # Create radio button group
        self.input_button_group = QButtonGroup()

        for i in range(len(self._parameter.labels)):
            if '%s' in self._parameter.labels[i]:
                label = (
                    self._parameter.labels[i] %
                    self._parameter.options[i])
            else:
                label = self._parameter.labels[i]

            radio_button = QRadioButton(label)
            self.radio_button_layout.addWidget(radio_button)
            self.input_button_group.addButton(radio_button, i)
            if self._parameter.value == \
                    self._parameter.options[i]:
                radio_button.setChecked(True)

        # Create double spin box for custom value
        self.custom_value = QDoubleSpinBox()
        self.custom_value.setSingleStep(0.1)
        if self._parameter.options[-1]:
            self.custom_value.setValue(self._parameter.options[-1])
        self.radio_button_layout.addWidget(self.custom_value)

        self.toggle_custom_value()

        self.inner_input_layout.addLayout(self.radio_button_layout)

        # Connect
        # noinspection PyUnresolvedReferences
        self.input_button_group.buttonClicked.connect(
            self.toggle_custom_value)
    def __init__(self, parent, arrow):
        Ui_QgsComposerArrowWidgetBase.__init__(self, parent)

        self.mArrow = arrow
        self.mRadioButtonGroup = QButtonGroup(self)
        self.mRadioButtonGroup.addButton(self.mDefaultMarkerRadioButton)
        self.mRadioButtonGroup.addButton(self.mNoMarkerRadioButton)
        self.mRadioButtonGroup.addButton(self.mSvgMarkerRadioButton)
        self.mRadioButtonGroup.setExclusive(True)

        # //disable the svg related gui elements by default
        self.on_mSvgMarkerRadioButton_toggled(False)

        # //add widget for general composer item properties
        itemPropertiesWidget = QgsComposerItemWidget(self, self.mArrow)
        self.mainLayout.addWidget(itemPropertiesWidget)

        self.mArrowHeadOutlineColorButton.setColorDialogTitle(
            QString("Select arrow head outline color"))
        self.mArrowHeadOutlineColorButton.setAllowAlpha(True)
        self.mArrowHeadOutlineColorButton.setContext("composer")
        self.mArrowHeadOutlineColorButton.setNoColorString(
            QString("Transparent outline"))
        self.mArrowHeadOutlineColorButton.setShowNoColor(True)
        self.mArrowHeadFillColorButton.setColorDialogTitle(
            QString("Select arrow head fill color"))
        self.mArrowHeadFillColorButton.setAllowAlpha(True)
        self.mArrowHeadFillColorButton.setContext("composer")
        self.mArrowHeadFillColorButton.setNoColorString(
            QString("Transparent fill"))
        self.mArrowHeadFillColorButton.setShowNoColor(True)

        self.setGuiElementValues()

        if (arrow):
            self.connect(arrow, SIGNAL("itemChanged()"),
                         self.setGuiElementValues)
        self.connect(self.mArrowHeadWidthSpinBox,
                     SIGNAL("valueChanged(double)"),
                     self.on_mArrowHeadWidthSpinBox_valueChanged)

        self.timeEnd = 0
        self.timeStart = 0
예제 #23
0
    def __init__(self, result):
        QDialog.__init__(self)
        self.layout = QVBoxLayout(self)
        self.result = result
        observation_window = result.observation_window

        group = QButtonGroup(self)
        use_simu_duration = QRadioButton("Use entire simulation.")
        use_simu_duration.setChecked(
            observation_window[0] == 0
            and observation_window[1] == result.model.duration)
        group.addButton(use_simu_duration)
        self.layout.addWidget(use_simu_duration)

        use_custom = QRadioButton("Use a custom observation window:")
        use_custom.setChecked(not use_simu_duration.isChecked())
        group.addButton(use_custom)
        self.layout.addWidget(use_custom)

        self._slider = QxtSpanSliderWidget(
            0,
            result.model.now() // result.model.cycles_per_ms, self)
        self._slider.setSpan(
            observation_window[0] // result.model.cycles_per_ms,
            observation_window[1] // result.model.cycles_per_ms)
        self._slider.setEnabled(use_custom.isChecked())
        group.buttonClicked.connect(
            lambda x: self._slider.setEnabled(x == use_custom))

        self.layout.addWidget(self._slider)

        buttons = QWidget(self)
        buttons_layout = QHBoxLayout()
        buttons.setLayout(buttons_layout)
        buttons_layout.addStretch()
        ok_button = QPushButton("Ok")
        cancel_button = QPushButton("Cancel")
        ok_button.clicked.connect(self.accept)
        cancel_button.clicked.connect(self.reject)
        buttons_layout.addWidget(ok_button)
        buttons_layout.addWidget(cancel_button)
        self.layout.addWidget(buttons)
예제 #24
0
    def __init__(self, parent=None, mode="DateTime"):
        super(DateTimePickerWidget, self).__init__(parent)

        self.setupUi(self)
        self.mode = mode
        self.group = QButtonGroup()
        self.group.setExclusive(True)
        self.group.addButton(self.ambutton)
        self.group.addButton(self.pmbutton)

        self.ambutton.toggled.connect(self.isDirty)
        self.pmbutton.toggled.connect(self.isDirty)
        self.datepicker.selectionChanged.connect(self.isDirty)
        self.hourpicker.itemSelectionChanged.connect(self.isDirty)
        self.minutepicker.itemSelectionChanged.connect(self.isDirty)

        self.setasnowbutton.pressed.connect(self.setAsNow)
        self.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint)

        self.okButton.pressed.connect(self.ok.emit)
        self.closebutton.pressed.connect(self.cancel.emit)
예제 #25
0
    def __init__(self, parent=None, **kwargs):
        QWidget.__init__(self, parent, **kwargs)
        layout = QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)
        self.setLayout(layout)

        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
        self.__tabs = []

        self.__currentIndex = -1
        self.__changeOnHover = False

        self.__iconSize = QSize(26, 26)

        self.__group = QButtonGroup(self, exclusive=True)
        self.__group.buttonPressed[QAbstractButton].connect(
            self.__onButtonPressed)
        self.setMouseTracking(True)

        self.__sloppyButton = None
        self.__sloppyRegion = QRegion()
        self.__sloppyTimer = QTimer(self, singleShot=True)
        self.__sloppyTimer.timeout.connect(self.__onSloppyTimeout)
예제 #26
0
파일: owimpute.py 프로젝트: CHANAYA/orange3
    def __init__(self, parent=None):
        super().__init__(parent)
        self.modified = False

        box = group_box(self.tr("Default method"),
                        layout=layout(Qt.Vertical))
        self.controlArea.layout().addWidget(box)

        bgroup = QButtonGroup()

        for i, m in enumerate(self.METHODS[1:-1], 1):
            b = radio_button(m.name, checked=i == self.default_method,
                             group=bgroup, group_id=i)
            box.layout().addWidget(b)

        self.defbggroup = bgroup

        bgroup.buttonClicked[int].connect(self.set_default_method)
        box = group_box(self.tr("Individual attribute settings"),
                        layout=layout(Qt.Horizontal))
        self.controlArea.layout().addWidget(box)

        self.varview = QtGui.QListView(
            selectionMode=QtGui.QListView.ExtendedSelection
        )
        self.varview.setItemDelegate(DisplayFormatDelegate())
        self.varmodel = itemmodels.VariableListModel()
        self.varview.setModel(self.varmodel)
        self.varview.selectionModel().selectionChanged.connect(
            self._on_var_selection_changed
        )
        self.selection = self.varview.selectionModel()

        box.layout().addWidget(self.varview)

        method_layout = layout(Qt.Vertical, margins=0)
        box.layout().addLayout(method_layout)

        methodbox = group_box(layout=layout(Qt.Vertical))

        bgroup = QButtonGroup()
        for i, m in enumerate(self.METHODS):
            b = radio_button(m.name, group=bgroup, group_id=i)
            methodbox.layout().addWidget(b)

        assert self.METHODS[-1].short == "value"

        self.value_stack = value_stack = QStackedLayout()
        self.value_combo = QComboBox(activated=self._on_value_changed)
        self.value_line = QLineEdit(editingFinished=self._on_value_changed)
        self.value_line.setValidator(QDoubleValidator())
        value_stack.addWidget(self.value_combo)
        value_stack.addWidget(self.value_line)
        methodbox.layout().addLayout(value_stack)

        bgroup.buttonClicked[int].connect(
            self.set_method_for_current_selection
        )
        reset_button = push_button("Restore all to default",
                                   clicked=self.reset_var_methods,
                                   default=False, autoDefault=False)

        method_layout.addWidget(methodbox)
        method_layout.addStretch(2)
        method_layout.addWidget(reset_button)
        self.varmethodbox = methodbox
        self.varbgroup = bgroup

        commitbox = group_box("Commit", layout=layout(margins=0))

        cwidget = commit_widget(
            button_text="Commit",
            button_default=True,
            check_text="Commit on any change",
            checked=self.autocommit,
            clicked=self.commit
        )

        def toggle_auto_commit(b):
            self.autocommit = b
            if self.modified:
                self.commit()

        cwidget.auto_commit_check.toggled[bool].connect(toggle_auto_commit)
        commitbox.layout().addWidget(cwidget)

        self.addAction(cwidget.commit_action)
        self.controlArea.layout().addWidget(commitbox)

        self.data = None
        self.fitter = None
예제 #27
0
    def __init__(self, parameter, parent=None):
        """Constructor

        :param parameter: A DefaultSelectParameter object.
        :type parameter: DefaultSelectParameter
        """
        super(DefaultSelectParameterWidget, self).__init__(parameter, parent)

        self.default_layout = QHBoxLayout()
        self.radio_button_layout = QHBoxLayout()
        self.radio_button_widget = QWidget()

        self.default_label = QLabel(tr('Default'))

        # Create radio button group
        self.default_input_button_group = QButtonGroup()

        # Define string enabler for radio button
        self.radio_button_enabler = self.input.itemData(0, Qt.UserRole)

        for i in range(len(self._parameter.default_labels)):
            if '%s' in self._parameter.default_labels[i]:
                label = (self._parameter.default_labels[i] %
                         self._parameter.default_values[i])
            else:
                label = self._parameter.default_labels[i]

            radio_button = QRadioButton(label)
            self.radio_button_layout.addWidget(radio_button)
            self.default_input_button_group.addButton(radio_button, i)
            if self._parameter.default_value == \
                    self._parameter.default_values[i]:
                radio_button.setChecked(True)

        # Create double spin box for custom value
        self.custom_value = QDoubleSpinBox()
        if self._parameter.default_values[-1]:
            self.custom_value.setValue(self._parameter.default_values[-1])
        has_min = False
        if self._parameter.minimum is not None:
            has_min = True
            self.custom_value.setMinimum(self._parameter.minimum)
        has_max = False
        if self._parameter.maximum is not None:
            has_max = True
            self.custom_value.setMaximum(self._parameter.maximum)
        if has_min and has_max:
            step = (self._parameter.maximum - self._parameter.minimum) / 100.0
            self.custom_value.setSingleStep(step)
        self.radio_button_layout.addWidget(self.custom_value)

        self.toggle_custom_value()

        # Reset the layout
        self.input_layout.setParent(None)
        self.help_layout.setParent(None)

        self.label.setParent(None)
        self.inner_input_layout.setParent(None)

        self.input_layout = QGridLayout()
        self.input_layout.setSpacing(0)

        self.input_layout.addWidget(self.label, 0, 0)
        self.input_layout.addLayout(self.inner_input_layout, 0, 1)
        self.input_layout.addWidget(self.default_label, 1, 0)
        self.input_layout.addLayout(self.radio_button_layout, 1, 1)

        self.main_layout.addLayout(self.input_layout)
        self.main_layout.addLayout(self.help_layout)

        # check every added combobox, it could have been toggled by
        # the existing keyword
        self.toggle_input()

        # Connect
        # noinspection PyUnresolvedReferences
        self.input.currentIndexChanged.connect(self.toggle_input)
        self.default_input_button_group.buttonClicked.connect(
            self.toggle_custom_value)
예제 #28
0
    def __init__(self, parameter, parent=None):
        """Constructor.

        :param parameter: A GroupSelectParameter object.
        :type parameter: GroupSelectParameter
        """
        QWidget.__init__(self, parent)
        self._parameter = parameter

        # Store spin box
        self.spin_boxes = {}

        # Create elements
        # Label (name)
        self.label = QLabel(self._parameter.name)

        # Layouts
        self.main_layout = QVBoxLayout()
        self.input_layout = QVBoxLayout()

        # _inner_input_layout must be filled with widget in the child class
        self.inner_input_layout = QVBoxLayout()

        self.radio_button_layout = QGridLayout()

        # Create radio button group
        self.input_button_group = QButtonGroup()

        # List widget
        self.list_widget = QListWidget()
        self.list_widget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.list_widget.setDragDropMode(QAbstractItemView.DragDrop)
        self.list_widget.setDefaultDropAction(Qt.MoveAction)
        self.list_widget.setEnabled(False)
        self.list_widget.setSizePolicy(QSizePolicy.Maximum,
                                       QSizePolicy.Expanding)

        for i, key in enumerate(self._parameter.options):
            value = self._parameter.options[key]
            radio_button = QRadioButton(value.get('label'))
            self.radio_button_layout.addWidget(radio_button, i, 0)
            if value.get('type') == SINGLE_DYNAMIC:
                double_spin_box = QDoubleSpinBox()
                self.radio_button_layout.addWidget(double_spin_box, i, 1)
                double_spin_box.setValue(value.get('value', 0))
                double_spin_box.setMinimum(
                    value.get('constraint', {}).get('min', 0))
                double_spin_box.setMaximum(
                    value.get('constraint', {}).get('max', 1))
                double_spin_box.setSingleStep(
                    value.get('constraint', {}).get('step', 0.01))
                step = double_spin_box.singleStep()
                if step > 1:
                    precision = 0
                else:
                    precision = len(str(step).split('.')[1])
                    if precision > 3:
                        precision = 3
                double_spin_box.setDecimals(precision)
                self.spin_boxes[key] = double_spin_box

                # Enable spin box depends on the selected option
                if self._parameter.selected == key:
                    double_spin_box.setEnabled(True)
                else:
                    double_spin_box.setEnabled(False)

            elif value.get('type') == STATIC:
                static_value = value.get('value', 0)
                if static_value is not None:
                    self.radio_button_layout.addWidget(
                        QLabel(str(static_value)), i, 1)
            elif value.get('type') == MULTIPLE_DYNAMIC:
                selected_fields = value.get('value', [])
                if self._parameter.selected == key:
                    self.list_widget.setEnabled(True)
                else:
                    self.list_widget.setEnabled(False)

            self.input_button_group.addButton(radio_button, i)
            if self._parameter.selected == key:
                radio_button.setChecked(True)

        # Help text
        self.help_label = QLabel(self._parameter.help_text)
        self.help_label.setSizePolicy(QSizePolicy.Maximum,
                                      QSizePolicy.Expanding)
        self.help_label.setWordWrap(True)
        self.help_label.setAlignment(Qt.AlignTop)

        self.inner_input_layout.addLayout(self.radio_button_layout)
        self.inner_input_layout.addWidget(self.list_widget)

        # Put elements into layouts
        self.input_layout.addWidget(self.label)
        self.input_layout.addLayout(self.inner_input_layout)

        self.help_layout = QVBoxLayout()
        self.help_layout.addWidget(self.help_label)

        self.main_layout.addLayout(self.input_layout)
        self.main_layout.addLayout(self.help_layout)

        self.setLayout(self.main_layout)

        self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Expanding)

        # Update list widget
        self.update_list_widget()

        # Connect signal
        self.input_button_group.buttonClicked.connect(
            self.radio_buttons_clicked)
예제 #29
0
 def create_rows(self, layout):
     u"""Build the rows of the dialog box"""
     play_button_group = QButtonGroup(self)
     old_play_button_group = QButtonGroup(self)
     for num, entry in enumerate(self.entries_list, 3):
         tt_text = self.build_text_help_label(entry)
         ico_label = QLabel('', self)
         ico_label.setToolTip(tt_text)
         if entry.icon:
             ico_label.setPixmap(QPixmap.fromImage(entry.icon))
         layout.addWidget(ico_label, num, 0)
         tt_label = QLabel(entry.display_word, self)
         tt_label.setToolTip(tt_text)
         layout.addWidget(tt_label, num, 1)
         if self.hide_text:
             tt_label.hide()
         # Play button.
         t_play_button = QPushButton(self)
         play_button_group.addButton(t_play_button, num - 3)
         t_play_button.setToolTip(self.play_help)
         t_play_button.setIcon(QIcon(os.path.join(icons_dir, 'play.png')))
         layout.addWidget(t_play_button, num, self.play_column)
         if self.note[entry.audio_field_name]:
             t_play_old_button = QPushButton(self)
             old_play_button_group.addButton(t_play_old_button, num - 3)
             t_play_old_button.setIcon(
                 QIcon(os.path.join(icons_dir, 'play.png')))
             if not self.hide_text:
                 t_play_old_button.setToolTip(
                     self.note[entry.audio_field_name])
             else:
                 t_play_old_button.setToolTip(self.play_old_help_short)
             layout.addWidget(t_play_old_button, num, self.play_old_column)
         else:
             dummy_label = QLabel('', self)
             dummy_label.setToolTip(self.play_old_empty_line_help)
             layout.addWidget(dummy_label, num, self.play_old_column)
         # The group where we later look what to do:
         t_button_group = QButtonGroup(self)
         t_button_group.setExclusive(True)
         # Now the four buttons
         t_add_button = QPushButton(self)
         t_add_button.setCheckable(True)
         t_add_button.setFlat(True)
         t_add_button.setToolTip(self.add_help_text_short)
         t_add_button.setIcon(QIcon(os.path.join(icons_dir, 'add.png')))
         layout.addWidget(t_add_button, num, self.add_column)
         t_button_group.addButton(t_add_button, Action.Add)
         t_keep_button = QPushButton(self)
         t_keep_button.setCheckable(True)
         t_keep_button.setFlat(True)
         t_keep_button.setToolTip(self.keep_help_text_short)
         t_keep_button.setIcon(QIcon(os.path.join(icons_dir, 'keep.png')))
         layout.addWidget(t_keep_button, num, self.keep_column)
         t_button_group.addButton(t_keep_button, Action.Keep)
         t_delete_button = QPushButton(self)
         t_delete_button.setCheckable(True)
         t_delete_button.setFlat(True)
         t_delete_button.setToolTip(self.delete_help_text_short)
         t_delete_button.setIcon(
             QIcon(os.path.join(icons_dir, 'delete.png')))
         layout.addWidget(t_delete_button, num, self.delete_column)
         t_button_group.addButton(t_delete_button,  Action.Delete)
         t_blacklist_button = QPushButton(self)
         t_blacklist_button.setCheckable(True)
         t_blacklist_button.setFlat(True)
         t_blacklist_button.setToolTip(self.blacklist_help_text_short)
         t_blacklist_button.setIcon(
             QIcon(os.path.join(icons_dir, 'blacklist.png')))
         if entry.entry_hash:
             layout.addWidget(
                 t_blacklist_button, num, self.blacklist_column)
         else:
             t_blacklist_button.hide()
             dummy_label_bl = QLabel('', self)
             dummy_label_bl.setToolTip(self.blacklist_empty_line_help)
             layout.addWidget(dummy_label_bl, num, self.blacklist_column)
         t_button_group.button(entry.action).setChecked(True)
         # New: check a button based on how good the downloader is.
         t_button_group.addButton(t_blacklist_button, Action.Blacklist)
         self.buttons_groups.append(t_button_group)
     play_button_group.buttonClicked.connect(
         lambda button: play(
             self.entries_list[play_button_group.id(button)].file_path))
     # N.B.: anki.sound.play() plays files from anywhere, not just
     # from the colection.media folder. We should be good,
     # here. (This behaviour may be a security risk, idk.)
     old_play_button_group.buttonClicked.connect(
         lambda button: playFromText(
             self.note[
                 self.entries_list[
                     old_play_button_group.id(button)].audio_field_name]))
예제 #30
0
    def __init__(self, type_image=None, nb_bands=None):

        # creating interface
        Dialog = QDialog()
        self.bandsUi = Ui_Dialog()
        self.bandsUi.setupUi(Dialog)
        # screen = QApplication.desktop().screenGeometry()
        # self.move( screen.center() - self.rect().center() )

        groupButton1 = QButtonGroup()
        groupButton1.addButton(self.bandsUi.radioButton_formosat)
        groupButton1.addButton(self.bandsUi.radioButton_pleiades)
        groupButton1.addButton(self.bandsUi.radioButton_spot)
        groupButton1.addButton(self.bandsUi.radioButton_autre)

        self.red = None
        self.green = None
        self.blue = None
        self.pir = None
        self.mir = None
        self.satellite = "Non renseigné"

        # connect the qdialog button box
        # QObject.connect(self.bandsUi.buttonBox, SIGNAL("accepted()"), self.set_bands)
        # QObject.connect(self.bandsUi.buttonBox, SIGNAL("rejected()"), self.reset_bands)
        self.bandsUi.checkBox_blue.stateChanged.connect(
            self.blue_checkbox_changed)
        self.bandsUi.checkBox_mir.stateChanged.connect(
            self.mir_checkbox_changed)
        self.bandsUi.radioButton_formosat.toggled.connect(self.define_formosat)
        self.bandsUi.radioButton_pleiades.toggled.connect(self.define_pleiade)
        self.bandsUi.radioButton_spot.toggled.connect(self.define_spot)
        self.bandsUi.radioButton_autre.toggled.connect(self.define_other)

        QObject.connect(self.bandsUi.spinBox_blue, SIGNAL("valueChanged(int)"),
                        self.update_blue)
        QObject.connect(self.bandsUi.spinBox_red, SIGNAL("valueChanged(int)"),
                        self.update_red)
        QObject.connect(self.bandsUi.spinBox_green,
                        SIGNAL("valueChanged(int)"), self.update_green)
        QObject.connect(self.bandsUi.spinBox_pir, SIGNAL("valueChanged(int)"),
                        self.update_pir)
        QObject.connect(self.bandsUi.spinBox_mir, SIGNAL("valueChanged(int)"),
                        self.update_mir)
        # QObject.connect( spinBox_mir, SIGNAL( "valueChanged(int)" ), lambda x:self.mir = x)
        QObject.connect(self.bandsUi.buttonBox, SIGNAL("rejected()"),
                        self.cancel)

        # settrace()

        if nb_bands:
            self.nb_bands = nb_bands
            self.custom_from_nb_of_bands(nb_bands)
        else:
            self.nb_bands = -1

        gray_other = False
        if type_image:
            if type_image == "Spot 5" or type_image == "spot":
                logger.info("define spot")
                # self.define_spot(False)
                self.bandsUi.radioButton_spot.setChecked(True)
                self.bandsUi.radioButton_formosat.setEnabled(False)
                self.bandsUi.radioButton_pleiades.setEnabled(False)
                gray_other = True
            elif type_image == "PHR 1A":
                logger.info("define pleiade")
                # self.define_pleiade()
                self.bandsUi.radioButton_pleiades.setChecked(True)
                self.bandsUi.radioButton_formosat.setEnabled(False)
                self.bandsUi.radioButton_spot.setEnabled(False)
                gray_other = True
            elif type_image == "Formosat 2":
                logger.info("define formosat")
                # self.define_formosat(False)
                self.bandsUi.radioButton_formosat.setChecked(True)
                self.bandsUi.radioButton_spot.setEnabled(False)
                self.bandsUi.radioButton_pleiades.setEnabled(False)
                gray_other = True
            else:
                logger.info("define others")
                self.bandsUi.radioButton_autre.setChecked(True)
                self.set_spinbox_read_only(False)
            if gray_other:
                self.gray_other()

        # execute the dialog
        Dialog.exec_()