當前位置: 首頁>>代碼示例>>Python>>正文


Python QLineEdit.setGeometry方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setGeometry方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setGeometry方法的具體用法?Python QLineEdit.setGeometry怎麽用?Python QLineEdit.setGeometry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QLineEdit的用法示例。


在下文中一共展示了QLineEdit.setGeometry方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Header

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class Header(QHeaderView):

    def __init__(self, orientation=Qt.Horizontal, parent=None):
        super(Header, self).__init__(orientation, parent)
        self.editable = True
        self.setSectionsClickable(True)
        self.setSectionResizeMode(QHeaderView.ResizeToContents)
        self.line = QLineEdit(parent=self.viewport())
        self.line.setAlignment(Qt.AlignTop)
        self.line.setHidden(True)
        self.line.blockSignals(True)
        self.col = 0

        # Connections
        self.sectionDoubleClicked[int].connect(self.__edit)
        self.line.editingFinished.connect(self.__done_editing)

    def __edit(self, index):
        if not self.editable:
            return
        geo = self.line.geometry()
        geo.setWidth(self.sectionSize(index))
        geo.moveLeft(self.sectionViewportPosition(index))
        current_text = self.model().headerData(index, Qt.Horizontal,
                                               Qt.DisplayRole)
        self.line.setGeometry(geo)
        self.line.setHidden(False)
        self.line.blockSignals(False)
        self.line.setText(str(current_text))
        self.line.setFocus()
        self.line.selectAll()
        self.col = index

    def __done_editing(self):
        text = self.line.text()
        if not text.strip():
            # No debe ser vacío
            QMessageBox.critical(self, "Error",
                                 self.tr("El campo no debe ser vacío"))
            self.line.hide()
            return
        self.line.blockSignals(True)
        self.line.setHidden(False)
        self.model().setHeaderData(self.col, Qt.Horizontal, text,
                                   Qt.DisplayRole)
        self.line.setText("")
        self.line.hide()
        self.setCurrentIndex(QModelIndex())
開發者ID:yoshitomimaehara,項目名稱:pireal,代碼行數:50,代碼來源:view.py

示例2: Header

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class Header(QHeaderView):

    def __init__(self, orientation=Qt.Horizontal, parent=None):
        super(Header, self).__init__(orientation, parent)
        self.setSectionsClickable(True)
        self.setSectionResizeMode(QHeaderView.ResizeToContents)
        self.line = QLineEdit(parent=self.viewport())
        self.line.setAlignment(Qt.AlignTop)
        self.line.setHidden(True)
        self.line.blockSignals(True)
        self.col = 0

        # Connections
        self.sectionDoubleClicked[int].connect(self.__edit)
        self.line.editingFinished.connect(self.__done_editing)

    def __edit(self, index):
        geo = self.line.geometry()
        geo.setWidth(self.sectionSize(index))
        geo.moveLeft(self.sectionViewportPosition(index))
        current_text = self.model().headerData(index, Qt.Horizontal)
        self.line.setGeometry(geo)
        self.line.setHidden(False)
        self.line.blockSignals(False)
        self.line.setText(str(current_text))
        self.line.setFocus()
        self.line.selectAll()
        self.col = index

    def __done_editing(self):
        self.line.blockSignals(True)
        self.line.setHidden(False)
        text = self.line.text()
        self.model().setHeaderData(self.col, Qt.Horizontal, text)
        self.line.setText("")
        self.line.hide()
        self.setCurrentIndex(QModelIndex())
開發者ID:centaurialpha,項目名稱:pireal,代碼行數:39,代碼來源:custom_table.py

