我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用PyQt4.QtGui.QRadioButton()。
def refresh_classes(self,event=None): for i in reversed(range(self.class_line.count())): w = self.class_line.itemAt(i).widget() self.class_line.removeWidget(w) w.setParent(None) for i, k in enumerate(self.classes.key): if k == ' ': text = ' ' else: text = k button = QtWidgets.QRadioButton(text, self) button.clicked.connect(self.show_selected_class) if i == 0: button.setChecked(True) self.class_num.addButton(button, i) self.class_line.addWidget(button, i/5, i%5)
def refresh_class_line(self): for i in reversed(range(self.class_line.count())): w = self.class_line.itemAt(i).widget() self.class_line.removeWidget(w) w.setParent(None) self.class_num = QtWidgets.QButtonGroup() button = QtWidgets.QRadioButton('All') button.setChecked(True) self.class_num.addButton(button, 0) self.class_line.addWidget(button, 0, 0) for i, k in enumerate(self.classes.key): if k == ' ': text = ' ' else: text = k button = QtWidgets.QRadioButton(text, self) self.class_num.addButton(button, i+1) self.class_line.addWidget(button, (i+1)/5, (i+1)%5) self.class_list_summary.setText(self.classes.gen_summary())
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(800, 600) self.centralWidget = QtGui.QWidget(MainWindow) self.centralWidget.setObjectName(_fromUtf8("centralWidget")) self.pushButton = QtGui.QPushButton(self.centralWidget) self.pushButton.setGeometry(QtCore.QRect(40, 510, 75, 23)) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.textBrowser = QtGui.QTextBrowser(self.centralWidget) self.textBrowser.setGeometry(QtCore.QRect(40, 20, 571, 461)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.radioButton = QtGui.QRadioButton(self.centralWidget) self.radioButton.setGeometry(QtCore.QRect(680, 110, 89, 16)) self.radioButton.setObjectName(_fromUtf8("radioButton")) self.radioButton_2 = QtGui.QRadioButton(self.centralWidget) self.radioButton_2.setGeometry(QtCore.QRect(680, 160, 89, 16)) self.radioButton_2.setObjectName(_fromUtf8("radioButton_2")) self.label = QtGui.QLabel(self.centralWidget) self.label.setGeometry(QtCore.QRect(640, 350, 101, 101)) self.label.setObjectName(_fromUtf8("label")) MainWindow.setCentralWidget(self.centralWidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def __init__(self, parent=None): super(PlateDialog, self).__init__(parent) layout = QtGui.QVBoxLayout(self) self.info = QtGui.QLabel('Please make selection: ') self.radio1 = QtGui.QRadioButton('Export only the sequences needed for this design. (176 staples in 2 plates)') self.radio2 = QtGui.QRadioButton('Export full 2 full plates for all sequences used (176 staples * number of unique sequences)') self.setWindowTitle('Plate export') layout.addWidget(self.info) layout.addWidget(self.radio1) layout.addWidget(self.radio2) self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def add_car_label_button(self, layout, label_type): mydir = os.path.dirname(os.path.realpath(__file__)) fp = '{}/data/{}_labels_Chinese.txt'.format(mydir, label_type) label_names = self.label_seg.read_label_name(fp) label_index = range(len(label_names)) # self.label_names.append('ignore') label_names.append(u"??") label_index.append(255) # ignore_lable -- 255 logging.warn('load label names :{}'.format(label_names)) self.label_radiobtn = [] max_col = 18 # max num of radiobtn per row nrow = (len(label_names) - 1) // max_col + 1 for i, name in enumerate(label_names): raw_s = name.strip(' |\n').split(',')[0] b = QtGui.QRadioButton(unicode(raw_s)) c = label_index[i] # b.toggled.connect(lambda :self.label_changed(c)) b.toggled.connect(functools.partial(self.label_changed, c)) x = i / max_col y = i % max_col layout.addWidget(b, x, y) self.label_radiobtn.append(b)
def add_drone_label_button(self, layout, label_type): mydir = os.path.dirname(os.path.realpath(__file__)) fp = '{}/data/{}_labels_Chinese.txt'.format(mydir, label_type) label_names = self.label_seg.read_label_name(fp) label_index = range(len(label_names)) # self.label_names.append('ignore') label_names.append(u"??") label_index.append(255) logging.warn('load label names :{}'.format(label_names)) self.label_radiobtn = [] max_col = 18 nrow = (len(label_names) - 1) // max_col + 1 for i, name in enumerate(label_names): raw_s = name.strip(' |\n').split(',')[0] b = QtGui.QRadioButton(unicode(raw_s)) c = label_index[i] # b.toggled.connect(lambda :self.label_changed(c)) b.toggled.connect(functools.partial(self.label_changed, c)) x = i / max_col y = i % max_col layout.addWidget(b, x, y) # layout.addStretch(1) self.label_radiobtn.append(b)
def add_car_label_button(self, layout, label_type): mydir = os.path.dirname(os.path.realpath(__file__)) fp = '{}/data/{}_labels_Chinese.txt'.format(mydir, label_type) label_names = self.label_seg.read_label_name(fp) label_index = range(len(label_names)) # self.label_names.append('ignore') label_names.append(u"??") label_index.append(255) # ignore_lable -- 255 logging.warn('load label names :{}'.format(label_names)) self.label_radiobtn = [] max_col = 10 # max num of radiobtn per row nrow = (len(label_names) - 1) // max_col + 1 for i, name in enumerate(label_names): raw_s = name.strip(' |\n').split(',')[0] b = QtGui.QRadioButton(unicode(raw_s)) c = label_index[i] # b.toggled.connect(lambda :self.label_changed(c)) b.toggled.connect(functools.partial(self.label_changed, c)) x = i / max_col y = i % max_col layout.addWidget(b, x, y) self.label_radiobtn.append(b)
def add_drone_label_button(self, layout, label_type): mydir = os.path.dirname(os.path.realpath(__file__)) fp = '{}/data/{}_labels_Chinese.txt'.format(mydir, label_type) label_names = self.label_seg.read_label_name(fp) label_index = range(len(label_names)) # self.label_names.append('ignore') label_names.append(u"??") label_index.append(255) logging.warn('load label names :{}'.format(label_names)) self.label_radiobtn = [] max_col = 10 nrow = (len(label_names) - 1) // max_col + 1 for i, name in enumerate(label_names): raw_s = name.strip(' |\n').split(',')[0] b = QtGui.QRadioButton(unicode(raw_s)) c = label_index[i] # b.toggled.connect(lambda :self.label_changed(c)) b.toggled.connect(functools.partial(self.label_changed, c)) x = i / max_col y = i % max_col layout.addWidget(b, x, y) # layout.addStretch(1) self.label_radiobtn.append(b)
def eventFilter(self, object, event): if not self.submitType and not self.PH5View.helpEnable: return False if self.submitType and not self.helpEnable: return False if event.type() == QtCore.QEvent.Enter: if object not in self.EXPL.keys(): return False #print object P = object.pos() #print P if object.__class__.__name__ == 'QRadioButton' \ or (not self.submitType and object.__class__.__name__ == 'QCheckBox'): QtGui.QToolTip.showText(self.scrollPanel.mapToGlobal(QtCore.QPoint(P.x(), P.y()+20)), self.EXPL[object]) else: QtGui.QToolTip.showText(self.mapToGlobal(QtCore.QPoint(P.x(), P.y()+20)), self.EXPL[object]) return True return False
def setupUi(self): self.setVisible(False) self._singleButton = QtGui.QRadioButton(self) self._singleButton.setText("Single") self._singleButton.setChecked(True) self._layout.addWidget(self._singleButton, 0, 0) self._multipleButton = QtGui.QRadioButton(self) self._multipleButton.setText("Multiple") self._layout.addWidget(self._multipleButton, 0, 1) self._singleAxisWidget = SingleAxisWidget() self._layout.addWidget(self._singleAxisWidget, 1, 0, 1, 2) self._multipleAxisWidget = MultipleAxisWidget() self._layout.addWidget(self._multipleAxisWidget, 2, 0, 1, 2) QtCore.QObject.connect(self._singleButton, QtCore.SIGNAL( "clicked()"), self._changeView) QtCore.QObject.connect(self._multipleButton, QtCore.SIGNAL("clicked()"), self._changeView) self._spacerItem1 = Qt.QSpacerItem( 10, 0, Qt.QSizePolicy.Fixed, Qt.QSizePolicy.Expanding) self._layout.addItem(self._spacerItem1, 4, 0, 1, 1, Qt.Qt.AlignCenter)
def setupUi(self, Dialog): Dialog.resize(316, 238) Dialog.setWindowTitle("Select Resolution") self.verticalLayout = QtGui.QVBoxLayout(Dialog) self.frame = QtGui.QFrame(Dialog) self.frame.setFrameShape(QtGui.QFrame.StyledPanel) self.frame.setFrameShadow(QtGui.QFrame.Raised) self.verticalLayout_2 = QtGui.QVBoxLayout(self.frame) self.buttonGroup = QtGui.QButtonGroup(self.frame) if len(self.videos)>3: checked_btn = 2 else: checked_btn = len(self.videos)-1 for i, video in enumerate(self.videos): radioButton = QtGui.QRadioButton(self.frame) radioButton.setText(video.resolution + " (" + video.extension + ')') self.buttonGroup.addButton(radioButton) self.verticalLayout_2.addWidget(radioButton) if i==checked_btn : radioButton.setChecked(True) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.verticalLayout.addWidget(self.frame) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
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)
def add_roi_radiobutton(self, num): button = QtWidgets.QRadioButton(str(num)) if num == 0: button.setChecked(True) self.current_roi.addButton(button, num) self.roi_choice.addWidget(button, num/5, num%5)
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(455, 393) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.textBrowser = QtGui.QTextBrowser(self.centralwidget) self.textBrowser.setGeometry(QtCore.QRect(20, 20, 291, 261)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.pushButton = QtGui.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(60, 310, 75, 23)) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.pushButton_2 = QtGui.QPushButton(self.centralwidget) self.pushButton_2.setGeometry(QtCore.QRect(210, 310, 75, 23)) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.groupBox = QtGui.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(330, 20, 120, 80)) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.radioButton = QtGui.QRadioButton(self.groupBox) self.radioButton.setGeometry(QtCore.QRect(10, 20, 89, 16)) self.radioButton.setObjectName(_fromUtf8("radioButton")) self.radioButton_2 = QtGui.QRadioButton(self.groupBox) self.radioButton_2.setGeometry(QtCore.QRect(10, 50, 89, 16)) self.radioButton_2.setObjectName(_fromUtf8("radioButton_2")) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 455, 23)) self.menubar.setObjectName(_fromUtf8("menubar")) MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.textBrowser.forward) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(400, 300) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setGeometry(QtCore.QRect(30, 240, 341, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(190, 110, 98, 27)) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.checkBox = QtGui.QCheckBox(Dialog) self.checkBox.setGeometry(QtCore.QRect(190, 200, 97, 22)) self.checkBox.setObjectName(_fromUtf8("checkBox")) self.radioButton = QtGui.QRadioButton(Dialog) self.radioButton.setGeometry(QtCore.QRect(30, 90, 116, 22)) self.radioButton.setObjectName(_fromUtf8("radioButton")) self.commandLinkButton = QtGui.QCommandLinkButton(Dialog) self.commandLinkButton.setGeometry(QtCore.QRect(10, 20, 185, 41)) self.commandLinkButton.setObjectName(_fromUtf8("commandLinkButton")) self.listView = QtGui.QListView(Dialog) self.listView.setGeometry(QtCore.QRect(40, 120, 91, 71)) self.listView.setObjectName(_fromUtf8("listView")) self.listWidget = QtGui.QListWidget(Dialog) self.listWidget.setGeometry(QtCore.QRect(30, 220, 111, 81)) self.listWidget.setObjectName(_fromUtf8("listWidget")) self.pushButton_2 = QtGui.QPushButton(Dialog) self.pushButton_2.setGeometry(QtCore.QRect(190, 60, 98, 27)) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.retranslateUi(Dialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
def add_line_setting(self, layout): ## Only 1 line_type -- virtualLine # button for deleting lines btn = QtGui.QPushButton('Delete selected line', self) # connect to delete selected type of line (name) handler btn.clicked.connect(self.handle_delete_selected_line_button) layout.addWidget(btn) # add btn on layout # def add_line_setting(self, layout): # # ... Use QtGui.QRadioButton(unicode(raw_s)) to select a line_type # #self.line_type_ratiobtn = [] # #line_type_index = range(len(self.line_type)) # print "cur_line_type: ", self.label_seg.cur_line_type # for i, name in enumerate(self.label_seg.line_types.keys()): # # if name == "polygonPlus" or name == "polygonMinus" or name == "polygonOtsu" or name == "default": # if name[:3] == "fnc": # continue # b = QtGui.QRadioButton( # unicode( # name + # " " + # self.label_seg.line_types[name]["chinese"])) # if (i == 0): # b.setChecked(True) # b.toggled.connect(functools.partial(self.line_type_changed, name)) # layout.addWidget(b) # add the RadioButton on layout in 1 col # self.radiobtn_dict[name] = b # # self.line_type_ratiobtn.append(b) # # button for deleting lines # btn = QtGui.QPushButton('Delete selected line', self) # # connect to delete selected type of line (name) handler # btn.clicked.connect(self.handle_delete_selected_line_button) # layout.addWidget(btn) # add btn on layout
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self._formLayout = QtGui.QHBoxLayout(self) self.trueButton = QtGui.QRadioButton(self) self._formLayout.addWidget(self.trueButton) self.falseButton = QtGui.QRadioButton(self) self._formLayout.addWidget(self.falseButton) self.trueButton.setText("True") self.falseButton.setText("False") QtCore.QObject.connect(self.trueButton, QtCore.SIGNAL( "clicked()"), self.valueChanged) QtCore.QObject.connect(self.falseButton, QtCore.SIGNAL( "clicked()"), self.valueChanged) self.setValue(self.getDefaultValue(), undo=False)
def setupUi(self, HexDialogInsert): HexDialogInsert.setObjectName("HexDialogInsert") HexDialogInsert.resize(404, 146) self.verticalLayout = QtGui.QVBoxLayout(HexDialogInsert) self.verticalLayout.setObjectName("verticalLayout") self.widget = QtGui.QWidget(HexDialogInsert) self.widget.setObjectName("widget") self.horizontalLayout = QtGui.QHBoxLayout(self.widget) self.horizontalLayout.setObjectName("horizontalLayout") self.radioHex = QtGui.QRadioButton(self.widget) self.radioHex.setObjectName("radioHex") self.horizontalLayout.addWidget(self.radioHex) self.lblhex = QtGui.QLabel(self.widget) self.lblhex.setObjectName("lblhex") self.horizontalLayout.addWidget(self.lblhex) self.lineHex = QtGui.QLineEdit(self.widget) self.lineHex.setObjectName("lineHex") self.horizontalLayout.addWidget(self.lineHex) self.verticalLayout.addWidget(self.widget) self.widget_2 = QtGui.QWidget(HexDialogInsert) self.widget_2.setObjectName("widget_2") self.horizontalLayout_2 = QtGui.QHBoxLayout(self.widget_2) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.radioText = QtGui.QRadioButton(self.widget_2) self.radioText.setChecked(True) self.radioText.setObjectName("radioText") self.horizontalLayout_2.addWidget(self.radioText) self.lbltxt = QtGui.QLabel(self.widget_2) self.lbltxt.setObjectName("lbltxt") self.horizontalLayout_2.addWidget(self.lbltxt) self.lineText = QtGui.QLineEdit(self.widget_2) self.lineText.setObjectName("lineText") self.horizontalLayout_2.addWidget(self.lineText) self.verticalLayout.addWidget(self.widget_2) self.buttonBox = QtGui.QDialogButtonBox(HexDialogInsert) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(HexDialogInsert) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), HexDialogInsert.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), HexDialogInsert.reject) QtCore.QMetaObject.connectSlotsByName(HexDialogInsert)
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(430, 326) self.verticalLayout_5 = QtGui.QVBoxLayout(Dialog) self.verticalLayout_5.setObjectName("verticalLayout_5") self.textBrowser = QtGui.QTextBrowser(Dialog) self.textBrowser.setObjectName("textBrowser") self.verticalLayout_5.addWidget(self.textBrowser) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.groupBox = QtGui.QGroupBox(Dialog) self.groupBox.setObjectName("groupBox") self.verticalLayout = QtGui.QVBoxLayout(self.groupBox) self.verticalLayout.setObjectName("verticalLayout") self.radioButton = QtGui.QRadioButton(self.groupBox) self.radioButton.setObjectName("radioButton") self.verticalLayout.addWidget(self.radioButton) self.radioButton_4 = QtGui.QRadioButton(self.groupBox) self.radioButton_4.setObjectName("radioButton_4") self.verticalLayout.addWidget(self.radioButton_4) self.radioButton_3 = QtGui.QRadioButton(self.groupBox) self.radioButton_3.setObjectName("radioButton_3") self.verticalLayout.addWidget(self.radioButton_3) self.radioButton_2 = QtGui.QRadioButton(self.groupBox) self.radioButton_2.setChecked(True) self.radioButton_2.setObjectName("radioButton_2") self.verticalLayout.addWidget(self.radioButton_2) self.horizontalLayout.addWidget(self.groupBox) self.groupBox_2 = QtGui.QGroupBox(Dialog) self.groupBox_2.setObjectName("groupBox_2") self.verticalLayout_3 = QtGui.QVBoxLayout(self.groupBox_2) self.verticalLayout_3.setObjectName("verticalLayout_3") self.radioButton_9 = QtGui.QRadioButton(self.groupBox_2) self.radioButton_9.setObjectName("radioButton_9") self.verticalLayout_3.addWidget(self.radioButton_9) self.radioButton_10 = QtGui.QRadioButton(self.groupBox_2) self.radioButton_10.setObjectName("radioButton_10") self.verticalLayout_3.addWidget(self.radioButton_10) self.radioButton_11 = QtGui.QRadioButton(self.groupBox_2) self.radioButton_11.setObjectName("radioButton_11") self.verticalLayout_3.addWidget(self.radioButton_11) self.radioButton_12 = QtGui.QRadioButton(self.groupBox_2) self.radioButton_12.setChecked(True) self.radioButton_12.setObjectName("radioButton_12") self.verticalLayout_3.addWidget(self.radioButton_12) self.horizontalLayout.addWidget(self.groupBox_2) self.verticalLayout_5.addLayout(self.horizontalLayout) self.buttonBox = QtGui.QDialogButtonBox(Dialog) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayout_5.addWidget(self.buttonBox) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) Form.resize(898,700) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.baidu=QtGui.QRadioButton(Form) self.baidu.setObjectName(_fromUtf8("baidu")) self.qihu=QtGui.QRadioButton(Form) self.qihu.setObjectName(_fromUtf8("qihu")) self.sousou=QtGui.QRadioButton(Form) self.sousou.setObjectName(_fromUtf8("sousou")) self.shenma=QtGui.QRadioButton(Form) self.shenma.setObjectName(_fromUtf8("shenma")) self.isMobile=QtGui.QCheckBox(_fromUtf8("mobile")) self.isMobile.setObjectName(_fromUtf8("mobile")) self.l_se=QtGui.QLabel(Form) self.l_se.setObjectName(_fromUtf8("label_0")) self.gridLayout.addWidget(self.l_se,0,0,1,1) self.gridLayout.addWidget(self.baidu, 0, 1, 1, 1) self.gridLayout.addWidget(self.qihu, 0, 2, 1, 1) self.gridLayout.addWidget(self.sousou, 0, 3, 1, 1) self.gridLayout.addWidget(self.shenma, 0, 4, 1, 1) self.gridLayout.addWidget(self.isMobile,0,6,1,1) self.textEdit_2 = QtGui.QTextEdit(Form) self.textEdit_2.setObjectName(_fromUtf8("textEdit_2")) self.gridLayout.addWidget(self.textEdit_2, 2, 3, 1, 3) self.textEdit = QtGui.QTextEdit(Form) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.gridLayout.addWidget(self.textEdit, 2, 0, 1, 3) self.tableView = QtGui.QTableWidget(Form) self.tableView.setObjectName(_fromUtf8("tableView")) self.tableView.setColumnCount(3) self.tableView.setColumnWidth(0,150) self.tableView.setHorizontalHeaderLabels([u"???",u"??",u"??"]) self.gridLayout.addWidget(self.tableView, 2, 6, 1, 1) self.label_3 = QtGui.QLabel(Form) self.label_3.setObjectName(_fromUtf8("label_3")) self.gridLayout.addWidget(self.label_3, 1, 6, 1, 1) self.label = QtGui.QLabel(Form) self.label.setObjectName(_fromUtf8("label")) self.gridLayout.addWidget(self.label, 1, 3, 1, 2) self.label_2 = QtGui.QLabel(Form) self.label_2.setObjectName(_fromUtf8("label_2")) self.gridLayout.addWidget(self.label_2, 1, 0, 1, 2) self.pushButton = QtGui.QPushButton(Form) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.gridLayout.addWidget(self.pushButton, 3, 2, 1, 1) self.pushButton_2 = QtGui.QPushButton(Form) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.gridLayout.addWidget(self.pushButton_2, 3, 3, 1, 1) self.pushButton_3 = QtGui.QPushButton(Form) self.pushButton_3.setObjectName(_fromUtf8("pushButton_3")) self.gridLayout.addWidget(self.pushButton_3, 3, 6, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(461, 141) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Dialog.sizePolicy().hasHeightForWidth()) Dialog.setSizePolicy(sizePolicy) self.verticalLayout_3 = QtGui.QVBoxLayout(Dialog) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.chkEnabled = QtGui.QCheckBox(Dialog) self.chkEnabled.setChecked(True) self.chkEnabled.setObjectName(_fromUtf8("chkEnabled")) self.horizontalLayout.addWidget(self.chkEnabled) self.optReplace = QtGui.QRadioButton(Dialog) self.optReplace.setChecked(True) self.optReplace.setObjectName(_fromUtf8("optReplace")) self.horizontalLayout.addWidget(self.optReplace) self.optIgnore = QtGui.QRadioButton(Dialog) self.optIgnore.setObjectName(_fromUtf8("optIgnore")) self.horizontalLayout.addWidget(self.optIgnore) self.verticalLayout_3.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.label = QtGui.QLabel(Dialog) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label) self.label_2 = QtGui.QLabel(Dialog) self.label_2.setObjectName(_fromUtf8("label_2")) self.verticalLayout.addWidget(self.label_2) self.horizontalLayout_2.addLayout(self.verticalLayout) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.txtMatch = QtGui.QLineEdit(Dialog) self.txtMatch.setObjectName(_fromUtf8("txtMatch")) self.verticalLayout_2.addWidget(self.txtMatch) self.txtReplace = QtGui.QLineEdit(Dialog) self.txtReplace.setObjectName(_fromUtf8("txtReplace")) self.verticalLayout_2.addWidget(self.txtReplace) self.horizontalLayout_2.addLayout(self.verticalLayout_2) self.verticalLayout_3.addLayout(self.horizontalLayout_2) self.btnBox = QtGui.QDialogButtonBox(Dialog) self.btnBox.setOrientation(QtCore.Qt.Horizontal) self.btnBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.btnBox.setObjectName(_fromUtf8("btnBox")) self.verticalLayout_3.addWidget(self.btnBox) self.retranslateUi(Dialog) QtCore.QObject.connect(self.btnBox, QtCore.SIGNAL(_fromUtf8("accepted()")), Dialog.accept) QtCore.QObject.connect(self.btnBox, QtCore.SIGNAL(_fromUtf8("rejected()")), Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog)
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)
def setStations(self): if self.submitType: allChk = QtGui.QCheckBox('') allChk.setChecked(True) self.ESGrid.addWidget(allChk,0,0) allChk.installEventFilter(self) self.EXPL[allChk] = "Click to select/deselect ALL stations" allChk.clicked.connect(self.onSelectAllStations) else: stationGroup = QtGui.QButtonGroup(self) self.ESGrid.addWidget(QtGui.QLabel('staId'),0,1) self.ESGrid.addWidget(QtGui.QLabel('DAS'),0,2) self.ESGrid.addWidget(QtGui.QLabel('Latitude'),0,3) self.ESGrid.addWidget(QtGui.QLabel('Longitude'),0,4) self.ESGrid.addWidget(QtGui.QLabel('Elevation(m)'),0,5) self.stationChks = [] lineSeq = 1 for sId in self.array['orderedStationIds']: s = self.array['stations'][sId] if not self.submitType: # receiver gather: user click on a station to open events' form s['stationRbtn'] = QtGui.QRadioButton(self.ESPane) s['stationRbtn'].installEventFilter(self) self.EXPL[s['stationRbtn']] = "Click this station to select/deselect" s['stationRbtn'].clicked.connect(self.onSelectStation) self.ESGrid.addWidget(s['stationRbtn'], lineSeq, 0) stationGroup.addButton(s['stationRbtn']) else: # shot gather. This form was opened when user select an event. User can select multi stations befor submitting s['stationChk'] = QtGui.QCheckBox('', self.ESPane) self.stationChks.append(s['stationChk']) s['stationChk'].setChecked(True) s['stationChk'].clicked.connect(self.onSelectStationRange) s['stationChk'].installEventFilter(self) self.EXPL[s['stationChk']] = "Click to select this station" self.ESGrid.addWidget(s['stationChk'], lineSeq, 0) self.addLabel(self.ESGrid, str(s['stationId']), lineSeq, 1) self.addLabel(self.ESGrid, str(s['dasSer']), lineSeq, 2) self.addLabel(self.ESGrid, str(s['lat.']), lineSeq, 3) self.addLabel(self.ESGrid, str(s['long.']), lineSeq, 4) self.addLabel(self.ESGrid, str(s['elev.']), lineSeq, 5) lineSeq += 1 self.selectedStationChks = list(range(len(self.stationChks))) ################################### # Author: Lan # def: addLabel():2015 # set info labels with background white