本文整理汇总了Python中qrtools.QR.destroy方法的典型用法代码示例。如果您正苦于以下问题:Python QR.destroy方法的具体用法?Python QR.destroy怎么用?Python QR.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qrtools.QR
的用法示例。
在下文中一共展示了QR.destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: qrencode
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import destroy [as 别名]
def qrencode(self, fileName=None):
#Functions to get the correct data
data_fields = {
"text": unicode(self.textEdit.toPlainText()),
"url": unicode(self.urlEdit.text()),
"bookmark": ( unicode(self.bookmarkTitleEdit.text()), unicode(self.bookmarkUrlEdit.text()) ),
"email": unicode(self.emailEdit.text()),
"emailmessage": ( unicode(self.emailEdit.text()), unicode(self.emailSubjectEdit.text()), unicode(self.emailBodyEdit.toPlainText()) ),
"telephone": unicode(self.telephoneEdit.text()),
"phonebook": (('N',unicode(self.phonebookNameEdit.text())),
('TEL', unicode(self.phonebookTelEdit.text())),
('EMAIL',unicode(self.phonebookEMailEdit.text())),
('NOTE', unicode(self.phonebookNoteEdit.text())),
('BDAY', unicode(self.phonebookBirthdayEdit.date().toString("yyyyMMdd")) if self.phonebookBirthdayLabel.isChecked() else ""), #YYYYMMDD
('ADR', unicode(self.phonebookAddressEdit.text())), #The fields divided by commas (,) denote PO box, room number, house number, city, prefecture, zip code and country, in order.
('URL', unicode(self.phonebookUrlEdit.text())),
# ('NICKNAME', ''),
),
"sms": ( unicode(self.smsNumberEdit.text()), unicode(self.smsBodyEdit.toPlainText()) ),
"mms": ( unicode(self.mmsNumberEdit.text()), unicode(self.mmsBodyEdit.toPlainText()) ),
"geo": ( unicode(self.geoLatEdit.text()), unicode(self.geoLongEdit.text()) ),
"wifi": ( unicode(self.wifiSSIDEdit.text()), (u"WEP",u"WPA",u"nopass")[self.wifiEncriptionType.currentIndex()], unicode(self.wifiPasswordEdit.text()))
}
data_type = unicode(self.templates[unicode(self.selector.currentText())])
data = data_fields[data_type]
level = (u'L',u'M',u'Q',u'H')
if data:
if data_type == 'emailmessage' and data[1] == '' and data[2] == '':
data_type = 'email'
data = data_fields[data_type]
qr = QR(pixel_size = unicode(self.pixelSize.value()),
data = data,
level = unicode(level[self.ecLevel.currentIndex()]),
margin_size = unicode(self.marginSize.value()),
data_type = data_type,
)
error = 1
if type(fileName) is not unicode:
error = qr.encode()
else:
error = qr.encode(fileName)
if error == 0:
self.qrcode.setPixmap(QtGui.QPixmap(qr.filename))
self.saveButton.setEnabled(True)
else:
if NOTIFY:
n = pynotify.Notification(
"QtQR",
unicode(self.trUtf8("ERROR: Something went wrong while trying to generate the QR Code.")),
"qtqr"
)
n.show()
else:
print "Something went wrong while trying to generate the QR Code"
qr.destroy()
else:
self.saveButton.setEnabled(False)
示例2: decodeWebcam
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import destroy [as 别名]
def decodeWebcam(self):
vdDialog = VideoDevices()
if vdDialog.exec_():
device = vdDialog.videoDevices[vdDialog.videoDevice.currentIndex()][1]
qr = QR()
qr.decode_webcam(device=device)
if qr.data_decode[qr.data_type](qr.data) == 'NULL':
QtGui.QMessageBox.warning(
self,
self.trUtf8("Decoding Failed"),
self.trUtf8("<p>Oops! no code was found.<br /> Maybe your webcam didn't focus.</p>"),
QtGui.QMessageBox.Ok
)
else:
self.showInfo(qr)
qr.destroy()
示例3: _qr_code
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import destroy [as 别名]
def _qr_code(qr_code_data):
"""
Create QR code.
@type qr_code_data: string
@param qr_code_data: Data to encode in the qr code
"""
if not qr_code_data:
return "/static/images/default.png"
qr_code_data = "\n".join(qr_code_data)
qr_code_data = "mecard:" + qr_code_data
qr_code = QR(qr_code_data)
qr_code.encode()
with open(qr_code.filename) as filename:
data = filename.read()
return "data:image/png;base64," + data.encode('base64')
qr_code.destroy()
示例4: decodeFile
# 需要导入模块: from qrtools import QR [as 别名]
# 或者: from qrtools.QR import destroy [as 别名]
def decodeFile(self, fn=None):
if not fn:
fn = unicode(QtGui.QFileDialog.getOpenFileName(
self,
self.trUtf8('Open QRCode'),
filter=self.trUtf8('Images (*.png *.jpg);; All Files (*.*)')
)
)
if os.path.isfile(fn):
qr = QR(filename=fn)
if qr.decode():
self.showInfo(qr)
else:
QtGui.QMessageBox.information(
self,
self.trUtf8('Decode File'),
unicode(self.trUtf8('No QRCode could be found in file: <b>%s</b>.')) % fn
)
qr.destroy()