Python PyQt4.QtGui.QRadioButton() Examples

The following are 17 code examples of PyQt4.QtGui.QRadioButton(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt4.QtGui , or try the search function .
Example #1
Source File: options.py    From wacom-gui with GNU General Public License v3.0 6 votes vote down vote up
def screenOptions(self):
        if QtGui.QDesktopWidget().numScreens() == 1:
            self.screenFull = None
            return None
        groupBox = QtGui.QGroupBox("Screen Area")
        groupBox.setAlignment(QtCore.Qt.AlignHCenter)
        groupBox.setFixedHeight(120)
        self.screenGroup = QtGui.QButtonGroup(groupBox)
        self.displays = []
        for x in range(0, QtGui.QDesktopWidget().numScreens()):
            self.displays.append(QtGui.QRadioButton("Monitor %d" % x))
        self.screenFull = QtGui.QRadioButton("All Monitors")
        for screen in self.displays:
            self.screenGroup.addButton(screen)
        self.screenGroup.addButton(self.screenFull)
        screenLayout = QtGui.QVBoxLayout()
        for screen in self.displays:
            screenLayout.addWidget(screen)
        screenLayout.addWidget(self.screenFull)
        screenLayout.addStretch(1)
        self.screenGroup.buttonClicked.connect(self.screenChange)
        groupBox.setLayout(screenLayout)
        return groupBox 
Example #2
Source File: GUIElements.py    From FlatCAM with MIT License 6 votes vote down vote up
def __init__(self, choices, orientation='horizontal', parent=None):
        """
        The choices are specified as a list of dictionaries containing:

        * 'label': Shown in the UI
        * 'value': The value returned is selected

        :param choices: List of choices. See description.
        :type choices: list
        """
        super(RadioSet, self).__init__(parent)
        self.choices = copy(choices)

        if orientation == 'horizontal':
            layout = QtGui.QHBoxLayout()
        else:
            layout = QtGui.QVBoxLayout()

        group = QtGui.QButtonGroup(self)

        for choice in self.choices:
            choice['radio'] = QtGui.QRadioButton(choice['label'])
            group.addButton(choice['radio'])
            layout.addWidget(choice['radio'], stretch=0)
            choice['radio'].toggled.connect(self.on_toggle)

        layout.setContentsMargins(0, 0, 0, 0)
        layout.addStretch()
        self.setLayout(layout)

        self.group_toggle_fn = lambda: None 
Example #3
Source File: settingDialog.py    From LabelImgTool with MIT License 6 votes vote down vote up
def createModeGroup(self):
        '''
        set the trask mode setting group
        :return: mode group
        '''
        self.modegroupBox = QtGui.QGroupBox("& Task Mode")
        self.modegroupBox.setCheckable(True)
        self.modegroupBox.setChecked(True)
        self.CLS_mode_rb = QtGui.QRadioButton("CLS Mode")
        self.CLS_mode_rb.clicked.connect(self.CLS_model_selected)
        self.DET_mode_rb = QtGui.QRadioButton("DET Mode")
        self.DET_mode_rb.clicked.connect(self.DET_model_selected)
        self.SEG_mode_rb = QtGui.QRadioButton("SEG Mode")
        self.SEG_mode_rb.clicked.connect(self.SEG_model_selected)
        self.BRU_mode_rb = QtGui.QRadioButton("BRU Mode")
        self.BRU_mode_rb.clicked.connect(self.BRU_model_selected)

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.CLS_mode_rb)
        vbox.addWidget(self.DET_mode_rb)
        vbox.addWidget(self.SEG_mode_rb)
        vbox.addWidget(self.BRU_mode_rb)
        vbox.addStretch(True)
        self.modegroupBox.setLayout(vbox)
        return self.modegroupBox 
