Example #1
0
class ActionsPane(QWidget):
    def __init__(self):
        super().__init__()

        self.group = QButtonGroup()
        self.group.setExclusive(False)

        self.scope_widget = ActionsScope()
        self.action_buttons = QVBoxLayout()
        self.big_red_button = QPushButton("Automate !!!", clicked=self.automate)
        self.big_red_button.setStyleSheet("QPushButton { background-color : red}")

        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

        self.layout.addWidget(self.scope_widget)
        self.layout.addLayout(self.action_buttons)
        self.layout.addStretch()
        self.layout.addWidget(self.big_red_button)

    def registerAction(self, action):
        button = ActionButton(action)
        self.group.addButton(button.checkbox)
        self.action_buttons.addWidget(button)

    def getCheckedActions(self):
        return [btn.parent().action for btn in self.group.buttons() if btn.isChecked()]

    def automate(self, event):
        for action in self.getCheckedActions():
            action.on_triggered()
Example #2
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")
Example #3
0
class ChooseBlogDialog(QDialog, Ui_ChooseBlogDialog):
    def __init__(self, available_blogs, addToDB):
        QDialog.__init__(self)
        Ui_ChooseBlogDialog.__init__(self)
        self.func = addToDB
        self.setupUi(self)
        radioboxLayout = QVBoxLayout()
        self.radiobuttonGroup = QButtonGroup()
        self.radios = []
        for blog in available_blogs:
            radio = BlogRadio("Blog Title: %s,   Url: %s" %(blog.blogname, blog.homeurl), blog)
            self.radiobuttonGroup.addButton(radio)
            radioboxLayout.addWidget(radio)
            self.radios.append(radio)
        self.chooseBlogFrame.setLayout(radioboxLayout)
        self.adjustSize()
        connect(self.chooseBlogButtonBox, SIGNAL("accepted()"), self.addBlog) #AddBlogDialog.accept)
        connect(self.chooseBlogButtonBox, SIGNAL("rejected()"), self.reject)#AddBlogDialog.reject)

    def addBlog(self):
        if self.radiobuttonGroup.checkedButton():
            self.func(self.radiobuttonGroup.checkedButton().blog)
            self.accept()
        else:
            QMessageBox.warning(self, "Choose A Blog", "Please choose a blog and click OK.  If you do not want to add a blog, Please click 'Cancel'", QMessageBox.Ok, QMessageBox.Ok)
        pass
Example #4
0
    def __init__(self, iface_name, parent=None):
        IfaceWizardPage.__init__(self, parent)
        self.q_netobject = QNetObject.getInstance()
        self.setSubTitle("What kind of interface do you want to configure?")
        box = QVBoxLayout(self)

        self.ethernet = "ethernet", "Activate ethernet interface %s" % iface_name , QRadioButton()
        self.vlan = "vlan", "Create a VLAN interface", QRadioButton()

        group = QButtonGroup(self)
        form = QFormLayout()

        options = (self.ethernet, self.vlan)

        for item in options:
            group.addButton(item[2])
            form.addRow(item[1], item[2])
            self.registerField(item[0], item[2])


        self.ethernet[2].setChecked(Qt.Checked)

        box.addLayout(form)
        box.addStretch()

        box.addWidget(
            HelpMissingFunction("""\
All interfaces but one (%s) are configured.

In order to be able to activate an ethernet interface for bonding agregation, \
you must deconfigure at least one ethernet interface first \
(which may be in use by vlans or bondings).""" % iface_name)
        )
Example #5
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()
Example #6
0
class BoardWidget(QWidget):
    def __init__(self, *args, **kwargs):
        engine = kwargs.pop('engine')

        super(BoardWidget, self).__init__(*args, **kwargs)

        self.setupEngine(engine)

        self.setupUi()

    def setupEngine(self, engine):
        self.engine = engine
        self.engine.playerMoved.connect(self.handlePlayerMoved)

    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)

    def handlePlayerMoved(self, position, player):
        self.buttonGroup.buttons()[position].markPlayer(player)

    def resetUi(self):
        for button in self.buttonGroup.buttons():
            button.clearText()
