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