mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-12-22 14:05:23 +01:00
added qrcode for dropbox setup
This commit is contained in:
parent
4b066432be
commit
382dbce4ac
@ -1,11 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="script.xbmcbackup"
|
||||
name="Backup" version="1.6.7~beta1" provider-name="robweber">
|
||||
name="Backup" version="1.6.7~beta2" provider-name="robweber">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="3.0.0"/>
|
||||
<import addon="script.module.dateutil" version="2.8.0" />
|
||||
<import addon="script.module.future" version="0.18.2+matrix.1" />
|
||||
<import addon="script.module.dropbox" version="9.4.0" />
|
||||
<import addon="script.module.pyqrcode" version="1.2.1+matrix.1" />
|
||||
</requires>
|
||||
<extension point="xbmc.python.script" library="default.py">
|
||||
<provides>executable</provides>
|
||||
@ -91,6 +92,7 @@
|
||||
</assets>
|
||||
<news>Version 1.6.7
|
||||
- fixed issue with RunScript not launching Advanced Editor in some cases
|
||||
- added qr code for Dropbox setup
|
||||
</news>
|
||||
</extension>
|
||||
</addon>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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))
|
||||
|
74
resources/skins/default/1080i/script-backup-qrcode.xml
Normal file
74
resources/skins/default/1080i/script-backup-qrcode.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<window>
|
||||
<coordinates>
|
||||
<left>502</left>
|
||||
<top>345</top>
|
||||
</coordinates>
|
||||
<controls>
|
||||
<animation type="WindowOpen" reversible="false">
|
||||
<effect type="zoom" start="80" end="100" center="960,540" delay="160" tween="back" time="240" />
|
||||
<effect type="fade" delay="160" end="100" time="240" />
|
||||
</animation>
|
||||
<animation type="WindowClose" reversible="false">
|
||||
<effect type="zoom" start="100" end="80" center="960,540" easing="in" tween="back" time="240" />
|
||||
<effect type="fade" start="100" end="0" time="240" />
|
||||
</animation>
|
||||
<control type="image">
|
||||
<left>-1920</left>
|
||||
<top>-1080</top>
|
||||
<width>5760</width>
|
||||
<height>3240</height>
|
||||
<animation effect="fade" start="0" end="100" time="300">WindowOpen</animation>
|
||||
<animation effect="fade" start="100" end="0" time="200">WindowClose</animation>
|
||||
<texture colordiffuse="C2FFFFFF">background-black.png</texture>
|
||||
</control>
|
||||
<control type="image">
|
||||
<left>0</left>
|
||||
<top>0</top>
|
||||
<width>915</width>
|
||||
<height>450</height>
|
||||
<texture border="2">dialog-bg.png</texture>
|
||||
</control>
|
||||
<control type="textbox" id="502">
|
||||
<left>0</left>
|
||||
<top>20</top>
|
||||
<width>915</width>
|
||||
<height>300</height>
|
||||
<font>font12_title</font>
|
||||
<align>center</align>
|
||||
<aligny>top</aligny>
|
||||
<shadowcolor>FF000000</shadowcolor>
|
||||
</control>
|
||||
<control type="textbox" id="504">
|
||||
<left>0</left>
|
||||
<top>60</top>
|
||||
<width>915</width>
|
||||
<height>300</height>
|
||||
<font>font12_title</font>
|
||||
<align>center</align>
|
||||
<aligny>top</aligny>
|
||||
<shadowcolor>FF000000</shadowcolor>
|
||||
</control>
|
||||
<control type="image" id="501">
|
||||
<left>300</left>
|
||||
<top>80</top>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
<aspectratio aligny="center" align="center">keep</aspectratio>
|
||||
</control>
|
||||
<control type="button" id="503">
|
||||
<left>302</left>
|
||||
<top>350</top>
|
||||
<width>300</width>
|
||||
<height>90</height>
|
||||
<font>font12_title</font>
|
||||
<textcolor>FFF0F0F0</textcolor>
|
||||
<textoffsetx>20</textoffsetx>
|
||||
<label>OK</label>
|
||||
<align>center</align>
|
||||
<aligny>center</aligny>
|
||||
<texturefocus border="40" colordiffuse="FF12B2E7">dialogbutton-fo.png</texturefocus>
|
||||
<texturenofocus border="40">dialogbutton-nofo.png</texturenofocus>
|
||||
</control>
|
||||
</controls>
|
||||
</window>
|
BIN
resources/skins/default/media/background-black.png
Normal file
BIN
resources/skins/default/media/background-black.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 166 B |
BIN
resources/skins/default/media/dialog-bg.png
Normal file
BIN
resources/skins/default/media/dialog-bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/skins/default/media/dialogbutton-fo.png
Normal file
BIN
resources/skins/default/media/dialogbutton-fo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/skins/default/media/dialogbutton-nofo.png
Normal file
BIN
resources/skins/default/media/dialogbutton-nofo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue
Block a user