GraphMEPG - vertical timelines display configurable, skin's parameters ServiceBorderW...
authorims <ims21@users.sourceforge.net>
Sun, 22 Mar 2015 10:01:52 +0000 (11:01 +0100)
committerlittlesat <littlesat99@yahoo.com>
Sun, 22 Mar 2015 13:29:12 +0000 (14:29 +0100)
Signed-off-by: littlesat <littlesat99@yahoo.com>

lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpg.py
lib/python/Plugins/Extensions/GraphMultiEPG/GraphMultiEpgSetup.py

index a3b4656..9342bd7 100644 (file)
@@ -61,6 +61,7 @@ possibleAlignmentChoices = [
        ( str(RT_HALIGN_CENTER | RT_VALIGN_CENTER | RT_WRAP) , _("centered, wrapped")),
        ( str(RT_HALIGN_RIGHT  | RT_VALIGN_CENTER | RT_WRAP) , _("right, wrapped"))]
 config.misc.graph_mepg.event_alignment = ConfigSelection(default = possibleAlignmentChoices[0][0], choices = possibleAlignmentChoices)
+config.misc.graph_mepg.show_timelines = ConfigSelection(default = "all", choices = [("nothing", _("no")), ("all", _("all")), ("now", _("actual time only"))])
 config.misc.graph_mepg.servicename_alignment = ConfigSelection(default = possibleAlignmentChoices[0][0], choices = possibleAlignmentChoices)
 config.misc.graph_mepg.extension_menu = ConfigYesNo(default = False)
 config.misc.graph_mepg.silent_bouquet_change = ConfigYesNo(default = True)
@@ -148,9 +149,11 @@ class EPGList(HTMLComponent, GUIComponent):
 
                self.listHeight = None
                self.listWidth = None
-               self.serviceBorderWidth = 1
+               self.serviceBorderVerWidth = 1
+               self.serviceBorderHorWidth = 1
                self.serviceNamePadding = 0
-               self.eventBorderWidth = 1
+               self.eventBorderVerWidth = 1
+               self.eventBorderHorWidth = 1
                self.eventNamePadding = 0
 
        def applySkin(self, desktop, screen):
@@ -194,12 +197,16 @@ class EPGList(HTMLComponent, GUIComponent):
                        self.backColorNow = parseColor(value).argb()
                def EntryForegroundColorNow(value):
                        self.foreColorNow = parseColor(value).argb()
-               def ServiceBorderWidth(value):
-                       self.serviceBorderWidth = int(value)
+               def ServiceBorderVerWidth(value):
+                       self.serviceBorderVerWidth = int(value)
+               def ServiceBorderHorWidth(value):
+                       self.serviceBorderHorWidth = int(value)
                def ServiceNamePadding(value):
                        self.serviceNamePadding = int(value)
-               def EventBorderWidth(value):
-                       self.eventBorderWidth = int(value)
+               def EventBorderHorWidth(value):
+                       self.eventBorderHorWidth = int(value)
+               def EventBorderVerWidth(value):
+                       self.eventBorderVerWidth = int(value)
                def EventNamePadding(value):
                        self.eventNamePadding = int(value)
                for (attrib, value) in list(self.skinAttributes):
@@ -370,13 +377,13 @@ class EPGList(HTMLComponent, GUIComponent):
                if self.showServiceTitle:
                        w = width / 10 * 2;
                else:     # if self.showPicon:    # this must be set if showServiceTitle is None
-                       w = 2 * height - 2 * self.serviceBorderWidth  # FIXME: could do better...
+                       w = 2 * height - 2 * self.serviceBorderVerWidth  # FIXME: could do better...
                self.service_rect = Rect(0, 0, w, height)
                self.event_rect = Rect(w, 0, width - w, height)
-               piconHeight = height - 2 * self.serviceBorderWidth
+               piconHeight = height - 2 * self.serviceBorderHorWidth
                piconWidth = 2 * piconHeight  # FIXME: could do better...
