Ejemplo n.º 1
0
 def getMessageBeforeClose(self, afterSave):
     needPluginUpdate = False
     if afterSave and config.plugins.iptvplayer.ListaGraficzna.value and 0 == GetAvailableIconSize(False):
         needPluginUpdate = True
     else:
         enabledHostsList = GetEnabledHostsList()
         hostsFromFolder  = GetHostsList(fromList=False, fromHostFolder=True)
         if self.remove_diabled_hostsOld != config.plugins.iptvplayer.remove_diabled_hosts.value:
             if config.plugins.iptvplayer.remove_diabled_hosts.value:
                 for folderItem in hostsFromFolder:
                     if folderItem in enabledHostsList:
                         continue
                     else:
                         # there is host file which is not enabled, 
                         # so we need perform update to remove it
                         needPluginUpdate = True
                         break
             else:
                 hostsFromList = GetHostsList(fromList=True, fromHostFolder=False)
                 if not set(hostsFromList).issubset(set(hostsFromFolder)):
                     # there is missing hosts files, we need updated does not matter 
                     # if these hosts are enabled or disabled
                     needPluginUpdate = True
             
         elif config.plugins.iptvplayer.remove_diabled_hosts.value and enabledHostsList != self.enabledHostsListOld:
             hostsFromList = GetHostsList(fromList=True, fromHostFolder=False)
             diffDisabledHostsList = set(self.enabledHostsListOld).difference(set(enabledHostsList))
             diffList = set(enabledHostsList).symmetric_difference(set(self.enabledHostsListOld))
             for hostItem in diffList:
                 if hostItem in hostsFromList:
                     if hostItem in diffDisabledHostsList:
                         if hostItem in hostsFromFolder:
                             # standard host has been disabled but it is still in folder
                             needPluginUpdate = True
                             break
                     else:
                         if hostItem not in hostsFromFolder:
                             # standard host has been enabled but it is not in folder
                             needPluginUpdate = True
                             break
         
     if needPluginUpdate:
         return _('Some changes will be applied only after plugin update.\nDo you want to perform update now?')
     else:
         return ''
Ejemplo n.º 2
0
 def getMessageBeforeClose(self, afterSave):
     needPluginUpdate = False
     if afterSave and config.plugins.iptvplayer.ListaGraficzna.value and 0 == GetAvailableIconSize(False):
         needPluginUpdate = True
     else:
         enabledHostsList = GetEnabledHostsList()
         hostsFromFolder  = GetHostsList(fromList=False, fromHostFolder=True)
         if self.remove_diabled_hostsOld != config.plugins.iptvplayer.remove_diabled_hosts.value:
             if config.plugins.iptvplayer.remove_diabled_hosts.value:
                 for folderItem in hostsFromFolder:
                     if folderItem in enabledHostsList:
                         continue
                     else:
                         # there is host file which is not enabled, 
                         # so we need perform update to remove it
                         needPluginUpdate = True
                         break
             else:
                 hostsFromList = GetHostsList(fromList=True, fromHostFolder=False)
                 if not set(hostsFromList).issubset(set(hostsFromFolder)):
                     # there is missing hosts files, we need updated does not matter 
                     # if these hosts are enabled or disabled
                     needPluginUpdate = True
         elif IsUpdateNeededForHostsChangesCommit(self.enabledHostsListOld, enabledHostsList, hostsFromFolder):
             needPluginUpdate = True
     
     if needPluginUpdate:
         SetGraphicsHash("")
         SetIconsHash("")
     
     if not needPluginUpdate and config.plugins.iptvplayer.IPTVWebIterface.value != IsWebInterfaceModuleAvailable(True):
         needPluginUpdate = True
         
     if needPluginUpdate:
         return _('Some changes will be applied only after plugin update.\nDo you want to perform update now?')
     else:
         return ''