Example #4
Source File: Sniffer.py    From SimpleSniffer with GNU General Public License v3.0 5 votes vote down vote up
def initUI(self):
        device_data = get_iface_name()
        iface_num = len(device_data)
        iface_keys = device_data.keys()
        #网卡列表
        self.radio_lists = []
        self.gridlayout = QtGui.QGridLayout()
        self.label_name = QtGui.QLabel(u'接口名')
        self.label_ip = QtGui.QLabel(u'IP地址')
        self.label_receive = QtGui.QLabel(u'接受流量')
        self.label_send = QtGui.QLabel(u'发送流量')
        self.gridlayout.addWidget(self.label_name, 1, 1)
        self.gridlayout.addWidget(self.label_ip, 1, 2)
        self.gridlayout.addWidget(self.label_receive, 1, 3)
        self.gridlayout.addWidget(self.label_send, 1, 4)
        self.setLayout(self.gridlayout)
        for i in range(iface_num):
            iface_name = iface_keys[i]
            self.iface_radio = QtGui.QRadioButton(iface_name)
            if iface_name == 'eth0':
                self.iface_radio.setChecked(True)
            self.gridlayout.addWidget(self.iface_radio, i+2, 1)
            self.radio_lists.append(self.iface_radio)
            self.ip_label = QtGui.QLabel(get_ip_address(iface_name))
            self.gridlayout.addWidget(self.ip_label, i+2, 2)
            data = device_data[iface_name].split(';')
            self.receive_label = QtGui.QLabel(data[0])
            self.send_label = QtGui.QLabel(data[1])
            self.gridlayout.addWidget(self.receive_label, i+2, 3)
            self.gridlayout.addWidget(self.send_label, i+2, 4)
            self.setLayout(self.gridlayout)
        #添加按钮
        self.start_but = QtGui.QPushButton(u'确定', self)
        self.start_but.clicked.connect(self.exit_me)
        self.start_but.setCheckable(False)
        self.gridlayout.addWidget(self.start_but, iface_num + 2, 2)
        self.cancel_but = QtGui.QPushButton(u'取消', self)
        self.connect(self.cancel_but, QtCore.SIGNAL('clicked()'), QtCore.SLOT('close()'))
        self.cancel_but.setCheckable(False)
        self.gridlayout.addWidget(self.cancel_but, iface_num + 2, 3) 
Example #5
Source File: options.py    From wacom-gui with GNU General Public License v3.0 5 votes vote down vote up
def flipOptions(self):
        groupBox = QtGui.QGroupBox("Tablet Orientation")
        groupBox.setAlignment(QtCore.Qt.AlignHCenter)
        groupBox.setFixedHeight(120)
        self.tabletFlipGroup = QtGui.QButtonGroup(groupBox)
        self.tabletRight = QtGui.QRadioButton("Right-Handed")
        self.tabletLeft = QtGui.QRadioButton("Left-Handed")
        self.tabletFlipGroup.addButton(self.tabletRight)
        self.tabletFlipGroup.addButton(self.tabletLeft)
        flipLayout = QtGui.QVBoxLayout()
        flipLayout.addWidget(self.tabletRight)
        flipLayout.addWidget(self.tabletLeft)
        flipLayout.addStretch(1)
        getCommand = os.popen("xsetwacom --get \"%s stylus\" Rotate" % self.tabletStylus).readlines()
        # check correct button for orientation
        if getCommand[0] == "none\n":
            self.orient = "xsetwacom --set \"%s stylus\" Rotate none" % self.tabletStylus
            self.orient += "\nxsetwacom --set \"%s eraser\" Rotate none" % self.tabletEraser
            self.tabletRight.setChecked(1)
        elif getCommand[0] == "half\n":
            self.orient = "xsetwacom --set \"%s stylus\" Rotate half" % self.tabletStylus
            self.orient += "\nxsetwacom --set \"%s eraser\" Rotate half" % self.tabletEraser
            self.tabletLeft.setChecked(1)
        self.tabletFlipGroup.buttonClicked.connect(self.tabletFlipChange)
        groupBox.setLayout(flipLayout)
        return groupBox 
