Skip to content

Commit

Permalink
herpoi changes
Browse files Browse the repository at this point in the history
  • Loading branch information
herpoi committed Apr 22, 2017
1 parent 0312021 commit 1b01c11
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 16 deletions.
7 changes: 5 additions & 2 deletions data/keymap.xml
Expand Up @@ -188,6 +188,7 @@
</map>

<map context="InfobarShowHideActions">
<key id="KEY_INFO" mapto="toggleShowInfo" flags="m"/>
<key id="KEY_OK" mapto="toggleShow" flags="m"/>
<key id="KEY_ENTER" mapto="toggleShow" flags="m"/>
<key id="KEY_EXIT" mapto="hide" flags="m"/>
Expand Down Expand Up @@ -314,6 +315,8 @@
</device>
<key id="KEY_PLAYPAUSE" mapto="playpauseService" flags="m"/>
<key id="KEY_PAUSE" mapto="pauseService" flags="m"/>
<key id="KEY_DOWN" mapto="pauseService" flags="m"/>
<key id="KEY_UP" mapto="unPauseService" flags="m"/>
<key id="KEY_PLAY" mapto="unPauseService" flags="m"/>
<key id="KEY_REWIND" mapto="seekBack" flags="b"/>
<key id="KEY_FASTFORWARD" mapto="seekFwd" flags="b"/>
Expand All @@ -335,6 +338,8 @@
<key id="KEY_6" mapto="seekdef:6" flags="m"/>
<key id="KEY_7" mapto="seekdef:7" flags="m"/>
<key id="KEY_9" mapto="seekdef:9" flags="m"/>
<key id="KEY_GREEN" mapto="jumpPreviousMark" flags="b"/>
<key id="KEY_YELLOW" mapto="jumpNextMark" flags="b"/>
</map>

<map context="MediaPlayerSeekActions">
Expand Down Expand Up @@ -397,8 +402,6 @@
</map>

<map context="InfobarMovieListActions">
<key id="KEY_UP" mapto="up" flags="m"/>
<key id="KEY_DOWN" mapto="down" flags="m"/>
<key id="KEY_VIDEO" mapto="movieList" flags="m"/>
<key id="KEY_FILE" mapto="movieList" flags="m"/>
</map>
Expand Down
1 change: 1 addition & 0 deletions data/setup.xml
Expand Up @@ -43,6 +43,7 @@
</setup>
<setup key="userinterface" title="User interface">
<item level="0" text="Show animation while busy" description="Show busy indicator when the system is busy.">config.usage.show_spinner</item>
<item level="0" text="Volume step size" description="Configure the volume step size.">config.usage.volumestep</item>
<item level="1" text="Show positioner movement" description="Configure whether or not an icon should be shown when your motorized dish is moving.">config.usage.showdish</item>
<item level="1" text="Show positioner position" description="Configure whether or not an rotor position will be displayed on infobar">config.misc.showrotorposition</item>
<item level="1" text="Enable multiple bouquets" description="When enabled, services may be grouped in multiple bouquets.">config.usage.multibouquet</item>
Expand Down
3 changes: 2 additions & 1 deletion lib/dvb/volume.cpp
Expand Up @@ -5,6 +5,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <lib/base/nconfig.h>

#include <linux/dvb/version.h>
#if DVB_API_VERSION < 3
Expand Down Expand Up @@ -38,7 +39,7 @@ eDVBVolumecontrol* eDVBVolumecontrol::getInstance()
}