Example #7
0
class TransformationModule(PreprocessorModule):
    DEFAULT_SETTINGS = {
        'is_enabled': True,
        'method': 0,
    }

    PorterStemmer, SnowballStemmer, Lemmatizer = 0, 1, 2
    transformation_values = {
        PorterStemmer: PS,
        SnowballStemmer: SS,
        Lemmatizer: LM,
    }

    transformation_method = 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)

    def group_button_clicked(self):
        self.transformation_method = self.group.checkedId()
        self.notify_on_change()

    def restore_data(self, data):
        self.transformation_method = data.get('method')
        b = self.group.button(self.transformation_method)
        b.setChecked(True)

    def export_data(self):
        return {
            'is_enabled': self.enabled,
            'method': self.transformation_method,
        }

    def get_pp_setting(self):
        return {
            'transformation': self.transformation_values.get(
                    self.transformation_method
            )
        }
Example #8
0
class TokenizerModule(PreprocessorModule):
    DEFAULT_SETTINGS = {
        'is_enabled': True,
        'method': 0,
    }

    NLTKTokenizer, NLTKPunctTokenizer, TwitterTokenizer = 0, 1, 2
    tokenizer_values = {
        NLTKTokenizer: 'default',
        NLTKPunctTokenizer: 'no_punct',
        TwitterTokenizer: 'twitter'
    }
    tokenizer_names = {
        NLTKTokenizer: 'NLTK tokenizer',
        NLTKPunctTokenizer: 'NLTK tokenizer (no punctuation)',
        TwitterTokenizer: 'Twitter tokenizer',
    }

    tokenizer_method = 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)

    def group_button_clicked(self):
        self.tokenizer_method = self.group.checkedId()
        self.notify_on_change()

    def restore_data(self, data):
        self.tokenizer_method = data.get('method')
        b = self.group.button(self.tokenizer_method)
        b.setChecked(True)

    def export_data(self):
        return {
            'is_enabled': self.enabled,
            'method': self.tokenizer_method,
        }

    def get_pp_setting(self):
        return {
            'tokenizer': self.tokenizer_values.get(self.tokenizer_method)
        }
Example #9
0
class ScopeBox(QGroupBox):
    title = None
    button_type = None

    def __init__(self):
        if self.title is None or self.button_type is None:
            raise Exception("Still too abstract!")

        super().__init__(title=self.title)

        self.populate_button_id()
        self.build_layout()
        self.populate_box()
        self.select_default()

        if self.button_type == 'check':
            self.group.setExclusive(False)

    def populate_button_id(self):
        pass

    def build_layout(self):
        self.group = QButtonGroup()
        self.layout = QVBoxLayout()
        self.setLayout(self.layout)

    def populate_box(self):
        keys = list(self.button_id.keys())
        keys.sort()

        BtnClass = None
        if self.button_type == 'check':
            BtnClass = QCheckBox
        elif self.button_type == 'radio':
            BtnClass = QRadioButton

        for key in keys:
            btn = BtnClass(key)
            self.layout.addWidget(btn)
            self.group.addButton(btn, self.button_id[key])

    def select_default(self):
        pass

    def getSelection(self):
        selection = None

        if self.button_type == 'radio':
            selection = self.group.checkedId()
        elif self.button_type == 'check':
            selection = []

            for btn in self.group.buttons():
                if btn.isChecked():
                    selection.append(btn.text())

        return selection
Example #10
0
class TokenizerModule(PreprocessorModule):
    DEFAULT_SETTINGS = {
        'is_enabled': True,
        'method': 0,
    }

    NLTKTokenizer, NLTKPunctTokenizer, TwitterTokenizer = 0, 1, 2
    tokenizer_values = {
        NLTKTokenizer: 'default',
        NLTKPunctTokenizer: 'no_punct',
        TwitterTokenizer: 'twitter'
    }
    tokenizer_names = {
        NLTKTokenizer: 'NLTK tokenizer',
        NLTKPunctTokenizer: 'NLTK tokenizer (no punctuation)',
        TwitterTokenizer: 'Twitter tokenizer',
    }

    tokenizer_method = 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)

    def group_button_clicked(self):
        self.tokenizer_method = self.group.checkedId()
        self.notify_on_change()

    def restore_data(self, data):
        self.tokenizer_method = data.get('method')
        b = self.group.button(self.tokenizer_method)
        b.setChecked(True)

    def export_data(self):
        return {
            'is_enabled': self.enabled,
            'method': self.tokenizer_method,
        }

    def get_pp_setting(self):
        return {'tokenizer': self.tokenizer_values.get(self.tokenizer_method)}