示例3: inputPad

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class inputPad(QWidget):
	def __init__(self, window, posX = 50, posY = 50, width = 250, height = 125, title = 'input:'):
		super().__init__(window)
		self.setGeometry(posX, posY, width, height)
		
		#Set the background color
		pal = self.palette()
		pal.setColor(self.backgroundRole(), Qt.black)
		self.setPalette(pal)
		self.setAutoFillBackground(True)
		
		#Create a QLabel
		self.titleLabel = QLabel(self)
		self.titleLabel.setText(title)
		self.titleLabel.setStyleSheet('font-size: 20pt; font-family: Courier; color: red;')
		
		#Create a QLineEdit
		self.inputLine = QLineEdit(self)
		self.inputLine.setGeometry(10, 50, 100, 50)
		self.inputLine.setStyleSheet('font-size: 20pt; font-family: Courier;')
		
		#Create a QPushButton
		self.inputBtn = QPushButton('Set', self)
		self.inputBtn.setGeometry(130, 50, 100, 50)
開發者ID:AndersonPeng,項目名稱:scoreGen,代碼行數:26,代碼來源:inputPad.py

示例4: DialogConnectToDataBase

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class DialogConnectToDataBase(QDialog):
    """
    Dialog for connecting to MySQL Database
    """
    # Signals
    if platform.system() == 'Darwin':
        onDbConnected = pyqtSignal(str, MySqlAccess)
    onDbConnectedFailed = pyqtSignal(str)

    def __init__(self):
        super().__init__()
        self.__init_consts()
        self._init_ui()
        self.__set_default_values()

    def __init_consts(self):
        self.__LBL_USER_NAME = QLabel('UserName: ')
        self.__LBL_PASSWORD = QLabel('Password: ')
        self.__DIALOG_GEOMETRY = QRect(300, 300, 300, 120)
        self.__LBL_IP = QLabel('IP: ')
        self.__LBL_PORT = QLabel('Port: ')
        self.__TITLE = 'Connect to Database'
        self.__CONNECT = 'Connect'
        self.__CANCEL = 'Cancel'
        self.__ERR_MSG_INVALID_IP = 'Invalid IP Address: '
        self.__ERR_MSG_INVALID_PORT = 'Invalid Port: '
        self.__ERR_MSG_INVALID_USER = 'User name must not be empty'
        self.__ERR_MSG_INVALID_PASSWD = 'Password must not be empty'
        self.__DEFAULT_IP = 'localhost'
        self.__DEFAULT_PORT = '8889'
        self.__DEFAULT_USER = 'test'
        self.__DEFAULT_PASSWD = 'test123'
        self.__DELIMITER = ':'

    def _init_ui(self):
        vbox = QVBoxLayout()
        vbox.setSpacing(5)
        vbox.addLayout(self.__init_address_layout())
        vbox.addLayout(self.__init_user_name_layout())
        vbox.addLayout(self.__init_password_layout())
        vbox.addLayout(self.__init_button_layout())
        self.setLayout(vbox)
        self.setWindowTitle(self.__TITLE)
        self.setModal(True)

    def __init_address_layout(self) -> QHBoxLayout:
        hbox_addr = QHBoxLayout()
        hbox_addr
        self._leIpAddr = QLineEdit(self)
        self._lePort = QLineEdit(self)
        hbox_addr.addWidget(self.__LBL_IP)
        hbox_addr.addWidget(self._leIpAddr)
        hbox_addr.addWidget(self.__LBL_PORT)
        hbox_addr.addWidget(self._lePort)
        return hbox_addr

    def __init_user_name_layout(self) -> QHBoxLayout:
        hbox_user_name = QHBoxLayout()
        self._leUserName = QLineEdit(self)
        hbox_user_name.addWidget(self.__LBL_USER_NAME)
        hbox_user_name.addWidget(self._leUserName)
        return hbox_user_name

    def __init_password_layout(self) -> QHBoxLayout:
        hbox_passwd = QHBoxLayout()
        self._lePasswd = QLineEdit(self)
        self._lePasswd.setEchoMode(QLineEdit.Password)
        self._lePasswd.setGeometry(self._leUserName.geometry())
        self._lePasswd.move(self._lePasswd.geometry().top(),
                            self._leUserName.geometry().left())
        hbox_passwd.addWidget(self.__LBL_PASSWORD)
        hbox_passwd.addWidget(self._lePasswd)
        return hbox_passwd

    def __init_button_layout(self) -> QHBoxLayout:
        hbox_btns = QHBoxLayout()
        self._okButton = QPushButton(self.__CONNECT)
        self._okButton.clicked.connect(self.connect_to_db)
        self._cancelButton = QPushButton(self.__CANCEL)
        self._cancelButton.clicked.connect(self.close)
        hbox_btns.addWidget(self._okButton)
        hbox_btns.addWidget(self._cancelButton)
        return hbox_btns

    def __set_default_values(self):
        self._leIpAddr.setText(self.__DEFAULT_IP)
        self._lePort.setText(self.__DEFAULT_PORT)
        self._leUserName.setText(self.__DEFAULT_USER)
        self._lePasswd.setText(self.__DEFAULT_PASSWD)

    @pyqtSlot()
    def connect_to_db(self):
        if not self.__validate_input():
            return
        if platform.system() == 'Darwin':
            db_access = MySqlAccess(self._leIpAddr.text(), int(self._lePort.text()))
            if not db_access.connect(self._leUserName.text(), self._lePasswd.text()):
                self.onDbConnectedFailed.emit(self._leIpAddr.text() +
                                              self.__DELIMITER +
                                              self._lePort.text())