eDVBVolumecontrol::eDVBVolumecontrol()
:m_volsteps(5)
:m_volsteps(eConfigManager::getConfigIntValue("config.usage.volumestep"))
{
#ifdef HAVE_ALSA
mainVolume = NULL;
Expand Down
15 changes: 14 additions & 1 deletion lib/python/Components/EpgList.py
Expand Up @@ -13,6 +13,9 @@
from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
from skin import parseFont

from Components.Language import language
import locale

EPG_TYPE_SINGLE = 0
EPG_TYPE_MULTI = 1
EPG_TYPE_SIMILAR = 2
Expand Down Expand Up @@ -56,6 +59,13 @@ def __init__(self, type=EPG_TYPE_SINGLE, selChangedCB=None, timer = None):
self.tw = 90
self.dy = 0

self.lang = language.getLanguage()
try:
locale.setlocale(locale.LC_COLLATE, self.lang)
self.useLocale=True
except:
self.useLocale=False

if type == EPG_TYPE_SINGLE:
self.l.setBuildFunc(self.buildSingleEntry)
elif type == EPG_TYPE_MULTI:
Expand Down Expand Up @@ -346,7 +356,10 @@ def sortSingleEPG(self, type):
if list:
event_id = self.getSelectedEventId()
if type == 1:
list.sort(key=lambda x: (x[4] and x[4].lower(), x[2]))
if self.useLocale:
list.sort(key=lambda x: (locale.strxfrm(x[4]), x[2]))
else:
list.sort(key=lambda x: (x[4] and x[4].lower(), x[2]))
else:
assert(type == 0)
list.sort(key=lambda x: x[2])
Expand Down
11 changes: 11 additions & 0 deletions lib/python/Components/MovieList.py
Expand Up @@ -180,6 +180,13 @@ def __init__(self, root, list_type=None, sort_type=None, descr_state=None):
self._playInBackground = None
self._char = ''

self.lang = language.getLanguage()
try:
locale.setlocale(locale.LC_COLLATE, self.lang)
self.useLocale=True
except:
self.useLocale=False

if root is not None:
self.reload(root)

Expand Down Expand Up @@ -750,6 +757,8 @@ def buildAlphaNumericSortKey(self, x):
# x = ref,info,begin,...
ref = x[0]
name = x[1] and x[1].getName(ref)
if self.useLocale and name is not None:
name = locale.strxfrm(name)
if ref.flags & eServiceReference.mustDescent:
return (0, name and name.lower() or "", -x[2])
return (1, name and name.lower() or "", -x[2])
Expand All @@ -767,6 +776,8 @@ def buildAlphaNumericFlatSortKey(self, x):
name = p[1]
# print "Sorting for -%s-" % name

if self.useLocale and name is not None:
name = locale.strxfrm(name)
return (1, name and name.lower() or "", -x[2])

def buildBeginTimeSortKey(self, x):
Expand Down
20 changes: 15 additions & 5 deletions lib/python/Components/Renderer/Picon.py
Expand Up @@ -79,11 +79,21 @@ def getPiconName(serviceName):
if not pngname: # picon by channel name
name = ServiceReference(serviceName).getServiceName()
name = unicodedata.normalize('NFKD', unicode(name, 'utf_8', errors='ignore')).encode('ASCII', 'ignore')
name = re.sub('[^a-z0-9]', '', name.replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
if name:
pngname = findPicon(name)
if not pngname and len(name) > 2 and name.endswith('hd'):
pngname = findPicon(name[:-2])
piconname = re.sub('[^a-z0-9]', '', name.replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
if piconname:
pngname = findPicon(piconname)
if not pngname and len(piconname) > 2 and name.endswith('hd'):
pngname = findPicon(piconname[:-2])
if not pngname: # try picon by channel name without last word
piconname = ' '.join(name.split(' ')[:-1])
piconname = re.sub('[^a-z0-9]', '', piconname.replace('&', 'and').replace('+', 'plus').replace('*', 'star').lower())
pngname = findPicon(piconname)
if not pngname:
tmp = resolveFilename(SCOPE_CURRENT_SKIN, "picon_default.png")
if pathExists(tmp):
pngname = tmp
else:
pngname = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/picon_default.png")
return pngname

class Picon(Renderer):
Expand Down
6 changes: 3 additions & 3 deletions lib/python/Components/UsageConfig.py
Expand Up @@ -14,7 +14,7 @@ def InitUsageConfig():
config.usage.showdish = ConfigYesNo(default = True)
config.misc.showrotorposition = ConfigSelection(default = "no", choices = [("no", _("no")), ("yes", _("yes")), ("withtext", _("with text")), ("tunername", _("with tuner name"))])
config.usage.multibouquet = ConfigYesNo(default = True)

config.usage.volumestep = ConfigSelection(default = "2", choices = [("2"), ("5")])
config.usage.alternative_number_mode = ConfigYesNo(default = False)
def alternativeNumberModeChange(configElement):
eDVBDB.getInstance().setNumberingMode(configElement.value)
Expand Down Expand Up @@ -67,8 +67,8 @@ def alternativeNumberModeChange(configElement):
config.usage.infobar_frontend_source = ConfigSelection(default = "tuner", choices = [("settings", _("Settings")), ("tuner", _("Tuner"))])
config.usage.oldstyle_zap_controls = ConfigYesNo(default = False)
config.usage.oldstyle_channel_select_controls = ConfigYesNo(default = False)
config.usage.zap_with_ch_buttons = ConfigYesNo(default = False)
config.usage.ok_is_channelselection = ConfigYesNo(default = False)
config.usage.zap_with_ch_buttons = ConfigYesNo(default = True)
config.usage.ok_is_channelselection = ConfigYesNo(default = True)
config.usage.volume_instead_of_channelselection = ConfigYesNo(default = False)
config.usage.channelselection_preview = ConfigYesNo(default = False)
config.usage.show_spinner = ConfigYesNo(default = True)
Expand Down
40 changes: 36 additions & 4 deletions lib/python/Screens/InfoBarGenerics.py
Expand Up @@ -14,6 +14,8 @@
from Components.UsageConfig import preferredInstantRecordPath, defaultMoviePath
from Components.VolumeControl import VolumeControl
from Components.Sources.StaticText import StaticText
from Components.Pixmap import Pixmap
from Components.Renderer.Picon import getPiconName
from EpgSelection import EPGSelection
from Plugins.Plugin import PluginDescriptor

Expand Down Expand Up @@ -225,12 +227,14 @@ class InfoBarShowHide(InfoBarScreenSaver):
STATE_HIDING = 1
STATE_SHOWING = 2
STATE_SHOWN = 3
STATE_EPG = 4
FLAG_HIDE_VBI = 512

def __init__(self):
self["ShowHideActions"] = ActionMap( ["InfobarShowHideActions"] ,
{
"toggleShow": self.okButtonCheck,
"toggleShowInfo": self.toggleShow,
"hide": self.keyHide,
"toggleShowLong" : self.toggleShowLong,
"hideLong" : self.hideLong,
Expand Down Expand Up @@ -313,8 +317,8 @@ def keyHide(self):
self.session.openWithCallback(self.hidePipOnExitCallback, MessageBox, _("Disable Picture in Picture"), simple=True)
else:
self.hidePipOnExitCallback(True)
elif config.usage.ok_is_channelselection.value and hasattr(self, "openServiceList"):
self.toggleShow()
# elif config.usage.ok_is_channelselection.value and hasattr(self, "openServiceList"):
# self.toggleShow()
elif self.__state == self.STATE_SHOWN:
self.hide()

Expand Down Expand Up @@ -355,6 +359,12 @@ def doTimerHide(self):
if self.__state == self.STATE_SHOWN:
self.hide()

def epg(self):
self.__state = self.STATE_EPG
self.hide()
self.hideTimer.stop()
self.openEventView()

def okButtonCheck(self):
if config.usage.ok_is_channelselection.value and hasattr(self, "openServiceList"):
if isinstance(self, InfoBarTimeshift) and self.timeshiftEnabled() and isinstance(self, InfoBarSeek) and self.seekstate == self.SEEK_STATE_PAUSE:
Expand All @@ -377,7 +387,9 @@ def showSecondInfoBar(self):
self.show()
self.actualSecondInfoBarScreen.show()
self.startHideTimer()
else:
elif self.__state == self.STATE_SHOWN:
self.epg()
elif self.__state == self.STATE_EPG:
self.hide()
self.hideTimer.stop()

Expand Down Expand Up @@ -483,6 +495,12 @@ def handleServiceName(self):
if not self.startBouquet:
self.startBouquet = self.bouquet

def handlePicon(self):
if self.service is not None:
sname = self.service.toString()
pngname = getPiconName(sname)
self["picon"].instance.setPixmapFromFile(pngname)

def keyBlue(self):
self.startTimer()
if self.searchNumber:
Expand All @@ -498,6 +516,7 @@ def keyNumberGlobal(self, number):
self["number"].text = self["number_summary"].text = self.numberString

self.handleServiceName()
self.handlePicon()

if len(self.numberString) >= 5:
self.keyOK()
Expand All @@ -514,7 +533,7 @@ def __init__(self, session, number, searchNumberFunction = None):
self["channel_summary"] = StaticText(_("Channel:"))
self["number_summary"] = StaticText(self.numberString)
self["servicename_summary"] = StaticText()

self["picon"] = Pixmap()
self.handleServiceName()

self["actions"] = NumberActionMap( [ "SetupActions", "ShortcutActions" ],
Expand All @@ -539,6 +558,14 @@ def __init__(self, session, number, searchNumberFunction = None):
self.Timer.start(250)
self.startTimer()

def onLayoutReady(self):
self.updateData()
self.startTimer()

def updateData(self):
self.handleServiceName()
self.handlePicon()

def startTimer(self, repeat=False):
self.timer_target = repeat and self.timer_counter < 6 and [4,4,4,5,8,10][self.timer_counter] or 12
self.timer_counter = 0
Expand All @@ -548,6 +575,8 @@ def endTimer(self):
if self.timer_counter > self.timer_target:
self.keyOK()

self.onLayoutFinish.append(self.handlePicon)

class InfoBarNumberZap:
""" Handles an initial number for NumberZapping """
def __init__(self):
Expand Down Expand Up @@ -658,6 +687,7 @@ def __init__(self):
"historyNext": (self.historyNext, _("Switch to next channel in history")),
"keyChannelUp": (self.keyChannelUpCheck, self.getKeyChannelUpHelptext),
"keyChannelDown": (self.keyChannelDownCheck, self.getKeyChannelDownHelptext),
"openServiceList": (self.openServiceList, _("Open service list")),
})

def showTvChannelList(self, zap=False):
Expand Down Expand Up @@ -975,6 +1005,8 @@ def __init__(self):
"showEventInfoSingleEPG": (self.showSingleEPG, _("Show single service EPG")),
"showEventInfoMultiEPG": (self.showMultiEPG, _("Show multi channel EPG")),
"showInfobarOrEpgWhenInfobarAlreadyVisible": self.showEventInfoWhenNotVisible,
"showSingleEPG": self.openSingleServiceEPG,
"showMultiEPG": self.openMultiServiceEPG,
})

def getEPGPluginList(self, getAll=False):
Expand Down

0 comments on commit 1b01c11

Please sign in to comment.