Example #11
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()
Example #12
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)
Example #13
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)
Example #14
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)
Example #15
0
    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()
Example #16
0
class TransformationModule(PreprocessorModule):
    DEFAULT_SETTINGS = {
        'is_enabled': True,
        'method': 0,
    }

    PorterStemmer, SnowballStemmer, Lemmatizer = 0, 1, 2
    transformation_values = {
        PorterStemmer: PS,
        SnowballStemmer: SS,
        Lemmatizer: LM,
    }

    transformation_method = 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)

    def group_button_clicked(self):
        self.transformation_method = self.group.checkedId()
        self.notify_on_change()

    def restore_data(self, data):
        self.transformation_method = data.get('method')
        b = self.group.button(self.transformation_method)
        b.setChecked(True)

    def export_data(self):
        return {
            'is_enabled': self.enabled,
            'method': self.transformation_method,
        }

    def get_pp_setting(self):
        return {
            'transformation':
            self.transformation_values.get(self.transformation_method)
        }
Example #17
0
class AxisWidgetContainer(GridWidget):
    def __init__(self, axisModel, parent = None):
        super(AxisWidgetContainer, self).__init__(["_Axis", "_Value_", "_X(24)", "_Y(24)"], parent)
        self.axisModel = axisModel
        self.xGroup = QButtonGroup()
        self.yGroup = QButtonGroup()
        self.xGroup.buttonClicked.connect(self.showXAxisButtonClicked)
        self.yGroup.buttonClicked.connect(self.showYAxisButtonClicked)
        axis = 0
        for axis in range(axisModel.currentJoystickNumAxes()):
            self.__createTextWidgetForAxis__(axis)
        if axis > 0:
            self.graphWidget = AxisGraphWidget(self)
            self.addWidget(self.graphWidget, 3, 0, 1, 2)
        sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth())
        self.scrollArea.setSizePolicy(sizePolicy)
        
    def __createTextWidgetForAxis__(self, axis):
        textWidget = AxisTextWidget(axis, self)
        self.axisModel.addAxisObserver(textWidget, axis)
        showInX = QRadioButton()
        showInY = QRadioButton()
        showInX.setObjectName(str(axis))
        showInY.setObjectName(str(axis))
        showInX.setLayoutDirection(Qt.RightToLeft)
        showInY.setLayoutDirection(Qt.RightToLeft)
        showInX.setMaximumSize(24, 24)
        showInY.setMaximumSize(24, 24)
        self.xGroup.addButton(showInX)
        self.yGroup.addButton(showInY)
        gridLayout = QGridLayout()
        gridLayout.addWidget(textWidget, 0, 0, 1, 2)
        gridLayout.addWidget(showInX, 0, 2, 1, 1)
        gridLayout.addWidget(showInY, 0, 3, 1, 1)
        self.addLayoutToScrollArea(gridLayout)

    def showXAxisButtonClicked(self, button):
        if button.isChecked():
            self.graphWidget.setXAxis(int(button.objectName()))
            self.axisModel.addAxisObserver(self.graphWidget, int(button.objectName()))
        else:
            self.axisModel.removeAxisObserver(self.graphWidget, int(button.objectName()))
    
    def showYAxisButtonClicked(self, button):
        if button.isChecked():
            self.graphWidget.setYAxis(int(button.objectName()))
            self.axisModel.addAxisObserver(self.graphWidget, int(button.objectName()))
        else:
            self.axisModel.removeAxisObserver(self.graphWidget, int(button.objectName()))
Example #18
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))
Example #20
0
class RadioBooleanFilter(QWidget, Control):

    """ Boolean filter (Only/Exclude)
    """

    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)

    def value(self):
        return {"excluded": "%i" % self.buttonGroup.checkedId()}

    def get_filter(self):
        return self.tree.internalName, self.value()

    def query(self):
        return [("Filter", self.tree, self.value())]

    def setControlValue(self, name, value):
        for i, v in enumerate(self.values):
            if v == value:
                button = self.buttonGroup.button(i)
                button.setChecked(True)
                break