#.........這裏部分代碼省略.........
開發者ID:raof01,項目名稱:utilities,代碼行數:103,代碼來源:DialogConnectToDatabase.py

示例5: AddWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class AddWindow(QWidget):
	okSig=pyqtSignal()
	def __init__(self):
		QWidget.__init__(self)
		self.resize(480,350)
		self.nameText=QLineEdit(self)
		self.nameText.setGeometry(110,30,240,30)
		self.commandText=QLineEdit(self)
		self.commandText.setGeometry(110,90,240,30)
		self.iconText=QLineEdit(self)
		self.iconText.setGeometry(110,150,240,30)
		self.iconText.setReadOnly(True)
		self.keyText=QLineEdit(self)
		self.keyText.setGeometry(180,200,120,30)
		is_edit=False
		self.nameLabel=QLabel(self)
		self.nameLabel.setText("name:")
		self.nameLabel.setGeometry(30,40,65,20)
		self.commandLabel=QLabel(self)
		self.commandLabel.setText("command:")
		self.commandLabel.setGeometry(30,90,65,20)
		self.pathLabel=QLabel(self)
		self.pathLabel.setText("icon path:")
		self.pathLabel.setGeometry(30,150,65,20)
		self.keyLabel=QLabel(self)
		self.keyLabel.setText("hot key:     super+")
		self.keyLabel.setGeometry(30,200,160,20)
		self.okButton=QPushButton(self)
		self.okButton.setText("ok")
		self.okButton.clicked.connect(self.on_ok_clicked)
		self.okButton.setGeometry(50,280,100,30)
		self.cancelButton=QPushButton(self)
		self.cancelButton.setText("cancel")
		self.cancelButton.setGeometry(310,280,100,30)
		self.cancelButton.clicked.connect(self.on_cancel_clicked)
		self.selectButton=QPushButton(self)
		self.selectButton.setText("select icon")
		self.selectButton.setGeometry(360,150,100,30)
		self.selectButton.clicked.connect(self.on_select_clicked)
	def on_ok_clicked(self):
		key=self.keyText.text()
		if(len(key)==1 and (key.islower() or key.isupper() or key.isdigit())):
			name=self.nameText.text()
			command=self.commandText.text()
			path=self.iconText.text()
			if(len(name)<1 or len(command)<1 or len(path)<1):	
				msgBox=QMessageBox()
				msgBox.setText("name command and icon cannot be nul")
				msgBox.exec_()
			else:
				readFile=open("conf","r")
				objs=cPickle.load(readFile)
				readFile.close()
				order=len(objs)+1
				obj=d_struct(order,name,path,command,key)
				objs.append(obj)
				writeFile=open("conf","w")
				cPickle.dump(objs,writeFile)
				writeFile.close()
				self.okSig.emit()
				self.close()
		else:
			msgBox=QMessageBox()
			msgBox.setText("the length of hot key must be 1 and value must be 0-9 or a-z")
			msgBox.exec_()
	def on_cancel_clicked(self):
		self.close()
	def on_select_clicked(self):
		filepath=QFileDialog.getOpenFileName(self,"Open Image", "./png", "Image Files (*.png *.jpg *.bmp)")
		self.iconText.setText(filepath[0])