-               if piconWidth > w - 2 * self.serviceBorderWidth:
-                       piconWidth = w - 2 * self.serviceBorderWidth
+               if piconWidth > w - 2 * self.serviceBorderVerWidth:
+                       piconWidth = w - 2 * self.serviceBorderVerWidth
                self.picon_size = eSize(piconWidth, piconHeight)
 
        def calcEntryPosAndWidthHelper(self, stime, duration, start, end, width):
@@ -414,8 +421,8 @@ class EPGList(HTMLComponent, GUIComponent):
                res = [ None ]
                if bgpng is not None:    # bacground for service rect
                        res.append(MultiContentEntryPixmapAlphaTest(
-                                       pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth),
-                                       size = (r1.w - 2 * self.serviceBorderWidth, r1.h - 2 * self.serviceBorderWidth),
+                                       pos = (r1.x + self.serviceBorderVerWidth, r1.y + self.serviceBorderHorWidth),
+                                       size = (r1.w - 2 * self.serviceBorderVerWidth, r1.h - 2 * self.serviceBorderHorWidth),
                                        png = bgpng,
                                        flags = BT_SCALE))
                else:
@@ -439,7 +446,7 @@ class EPGList(HTMLComponent, GUIComponent):
                                displayPicon = loadPNG(picon)
                        if displayPicon is not None:
                                res.append(MultiContentEntryPixmapAlphaTest(
-                                       pos = (r1.x + self.serviceBorderWidth, r1.y + self.serviceBorderWidth),
+                                       pos = (r1.x + self.serviceBorderVerWidth, r1.y + self.serviceBorderHorWidth),
                                        size = (piconWidth, piconHeight),
                                        png = displayPicon,
                                        backcolor = None, backcolor_sel = None, flags = BT_SCALE | BT_KEEP_ASPECT_RATIO))
@@ -459,10 +466,10 @@ class EPGList(HTMLComponent, GUIComponent):
 
                if self.showServiceTitle or displayPicon is None:
                        res.append(MultiContentEntryText(
-                               pos = (r1.x + piconWidth + self.serviceBorderWidth + self.serviceNamePadding,
-                                       r1.y + self.serviceBorderWidth),
-                               size = (namewidth - 2 * (self.serviceBorderWidth + self.serviceNamePadding),
-                                       r1.h - 2 * self.serviceBorderWidth),
+                               pos = (r1.x + piconWidth + self.serviceBorderVerWidth + self.serviceNamePadding,
+                                       r1.y + self.serviceBorderHorWidth),
+                               size = (namewidth - 2 * (self.serviceBorderVerWidth + self.serviceNamePadding),
+                                       r1.h - 2 * self.serviceBorderHorWidth),
                                font = namefont, flags = namefontflag,
                                text = service_name,
                                color = serviceForeColor, color_sel = serviceForeColor,
@@ -512,8 +519,8 @@ class EPGList(HTMLComponent, GUIComponent):
 
                                if bgpng is not None:
                                        res.append(MultiContentEntryPixmapAlphaTest(
-                                               pos = (left + xpos + self.eventBorderWidth, top + self.eventBorderWidth),
-                                               size = (ewidth - 2 * self.eventBorderWidth, height - 2 * self.eventBorderWidth),
+                                               pos = (left + xpos + self.eventBorderVerWidth, top + self.eventBorderHorWidth),
+                                               size = (ewidth - 2 * self.eventBorderVerWidth, height - 2 * self.eventBorderHorWidth),
                                                png = bgpng,
                                                flags = BT_SCALE))
                                else:
@@ -524,10 +531,10 @@ class EPGList(HTMLComponent, GUIComponent):
                                                backcolor = backColor, backcolor_sel = backColorSel))
 
                                # event text