Example #21
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)
Example #22
0
class RadioBooleanFilter(QWidget, Control):

    """ Boolean filter (Only/Exclude)
    """

    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)

    def value(self):
        return {"excluded": "%i" % self.buttonGroup.checkedId()}

    def get_filter(self):
        return self.tree.internalName, self.value()

    def query(self):
        return [("Filter", self.tree, self.value())]

    def setControlValue(self, name, value):
        for i, v in enumerate(self.values):
            if v == value:
                button = self.buttonGroup.button(i)
                button.setChecked(True)
                break
Example #23
0
    def __init__(self, parent, hex_widget):
        utils.Dialog.__init__(self, parent, name='add_bookmark_dialog')
        self.hexWidget = hex_widget
        self.ui = Ui_AddBookmarkDialog()
        self.ui.setupUi(self)
        self._canCreateBookmark = True
        self._isColorChoosen = False

        self._groupMark = QButtonGroup()
        self._groupMark.addButton(self.ui.btnMarkCaret)
        self._groupMark.addButton(self.ui.btnMarkSelection)
        if self.hexWidget.hasSelection:
            self.ui.btnMarkSelection.setChecked(True)
        else:
            self.ui.btnMarkCaret.setChecked(True)

        self._groupBind = QButtonGroup()
        self._groupBind.addButton(self.ui.btnBoundToPosition)
        self._groupBind.addButton(self.ui.btnBoundToData)
        self.ui.btnBoundToData.setChecked(True)

        self._bookmarkColor = QColor(Qt.red)

        self.ui.btnMarkCaret.toggled.connect(self._updateOk)
        self.ui.btnMarkSelection.toggled.connect(self._updateOk)
        self.ui.btnMarkCaret.toggled.connect(self._updateColor)
        self.ui.btnMarkSelection.toggled.connect(self._updateColor)

        self.ui.btnSelectColor.clicked.connect(self._selectBookmarkColor)

        self._updateOk()

        bookmark_name = ''
        if self._canCreateBookmark:
            bookmark_range = self.createBookmark()
            # find existing bookmarks that contain this one
            c_bookmarks = [b for b in self.hexWidget.bookmarks if b.contains(bookmark_range)]

            if c_bookmarks:
                c_bookmark = min(c_bookmarks, key=lambda x: x.size)
                bookmark_name = c_bookmark.name + '.'

        if bookmark_name:
            self.ui.txtName.setText(bookmark_name)
        else:
            bookmark_name = utils.tr('bookmark{0}').format(currentBookmarkIndex)
            self.ui.txtName.setText(bookmark_name)
            self.ui.txtName.selectAll()

        self._updateColor()
Example #24
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)
Example #25
0
    def add_node(self, parentItem, path, type):
        item = QTreeWidgetItem(parentItem)
        item.setText(0, path_leaf(path))
        buttonGroup = QButtonGroup()

        isNewFile = type is "UNTRACKED"
        isModifiedFile = type is "MODIFIED"
        isMissing = type is "MISSING"
        isDirectory = type is "DIR"

        if isNewFile:
            item.setText(1, type)
            item.setForeground(1, QBrush(QColor(0, 255, 0)))
        if isModifiedFile:
            item.setText(1, type)
            item.setForeground(1, QBrush(QColor(0, 0, 255)))
        if isMissing:
            item.setText(1, type)
            item.setForeground(1, QBrush(QColor(255, 0, 0)))
        if isDirectory:
            for i in range(self.tree.columnCount()):
                item.setBackground(i, QBrush(QColor(230, 230, 255)))

        # must keep reference to buttonGroup for its callback to work
        parent_data = self.retrieve_data(parentItem)
        if parent_data != None:
            path = os.path.join(parent_data[0], path)
        self.attach_data(item, (path, buttonGroup, type))

        for i in range(self.uncheckableColumns, self.tree.columnCount()):
            if i == self.tree.columnCount() - 7 and isMissing:
                continue # option to add not enabled for missing files
            if i == self.tree.columnCount() - 4 and isNewFile:
                continue # option to resolve not enabled for new files
            if i == self.tree.columnCount() - 3 and not isMissing:
                continue # option to stop tracking enabled only for missing files
            if i == self.tree.columnCount() - 2 and not isNewFile:
                continue # option to delete enabled only for untracked files
            if i == self.tree.columnCount() - 2 and isDirectory:
                continue # option to delete not enabled for directories, too dangerous
            button = QRadioButton()
            buttonGroup.addButton(button, i - self.uncheckableColumns) # id is the index
            button.treeItem = item
            self.tree.setItemWidget(item, i, button)

        buttonGroup.buttonClicked.connect(self.tree_item_radio_clicked)

        return item