開發者ID:ganger,項目名稱:linux_quick_launch_tool,代碼行數:72,代碼來源:addWindow.py

示例6: QChatWidget

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]

#.........這裏部分代碼省略.........
        self.typing_timer.stop()

        text = str(self.chat_input.toPlainText())[:-1]

        # Don't send empty messages
        if text == '':
            return

        # Convert URLs into clickable links
        text = self.__linkify(text)

        # Add the message to the message queue to be sent
        self.chat_window.client.getSession(self.remote_id).sendChatMessage(text)

        # Clear the chat input
        self.wasCleared = True
        self.chat_input.clear()

        self.appendMessage(text, MSG_SENDER)

    def sendTypingStatus(self, status):
        self.chat_window.client.getSession(self.remote_id).sendTypingMessage(status)

    def showNowChattingMessage(self, nick):
        self.nick = nick
        self.remote_id = self.chat_window.client.getClientId(self.nick)
        self.appendMessage("You are now securely chatting with " + self.nick + " :)",
                           MSG_SERVICE, show_timestamp_and_nick=False)

        self.appendMessage("It's a good idea to verify the communcation is secure by selecting "
                           "\"authenticate buddy\" in the options menu.", MSG_SERVICE, show_timestamp_and_nick=False)

        self.addNickButton = QPushButton('Add', self)
        self.addNickButton.setGeometry(584, 8, 31, 23)
        self.addNickButton.clicked.connect(self.addNickScreen)
        self.addNickButton.show()

    def addUser(self, user):
        nick = str(user.text()).lower()

        # Validate the given nick
        nickStatus = utils.isValidNick(nick)
        if nickStatus == errors.VALID_NICK:
            # TODO: Group chats
            pass
        elif nickStatus == errors.INVALID_NICK_CONTENT:
            QMessageBox.warning(self, errors.TITLE_INVALID_NICK, errors.INVALID_NICK_CONTENT)
        elif nickStatus == errors.INVALID_NICK_LENGTH:
            QMessageBox.warning(self, errors.TITLE_INVALID_NICK, errors.INVALID_NICK_LENGTH)
        elif nickStatus == errors.INVALID_EMPTY_NICK:
            QMessageBox.warning(self, errors.TITLE_EMPTY_NICK, errors.EMPTY_NICK)

    def addNickScreen(self):
        self.chat_log.setEnabled(False)
        self.chat_input.setEnabled(False)
        self.send_button.setEnabled(False)
        self.addNickButton.hide()
        self.addUserText = QLabel("Enter a username to add a user to the group chat.", self)
        self.addUserText.setGeometry(200, 20, 300, 100)
        self.addUserText.show()
        self.user = QLineEdit(self)
        self.user.setGeometry(200, 120, 240, 20)
        self.user.returnPressed.connect(self.addUser)
        self.user.show()
        self.addUserButton = QPushButton('Add User', self)
        self.addUserButton.setGeometry(250, 150, 150, 25)
開發者ID:HingeChat,項目名稱:HingeChat,代碼行數:70,代碼來源:qChatWidget.py

