From: Felix Domke Date: Sun, 27 Feb 2005 02:20:31 +0000 (+0000) Subject: - hopefully fixed some python/refcount stuff (__deref__ is still evil!) X-Git-Tag: 2.6.0~5923 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/dba614edd2aad3c17e244914eaef3809d8300cb1 - hopefully fixed some python/refcount stuff (__deref__ is still evil!) - first work on skin support, not really far - improved infobar - deletes components when destroying screens - fixed elistbox and component - add ability to change bouqet - real query parser still unfinished --- diff --git a/components.py b/components.py index 219e4f52..a5df8ffe 100644 --- a/components.py +++ b/components.py @@ -159,7 +159,8 @@ class Clock(HTMLComponent, GUIComponent, VariableText): # "funktionalitaet" def doClock(self): - self.setText("clock: " + time.asctime()) + t = time.localtime() + self.setText("%2d:%02d:%02d" % (t[3], t[4], t[5])) # realisierung als GUI def createWidget(self, parent, skindata): @@ -270,6 +271,7 @@ class MenuList(HTMLComponent, GUIComponent): def GUIdelete(self): self.instance.setContent(None) + del self.instance class ServiceList(HTMLComponent, GUIComponent): def __init__(self): @@ -316,18 +318,24 @@ class ServiceScan: self.progressbar = progressbar self.text = text self.scan = eComponentScan() + self.state = self.Idle + self.scanStatusChanged() + + def execBegin(self): + self.scan.statusChanged.get().append(self.scanStatusChanged) if self.scan.start(): self.state = self.Error else: self.state = self.Running - self.scan.statusChanged.get().append(self.scanStatusChanged) self.scanStatusChanged() + + def execEnd(self): + self.scan.statusChanged.get().remove(self.scanStatusChanged) + if not self.isDone(): + print "*** warning *** scan was not finished!" def isDone(self): return self.state == self.Done - - def fix(self): - self.scan.statusChanged.get().remove(self.scanStatusChanged) class ActionMap: def __init__(self, context, actions = { }, prio=0): @@ -376,6 +384,9 @@ class PerServiceDisplay(GUIComponent, VariableText): class EventInfo(PerServiceDisplay): Now = 0 Next = 1 + Now_Duration = 2 + Next_Duration = 3 + def __init__(self, navcore, now_or_next): # listen to evUpdatedEventInfo and evStopService # note that evStopService will be called once to establish a known state @@ -392,10 +403,12 @@ class EventInfo(PerServiceDisplay): if not self.navcore.getCurrentService(service): if not service.info(info): - print "got info !" ev = eServiceEventPtr() - info.getEvent(ev, self.now_or_next) - self.setText(ev.m_event_name) + info.getEvent(ev, self.now_or_next & 1) + if self.now_or_next & 2: + self.setText("%d min" % (ev.m_duration / 60)) + else: + self.setText(ev.m_event_name) print "new event info in EventInfo! yeah!" def stopEvent(self): diff --git a/include/connection.h b/include/connection.h index 5ae90d5b..a6fc4b54 100644 --- a/include/connection.h +++ b/include/connection.h @@ -6,7 +6,7 @@ class eConnection: public iObject, public Connection { -DECLARE_REF; +DECLARE_REF(eConnection); private: ePtr m_owner; public: diff --git a/keymap.xml b/keymap.xml index a17aebbc..82b8a507 100644 --- a/keymap.xml +++ b/keymap.xml @@ -19,6 +19,10 @@ + + + + diff --git a/lib/base/ebase.h b/lib/base/ebase.h index 187f9548..d9a17b79 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -171,40 +171,7 @@ public: void setRequested(int req) { requested=req; } }; - // ... und Timer -/** - * \brief Gives a callback after a specified timeout. - * - * This class emits the signal \c eTimer::timeout after the specified timeout. - */ -class eTimer -{ - eMainloop &context; - timeval nextActivation; - long interval; - bool bSingleShot; - bool bActive; -public: - /** - * \brief Constructs a timer. - * - * The timer is not yet active, it has to be started with \c start. - * \param context The thread from which the signal should be emitted. - */ - eTimer(eMainloop *context): context(*context), bActive(false) { } - ~eTimer() { if (bActive) stop(); } - - PSignal0 timeout; - void activate(); - - bool isActive() { return bActive; } - timeval &getNextActivation() { return nextActivation; } - - void start(long msec, bool singleShot=false); - void stop(); - void changeInterval(long msek); - bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; } -}; +class eTimer; // werden in einer mainloop verarbeitet class eMainloop @@ -231,6 +198,7 @@ public: void exit_loop(); }; + /** * \brief The application class. * @@ -250,4 +218,40 @@ public: eApp = 0; } }; + + // ... und Timer +/** + * \brief Gives a callback after a specified timeout. + * + * This class emits the signal \c eTimer::timeout after the specified timeout. + */ +class eTimer +{ + eMainloop &context; + timeval nextActivation; + long interval; + bool bSingleShot; + bool bActive; +public: + /** + * \brief Constructs a timer. + * + * The timer is not yet active, it has to be started with \c start. + * \param context The thread from which the signal should be emitted. + */ + eTimer(eMainloop *context = eApp): context(*context), bActive(false) { } + ~eTimer() { if (bActive) stop(); } + + PSignal0 timeout; + void activate(); + + bool isActive() { return bActive; } + timeval &getNextActivation() { return nextActivation; } + + void start(long msec, bool singleShot=false); + void stop(); + void changeInterval(long msek); + bool operator<(const eTimer& t) const { return nextActivation < t.nextActivation; } +}; + #endif diff --git a/lib/base/object.h b/lib/base/object.h index 64d9a88f..edd68a86 100644 --- a/lib/base/object.h +++ b/lib/base/object.h @@ -37,12 +37,22 @@ public: } }; -#define DECLARE_REF private: oRefCount ref; public: void AddRef(); void Release(); +#ifndef SWIG +#define DECLARE_REF(x) private: oRefCount ref; public: void AddRef(); void Release(); #ifdef OBJECT_DEBUG extern int object_total_remaining; #define DEFINE_REF(c) void c::AddRef() { ++object_total_remaining; ++ref; eDebug("OBJECT_DEBUG " #c "+%p now %d", this, (int)ref); } void c::Release() { --object_total_remaining; eDebug("OBJECT_DEBUG " #c "-%p now %d", this, ref-1); if (!--ref) delete this; } #else #define DEFINE_REF(c) void c::AddRef() { ++ref; } void c::Release() { if (!--ref) delete this; } #endif +#else +#define DECLARE_REF(x) private: void AddRef(); void Release(); +#endif + +#ifdef SWIG +class Object +{ +}; +#endif #endif diff --git a/lib/components/scan.h b/lib/components/scan.h index 073919c7..ca64f5e2 100644 --- a/lib/components/scan.h +++ b/lib/components/scan.h @@ -7,7 +7,7 @@ class eDVBScan; class eComponentScan: public Object, public iObject { -DECLARE_REF; +DECLARE_REF(eComponentScan); private: void scanEvent(int event); ePtr m_scan_event_connection; diff --git a/lib/dvb/db.h b/lib/dvb/db.h index 55998ebf..22eb0b74 100644 --- a/lib/dvb/db.h +++ b/lib/dvb/db.h @@ -8,7 +8,7 @@ class ServiceDescriptionTable; class eDVBDB: public iDVBChannelList { -DECLARE_REF; +DECLARE_REF(eDVBDB); friend class eDVBDBQuery; private: struct channel @@ -37,7 +37,7 @@ public: // we have to add a possibility to invalidate here. class eDVBDBQuery: public iDVBChannelListQuery { -DECLARE_REF; +DECLARE_REF(eDVBDBQuery); private: std::map >::iterator m_cursor; ePtr m_db; diff --git a/lib/dvb/decoder.h b/lib/dvb/decoder.h index b1e65611..b566df89 100644 --- a/lib/dvb/decoder.h +++ b/lib/dvb/decoder.h @@ -6,7 +6,7 @@ class eDVBAudio: public iObject { -DECLARE_REF; +DECLARE_REF(eDVBAudio); private: ePtr m_demux; int m_fd, m_fd_demux; @@ -19,7 +19,7 @@ public: class eDVBVideo: public iObject { -DECLARE_REF; +DECLARE_REF(eDVBVideo); private: ePtr m_demux; int m_fd, m_fd_demux; @@ -32,7 +32,7 @@ public: class eTSMPEGDecoder: public iTSMPEGDecoder { -DECLARE_REF; +DECLARE_REF(eTSMPEGDecoder); private: ePtr m_demux; ePtr m_audio; diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h index c7fa5bc0..d8c1078e 100644 --- a/lib/dvb/demux.h +++ b/lib/dvb/demux.h @@ -11,7 +11,7 @@ class eDVBDemux: public iDVBDemux friend class eDVBAudio; friend class eDVBVideo; public: - DECLARE_REF + DECLARE_REF(eDVBDemux); eDVBDemux(int adapter, int demux); virtual ~eDVBDemux(); RESULT createSectionReader(eMainloop *context, ePtr &reader); @@ -20,7 +20,7 @@ public: class eDVBSectionReader: public iDVBSectionReader, public Object { - DECLARE_REF + DECLARE_REF(eDVBSectionReader); private: int fd; Signal1 read; diff --git a/lib/dvb/dvb.h b/lib/dvb/dvb.h index 52dd9a07..8a13b403 100644 --- a/lib/dvb/dvb.h +++ b/lib/dvb/dvb.h @@ -10,7 +10,7 @@ class eDVBChannel; class eDVBResourceManager: public iDVBResourceManager { - DECLARE_REF; + DECLARE_REF(eDVBResourceManager); int avail, busy; struct adapter { @@ -40,7 +40,7 @@ public: class eDVBChannel: public iDVBChannel, public eDVBDemux, public Object { - DECLARE_REF; + DECLARE_REF(eDVBChannel); private: ePtr m_frontend; ePtr m_current_frontend_parameters; diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h index 6b8c8784..df0b93e5 100644 --- a/lib/dvb/esection.h +++ b/lib/dvb/esection.h @@ -6,7 +6,7 @@ class eGTable: public iObject, public Object { -DECLARE_REF; +DECLARE_REF(eGTable); private: ePtr m_reader; eDVBTableSpec m_table; diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 9036dc3e..f4e99fae 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -6,7 +6,7 @@ class eDVBFrontendParameters: public iDVBFrontendParameters { - DECLARE_REF; + DECLARE_REF(eDVBFrontendParameters); union { eDVBFrontendParametersSatellite sat; @@ -33,7 +33,7 @@ public: class eDVBFrontend: public iDVBFrontend, public Object { - DECLARE_REF; + DECLARE_REF(eDVBFrontend); int m_type; int m_fd; #if HAVE_DVB_API_VERSION < 3 diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 4d728b4c..da626866 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -160,7 +160,7 @@ class eDVBChannelQuery; class eDVBService: public iStaticServiceInformation { - DECLARE_REF; + DECLARE_REF(eDVBService); public: eDVBService(); std::string m_service_name; @@ -194,7 +194,7 @@ public: class eDVBChannelQuery: public iObject { - DECLARE_REF; + DECLARE_REF(eDVBChannelQuery); public: enum { diff --git a/lib/dvb/list.h b/lib/dvb/list.h index 6df49803..80ad20e8 100644 --- a/lib/dvb/list.h +++ b/lib/dvb/list.h @@ -3,7 +3,7 @@ class eDVBTransponderList: iDVBChannelList { - DECLARE_REF; + DECLARE_REF(eDVBTransponderList); private: std::map > channels; public: diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 96264e88..2f75291b 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -10,7 +10,7 @@ class eDVBScan: public Object, public iObject { -DECLARE_REF; +DECLARE_REF(eDVBScan); private: /* chid helper functions: */ diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 0bda004c..ea01108d 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -7,7 +7,7 @@ class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl { public: - DECLARE_REF; + DECLARE_REF(eDVBSatelliteEquipmentControl); eDVBSatelliteEquipmentControl(); RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat); }; diff --git a/lib/gdi/font.h b/lib/gdi/font.h index a17fee71..ff2a88c5 100644 --- a/lib/gdi/font.h +++ b/lib/gdi/font.h @@ -79,7 +79,7 @@ class eLCD; class eTextPara: public iObject { -DECLARE_REF; +DECLARE_REF(eTextPara); private: ePtr current_font, replacement_font; FT_Face current_face, replacement_face; @@ -139,7 +139,7 @@ public: class Font: public iObject { -DECLARE_REF; +DECLARE_REF(Font); public: FTC_Image_Desc font; fontRenderClass *renderer; diff --git a/lib/gdi/gpixmap.h b/lib/gdi/gpixmap.h index 9dd170ac..396d92b7 100644 --- a/lib/gdi/gpixmap.h +++ b/lib/gdi/gpixmap.h @@ -89,7 +89,7 @@ struct gLookup */ class gFont: public iObject { -DECLARE_REF; +DECLARE_REF(gFont); public: std::string family; @@ -133,7 +133,7 @@ struct gSurfaceSystem: gSurface struct gPixmap: public iObject { -DECLARE_REF; +DECLARE_REF(gPixmap); private: friend class gDC; void fill(const gRegion &clip, const gColor &color); diff --git a/lib/gdi/grc.h b/lib/gdi/grc.h index 5eb81314..f6829902 100644 --- a/lib/gdi/grc.h +++ b/lib/gdi/grc.h @@ -124,7 +124,7 @@ struct gOpcode /* gRC is the singleton which controls the fifo and dispatches commands */ class gRC: public iObject { -DECLARE_REF; +DECLARE_REF(gRC); private: static gRC *instance; @@ -212,7 +212,7 @@ public: class gDC: public iObject { -DECLARE_REF; +DECLARE_REF(gDC); protected: ePtr m_pixmap; diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index 1dae137f..a3fae34c 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -22,11 +22,17 @@ eListbox::~eListbox() void eListbox::setContent(iListboxContent *content) { m_content = content; + if (content) + m_content->setListbox(this); entryReset(); } void eListbox::moveSelection(int dir) { + /* refuse to do anything without a valid list. */ + if (!m_content) + return; + /* we need the old top/sel to see what we have to redraw */ int oldtop = m_top; int oldsel = m_selected; @@ -98,6 +104,8 @@ int eListbox::event(int event, void *data, void *data2) { ePtr style; + if (!m_content) + return eWidget::event(event, data, data2); assert(m_content); recalcSize(); // move to event @@ -183,9 +191,10 @@ void eListbox::entryChanged(int index) void eListbox::entryReset() { - invalidate(); if (m_content) m_content->cursorHome(); m_top = 0; m_selected = 0; + invalidate(); + eDebug("inval!"); } diff --git a/lib/gui/elistbox.h b/lib/gui/elistbox.h index 78e0fbe9..9e23bde3 100644 --- a/lib/gui/elistbox.h +++ b/lib/gui/elistbox.h @@ -21,6 +21,7 @@ public: anyway. */ #ifndef SWIG protected: + iListboxContent(); friend class eListbox; virtual void cursorHome()=0; virtual void cursorEnd()=0; @@ -72,12 +73,8 @@ public: pageDown, justCheck }; -protected: - int event(int event, void *data=0, void *data2=0); - void recalcSize(); -private: - friend class iListboxContent; - + +#ifndef SWIG /* entryAdded: an entry was added *before* the given index. it's index is the given number. */ void entryAdded(int index); /* entryRemoved: an entry with the given index was removed. */ @@ -86,11 +83,18 @@ private: void entryChanged(int index); /* the complete list changed. you should not attemp to keep the current index. */ void entryReset(); + +protected: + int event(int event, void *data=0, void *data2=0); + void recalcSize(); +private: int m_top, m_selected; int m_itemheight; int m_items_per_page; ePtr m_content; +#endif + }; #endif diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index 0a10b27a..209b5250 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -29,6 +29,10 @@ iListboxContent::~iListboxContent() { } +iListboxContent::iListboxContent(): m_listbox(0) +{ +} + void iListboxContent::setListbox(eListbox *lb) { m_listbox = lb; diff --git a/lib/gui/elistboxcontent.h b/lib/gui/elistboxcontent.h index deea3000..a2e1fd36 100644 --- a/lib/gui/elistboxcontent.h +++ b/lib/gui/elistboxcontent.h @@ -6,7 +6,7 @@ class eListboxTestContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxTestContent); public: #ifndef SWIG @@ -37,7 +37,7 @@ private: class eListboxStringContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxStringContent); public: eListboxStringContent(); void setList(std::list &list); @@ -75,7 +75,7 @@ private: class eListboxPythonStringContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxPythonStringContent); public: eListboxPythonStringContent(); ~eListboxPythonStringContent(); diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h index 12d2e743..97eb1434 100644 --- a/lib/gui/ewidget.h +++ b/lib/gui/ewidget.h @@ -5,8 +5,6 @@ #include /* for eSmartPtrList */ #include /* for eWindowStyle */ -class eWindowStyle; - class eWidget { friend class eWidgetDesktop; diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp index ccf7299f..3b8271f6 100644 --- a/lib/gui/ewindowstyle.cpp +++ b/lib/gui/ewindowstyle.cpp @@ -105,3 +105,34 @@ void eWindowStyleSimple::drawFrame(gPainter &painter, const eRect &frame, int wh painter.line(frame.bottomRight1(), frame.bottomLeft1()); painter.line(frame.bottomLeft1(), frame.topLeft1()); } + +DEFINE_REF(eWindowStyleSkinned); + +eWindowStyleSkinned::eWindowStyleSkinned() +{ +} + +void eWindowStyleSkinned::handleNewSize(eWindow *wnd, const eSize &size) +{ +} + +void eWindowStyleSkinned::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) +{ +} + +void eWindowStyleSkinned::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) +{ +} + +void eWindowStyleSkinned::setStyle(gPainter &painter, int what) +{ +} + +void eWindowStyleSkinned::drawFrame(gPainter &painter, const eRect &frame, int what) +{ +} + +void eWindowStyleSkinned::drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where) +{ +} + diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h index 74ff88d5..6431c242 100644 --- a/lib/gui/ewindowstyle.h +++ b/lib/gui/ewindowstyle.h @@ -32,7 +32,7 @@ public: class eWindowStyleSimple: public eWindowStyle { - DECLARE_REF; + DECLARE_REF(eWindowStyleSimple); private: ePtr m_fnt; gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color; @@ -47,4 +47,43 @@ public: void drawFrame(gPainter &painter, const eRect &frame, int what); }; +class eWindowStyleSkinned: public eWindowStyle +{ + DECLARE_REF(eWindowStyleSkinned); +public: + eWindowStyleSkinned(); + void handleNewSize(eWindow *wnd, const eSize &size); + void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title); + void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size); + void setStyle(gPainter &painter, int what); + void drawFrame(gPainter &painter, const eRect &frame, int what); + + enum { + bsWindow, + bsButton, +#ifndef SWIG + bsMax +#endif + }; + + enum { + bpTopLeft = 1, + bpTop = 2, + bpTopRight = 4, + bpLeft = 8, + bpRight = 0x10, + bpBottomLeft = 0x20, + bpBottom = 0x40, + bpBottomRight = 0x80, + bpBackground = 0x100 + }; +private: + struct borderSet + { + ePtr m_pixmap[9]; + }; + + void drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where); +}; + #endif diff --git a/lib/nav/core.h b/lib/nav/core.h index c049e43d..6c94fe2c 100644 --- a/lib/nav/core.h +++ b/lib/nav/core.h @@ -8,7 +8,7 @@ class eNavigation: public iObject, public Object { - DECLARE_REF; + DECLARE_REF(eNavigation); private: ePtr m_runningService; ePtr m_servicehandler; diff --git a/lib/nav/pcore.h b/lib/nav/pcore.h index 004bab27..1a910b82 100644 --- a/lib/nav/pcore.h +++ b/lib/nav/pcore.h @@ -8,7 +8,7 @@ class pNavigation: public iObject, public Object { -DECLARE_REF; +DECLARE_REF(pNavigation); public: PSignal1 m_event; diff --git a/lib/nav/playlist.h b/lib/nav/playlist.h index 6d89406e..e69de29b 100644 --- a/lib/nav/playlist.h +++ b/lib/nav/playlist.h @@ -1,17 +0,0 @@ -#ifndef __lib_nav_playlist_h -#define __lib_nav_playlist_h - -#include -#include -#include - -class ePlaylist: public iObject, public std::list -{ -DECLARE_REF; -public: - ePlaylist(); - virtual ~ePlaylist(); - std::list::iterator m_current; -}; - -#endif diff --git a/lib/network/http_dyn.h b/lib/network/http_dyn.h index 61116409..24e4dba1 100644 --- a/lib/network/http_dyn.h +++ b/lib/network/http_dyn.h @@ -5,7 +5,7 @@ class eHTTPDyn: public eHTTPDataSource { - DECLARE_REF; + DECLARE_REF(eHTTPDyn); private: std::string result; int wptr, size; @@ -17,11 +17,11 @@ public: class eHTTPDynPathResolver: public iHTTPPathResolver { - DECLARE_REF; + DECLARE_REF(eHTTPDynPathResolver); private: - struct eHTTPDynEntry + struct eHTTPDynEntry: public iObject { - DECLARE_REF; + DECLARE_REF(eHTTPDynEntry); public: std::string request, path; std::string (*function)(std::string request, std::string path, std::string opt, eHTTPConnection *content); diff --git a/lib/network/http_file.h b/lib/network/http_file.h index 6feb562d..a9c86c5c 100644 --- a/lib/network/http_file.h +++ b/lib/network/http_file.h @@ -5,7 +5,7 @@ class eHTTPFile: public eHTTPDataSource { - DECLARE_REF; + DECLARE_REF(eHTTPFile); private: int fd, size; const char *mime; @@ -20,7 +20,7 @@ public: class eHTTPFilePathResolver: public iHTTPPathResolver { - DECLARE_REF; + DECLARE_REF(eHTTPFilePathResolver); public: struct eHTTPFilePath { diff --git a/lib/network/httpd.h b/lib/network/httpd.h index 30c3c032..aa8c5288 100644 --- a/lib/network/httpd.h +++ b/lib/network/httpd.h @@ -41,7 +41,7 @@ typedef ePtr eHTTPDataSourcePtr; class eHTTPError: public eHTTPDataSource { - DECLARE_REF; + DECLARE_REF(eHTTPError); private: int errcode; public: diff --git a/lib/network/xmlrpc.h b/lib/network/xmlrpc.h index 05fd3cca..b43e8e3d 100644 --- a/lib/network/xmlrpc.h +++ b/lib/network/xmlrpc.h @@ -71,7 +71,7 @@ int xmlrpc_checkArgs(std::string args, std::vector&, ePtrList enigma_iobject.i + \ No newline at end of file diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 33fc0a14..096254f9 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -32,14 +32,9 @@ Oh, things like "operator= is private in this context" etc. is usually caused by not marking PSignals as immutable. */ -%define RefCount(...) -%typemap(newfree) __VA_ARGS__ * { eDebug("adding ref"); $1->AddRef(); } -%extend __VA_ARGS__ { ~__VA_ARGS__() { eDebug("removing ref!"); self->Release(); } } -%ignore __VA_ARGS__::~__VA_ARGS__(); -%enddef - %module enigma %{ + #define SWIG_COMPILE #include #include @@ -54,6 +49,7 @@ is usually caused by not marking PSignals as immutable. #include #include #include +#include #include #include #include @@ -69,9 +65,10 @@ extern void quitMainloop(); extern PSignal1 &keyPressedSignal(); %} -RefCount(eListboxPythonStringContent) -RefCount(eListboxServiceContent) -RefCount(eComponentScan) +%feature("ref") iObject "$this->AddRef(); eDebug(\"AddRef (%s:%d)!\", __FILE__, __LINE__); " +%feature("unref") iObject "$this->Release(); eDebug(\"Release! %s:%d\", __FILE__, __LINE__); " + +%newobject eDebugClassPtr::operator->; #define DEBUG %include "typemaps.i" @@ -82,6 +79,7 @@ RefCount(eComponentScan) %include %include %include + %template(eServiceCenterPtr) ePtr; %include @@ -103,6 +101,7 @@ RefCount(eComponentScan) %include %include %include +%include %include %include %include @@ -111,7 +110,6 @@ RefCount(eComponentScan) /************** eptr **************/ %template(eActionMapPtr) ePtr; -RefCount(eActionMap) %apply eActionMapPtr OUTPUT { eActionMapPtr &ptr } %apply eActionMap* *OUTPUT { eActionMap **ptr } @@ -169,3 +167,4 @@ void runMainloop(); void quitMainloop(); %immutable keyPressed; PSignal1 &keyPressedSignal(); + diff --git a/lib/service/event.cpp b/lib/service/event.cpp index 7ea16560..58079da0 100644 --- a/lib/service/event.cpp +++ b/lib/service/event.cpp @@ -8,8 +8,7 @@ DEFINE_REF(eServiceEvent); RESULT eServiceEvent::parseFrom(Event *evt) { m_begin = 0; // ich bin FAUL - m_duration = evt->getDuration(); - + m_duration = (evt->getDuration() & 0xFF) + ((evt->getDuration() >> 8) & 0xFF) * 60 + ((evt->getDuration() >> 16) & 0xFF) * 24 * 60; for (DescriptorConstIterator desc = evt->getDescriptors()->begin(); desc != evt->getDescriptors()->end(); ++desc) { @@ -24,4 +23,7 @@ RESULT eServiceEvent::parseFrom(Event *evt) } } } + return 0; } + +DEFINE_REF(eDebugClass); diff --git a/lib/service/event.h b/lib/service/event.h index 094b080a..99ce5b24 100644 --- a/lib/service/event.h +++ b/lib/service/event.h @@ -8,7 +8,7 @@ class Event; class eServiceEvent: public iObject { -DECLARE_REF; +DECLARE_REF(eServiceEvent); public: time_t m_begin; int m_duration; @@ -20,4 +20,16 @@ public: TEMPLATE_TYPEDEF(ePtr, eServiceEventPtr); +class eDebugClass: public iObject +{ + DECLARE_REF(eDebugClass); +public: + int x; + static void getDebug(ePtr &ptr, int x) { ptr = new eDebugClass(x); } + eDebugClass(int i) { printf("build debug class %d\n", i); x = i; } + ~eDebugClass() { printf("remove debug class %d\n", x); } +}; + +// TEMPLATE_TYPEDEF(ePtr, eDebugClassPtr); + #endif diff --git a/lib/service/listboxservice.cpp b/lib/service/listboxservice.cpp index 881047df..647dbdb9 100644 --- a/lib/service/listboxservice.cpp +++ b/lib/service/listboxservice.cpp @@ -3,6 +3,7 @@ void eListboxServiceContent::setRoot(const eServiceReference &root) { + m_list.clear(); m_root = root; assert(m_service_center); @@ -16,6 +17,9 @@ void eListboxServiceContent::setRoot(const eServiceReference &root) m_size = m_list.size(); cursorHome(); + + if (m_listbox) + m_listbox->entryReset(); } void eListboxServiceContent::getCurrent(eServiceReference &ref) diff --git a/lib/service/listboxservice.h b/lib/service/listboxservice.h index 9d0cb721..231bab16 100644 --- a/lib/service/listboxservice.h +++ b/lib/service/listboxservice.h @@ -8,7 +8,7 @@ class eServiceCenter; class eListboxServiceContent: public virtual iListboxContent { - DECLARE_REF; + DECLARE_REF(eListboxServiceContent); public: eListboxServiceContent(); void setRoot(const eServiceReference &ref); diff --git a/lib/service/service.h b/lib/service/service.h index 9f4b4560..2dd01acc 100644 --- a/lib/service/service.h +++ b/lib/service/service.h @@ -11,7 +11,7 @@ typedef ePtr eServiceCenterPtr; class eServiceCenter: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceCenter); private: std::map handler; static eServiceCenter *instance; diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 2e8d899a..d414d69b 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -9,7 +9,7 @@ class eServiceFactoryDVB: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceFactoryDVB); public: eServiceFactoryDVB(); virtual ~eServiceFactoryDVB(); @@ -24,7 +24,7 @@ public: class eDVBServiceList: public iListableService { -DECLARE_REF; +DECLARE_REF(eDVBServiceList); private: eServiceReference m_parent; friend class eServiceFactoryDVB; @@ -36,7 +36,7 @@ public: class eDVBServicePlay: public iPlayableService, public Object, public iServiceInformation { -DECLARE_REF; +DECLARE_REF(eDVBServicePlay); private: friend class eServiceFactoryDVB; eServiceReference m_reference; diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp index 5a945679..9db85028 100644 --- a/lib/service/servicefs.cpp +++ b/lib/service/servicefs.cpp @@ -14,7 +14,7 @@ class eStaticServiceFSInformation: public iStaticServiceInformation { - DECLARE_REF; + DECLARE_REF(eStaticServiceFSInformation); public: RESULT getName(const eServiceReference &ref, std::string &name); }; diff --git a/lib/service/servicefs.h b/lib/service/servicefs.h index 337ff620..61fcb4a9 100644 --- a/lib/service/servicefs.h +++ b/lib/service/servicefs.h @@ -5,7 +5,7 @@ class eServiceFactoryFS: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceFactoryFS); public: eServiceFactoryFS(); virtual ~eServiceFactoryFS(); @@ -22,7 +22,7 @@ private: class eServiceFS: public iListableService { -DECLARE_REF; +DECLARE_REF(eServiceFS); private: std::string path; friend class eServiceFactoryFS; diff --git a/lib/service/servicemp3.h b/lib/service/servicemp3.h index 40287ae5..4bec7365 100644 --- a/lib/service/servicemp3.h +++ b/lib/service/servicemp3.h @@ -7,7 +7,7 @@ class eStaticServiceMP3Info; class eServiceFactoryMP3: public iServiceHandler { -DECLARE_REF; +DECLARE_REF(eServiceFactoryMP3); public: eServiceFactoryMP3(); virtual ~eServiceFactoryMP3(); @@ -24,7 +24,7 @@ private: class eStaticServiceMP3Info: public iServiceInformation { - DECLARE_REF; + DECLARE_REF(eStaticServiceMP3Info); friend class eServiceFactoryMP3; eStaticServiceMP3Info(); public: @@ -33,7 +33,7 @@ public: class eServiceMP3: public iPlayableService, public iPauseableService, public iServiceInformation, public Object { -DECLARE_REF; +DECLARE_REF(eServiceMP3); private: friend class eServiceFactoryMP3; std::string filename; diff --git a/mytest.py b/mytest.py index 80158884..13a2c266 100644 --- a/mytest.py +++ b/mytest.py @@ -17,11 +17,23 @@ from skin import applyGUIskin # we thus have one (static) hierarchy of screens (classes, not instances) # and one with the instanciated components itself (both global and dynamic) +had = dict() + def dump(dir, p = ""): if isinstance(dir, dict): for (entry, val) in dir.items(): - dump(val, p + "/" + entry) - print p + ":" + str(dir.__class__) + dump(val, p + "(dict)/" + entry) + if hasattr(dir, "__dict__"): + for name, value in dir.__dict__.items(): + if not had.has_key(str(value)): + had[str(value)] = 1 + dump(value, p + "/" + str(name)) + else: + print p + "/" + str(name) + ":" + str(dir.__class__) + "(cycle)" + else: + print p + ":" + str(dir) + +# + ":" + str(dir.__class__) # defined components components = {} @@ -61,6 +73,8 @@ class Session: self.execEnd() self.currentDialog.doClose() + dump(self.currentDialog) + print sys.getrefcount(self.currentDialog) del self.currentDialog del self.currentWindow @@ -137,3 +151,20 @@ keymapparser.readKeymap() runScreenTest() # now, run the mainloop + +#pt = eDebugClassPtr() +#eDebugClass.getDebug(pt, 12) +#p = pt.__deref__() +#print pt.x +#print p.x +#print "removing ptr..." +#pt = 0 +#print "now" +#print "p is " + str(p) +#print p.x +#p = 0 +# +#bla = eDebugClass() +#bla = eDebugClass(2) +# + diff --git a/screens.py b/screens.py index cf0daae9..dd13c550 100644 --- a/screens.py +++ b/screens.py @@ -25,6 +25,10 @@ class Screen(dict, HTMLSkin, GUISkin): # never call this directly - it will be called from the session! def doClose(self): GUISkin.close(self) + + for (name, val) in self.items(): + print "%s -> %d" % (name, sys.getrefcount(val)) + del self[name] def close(self, retval=None): self.session.close() @@ -89,11 +93,20 @@ class channelSelection(Screen): self["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:PREMIERE")) self["okbutton"] = Button("ok", [self.channelSelected]) - - self["actions"] = ActionMap("ChannelSelectActions", + + class ChannelActionMap(ActionMap): + def action(self, context, action): + if action[:7] == "bouquet": + print "setting root to " + action[8:] + self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:])) + else: + ActionMap.action(self, context, action) + + self["actions"] = ChannelActionMap("ChannelSelectActions", { "selectChannel": self.channelSelected, }) + self["actions"].csel = self def channelSelected(self): self.session.nav.playService(self["list"].getCurrent()) @@ -109,13 +122,17 @@ class infoBar(Screen): "switchChannel": self.switchChannel, "mainMenu": self.mainMenu }) - self["channelSwitcher"] = Button("switch Channel", [self.switchChannel]) self["okbutton"] = Button("mainMenu", [self.mainMenu]) + self["CurrentTime"] = Clock() + self["ServiceName"] = ServiceName(self.session.nav) self["Event_Now"] = EventInfo(self.session.nav, EventInfo.Now) self["Event_Next"] = EventInfo(self.session.nav, EventInfo.Next) + + self["Event_Now_Duration"] = EventInfo(self.session.nav, EventInfo.Now_Duration) + self["Event_Next_Duration"] = EventInfo(self.session.nav, EventInfo.Next_Duration) def mainMenu(self): self.session.open(mainMenu) @@ -136,7 +153,6 @@ class clockDisplay(Screen): self["okbutton"] = b self["title"] = Header("clock dialog: here you see the current uhrzeit!") - class serviceScan(Screen): def ok(self): if self["scan"].isDone(): diff --git a/skin.py b/skin.py index 46a14292..db4812ab 100644 --- a/skin.py +++ b/skin.py @@ -23,15 +23,17 @@ dom = xml.dom.minidom.parseString( - - + + - - + + + + - - - + + +