Example #6
Source File: MotorControlModernUi.py    From rpi-course with MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(534, 310)
        self.dial = QtGui.QDial(Dialog)
        self.dial.setGeometry(QtCore.QRect(120, -10, 311, 261))
        self.dial.setMaximum(100)
        self.dial.setObjectName(_fromUtf8("dial"))
        self.lcdNumber = QtGui.QLCDNumber(Dialog)
        self.lcdNumber.setGeometry(QtCore.QRect(10, 250, 71, 41))
        self.lcdNumber.setAutoFillBackground(False)
        self.lcdNumber.setFrameShape(QtGui.QFrame.StyledPanel)
        self.lcdNumber.setFrameShadow(QtGui.QFrame.Raised)
        self.lcdNumber.setDigitCount(3)
        self.lcdNumber.setSegmentStyle(QtGui.QLCDNumber.Filled)
        self.lcdNumber.setObjectName(_fromUtf8("lcdNumber"))
        self.progressBar = QtGui.QProgressBar(Dialog)
        self.progressBar.setGeometry(QtCore.QRect(90, 250, 441, 41))
        self.progressBar.setProperty("value", 0)
        self.progressBar.setObjectName(_fromUtf8("progressBar"))
        self.groupBox = QtGui.QGroupBox(Dialog)
        self.groupBox.setGeometry(QtCore.QRect(10, 160, 71, 80))
        self.groupBox.setObjectName(_fromUtf8("groupBox"))
        self.CWButton = QtGui.QRadioButton(self.groupBox)
        self.CWButton.setGeometry(QtCore.QRect(10, 20, 82, 17))
        self.CWButton.setChecked(True)
        self.CWButton.setObjectName(_fromUtf8("CWButton"))
        self.CCWButton = QtGui.QRadioButton(self.groupBox)
        self.CCWButton.setGeometry(QtCore.QRect(10, 40, 81, 31))
        self.CCWButton.setObjectName(_fromUtf8("CCWButton"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #7
Source File: settingDialog.py    From LabelImgTool with MIT License 5 votes vote down vote up
def createBRUoptGroup(self):
        self.brugroupBox = QtGui.QGroupBox("& Brush options")
        #self.single_label_rb = QtGui.QRadioButton("single label")
        #self.multi_label_rb = QtGui.QRadioButton("multi label")
        vbox = QtGui.QVBoxLayout()
        #vbox.addWidget(self.single_label_rb)
        #vbox.addWidget(self.multi_label_rb)
        vbox.addStretch(True)
        self.brugroupBox.setLayout(vbox)
        return self.brugroupBox 
Example #8
Source File: settingDialog.py    From LabelImgTool with MIT License 5 votes vote down vote up
def createCLSoptGroup(self):
        self.clsgroupBox = QtGui.QGroupBox("& CLS options")
        #self.single_label_rb = QtGui.QRadioButton("single label")
        #self.multi_label_rb = QtGui.QRadioButton("multi label")
        vbox = QtGui.QVBoxLayout()
        #vbox.addWidget(self.single_label_rb)
        #vbox.addWidget(self.multi_label_rb)
        vbox.addStretch(True)
        self.clsgroupBox.setLayout(vbox)
        return self.clsgroupBox 
Example #9
Source File: mainwindow.py    From nike_purchase_system with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super(NikeSetting, self).__init__()
        self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setWindowTitle("可选设置")
        self.setGeometry(250, 250, 250, 200)
        self.setFixedSize(250, 200)

        self.label_mail = QtGui.QLabel("加入购物车后发送邮件", self)
        self.label_mail.setGeometry(20, 20, 50, 20)

        self.rb_mail = QtGui.QRadioButton(self)
        self.rb_mail.setGeometry(75, 20, 15, 20)

        self.text_mail = QtGui.QLineEdit(self)
        self.text_mail.setText('859905874@qq.com')

        self.label_size = QtGui.QLabel("默认尺码", self)
        self.label_size.setGeometry(20, 45, 50, 20)
        self.text_sizes = QtGui.QLineEdit(self)
        self.text_sizes.setGeometry(75, 45, 100, 20)

        self.label_pay_in_qrcode = QtGui.QLabel('二维码付款', self)
        self.rb_pay_in_qrcode = QtGui.QRadioButton(self)

        self.button = QtGui.QPushButton('确定', self)
        self.button.setGeometry(160, 150, 80, 40) 
Example #10
Source File: production_gui.py    From CrisisMappingToolkit with Apache License 2.0 5 votes vote down vote up
def __init__(self, parent = None):
            super(ProductionGui.GuestImageDialog, self).__init__(parent)
            
            # Get the list of available sensors
            self.radioNames = miscUtilities.getDefinedSensorNames()
            if not self.radioNames:
                raise Exception('Could not load any sensors!')
            # Set up sensor selection buttons
            self.radioButtons = []
            for name in self.radioNames:
                self.radioButtons.append(QtGui.QRadioButton(name))
            self.radioButtons[0].setChecked(True)
            
            # Set up the other controls
            self.lineIn       = QtGui.QLineEdit("Asset ID")
            self.okButton     = QtGui.QPushButton('Ok',     self)
            self.cancelButton = QtGui.QPushButton('Cancel', self)            
            self.okButton.clicked.connect(self.accept)
            self.cancelButton.clicked.connect(self.reject)
            
            # Lay everything out
            vbox = QtGui.QVBoxLayout(self)
            vbox.addWidget(self.lineIn)
            for button in self.radioButtons:
               vbox.addWidget(button)
            vbox.addWidget(self.okButton)
            vbox.addWidget(self.cancelButton)
            vbox.addStretch(1) 
Example #11
Source File: modal_dialogs.py    From tutorials with MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
		super(Window, self).__init__(*args, **kwargs)
		
		self.resize(300,200)

		self.layout = QtGui.QHBoxLayout(self)

		self.modalButton = QtGui.QRadioButton("Go modal")
		self.asyncModalButton = QtGui.QRadioButton("Go async modal")
		self.nonModalButton = QtGui.QRadioButton("Go non-modal")

		self.layout.addWidget(self.modalButton)
		self.layout.addWidget(self.asyncModalButton)
		self.layout.addWidget(self.nonModalButton)

		self.buttonGroup = QtGui.QButtonGroup()
		self.buttonGroup.setExclusive(True)

		self.buttonGroup.addButton(self.modalButton)
		self.buttonGroup.addButton(self.asyncModalButton)
		self.buttonGroup.addButton(self.nonModalButton)

		# Example of a signal with multiple signatures
		# This one can either return the int id of the button, or the button
		# object itself
		self.buttonGroup.buttonClicked['QAbstractButton*'].connect(self.handle_show_dialog) 
Example #12
Source File: ui_composer_data_source.py    From stdm with GNU General Public License v2.0 4 votes vote down vote up
def setupUi(self, frmComposerDataSource):
        frmComposerDataSource.setObjectName(_fromUtf8("frmComposerDataSource"))
        frmComposerDataSource.resize(380, 130)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(frmComposerDataSource.sizePolicy().hasHeightForWidth())
        frmComposerDataSource.setSizePolicy(sizePolicy)
        frmComposerDataSource.setMaximumSize(QtCore.QSize(16777215, 130))
        self.gridLayout = QtGui.QGridLayout(frmComposerDataSource)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label = QtGui.QLabel(frmComposerDataSource)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
        self.label.setSizePolicy(sizePolicy)
        self.label.setStyleSheet(_fromUtf8("padding: 2px; font-weight: bold; background-color: rgb(200, 200, 200);"))
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 0, 0, 1, 2)
        self.label_2 = QtGui.QLabel(frmComposerDataSource)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        self.label_2.setMaximumSize(QtCore.QSize(16777215, 100))
        self.label_2.setFrameShape(QtGui.QFrame.NoFrame)
        self.label_2.setWordWrap(True)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.gridLayout.addWidget(self.label_2, 1, 0, 1, 2)
        self.cboDataSource = QtGui.QComboBox(frmComposerDataSource)
        self.cboDataSource.setMinimumSize(QtCore.QSize(0, 30))
        self.cboDataSource.setObjectName(_fromUtf8("cboDataSource"))
        self.gridLayout.addWidget(self.cboDataSource, 2, 0, 1, 2)
        self.rbTables = QtGui.QRadioButton(frmComposerDataSource)
        self.rbTables.setObjectName(_fromUtf8("rbTables"))
        self.gridLayout.addWidget(self.rbTables, 3, 0, 1, 1)
        self.rbViews = QtGui.QRadioButton(frmComposerDataSource)
        self.rbViews.setObjectName(_fromUtf8("rbViews"))
        self.gridLayout.addWidget(self.rbViews, 3, 1, 1, 1)

        self.retranslateUi(frmComposerDataSource)
        QtCore.QMetaObject.connectSlotsByName(frmComposerDataSource) 
Example #13
Source File: ui_composer_data_source.py    From stdm with GNU General Public License v2.0 4 votes vote down vote up
def setupUi(self, frmComposerDataSource):
        frmComposerDataSource.setObjectName(_fromUtf8("frmComposerDataSource"))
        frmComposerDataSource.resize(380, 168)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(frmComposerDataSource.sizePolicy().hasHeightForWidth())
        frmComposerDataSource.setSizePolicy(sizePolicy)
        frmComposerDataSource.setMaximumSize(QtCore.QSize(16777215, 170))
        self.gridLayout = QtGui.QGridLayout(frmComposerDataSource)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.label_3 = QtGui.QLabel(frmComposerDataSource)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.gridLayout.addWidget(self.label_3, 4, 0, 1, 2)
        self.label_2 = QtGui.QLabel(frmComposerDataSource)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        self.label_2.setMaximumSize(QtCore.QSize(16777215, 100))
        self.label_2.setFrameShape(QtGui.QFrame.NoFrame)
        self.label_2.setWordWrap(True)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.gridLayout.addWidget(self.label_2, 1, 0, 1, 2)
        self.label = QtGui.QLabel(frmComposerDataSource)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
        self.label.setSizePolicy(sizePolicy)
        self.label.setStyleSheet(_fromUtf8("padding: 2px; font-weight: bold; background-color: rgb(200, 200, 200);"))
        self.label.setObjectName(_fromUtf8("label"))
        self.gridLayout.addWidget(self.label, 0, 0, 1, 2)
        self.rbViews = QtGui.QRadioButton(frmComposerDataSource)
        self.rbViews.setObjectName(_fromUtf8("rbViews"))
        self.gridLayout.addWidget(self.rbViews, 3, 1, 1, 1)
        self.cboDataSource = QtGui.QComboBox(frmComposerDataSource)
        self.cboDataSource.setMinimumSize(QtCore.QSize(0, 30))
        self.cboDataSource.setObjectName(_fromUtf8("cboDataSource"))
        self.gridLayout.addWidget(self.cboDataSource, 2, 0, 1, 2)
        self.rbTables = QtGui.QRadioButton(frmComposerDataSource)
        self.rbTables.setObjectName(_fromUtf8("rbTables"))
        self.gridLayout.addWidget(self.rbTables, 3, 0, 1, 1)
        self.cboReferencedTable = QtGui.QComboBox(frmComposerDataSource)
        self.cboReferencedTable.setMinimumSize(QtCore.QSize(0, 30))
        self.cboReferencedTable.setObjectName(_fromUtf8("cboReferencedTable"))
        self.gridLayout.addWidget(self.cboReferencedTable, 5, 0, 1, 2)

        self.retranslateUi(frmComposerDataSource)
        QtCore.QMetaObject.connectSlotsByName(frmComposerDataSource) 
Example #14
Source File: find.py    From Writer-Tutorial with MIT License 4 votes vote down vote up
def initUI(self):

        # Button to search the document for something
        findButton = QtGui.QPushButton("Find",self)
        findButton.clicked.connect(self.find)

        # Button to replace the last finding
        replaceButton = QtGui.QPushButton("Replace",self)
        replaceButton.clicked.connect(self.replace)

        # Button to remove all findings
        allButton = QtGui.QPushButton("Replace all",self)
        allButton.clicked.connect(self.replaceAll)

        # Normal mode - radio button
        self.normalRadio = QtGui.QRadioButton("Normal",self)

        # Regular Expression Mode - radio button
        regexRadio = QtGui.QRadioButton("RegEx",self)

        # The field into which to type the query
        self.findField = QtGui.QTextEdit(self)
        self.findField.resize(250,50)

        # The field into which to type the text to replace the
        # queried text
        self.replaceField = QtGui.QTextEdit(self)
        self.replaceField.resize(250,50)
        
        layout = QtGui.QGridLayout()

        layout.addWidget(self.findField,1,0,1,4)
        layout.addWidget(self.normalRadio,2,2)
        layout.addWidget(regexRadio,2,3)
        layout.addWidget(findButton,2,0,1,2)
        
        layout.addWidget(self.replaceField,3,0,1,4)
        layout.addWidget(replaceButton,4,0,1,2)
        layout.addWidget(allButton,4,2,1,2)

        self.setGeometry(300,300,360,250)
        self.setWindowTitle("Find and Replace")
        self.setLayout(layout)

        # By default the normal mode is activated
        self.normalRadio.setChecked(True) 
Example #15
Source File: pressure.py    From wacom-gui with GNU General Public License v3.0 4 votes vote down vote up
def penSettings(self):
        groupBox = QtGui.QGroupBox("Mode")
        groupBox.setAlignment(QtCore.Qt.AlignCenter)
        self.penGroup = QtGui.QButtonGroup(groupBox)
        self.penAbs = QtGui.QRadioButton("Absolute")
        self.penAbs.setToolTip("%s maps 1:1 to mapped input area." % self.sensor.title())
        self.penRel = QtGui.QRadioButton("Relative")
        self.penRel.setToolTip("%s moves relative to when it is detected." % self.sensor.title())

        self.penGroup.addButton(self.penAbs)
        self.penGroup.addButton(self.penRel)
        
        penLayout = QtGui.QHBoxLayout()
        penLayout.addWidget(self.penAbs)
        penLayout.addWidget(self.penRel)
        penLayout.addStretch(1)

        #if self.sensor == 'stylus' or self.sensor == 'eraser':
        getCommand = os.popen("xsetwacom --get \"%s %s\" Mode" % (self.tabletName, self.sensor.lower())).readlines()
        #check stylus mode
        if getCommand[0] == "Absolute\n":
            self.penMode = "xsetwacom --set \"%s %s\" mode Absolute" % (self.tabletName, self.sensor.lower())
            self.penAbs.setChecked(1)
        elif getCommand[0] == "Relative\n":
            self.penMode = "xsetwacom --set \"%s %s\" mode Relative" % (self.tabletName, self.sensor.lower())
            self.penRel.setChecked(1)
        if self.sensor == 'stylus':
            #for buttons
            but1 = os.popen(("xsetwacom --get \"%s %s\" Button 2") % (self.tabletName, self.sensor.lower())).readlines()
            but2 = os.popen(("xsetwacom --get \"%s %s\" Button 3") % (self.tabletName, self.sensor.lower())).readlines()
            if but1[0].find('3') != -1 and but2[0].find('2') != -1:
                self.buttons.setChecked(True)
            #for tip touch check
            tip = os.popen("xsetwacom --get \"%s %s\" TabletPCButton" % (self.tabletName, self.sensor.lower())).readlines()
            if tip[0].find('on') != -1:
                self.tiptouch.setChecked(True)
        else:
            self.tiptouch.hide()

        self.penGroup.buttonClicked.connect(self.penChange)

        groupBox.setLayout(penLayout)

        return groupBox 
Example #16
Source File: find.py    From Writer-Tutorial with MIT License 4 votes vote down vote up
def initUI(self):

        # Button to search the document for something
        findButton = QtGui.QPushButton("Find",self)
        findButton.clicked.connect(self.find)

        # Button to replace the last finding
        replaceButton = QtGui.QPushButton("Replace",self)
        replaceButton.clicked.connect(self.replace)

        # Button to remove all findings
        allButton = QtGui.QPushButton("Replace all",self)
        allButton.clicked.connect(self.replaceAll)

        # Normal mode - radio button
        self.normalRadio = QtGui.QRadioButton("Normal",self)

        # Regular Expression Mode - radio button
        regexRadio = QtGui.QRadioButton("RegEx",self)

        # The field into which to type the query
        self.findField = QtGui.QTextEdit(self)
        self.findField.resize(250,50)

        # The field into which to type the text to replace the
        # queried text
        self.replaceField = QtGui.QTextEdit(self)
        self.replaceField.resize(250,50)
        
        layout = QtGui.QGridLayout()

        layout.addWidget(self.findField,1,0,1,4)
        layout.addWidget(self.normalRadio,2,2)
        layout.addWidget(regexRadio,2,3)
        layout.addWidget(findButton,2,0,1,2)
        
        layout.addWidget(self.replaceField,3,0,1,4)
        layout.addWidget(replaceButton,4,0,1,2)
        layout.addWidget(allButton,4,2,1,2)

        self.setGeometry(300,300,360,250)
        self.setWindowTitle("Find and Replace")
        self.setLayout(layout)

        # By default the normal mode is activated
        self.normalRadio.setChecked(True) 
Example #17
Source File: find.py    From Writer with MIT License 4 votes vote down vote up
def initUI(self):

        # Button to search the document for something
        findButton = QtGui.QPushButton("Find",self)
        findButton.clicked.connect(self.find)

        # Button to replace the last finding
        replaceButton = QtGui.QPushButton("Replace",self)
        replaceButton.clicked.connect(self.replace)

        # Button to remove all findings
        allButton = QtGui.QPushButton("Replace all",self)
        allButton.clicked.connect(self.replaceAll)

        # Normal mode - radio button
        self.normalRadio = QtGui.QRadioButton("Normal",self)

        # Regular Expression Mode - radio button
        regexRadio = QtGui.QRadioButton("RegEx",self)

        # The field into which to type the query
        self.findField = QtGui.QTextEdit(self)
        self.findField.resize(250,50)

        # The field into which to type the text to replace the
        # queried text
        self.replaceField = QtGui.QTextEdit(self)
        self.replaceField.resize(250,50)
        
        layout = QtGui.QGridLayout()

        layout.addWidget(self.findField,1,0,1,4)
        layout.addWidget(self.normalRadio,2,2)
        layout.addWidget(regexRadio,2,3)
        layout.addWidget(findButton,2,0,1,2)
        
        layout.addWidget(self.replaceField,3,0,1,4)
        layout.addWidget(replaceButton,4,0,1,2)
        layout.addWidget(allButton,4,2,1,2)

        self.setGeometry(300,300,360,250)
        self.setWindowTitle("Find and Replace")
        self.setLayout(layout)

        # By default the normal mode is activated
        self.normalRadio.setChecked(True)