示例7: Dimili

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class Dimili(QMainWindow):

    def baslat(self, anaPencere):
        anaPencere.resize(600, 400)
        anaPencere.setWindowTitle("Dimili-Türkçe Sözlük")
        anaPencere.setFixedSize(600,400)

        icon =QIcon()
        icon.addPixmap(QPixmap("Dictionary.png"),QIcon.Normal,QIcon.Off)
        anaPencere.setWindowIcon(icon)
        zemin=QWidget(anaPencere)
        zemin.setGeometry(QRect(0,30,600,390))
        zemin.setStyleSheet("background-color:rgb(167, 196, 233);")
        self.araKutu = QLineEdit(anaPencere)
        self.araKutu.setGeometry(QRect(10, 80, 200, 20))

        self.araKutu.textChanged.connect(self.benzerKelimeler)


        self.kelimeGir = QLabel("Kelimeler:",anaPencere)
        self.kelimeGir.setGeometry(QRect(10, 110, 141, 21))

        self.kelimeGor = QLabel("Kelime Ara",anaPencere)
        self.kelimeGor.setGeometry(QRect(10, 30, 91, 16))
        self.harfGrup=QButtonGroup(anaPencere)
        aharf=QPushButton("â",anaPencere)
        aharf.setGeometry(QRect(10,50,25,25))
        eharf=QPushButton("é",anaPencere)
        eharf.setGeometry(QRect(30,50,25,25))

        self.DilGrup=QButtonGroup(anaPencere)
        self.Dil1 = QPushButton("Zazaca-Türkçe",anaPencere)
        self.Dil1.setGeometry(QRect(230, 80, 91, 23))
        self.Dil1.setCheckable(True)
        self.Dil1.setAutoExclusive(True)
        self.Dil1.setChecked(True)
        self.Dil1.setStyleSheet("background-color: rgb(102, 255, 0);")

        self.Dil2 = QPushButton("Türkçe-Zazaca",anaPencere)
        self.Dil2.setGeometry(QRect(330, 80, 91, 23))
        self.Dil2.setCheckable(True)
        self.Dil2.setAutoExclusive(True)
        self.Dil2.setStyleSheet("background-color: rgb(255, 94, 105);")

        self.DilGrup.addButton(self.Dil1,1)
        self.DilGrup.addButton(self.Dil2,2)
        self.DilGrup.buttonClicked[int].connect(self.dilSecme)
        self.kelimeListesi=QListWidget(anaPencere)
        self.kelimeListesi.setGeometry(QRect(10, 130, 191, 231))

        self.kelimeListesi.itemClicked.connect(self.kelimeAcikla)
        self.kelimeAnlam = QLabel("Kelimenin Anlamı:",anaPencere)
        self.kelimeAnlam.setGeometry(QRect(230, 110, 131, 21))

        self.cumleList1 = QListWidget(anaPencere)
        self.cumleList1.setGeometry(QRect(230, 130, 351, 51))

        self.ornekCumle1 = QLabel("Örnek Zazaca Cümle:",anaPencere)
        self.ornekCumle1.setGeometry(QRect(230, 200, 101, 21))

        self.cumleList2 = QListWidget(anaPencere)
        self.cumleList2.setGeometry(QRect(230, 220, 351, 51))

        self.ornekCumle2 = QLabel("Örnek Türkçe Cümle:",anaPencere)
        self.ornekCumle2.setGeometry(QRect(230, 290, 111, 16))

        self.cumleList3 = QListWidget(anaPencere)
        self.cumleList3.setGeometry(QRect(230, 310, 351, 51))




        self.anaMenu = QMenuBar(anaPencere)
        self.anaMenu.setGeometry(QRect(0, 0, 600, 21))

        self.menuDosya = QMenu("Dosya",self.anaMenu)

        self.menuDuzenle = QMenu("Düzenle",self.anaMenu)

        self.menuYardim = QMenu("Yardım",self.anaMenu)

        anaPencere.setMenuBar(self.anaMenu)

        self.durum = QStatusBar(zemin)
        anaPencere.setStatusBar(self.durum)
        self.durum.setStyleSheet("background-color:white")
        self.durum.showMessage("Hazır")

        self.cikis= QAction(QIcon("Exit.ico"),"&Çıkış",anaPencere)
        self.cikis.setShortcut("Ctrl+X")

        self.cikis.triggered.connect(anaPencere.close)

        self.actionHakkinda = QAction("Hakkında",anaPencere)
        self.actionHakkinda.triggered.connect(self.hakkinda)
        self.actionSecenekler = QAction("Seçenekler",anaPencere)

        self.menuDosya.addAction(self.cikis)
        self.menuDuzenle.addAction(self.actionSecenekler)
        self.menuYardim.addAction(self.actionHakkinda)
