diff --git a/addon.xml b/addon.xml
index 400369a..59035c9 100644
--- a/addon.xml
+++ b/addon.xml
@@ -1,11 +1,12 @@
+ name="Backup" version="1.6.7~beta2" provider-name="robweber">
+
executable
@@ -91,6 +92,7 @@
Version 1.6.7
- fixed issue with RunScript not launching Advanced Editor in some cases
+ - added qr code for Dropbox setup
diff --git a/changelog.md b/changelog.md
index eb8df80..28f780f 100644
--- a/changelog.md
+++ b/changelog.md
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## [Unreleased](https://github.com/robweber/xbmcbackup/compare/matrix-1.6.5...robweber:matrix)
+### Added
+
+- added QRcode when setting up Dropbox, uses pyqrcode
+
### Fixed
- fixed issue when using ```RunScript()``` within settings to launch Advanced Editor
diff --git a/default.py b/default.py
index bef946a..8fb563d 100644
--- a/default.py
+++ b/default.py
@@ -63,7 +63,6 @@ if("mode" in params):
elif(params['mode'] == 'launcher'):
mode = LAUNCHER
-
# if mode wasn't passed in as arg, get from user
if(mode == -1):
# by default, Backup,Restore,Open Settings
diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po
index 7f6da03..95402f5 100644
--- a/resources/language/resource.language.en_gb/strings.po
+++ b/resources/language/resource.language.en_gb/strings.po
@@ -213,8 +213,8 @@ msgid "Removing backup"
msgstr "Removing backup"
msgctxt "#30056"
-msgid "Go to this URL to authorize"
-msgstr "Go to this URL to authorize"
+msgid "Scan or click this URL to authorize, click OK AFTER completion"
+msgstr "Scan or click this URL to authorize, click OK AFTER completion"
msgctxt "#30057"
msgid "Click OK AFTER completion"
diff --git a/resources/lib/authorizers.py b/resources/lib/authorizers.py
index 028b3f9..3923be9 100644
--- a/resources/lib/authorizers.py
+++ b/resources/lib/authorizers.py
@@ -1,5 +1,6 @@
import xbmcgui
import xbmcvfs
+import pyqrcode
import resources.lib.tinyurl as tinyurl
import resources.lib.utils as utils
@@ -11,6 +12,30 @@ except ImportError:
pass
+class QRCode(xbmcgui.WindowXMLDialog):
+ def __init__(self, *args, **kwargs):
+ self.image = kwargs["image"]
+ self.text = kwargs["text"]
+ self.url = kwargs['url']
+
+ def onInit(self):
+ self.imagecontrol = 501
+ self.textbox1 = 502
+ self.textbox2 = 504
+ self.okbutton = 503
+ self.showdialog()
+
+ def showdialog(self):
+ self.getControl(self.imagecontrol).setImage(self.image)
+ self.getControl(self.textbox1).setText(self.text)
+ self.getControl(self.textbox2).setText(self.url)
+ self.setFocus(self.getControl(self.okbutton))
+
+ def onClick(self, controlId):
+ if (controlId == self.okbutton):
+ self.close()
+
+
class DropboxAuthorizer:
APP_KEY = ""
APP_SECRET = ""
@@ -52,7 +77,20 @@ class DropboxAuthorizer:
# print url in log
utils.log("Authorize URL: " + url)
- xbmcgui.Dialog().ok(utils.getString(30010), '%s\n%s\n%s' % (utils.getString(30056), utils.getString(30057), str(tinyurl.shorten(url), 'utf-8')))
+
+ # create a QR Code
+ shortUrl = str(tinyurl.shorten(url), 'utf-8')
+ imageFile = xbmcvfs.translatePath(utils.data_dir() + '/qrcode.png')
+ qrIMG = pyqrcode.create(shortUrl)
+ qrIMG.png(imageFile, scale=10)
+
+ # show the dialog prompt to authorize
+ qr = QRCode("script-backup-qrcode.xml", utils.addon_dir(), "default", image=imageFile, text=utils.getString(30056), url=shortUrl)
+ qr.doModal()
+
+ # cleanup
+ del qr
+ xbmcvfs.delete(imageFile)
# get the auth code
code = xbmcgui.Dialog().input(utils.getString(30027) + ' ' + utils.getString(30103))
diff --git a/resources/skins/default/1080i/script-backup-qrcode.xml b/resources/skins/default/1080i/script-backup-qrcode.xml
new file mode 100644
index 0000000..fbff708
--- /dev/null
+++ b/resources/skins/default/1080i/script-backup-qrcode.xml
@@ -0,0 +1,74 @@
+
+
+
+ 502
+ 345
+
+
+
+
+
+
+
+
+
+
+
+ -1920
+ -1080
+ 5760
+ 3240
+ WindowOpen
+ WindowClose
+ background-black.png
+
+
+ 0
+ 0
+ 915
+ 450
+ dialog-bg.png
+
+
+ 0
+ 20
+ 915
+ 300
+ font12_title
+ center
+ top
+ FF000000
+
+
+ 0
+ 60
+ 915
+ 300
+ font12_title
+ center
+ top
+ FF000000
+
+
+ 300
+ 80
+ 300
+ 300
+ keep
+
+
+ 302
+ 350
+ 300
+ 90
+ font12_title
+ FFF0F0F0
+ 20
+
+ center
+ center
+ dialogbutton-fo.png
+ dialogbutton-nofo.png
+
+
+
diff --git a/resources/skins/default/media/background-black.png b/resources/skins/default/media/background-black.png
new file mode 100644
index 0000000..2ff1770
Binary files /dev/null and b/resources/skins/default/media/background-black.png differ
diff --git a/resources/skins/default/media/dialog-bg.png b/resources/skins/default/media/dialog-bg.png
new file mode 100644
index 0000000..e8c13eb
Binary files /dev/null and b/resources/skins/default/media/dialog-bg.png differ
diff --git a/resources/skins/default/media/dialogbutton-fo.png b/resources/skins/default/media/dialogbutton-fo.png
new file mode 100644
index 0000000..a161d6e
Binary files /dev/null and b/resources/skins/default/media/dialogbutton-fo.png differ
diff --git a/resources/skins/default/media/dialogbutton-nofo.png b/resources/skins/default/media/dialogbutton-nofo.png
new file mode 100644
index 0000000..5d24279
Binary files /dev/null and b/resources/skins/default/media/dialogbutton-nofo.png differ