[MerlinSkinThemes] - add support for globals
[enigma2-plugins.git] / merlinskinthemes / src / MerlinSkinThemes.py
1 #######################################################################
2 #
3 #  MerlinSkinThemes for Dreambox/Enigma2/Dreambox OS
4 #  Coded by marthom (c)2012 - 2018
5 #
6 #  Support: board.dreambox.tools
7 #  E-Mail: marthom@dreambox-tools.info
8 #
9 #  This plugin is open source but it is NOT free software.
10 #
11 #  This plugin may only be distributed to and executed on hardware which
12 #  is licensed by Dream Multimedia GmbH.
13 #  In other words:
14 #  It's NOT allowed to distribute any parts of this plugin or its source code in ANY way
15 #  to hardware which is NOT licensed by Dream Property.
16 #  It's NOT allowed to execute this plugin and its source code or even parts of it in ANY way
17 #  on hardware which is NOT licensed by Dream Property.
18 #
19 #  If you want to use or modify the code or parts of it,
20 #  you have to keep MY license and inform me about the modifications by mail.
21 #
22 #######################################################################
23
24 from Plugins.Plugin import PluginDescriptor
25
26 from Screens.Screen import Screen
27 from Screens.HelpMenu import HelpableScreen
28 from Screens.MessageBox import MessageBox
29 from Screens.InputBox import InputBox
30 from Screens.Standby import TryQuitMainloop
31 from Screens.ChoiceBox import ChoiceBox
32 from Screens.Console import Console
33
34 from skin import parseColor, TemplatedListFonts, componentSizes
35
36 from Components.ActionMap import ActionMap, HelpableActionMap
37 from Components.Button import Button
38 from Components.Input import Input
39 from Components.Label import Label
40 from Components.Pixmap import Pixmap
41 from Components.Sources.List import List
42 from Components.MenuList import MenuList
43 from Components.config import config, configfile, ConfigYesNo, ConfigSubsection, getConfigListEntry, ConfigSelection, ConfigNumber, ConfigText, ConfigInteger
44 from Components.ConfigList import ConfigListScreen
45
46 from enigma import eListbox, eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT, RT_HALIGN_CENTER, RT_HALIGN_RIGHT, RT_VALIGN_CENTER, getEnigmaVersionString
47
48 from Tools.HardwareInfo import HardwareInfo
49 from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_CURRENT_SKIN, SCOPE_PLUGINS, SCOPE_SYSETC, fileExists
50 from Tools.Notifications import AddPopup
51
52 import xml.etree.cElementTree as Tree
53 from xml.dom import minidom
54
55 import shutil
56 import os
57
58 # =========================================
59 PluginVersion = "v2.6.3"
60 Title = "MerlinSkinThemes "
61 Author = "by marthom"
62 # =========================================
63
64 SkinXML = config.skin.primary_skin.value
65 SkinFile = resolveFilename(SCOPE_SKIN) + SkinXML
66 SkinName = SkinXML[0:SkinXML.find("/")]
67 ThemeFile = resolveFilename(SCOPE_SKIN) + SkinName + "/themes.xml"
68 skin_user_xml = "/etc/enigma2/skin_user.xml"
69 enigmacontrol = "/var/lib/opkg/info/enigma2.control"
70 merlinChk = "/usr/share/enigma2/merlin_setup.xml"
71 GP3Chk = "/usr/lib/enigma2/python/Plugins/Bp/geminimain/gVersion.py"
72 GP4Chk = "/usr/lib/enigma2/python/Plugins/GP4/geminilocale/gVersion.py"
73 ImageCreater = "/usr/lib/enigma2/python/Components/ImageCreater.py"
74 PIL = "/usr/lib/python2.7/site-packages/PIL/Image.py"
75
76 # Liste der Vorschaubilder
77 myList = ["InfoBar", "Menu", "PluginBrowser", "ChannelSelection", "MovieSelection", "MoviePlayer", "SecondInfoBar", "GraphMultiEPG", "MessageBox", "InputBox", "ChoiceBox", "Mute", "Volume", "MerlinMusicPlayer2", "ExtLCDInfoBar", "ExtLCDEventView", "ExtLCDStandby", "ExtLCDMoviePlayer", "ExtLCDMMP2", "OLEDInfoBar", "OLEDEventView", "OLEDStandby", "OLEDMoviePlayer", "OLEDMMP2", "LCDInfoBar", "LCDEventView", "LCDStandby", "LCDMoviePlayer", "LCDMMP2"]
78
79 # Enigma2Version
80 E2ver = "not available"
81 if open("/proc/stb/info/model","rb").read() == "dm7080":
82         if fileExists(enigmacontrol):
83                 file = open(enigmacontrol, 'r')
84                 while 1:
85                         line = file.readline()
86                         if not line:break
87                         if line[:9] == "Version: ":
88                                 E2ver = line[9:-1]
89                 file.close()
90 else:
91         E2ver = getEnigmaVersionString()
92
93 # Merlin
94 Merlin = False
95 if fileExists(merlinChk):
96         Merlin = True
97
98 # GP3
99 GP3 = False
100 GP3ver = ""
101 if fileExists(GP3Chk):
102         GP3 = True
103         file = open(GP3Chk, 'r')
104         data = ""
105         while 1:
106                 line = file.readline()
107                 if not line:break
108                 data += line
109         file.close()
110         
111         data = data.split("'")
112         GP3ver = data[1]
113
114 # GP4
115 GP4 = False
116 GP4ver = ""
117 if fileExists(GP4Chk):
118         GP4 = True
119         file = open(GP4Chk, 'r')
120         data = ""
121         while 1:
122                 line = file.readline()
123                 if not line:break
124                 data += line
125         file.close()
126         
127         data = data.split("'")
128         GP4ver = data[1]
129
130 # ImageCreate
131 ImgCreate = False
132 if fileExists(ImageCreater) and fileExists(PIL):
133         from Components.ImageCreater import imageCreater
134         ImgCreate = True
135
136 # Arm/mipsel/aarch64
137 if HardwareInfo().get_device_name() in ('dm900', 'dm920'):
138         ArchArm = True
139         ArchMipsel = False
140         Arch64 = False
141 else:
142         if HardwareInfo().get_device_name() in ('one', 'two'):
143                 Arch64 = True
144                 ArchMipsel = False
145                 ArchArm = False
146         else:
147                 ArchArm = False
148                 ArchMipsel = True
149                 Arch64 = False
150
151 print "------------------------------------------------"
152 print HardwareInfo().get_device_name()
153 print "------------------------------------------------"
154
155 # skin_user.xml
156 SkinUser = False
157 if fileExists(skin_user_xml):
158         SkinUser = True
159         
160 config.plugins.MerlinSkinThemes = ConfigSubsection()
161 config.plugins.MerlinSkinThemes.Skin = ConfigText(default=SkinName)
162 config.plugins.MerlinSkinThemes.selSkin = ConfigText(default=SkinName)
163 config.plugins.MerlinSkinThemes.ComponentTheme = ConfigText(default="")
164 config.plugins.MerlinSkinThemes.LayoutTheme = ConfigText(default="")
165 config.plugins.MerlinSkinThemes.GlobalsTheme = ConfigText(default="")
166 config.plugins.MerlinSkinThemes.ColorTheme = ConfigText(default="")
167 config.plugins.MerlinSkinThemes.SkinPathTheme = ConfigText(default="")
168 config.plugins.MerlinSkinThemes.FontTheme = ConfigText(default="")
169 config.plugins.MerlinSkinThemes.BorderSetTheme = ConfigText(default="")
170 config.plugins.MerlinSkinThemes.WindowStyleScrollbarTheme = ConfigText(default="")
171 config.plugins.MerlinSkinThemes.InfoBar = ConfigText(default="")
172 config.plugins.MerlinSkinThemes.Menu = ConfigText(default="")
173 config.plugins.MerlinSkinThemes.PluginBrowser = ConfigText(default="")
174 config.plugins.MerlinSkinThemes.ChannelSelection = ConfigText(default="")
175 config.plugins.MerlinSkinThemes.MovieSelection = ConfigText(default="")
176 config.plugins.MerlinSkinThemes.MoviePlayer = ConfigText(default="")
177 config.plugins.MerlinSkinThemes.SecondInfoBar = ConfigText(default="")
178 config.plugins.MerlinSkinThemes.GraphMultiEPG = ConfigText(default="")
179 config.plugins.MerlinSkinThemes.MessageBox = ConfigText(default="")
180 config.plugins.MerlinSkinThemes.InputBox = ConfigText(default="")
181 config.plugins.MerlinSkinThemes.ChoiceBox = ConfigText(default="")
182 config.plugins.MerlinSkinThemes.Mute = ConfigText(default="")
183 config.plugins.MerlinSkinThemes.Volume = ConfigText(default="")
184 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen = ConfigText(default="")
185 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_MIPSEL = ConfigText(default="")
186 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_ARM = ConfigText(default="")
187 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_AARCH64 = ConfigText(default="")
188 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver = ConfigText(default="")
189 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_MIPSEL = ConfigText(default="")
190 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_ARM = ConfigText(default="")
191 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_ARCH64 = ConfigText(default="")
192 config.plugins.MerlinSkinThemes.ExtLCDInfoBar = ConfigText(default="")
193 config.plugins.MerlinSkinThemes.ExtLCDEventView = ConfigText(default="")
194 config.plugins.MerlinSkinThemes.ExtLCDStandby = ConfigText(default="")
195 config.plugins.MerlinSkinThemes.ExtLCDMoviePlayer = ConfigText(default="")
196 config.plugins.MerlinSkinThemes.ExtLCDMMP2 = ConfigText(default="")
197 config.plugins.MerlinSkinThemes.OLEDInfoBar = ConfigText(default="")
198 config.plugins.MerlinSkinThemes.OLEDEventView = ConfigText(default="")
199 config.plugins.MerlinSkinThemes.OLEDStandby = ConfigText(default="")
200 config.plugins.MerlinSkinThemes.OLEDMoviePlayer = ConfigText(default="")
201 config.plugins.MerlinSkinThemes.OLEDMMP2 = ConfigText(default="")
202 config.plugins.MerlinSkinThemes.LCDInfoBar = ConfigText(default="")
203 config.plugins.MerlinSkinThemes.LCDEventView = ConfigText(default="")
204 config.plugins.MerlinSkinThemes.LCDStandby = ConfigText(default="")
205 config.plugins.MerlinSkinThemes.LCDMoviePlayer = ConfigText(default="")
206 config.plugins.MerlinSkinThemes.LCDMMP2 = ConfigText(default="")
207 config.plugins.MerlinSkinThemes.PNGTheme = ConfigText(default="")
208 config.plugins.MerlinSkinThemes.ShowPrevPNG = ConfigText(default="1")
209 config.plugins.MerlinSkinThemes.CornerRadius = ConfigText(default="")
210
211 class MerlinSkinThemes(Screen, HelpableScreen, ConfigListScreen):
212         skin = """
213                 <screen position="center,center" size="1920,1080" title="%s" backgroundColor="#00808080" >
214                         <widget name="DescLabel" position="10,10" size="1900,40" font="Regular;26" zPosition="2" valign="center" halign="center" />
215
216                         <widget name="ListLabel" position="10,60" size="945,40" font="Regular;26" zPosition="2" valign="center" halign="left" />
217                         <widget name="ImageInfo" position="965,60" size="945,40" font="Regular;26" zPosition="2" halign="left" />
218                         
219                         <widget name="SkinsList" position="10,110" size="945,910" scrollbarMode="showOnDemand" zPosition="1" />
220                         <widget name="config" position="10,110" size="945,910" scrollbarMode="showOnDemand" zPosition="1" /> 
221
222                         <widget name="SkinCopyright" position="965,110" size="945,200" font="Regular;18" zPosition="2" halign="left" />
223                         <widget name="Preview" position="965,320" size="945,700" alphatest="blend" />
224                         
225                         <widget name="key_red" position="10,1030" size="200,40" valign="center" halign="center" zPosition="3" transparent="1" font="Regular;24" />
226                         <widget name="key_green" position="258,1030" size="200,40" valign="center" halign="center" zPosition="3" transparent="1" font="Regular;24" />
227                         <widget name="key_yellow" position="506,1030" size="200,40" valign="center" halign="center" zPosition="3" transparent="1" font="Regular;24" />
228                         <widget name="key_blue" position="755,1030" size="200,40" valign="center" halign="center" zPosition="3" transparent="1" font="Regular;24" />
229
230                         <ePixmap name="red" position="10,1030" zPosition="1" size="200,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="blend" />
231                         <ePixmap name="green" position="258,1030" zPosition="1" size="200,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="blend" />
232                         <ePixmap name="yellow" position="506,1030" zPosition="1" size="200,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="blend" />
233                         <ePixmap name="blue" position="755,1030" zPosition="1" size="200,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="blend" />
234                 </screen>"""% _("MerlinSkinThemes")
235
236         ThemeName = ""
237         selSkinName = ""
238         selThemeFile = ""
239         
240         def __init__(self, session):
241                 print "[MST] " + PluginVersion + " running..."
242                 
243                 self.session = session
244                 
245                 Screen.__init__(self, session)
246                 HelpableScreen.__init__(self)
247                 
248                 self.clist = []
249                 ConfigListScreen.__init__(self, self.clist)
250                 
251                 self.setTitle(Title + " " + PluginVersion + " - " + Author)
252
253                 if not SkinUser:
254                         self["ListLabel"] = Label(_("Skinlist") )
255                 else:
256                         self["ListLabel"] = Label(_("Skinlist") + " - ATTENTION: skin_user.xml found!!!")
257                 
258                 self["DescLabel"] = Label(Title + " " + PluginVersion + " " + Author)
259                 self["SkinCopyright"] = Label()
260                 self["Preview"] = Pixmap()
261                 self["ImageInfo"] = Label()
262                 
263                 self.curList = "SkinsList"
264                 
265                 self["key_red"] = Button(_("exit"))
266                 self["key_green"] = Button(_("switch to skin"))
267                 self["key_yellow"] = Button(_("save as design"))
268                 self["key_blue"] = Button(_(" "))
269                 
270                 self["SkinsList"] = GetSkinsList([])
271
272                 self.onSelectionChanged = [ ]
273                 
274                 self["ColorActions"] = HelpableActionMap(self, "ColorActions",
275                 {
276                         "red":     self.buttonRed,
277                         "green":   self.buttonGreen,
278                         "yellow":  self.buttonYellow,
279                 }, -1)
280                 
281                 self["DirectionActions"] = HelpableActionMap(self, "DirectionActions",
282                 {
283                         "up":           (self.up, _("Move cursor up")),
284                         "down":         (self.down, _("Move cursor down")),
285                         "left":         (self.left, _("Move cursor left")),
286                         "right":        (self.right, _("Move cursor right")),
287                 }, -1)
288
289                 self["OkCancelActions"] = HelpableActionMap(self, "OkCancelActions",
290                 {
291                         "ok":           (self.ok, _("")),
292                         "cancel":       (self.exit, _("Close plugin")),
293                 }, -1)
294
295                 self["TeleTextActions"] = HelpableActionMap(self, "TeleTextActions",
296                 {
297                         "help":         (self.Help, _("")),
298                         "info":         (self.Info, _("")),
299                 }, -1)
300
301                 self["MenuActions"] = HelpableActionMap(self, "MenuActions",
302                 {
303                         "menu":         (self.MSTMenu, _("")),
304                 }, -1)
305                 
306                 self.updateSkinList()
307                 
308                 MerlinSkinThemes.selSkinName = self["SkinsList"].getCurrent()[1][7]
309                 MerlinSkinThemes.selSkinFile = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/skin.xml"
310                 MerlinSkinThemes.selThemeFile = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/themes.xml"
311                 
312                 self.onLayoutFinish.append(self.startRun)
313
314         def startRun(self):
315                 self["SkinsList"].onSelectionChanged.append(self.changedSkinsList)
316
317                 MerlinSkinThemes.selSkinName = self["SkinsList"].getCurrent()[1][7]
318                 MerlinSkinThemes.selSkinFile = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/skin.xml"
319                 MerlinSkinThemes.selThemeFile = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/themes.xml"
320                 
321                 self["config"].hide()
322                 
323                 try:
324                         self["SkinsList"].up()
325                         listend = self["SkinsList"].getSelectionIndex()
326                         self["SkinsList"].moveToIndex(0)
327                         activeItem = 0
328                         for index in range(listend):
329                                 self["SkinsList"].moveToIndex(index)
330                                 if self["SkinsList"].getCurrent()[1][7] == SkinName:
331                                         activeItem = index
332                                 
333                         self["SkinsList"].moveToIndex(activeItem)
334                 except:
335                         self["SkinsList"].moveToIndex(0)
336
337                 self.ImageInfo()
338                 if fileExists(MerlinSkinThemes.selSkinFile):
339                         self.CopyrightInfo()
340
341
342         def readThemes(self):
343                 defaultdesign = None
344                 defaultcomponenttheme = None
345                 defaultlayouttheme = None
346                 defaultglobalstheme = None
347                 defaultcolortheme = None
348                 defaultskinpaththeme = None
349                 defaultfonttheme = None
350                 defaultbordersettheme = None
351                 defaultwindowstylescrollbartheme = None
352                 defaultinfobar = None
353                 defaultmenu = None
354                 defaultpluginbrowser = None
355                 defaultchannelselection = None
356                 defaultmovieselection = None
357                 defaultmovieplayer = None
358                 defaultsecondinfobar = None
359                 defaultgraphmultiepg = None
360                 defaulteventview = None
361                 defaultepgselection = None
362                 defaultmessagebox = None
363                 defaultinputbox = None
364                 defaultchoicebox = None
365                 defaultmute = None
366                 defaultvolume = None
367                 defaultmmp2 = None
368                 defaultmmp2mipsel = None
369                 defaultmmp2arm = None
370                 defaultmmp2saver = None
371                 defaultmmp2savermipsel = None
372                 defaultmmp2saverarm = None
373                 defaultmmp2saverarch64 = None
374                 defaultextlcdinfobar = None
375                 defaultextlcdeventview = None
376                 defaultextlcdstandby = None
377                 defaultextlcdmovieplayer = None
378                 defaultextlcdmmp2 = None
379                 defaultoledinfobar = None
380                 defaultoledeventview = None
381                 defaultoledstandby = None
382                 defaultoledmovieplayer = None
383                 defaultoledmmp2 = None
384                 defaultlcdinfobar = None
385                 defaultlcdeventview = None
386                 defaultlcdstandby = None
387                 defaultlcdmovieplayer = None
388                 defaultlcdmmp2 = None
389                 defaultpngtheme = None
390                 defaultcornerradius = None
391                 
392                 self.clist = []
393
394                 try:
395                         xml = Tree.parse(MerlinSkinThemes.selThemeFile)
396
397                         selSkinList = []
398                         selSkinList.append(MerlinSkinThemes.selSkinName)
399                         config.plugins.MerlinSkinThemes.selSkin = MyConfigSelection(default=MerlinSkinThemes.selSkinName, choices = selSkinList)
400                         self.clist.append(getConfigListEntry(_(" "), ))
401                         self.clist.append(getConfigListEntry("Skin", config.plugins.MerlinSkinThemes.selSkin))
402                         
403                         # Designs
404                         self.clist.append(getConfigListEntry(_(" "), ))
405                         self.clist.append(getConfigListEntry(_(" " + u'\u00b7' + " DESIGNS"), ))
406
407                         DesignList = []
408                         if xml.find("designs") is not None:
409                                 DesignList.append("-none-")
410                                 ds = xml.find("designs")
411                                 for design in ds.findall("design"):
412                                         DesignList.append(design.get("name"))
413                                         defaultdesign = "-none-"
414
415                         if len(DesignList) > 0:
416                                 self.MSTDesigns = MyConfigSelection(default=defaultdesign, choices = DesignList)
417                                 config.plugins.MerlinSkinThemes.Design = self.MSTDesigns
418                                 self.clist.append(getConfigListEntry("Design", self.MSTDesigns))
419                         else:
420                                 self.MSTDesigns = MyConfigSelection(default=defaultdesign, choices = ["-none-"])
421                                 config.plugins.MerlinSkinThemes.Design = self.MSTDesigns
422                                 self.clist.append(getConfigListEntry("Design", self.MSTDesigns))
423
424                         # Themes
425                         self.clist.append(getConfigListEntry(_(" "), ))
426                         self.clist.append(getConfigListEntry(_(" " + u'\u00b7' + " THEMES"), ))
427
428                         # COLOR
429                         ColorThemeList = []
430                         if xml.find("colortheme") is not None:
431                                 for theme in xml.findall("colortheme"):
432                                         ColorThemeList.append(theme.get("name"))
433                                         if theme.get("value") == "active":
434                                                 defaultcolortheme = theme.get("name")
435
436                         if len(ColorThemeList) > 0:
437                                 self.TColor = MyConfigSelection(default=defaultcolortheme, choices = ColorThemeList)
438                                 config.plugins.MerlinSkinThemes.ColorTheme = self.TColor
439                                 self.clist.append(getConfigListEntry("ColorTheme", self.TColor))
440
441                         # SkinPathTheme
442                         SkinPathThemeList = []
443                         if xml.find("skinpaththemes") is not None:
444                                 spt = xml.find("skinpaththemes")
445                                 for theme in spt.findall("theme"):
446                                         SkinPathThemeList.append(theme.get("name"))
447                                         if theme.get("value") == "active":
448                                                 defaultskinpaththeme = theme.get("name")
449
450                         if len(SkinPathThemeList) > 0:
451                                 self.SPath = MyConfigSelection(default=defaultskinpaththeme, choices = SkinPathThemeList)
452                                 config.plugins.MerlinSkinThemes.SkinPathTheme = self.SPath
453                                 self.clist.append(getConfigListEntry("SkinPathTheme", self.SPath))
454
455                         # FONT
456                         FontThemeList = []
457                         if xml.find("fonttheme") is not None:
458                                 for theme in xml.findall("fonttheme"):
459                                         FontThemeList.append(theme.get("name"))
460                                         if theme.get("value") == "active":
461                                                 defaultfonttheme = theme.get("name")
462
463                         if len(FontThemeList) > 0:
464                                 self.TFont = MyConfigSelection(default=defaultfonttheme, choices = FontThemeList)
465                                 config.plugins.MerlinSkinThemes.FontTheme = self.TFont
466                                 self.clist.append(getConfigListEntry("FontTheme", self.TFont))
467
468                         # BORDERSET
469                         BorderSetThemeList = []
470                         if xml.find("bordersettheme") is not None:
471                                 for theme in xml.findall("bordersettheme"):
472                                         BorderSetThemeList.append(theme.get("name"))
473                                         if theme.get("value") == "active":
474                                                 defaultbordersettheme = theme.get("name")
475
476                         if len(BorderSetThemeList) > 0:
477                                 self.TBorder = MyConfigSelection(default=defaultbordersettheme, choices = BorderSetThemeList)
478                                 config.plugins.MerlinSkinThemes.BorderSetTheme = self.TBorder
479                                 self.clist.append(getConfigListEntry("BorderSetTheme", self.TBorder))
480                                 
481                         # WINDOSTYLESCROLLBAR
482                         WindowStyleScrollbarThemeList = []
483                         if xml.find("windowstylescrollbartheme") is not None:
484                                 for theme in xml.findall("windowstylescrollbartheme"):
485                                         WindowStyleScrollbarThemeList.append(theme.get("name"))
486                                         if theme.get("value") == "active":
487                                                 defaultwindowstylescrollbartheme = theme.get("name")
488
489                         if len(WindowStyleScrollbarThemeList) > 0:
490                                 self.TScroll = MyConfigSelection(default=defaultwindowstylescrollbartheme, choices = WindowStyleScrollbarThemeList)
491                                 config.plugins.MerlinSkinThemes.WindowStyleScrollbarTheme = self.TScroll
492                                 self.clist.append(getConfigListEntry("WindowStyleScrollbarTheme", self.TScroll))
493
494                         # PNG
495                         PNGThemeList = []
496                         if xml.find("pngtheme") is not None:
497                                 for theme in xml.findall("pngtheme"):
498                                         PNGThemeList.append(theme.get("name"))
499                                         if theme.get("value") == "active":
500                                                 defaultpngtheme = theme.get("name")
501
502                         if len(PNGThemeList) > 0:
503                                 self.TPNG = MyConfigSelection(default=defaultpngtheme, choices = PNGThemeList)
504                                 config.plugins.MerlinSkinThemes.PNGTheme = self.TPNG
505                                 self.clist.append(getConfigListEntry("PNGTheme", self.TPNG))
506
507                         # COMPONENTS
508                         ComponentsThemeList = []
509                         if xml.find("componenttheme") is not None:
510                                 for theme in xml.findall("componenttheme"):
511                                         ComponentsThemeList.append(theme.get("name"))
512                                         if theme.get("value") == "active":
513                                                 defaultcomponenttheme = theme.get("name")
514
515                         if len(ComponentsThemeList) > 0:
516                                 self.TComponent = MyConfigSelection(default=defaultcomponenttheme, choices = ComponentsThemeList)
517                                 config.plugins.MerlinSkinThemes.ComponentTheme = self.TComponent
518                                 self.clist.append(getConfigListEntry("ComponentTheme", self.TComponent))
519                         
520                         # LAYOUTS
521                         LayoutsThemeList = []
522                         if xml.find("layouttheme") is not None:
523                                 for theme in xml.findall("layouttheme"):
524                                         LayoutsThemeList.append(theme.get("name"))
525                                         if theme.get("value") == "active":
526                                                 defaultlayouttheme = theme.get("name")
527
528                         if len(LayoutsThemeList) > 0:
529                                 self.TLayout = MyConfigSelection(default=defaultlayouttheme, choices = LayoutsThemeList)
530                                 config.plugins.MerlinSkinThemes.LayoutTheme = self.TLayout
531                                 self.clist.append(getConfigListEntry("LayoutTheme", self.TLayout))
532
533                         # GLOBALS
534                         GlobalsThemeList = []
535                         if xml.find("globalstheme") is not None:
536                                 for theme in xml.findall("globalstheme"):
537                                         GlobalsThemeList.append(theme.get("name"))
538                                         if theme.get("value") == "active":
539                                                 defaultglobalstheme = theme.get("name")
540
541                         if len(GlobalsThemeList) > 0:
542                                 self.TGlobals = MyConfigSelection(default=defaultglobalstheme, choices = GlobalsThemeList)
543                                 config.plugins.MerlinSkinThemes.GlobalsTheme = self.TGlobals
544                                 self.clist.append(getConfigListEntry("GlobalsTheme", self.TGlobals))
545                         
546                         # SCREENS
547                         self.clist.append(getConfigListEntry(_(" "), ))
548                         self.clist.append(getConfigListEntry(_(" " + u'\u00b7' + " SCREENS"), ))
549
550                         if xml.find("screenthemes") is not None:
551                                 #-----------
552                                 # INFOBAR
553                                 InfoBarList = []
554                                 st = xml.find("screenthemes")
555                                 for screens in st.findall("screens"):
556                                         if screens.get("name") == "InfoBar":
557                                                 for themes in screens.findall("screentheme"):
558                                                         InfoBarList.append(themes.get("name"))
559                                                         if themes.get("value") == "active":
560                                                                 defaultinfobar = themes.get("name")
561
562                                 if len(InfoBarList) > 0:
563                                         self.SInfobar = MyConfigSelection(default=defaultinfobar, choices = InfoBarList)
564                                         config.plugins.MerlinSkinThemes.InfoBar = self.SInfobar
565                                         self.clist.append(getConfigListEntry("InfoBar", self.SInfobar))
566
567                                 #-----------
568                                 # Menue
569                                 MenuList = []
570                                 st = xml.find("screenthemes")
571                                 for screens in st.findall("screens"):
572                                         if screens.get("name") == "Menu":
573                                                 for themes in screens.findall("screentheme"):
574                                                         MenuList.append(themes.get("name"))
575                                                         if themes.get("value") == "active":
576                                                                 defaultmenu = themes.get("name")
577
578                                 if len(MenuList) > 0:
579                                         self.SMenu = MyConfigSelection(default=defaultmenu, choices = MenuList)
580                                         config.plugins.MerlinSkinThemes.Menu = self.SMenu
581                                         self.clist.append(getConfigListEntry("Menu", self.SMenu))
582
583                                 #-----------
584                                 # PluginBrowser
585                                 PluginBrowserList = []
586                                 st = xml.find("screenthemes")
587                                 for screens in st.findall("screens"):
588                                         if screens.get("name") == "PluginBrowser":
589                                                 for themes in screens.findall("screentheme"):
590                                                         PluginBrowserList.append(themes.get("name"))
591                                                         if themes.get("value") == "active":
592                                                                 defaultpluginbrowser = themes.get("name")
593
594                                 if len(PluginBrowserList) > 0:
595                                         self.SPluginBrowser = MyConfigSelection(default=defaultpluginbrowser, choices = PluginBrowserList)
596                                         config.plugins.MerlinSkinThemes.PluginBrowser = self.SPluginBrowser
597                                         self.clist.append(getConfigListEntry("PluginBrowser", self.SPluginBrowser))
598
599                                 #-----------
600                                 # CHANNELSELECTION
601                                 ChannelSelectionList = []
602                                 st = xml.find("screenthemes")
603                                 for screens in st.findall("screens"):
604                                         if screens.get("name") == "ChannelSelection":
605                                                 for themes in screens.findall("screentheme"):
606                                                         ChannelSelectionList.append(themes.get("name"))
607                                                         if themes.get("value") == "active":
608                                                                 defaultchannelselection = themes.get("name")
609
610                                 if len(ChannelSelectionList) > 0:
611                                         self.SChannelSel = MyConfigSelection(default=defaultchannelselection, choices = ChannelSelectionList)
612                                         config.plugins.MerlinSkinThemes.ChannelSelection = self.SChannelSel
613                                         self.clist.append(getConfigListEntry("ChannelSelection", self.SChannelSel))
614
615                                 #-----------
616                                 # MOVIESELECTION
617                                 MovieSelectionList = []
618                                 st = xml.find("screenthemes")
619                                 for screens in st.findall("screens"):
620                                         if screens.get("name") == "MovieSelection":
621                                                 for themes in screens.findall("screentheme"):
622                                                         MovieSelectionList.append(themes.get("name"))
623                                                         if themes.get("value") == "active":
624                                                                 defaultmovieselection = themes.get("name")
625
626                                 if len(MovieSelectionList) > 0:
627                                         self.SMovieSel = MyConfigSelection(default=defaultmovieselection, choices = MovieSelectionList)
628                                         config.plugins.MerlinSkinThemes.MovieSelection = self.SMovieSel
629                                         self.clist.append(getConfigListEntry("MovieSelection", self.SMovieSel))
630
631                                 #-----------
632                                 # MOVIEPLAYER
633                                 MoviePlayerList = []
634                                 st = xml.find("screenthemes")
635                                 for screens in st.findall("screens"):
636                                         if screens.get("name") == "MoviePlayer":
637                                                 for themes in screens.findall("screentheme"):
638                                                         MoviePlayerList.append(themes.get("name"))
639                                                         if themes.get("value") == "active":
640                                                                 defaultmovieplayer = themes.get("name")
641
642                                 if len(MoviePlayerList) > 0:
643                                         self.SMoviePlay = MyConfigSelection(default=defaultmovieplayer, choices = MoviePlayerList)
644                                         config.plugins.MerlinSkinThemes.MoviePlayer = self.SMoviePlay           
645                                         self.clist.append(getConfigListEntry("MoviePlayer", self.SMoviePlay))
646
647                                 #-----------
648                                 # SECONDINFOBAR
649                                 SecondInfoBarList = []
650                                 st = xml.find("screenthemes")
651                                 for screens in st.findall("screens"):
652                                         if screens.get("name") == "SecondInfoBar":
653                                                 for themes in screens.findall("screentheme"):
654                                                         SecondInfoBarList.append(themes.get("name"))
655                                                         if themes.get("value") == "active":
656                                                                 defaultsecondinfobar = themes.get("name")
657
658                                 if len(SecondInfoBarList) > 0:
659                                         self.S2IB = MyConfigSelection(default=defaultsecondinfobar, choices = SecondInfoBarList)
660                                         config.plugins.MerlinSkinThemes.SecondInfoBar = self.S2IB
661                                         self.clist.append(getConfigListEntry("SecondInfoBar", self.S2IB))
662
663                                 #-----------
664                                 # GraphMultiEPG
665                                 
666                                 GraphMultiEPGList = []
667                                 st = xml.find("screenthemes")
668                                 for screens in st.findall("screens"):
669                                         if screens.get("name") == "GraphMultiEPG":
670                                                 for themes in screens.findall("screentheme"):
671                                                         GraphMultiEPGList.append(themes.get("name"))
672                                                         if themes.get("value") == "active":
673                                                                 defaultgraphmultiepg = themes.get("name")
674
675                                 if len(GraphMultiEPGList) > 0:
676                                         self.graphmultiepg = MyConfigSelection(default=defaultgraphmultiepg, choices = GraphMultiEPGList)
677                                         config.plugins.MerlinSkinThemes.GraphMultiEPG = self.graphmultiepg
678                                         self.clist.append(getConfigListEntry("GraphMultiEPG", self.graphmultiepg))
679
680                                 #-----------
681                                 # EventView
682                                 EventViewList = []
683                                 st = xml.find("screenthemes")
684                                 for screens in st.findall("screens"):
685                                         if screens.get("name") == "EventView":
686                                                 for themes in screens.findall("screentheme"):
687                                                         EventViewList.append(themes.get("name"))
688                                                         if themes.get("value") == "active":
689                                                                 defaulteventview = themes.get("name")
690
691                                 if len(EventViewList) > 0:
692                                         self.EventView = MyConfigSelection(default=defaulteventview, choices = EventViewList)
693                                         config.plugins.MerlinSkinThemes.EventView = self.EventView
694                                         self.clist.append(getConfigListEntry("EventView", self.EventView))
695
696                                 #-----------
697                                 # EPGSelection
698                                 EPGSelectionList = []
699                                 st = xml.find("screenthemes")
700                                 for screens in st.findall("screens"):
701                                         if screens.get("name") == "EPGSelection":
702                                                 for themes in screens.findall("screentheme"):
703                                                         EPGSelectionList.append(themes.get("name"))
704                                                         if themes.get("value") == "active":
705                                                                 defaultepgselection = themes.get("name")
706
707                                 if len(EPGSelectionList) > 0:
708                                         self.EPGSelection = MyConfigSelection(default=defaultepgselection, choices = EPGSelectionList)
709                                         config.plugins.MerlinSkinThemes.EPGSelection = self.EPGSelection
710                                         self.clist.append(getConfigListEntry("EPGSelection", self.EPGSelection))
711
712                                 #-----------
713                                 # MESSAGEBOX
714                                 MessageBoxList = []
715                                 st = xml.find("screenthemes")
716                                 for screens in st.findall("screens"):
717                                         if screens.get("name") == "MessageBox":
718                                                 for themes in screens.findall("screentheme"):
719                                                         MessageBoxList.append(themes.get("name"))
720                                                         if themes.get("value") == "active":
721                                                                 defaultmessagebox = themes.get("name")
722
723                                 if len(MessageBoxList) > 0:
724                                         self.SMsgBox = MyConfigSelection(default=defaultmessagebox, choices = MessageBoxList)
725                                         config.plugins.MerlinSkinThemes.MessageBox = self.SMsgBox
726                                         self.clist.append(getConfigListEntry("MessageBox", self.SMsgBox))
727
728                                 #-----------
729                                 # INPUTBOX
730                                 InputBoxList = []
731                                 st = xml.find("screenthemes")
732                                 for screens in st.findall("screens"):
733                                         if screens.get("name") == "InputBox":
734                                                 for themes in screens.findall("screentheme"):
735                                                         InputBoxList.append(themes.get("name"))
736                                                         if themes.get("value") == "active":
737                                                                 defaultinputbox = themes.get("name")
738
739                                 if len(InputBoxList) > 0:
740                                         self.SInBox = MyConfigSelection(default=defaultinputbox, choices = InputBoxList)
741                                         config.plugins.MerlinSkinThemes.InputBox = self.SInBox
742                                         self.clist.append(getConfigListEntry("InputBox", self.SInBox))
743
744                                 #-----------
745                                 # CHOICEBOX
746                                 ChoiceBoxList = []
747                                 st = xml.find("screenthemes")
748                                 for screens in st.findall("screens"):
749                                         if screens.get("name") == "ChoiceBox":
750                                                 for themes in screens.findall("screentheme"):
751                                                         ChoiceBoxList.append(themes.get("name"))
752                                                         if themes.get("value") == "active":
753                                                                 defaultchoicebox = themes.get("name")
754
755                                 if len(ChoiceBoxList) > 0:
756                                         self.SChoiceBox = MyConfigSelection(default=defaultchoicebox, choices = ChoiceBoxList)
757                                         config.plugins.MerlinSkinThemes.ChoiceBox = self.SChoiceBox
758                                         self.clist.append(getConfigListEntry("ChoiceBox", self.SChoiceBox))
759                                         
760                                 #-----------
761                                 # MUTE
762                                 MuteList = []
763                                 st = xml.find("screenthemes")
764                                 for screens in st.findall("screens"):
765                                         if screens.get("name") == "Mute":
766                                                 for themes in screens.findall("screentheme"):
767                                                         MuteList.append(themes.get("name"))
768                                                         if themes.get("value") == "active":
769                                                                 defaultmute = themes.get("name")
770
771                                 if len(MuteList) > 0:
772                                         self.SMute = MyConfigSelection(default=defaultmute, choices = MuteList)
773                                         config.plugins.MerlinSkinThemes.Mute = self.SMute
774                                         self.clist.append(getConfigListEntry("Mute", self.SMute))
775                                         
776                                 #-----------
777                                 # VOLUME
778                                 VolumeList = []
779                                 st = xml.find("screenthemes")
780                                 for screens in st.findall("screens"):
781                                         if screens.get("name") == "Volume":
782                                                 for themes in screens.findall("screentheme"):
783                                                         VolumeList.append(themes.get("name"))
784                                                         if themes.get("value") == "active":
785                                                                 defaultvolume = themes.get("name")
786
787                                 if len(VolumeList) > 0:
788                                         self.SVolume = MyConfigSelection(default=defaultvolume, choices = VolumeList)
789                                         config.plugins.MerlinSkinThemes.Volume = self.SVolume
790                                         self.clist.append(getConfigListEntry("Volume", self.SVolume))
791                                         
792                                 #-----------
793                                 # MerlinMusicPlayer2Screen
794                                 MMP2List = []
795                                 st = xml.find("screenthemes")
796                                 for screens in st.findall("screens"):
797                                         if screens.get("name") == "MerlinMusicPlayer2Screen":
798                                                 for themes in screens.findall("screentheme"):
799                                                         MMP2List.append(themes.get("name"))
800                                                         if themes.get("value") == "active":
801                                                                 defaultmmp2 = themes.get("name")
802
803                                 if len(MMP2List) > 0:
804                                         self.SMMP2 = MyConfigSelection(default=defaultmmp2, choices = MMP2List)
805                                         config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen = self.SMMP2
806                                         self.clist.append(getConfigListEntry("MerlinMusicPlayer2Screen", self.SMMP2))
807
808                                 if ArchMipsel:
809                                         #-----------
810                                         # MerlinMusicPlayer2Screen_MIPSEL
811                                         MMP2MipselList = []
812                                         st = xml.find("screenthemes")
813                                         for screens in st.findall("screens"):
814                                                 if screens.get("name") == "MerlinMusicPlayer2Screen_MIPSEL":
815                                                         for themes in screens.findall("screentheme"):
816                                                                 MMP2MipselList.append(themes.get("name"))
817                                                                 if themes.get("value") == "active":
818                                                                         defaultmmp2mipsel = themes.get("name")
819
820                                         if len(MMP2MipselList) > 0:
821                                                 self.SMMP2Mipsel = MyConfigSelection(default=defaultmmp2mipsel, choices = MMP2MipselList)
822                                                 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_MIPSEL = self.SMMP2Mipsel
823                                                 self.clist.append(getConfigListEntry("MerlinMusicPlayer2Screen_MIPSEL", self.SMMP2Mipsel))
824
825                                 if ArchArm:
826                                         #-----------
827                                         # MerlinMusicPlayer2Screen_ARM
828                                         MMP2ArmList = []
829                                         st = xml.find("screenthemes")
830                                         for screens in st.findall("screens"):
831                                                 if screens.get("name") == "MerlinMusicPlayer2Screen_ARM":
832                                                         for themes in screens.findall("screentheme"):
833                                                                 MMP2ArmList.append(themes.get("name"))
834                                                                 if themes.get("value") == "active":
835                                                                         defaultmmp2arm = themes.get("name")
836
837                                         if len(MMP2ArmList) > 0:
838                                                 self.SMMP2Arm = MyConfigSelection(default=defaultmmp2arm, choices = MMP2ArmList)
839                                                 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_ARM = self.SMMP2Arm
840                                                 self.clist.append(getConfigListEntry("MerlinMusicPlayer2Screen_ARM", self.SMMP2Arm))
841
842                                 if Arch64:
843                                         #-----------
844                                         # MerlinMusicPlayer2Screen_AARCH64
845                                         MMP2Arch64List = []
846                                         st = xml.find("screenthemes")
847                                         for screens in st.findall("screens"):
848                                                 if screens.get("name") == "MerlinMusicPlayer2Screen_AARCH64":
849                                                         for themes in screens.findall("screentheme"):
850                                                                 MMP2Arch64List.append(themes.get("name"))
851                                                                 if themes.get("value") == "active":
852                                                                         defaultmmp2arch64 = themes.get("name")
853
854                                         if len(MMP2Arch64List) > 0:
855                                                 self.SMMP2Arch64 = MyConfigSelection(default=defaultmmp2arch64, choices = MMP2Arch64List)
856                                                 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_AARCH64 = self.SMMP2Arch64
857                                                 self.clist.append(getConfigListEntry("MerlinMusicPlayer2Screen_AARCH64", self.SMMP2Arch64))
858
859                                 #-----------
860                                 # MerlinMusicPlayer2ScreenSaver
861                                 MMP2SaverList = []
862                                 st = xml.find("screenthemes")
863                                 for screens in st.findall("screens"):
864                                         if screens.get("name") == "MerlinMusicPlayer2ScreenSaver":
865                                                 for themes in screens.findall("screentheme"):
866                                                         MMP2SaverList.append(themes.get("name"))
867                                                         if themes.get("value") == "active":
868                                                                 defaultmmp2saver = themes.get("name")
869
870                                 if len(MMP2SaverList) > 0:
871                                         self.SMMP2Saver = MyConfigSelection(default=defaultmmp2saver, choices = MMP2SaverList)
872                                         config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver = self.SMMP2Saver
873                                         self.clist.append(getConfigListEntry("MerlinMusicPlayer2ScreenSaver", self.SMMP2Saver))
874
875                                 if ArchMipsel:
876                                         #-----------
877                                         # MerlinMusicPlayer2ScreenSaver_MIPSEL
878                                         MMP2SaverMipselList = []
879                                         st = xml.find("screenthemes")
880                                         for screens in st.findall("screens"):
881                                                 if screens.get("name") == "MerlinMusicPlayer2ScreenSaver_MIPSEL":
882                                                         for themes in screens.findall("screentheme"):
883                                                                 MMP2SaverMipselList.append(themes.get("name"))
884                                                                 if themes.get("value") == "active":
885                                                                         defaultmmp2savermipsel = themes.get("name")
886
887                                         if len(MMP2SaverMipselList) > 0:
888                                                 self.SMMP2SaverMipsel = MyConfigSelection(default=defaultmmp2savermipsel, choices = MMP2SaverMipselList)
889                                                 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_MIPSEL = self.SMMP2SaverMipsel
890                                                 self.clist.append(getConfigListEntry("MerlinMusicPlayer2ScreenSaver_MIPSEL", self.SMMP2SaverMipsel))
891
892                                 if ArchArm:
893                                         #-----------
894                                         # MerlinMusicPlayer2ScreenSaver_ARM
895                                         MMP2SaverArmList = []
896                                         st = xml.find("screenthemes")
897                                         for screens in st.findall("screens"):
898                                                 if screens.get("name") == "MerlinMusicPlayer2ScreenSaver_ARM":
899                                                         for themes in screens.findall("screentheme"):
900                                                                 MMP2SaverArmList.append(themes.get("name"))
901                                                                 if themes.get("value") == "active":
902                                                                         defaultmmp2saverarm = themes.get("name")
903
904                                         if len(MMP2SaverArmList) > 0:
905                                                 self.SMMP2SaverArm = MyConfigSelection(default=defaultmmp2saverarm, choices = MMP2SaverArmList)
906                                                 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_ARM = self.SMMP2SaverArm
907                                                 self.clist.append(getConfigListEntry("MerlinMusicPlayer2ScreenSaver_ARM", self.SMMP2SaverArm))
908
909                                 if Arch64:
910                                         #-----------
911                                         # MerlinMusicPlayer2ScreenSaver_AARCH64
912                                         MMP2SaverArch64List = []
913                                         st = xml.find("screenthemes")
914                                         for screens in st.findall("screens"):
915                                                 if screens.get("name") == "MerlinMusicPlayer2ScreenSaver_AARCH64":
916                                                         for themes in screens.findall("screentheme"):
917                                                                 MMP2SaverArch64List.append(themes.get("name"))
918                                                                 if themes.get("value") == "active":
919                                                                         defaultmmp2saverarch64 = themes.get("name")
920
921                                         if len(MMP2SaverArch64List) > 0:
922                                                 self.SMMP2SaverArch64 = MyConfigSelection(default=defaultmmp2saverarch64, choices = MMP2SaverArch64List)
923                                                 config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_AARCH64 = self.SMMP2SaverArch64
924                                                 self.clist.append(getConfigListEntry("MerlinMusicPlayer2ScreenSaver_AARCH64", self.SMMP2SaverArch64))
925
926                         # LCD Screens
927                         #-----------
928                         if xml.find("lcdscreenthemes") is not None:
929                                 self.clist.append(getConfigListEntry(_(" "), ))
930                                 self.clist.append(getConfigListEntry(_(" " + u'\u00b7' + " LCD SCREENS ID=1 (8000, 7020HD, 800HD, 7080) 132x64"), ))            
931                                 # INFOBAR
932                                 LCDInfoBarList = []
933                                 st = xml.find("lcdscreenthemes")
934                                 if st.find("screens[@name='InfoBarSummary']") is not None:
935                                         lst = st.find("screens[@name='InfoBarSummary']")
936                                         for th in lst.findall("lcdscreentheme"):
937                                                 for screen in th.findall("screen"):
938                                                         if screen.get("name") == "InfoBarSummary" and screen.get("id") == "1":
939                                                                 LCDInfoBarList.append(th.get("name"))
940                                                                 if th.get("value") == "active":
941                                                                         defaultlcdinfobar = th.get("name")
942
943                                         if len(LCDInfoBarList) > 0:
944                                                 self.LSInfobar = MyConfigSelection(default=defaultlcdinfobar, choices = LCDInfoBarList)
945                                                 config.plugins.MerlinSkinThemes.LCDInfoBar = self.LSInfobar
946                                                 self.clist.append(getConfigListEntry("LCDInfoBar", self.LSInfobar))
947
948                                 #-----------
949                                 # EVENTVIEW
950                                 LCDEventViewList = []
951                                 if st.find("screens[@name='EventView_summary']") is not None:
952                                         lst = st.find("screens[@name='EventView_summary']")
953                                         for th in lst.findall("lcdscreentheme"):
954                                                 for screen in th.findall("screen"):
955                                                         if screen.get("name") == "EventView_summary" and screen.get("id") == "1":
956                                                                 LCDEventViewList.append(th.get("name"))
957                                                                 if th.get("value") == "active":
958                                                                         defaultlcdeventview = th.get("name")
959
960                                         if len(LCDEventViewList) > 0:
961                                                 self.LSEventView = MyConfigSelection(default=defaultlcdeventview, choices = LCDEventViewList)
962                                                 config.plugins.MerlinSkinThemes.LCDEventView = self.LSEventView
963                                                 self.clist.append(getConfigListEntry("LCDEventView", self.LSEventView))
964
965                                 #-----------
966                                 # STANDBY
967                                 LCDStandbyList = []
968                                 if st.find("screens[@name='StandbySummary']") is not None:
969                                         lst = st.find("screens[@name='StandbySummary']")
970                                         for th in lst.findall("lcdscreentheme"):
971                                                 for screen in th.findall("screen"):
972                                                         if screen.get("name") == "StandbySummary" and screen.get("id") == "1":
973                                                                 LCDStandbyList.append(th.get("name"))
974                                                                 if th.get("value") == "active":
975                                                                         defaultlcdstandby = th.get("name")
976
977                                         if len(LCDStandbyList) > 0:
978                                                 self.LSStandby = MyConfigSelection(default=defaultlcdstandby, choices = LCDStandbyList)
979                                                 config.plugins.MerlinSkinThemes.LCDStandby = self.LSStandby
980                                                 self.clist.append(getConfigListEntry("LCDStandby", self.LSStandby))
981                                 
982                                 #-----------
983                                 # InfoBarMoviePlayerSummary
984                                 LCDMoviePlayerList = []
985                                 if st.find("screens[@name='InfoBarMoviePlayerSummary']") is not None:
986                                         lst = st.find("screens[@name='InfoBarMoviePlayerSummary']")
987                                         for th in lst.findall("lcdscreentheme"):
988                                                 for screen in th.findall("screen"):
989                                                         if screen.get("name") == "InfoBarMoviePlayerSummary" and screen.get("id") == "1":
990                                                                 LCDMoviePlayerList.append(th.get("name"))
991                                                                 if th.get("value") == "active":
992                                                                         defaultlcdmovieplayer = th.get("name")
993
994                                         if len(LCDMoviePlayerList) > 0:
995                                                 self.LSMoviePlayer = MyConfigSelection(default=defaultlcdmovieplayer, choices = LCDMoviePlayerList)
996                                                 config.plugins.MerlinSkinThemes.LCDMoviePlayer = self.LSMoviePlayer
997                                                 self.clist.append(getConfigListEntry("LCDMoviePlayer", self.LSMoviePlayer))
998                                                 
999                                 #-----------
1000                                 # MerlinMusicPlayer2LCDScreen
1001                                 LCDMMP2List = []
1002                                 if st.find("screens[@name='MerlinMusicPlayer2LCDScreen']") is not None:
1003                                         lst = st.find("screens[@name='MerlinMusicPlayer2LCDScreen']")
1004                                         for th in lst.findall("lcdscreentheme"):
1005                                                 for screen in th.findall("screen"):
1006                                                         if screen.get("name") == "MerlinMusicPlayer2LCDScreen" and screen.get("id") == "1":
1007                                                                 LCDMMP2Lst.append(th.get("name"))
1008                                                                 if th.get("value") == "active":
1009                                                                         defaultlcdmmp2 = th.get("name")
1010
1011                                         if len(LCDMMP2List) > 0:
1012                                                 self.LSMMP2 = MyConfigSelection(default=defaultlcdmmp2, choices = LCDMMP2List)
1013                                                 config.plugins.MerlinSkinThemes.LCDMMP2 = self.LSMMP2
1014                                                 self.clist.append(getConfigListEntry("LCDMMP2", self.LSMMP2))
1015                                                 
1016                         # OLED Screens
1017                         if xml.find("oledscreenthemes") is not None:
1018                                 self.clist.append(getConfigListEntry(_(" "), ))
1019                                 self.clist.append(getConfigListEntry(_(" " + u'\u00b7' + " OLED SCREENS ID=2 (800se, 820) 96x64"), ))           
1020                                 #-----------
1021                                 # INFOBAR
1022                                 OLEDInfoBarList = []
1023                                 st = xml.find("oledscreenthemes")
1024                                 if st.find("screens[@name='InfoBarSummary']") is not None:
1025                                         ost = st.find("screens[@name='InfoBarSummary']")
1026                                         for th in ost.findall("oledscreentheme"):
1027                                                 for screen in th.findall("screen"):
1028                                                         if screen.get("name") == "InfoBarSummary" and screen.get("id") == "2":
1029                                                                 OLEDInfoBarList.append(th.get("name"))
1030                                                                 if th.get("value") == "active":
1031                                                                         defaultoledinfobar = th.get("name")
1032
1033                                         if len(OLEDInfoBarList) > 0:
1034                                                 self.OSInfobar = MyConfigSelection(default=defaultoledinfobar, choices = OLEDInfoBarList)
1035                                                 config.plugins.MerlinSkinThemes.OLEDInfoBar = self.OSInfobar
1036                                                 self.clist.append(getConfigListEntry("OLEDInfoBar", self.OSInfobar))
1037
1038                                 #-----------
1039                                 # EVENTVIEW
1040                                 OLEDEventViewList = []
1041                                 if st.find("screens[@name='EventView_summary']") is not None:
1042                                         ost = st.find("screens[@name='EventView_summary']")
1043                                         for th in ost.findall("oledscreentheme"):
1044                                                 for screen in th.findall("screen"):
1045                                                         if screen.get("name") == "EventView_summary" and screen.get("id") == "2":
1046                                                                 OLEDEventViewList.append(th.get("name"))
1047                                                                 if th.get("value") == "active":
1048                                                                         defaultoledeventview = th.get("name")
1049
1050                                         if len(OLEDEventViewList) > 0:
1051                                                 self.OSEventView = MyConfigSelection(default=defaultoledeventview, choices = OLEDEventViewList)
1052                                                 config.plugins.MerlinSkinThemes.OLEDEventView = self.OSEventView
1053                                                 self.clist.append(getConfigListEntry("OLEDEventView", self.OSEventView))
1054
1055                                 #-----------
1056                                 # STANDBY
1057                                 OLEDStandbyList = []
1058                                 if st.find("screens[@name='StandbySummary']") is not None:
1059                                         ost = st.find("screens[@name='StandbySummary']")
1060                                         for th in ost.findall("oledscreentheme"):
1061                                                 for screen in th.findall("screen"):
1062                                                         if screen.get("name") == "StandbySummary" and screen.get("id") == "2":
1063                                                                 OLEDStandbyList.append(th.get("name"))
1064                                                                 if th.get("value") == "active":
1065                                                                         defaultoledstandby = th.get("name")
1066
1067                                         if len(OLEDStandbyList) > 0:
1068                                                 self.OSStandby = MyConfigSelection(default=defaultoledstandby, choices = OLEDStandbyList)
1069                                                 config.plugins.MerlinSkinThemes.OLEDStandby = self.OSStandby
1070                                                 self.clist.append(getConfigListEntry("OLEDStandby", self.OSStandby))
1071                                                 
1072                                 #-----------
1073                                 # InfoBarMoviePlayerSummary
1074                                 OLEDMoviePlayerList = []
1075                                 if st.find("screens[@name='InfoBarMoviePlayerSummary']") is not None:
1076                                         ost = st.find("screens[@name='InfoBarMoviePlayerSummary']")
1077                                         for th in ost.findall("oledscreentheme"):
1078                                                 for screen in th.findall("screen"):
1079                                                         if screen.get("name") == "InfoBarMoviePlayerSummary" and screen.get("id") == "2":
1080                                                                 OLEDMoviePlayerList.append(th.get("name"))
1081                                                                 if th.get("value") == "active":
1082                                                                         defaultoledmovieplayer = th.get("name")
1083
1084                                         if len(OLEDMoviePlayerList) > 0:
1085                                                 self.OSMoviePlayer = MyConfigSelection(default=defaultoledmovieplayer, choices = OLEDMoviePlayerList)
1086                                                 config.plugins.MerlinSkinThemes.OLEDMoviePlayer = self.OSMoviePlayer
1087                                                 self.clist.append(getConfigListEntry("OLEDMoviePlayer", self.OSMoviePlayer))
1088                                                 
1089                                 #-----------
1090                                 # MerlinMusicPlayer2OLCDScreen
1091                                 OLEDMMP2List = []
1092                                 if st.find("screens[@name='MerlinMusicPlayer2LCDScreen']") is not None:
1093                                         ost = st.find("screens[@name='MerlinMusicPlayer2LCDScreen']")
1094                                         for th in ost.findall("oledscreentheme"):
1095                                                 for screen in th.findall("screen"):
1096                                                         if screen.get("name") == "MerlinMusicPlayer2LCDScreen" and screen.get("id") == "2":
1097                                                                 OLEDMMP2Lst.append(th.get("name"))
1098                                                                 if th.get("value") == "active":
1099                                                                         defaultoledmmp2 = th.get("name")
1100
1101                                         if len(OLEDMMP2List) > 0:
1102                                                 self.OSMMP2 = MyConfigSelection(default=defaultoledmmp2, choices = OLEDMMP2List)
1103                                                 config.plugins.MerlinSkinThemes.OLEDMMP2 = self.OSMMP2
1104                                                 self.clist.append(getConfigListEntry("OLEDMMP2", self.OSMMP2))
1105                                                 
1106                         # External LCD Screens
1107                         #-----------
1108                         if xml.find("extlcdscreenthemes") is not None:
1109                                 self.clist.append(getConfigListEntry(_(" "), ))
1110                                 self.clist.append(getConfigListEntry(_(" " + u'\u00b7' + " LCD SCREENS ID=3 (900ultraHD, 920ultraHD, Buck(380x210)...) 400x240"), ))            
1111                                 # INFOBAR
1112                                 ExtLCDInfoBarList = []
1113                                 st = xml.find("extlcdscreenthemes")
1114                                 if st.find("screens[@name='InfoBarSummary']") is not None:
1115                                         elst = st.find("screens[@name='InfoBarSummary']")
1116                                         for th in elst.findall("extlcdscreentheme"):
1117                                                 for screen in th.findall("screen"):
1118                                                         if screen.get("name") == "InfoBarSummary" and screen.get("id") == "3":
1119                                                                 ExtLCDInfoBarList.append(th.get("name"))
1120                                                                 if th.get("value") == "active":
1121                                                                         defaultextlcdinfobar = th.get("name")
1122
1123                                         if len(ExtLCDInfoBarList) > 0:
1124                                                 self.ExtLSInfobar = MyConfigSelection(default=defaultextlcdinfobar, choices = ExtLCDInfoBarList)
1125                                                 config.plugins.MerlinSkinThemes.ExtLCDInfoBar = self.ExtLSInfobar
1126                                                 self.clist.append(getConfigListEntry("ExtLCDInfoBar", self.ExtLSInfobar))
1127
1128                                 #-----------
1129                                 # EVENTVIEW
1130                                 ExtLCDEventViewList = []
1131                                 if st.find("screens[@name='EventView_summary']") is not None:
1132                                         elst = st.find("screens[@name='EventView_summary']")
1133                                         for th in elst.findall("extlcdscreentheme"):
1134                                                 for screen in th.findall("screen"):
1135                                                         if screen.get("name") == "EventView_summary" and screen.get("id") == "3":
1136                                                                 ExtLCDEventViewList.append(th.get("name"))
1137                                                                 if th.get("value") == "active":
1138                                                                         defaultextlcdeventview = th.get("name")
1139
1140                                         if len(ExtLCDEventViewList) > 0:
1141                                                 self.ExtLSEventView = MyConfigSelection(default=defaultextlcdeventview, choices = ExtLCDEventViewList)
1142                                                 config.plugins.MerlinSkinThemes.ExtLCDEventView = self.ExtLSEventView
1143                                                 self.clist.append(getConfigListEntry("ExtLCDEventView", self.ExtLSEventView))
1144
1145                                 #-----------
1146                                 # STANDBY
1147                                 ExtLCDStandbyList = []
1148                                 if st.find("screens[@name='StandbySummary']") is not None:
1149                                         elst = st.find("screens[@name='StandbySummary']")
1150                                         for th in elst.findall("extlcdscreentheme"):
1151                                                 for screen in th.findall("screen"):
1152                                                         if screen.get("name") == "StandbySummary" and screen.get("id") == "3":
1153                                                                 ExtLCDStandbyList.append(th.get("name"))
1154                                                                 if th.get("value") == "active":
1155                                                                         defaultextlcdstandby = th.get("name")
1156
1157                                         if len(ExtLCDStandbyList) > 0:
1158                                                 self.ExtLSStandby = MyConfigSelection(default=defaultextlcdstandby, choices = ExtLCDStandbyList)
1159                                                 config.plugins.MerlinSkinThemes.ExtLCDStandby = self.ExtLSStandby
1160                                                 self.clist.append(getConfigListEntry("ExtLCDStandby", self.ExtLSStandby))
1161
1162                                 #-----------
1163                                 # InfoBarMoviePlayerSummary
1164                                 ExtLCDMoviePlayerList = []
1165                                 if st.find("screens[@name='InfoBarMoviePlayerSummary']") is not None:
1166                                         elst = st.find("screens[@name='InfoBarMoviePlayerSummary']")
1167                                         for th in elst.findall("extlcdscreentheme"):
1168                                                 for screen in th.findall("screen"):
1169                                                         if screen.get("name") == "InfoBarMoviePlayerSummary" and screen.get("id") == "3":
1170                                                                 ExtLCDMoviePlayerList.append(th.get("name"))
1171                                                                 if th.get("value") == "active":
1172                                                                         defaultextlcdmovieplayer = th.get("name")
1173
1174                                         if len(ExtLCDMoviePlayerList) > 0:
1175                                                 self.ExtLSMoviePlayer = MyConfigSelection(default=defaultextlcdmovieplayer, choices = ExtLCDMoviePlayerList)
1176                                                 config.plugins.MerlinSkinThemes.ExtLCDMoviePlayer = self.ExtLSMoviePlayer
1177                                                 self.clist.append(getConfigListEntry("ExtLCDMoviePlayer", self.ExtLSMoviePlayer))
1178                                                 
1179                                 #-----------
1180                                 # MerlinMusicPlayer2EXTLCDScreen
1181                                 ExtLCDMMP2List = []
1182                                 if st.find("screens[@name='MerlinMusicPlayer2LCDScreen']") is not None:
1183                                         elst = st.find("screens[@name='MerlinMusicPlayer2LCDScreen']")
1184                                         for th in elst.findall("extlcdscreentheme"):
1185                                                 for screen in th.findall("screen"):
1186                                                         if screen.get("name") == "MerlinMusicPlayer2LCDScreen" and screen.get("id") == "3":
1187                                                                 ExtLCDMMP2List.append(th.get("name"))
1188                                                                 if th.get("value") == "active":
1189                                                                         defaultextlcdmmp2 = th.get("name")
1190
1191                                         if len(ExtLCDMMP2List) > 0:
1192                                                 self.ExtLSMMP2 = MyConfigSelection(default=defaultextlcdmmp2, choices = ExtLCDMMP2List)
1193                                                 config.plugins.MerlinSkinThemes.ExtLCDMMP2 = self.ExtLSMMP2
1194                                                 self.clist.append(getConfigListEntry("ExtLCDMMP2", self.ExtLSMMP2))
1195                                                 
1196                         # cornerRadius 
1197                         if xml.find("cornerradius") is not None:
1198                                 self.clist.append(getConfigListEntry(_(" "), ))
1199                                 self.clist.append(getConfigListEntry(_(" " + u'\u00b7' + " CORNERRADIUS"), ))
1200
1201                                 CornerRadiusList = []
1202                                 
1203                                 cr = xml.find("cornerradius")
1204                                 for cradius in cr.findall("radius"):
1205                                         CornerRadiusList.append(cradius.get("name"))
1206                                         if cradius.get("value") == "active":
1207                                                 defaultcornerradius = cradius.get("name")
1208
1209                                 if len(CornerRadiusList) > 0:
1210                                         self.CornerRadius = MyConfigSelection(default=defaultcornerradius, choices = CornerRadiusList)
1211                                         config.plugins.MerlinSkinThemes.CornerRadius = self.CornerRadius
1212                                         self.clist.append(getConfigListEntry("CornerRadius", self.CornerRadius))
1213                                                 
1214                 except:
1215                         print "[MST] themes.xml in " + MerlinSkinThemes.selSkinName + " corrupt!"
1216                         self.clist.append(getConfigListEntry(_(" "), ))
1217                         self.clist.append(getConfigListEntry(_(">>> ERROR - themes.xml in " + MerlinSkinThemes.selSkinName + " corrupt! <<<"), ))
1218                         
1219                 self["config"].setList(self.clist)
1220                 
1221         def buttonGreen(self):
1222                 if self.curList == "SkinsList":
1223                         # set new skin
1224                         sel = self["SkinsList"].getCurrent()
1225                         if sel[1][7] == "Default Skin":
1226                                 skinfile = "skin.xml"
1227                         else:
1228                                 skinfile = "%s/skin.xml" % sel[1][7]
1229
1230                         # Dr. Best Infobar position
1231                         if fileExists("/usr/share/enigma2/merlin_setup.xml"):
1232                                 config.merlin2.infobar_position_offset_x.value = 0
1233                                 config.merlin2.infobar_position_offset_x.save()
1234                                 config.merlin2.infobar_position_offset_y.value = 0
1235                                 config.merlin2.infobar_position_offset_y.save()
1236                                 config.merlin2.movieplayer_infobar_position_offset_x.value = 0
1237                                 config.merlin2.movieplayer_infobar_position_offset_x.save()
1238                                 config.merlin2.movieplayer_infobar_position_offset_y.value = 0
1239                                 config.merlin2.movieplayer_infobar_position_offset_y.save()
1240                                 
1241                         config.skin.primary_skin.value = skinfile
1242                         config.skin.primary_skin.save()
1243                         restartbox = self.session.openWithCallback(self.restartGUI,MessageBox,_("GUI needs a restart to apply a new skin\nDo you want to Restart the GUI now?"), MessageBox.TYPE_YESNO)
1244                         restartbox.setTitle(_("Restart GUI now?"))
1245                 elif self.curList == "ConfigList":
1246                         askBox = self.session.openWithCallback(self.askYN,MessageBox,_("[apply themes] needs time to build new settings\nDo you want to do this now?"), MessageBox.TYPE_YESNO)
1247                         askBox.setTitle(_("Apply themes now?"))
1248
1249         def askYN(self, answer):
1250                 if answer is True:
1251                         self.setThemes()
1252                         if SkinName == MerlinSkinThemes.selSkinName:
1253                                 restartbox = self.session.openWithCallback(self.restartGUI,MessageBox,_("GUI needs a restart to apply a new skin\nDo you want to Restart the GUI now?"), MessageBox.TYPE_YESNO)
1254                                 restartbox.setTitle(_("Restart GUI now?"))
1255                         
1256                         else:
1257                                 self.session.open(MessageBox, _("Changes to skin " + MerlinSkinThemes.selSkinName + " ready!"), MessageBox.TYPE_INFO)
1258                 #else:
1259                 #       self.exit()
1260
1261         def MSTScrFix(self, answer):
1262                 if answer is True:
1263                         curSkin = Tree.parse(MerlinSkinThemes.selSkinFile)
1264                         rootSkin = curSkin.getroot()
1265                         mstscreen = rootSkin.find("screen[@name='MerlinSkinThemes']")
1266                         rootSkin.remove(mstscreen)
1267
1268                         self.XMLindent(rootSkin, 0)
1269                         curSkin.write(MerlinSkinThemes.selSkinFile)
1270                         
1271                         self.updateSkinList()
1272
1273                         self.session.open(MessageBox, '<screen name="MerlinSkinThemes"...> was removed from selected skin.', MessageBox.TYPE_INFO)
1274                         
1275         def buttonRed(self):
1276                 self.exit()
1277                 
1278         def buttonYellow(self):
1279                 if self.curList == "SkinsList":
1280                         if self["SkinsList"].getCurrent()[3][7] == "no themes.xml":
1281                                 self.createThemes()
1282
1283                         if self["SkinsList"].getCurrent()[3][7] == "no skin.xml":
1284                                 self.delSkinDir()
1285                                 
1286                 elif self.curList == "ConfigList":
1287                         if self["config"].getCurrent()[0] == "Design":
1288                                 # delete design
1289                                 self.deleteDesign()
1290                         
1291                         else:
1292                                 # save as design
1293                                 self.session.openWithCallback(self.saveDesign, InputBox, title=_("Please enter designname!"))
1294                         
1295         def saveDesign(self, designname):
1296                 if designname is not None:
1297                 
1298                         designname = designname.strip()
1299                         
1300                         curTree = Tree.parse(MerlinSkinThemes.selThemeFile)
1301                         xmlroot = curTree.getroot()
1302                         
1303                         if xmlroot.find("designs") is None:
1304                                 xmldesigns = Tree.SubElement(xmlroot, "designs")
1305                         else:
1306                                 xmldesigns = xmlroot.find("designs")
1307
1308                         # check if design exists
1309                         if xmldesigns.find("design[@name='" + designname + "']") is not None:
1310                                 xmldesigns.remove(xmldesigns.find("design[@name='" + designname + "']"))
1311                                 
1312                         # write/rewrite design
1313                         xmldesign = Tree.SubElement(xmldesigns, "design", {"name": designname, "value": "active"})
1314                                 
1315                         if xmlroot.find("colortheme[@name='" + config.plugins.MerlinSkinThemes.ColorTheme.value + "']") is not None:
1316                                 if xmldesign.find("ColorTheme") is not None:
1317                                         td = xmldesign.find("ColorTheme")
1318                                         td.set("name", config.plugins.MerlinSkinThemes.ColorTheme.value)
1319                                 else:
1320                                         Tree.SubElement(xmldesign, "ColorTheme", {"name": config.plugins.MerlinSkinThemes.ColorTheme.value})
1321                                 
1322                         if xmlroot.find("fonttheme[@name='" + config.plugins.MerlinSkinThemes.FontTheme.value + "']") is not None:
1323                                 if xmldesign.find("FontTheme") is not None:
1324                                         td = d.find("FontTheme")
1325                                         td.set("name", config.plugins.MerlinSkinThemes.FontTheme.value)
1326                                 else:
1327                                         Tree.SubElement(xmldesign, "FontTheme", {"name": config.plugins.MerlinSkinThemes.FontTheme.value})
1328                         
1329                         if xmlroot.find("bordersettheme") is not None:
1330                                 if xmldesign.find("BorderSetTheme") is not None:
1331                                         td = d.find("BorderSetTheme")
1332                                         td.set("name", config.plugins.MerlinSkinThemes.BorderSetTheme.value)
1333                                 else:
1334                                         Tree.SubElement(xmldesign, "BorderSetTheme", {"name": config.plugins.MerlinSkinThemes.BorderSetTheme.value})
1335                         
1336                         if xmlroot.find("windowstylescrollbartheme") is not None:
1337                                 if xmldesign.find("WindowStyleScrollbarTheme") is not None:
1338                                         td = d.find("WindowStyleScrollbarTheme")
1339                                         td.set("name", config.plugins.MerlinSkinThemes.WindowStyleScrollbarTheme.value)
1340                                 else:
1341                                         Tree.SubElement(xmldesign, "WindowStyleScrollbarTheme", {"name": config.plugins.MerlinSkinThemes.WindowStyleScrollbarTheme.value})
1342                         
1343                         if xmlroot.find("componenttheme") is not None:
1344                                 if xmldesign.find("ComponentTheme") is not None:
1345                                         td = d.find("ComponentTheme")
1346                                         td.set("name", config.plugins.MerlinSkinThemes.ComponentTheme.value)
1347                                 else:
1348                                         Tree.SubElement(xmldesign, "ComponentTheme", {"name": config.plugins.MerlinSkinThemes.ComponentTheme.value})
1349                         
1350                         if xmlroot.find("layouttheme") is not None:
1351                                 if xmldesign.find("LayoutTheme") is not None:
1352                                         td = d.find("LayoutTheme")
1353                                         td.set("name", config.plugins.MerlinSkinThemes.LayoutTheme.value)
1354                                 else:
1355                                         Tree.SubElement(xmldesign, "LayoutTheme", {"name": config.plugins.MerlinSkinThemes.LayoutTheme.value})
1356                         
1357                         if xmlroot.find("globalstheme") is not None:
1358                                 if xmldesign.find("GlobalsTheme") is not None:
1359                                         td = d.find("GlobalsTheme")
1360                                         td.set("name", config.plugins.MerlinSkinThemes.GlobalsTheme.value)
1361                                 else:
1362                                         Tree.SubElement(xmldesign, "GlobalsTheme", {"name": config.plugins.MerlinSkinThemes.GlobalsTheme.value})
1363                         
1364                         if xmlroot.find("pngtheme[@name='" + config.plugins.MerlinSkinThemes.PNGTheme.value + "']") is not None:
1365                                 if xmldesign.find("PNGTheme") is not None:
1366                                         td = xmldesign.find("PNGTheme")
1367                                         td.set("name", config.plugins.MerlinSkinThemes.PNGTheme.value)
1368                                 else:
1369                                         Tree.SubElement(xmldesign, "PNGTheme", {"name": config.plugins.MerlinSkinThemes.PNGTheme.value})
1370
1371                         # SkinPathThemes
1372                         if xmlroot.find("skinpaththemes") is not None:
1373                                 t = xmlroot.find("skinpaththemes")
1374                                 
1375                                 if t.find("theme[@name='" + config.plugins.MerlinSkinThemes.SkinPathTheme.value + "']") is not None:
1376                                         if xmldesign.find("SkinPathTheme") is not None:
1377                                                 td = xmldesign.find("SkinPathTheme")
1378                                                 td.set("name", config.plugins.MerlinSkinThemes.SkinPathTheme.value)
1379                                         else:
1380                                                 Tree.SubElement(xmldesign, "SkinPathTheme", {"name": config.plugins.MerlinSkinThemes.SkinPathTheme.value})
1381                                         
1382                         # Screens
1383                         if xmlroot.find("screenthemes") is not None:
1384                                 t = xmlroot.find("screenthemes")
1385                                 
1386                                 if t.find("screens[@name='InfoBar']") is not None:
1387                                         ts = t.find("screens[@name='InfoBar']")
1388                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.InfoBar.value + "']") is not None:
1389                                                 Tree.SubElement(xmldesign, "InfoBar", {"name": config.plugins.MerlinSkinThemes.InfoBar.value})
1390
1391                                 if t.find("screens[@name='Menu']") is not None:
1392                                         ts = t.find("screens[@name='Menu']")
1393                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.Menu.value + "']") is not None:
1394                                                 Tree.SubElement(xmldesign, "Menu", {"name": config.plugins.MerlinSkinThemes.Menu.value})
1395
1396                                 if t.find("screens[@name='PluginBrowser']") is not None:
1397                                         ts = t.find("screens[@name='PluginBrowser']")
1398                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.PluginBrowser.value + "']") is not None:
1399                                                 Tree.SubElement(xmldesign, "PluginBrowser", {"name": config.plugins.MerlinSkinThemes.PluginBrowser.value})
1400         
1401                                 if t.find("screens[@name='ChannelSelection']") is not None:
1402                                         ts = t.find("screens[@name='ChannelSelection']")
1403                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.ChannelSelection.value + "']") is not None:
1404                                                 Tree.SubElement(xmldesign, "ChannelSelection", {"name": config.plugins.MerlinSkinThemes.ChannelSelection.value})
1405                                                 
1406                                 if t.find("screens[@name='MovieSelection']") is not None:
1407                                         ts = t.find("screens[@name='MovieSelection']")
1408                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MovieSelection.value + "']") is not None:
1409                                                 Tree.SubElement(xmldesign, "MovieSelection", {"name": config.plugins.MerlinSkinThemes.MovieSelection.value})
1410                                                 
1411                                 if t.find("screens[@name='MoviePlayer']") is not None:
1412                                         ts = t.find("screens[@name='MoviePlayer']")
1413                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MoviePlayer.value + "']") is not None:
1414                                                 Tree.SubElement(xmldesign, "MoviePlayer", {"name": config.plugins.MerlinSkinThemes.MoviePlayer.value})
1415                                                 
1416                                 if t.find("screens[@name='SecondInfoBar']") is not None:
1417                                         ts = t.find("screens[@name='SecondInfoBar']")
1418                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.SecondInfoBar.value + "']") is not None:
1419                                                 Tree.SubElement(xmldesign, "SecondInfoBar", {"name": config.plugins.MerlinSkinThemes.SecondInfoBar.value})
1420
1421                                 if t.find("screens[@name='GraphMultiEPG']") is not None:
1422                                         ts = t.find("screens[@name='GraphMultiEPG']")
1423                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.GraphMultiEPG.value + "']") is not None:
1424                                                 Tree.SubElement(xmldesign, "GraphMultiEPG", {"name": config.plugins.MerlinSkinThemes.GraphMultiEPG.value})
1425                                                 
1426                                 if t.find("screens[@name='EventView']") is not None:
1427                                         ts = t.find("screens[@name='EventView']")
1428                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.EventView.value + "']") is not None:
1429                                                 Tree.SubElement(xmldesign, "EventView", {"name": config.plugins.MerlinSkinThemes.EventView.value})
1430                                                 
1431                                 if t.find("screens[@name='EPGSelection']") is not None:
1432                                         ts = t.find("screens[@name='EPGSelection']")
1433                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.EPGSelection.value + "']") is not None:
1434                                                 Tree.SubElement(xmldesign, "EPGSelection", {"name": config.plugins.MerlinSkinThemes.EPGSelection.value})
1435                                                 
1436                                 if t.find("screens[@name='MessageBox']") is not None:
1437                                         ts = t.find("screens[@name='MessageBox']")
1438                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MessageBox.value + "']") is not None:
1439                                                 Tree.SubElement(xmldesign, "MessageBox", {"name": config.plugins.MerlinSkinThemes.MessageBox.value})
1440                                                 
1441                                 if t.find("screens[@name='InputBox']") is not None:
1442                                         ts = t.find("screens[@name='InputBox']")
1443                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.InputBox.value + "']") is not None:
1444                                                 Tree.SubElement(xmldesign, "InputBox", {"name": config.plugins.MerlinSkinThemes.InputBox.value})
1445                                                 
1446                                 if t.find("screens[@name='ChoiceBox']") is not None:
1447                                         ts = t.find("screens[@name='ChoiceBox']")
1448                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.ChoiceBox.value + "']") is not None:
1449                                                 Tree.SubElement(xmldesign, "ChoiceBox", {"name": config.plugins.MerlinSkinThemes.ChoiceBox.value})
1450                                                 
1451                                 if t.find("screens[@name='Mute']") is not None:
1452                                         ts = t.find("screens[@name='Mute']")
1453                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.Mute.value + "']") is not None:
1454                                                 Tree.SubElement(xmldesign, "Mute", {"name": config.plugins.MerlinSkinThemes.Mute.value})
1455                                                 
1456                                 if t.find("screens[@name='Volume']") is not None:
1457                                         ts = t.find("screens[@name='Volume']")
1458                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.Volume.value + "']") is not None:
1459                                                 Tree.SubElement(xmldesign, "Volume", {"name": config.plugins.MerlinSkinThemes.Volume.value})
1460
1461                                 if t.find("screens[@name='MerlinMusicPlayer2Screen']") is not None:
1462                                         ts = t.find("screens[@name='MerlinMusicPlayer2Screen']")
1463                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen.value + "']") is not None:
1464                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2Screen", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen.value})
1465
1466                                 if t.find("screens[@name='MerlinMusicPlayer2Screen_MIPSEL']") is not None:
1467                                         ts = t.find("screens[@name='MerlinMusicPlayer2Screen_MIPSEL']")
1468                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_MIPSEL.value + "']") is not None:
1469                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2Screen_MIPSEL", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_MIPSEL.value})
1470
1471                                 if t.find("screens[@name='MerlinMusicPlayer2Screen_ARM']") is not None:
1472                                         ts = t.find("screens[@name='MerlinMusicPlayer2Screen_ARM']")
1473                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_ARM.value + "']") is not None:
1474                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2Screen_ARM", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_ARM.value})
1475
1476                                 if t.find("screens[@name='MerlinMusicPlayer2Screen_AARCH64']") is not None:
1477                                         ts = t.find("screens[@name='MerlinMusicPlayer2Screen_AARCH64']")
1478                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_AARCH64.value + "']") is not None:
1479                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2Screen_AARCH64", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2Screen_AARCH64.value})
1480
1481                                 if t.find("screens[@name='MerlinMusicPlayer2ScreenSaver']") is not None:
1482                                         ts = t.find("screens[@name='MerlinMusicPlayer2ScreenSaver']")
1483                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver.value + "']") is not None:
1484                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2ScreenSaver", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver.value})
1485
1486                                 if t.find("screens[@name='MerlinMusicPlayer2ScreenSaver_MIPSEL']") is not None:
1487                                         ts = t.find("screens[@name='MerlinMusicPlayer2ScreenSaver_MIPSEL']")
1488                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_MIPSEL.value + "']") is not None:
1489                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2ScreenSaver_MIPSEL", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_MIPSEL.value})
1490
1491                                 if t.find("screens[@name='MerlinMusicPlayer2ScreenSaver_ARM']") is not None:
1492                                         ts = t.find("screens[@name='MerlinMusicPlayer2ScreenSaver_ARM']")
1493                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_ARM.value + "']") is not None:
1494                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2ScreenSaver_ARM", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_ARM.value})
1495
1496                                 if t.find("screens[@name='MerlinMusicPlayer2ScreenSaver_AARCH64']") is not None:
1497                                         ts = t.find("screens[@name='MerlinMusicPlayer2ScreenSaver_AARCH64']")
1498                                         if ts.find("screentheme[@name='" + config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_AARCH64.value + "']") is not None:
1499                                                 Tree.SubElement(xmldesign, "MerlinMusicPlayer2ScreenSaver_AARCH64", {"name": config.plugins.MerlinSkinThemes.MerlinMusicPlayer2ScreenSaver_AARCH64.value})
1500
1501                         # LCD Screens
1502                         if xmlroot.find("lcdscreenthemes") is not None:
1503                                 t = xmlroot.find("lcdscreenthemes")
1504                                 
1505                                 if t.find("screens[@name='InfoBarSummary']") is not None:
1506                                         ts = t.find("screens[@name='InfoBarSummary']")
1507                                         if ts.find("lcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.LCDInfoBar.value + "']") is not None:
1508                                                 Tree.SubElement(xmldesign, "LCDInfoBar", {"name": config.plugins.MerlinSkinThemes.LCDInfoBar.value})
1509
1510                                 if t.find("screens[@name='EventView_summary']") is not None:
1511                                         ts = t.find("screens[@name='EventView_summary']")
1512                                         if ts.find("lcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.LCDEventView.value + "']") is not None:
1513                                                 Tree.SubElement(xmldesign, "LCDEventView", {"name": config.plugins.MerlinSkinThemes.LCDEventView.value})
1514
1515                                 if t.find("screens[@name='StandbySummary']") is not None:
1516                                         ts = t.find("screens[@name='StandbySummary']")
1517                                         if ts.find("lcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.LCDStandby.value + "']") is not None:
1518                                                 Tree.SubElement(xmldesign, "LCDStandby", {"name": config.plugins.MerlinSkinThemes.LCDStandby.value})
1519
1520                                 if t.find("screens[@name='InfoBarMoviePlayerSummary']") is not None:
1521                                         ts = t.find("screens[@name='InfoBarMoviePlayerSummary']")
1522                                         if ts.find("lcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.LCDMoviePlayer.value + "']") is not None:
1523                                                 Tree.SubElement(xmldesign, "LCDMoviePlayer", {"name": config.plugins.MerlinSkinThemes.LCDMoviePlayer.value})
1524
1525                                 if t.find("screens[@name='MerlinMusicPlayer2LCDScreen']") is not None:
1526                                         ts = t.find("screens[@name='MerlinMusicPlayer2LCDScreen']")
1527                                         if ts.find("lcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.LCDMMP2.value + "']") is not None:
1528                                                 Tree.SubElement(xmldesign, "LCDMMP2", {"name": config.plugins.MerlinSkinThemes.LCDMMP2.value})
1529                                                 
1530                         # OLED Screens
1531                         if xmlroot.find("oledscreenthemes") is not None:
1532                                 t = xmlroot.find("oledscreenthemes")
1533                                 
1534                                 if t.find("screens[@name='InfoBarSummary']") is not None:
1535                                         ts = t.find("screens[@name='InfoBarSummary']")
1536                                         if ts.find("oledscreentheme[@name='" + config.plugins.MerlinSkinThemes.OLEDInfoBar.value + "']") is not None:
1537                                                 Tree.SubElement(xmldesign, "OLEDInfoBar", {"name": config.plugins.MerlinSkinThemes.OLEDInfoBar.value})
1538
1539                                 if t.find("screens[@name='EventView_summary']") is not None:
1540                                         ts = t.find("screens[@name='EventView_summary']")
1541                                         if ts.find("oledscreentheme[@name='" + config.plugins.MerlinSkinThemes.OLEDEventView.value + "']") is not None:
1542                                                 Tree.SubElement(xmldesign, "OLEDEventView", {"name": config.plugins.MerlinSkinThemes.OLEDEventView.value})
1543
1544                                 if t.find("screens[@name='StandbySummary']") is not None:
1545                                         ts = t.find("screens[@name='StandbySummary']")
1546                                         if ts.find("oledscreentheme[@name='" + config.plugins.MerlinSkinThemes.OLEDStandby.value + "']") is not None:
1547                                                 Tree.SubElement(xmldesign, "OLEDStandby", {"name": config.plugins.MerlinSkinThemes.OLEDStandby.value})
1548
1549                                 if t.find("screens[@name='InfoBarMoviePlayerSummary']") is not None:
1550                                         ts = t.find("screens[@name='InfoBarMoviePlayerSummary']")
1551                                         if ts.find("oledscreentheme[@name='" + config.plugins.MerlinSkinThemes.OLEDMoviePlayer.value + "']") is not None:
1552                                                 Tree.SubElement(xmldesign, "OLEDMoviePlayer", {"name": config.plugins.MerlinSkinThemes.OLEDMoviePlayer.value})
1553
1554                                 if t.find("screens[@name='MerlinMusicPlayer2LCDScreen']") is not None:
1555                                         ts = t.find("screens[@name='MerlinMusicPlayer2LCDScreen']")
1556                                         if ts.find("oledscreentheme[@name='" + config.plugins.MerlinSkinThemes.OLEDMMP2.value + "']") is not None:
1557                                                 Tree.SubElement(xmldesign, "OLEDMMP2", {"name": config.plugins.MerlinSkinThemes.OLEDMMP2.value})
1558                                                 
1559                         # External LCD Screens
1560                         if xmlroot.find("extlcdscreenthemes") is not None:
1561                                 t = xmlroot.find("extlcdscreenthemes")
1562                                 
1563                                 if t.find("screens[@name='InfoBarSummary']") is not None:
1564                                         ts = t.find("screens[@name='InfoBarSummary']")
1565                                         if ts.find("extlcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.ExtLCDInfoBar.value + "']") is not None:
1566                                                 Tree.SubElement(xmldesign, "ExtLCDInfoBar", {"name": config.plugins.MerlinSkinThemes.ExtLCDInfoBar.value})
1567
1568                                 if t.find("screens[@name='EventView_summary']") is not None:
1569                                         ts = t.find("screens[@name='EventView_summary']")
1570                                         if ts.find("extlcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.ExtLCDEventView.value + "']") is not None:
1571                                                 Tree.SubElement(xmldesign, "ExtLCDEventView", {"name": config.plugins.MerlinSkinThemes.ExtLCDEventView.value})
1572
1573                                 if t.find("screens[@name='StandbySummary']") is not None:
1574                                         ts = t.find("screens[@name='StandbySummary']")
1575                                         if ts.find("extlcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.ExtLCDStandby.value + "']") is not None:
1576                                                 Tree.SubElement(xmldesign, "ExtLCDStandby", {"name": config.plugins.MerlinSkinThemes.ExtLCDStandby.value})
1577
1578                                 if t.find("screens[@name='InfoBarMoviePlayerSummary']") is not None:
1579                                         ts = t.find("screens[@name='InfoBarMoviePlayerSummary']")
1580                                         if ts.find("extlcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.ExtLCDMoviePlayer.value + "']") is not None:
1581                                                 Tree.SubElement(xmldesign, "ExtLCDMoviePlayer", {"name": config.plugins.MerlinSkinThemes.ExtLCDMoviePlayer.value})
1582
1583                                 if t.find("screens[@name='MerlinMusicPlayer2LCDScreen']") is not None:
1584                                         ts = t.find("screens[@name='MerlinMusicPlayer2LCDScreen']")
1585                                         if ts.find("extlcdscreentheme[@name='" + config.plugins.MerlinSkinThemes.ExtLCDMMP2.value + "']") is not None:
1586                                                 Tree.SubElement(xmldesign, "ExtLCDMMP2", {"name": config.plugins.MerlinSkinThemes.ExtLCDMMP2.value})
1587
1588
1589                         # cornerRadius
1590                         if xmlroot.find("cornerradius") is not None:
1591                                 if xmldesign.find("CornerRadius") is not None:
1592                                         td = xmldesign.find("CornerRadius")
1593                                         td.set("name", config.plugins.MerlinSkinThemes.CornerRadius.value)
1594                                 else:
1595                                         Tree.SubElement(xmldesign, "CornerRadius", {"name": config.plugins.MerlinSkinThemes.CornerRadius.value})
1596                                                 
1597                         self.XMLindent(xmlroot, 0)
1598                         
1599                         curTree.write(MerlinSkinThemes.selThemeFile)
1600                                 
1601                         self.readThemes()
1602                                 
1603         def deleteDesign(self):
1604                 if self.MSTDesigns.value == "-none-":
1605                         self.session.open(MessageBox,_("nothing to delete"), MessageBox.TYPE_ERROR)
1606                 else:
1607                         curTree = Tree.parse(MerlinSkinThemes.selThemeFile)
1608                         xmlroot = curTree.getroot()
1609                         designs = xmlroot.find("designs")
1610                         for design in designs.findall("design"):
1611                                 if design.get("name") == config.plugins.MerlinSkinThemes.Design.value:
1612                                         designs.remove(design)
1613                         
1614                                         self.XMLindent(xmlroot, 0)
1615
1616                                         curTree.write(MerlinSkinThemes.selThemeFile)
1617                 
1618                                         self.readThemes()
1619                                                 
1620         def setDesign(self):
1621                 curTree = Tree.parse(MerlinSkinThemes.selThemeFile)
1622                 xmlroot = curTree.getroot()
1623                 designs = xmlroot.find("designs")
1624                 for design in designs.findall("design"):
1625                         if design.get("name") == config.plugins.MerlinSkinThemes.Design.value:
1626                                 if design.find("ColorTheme") is not None:
1627                                         tmp = design.find("ColorTheme")
1628                                         try:
1629                                                 self.TColor.setValue(tmp.get("name"))
1630                                         except:
1631                                                 print "[MST] TColor not found"
1632                                         
1633                                 if design.find("SkinPathTheme") is not None:
1634                                         tmp = design.find("SkinPathTheme")
1635                                         try:
1636                                                 self.SPath.setValue(tmp.get("name"))
1637                                         except:
1638                                                 print "[MST] SPath not found"
1639
1640                                 if design.find("FontTheme") is not None:
1641                                         tmp = design.find("FontTheme")
1642                                         try:
1643                                                 self.TFont.setValue(tmp.get("name"))
1644                                         except:
1645                                                 print "[MST] TFont not found"
1646
1647                                 if design.find("BorderSetTheme") is not None:
1648                                         tmp = design.find("BorderSetTheme")
1649                                         try:
1650                                                 self.TBorder.setValue(tmp.get("name"))
1651                                         except:
1652                                                 print "[MST] TBorder not found"
1653                                         
1654                                 if design.find("WindowStyleScrollbarTheme") is not None:
1655                                         tmp = design.find("WindowStyleScrollbarTheme")
1656                                         #print "[MST] TScroll: %s" % self["config"].getCurrent()[1].getChoices()
1657                                         #print "[MST] TScroll: %s" % self["config"].getCurrent()[0]
1658                                         #print "[MST] TScroll len: %s" % len(self["config"].getCurrent()[1].getChoices())
1659
1660                                         #print "[MST] BEVOR"
1661                                         #print "[MST] TScroll: %s" % self.TScroll.getChoices()
1662                                         #print "[MST] TScroll default: %s" % tmp.get("name")
1663                                         #print "[MST] TScroll index: %s" % self.TScroll.getChoices().index(tmp.get("name"))
1664                                         #print "[MST] TScroll len: %s" % len(self.TScroll.getChoices())
1665                                         
1666                                         try:
1667                                                 self.TScroll.setValue(tmp.get("name"))
1668                                         except:
1669                                                 print "[MST] TScroll not found"
1670                                         
1671                                 if design.find("ComponentTheme") is not None:
1672                                         tmp = design.find("ComponentTheme")
1673                                         try:
1674                                                 self.TComponent.setValue(tmp.get("name"))
1675                                         except:
1676                                                 print "[MST] TComponent not found"
1677                                         
1678                                 if design.find("LayoutTheme") is not None:
1679                                         tmp = design.find("LayoutTheme")
1680                                         try:
1681                                                 self.TLayout.setValue(tmp.get("name"))
1682                                         except:
1683                                                 print "[MST] TLayout not found"
1684                                 
1685                                 if design.find("GlobalsTheme") is not None:
1686                                         tmp = design.find("GlobalsTheme")
1687                                         try:
1688                                                 self.TGlobals.setValue(tmp.get("name"))
1689                                         except:
1690                                                 print "[MST] TGlobals not found"
1691                                 
1692                                 if design.find("PNGTheme") is not None:
1693                                         tmp = design.find("PNGTheme")
1694                                         try:
1695                                                 self.TPNG.setValue(tmp.get("name"))
1696                                         except:
1697                                                 print "[MST] TPNG not found"
1698                                 
1699                                 # Screens
1700                                 if design.find("InfoBar") is not None:
1701                                         tmp = design.find("InfoBar")
1702                                         try:
1703                                                 self.SInfobar.setValue(tmp.get("name"))
1704                                         except:
1705                                                 print "[MST] SInfobar not found"
1706
1707                                 if design.find("Menu") is not None:
1708                                         tmp = design.find("Menu")
1709                                         try:
1710                                                 self.SMenu.setValue(tmp.get("name"))
1711                                         except:
1712                                                 print "[MST] SMenu not found"
1713
1714                                 if design.find("PluginBrowser") is not None:
1715                                         tmp = design.find("PluginBrowser")
1716                                         try:
1717                                                 self.SPluginBrowser.setValue(tmp.get("name"))
1718                                         except:
1719                                                 print "[MST] SPluginBrowser not found"
1720                                         
1721                                 if design.find("ChannelSelection") is not None:
1722                                         tmp = design.find("ChannelSelection")
1723                                         try:
1724                                                 self.SChannelSel.setValue(tmp.get("name"))
1725                                         except:
1726                                                 print "[MST] SChannelSel not found"
1727                                         
1728                                 if design.find("MovieSelection") is not None:
1729                                         tmp = design.find("MovieSelection")
1730                                         try:
1731                                                 self.SMovieSel.setValue(tmp.get("name"))
1732                                         except:
1733                                                 print "[MST] SMovieSel not found"
1734                                         
1735                                 if design.find("MoviePlayer") is not None:
1736                                         tmp = design.find("MoviePlayer")
1737                                         try:
1738                                                 self.SMoviePlay.setValue(tmp.get("name"))
1739                                         except:
1740                                                 print "[MST] SMoviePlayer not found"
1741                                         
1742                                 if design.find("SecondInfoBar") is not None:
1743                                         tmp = design.find("SecondInfoBar")
1744                                         try:
1745                                                 self.S2IB.setValue(tmp.get("name"))
1746                                         except:
1747                                                 print "[MST] S2IB not found"
1748                                         
1749                                 if design.find("GraphMultiEPG") is not None:
1750                                         tmp = design.find("GraphMultiEPG")
1751                                         try:
1752                                                 self.graphmultiepg.setValue(tmp.get("name"))
1753                                         except:
1754                                                 print "[MST] GMEPG not found"
1755                                         
1756                                 if design.find("EventView") is not None:
1757                                         tmp = design.find("EventView")
1758                                         try:
1759                                                 self.EventView.setValue(tmp.get("name"))
1760                                         except:
1761                                                 print "[MST] EventView not found"
1762                                         
1763                                 if design.find("EPGSelection") is not None:
1764                                         tmp = design.find("EPGSelection")
1765                                         try:
1766                                                 self.EPGSelection.setValue(tmp.get("name"))
1767                                         except:
1768                                                 print "[MST] EPGSelection not found"
1769                                         
1770                                 if design.find("MessageBox") is not None:
1771                                         tmp = design.find("MessageBox")
1772                                         try:
1773                                                 self.SMsgBox.setValue(tmp.get("name"))
1774                                         except:
1775                                                 print "[MST] SMsgBox not found"
1776                                         
1777                                 if design.find("InputBox") is not None:
1778                                         tmp = design.find("InputBox")
1779                                         try:
1780                                                 self.SInBox.setValue(tmp.get("name"))
1781                                         except:
1782                                                 print "[MST] SInBox not found"
1783                                         
1784                                 if design.find("ChoiceBox") is not None:
1785                                         tmp = design.find("ChoiceBox")
1786                                         try:
1787                                                 self.SChoiceBox.setValue(tmp.get("name"))
1788                                         except:
1789                                                 print "[MST] SChoiceBox not found"
1790
1791                                 if design.find("Mute") is not None:
1792                                         tmp = design.find("Mute")
1793                                         try:
1794                                                 self.SMute.setValue(tmp.get("name"))
1795                                         except:
1796                                                 print "[MST] SMute not found"
1797
1798                                 if design.find("Volume") is not None:
1799                                         tmp = design.find("Volume")
1800                                         try:
1801                                                 self.SVolume.setValue(tmp.get("name"))
1802                                         except:
1803                                                 print "[MST] SVolume not found"
1804
1805                                 if design.find("MerlinMusicPlayer2Screen") is not None:
1806                                         tmp = design.find("MerlinMusicPlayer2Screen")
1807                                         try:
1808                                                 self.SMMP2.setValue(tmp.get("name"))
1809                                         except:
1810                                                 print "[MST] SMMP2 not found"
1811
1812                                 if design.find("MerlinMusicPlayer2Screen_MIPSEL") is not None:
1813                                         tmp = design.find("MerlinMusicPlayer2Screen_MIPSEL")
1814                                         try:
1815                                                 self.SMMP2Mipsel.setValue(tmp.get("name"))
1816                                         except:
1817                                                 print "[MST] SMMP2Mipsel not found"
1818
1819                                 if design.find("MerlinMusicPlayer2Screen_ARM") is not None:
1820                                         tmp = design.find("MerlinMusicPlayer2Screen_ARM")
1821                                         try:
1822                                                 self.SMMP2Arm.setValue(tmp.get("name"))
1823                                         except:
1824                                                 print "[MST] SMMP2Arm not found"
1825
1826                                 if design.find("MerlinMusicPlayer2Screen_AARCH64") is not None:
1827                                         tmp = design.find("MerlinMusicPlayer2Screen_AARCH64")
1828                                         try:
1829                                                 self.SMMP2Arch64.setValue(tmp.get("name"))
1830                                         except:
1831                                                 print "[MST] SMMP2Arch64 not found"
1832
1833                                 if design.find("MerlinMusicPlayer2ScreenSaver") is not None:
1834                                         tmp = design.find("MerlinMusicPlayer2ScreenSaver")
1835                                         try:
1836                                                 self.SMMP2Saver.setValue(tmp.get("name"))
1837                                         except:
1838                                                 print "[MST] SMMP2Saver not found"
1839
1840                                 if design.find("MerlinMusicPlayer2ScreenSaver_MIPSEL") is not None:
1841                                         tmp = design.find("MerlinMusicPlayer2ScreenSaver_MIPSEL")
1842                                         try:
1843                                                 self.SMMP2SaverMipsel.setValue(tmp.get("name"))
1844                                         except:
1845                                                 print "[MST] SMMP2SaverMipsel not found"
1846
1847                                 if design.find("MerlinMusicPlayer2ScreenSaver_ARM") is not None:
1848                                         tmp = design.find("MerlinMusicPlayer2ScreenSaver_ARM")
1849                                         try:
1850                                                 self.SMMP2SaverArm.setValue(tmp.get("name"))
1851                                         except:
1852                                                 print "[MST] SMMP2SaverArm not found"
1853
1854                                 if design.find("MerlinMusicPlayer2ScreenSaver_AARCH64") is not None:
1855                                         tmp = design.find("MerlinMusicPlayer2ScreenSaver_AARCH64")
1856                                         try:
1857                                                 self.SMMP2SaverArch64.setValue(tmp.get("name"))
1858                                         except:
1859                                                 print "[MST] SMMP2SaverArch64 not found"
1860
1861                                 # LCD
1862                                 if design.find("LCDInfoBar") is not None:
1863                                         tmp = design.find("LCDInfoBar")
1864                                         try:
1865                                                 self.LSInfobar.setValue(tmp.get("name"))
1866                                         except:
1867                                                 print "[MST] LSInfobar not found"
1868                                         
1869                                 if design.find("LCDEventView") is not None:
1870                                         tmp = design.find("LCDEventView")
1871                                         try:
1872                                                 self.LSEventView.setValue(tmp.get("name"))
1873                                         except:
1874                                                 print "[MST] LSEventView not found"
1875                                         
1876                                 if design.find("LCDStandby") is not None:
1877                                         tmp = design.find("LCDStandby")
1878                                         try:
1879                                                 self.LSStandby.setValue(tmp.get("name"))
1880                                         except:
1881                                                 print "[MST] LSStandby not found"
1882                                         
1883                                 if design.find("LCDMoviePlayer") is not None:
1884                                         tmp = design.find("LCDMoviePlayer")
1885                                         try:
1886                                                 self.LSMoviePlayer.setValue(tmp.get("name"))
1887                                         except:
1888                                                 print "[MST] LSMoviePlayer not found"
1889                                         
1890                                 if design.find("LCDMMP2") is not None:
1891                                         tmp = design.find("LCDMMP2")
1892                                         try:
1893                                                 self.LSMMP2.setValue(tmp.get("name"))
1894                                         except:
1895                                                 print "[MST] LSMMP2 not found"
1896                                         
1897                                 # OLED
1898                                 if design.find("OLEDInfoBar") is not None:
1899                                         tmp = design.find("OLEDInfoBar")
1900                                         try:
1901                                                 self.OSInfobar.setValue(tmp.get("name"))
1902                                         except:
1903                                                 print "[MST] OSInfobar not found"
1904                                         
1905                                 if design.find("OLEDEventView") is not None:
1906                                         tmp = design.find("OLEDEventView")
1907                                         try:
1908                                                 self.OSEventView.setValue(tmp.get("name"))
1909                                         except:
1910                                                 print "[MST] OSEventView not found"
1911                                         
1912                                 if design.find("OLEDStandby") is not None:
1913                                         tmp = design.find("OLEDStandby")
1914                                         try:
1915                                                 self.OSStandby.setValue(tmp.get("name"))
1916                                         except:
1917                                                 print "[MST] OSStandby not found"
1918                                         
1919                                 if design.find("OLEDMoviePlayer") is not None:
1920                                         tmp = design.find("OLEDMoviePlayer")
1921                                         try:
1922                                                 self.OSMoviePlayer.setValue(tmp.get("name"))
1923                                         except:
1924                                                 print "[MST] OSMoviePlayer not found"
1925                                         
1926                                 if design.find("OLEDMMP2") is not None:
1927                                         tmp = design.find("OLEDMMP2")
1928                                         try:
1929                                                 self.OSMMP2.setValue(tmp.get("name"))
1930                                         except:
1931                                                 print "[MST] OSMMP2 not found"
1932                                         
1933                                 # External LCD
1934                                 if design.find("ExtLCDInfoBar") is not None:
1935                                         tmp = design.find("ExtLCDInfoBar")
1936                                         try:
1937                                                 self.ExtLSInfobar.setValue(tmp.get("name"))
1938                                         except:
1939                                                 print "[MST] ExtLSInfobar not found"
1940                                         
1941                                 if design.find("ExtLCDEventView") is not None:
1942                                         tmp = design.find("ExtLCDEventView")
1943                                         try:
1944                                                 self.ExtLSEventView.setValue(tmp.get("name"))
1945                                         except:
1946                                                 print "[MST] ExtLSEventView not found"
1947                                         
1948                                 if design.find("ExtLCDStandby") is not None:
1949                                         tmp = design.find("ExtLCDStandby")
1950                                         try:
1951                                                 self.ExtLSStandby.setValue(tmp.get("name"))
1952                                         except:
1953                                                 print "[MST] ExtLSStandby not found"
1954                                         
1955                                 if design.find("ExtLCDMoviePlayer") is not None:
1956                                         tmp = design.find("ExtLCDMoviePlayer")
1957                                         try:
1958                                                 self.ExtLSMoviePlayer.setValue(tmp.get("name"))
1959                                         except:
1960                                                 print "[MST] ExtLSMoviePlayer not found"
1961                                         
1962                                 if design.find("ExtLCDMMP2") is not None:
1963                                         tmp = design.find("ExtLCDMMP2")
1964                                         try:
1965                                                 self.ExtLSMMP2.setValue(tmp.get("name"))
1966                                         except:
1967                                                 print "[MST] ExtLSMMP2 not found"
1968                                         
1969                                 # refresh Screen
1970                                 self["config"].setList(self.clist)
1971                                 #self["config"].hide()
1972                                 #self["config"].show()
1973                         
1974                                 if design.find("CornerRadius") is not None:
1975                                         tmp = design.find("CornerRadius")
1976                                         try:
1977                                                 self.CornerRadius.setValue(tmp.get("name"))
1978                                         except:
1979                                                 print "[MST] CornerRadius not found"
1980                                                 
1981         def ok(self):
1982                 if self.curList == "SkinsList":
1983                         if self["SkinsList"].getCurrent()[3][7] == "":
1984                                 self.curList = "ConfigList"
1985                                 
1986                                 if not SkinUser:
1987                                         self["ListLabel"].setText(_("Configlist") )
1988                                 else:
1989                                         self["ListLabel"].setText(_("Configlist") + " - ATTENTION: skin_user.xml found!!!")
1990
1991                                 if fileExists(MerlinSkinThemes.selSkinFile):
1992                                         self.CopyrightInfo()
1993                                         
1994                                 self.readThemes()
1995
1996                                 if self["config"].getCurrent()[0] == "Design":
1997                                         self["key_green"].setText(_("apply themes"))
1998                                         self["key_yellow"].setText(_("delete design"))
1999                                 elif self["config"].getCurrent()[0] == "Skin":
2000                                         self["key_green"].setText(_("apply themes"))
2001                                         self["key_yellow"].setText(_("save as design"))
2002                                 else:
2003                                         self["key_green"].setText(_("apply themes"))
2004                                         self["key_yellow"].setText(_("save as design"))
2005                                 
2006                                 self["key_green"].show()
2007                                 self["key_yellow"].show()
2008                                 
2009                                 self["SkinsList"].hide()
2010                                 self["config"].show()
2011                                 
2012                                 config.plugins.MerlinSkinThemes.Skin.value = self["SkinsList"].getCurrent()[1][7]
2013                                 
2014                         else:
2015                                 self.CopyrightInfo()
2016                                 self.session.open(MessageBox,_("No themes.xml or skin.xml found.\nPlease select a valid skin including themes.xml"), MessageBox.TYPE_ERROR, title=_("Error"))
2017                                 
2018                 else:
2019                         self.curList = "SkinsList"
2020                         
2021                         if not SkinUser:
2022                                 self["ListLabel"].setText(_("Skinlist") )
2023                         else:
2024                                 self["ListLabel"].setText(_("Skinlist") + " - ATTENTION: skin_user.xml found!!!")
2025                         
2026                         self["SkinCopyright"].setText("")
2027                         
2028                         self["key_green"].setText(_("switch to skin"))
2029                         self["key_green"].hide()
2030                         self["key_yellow"].setText(_(""))
2031                         self["key_yellow"].hide()
2032
2033                         #t1 = time.time()
2034                         self.updateSkinList()
2035                         #t2 = time.time()
2036                         #print "[MST] updateSkinList: ", t2 - t1
2037                 
2038                         self["SkinsList"].show()
2039                         self["config"].hide()
2040
2041                         if fileExists(MerlinSkinThemes.selSkinFile):
2042                                 self.CopyrightInfo()
2043                         
2044         def up(self):
2045                 if self.curList == "SkinsList":
2046                         self[self.curList].up()
2047
2048                         if fileExists(MerlinSkinThemes.selSkinFile):
2049                                 self.CopyrightInfo()
2050                         
2051                 else:
2052                         self["config"].instance.moveSelection(self["config"].instance.moveUp)
2053                         if self["config"].getCurrent()[0] == "Design":
2054                                 self["key_green"].setText(_("apply themes"))
2055                                 self["key_yellow"].setText(_("delete design"))
2056                         elif self["config"].getCurrent()[0] == "Skin":
2057                                 self["key_green"].setText(_("apply themes"))
2058                                 self["key_yellow"].setText(_("save as design"))
2059                         else:
2060                                 self["key_green"].setText(_("apply themes"))
2061                                 self["key_yellow"].setText(_("save as design"))
2062         
2063         def down(self):
2064                 if self.curList == "SkinsList":
2065                         self[self.curList].down()
2066
2067                         if fileExists(MerlinSkinThemes.selSkinFile):
2068                                 self.CopyrightInfo()
2069                         
2070                 else:
2071                         self["config"].instance.moveSelection(self["config"].instance.moveDown)
2072                         if self["config"].getCurrent()[0] == "Design":
2073                                 self["key_green"].setText(_("apply themes"))
2074                                 self["key_yellow"].setText(_("delete design"))
2075                         elif self["config"].getCurrent()[0] == "Skin":
2076                                 self["key_green"].setText(_("apply themes"))
2077                                 self["key_yellow"].setText(_("save as design"))
2078                         else:
2079                                 self["key_green"].setText(_("apply themes"))
2080                                 self["key_yellow"].setText(_("save as design"))
2081         
2082         def left(self):
2083                 if self.curList == "SkinsList":
2084                         self[self.curList].pageUp()
2085                 else:
2086                         ConfigListScreen.keyLeft(self)
2087
2088                         if self["config"].getCurrent()[0] in myList:
2089                                 # PreviewPNG anzeigen
2090                                 pngpath = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/preview/" + self["config"].getCurrent()[0] + "/" + self["config"].getCurrent()[1].value + ".png"
2091
2092                                 if not fileExists(pngpath):
2093                                         pngpath = resolveFilename(SCOPE_PLUGINS) + "Extensions/MerlinSkinThemes/noprev.png"
2094
2095                                 self["Preview"].instance.setPixmapFromFile(pngpath)
2096                                 self["Preview"].show()
2097
2098                         if self["config"].getCurrent()[0] == "Design":
2099                                 if config.plugins.MerlinSkinThemes.Design.value == "-none-":
2100                                         self.readThemes()
2101                                 else:
2102                                         # PreviewPNG anzeigen
2103                                         pngpath = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/preview/" + config.plugins.MerlinSkinThemes.Design.value + ".png"
2104
2105                                         if not fileExists(pngpath):
2106                                                 pngpath = resolveFilename(SCOPE_PLUGINS) + "Extensions/MerlinSkinThemes/noprev.png"
2107
2108                                         self["Preview"].instance.setPixmapFromFile(pngpath)
2109                                         self["Preview"].show()
2110                                         
2111                                         self.setDesign()
2112         
2113         def right(self):
2114                 if self.curList == "SkinsList":
2115                         self[self.curList].pageDown()
2116                 else:
2117                         ConfigListScreen.keyRight(self)
2118
2119                         if self["config"].getCurrent()[0] in myList:
2120                                 # PreviewPNG anzeigen
2121                                 pngpath = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/preview/" + self["config"].getCurrent()[0] + "/" + self["config"].getCurrent()[1].value + ".png"
2122
2123                                 if not fileExists(pngpath):
2124                                         pngpath = resolveFilename(SCOPE_PLUGINS) + "Extensions/MerlinSkinThemes/noprev.png"
2125
2126                                 self["Preview"].instance.setPixmapFromFile(pngpath)
2127                                 self["Preview"].show()
2128
2129                         if self["config"].getCurrent()[0] == "Design":
2130                                 if config.plugins.MerlinSkinThemes.Design.value == "-none-":
2131                                         self.readThemes()
2132                                 else:
2133                                         # PreviewPNG anzeigen
2134                                         pngpath = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/preview/" + config.plugins.MerlinSkinThemes.Design.value + ".png"
2135
2136                                         if not fileExists(pngpath):
2137                                                 pngpath = resolveFilename(SCOPE_PLUGINS) + "Extensions/MerlinSkinThemes/noprev.png"
2138
2139                                         self["Preview"].instance.setPixmapFromFile(pngpath)
2140                                         self["Preview"].show()
2141
2142                                         self.setDesign()
2143         
2144         def changedSkinsList(self):
2145                 self["SkinCopyright"].setText("")
2146                 
2147                 MerlinSkinThemes.selSkinName = self["SkinsList"].getCurrent()[1][7]
2148                 
2149                 MerlinSkinThemes.selSkinFile = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/skin.xml"
2150                 MerlinSkinThemes.selThemeFile = resolveFilename(SCOPE_SKIN) + MerlinSkinThemes.selSkinName + "/themes.xml"
2151                 
2152                 #if fileExists(MerlinSkinThemes.selSkinFile):
2153                 #       self.CopyrightInfo()
2154                         
2155                 if config.plugins.MerlinSkinThemes.ShowPrevPNG.value == "1":
2156                         self.loadPreview()
2157                 
2158                 if self["SkinsList"].getCurrent()[2][7] == "active skin":
2159                         self["key_green"].hide()
2160                 else:
2161                         self["key_green"].show()
2162
2163                 if self["SkinsList"].getCurrent()[3][7] == "no skin.xml":
2164                         self["key_green"].hide()
2165
2166                         self["key_yellow"].show()
2167                         self["key_yellow"].setText(_("delete"))
2168                         
2169                 elif self["SkinsList"].getCurrent()[3][7] == "no themes.xml":
2170                         self["key_green"].show()
2171                         
2172                         self["key_yellow"].show()
2173                         self["key_yellow"].setText(_("create themes"))
2174                         
2175                 else:
2176                         self["key_yellow"].show()
2177
2178                         self["key_yellow"].hide()
2179                         #self.readThemes()
2180                         
2181         def updateSkinList(self):
2182                 self["SkinsList"].buildList()
2183
2184         def setThemes(self):
2185                 # set all "inactive", set new theme "active"
2186                 curTree = Tree.parse(MerlinSkinThemes.selThemeFile)
2187                 rootTheme = curTree.getroot()
2188
2189                 curSkin = Tree.parse(MerlinSkinThemes.selSkinFile)
2190                 rootSkin = curSkin.getroot()
2191                 
2192                 if rootTheme.find("colortheme") is not None:
2193                         for theme in rootTheme.findall("colortheme"):
2194                                 if theme.get("name") == config.plugins.MerlinSkinThemes.ColorTheme.value:
2195                                         theme.set("value", "active")
2196
2197                                         # colors
2198                                         SkinColors = rootSkin.find("colors")
2199
2200                                         # delete old colors
2201                                         for color in SkinColors.findall("color"):
2202                                                 SkinColors.remove(color)
2203                                         
2204                                         # Set new colors
2205                                         ThemeColors = theme.find("colors")
2206                                         
2207                                         for color in ThemeColors.findall("color"):
2208                                                 name = color.get("name")
2209                                                 value = color.get("value")
2210                                                 
2211                                                 Tree.SubElement(SkinColors, "color", {"name": name, "value": value})
2212                                         
2213                                 else:
2214                                         theme.set("value", "inactive")
2215
2216                 if rootTheme.find("fonttheme") is not None:
2217                         for theme in rootTheme.findall("fonttheme"):
2218                                 if theme.get("name") == config.plugins.MerlinSkinThemes.FontTheme.value:
2219                                         theme.set("value", "active")
2220
2221                                         # fonts
2222                                         SkinFonts = rootSkin.find("fonts")
2223
2224                                         # delete old fonts
2225                                         for font in SkinFonts.findall("font"):
2226                                                 SkinFonts.remove(font)
2227                                         
2228        &n