#.........這裏部分代碼省略.........
開發者ID:Serwer,項目名稱:Zazaca-Turkce-Sozluk,代碼行數:103,代碼來源:Sozluk.py

示例8: Ui_chem

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class Ui_chem(QWidget):

    def __init__(self):

        super(Ui_chem, self).__init__()
        self.initUi(self)

    def initUi(self, chem):
        chem.setObjectName(_fromUtf8("chem"))
        chem.resize(601, 430)
        self.pushButton = QPushButton(chem)
        self.pushButton.setGeometry(QtCore.QRect(340, 390, 110, 32))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.pushButton_2 = QPushButton(chem)
        self.pushButton_2.setGeometry(QtCore.QRect(449, 390, 151, 32))
        self.pushButton_2.setObjectName(_fromUtf8("pushButton_2"))
        self.line_name = QLineEdit(chem)
        self.line_name.setGeometry(QtCore.QRect(140, 40, 431, 31))
        self.line_name.setObjectName(_fromUtf8("line_name"))
        self.label_name = QLabel(chem)
        self.label_name.setGeometry(QtCore.QRect(30, 50, 56, 13))
        self.label_name.setObjectName(_fromUtf8("label_name"))
        self.line_vendor = QLineEdit(chem)
        self.line_vendor.setGeometry(QtCore.QRect(140, 100, 211, 21))
        self.line_vendor.setObjectName(_fromUtf8("line_vendor"))
        self.label_vendor = QLabel(chem)
        self.label_vendor.setGeometry(QtCore.QRect(30, 100, 56, 13))
        self.label_vendor.setObjectName(_fromUtf8("label_vendor"))
        self.line_vpid = QLineEdit(chem)
        self.line_vpid.setGeometry(QtCore.QRect(140, 140, 211, 21))
        self.line_vpid.setObjectName(_fromUtf8("line_vpid"))
        self.label_vpid = QLabel(chem)
        self.label_vpid.setGeometry(QtCore.QRect(30, 150, 111, 16))
        self.label_vpid.setObjectName(_fromUtf8("label_vpid"))
        self.line_cas = QLineEdit(chem)
        self.line_cas.setGeometry(QtCore.QRect(140, 200, 211, 21))
        self.line_cas.setObjectName(_fromUtf8("line_cas"))
        self.label_cas = QLabel(chem)
        self.label_cas.setGeometry(QtCore.QRect(30, 210, 111, 16))
        self.label_cas.setObjectName(_fromUtf8("label_cas"))
        self.line_size = QLineEdit(chem)
        self.line_size.setGeometry(QtCore.QRect(140, 250, 211, 21))
        self.line_size.setObjectName(_fromUtf8("line_size"))
        self.label_size = QLabel(chem)
        self.label_size.setGeometry(QtCore.QRect(30, 250, 111, 16))
        self.label_size.setObjectName(_fromUtf8("label_size"))
        self.label_storage = QLabel(chem)
        self.label_storage.setGeometry(QtCore.QRect(30, 310, 111, 16))
        self.label_storage.setObjectName(_fromUtf8("label_storage"))
        self.label_room = QLabel(chem)
        self.label_room.setGeometry(QtCore.QRect(320, 310, 111, 16))
        self.label_room.setObjectName(_fromUtf8("label_room"))
        self.line_storage = QLineEdit(chem)
        self.line_storage.setGeometry(QtCore.QRect(90, 300, 211, 21))
        self.line_storage.setObjectName(_fromUtf8("line_storage"))
        self.line_room = QLineEdit(chem)
        self.line_room.setGeometry(QtCore.QRect(370, 300, 211, 21))
        self.line_room.setObjectName(_fromUtf8("line_room"))
        self.line_id = QLineEdit(chem)
        self.line_id.setGeometry(QtCore.QRect(370, 350, 211, 21))
        self.line_id.setObjectName(_fromUtf8("line_id"))
        self.label_id = QLabel(chem)
        self.label_id.setGeometry(QtCore.QRect(320, 350, 111, 16))
        self.label_id.setObjectName(_fromUtf8("label_id"))


        self.retranslateUi(chem)
        QtCore.QMetaObject.connectSlotsByName(chem)

        #connections
        #self.connect(self.pushButton, QtCore.SIGNAL("released()"), self.save)
        #self.connect(self.pushButton_2, QtCore.SIGNAL("released()"), self.quit)
        self.pushButton.clicked.connect(self.save)
        self.pushButton_2.clicked.connect(self.quit)

    def save (self) :
        allconn=cursor.connection()
        curs=allconn[0]
        data=allconn[1]
        name=str(self.line_name.text())
        vendor=str(self.line_vendor.text())
        vpid=str(self.line_vpid.text())
        cas=str(self.line_cas.text())
        size=str(self.line_size.text())
        storage=str(self.line_storage.text())
        room=str(self.line_room.text())
        idnum=str(self.line_id.text())
        idtupl=(idnum,)
        val=(name,vendor,vpid,cas,size,storage,room,idnum)
        curs.execute('''DELETE FROM chem WHERE id=?''', idtupl)
        data.commit()
        curs.execute('''INSERT INTO chem VALUES (?,?,?,?,?,?,?,?)''', val)
        data.commit()
        data.close()
        self.close()

    def quit (self) :
        self.close()


