From 91f1726f99acf507973513a7203cbd1306275718 Mon Sep 17 00:00:00 2001 From: Fraxinas Date: Mon, 8 Dec 2008 14:50:20 +0100 Subject: change character encoding of source file from 8859-1 to utf-8 --- lib/python/Tools/NumericalTextInput.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Tools/NumericalTextInput.py b/lib/python/Tools/NumericalTextInput.py index be4cf01f..c5576405 100644 --- a/lib/python/Tools/NumericalTextInput.py +++ b/lib/python/Tools/NumericalTextInput.py @@ -1,4 +1,4 @@ -# -*- coding: iso-8859-1 -*- +# -*- coding: utf-8 -*- from enigma import eTimer from Components.Language import language @@ -33,33 +33,33 @@ class NumericalTextInput: if self.lang == 'de_DE': self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 self.mapping.append (u" 1") # 1 - self.mapping.append (u"abc2ABC") # 2 + self.mapping.append (u"aäbc2AÄBC") # 2 self.mapping.append (u"def3DEF") # 3 self.mapping.append (u"ghi4GHI") # 4 self.mapping.append (u"jkl5JKL") # 5 - self.mapping.append (u"mno6MNO") # 6 - self.mapping.append (u"pqrs7PQRS") # 7 - self.mapping.append (u"tuv8TUV") # 8 + self.mapping.append (u"mnoö6MNOÖ") # 6 + self.mapping.append (u"pqrsß7PQRSß") # 7 + self.mapping.append (u"tuüv8TUÜV") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 elif self.lang == 'es_ES': self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 self.mapping.append (u" 1") # 1 - self.mapping.append (u"abc2ABC") # 2 - self.mapping.append (u"def3DEF") # 3 - self.mapping.append (u"ghi4GHI") # 4 + self.mapping.append (u"abcáà2ABCÁÀ") # 2 + self.mapping.append (u"deéèf3DEFÉÈ") # 3 + self.mapping.append (u"ghiíì4GHIÍÌ") # 4 self.mapping.append (u"jkl5JKL") # 5 - self.mapping.append (u"mno6MNO") # 6 + self.mapping.append (u"mnñoóò6MNÑOÓÒ") # 6 self.mapping.append (u"pqrs7PQRS") # 7 - self.mapping.append (u"tuv8TUV") # 8 + self.mapping.append (u"tuvúù8TUVÚÙ") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 if self.lang in ['sv_SE', 'fi_FI']: self.mapping.append (u".,?'+\"0-()@/:_$!") # 0 self.mapping.append (u" 1") # 1 - self.mapping.append (u"abc2ABC") # 2 - self.mapping.append (u"def3DEF") # 3 + self.mapping.append (u"abcåä2ABCÅÄ") # 2 + self.mapping.append (u"defé3DEFÉ") # 3 self.mapping.append (u"ghi4GHI") # 4 self.mapping.append (u"jkl5JKL") # 5 - self.mapping.append (u"mno6MNO") # 6 + self.mapping.append (u"mnoö6MNOÖ") # 6 self.mapping.append (u"pqrs7PQRS") # 7 self.mapping.append (u"tuv8TUV") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 -- cgit v1.2.3 From 5b37109a8002420247a5abf46841c95365e88036 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 8 Dec 2008 13:10:44 +0100 Subject: follow libdreamdvd changes to support scaling (needs libdreamdvd >= 20081208) --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 8 ++-- .../Extensions/DVDPlayer/src/servicedvd.cpp | 56 ++++++++++++++++------ 2 files changed, 46 insertions(+), 18 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index b7d66a82..40feaffe 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -352,7 +352,7 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP if file.mimetype == "video/x-dvd": self.dvd_device = devicepath print "physical dvd found:", self.dvd_device - self.physicalDVD = True + self.physicalDVD = True self.dvd_filelist = dvd_filelist self.onFirstExecBegin.append(self.showFileBrowser) @@ -387,9 +387,6 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP def serviceStarted(self): #override InfoBarShowHide function self.dvdScreen.show() - subs = self.getServiceInterface("subtitle") - if subs: - subs.enableSubtitles(self.dvdScreen.instance, None) def doEofInternal(self, playing): if self.in_menu: @@ -588,6 +585,9 @@ class DVDPlayer(Screen, InfoBarBase, InfoBarNotifications, InfoBarSeek, InfoBarP self.service = self.session.nav.getCurrentService() print "self.service", self.service print "cur_dlg", self.session.current_dialog + subs = self.getServiceInterface("subtitle") + if subs: + subs.enableSubtitles(self.dvdScreen.instance, None) def exitCB(self, answer): if answer is not None: diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 1add04ab..0a3d0359 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -87,30 +87,48 @@ DEFINE_REF(eServiceDVD); eServiceDVD::eServiceDVD(const char *filename): m_filename(filename), m_ddvdconfig(ddvd_create()), - m_pixmap(new gPixmap(eSize(720, 576), 32)), m_subtitle_widget(0), m_state(stIdle), m_current_trick(0), m_pump(eApp, 1) { + int aspect = DDVD_16_9; + int policy = DDVD_PAN_SCAN; + + char tmp[255]; + ssize_t rd; + m_sn = eSocketNotifier::create(eApp, ddvd_get_messagepipe_fd(m_ddvdconfig), eSocketNotifier::Read|eSocketNotifier::Priority|eSocketNotifier::Error|eSocketNotifier::Hungup); - std::string aspect; eDebug("SERVICEDVD construct!"); // create handle ddvd_set_dvd_path(m_ddvdconfig, filename); ddvd_set_ac3thru(m_ddvdconfig, 0); ddvd_set_language(m_ddvdconfig, "de"); - if (ePythonConfigQuery::getConfigValue("config.av.aspect", aspect) != 0) - aspect = "16_9"; - if (aspect == "4_3_letterbox") - ddvd_set_video(m_ddvdconfig, DDVD_4_3_LETTERBOX, DDVD_PAL); - else if (aspect == "4_3_panscan") - ddvd_set_video(m_ddvdconfig, DDVD_4_3_PAN_SCAN, DDVD_PAL); - else - ddvd_set_video(m_ddvdconfig, DDVD_16_9, DDVD_PAL); + int fd = open("/proc/stb/video/aspect", O_RDONLY); + if (fd > -1) + { + rd = read(fd, tmp, 255); + if (rd > 2 && !strncmp(tmp, "4:3", 3)) + aspect = DDVD_4_3; + else if (rd > 4 && !strncmp(tmp, "16:10", 5)) + aspect = DDVD_16_10; + close(fd); + } + + fd = open("/proc/stb/video/policy", O_RDONLY); + if (fd > -1) + { + rd = read(fd, tmp, 255); + if (rd > 6 && !strncmp(tmp, "bestfit", 3)) + aspect = DDVD_JUSTSCALE; + else if (rd > 8 && !strncmp(tmp, "letterbox", 5)) + aspect = DDVD_LETTERBOX; + close(fd); + } + + ddvd_set_video(m_ddvdconfig, aspect, policy, DDVD_PAL /*unused*/); - ddvd_set_lfb(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, 720, 576, 4, 720*4); CONNECT(m_sn->activated, eServiceDVD::gotMessage); CONNECT(m_pump.recv_msg, eServiceDVD::gotThreadMessage); strcpy(m_ddvd_titlestring,""); @@ -159,7 +177,7 @@ void eServiceDVD::gotMessage(int /*what*/) case DDVD_SCREEN_UPDATE: eDebug("DVD_SCREEN_UPDATE!"); if (m_subtitle_widget) - m_subtitle_widget->setPixmap(m_pixmap, eRect(0, 0, 720, 576)); + m_subtitle_widget->setPixmap(m_pixmap, eRect(ePoint(0, 0), m_pixmap->size())); break; case DDVD_SHOWOSD_STATE_PLAY: { @@ -272,7 +290,6 @@ RESULT eServiceDVD::start() assert(m_state == stIdle); m_state = stRunning; eDebug("eServiceDVD starting"); - run(); // m_event(this, evStart); return 0; } @@ -516,11 +533,22 @@ RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) /* { if (m_subtitle_widget) delete m_subtitle_widget; + m_subtitle_widget = new eSubtitleWidget(parent); m_subtitle_widget->resize(parent->size()); - m_subtitle_widget->setPixmap(m_pixmap, eRect(0, 0, 720, 576)); + + eSize size = parent->size(); + + if (!m_pixmap) + { + m_pixmap = new gPixmap(size, 32); + ddvd_set_lfb(m_ddvdconfig, (unsigned char *)m_pixmap->surface->data, size.width(), size.height(), 4, size.width()*4); + run(); // start the thread + } + m_subtitle_widget->setZPosition(-1); m_subtitle_widget->show(); + return 0; } -- cgit v1.2.3 From f1b8049d3735b3f6544e84817e9c7d3bca474d5e Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 8 Dec 2008 15:50:30 +0100 Subject: remove agc --- lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py index d67a97cb..c8aa2718 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py @@ -28,16 +28,13 @@ class PositionerSetup(Screen): - - + - - + - - + @@ -87,14 +84,11 @@ class PositionerSetup(Screen): self.createSetup() self["snr"] = Label() - self["agc"] = Label() self["ber"] = Label() self["lock"] = Label() self["snr_percentage"] = TunerInfo(TunerInfo.SNR_PERCENTAGE, statusDict = self.frontendStatus) - self["agc_percentage"] = TunerInfo(TunerInfo.AGC_PERCENTAGE, statusDict = self.frontendStatus) self["ber_value"] = TunerInfo(TunerInfo.BER_VALUE, statusDict = self.frontendStatus) self["snr_bar"] = TunerInfo(TunerInfo.SNR_BAR, statusDict = self.frontendStatus) - self["agc_bar"] = TunerInfo(TunerInfo.AGC_BAR, statusDict = self.frontendStatus) self["ber_bar"] = TunerInfo(TunerInfo.BER_BAR, statusDict = self.frontendStatus) self["lock_state"] = TunerInfo(TunerInfo.LOCK_STATE, statusDict = self.frontendStatus) @@ -330,10 +324,8 @@ class PositionerSetup(Screen): if self.frontend: self.frontend.getFrontendStatus(self.frontendStatus) self["snr_percentage"].update() - self["agc_percentage"].update() self["ber_value"].update() self["snr_bar"].update() - self["agc_bar"].update() self["ber_bar"].update() self["lock_state"].update() transponderdata = self.tuner.getTransponderData() -- cgit v1.2.3 From c484030a629ae2dc308d87a6cceeb3bb79e0aefd Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 8 Dec 2008 16:27:17 +0100 Subject: small fix --- lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 0a3d0359..5d6a0870 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -120,9 +120,9 @@ eServiceDVD::eServiceDVD(const char *filename): if (fd > -1) { rd = read(fd, tmp, 255); - if (rd > 6 && !strncmp(tmp, "bestfit", 3)) + if (rd > 6 && !strncmp(tmp, "bestfit", 7)) aspect = DDVD_JUSTSCALE; - else if (rd > 8 && !strncmp(tmp, "letterbox", 5)) + else if (rd > 8 && !strncmp(tmp, "letterbox", 9)) aspect = DDVD_LETTERBOX; close(fd); } -- cgit v1.2.3 From 50182c33fbbd4845ceb81afa7a5cbf263c929412 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 15:59:34 +0100 Subject: add SNRdB to TunerInfo --- lib/python/Components/TunerInfo.py | 40 +++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/TunerInfo.py b/lib/python/Components/TunerInfo.py index d8b4d064..39f54c0b 100644 --- a/lib/python/Components/TunerInfo.py +++ b/lib/python/Components/TunerInfo.py @@ -10,13 +10,14 @@ class TunerInfo(GUIComponent): BER = 2 LOCK = 3 SNR_PERCENTAGE = 0 - AGC_PERCENTAGE = 1 - BER_VALUE = 2 - SNR_BAR = 3 - AGC_BAR = 4 - BER_BAR = 5 - LOCK_STATE = 6 - SYNC_STATE = 7 + SNR_DB = 1 + AGC_PERCENTAGE = 2 + BER_VALUE = 3 + SNR_BAR = 4 + AGC_BAR = 5 + BER_BAR = 6 + LOCK_STATE = 7 + SYNC_STATE = 8 def __init__(self, type, servicefkt = None, frontendfkt = None, statusDict = None): GUIComponent.__init__(self) @@ -47,7 +48,9 @@ class TunerInfo(GUIComponent): return val*100/65535 def update(self): - if self.type == self.SNR_PERCENTAGE or self.type == self.SNR_BAR: + if self.type == self.SNR_DB: + value = self.getValue(self.SNR_DB) + elif self.type == self.SNR_PERCENTAGE or self.type == self.SNR_BAR: value = self.getValue(self.SNR) * 100 / 65536 elif self.type == self.AGC_PERCENTAGE or self.type == self.AGC_BAR: value = self.getValue(self.AGC) * 100 / 65536 @@ -55,8 +58,13 @@ class TunerInfo(GUIComponent): value = self.getValue(self.BER) elif self.type == self.LOCK_STATE: value = self.getValue(self.LOCK) - - if self.type == self.SNR_PERCENTAGE or self.type == self.AGC_PERCENTAGE: + + if self.type == self.SNR_DB: + if value != 0x12345678: + self.setText("%3.02f dB" % (value / 100.0)) + else: + self.setText("") + elif self.type == self.SNR_PERCENTAGE or self.type == self.AGC_PERCENTAGE: self.setText("%d%%" % (value)) elif self.type == self.BER_VALUE: self.setText("%d" % (value)) @@ -72,7 +80,9 @@ class TunerInfo(GUIComponent): def getValue(self, what): if self.statusDict: - if what == self.SNR: + if what == self.SNR_DB: + return self.statusDict.get("tuner_signal_quality_db", 0x12345678) + elif what == self.SNR: return self.statusDict.get("tuner_signal_quality", 0) elif what == self.AGC: return self.statusDict.get("tuner_signal_power", 0) @@ -85,7 +95,9 @@ class TunerInfo(GUIComponent): if service is not None: feinfo = service.frontendInfo() if feinfo is not None: - if what == self.SNR: + if what == self.SNR_DB: + return feinfo.getFrontendInfo(iFrontendInformation.signalQualitydB) + elif what == self.SNR: return feinfo.getFrontendInfo(iFrontendInformation.signalQuality) elif what == self.AGC: return feinfo.getFrontendInfo(iFrontendInformation.signalPower) @@ -96,7 +108,9 @@ class TunerInfo(GUIComponent): elif self.frontendfkt: frontend = self.frontendfkt() if frontend: - if what == self.SNR: + if what == self.SNR_DB: + return frontend.readFrontendData(iFrontendInformation.signalQualitydB) + elif what == self.SNR: return frontend.readFrontendData(iFrontendInformation.signalQuality) elif what == self.AGC: return frontend.readFrontendData(iFrontendInformation.signalPower) -- cgit v1.2.3 From 75df7af9707fe12227d7a0b5873e9c57c3a6fc6e Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 15:59:56 +0100 Subject: remove unneeded skin (already in skin_default.xml) --- .../Plugins/SystemPlugins/Satfinder/plugin.py | 40 ---------------------- 1 file changed, 40 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py b/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py index 74568855..064ac673 100644 --- a/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Satfinder/plugin.py @@ -39,46 +39,6 @@ class Tuner: self.frontend.tune(self.lastparm) class Satfinder(ScanSetup): - skin = """ - - - - - - - - - - SNRdB - - - SNR - - - AGC - - - BER - - - SNR - - - AGC - - - BER - - - LOCK - - - - LOCK - Invert - - """ - def openFrontend(self): res_mgr = eDVBResourceManager.getInstance() if res_mgr: -- cgit v1.2.3 From bb349d44c5c3e963d25f31c085e92407d2c2b0a9 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 16:00:18 +0100 Subject: also show SNR in dB in PositionerSetup --- .../SystemPlugins/PositionerSetup/plugin.py | 36 ++++++++++------------ 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py index c8aa2718..928d72a6 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py @@ -26,19 +26,20 @@ class PositionerSetup(Screen): - - - - - - + + + + + + + - - + + - - - + + + @@ -78,24 +79,18 @@ class PositionerSetup(Screen): self["yellow"] = self.yellow self.blue = Label("") self["blue"] = self.blue - + self.list = [] self["list"] = ConfigList(self.list) self.createSetup() - - self["snr"] = Label() - self["ber"] = Label() - self["lock"] = Label() + + self["snr_db"] = TunerInfo(TunerInfo.SNR_DB, statusDict = self.frontendStatus) self["snr_percentage"] = TunerInfo(TunerInfo.SNR_PERCENTAGE, statusDict = self.frontendStatus) self["ber_value"] = TunerInfo(TunerInfo.BER_VALUE, statusDict = self.frontendStatus) self["snr_bar"] = TunerInfo(TunerInfo.SNR_BAR, statusDict = self.frontendStatus) self["ber_bar"] = TunerInfo(TunerInfo.BER_BAR, statusDict = self.frontendStatus) self["lock_state"] = TunerInfo(TunerInfo.LOCK_STATE, statusDict = self.frontendStatus) - self["frequency"] = Label() - self["symbolrate"] = Label() - self["fec"] = Label() - self["frequency_value"] = Label("") self["symbolrate_value"] = Label("") self["fec_value"] = Label("") @@ -323,6 +318,7 @@ class PositionerSetup(Screen): def updateStatus(self): if self.frontend: self.frontend.getFrontendStatus(self.frontendStatus) + self["snr_db"].update() self["snr_percentage"].update() self["ber_value"].update() self["snr_bar"].update() -- cgit v1.2.3 From c634e149898349456965ca2dab6b66dc8e2a0e06 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 21:31:39 +0100 Subject: blit just needed regions --- lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 5d6a0870..4a85a020 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -176,8 +176,11 @@ void eServiceDVD::gotMessage(int /*what*/) } case DDVD_SCREEN_UPDATE: eDebug("DVD_SCREEN_UPDATE!"); - if (m_subtitle_widget) - m_subtitle_widget->setPixmap(m_pixmap, eRect(ePoint(0, 0), m_pixmap->size())); + if (m_subtitle_widget) { + int x1,x2,y1,y2; + ddvd_get_last_blit_area(m_ddvdconfig, &x1, &x2, &y1, &y2); + m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, x2-x1, y2-y1)); + } break; case DDVD_SHOWOSD_STATE_PLAY: { -- cgit v1.2.3 From 8e5c4dddb513786c7a558a88da25c3e9cddc8964 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 23:07:03 +0100 Subject: DVDPlayer/plugin.py: set size of overlay screen depended to desktop size --- lib/python/Plugins/Extensions/DVDPlayer/plugin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py index 40feaffe..29e69ee1 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/plugin.py +++ b/lib/python/Plugins/Extensions/DVDPlayer/plugin.py @@ -1,5 +1,5 @@ from os import path as os_path, remove as os_remove, listdir as os_listdir, system -from enigma import eTimer, iPlayableService, iServiceInformation, eServiceReference, iServiceKeys +from enigma import eTimer, iPlayableService, iServiceInformation, eServiceReference, iServiceKeys, getDesktop from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Screens.ChoiceBox import ChoiceBox @@ -109,10 +109,11 @@ class DVDSummary(Screen): self["Title"].setText(title) class DVDOverlay(Screen): - skin = """""" def __init__(self, session, args = None): + desktop_size = getDesktop(0).size() + DVDOverlay.skin = """""" %(desktop_size.width(), desktop_size.height()) Screen.__init__(self, session) - + class ChapterZap(Screen): skin = """ -- cgit v1.2.3 From 9ef5b8eaa067430868c27f7ef063ecf32e84ea68 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 23:23:40 +0100 Subject: RemainingToText.py: more flexible use --- lib/python/Components/Converter/RemainingToText.py | 34 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Converter/RemainingToText.py b/lib/python/Components/Converter/RemainingToText.py index adefe9cf..4249e30a 100644 --- a/lib/python/Components/Converter/RemainingToText.py +++ b/lib/python/Components/Converter/RemainingToText.py @@ -2,19 +2,43 @@ from Components.Converter.Converter import Converter from Components.Element import cached class RemainingToText(Converter, object): + DEFAULT = 0 + WITH_SECONDS = 1 + NO_SECONDS = 2 + def __init__(self, type): Converter.__init__(self, type) + if type == "WithSeconds": + self.type = self.WITH_SECONDS + elif type == "NoSeconds": + self.type = self.NO_SECONDS + else: + self.type = self.DEFAULT @cached def getText(self): - r = self.source.time - if r is None: + time = self.source.time + if time is None: return "" (duration, remaining) = self.source.time - if remaining is not None: - return "+%d min" % (remaining / 60) + + if self.type == self.WITH_SECONDS: + if remaining is not None: + return "%d:%02d:%02d" % (remaining / 3600, (remaining / 60) - ((remaining / 3600) * 60), remaining % 60) + else: + return "%02d:%02d:%02d" % (duration / 3600, (duration / 60) - ((duration / 3600) * 60), duration % 60) + elif self.type == self.NO_SECONDS: + if remaining is not None: + return "+%d:%02d" % (remaining / 3600, (remaining / 60) - ((remaining / 3600) * 60)) + else: + return "%02d:%02d" % (duration / 3600, (duration / 60) - ((duration / 3600) * 60)) + elif self.type == self.DEFAULT: + if remaining is not None: + return "+%d min" % (remaining / 60) + else: + return "%d min" % (duration / 60) else: - return "%d min" % (duration / 60) + return "???" text = property(getText) -- cgit v1.2.3 From efe45cc966495fe6d581a465df5a3c6a1280d633 Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 9 Dec 2008 23:37:05 +0100 Subject: ServicePosition.py: add Option "ShowNoSeconds" --- lib/python/Components/Converter/ServicePosition.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py index b488258b..d7a55dae 100644 --- a/lib/python/Components/Converter/ServicePosition.py +++ b/lib/python/Components/Converter/ServicePosition.py @@ -19,6 +19,7 @@ class ServicePosition(Converter, Poll, object): self.negate = 'Negate' in args self.detailed = 'Detailed' in args self.showHours = 'ShowHours' in args + self.showNoSeconds = 'ShowNoSeconds' in args if self.detailed: self.poll_interval = 100 @@ -34,7 +35,7 @@ class ServicePosition(Converter, Poll, object): elif type == "Gauge": self.type = self.TYPE_GAUGE else: - raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours}" + raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours|NoSeconds}" self.poll_enabled = self.type != self.TYPE_LENGTH @@ -94,9 +95,15 @@ class ServicePosition(Converter, Poll, object): if not self.detailed: if self.showHours: - return sign + "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) + if self.showNoSeconds: + return sign + "%d:%02d" % (l/3600, l%3600/60) + else: + return sign + "%d:%02d:%02d" % (l/3600, l%3600/60, l%60) else: - return sign + "%d:%02d" % (l/60, l%60) + if self.showNoSeconds: + return sign + "%d" % (l/60) + else: + return sign + "%d:%02d" % (l/60, l%60) else: if self.showHours: return sign + "%d:%02d:%02d:%03d" % ((l/3600/90000), (l/90000)%3600/60, (l/90000)%60, (l%90000)/90) -- cgit v1.2.3 From a6976a2c3c6256a0c860827550aabd7ee9bdf3bf Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 10 Dec 2008 02:45:26 +0100 Subject: fix mem leak --- lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/python') diff --git a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp index 4a85a020..02c0ca94 100644 --- a/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp +++ b/lib/python/Plugins/Extensions/DVDPlayer/src/servicedvd.cpp @@ -280,6 +280,7 @@ eServiceDVD::~eServiceDVD() kill(); saveCuesheet(); ddvd_close(m_ddvdconfig); + disableSubtitles(0); } RESULT eServiceDVD::connectEvent(const Slot2 &event, ePtr &connection) @@ -534,8 +535,7 @@ PyObject *eServiceDVD::getInfoObject(int w) RESULT eServiceDVD::enableSubtitles(eWidget *parent, SWIG_PYOBJECT(ePyObject) /*entry*/) { - if (m_subtitle_widget) - delete m_subtitle_widget; + delete m_subtitle_widget; m_subtitle_widget = new eSubtitleWidget(parent); m_subtitle_widget->resize(parent->size()); -- cgit v1.2.3