Example #26
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        # Widgets, layouts and signals
        self._group = QButtonGroup()
        layout = QGridLayout()
        layout.setSpacing(0)
        ## Element
        for z, position in _ELEMENT_POSITIONS.items():
            widget = ElementPushButton(z)
            widget.setStyle(QStyleFactory.create("windows"))
            widget.setCheckable(True)
            layout.addWidget(widget, *position)
            self._group.addButton(widget, z)
        ## Labels
        layout.addWidget(QLabel(''), 7, 0) # Dummy
        layout.addWidget(QLabel('*'), 5, 2, Qt.AlignRight)
        layout.addWidget(QLabel('*'), 8, 2, Qt.AlignRight)
        layout.addWidget(QLabel('**'), 6, 2, Qt.AlignRight)
        layout.addWidget(QLabel('**'), 9, 2, Qt.AlignRight)

        for row in [0, 1, 2, 3, 4, 5, 6, 8, 9]:
            layout.setRowStretch(row, 1)

        self.setLayout(layout)

        # Signals
        self._group.buttonClicked.connect(self.selectionChanged)

        # Default
        self.setColorFunction(_category_color_function)
    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)
Example #28
0
    def __init__(self, nnd_widget, conf, name=""):
        NndDialog.__init__(self, nnd_widget, conf, title=tr("Domain"), name=name)

        self.typeselectors = QButtonGroup()
        for index, item in enumerate(NND_DIRTYPES):
            button = getattr(self, "type_%s_radiobutton" % item)
            self.typeselectors.addButton(button, index)
Example #29
0
    def __init__(self, mode="DateTime"):
        QDialog.__init__(self)
        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.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.setasnowbutton.pressed.connect(self.setAsNow)
        self.setWindowFlags(Qt.Dialog | Qt.CustomizeWindowHint)

        if mode == "Date":
            self.timesection.hide()
            self.setasnowbutton.setText("Set as current date")
        elif mode == "Time":
            self.datepicker.hide()
            self.setasnowbutton.setText("Set as current time")
Example #30
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())
    def __init__(self, mode="DateTime"):
        QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = Ui_datatimerpicker()
        self.ui.setupUi(self)
        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.hourpicker.hide()
            self.ui.minutepicker.hide()
            self.ui.ampmbutton.hide()
        elif mode == "Time":
            self.ui.datepicker.hide()
 def __init__(self):
     """
     Constructor
     """
     ConfigurationPageBase.__init__(self)
     self.setupUi(self)
     self.setObjectName("HelpViewersPage")
     
     self.helpViewerGroup = QButtonGroup()
     self.helpViewerGroup.addButton(self.helpBrowserButton)
     self.helpViewerGroup.addButton(self.qtAssistantButton)
     self.helpViewerGroup.addButton(self.webBrowserButton)
     self.helpViewerGroup.addButton(self.customViewerButton)
     
     self.customViewerCompleter = E4FileCompleter(self.customViewerEdit)
     
     # set initial values
     hvId = Preferences.getHelp("HelpViewerType")
     if hvId == 1:
         self.helpBrowserButton.setChecked(True)
     elif hvId == 2:
         self.qtAssistantButton.setChecked(True)
     elif hvId == 3:
         self.webBrowserButton.setChecked(True)
     else:
         self.customViewerButton.setChecked(True)
     self.customViewerEdit.setText(\
         Preferences.getHelp("CustomViewer"))
Example #33
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
    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()
Example #35
0
class InputRadioGroup(QWidget):
    """Create an horizontal radio group"""
    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)

    @pyqtProperty(str)
    def currentItemData(self):
        return str(abs(int(self.group.checkedId())) - 1)