Ejemplo n.º 3
0
    def __init__(self,
                 session,
                 inList,
                 outList,
                 numOfLockedItems=0,
                 groupName='',
                 groupObj=None):
        printDBG(
            "PlayerSelectorWidget.__init__ --------------------------------")
        screenwidth = getDesktop(0).size().width()
        iconSize = GetAvailableIconSize()
        if len(
                inList
        ) >= 30 and iconSize == 100 and screenwidth and screenwidth > 1100:
            numOfRow = 4
            numOfCol = 8
        elif len(inList) > 16 and iconSize == 100:
            numOfRow = 4
            numOfCol = 5
        elif len(inList) > 12 and iconSize == 100:
            numOfRow = 4
            numOfCol = 4
        elif len(inList) > 9:
            if screenwidth and screenwidth == 1920:
                numOfRow = 4
                numOfCol = 8
            else:
                numOfRow = 3
                numOfCol = 4
        elif len(inList) > 6:
            numOfRow = 3
            numOfCol = 3
        elif len(inList) > 3:
            numOfRow = 2
            numOfCol = 3
        else:
            numOfRow = 1
            numOfCol = 3

        try:
            confNumOfRow = int(config.plugins.iptvplayer.numOfRow.value)
            confNumOfCol = int(config.plugins.iptvplayer.numOfCol.value)
            # 0 - means AUTO
            if confNumOfRow > 0: numOfRow = confNumOfRow
            if confNumOfCol > 0: numOfCol = confNumOfCol
        except Exception:
            pass

        # position of first img
        offsetCoverX = 25
        if screenwidth and screenwidth == 1920:
            offsetCoverY = 100
        else:
            offsetCoverY = 80

        # image size
        coverWidth = iconSize
        coverHeight = iconSize

        # space/distance between images
        disWidth = int(coverWidth / 3)
        disHeight = int(coverHeight / 4)

        # marker size should be larger than img
        markerWidth = 45 + coverWidth
        markerHeight = 45 + coverHeight

        # position of first marker
        offsetMarkerX = offsetCoverX - (markerWidth - coverWidth) / 2
        offsetMarkerY = offsetCoverY - (markerHeight - coverHeight) / 2

        # how to calculate position of image with indexes indxX, indxY:
        #posX = offsetCoverX + (coverWidth + disWidth) * indxX
        #posY = offsetCoverY + (coverHeight + disHeight) * indxY

        # how to calculate position of marker for image with posX, posY
        #markerPosX = posX - (markerWidth - coverWidth)/2
        #markerPosY = posY - (markerHeight - coverHeight)/2

        tmpX = coverWidth + disWidth
        tmpY = coverHeight + disHeight

        self.numOfRow = numOfRow
        self.numOfCol = numOfCol
        # position of first cover
        self.offsetCoverX = offsetCoverX
        self.offsetCoverY = offsetCoverY
        # space/distance between images
        self.disWidth = disWidth
        self.disHeight = disHeight
        # image size
        self.coverWidth = coverWidth
        self.coverHeight = coverHeight
        # marker size should be larger than img
        self.markerWidth = markerWidth
        self.markerHeight = markerHeight

        self.inList = list(inList)
        self.currList = self.inList
        self.outList = outList

        self.groupName = groupName
        self.groupObj = groupObj
        self.numOfLockedItems = numOfLockedItems

        self.IconsSize = iconSize  #do ladowania ikon
        self.MarkerSize = self.IconsSize + 45

        self.lastSelection = PlayerSelectorWidget.LAST_SELECTION.get(
            self.groupName, 0)
        self.calcDisplayVariables()

        # pagination
        self.pageItemSize = 16
        self.pageItemStartX = (offsetCoverX + tmpX * numOfCol + offsetCoverX -
                               disWidth -
                               self.numOfPages * self.pageItemSize) / 2
        if screenwidth and screenwidth == 1920:
            self.pageItemStartY = 60
        else:
            self.pageItemStartY = 40

        if screenwidth and screenwidth == 1920:
            skin = """
            <screen name="IPTVPlayerPlayerSelectorWidget" position="center,center" title="E2iPlayer %s" size="%d,%d">
            <widget name="statustext" position="0,0" zPosition="1" size="%d,50" font="Regular;36" halign="center" valign="center" transparent="1"/>
            <widget name="marker" zPosition="2" position="%d,%d" size="%d,%d" transparent="1" alphatest="blend" />
            <widget name="page_marker" zPosition="3" position="%d,%d" size="%d,%d" transparent="1" alphatest="blend" />
            <widget name="menu" zPosition="3" position="%d,10" size="70,30" transparent="1" alphatest="blend" />
            """ % (
                GetIPTVPlayerVerstion(),
                offsetCoverX + tmpX * numOfCol + offsetCoverX -
                disWidth,  # width of window
                offsetCoverY + tmpY * numOfRow + offsetCoverX -
                disHeight,  # height of window
                offsetCoverX + tmpX * numOfCol + offsetCoverX -
                disWidth,  # width of status line
                offsetMarkerX,
                offsetMarkerY,  # first marker position
                markerWidth,
                markerHeight,  # marker size
                self.pageItemStartX,
                self.pageItemStartY,  # pagination marker
                self.pageItemSize,
                self.pageItemSize,
                offsetCoverX + tmpX * numOfCol + offsetCoverX - disWidth - 70,
            )
        else:
            skin = """
            <screen name="IPTVPlayerPlayerSelectorWidget" position="center,center" title="E2iPlayer %s" size="%d,%d">
            <widget name="statustext" position="0,0" zPosition="1" size="%d,50" font="Regular;26" halign="center" valign="center" transparent="1"/>
            <widget name="marker" zPosition="2" position="%d,%d" size="%d,%d" transparent="1" alphatest="blend" />
            <widget name="page_marker" zPosition="3" position="%d,%d" size="%d,%d" transparent="1" alphatest="blend" />
            <widget name="menu" zPosition="3" position="%d,10" size="70,30" transparent="1" alphatest="blend" />
            """ % (
                GetIPTVPlayerVerstion(),
                offsetCoverX + tmpX * numOfCol + offsetCoverX -
                disWidth,  # width of window
                offsetCoverY + tmpY * numOfRow + offsetCoverX -
                disHeight,  # height of window
                offsetCoverX + tmpX * numOfCol + offsetCoverX -
                disWidth,  # width of status line
                offsetMarkerX,
                offsetMarkerY,  # first marker position
                markerWidth,
                markerHeight,  # marker size
                self.pageItemStartX,
                self.pageItemStartY,  # pagination marker
                self.pageItemSize,
                self.pageItemSize,
                offsetCoverX + tmpX * numOfCol + offsetCoverX - disWidth - 70,
            )

        for y in range(1, numOfRow + 1):
            for x in range(1, numOfCol + 1):
                skinCoverLine = """<widget name="cover_%s%s" zPosition="4" position="%d,%d" size="%d,%d" transparent="1" alphatest="blend" />""" % (
                    x,
                    y,
                    (offsetCoverX + tmpX * (x - 1)),  # pos X image
                    (offsetCoverY + tmpY * (y - 1)),  # pos Y image
                    coverWidth,
                    coverHeight)
                skin += '\n' + skinCoverLine

        # add pagination items
        for pageItemOffset in range(self.numOfPages):
            pageItemX = self.pageItemStartX + pageItemOffset * self.pageItemSize
            skinCoverLine = """<ePixmap zPosition="2" position="%d,%d" size="%d,%d" pixmap="%s" transparent="1" alphatest="blend" />""" % (
                pageItemX, self.pageItemStartY, self.pageItemSize,
                self.pageItemSize, GetIconDir('radio_button_off.png'))
            skin += '\n' + skinCoverLine
        skin += '</screen>'
        self.skin = skin

        self.session = session
        Screen.__init__(self, session)

        self.session.nav.event.append(self.__event)
        self.onClose.append(self.__onClose)

        # load icons
        self.pixmapList = []
        for idx in range(0, self.numOfItems):
            self.pixmapList.append(
                LoadPixmap(
                    GetIconDir('PlayerSelector/' + self.currList[idx][1] +
                               '%i.png' % self.IconsSize)))

        self.markerPixmap = LoadPixmap(
            GetIconDir('PlayerSelector/marker%i.png' % self.MarkerSize))
        self.markerPixmapSel = LoadPixmap(
            GetIconDir('PlayerSelector/markerSel%i.png' % self.MarkerSize))
        self.pageMarkerPixmap = LoadPixmap(GetIconDir('radio_button_on.png'))
        self.menuPixmap = LoadPixmap(GetIconDir('menu.png'))

        self["actions"] = ActionMap(
            [
                "WizardActions", "DirectionActions", "ColorActions",
                "IPTVPlayerListActions"
            ], {
                "ok": self.ok_pressed,
                "back": self.back_pressed,
                "left": self.keyLeft,
                "right": self.keyRight,
                "up": self.keyUp,
                "down": self.keyDown,
                "blue": self.keyBlue,
                "menu": self.keyMenu,
            }, -1)

        self["marker"] = Cover3()
        self["page_marker"] = Cover3()
        self["menu"] = Cover3()

        for y in range(1, self.numOfRow + 1):
            for x in range(1, self.numOfCol + 1):
                strIndex = "cover_%s%s" % (x, y)
                self[strIndex] = Cover3()

        self["statustext"] = Label(self.currList[0][0])

        self.onLayoutFinish.append(self.onStart)
        self.visible = True
        self.reorderingMode = False
        self.reorderingItemSelected = False
Ejemplo n.º 4
0
 def getMessageAfterSave(self):
     if config.plugins.iptvplayer.ListaGraficzna.value and 0 == GetAvailableIconSize(False):
         return _('Some changes will be applied only after plugin update.')
     else:
         return ''