-                               evX = left + xpos + self.eventBorderWidth + self.eventNamePadding
-                               evY = top + self.eventBorderWidth
-                               evW = ewidth - 2 * (self.eventBorderWidth + self.eventNamePadding)
-                               evH = height - 2 * self.eventBorderWidth
+                               evX = left + xpos + self.eventBorderVerWidth + self.eventNamePadding
+                               evY = top + self.eventBorderHorWidth
+                               evW = ewidth - 2 * (self.eventBorderVerWidth + self.eventNamePadding)
+                               evH = height - 2 * self.eventBorderHorWidth
                                if evW > 0:
                                        res.append(MultiContentEntryText(
                                                pos = (evX, evY),
@@ -549,8 +556,8 @@ class EPGList(HTMLComponent, GUIComponent):
                else:
                        if selected and self.selEvPix:
                                res.append(MultiContentEntryPixmapAlphaTest(
-                                       pos = (r2.x + self.eventBorderWidth, r2.y + self.eventBorderWidth),
-                                       size = (r2.w - 2 * self.eventBorderWidth, r2.h - 2 * self.eventBorderWidth),
+                                       pos = (r2.x + self.eventBorderVerWidth, r2.y + self.eventBorderHorWidth),
+                                       size = (r2.w - 2 * self.eventBorderVerWidth, r2.h - 2 * self.eventBorderHorWidth),
                                        png = self.selEvPix,
                                        flags = BT_SCALE))
                return res
@@ -753,7 +760,7 @@ class TimelineText(HTMLComponent, GUIComponent):
                                line = time_lines[x]
                                old_pos = line.position
                                line.setPosition(xpos + eventLeft, old_pos[1])
-                               line.visible = True
+                               line.visible = config.misc.graph_mepg.show_timelines.value is "all"
                                xpos += incWidth
                        for x in range(num_lines, MAX_TIMELINES):
                                time_lines[x].visible = False
@@ -768,7 +775,7 @@ class TimelineText(HTMLComponent, GUIComponent):
                        new_pos = (xpos + eventLeft, old_pos[1])
                        if old_pos != new_pos:
                                timeline_now.setPosition(new_pos[0], new_pos[1])
-                       timeline_now.visible = True
+                       timeline_now.visible = config.misc.graph_mepg.show_timelines.value in ("all", "now")
                else:
                        timeline_now.visible = False
 
@@ -859,6 +866,12 @@ class GraphMultiEPG(Screen, HelpableScreen):
                        }, -1)
                self["inputactions"].csel = self
 
+               self["CSFDActions"] = HelpableActionMap(self, "CSFDActions", # ims
+                       {
+                               "csfd": (self.csfd, _("Display CSFD for selected event")),
+                       }, -1)
+               self["CSFDActions"].csel = self
+
                self.protectContextMenu = True
                self.updateTimelineTimer = eTimer()
                self.updateTimelineTimer.callback.append(self.moveTimeLines)
@@ -866,6 +879,23 @@ class GraphMultiEPG(Screen, HelpableScreen):
                self.onLayoutFinish.append(self.onCreate)
                self.previousref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
 
+       def csfd(self): #ims
+               def isCSFD():
+                       try:
+                               from Plugins.Extensions.CSFD.plugin import CSFD
+                       except ImportError:
+                               self.session.open(MessageBox, _("The CSFD plugin is not installed!\nPlease install it."), type = MessageBox.TYPE_INFO,timeout = 5 )
+                               return False
+                       else:
+                               return True
+
+               if isCSFD():
+                       event = self["list"].getCurrent()[0]
+                       if event:
+                               from Plugins.Extensions.CSFD.plugin import CSFD
+                               self.session.open(CSFD, event.getEventName())
+
+
        def prevPage(self):
                self["list"].moveTo(eListbox.pageUp)
 
index 76fb023..0ce67fc 100644 (file)
@@ -58,6 +58,7 @@ class GraphMultiEpgSetup(Screen, ConfigListScreen):
                self.list.append(getConfigListEntry(_("Function of OK button"), config.misc.graph_mepg.OKButton))
                self.list.append(getConfigListEntry(_("Alignment of service names"), config.misc.graph_mepg.servicename_alignment))
                self.list.append(getConfigListEntry(_("Alignment of events"), config.misc.graph_mepg.event_alignment))
+               self.list.append(getConfigListEntry(_("Show vertical timelines"), config.misc.graph_mepg.show_timelines))
                self.list.append(getConfigListEntry(_("Center time-labels and remove date"), config.misc.graph_mepg.center_timeline))
                self.list.append(getConfigListEntry(_("Show in extensions menu"), config.misc.graph_mepg.extension_menu))
                self.list.append(getConfigListEntry(_("Silently zap between bouquets"), config.misc.graph_mepg.silent_bouquet_change))