Example #36
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)
    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)

        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()
Example #38
0
 def __init__(self, axisModel, parent = None):
     super(AxisWidgetContainer, self).__init__(["_Axis", "_Value_", "_X(24)", "_Y(24)"], parent)
     self.axisModel = axisModel
     self.xGroup = QButtonGroup()
     self.yGroup = QButtonGroup()
     self.xGroup.buttonClicked.connect(self.showXAxisButtonClicked)
     self.yGroup.buttonClicked.connect(self.showYAxisButtonClicked)
     axis = 0
     for axis in range(axisModel.currentJoystickNumAxes()):
         self.__createTextWidgetForAxis__(axis)
     if axis > 0:
         self.graphWidget = AxisGraphWidget(self)
         self.addWidget(self.graphWidget, 3, 0, 1, 2)
     sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.scrollArea.sizePolicy().hasHeightForWidth())
     self.scrollArea.setSizePolicy(sizePolicy)
Example #39
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)
Example #40
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)
Example #41
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)
Example #42
0
    def _setupUi(self):
        self.setWindowTitle(tr("Export Options"))
        self.mainLayout = QVBoxLayout(self)

        self.label1 = QLabel(tr("Which accounts do you want to export?"), self)
        self.mainLayout.addWidget(self.label1)
        self.exportTypeButtons = QButtonGroup(self)
        self.exportAllButton = QRadioButton(tr("All"), self)
        self.mainLayout.addWidget(self.exportAllButton)
        self.exportTypeButtons.addButton(self.exportAllButton, ExportType.All)
        self.exportAllButton.setChecked(True)
        self.exportSelectedButton = QRadioButton(tr("Selected"), self)
        self.mainLayout.addWidget(self.exportSelectedButton)
        self.exportTypeButtons.addButton(self.exportSelectedButton, ExportType.Selected)

        self.tableView = QTableView(self)
        self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tableView.verticalHeader().setVisible(False)
        self.tableView.verticalHeader().setDefaultSectionSize(18)
        self.mainLayout.addWidget(self.tableView)

        self.label2 = QLabel(tr("Export format:"), self)
        self.mainLayout.addWidget(self.label2)
        self.exportFormatButtons = QButtonGroup(self)
        self.exportAsQIFButton = QRadioButton("QIF", self)
        self.mainLayout.addWidget(self.exportAsQIFButton)
        self.exportFormatButtons.addButton(self.exportAsQIFButton, ExportFormat.QIF)
        self.exportAsQIFButton.setChecked(True)
        self.exportAsCSVButton = QRadioButton("CSV", self)
        self.mainLayout.addWidget(self.exportAsCSVButton)
        self.exportFormatButtons.addButton(self.exportAsCSVButton, ExportFormat.CSV)

        self.label3 = QLabel(tr("Export scope:"))
        self.mainLayout.addWidget(self.label3)
        self.dateRangeOnlyCheckbox = QCheckBox(tr("Current date range only"))
        self.mainLayout.addWidget(self.dateRangeOnlyCheckbox)

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel)
        self.exportButton = self.buttonBox.addButton(tr("Export"), QDialogButtonBox.ActionRole)
        self.mainLayout.addWidget(self.buttonBox)
Example #43
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()
Example #44
0
    def __init__(self, parent=None):
        IfaceWizardPage.__init__(self, parent)
        self.setSubTitle("What kind of interface do you want to configure?")

        self.ethernet = "ethernet", "Activate ethernet interface", QRadioButton()
        self.vlan = "vlan", "Create a VLAN interface", QRadioButton()
        self.bonding = "bonding", QLabel("Create a bonding interface"), QRadioButton()

        group = QButtonGroup(self)
        form = QFormLayout(self)

        options = (self.ethernet, self.vlan, self.bonding)

        for item in options:
            group.addButton(item[2])
            form.addRow(item[1], item[2])
            self.registerField(item[0], item[2])

        self.ethernet[2].setChecked(Qt.Checked)
    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
    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 range(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)
