mirror of
https://github.com/correl/Transmission-XBMC.git
synced 2024-11-21 19:18:41 +00:00
Merge branch 'pr/14'
Conflicts: resources/language/Russian/strings.xml resources/lib/gui.py
This commit is contained in:
commit
6d227f0cf9
7 changed files with 55 additions and 11 deletions
|
@ -14,6 +14,7 @@
|
|||
<string id="105">Pause All</string>
|
||||
<string id="106">Start All</string>
|
||||
<string id="107">Exit</string>
|
||||
<string id="108">Settings</string>
|
||||
|
||||
<string id="110">Name</string>
|
||||
<string id="111">Status</string>
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<string id="105">Остановить все</string>
|
||||
<string id="106">Запустить все</string>
|
||||
<string id="107">Выход</string>
|
||||
<string id="108">Настойки</string>
|
||||
|
||||
<string id="110">Название</string>
|
||||
<string id="111">Статус</string>
|
||||
|
|
|
@ -30,24 +30,34 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
self.list = {}
|
||||
self.torrents = {}
|
||||
self.timer = None
|
||||
def onInit(self):
|
||||
p = xbmcgui.DialogProgress()
|
||||
p.create(_(0), _(1)) # 'Transmission', 'Connecting to Transmission'
|
||||
def get_settings(self):
|
||||
params = {
|
||||
'address': __settings__.getSetting('rpc_host'),
|
||||
'port': __settings__.getSetting('rpc_port'),
|
||||
'user': __settings__.getSetting('rpc_user'),
|
||||
'password': __settings__.getSetting('rpc_password')
|
||||
}
|
||||
return params
|
||||
def set_settings(self, params):
|
||||
__settings__.setSetting('rpc_host', params['address'])
|
||||
__settings__.setSetting('rpc_port', params['port'])
|
||||
__settings__.setSetting('rpc_user', params['user'])
|
||||
__settings__.setSetting('rpc_password', params['password'])
|
||||
def get_rpc_client(self):
|
||||
params = self.get_settings()
|
||||
import transmissionrpc
|
||||
return transmissionrpc.Client(**params)
|
||||
def onInit(self):
|
||||
p = xbmcgui.DialogProgress()
|
||||
p.create(_(0), _(1)) # 'Transmission', 'Connecting to Transmission'
|
||||
try:
|
||||
self.transmission = transmissionrpc.Client(**params)
|
||||
self.transmission = self.get_rpc_client()
|
||||
except:
|
||||
p.close()
|
||||
self.close()
|
||||
(type, e, traceback) = sys.exc_info()
|
||||
|
||||
message = _(9000) # Unexpected error
|
||||
import transmissionrpc
|
||||
if type is transmissionrpc.TransmissionError:
|
||||
if e.original:
|
||||
if e.original.code is 401:
|
||||
|
@ -65,7 +75,6 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
else:
|
||||
message = _(9000) # Unexpected error
|
||||
xbmcgui.Dialog().ok(_(2), message)
|
||||
|
||||
return False
|
||||
self.updateTorrents()
|
||||
p.close()
|
||||
|
@ -181,6 +190,26 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
|
|||
if (controlID == 117):
|
||||
# Exit button
|
||||
self.close()
|
||||
if (controlID == 118):
|
||||
# Settings button
|
||||
prev_settings = self.get_settings()
|
||||
__settings__.openSettings()
|
||||
p = xbmcgui.DialogProgress()
|
||||
p.create(_(0), _(1)) # 'Transmission', 'Connecting to Transmission'
|
||||
try:
|
||||
self.transmission = self.get_rpc_client()
|
||||
self.updateTorrents()
|
||||
p.close()
|
||||
except:
|
||||
p.close()
|
||||
xbmcgui.Dialog().ok(_(2), _(9001))
|
||||
# restore settings
|
||||
self.set_settings(prev_settings)
|
||||
try:
|
||||
self.transmission = self.get_rpc_client()
|
||||
except err:
|
||||
xbmcgui.Dialog().ok(_(2), _(9001))
|
||||
self.close()
|
||||
if (controlID == 120):
|
||||
# A torrent was chosen, show details
|
||||
item = list.getSelectedItem()
|
||||
|
|
|
@ -135,8 +135,8 @@
|
|||
<texturefocus>startall-focus.png</texturefocus>
|
||||
<texturenofocus>startall-nofocus.png</texturenofocus>
|
||||
</control>
|
||||
<control type="button" id="117">
|
||||
<description>Exit</description>
|
||||
<control type="button" id="118">
|
||||
<description>Settings</description>
|
||||
<posx>0</posx>
|
||||
<posy>450</posy>
|
||||
<height>70</height>
|
||||
|
@ -144,12 +144,12 @@
|
|||
<align>center</align>
|
||||
<aligny>top</aligny>
|
||||
<textoffsety>45</textoffsety>
|
||||
<label>SCRIPT107</label>
|
||||
<label>SCRIPT108</label>
|
||||
<font>font12_title</font>
|
||||
<onright>120</onright>
|
||||
<onup>116</onup>
|
||||
<texturefocus>exit-focus.png</texturefocus>
|
||||
<texturenofocus>exit-nofocus.png</texturenofocus>
|
||||
<texturefocus>settings-focus.png</texturefocus>
|
||||
<texturenofocus>settings-nofocus.png</texturenofocus>
|
||||
<ondown>111</ondown>
|
||||
</control>
|
||||
</control>
|
||||
|
@ -275,5 +275,18 @@
|
|||
</control>
|
||||
</focusedlayout>
|
||||
</control>
|
||||
<control type="button" id="117">
|
||||
<description>Exit</description>
|
||||
<posx>850</posx>
|
||||
<posy>-5</posy>
|
||||
<height>32</height>
|
||||
<width>64</width>
|
||||
<textoffsety>45</textoffsety>
|
||||
<label>-</label>
|
||||
<font>-</font>
|
||||
<texturefocus>DialogCloseButton-focus.png</texturefocus>
|
||||
<texturenofocus>DialogCloseButton.png</texturenofocus>
|
||||
<visible>system.getbool(input.enablemouse)</visible>
|
||||
</control>
|
||||
</controls>
|
||||
</window>
|
||||
|
|
BIN
resources/skins/Default/media/icons/configure.png
Normal file
BIN
resources/skins/Default/media/icons/configure.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
resources/skins/Default/media/settings-focus.png
Normal file
BIN
resources/skins/Default/media/settings-focus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
BIN
resources/skins/Default/media/settings-nofocus.png
Normal file
BIN
resources/skins/Default/media/settings-nofocus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Loading…
Reference in a new issue