#.........這裏部分代碼省略.........
開發者ID:dedichan,項目名稱:ChemDB,代碼行數:103,代碼來源:display.py

示例9: Ui_MainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setGeometry [as 別名]
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(500, 262)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.button_find_id = QPushButton(self.centralwidget)
        self.button_find_id.setGeometry(QtCore.QRect(370, 10, 110, 32))
        self.button_find_id.setObjectName(_fromUtf8("button_find_id"))
        self.button_find_name = QPushButton(self.centralwidget)
        self.button_find_name.setGeometry(QtCore.QRect(370, 50, 110, 32))
        self.button_find_name.setObjectName(_fromUtf8("button_find_name"))
        self.button_find_cas = QPushButton(self.centralwidget)
        self.button_find_cas.setGeometry(QtCore.QRect(370, 90, 110, 32))
        self.button_find_cas.setObjectName(_fromUtf8("button_find_cas"))
        self.button_find_vpid = QPushButton(self.centralwidget)
        self.button_find_vpid.setGeometry(QtCore.QRect(370, 130, 110, 32))
        self.button_find_vpid.setObjectName(_fromUtf8("button_find_cas"))

        self.button_add = QPushButton(self.centralwidget)
        self.button_add.setGeometry(QtCore.QRect(150, 180, 110, 32))
        self.button_add.setObjectName(_fromUtf8("button_add"))

        self.button_stop = QPushButton(self.centralwidget)
        self.button_stop.setGeometry(QtCore.QRect(150, 210, 110, 32))
        self.button_stop.setObjectName(_fromUtf8("button_stop"))

        self.button_invent = QPushButton(self.centralwidget)
        self.button_invent.setGeometry(QtCore.QRect(20, 180, 120, 32))
        self.button_invent.setObjectName(_fromUtf8("button_invent"))

        self.button_invent_2 = QPushButton(self.centralwidget)
        self.button_invent_2.setGeometry(QtCore.QRect(20, 210, 120, 32))
        self.button_invent_2.setObjectName(_fromUtf8("button_invent_2"))

        self.button_delete = QPushButton(self.centralwidget)
        self.button_delete.setGeometry(QtCore.QRect(260, 210, 120, 32))
        self.button_delete.setObjectName(_fromUtf8("button_delete"))

        self.button_manual = QPushButton(self.centralwidget)
        self.button_manual.setGeometry(QtCore.QRect(260, 180, 120, 32))
        self.button_manual.setObjectName(_fromUtf8("button_delete"))  

        self.button_repop = QPushButton(self.centralwidget)
        self.button_repop.setGeometry(QtCore.QRect(380, 195, 110, 32))
        self.button_repop.setObjectName(_fromUtf8("button_repop"))     


        self.line_id = QLineEdit(self.centralwidget)
        self.line_id.setGeometry(QtCore.QRect(90, 10, 251, 21))
        self.line_id.setObjectName(_fromUtf8("line_id"))
        self.line_name = QLineEdit(self.centralwidget)
        self.line_name.setGeometry(QtCore.QRect(90, 50, 251, 21))
        self.line_name.setObjectName(_fromUtf8("line_name"))
        self.line_cas = QLineEdit(self.centralwidget)
        self.line_cas.setGeometry(QtCore.QRect(90, 90, 251, 21))
        self.line_cas.setObjectName(_fromUtf8("line_cas"))
        self.line_vpid = QLineEdit(self.centralwidget)
        self.line_vpid.setGeometry(QtCore.QRect(90, 130, 251, 21))
        self.line_vpid.setObjectName(_fromUtf8("line_cas"))       
        self.label_id = QLabel(self.centralwidget)
        self.label_id.setGeometry(QtCore.QRect(10, 10, 56, 13))
        self.label_id.setObjectName(_fromUtf8("label_id"))
        self.label_name = QLabel(self.centralwidget)
        self.label_name.setGeometry(QtCore.QRect(10, 50, 56, 13))
        self.label_name.setObjectName(_fromUtf8("label_name"))
        self.label_cas = QLabel(self.centralwidget)
        self.label_cas.setGeometry(QtCore.QRect(10, 90, 56, 13))
        self.label_cas.setObjectName(_fromUtf8("label_cas"))
        self.label_vpid = QLabel(self.centralwidget)
        self.label_vpid.setGeometry(QtCore.QRect(10, 130, 56, 13))
        self.label_vpid.setObjectName(_fromUtf8("label_cas"))       
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 500, 22))
        self.menubar.setObjectName(_fromUtf8("menubar"))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(_fromUtf8("statusbar"))
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

        #connection
        #self.trigger=QtCore.pyqtSignal()
        #self.trigger.connect(self.button_add, QtCore.SIGNAL("released()"), self.new)
        #self.connect(self.button_stop, QtCore.SIGNAL("released()"), self.quit)
        #self.connect(self.button_find_id, QtCore.SIGNAL("released()"), self.find_id)
        #self.connect(self.button_find_name, QtCore.SIGNAL("released()"), self.find_name)
        #self.connect(self.button_find_vpid, QtCore.SIGNAL("released()"), self.find_vpid)
        #self.connect(self.button_find_cas, QtCore.SIGNAL("released()"), self.find_cas)
        #self.connect(self.button_invent, QtCore.SIGNAL("released()"), self.invent)
        #self.connect(self.button_invent_2, QtCore.SIGNAL("released()"), self.invent_2)
        #self.connect(self.button_delete, QtCore.SIGNAL("released()"), self.delete)
        #self.connect(self.button_manual, QtCore.SIGNAL("released()"), self.manu)
        #self.connect(self.button_repop, QtCore.SIGNAL("released()"), self.repop)
        self.button_stop.clicked.connect(self.quit)
        self.button_add.clicked.connect(self.new)
        self.button_find_id.clicked.connect(self.find_id)
#.........這裏部分代碼省略.........
開發者ID:dedichan,項目名稱:ChemDB,代碼行數:103,代碼來源:principal.py


注:本文中的PyQt5.QtWidgets.QLineEdit.setGeometry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。