Example #47
0
    def mkSslBox(self):
        group = QGroupBox(tr("Check server certificate"))
        group.setCheckable(True)
        box = QVBoxLayout(group)

        #id 0
        nupki = QRadioButton(tr("Upload certificate"))
        #id 1
        custom = QRadioButton(tr("Use an internal PKI"))

        hbox = QHBoxLayout()
        box.addLayout(hbox)
        self.nupki_or_custom = QButtonGroup()
        self.connect(self.nupki_or_custom, SIGNAL('buttonClicked(int)'), self.toggleCustomOrNupki)
        for index, radio in enumerate((custom, nupki)):
            hbox.addWidget(radio)
            self.nupki_or_custom.addButton(radio, index)

        self.file_selector_widget = QWidget()
        vbox = QVBoxLayout(self.file_selector_widget)
        selector_label = QLabel(tr("Manually uploaded LDAP certificate"))
        vbox.addWidget(selector_label)
        add_cert_trigger = AddButton(text=tr("Upload a certificate"))
        vbox.addWidget(add_cert_trigger)
        vbox.addWidget(separator())

        self.has_cert_message = QLabel(
            tr("There is no manually uploaded server certificate")
            )
        self.del_cert = RemButton(
            tr("Delete certificate file from server")
            )
        vbox.addWidget(self.has_cert_message)
        vbox.addWidget(self.del_cert)

        self.connect(add_cert_trigger, SIGNAL('clicked()'), self.upload_server_cert)

        self.connect(self.del_cert, SIGNAL('clicked()'), self.delete_server_cert)

        self.nupki_message = MessageArea()
        self.nupki_message.setMessage(tr("Warning"),
            tr(
                "There is no server certificate in the internal PKI.<br/>"
                "Please import or generate one using an internal PKI."
            )
            )

        for anti_button, widget in ((custom, self.nupki_message), (nupki, self.file_selector_widget)):
            box.addWidget(widget)
            self.connect(anti_button, SIGNAL('toggled(bool)'), widget.setVisible)

        self.selectCustomOrNupki(CUSTOM)

        return group
class CategoryButtons(QWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        Layout = QHBoxLayout(self)
        self.group = QButtonGroup(self)
        for i, (k, color) in enumerate(ORDERED):
            button = QPushButton(k)
            palette = QPalette(button.palette())
            palette.setColor(QPalette.Button, color)
            button.setPalette(palette)
            self.group.addButton(button)
            self.group.setId(button, i)
            Layout.addWidget(button)
        QObject.connect(self.group,
                        SIGNAL('buttonClicked(QAbstractButton *)'),
                        self.clicked)

    def clicked(self, button):
        category = ORDERED[self.group.id(button)][0]
        self.emit(SIGNAL('selected(QString &)'), category)
Example #49
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)
Example #50
0
 def __init__(self, parent = None):
     QMainWindow.__init__(self, parent)
     self.setupUi(self)
     self.setupSoQt()
     self.buttonGroup = QButtonGroup(self.groupBox)
     self.buttonGroup.addButton(self.button_x, 0)
     self.buttonGroup.addButton(self.button_y, 1)
     self.buttonGroup.addButton(self.button_z, 2)
     self.connect(self.buttonGroup, SIGNAL("buttonClicked(int)"), self.change_axis)
     self.connect(self.button, SIGNAL("clicked()"), self.change_color)
     self.connect(self.checkbox, SIGNAL("clicked()"), self.rotate)
Example #51
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)
Example #52
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)
Example #53
0
    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()
Example #54
0
    def choice(self, title, msg, choices):
        vbox = QVBoxLayout()
        self.set_layout(vbox)
        vbox.addWidget(QLabel(title))
        gb2 = QGroupBox(msg)
        vbox.addWidget(gb2)

        vbox2 = QVBoxLayout()
        gb2.setLayout(vbox2)

        group2 = QButtonGroup()
        for i, c in enumerate(choices):
            button = QRadioButton(gb2)
            button.setText(c[1])
            vbox2.addWidget(button)
            group2.addButton(button)
            group2.setId(button, i)
            if i == 0:
                button.setChecked(True)
        vbox.addStretch(1)
        vbox.addLayout(Buttons(CancelButton(self), OkButton(self, _('Next'))))
        if not self.exec_():
            return
        wallet_type = choices[group2.checkedId()][0]
        return wallet_type
Example #55
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)
Example #56
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)
Example #57
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)
Example #58
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)