Merge lp:~paulliu/qr-tools/python3 into lp:qr-tools

Proposed by Ying-Chun Liu
Status: Merged
Approved by: Ramiro Algozino
Approved revision: 33
Merged at revision: 33
Proposed branch: lp:~paulliu/qr-tools/python3
Merge into: lp:qr-tools
Diff against target: 404 lines (+92/-91)
2 files modified
qrtools.py (+12/-12)
qtqr.py (+80/-79)
To merge this branch: bzr merge lp:~paulliu/qr-tools/python3
Reviewer Review Type Date Requested Status
Ramiro Algozino Approve
Review via email: mp+372711@code.launchpad.net

Commit message

Porting to python3

Description of the change

Python2 is end of life. We have to port this project to python3 so that we can continue using it.

To post a comment you must log in.
Revision history for this message
Ramiro Algozino (algozino) wrote :

Lgtm. The packaging is pending yet though.

Thank you very much for your collaboration!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qrtools.py'
--- qrtools.py 2018-03-01 17:24:59 +0000
+++ qrtools.py 2019-09-12 18:29:16 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/env python1#!/usr/bin/env python3
22
3# Authors:3# Authors:
4# David Green <david4dev@gmail.com>4# David Green <david4dev@gmail.com>
@@ -35,7 +35,7 @@
35 import Image35 import Image
36import re36import re
37from codecs import BOM_UTF837from codecs import BOM_UTF8
38from urlparse import urlparse, parse_qs38from urllib.parse import urlparse, parse_qs
3939
40def eprint(*args, **kwargs):40def eprint(*args, **kwargs):
41 print(*args, file=sys.stderr, **kwargs)41 print(*args, file=sys.stderr, **kwargs)
@@ -170,7 +170,7 @@
170 utf8_bytedata = None170 utf8_bytedata = None
171 try:171 try:
172 utf8_bytedata = self.data_to_string()172 utf8_bytedata = self.data_to_string()
173 except QR.EncodeError, e:173 except QR.EncodeError as e:
174 eprint(repr(e))174 eprint(repr(e))
175 return 1175 return 1
176176
@@ -178,8 +178,8 @@
178 command = [178 command = [
179 'qrencode',179 'qrencode',
180 '-o', self.filename,180 '-o', self.filename,
181 '-s', unicode(self.pixel_size),181 '-s', str(self.pixel_size),
182 '-m', unicode(self.margin_size),182 '-m', str(self.margin_size),
183 '-l', self.level,183 '-l', self.level,
184 '-t', ext,184 '-t', ext,
185 self.data_to_string()185 self.data_to_string()
@@ -188,8 +188,8 @@
188 command = [188 command = [
189 'qrencode',189 'qrencode',
190 '-o', self.filename,190 '-o', self.filename,
191 '-s', unicode(self.pixel_size),191 '-s', str(self.pixel_size),
192 '-m', unicode(self.margin_size),192 '-m', str(self.margin_size),
193 '-l', self.level,193 '-l', self.level,
194 #'-t', ext,194 #'-t', ext,
195 self.data_to_string()195 self.data_to_string()
@@ -222,7 +222,7 @@
222 # clean up222 # clean up
223 del(image)223 del(image)
224 #Assuming data is encoded in utf8224 #Assuming data is encoded in utf8
225 self.data = symbol.data.decode(u'utf-8')225 self.data = symbol.data
226 self.data_type = self.data_recognise()226 self.data_type = self.data_recognise()
227 return True227 return True
228 else:228 else:
@@ -267,19 +267,19 @@
267 #FIXME: Probably a future bug in newer versions.267 #FIXME: Probably a future bug in newer versions.
268 #We should at least check if the binary is available.268 #We should at least check if the binary is available.
269 p = subprocess.Popen(['qrencode','-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)269 p = subprocess.Popen(['qrencode','-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
270 version_text = p.communicate()[1]270 version_text = p.communicate()[0]
271 version = re.search('version\s([\d.]*)',version_text) 271 version = re.search('version\s([\d.]*)',str(version_text))
272 if version:272 if version:
273 version_number = version.group(1)273 version_number = version.group(1)
274 else:274 else:
275 version_number = -1275 version_number = -1
276 #print "Using qrencode version:", version_number276 #print ("Using qrencode version:", version_number)
277 return version_number277 return version_number
278278
279 def get_qrencode_types(self):279 def get_qrencode_types(self):
280 p = subprocess.Popen(['qrencode','-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)280 p = subprocess.Popen(['qrencode','-h'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
281 help_text = p.communicate()[1]281 help_text = p.communicate()[1]
282 types_text = re.search('-t {([\w,]*)}', help_text) 282 types_text = re.search('-t {([\w,]*)}', str(help_text))
283 if types_text:283 if types_text:
284 types = types_text.group(1).split(',')284 types = types_text.group(1).split(',')
285 #print "The following format types have been found!:", types285 #print "The following format types have been found!:", types
286286
=== modified file 'qtqr.py'
--- qtqr.py 2018-06-04 01:50:55 +0000
+++ qtqr.py 2019-09-12 18:29:16 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/env python1#!/usr/bin/env python3
2#-*- encoding: utf-8 -*-2#-*- encoding: utf-8 -*-
33
4"""4"""
@@ -16,7 +16,7 @@
16try:16try:
17 # import pynotify17 # import pynotify
18 if not pynotify.init("QtQR"):18 if not pynotify.init("QtQR"):
19 print "DEBUG: There was a problem initializing the pynotify module"19 print ("DEBUG: There was a problem initializing the pynotify module")
20 NOTIFY = True20 NOTIFY = True
21except:21except:
22 NOTIFY = False22 NOTIFY = False
@@ -43,17 +43,17 @@
4343
44 # Templates for creating QRCodes supported by qrtools44 # Templates for creating QRCodes supported by qrtools
45 self.templates = {45 self.templates = {
46 "text": unicode(self.tr("Text")),46 "text": str(self.tr("Text")),
47 "url": unicode(self.tr("URL")),47 "url": str(self.tr("URL")),
48 "bookmark": unicode(self.tr("Bookmark")),48 "bookmark": str(self.tr("Bookmark")),
49 "emailmessage": unicode(self.tr("E-Mail")),49 "emailmessage": str(self.tr("E-Mail")),
50 "telephone": unicode(self.tr("Telephone Number")),50 "telephone": str(self.tr("Telephone Number")),
51 "phonebook": unicode(self.tr("Contact Information (PhoneBook)")),51 "phonebook": str(self.tr("Contact Information (PhoneBook)")),
52 "sms": unicode(self.tr("SMS")),52 "sms": str(self.tr("SMS")),
53 "mms": unicode(self.tr("MMS")),53 "mms": str(self.tr("MMS")),
54 "geo": unicode(self.tr("Geolocalization")),54 "geo": str(self.tr("Geolocalization")),
55 "wifi": unicode(self.tr("WiFi Network")),55 "wifi": str(self.tr("WiFi Network")),
56 "sepa": unicode(self.tr("SEPA Single Payment")),56 "sepa": str(self.tr("SEPA Single Payment")),
57 }57 }
58 # With this we make the dict bidirectional58 # With this we make the dict bidirectional
59 self.templates.update( dict((self.templates[k], k) for k in self.templates))59 self.templates.update( dict((self.templates[k], k) for k in self.templates))
@@ -440,7 +440,7 @@
440 self.smsBodyEdit.textChanged.connect(self.qrencode)440 self.smsBodyEdit.textChanged.connect(self.qrencode)
441 self.smsBodyEdit.textChanged.connect(441 self.smsBodyEdit.textChanged.connect(
442 lambda: self.smsCharCount.setText(442 lambda: self.smsCharCount.setText(
443 unicode(self.tr("characters count: %s - %d message(s)")) % (443 str(self.tr("characters count: %s - %d message(s)")) % (
444 len(self.smsBodyEdit.toPlainText()),444 len(self.smsBodyEdit.toPlainText()),
445 ceil(len(self.smsBodyEdit.toPlainText()) / 160.0)445 ceil(len(self.smsBodyEdit.toPlainText()) / 160.0)
446 ) 446 )
@@ -508,35 +508,35 @@
508 fileName = kargs.get('fileName')508 fileName = kargs.get('fileName')
509 #Functions to get the correct data509 #Functions to get the correct data
510 data_fields = {510 data_fields = {
511 "text": unicode(self.textEdit.toPlainText()),511 "text": str(self.textEdit.toPlainText()),
512 "url": unicode(self.urlEdit.text()),512 "url": str(self.urlEdit.text()),
513 "bookmark": ( unicode(self.bookmarkTitleEdit.text()), unicode(self.bookmarkUrlEdit.text()) ),513 "bookmark": ( str(self.bookmarkTitleEdit.text()), str(self.bookmarkUrlEdit.text()) ),
514 "email": unicode(self.emailEdit.text()),514 "email": str(self.emailEdit.text()),
515 "emailmessage": ( unicode(self.emailEdit.text()), unicode(self.emailSubjectEdit.text()), unicode(self.emailBodyEdit.toPlainText()) ),515 "emailmessage": ( str(self.emailEdit.text()), str(self.emailSubjectEdit.text()), str(self.emailBodyEdit.toPlainText()) ),
516 "telephone": unicode(self.telephoneEdit.text()),516 "telephone": str(self.telephoneEdit.text()),
517 "phonebook": (('N',unicode(self.phonebookNameEdit.text())),517 "phonebook": (('N',str(self.phonebookNameEdit.text())),
518 ('TEL', unicode(self.phonebookTelEdit.text())),518 ('TEL', str(self.phonebookTelEdit.text())),
519 ('EMAIL',unicode(self.phonebookEMailEdit.text())),519 ('EMAIL',str(self.phonebookEMailEdit.text())),
520 ('NOTE', unicode(self.phonebookNoteEdit.text())),520 ('NOTE', str(self.phonebookNoteEdit.text())),
521 ('BDAY', unicode(self.phonebookBirthdayEdit.date().toString("yyyyMMdd")) if self.phonebookBirthdayLabel.isChecked() else ""), #YYYYMMDD521 ('BDAY', str(self.phonebookBirthdayEdit.date().toString("yyyyMMdd")) if self.phonebookBirthdayLabel.isChecked() else ""), #YYYYMMDD
522 ('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.522 ('ADR', str(self.phonebookAddressEdit.text())), #The fields divided by commas (,) denote PO box, room number, house number, city, prefecture, zip code and country, in order.
523 ('URL', unicode(self.phonebookUrlEdit.text())),523 ('URL', str(self.phonebookUrlEdit.text())),
524 # ('NICKNAME', ''),524 # ('NICKNAME', ''),
525 ),525 ),
526 "sms": ( unicode(self.smsNumberEdit.text()), unicode(self.smsBodyEdit.toPlainText()) ),526 "sms": ( str(self.smsNumberEdit.text()), str(self.smsBodyEdit.toPlainText()) ),
527 "mms": ( unicode(self.mmsNumberEdit.text()), unicode(self.mmsBodyEdit.toPlainText()) ),527 "mms": ( str(self.mmsNumberEdit.text()), str(self.mmsBodyEdit.toPlainText()) ),
528 "geo": ( unicode(self.geoLatEdit.text()), unicode(self.geoLongEdit.text()) ),528 "geo": ( str(self.geoLatEdit.text()), str(self.geoLongEdit.text()) ),
529 "wifi": ( unicode(self.wifiSSIDEdit.text()), (u"WEP",u"WPA",u"nopass")[self.wifiEncryptionType.currentIndex()], unicode(self.wifiPasswordEdit.text())),529 "wifi": ( str(self.wifiSSIDEdit.text()), (u"WEP",u"WPA",u"nopass")[self.wifiEncryptionType.currentIndex()], str(self.wifiPasswordEdit.text())),
530 "sepa": (unicode(self.sepaNameEdit.text()),530 "sepa": (str(self.sepaNameEdit.text()),
531 unicode(self.sepaAccountEdit.text()),531 str(self.sepaAccountEdit.text()),
532 unicode(self.sepaBNCEdit.text()),532 str(self.sepaBNCEdit.text()),
533 unicode(self.sepaAmountEdit.text()),533 str(self.sepaAmountEdit.text()),
534 unicode(self.sepaReasonEdit.text()),534 str(self.sepaReasonEdit.text()),
535 unicode(self.sepaCurrencyEdit.text())535 str(self.sepaCurrencyEdit.text())
536 ),536 ),
537 }537 }
538538
539 data_type = unicode(self.templates[unicode(self.selector.currentText())])539 data_type = str(self.templates[str(self.selector.currentText())])
540 data = data_fields[data_type]540 data = data_fields[data_type]
541 541
542 level = (u'L',u'M',u'Q',u'H')542 level = (u'L',u'M',u'Q',u'H')
@@ -545,14 +545,14 @@
545 if data_type == 'emailmessage' and data[1] == '' and data[2] == '':545 if data_type == 'emailmessage' and data[1] == '' and data[2] == '':
546 data_type = 'email'546 data_type = 'email'
547 data = data_fields[data_type]547 data = data_fields[data_type]
548 qr = QR(pixel_size = unicode(self.pixelSize.value()),548 qr = QR(pixel_size = str(self.pixelSize.value()),
549 data = data,549 data = data,
550 level = unicode(level[self.ecLevel.currentIndex()]),550 level = str(level[self.ecLevel.currentIndex()]),
551 margin_size = unicode(self.marginSize.value()),551 margin_size = str(self.marginSize.value()),
552 data_type = data_type,552 data_type = data_type,
553 )553 )
554 error = 1554 error = 1
555 if type(fileName) is not unicode:555 if type(fileName) is not str:
556 error = qr.encode()556 error = qr.encode()
557 else:557 else:
558 error = qr.encode(fileName)558 error = qr.encode(fileName)
@@ -563,12 +563,12 @@
563 if NOTIFY:563 if NOTIFY:
564 n = pynotify.Notification(564 n = pynotify.Notification(
565 "QtQR",565 "QtQR",
566 unicode(self.tr("ERROR: Something went wrong while trying to generate the QR Code.")),566 str(self.tr("ERROR: Something went wrong while trying to generate the QR Code.")),
567 "qtqr"567 "qtqr"
568 )568 )
569 n.show()569 n.show()
570 else:570 else:
571 print "Something went wrong while trying to generate the QR Code"571 print ("Something went wrong while trying to generate the QR Code")
572 qr.destroy()572 qr.destroy()
573 else:573 else:
574 self.saveButton.setEnabled(False)574 self.saveButton.setEnabled(False)
@@ -596,19 +596,19 @@
596 and not fn.lower().endswith(u".utf8") \596 and not fn.lower().endswith(u".utf8") \
597 and not fn.lower().endswith(u".ansiutf8"):597 and not fn.lower().endswith(u".ansiutf8"):
598 fn += u".png"598 fn += u".png"
599 self.qrencode(fileName=unicode(fn))599 self.qrencode(fileName=str(fn))
600 if NOTIFY:600 if NOTIFY:
601 n = pynotify.Notification(601 n = pynotify.Notification(
602 unicode(self.tr("Save QR Code")),602 str(self.tr("Save QR Code")),
603 unicode(self.tr("QR Code succesfully saved to %s")) % fn,603 str(self.tr("QR Code succesfully saved to %s")) % fn,
604 "qtqr"604 "qtqr"
605 )605 )
606 n.show()606 n.show()
607 else:607 else:
608 QtWidgets.QMessageBox.information(608 QtWidgets.QMessageBox.information(
609 self, 609 self,
610 unicode(self.tr('Save QRCode')),610 str(self.tr('Save QRCode')),
611 unicode(self.tr('QRCode succesfully saved to <b>%s</b>.')) % fn611 str(self.tr('QRCode succesfully saved to <b>%s</b>.')) % fn
612 )612 )
613613
614 def decodeFile(self, fn=None):614 def decodeFile(self, fn=None):
@@ -619,7 +619,7 @@
619 filter=self.tr('Images (*.png *.jpg);; All Files (*.*)')619 filter=self.tr('Images (*.png *.jpg);; All Files (*.*)')
620 )620 )
621 if fn:621 if fn:
622 fn = unicode(fn)622 fn = str(fn)
623 else:623 else:
624 return624 return
625 if os.path.isfile(fn):625 if os.path.isfile(fn):
@@ -638,7 +638,7 @@
638 QtWidgets.QMessageBox.information(638 QtWidgets.QMessageBox.information(
639 self,639 self,
640 self.tr('Decode File'),640 self.tr('Decode File'),
641 unicode(self.tr('No QRCode could be found in file: <b>%s</b>.')) % fn641 str(self.tr('No QRCode could be found in file: <b>%s</b>.')) % fn
642 )642 )
643 qr.destroy()643 qr.destroy()
644 else:644 else:
@@ -652,26 +652,26 @@
652652
653 def showInfo(self, qr):653 def showInfo(self, qr):
654 dt = qr.data_type654 dt = qr.data_type
655 print dt.encode(u"utf-8") + ':',655 print (str(dt) + ':', end='')
656 data = qr.data_decode[dt](qr.data)656 data = qr.data_decode[dt](qr.data)
657 if type(data) == tuple:657 if type(data) == tuple:
658 for d in data:658 for d in data:
659 print d.encode(u"utf-8")659 print (d.encode(u"utf-8"))
660 elif type(data) == dict:660 elif type(data) == dict:
661 # FIX-ME: Print the decoded symbols661 # FIX-ME: Print the decoded symbols
662 print "Dict"662 print ("Dict")
663 print data.keys()663 print (data.keys())
664 print data.values()664 print (data.values())
665 else:665 else:
666 print data.encode(u"utf-8")666 print (data.encode(u"utf-8"))
667 msg = {667 msg = {
668 'text': lambda : unicode(self.tr("QRCode contains the following text:\n\n%s")) % (data),668 'text': lambda : str(self.tr("QRCode contains the following text:\n\n%s")) % (data),
669 'url': lambda : unicode(self.tr("QRCode contains the following url address:\n\n%s")) % (data),669 'url': lambda : str(self.tr("QRCode contains the following url address:\n\n%s")) % (data),
670 'bookmark': lambda: unicode(self.tr("QRCode contains a bookmark:\n\nTitle: %s\nURL: %s")) % (data),670 'bookmark': lambda: str(self.tr("QRCode contains a bookmark:\n\nTitle: %s\nURL: %s")) % (data),
671 'email': lambda : unicode(self.tr("QRCode contains the following e-mail address:\n\n%s")) % (data),671 'email': lambda : str(self.tr("QRCode contains the following e-mail address:\n\n%s")) % (data),
672 'emailmessage': lambda : unicode(self.tr("QRCode contains an e-mail message:\n\nTo: %s\nSubject: %s\nMessage: %s")) % (data),672 'emailmessage': lambda : str(self.tr("QRCode contains an e-mail message:\n\nTo: %s\nSubject: %s\nMessage: %s")) % (data),
673 'telephone': lambda : unicode(self.tr("QRCode contains a telephone number: ")) + (data),673 'telephone': lambda : str(self.tr("QRCode contains a telephone number: ")) + (data),
674 'phonebook': lambda : unicode(self.tr("QRCode contains a phonebook entry:\n\nName: %s\nTel: %s\nE-Mail: %s\nNote: %s\nBirthday: %s\nAddress: %s\nURL: %s")) %674 'phonebook': lambda : str(self.tr("QRCode contains a phonebook entry:\n\nName: %s\nTel: %s\nE-Mail: %s\nNote: %s\nBirthday: %s\nAddress: %s\nURL: %s")) %
675 (data.get('N') or "", 675 (data.get('N') or "",
676 data.get('TEL') or "", 676 data.get('TEL') or "",
677 data.get('EMAIL') or "", 677 data.get('EMAIL') or "",
@@ -679,11 +679,11 @@
679 QtCore.QDate.fromString(data.get('BDAY') or "",'yyyyMMdd').toString(), 679 QtCore.QDate.fromString(data.get('BDAY') or "",'yyyyMMdd').toString(),
680 data.get('ADR') or "",680 data.get('ADR') or "",
681 data.get('URL') or ""),681 data.get('URL') or ""),
682 'sms': lambda : unicode(self.tr("QRCode contains the following SMS message:\n\nTo: %s\nMessage: %s")) % (data),682 'sms': lambda : str(self.tr("QRCode contains the following SMS message:\n\nTo: %s\nMessage: %s")) % (data),
683 'mms': lambda : unicode(self.tr("QRCode contains the following MMS message:\n\nTo: %s\nMessage: %s")) % (data),683 'mms': lambda : str(self.tr("QRCode contains the following MMS message:\n\nTo: %s\nMessage: %s")) % (data),
684 'geo': lambda : unicode(self.tr("QRCode contains the following coordinates:\n\nLatitude: %s\nLongitude:%s")) % (data),684 'geo': lambda : str(self.tr("QRCode contains the following coordinates:\n\nLatitude: %s\nLongitude:%s")) % (data),
685 'wifi': lambda : unicode(self.tr("QRCode contains the following WiFi Network Configuration:\n\nSSID: %s\nEncryption Type: %s\nPassword: %s")) % (data),685 'wifi': lambda : str(self.tr("QRCode contains the following WiFi Network Configuration:\n\nSSID: %s\nEncryption Type: %s\nPassword: %s")) % (data),
686 'sepa': lambda : unicode(self.tr("QRCode contains the following Single Payment Information:\n\nName: %s\nAccount: %s\nBNC: %s\nAmmount: %s\nReason: %s\nCurrency: %s\n")) % (686 'sepa': lambda : str(self.tr("QRCode contains the following Single Payment Information:\n\nName: %s\nAccount: %s\nBNC: %s\nAmmount: %s\nReason: %s\nCurrency: %s\n")) % (
687 data.get('name')[0] or '',687 data.get('name')[0] or '',
688 data.get('account')[0] or '',688 data.get('account')[0] or '',
689 data.get('bnc')[0] or '',689 data.get('bnc')[0] or '',
@@ -743,7 +743,7 @@
743 link = data[1]743 link = data[1]
744 else:744 else:
745 link = qr.data_decode[qr.data_type](qr.data)745 link = qr.data_decode[qr.data_type](qr.data)
746 print u"Opening " + link746 print (u"Opening " + link)
747 QtGui.QDesktopServices.openUrl(QtCore.QUrl(link))747 QtGui.QDesktopServices.openUrl(QtCore.QUrl(link))
748 elif rsp == 0:748 elif rsp == 0:
749 #Edit the code749 #Edit the code
@@ -813,6 +813,7 @@
813 self.tabs.setCurrentIndex(tabIndex)813 self.tabs.setCurrentIndex(tabIndex)
814814
815 def decodeWebcam(self):815 def decodeWebcam(self):
816 device = None
816 vdDialog = VideoDevices()817 vdDialog = VideoDevices()
817 if len(vdDialog.videoDevices) == 1:818 if len(vdDialog.videoDevices) == 1:
818 device = vdDialog.videoDevices[0][1]819 device = vdDialog.videoDevices[0][1]
@@ -837,7 +838,7 @@
837 QtWidgets.QMessageBox.about(838 QtWidgets.QMessageBox.about(
838 self,839 self,
839 self.tr("About QtQR"),840 self.tr("About QtQR"),
840 unicode(self.tr('<h1>QtQR %s</h1><p>A simple software for creating and decoding QR Codes that uses python-qrtools as backend. Both are part of the <a href="https://launchpad.net/qr-tools">QR Tools</a> project.</p><p></p><p>This is Free Software: GNU-GPLv3</p><p></p><p>Please visit our website for more information and to check out the code:<br /><a href="https://code.launchpad.net/qr-tools/">https://code.launchpad.net/qr-tools/</p><p>copyright &copy; Ramiro Algozino &lt;<a href="mailto:algozino@gmail.com">algozino@gmail.com</a>&gt;</p>')) % __version__,841 str(self.tr('<h1>QtQR %s</h1><p>A simple software for creating and decoding QR Codes that uses python-qrtools as backend. Both are part of the <a href="https://launchpad.net/qr-tools">QR Tools</a> project.</p><p></p><p>This is Free Software: GNU-GPLv3</p><p></p><p>Please visit our website for more information and to check out the code:<br /><a href="https://code.launchpad.net/qr-tools/">https://code.launchpad.net/qr-tools/</p><p>copyright &copy; Ramiro Algozino &lt;<a href="mailto:algozino@gmail.com">algozino@gmail.com</a>&gt;</p>')) % __version__,
841 )842 )
842843
843 def dragEnterEvent(self, event):844 def dragEnterEvent(self, event):
@@ -848,9 +849,9 @@
848 for url in event.mimeData().urls():849 for url in event.mimeData().urls():
849 fn = url.toLocalFile()850 fn = url.toLocalFile()
850 if fn:851 if fn:
851 self.decodeFile(unicode(fn))852 self.decodeFile(str(fn))
852 else:853 else:
853 print "DEBUG: Downloading dropped file from %s" % url.toString() 854 print ("DEBUG: Downloading dropped file from %s" % url.toString() )
854 self.NetAccessMgr.get(QtNetwork.QNetworkRequest(url))855 self.NetAccessMgr.get(QtNetwork.QNetworkRequest(url))
855 # FIX-ME: We should check if the download gets timeout.856 # FIX-ME: We should check if the download gets timeout.
856 # and notify that we are downloading, the download could857 # and notify that we are downloading, the download could
@@ -861,7 +862,7 @@
861862
862863
863 def handleNetworkData(self, QNetReply):864 def handleNetworkData(self, QNetReply):
864 print "DEBUG: Finished downloading file."865 print ("DEBUG: Finished downloading file.")
865 tmpfn = '/tmp/qrtemp.png'866 tmpfn = '/tmp/qrtemp.png'
866 fn = open(tmpfn,"w")867 fn = open(tmpfn,"w")
867 fn.write(QNetReply.readAll())868 fn.write(QNetReply.readAll())
@@ -869,10 +870,10 @@
869 self.decodeFile(tmpfn)870 self.decodeFile(tmpfn)
870871
871 def toggleShowPassword(self, status):872 def toggleShowPassword(self, status):
872 if status == 0:873 if status == 0:
873 self.wifiPasswordEdit.setEchoMode(QtWidgets.QLineEdit.Password)874 self.wifiPasswordEdit.setEchoMode(QtWidgets.QLineEdit.Password)
874 elif status == 2:875 elif status == 2:
875 self.wifiPasswordEdit.setEchoMode(QtWidgets.QLineEdit.Normal)876 self.wifiPasswordEdit.setEchoMode(QtWidgets.QLineEdit.Normal)
876877
877class VideoDevices(QtWidgets.QDialog):878class VideoDevices(QtWidgets.QDialog):
878 def __init__(self):879 def __init__(self):
@@ -924,7 +925,7 @@
924 app = QtWidgets.QApplication(sys.argv)925 app = QtWidgets.QApplication(sys.argv)
925 # This is to make Qt use locale configuration; i.e. Standard Buttons926 # This is to make Qt use locale configuration; i.e. Standard Buttons
926 # in your system's language. 927 # in your system's language.
927 locale = unicode(QtCore.QLocale.system().name())928 locale = str(QtCore.QLocale.system().name())
928 translator=QtCore.QTranslator()929 translator=QtCore.QTranslator()
929 # translator.load(os.path.join(os.path.abspath(930 # translator.load(os.path.join(os.path.abspath(
930 # os.path.dirname(__file__)),931 # os.path.dirname(__file__)),

Subscribers

People subscribed via source and target branches