コード例 #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,
                           restart=False,
                           section=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] = (section, option, default)
        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)

            radiobutton.toggled.connect(show_message)
        radiobutton.restart_required = restart
        radiobutton.label_text = text
        return radiobutton
コード例 #2
0
ファイル: configdialog.py プロジェクト: impact27/spyder
 def create_radiobutton(self, text, option, default=NoDefault,
                        tip=None, msg_warning=None, msg_info=None,
                        msg_if_enabled=False, button_group=None,
                        restart=False):
     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, default)
     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)
         radiobutton.toggled.connect(show_message)
     radiobutton.restart_required = restart
     radiobutton.label_text = text
     return radiobutton