-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewer.py
77 lines (54 loc) · 1.88 KB
/
viewer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#
# Copyright (C) 2014-2015
# Sean Poyser ([email protected])
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with XBMC; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
#
import xbmcgui
import xbmcaddon
class Viewer(xbmcgui.WindowXMLDialog):
ACTION_EXIT = (9, 10, 247, 275, 61467, 216, 257, 61448)
def __init__(self, *args, **kwargs):
pass
def onInit(self):
self.getControl(1000).setImage(self.fanart)
self.getControl(1100).setImage(self.thumb)
self.setFocus(self.getControl(2000))
def onClick(self, controlId):
self.close()
pass
def onFocus(self, controlId):
pass
def onAction(self, action):
actionId = action.getId()
buttonId = action.getButtonCode()
if buttonId in self.ACTION_EXIT or actionId in self.ACTION_EXIT:
self.close()
if actionId != 107:
self.close()
def show(fanart, thumb, addon=None):
try:
if addon:
path = xbmcaddon.Addon(addon).getAddonInfo('path')
else:
path = xbmcaddon.Addon().getAddonInfo('path')
v = Viewer('viewer.xml', path, 'Default')
v.fanart = fanart
v.thumb = thumb
v.doModal()
del v
except:
pass