diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2005-04-21 16:30:28 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2005-04-21 16:30:28 +0000 |
| commit | 8a7fd294aeb67932e1057bf967958bbe5a959cfb (patch) | |
| tree | 7952e555079d7aaf3fa1ffbcf5f6e9a4a0bba87c | |
| parent | 094378485e220c9866ec449d4e0e3114a3f1c34d (diff) | |
| download | enigma2-8a7fd294aeb67932e1057bf967958bbe5a959cfb.tar.gz enigma2-8a7fd294aeb67932e1057bf967958bbe5a959cfb.zip | |
- improved scan error handling
| -rw-r--r-- | components.py | 21 | ||||
| -rw-r--r-- | lib/components/scan.cpp | 10 | ||||
| -rw-r--r-- | lib/components/scan.h | 4 | ||||
| -rw-r--r-- | screens.py | 11 | ||||
| -rw-r--r-- | skin.py | 1 |
5 files changed, 38 insertions, 9 deletions
diff --git a/components.py b/components.py index deb3760c..af0fbffa 100644 --- a/components.py +++ b/components.py @@ -312,12 +312,25 @@ class ServiceScan: Running = 2 Done = 3 Error = 4 + + Errors = { + 1: "error while scanning", + 2: "no resource manager", + 3: "no channel list" + } + def scanStatusChanged(self): if self.state == self.Running: self.progressbar.setValue(self.scan.getProgress()) if self.scan.isDone(): - self.state = self.Done + errcode = self.scan.getError() + + if errcode == 0: + self.state = self.Done + else: + self.state = self.Error + self.errorcode = errcode else: self.text.setText("scan in progress - %d %% done!\n%d services found!" % (self.scan.getProgress(), self.scan.getNumServices())) @@ -325,7 +338,7 @@ class ServiceScan: self.text.setText("scan done!") if self.state == self.Error: - self.text.setText("ERROR - failed to scan!") + self.text.setText("ERROR - failed to scan (%s)!" % (self.Errors[self.errorcode]) ) def __init__(self, progressbar, text): self.progressbar = progressbar @@ -336,10 +349,10 @@ class ServiceScan: def execBegin(self): self.scan.statusChanged.get().append(self.scanStatusChanged) + self.state = self.Running if self.scan.start(): self.state = self.Error - else: - self.state = self.Running + self.scanStatusChanged() def execEnd(self): diff --git a/lib/components/scan.cpp b/lib/components/scan.cpp index c82d04ef..ad2e4d1a 100644 --- a/lib/components/scan.cpp +++ b/lib/components/scan.cpp @@ -89,7 +89,10 @@ int eComponentScan::start() ePtr<iDVBChannel> channel; if (mgr->allocateRawChannel(channel)) + { eDebug("scan: allocating raw channel failed!"); + return -1; + } std::list<ePtr<iDVBFrontendParameters> > list; @@ -98,7 +101,7 @@ int eComponentScan::start() m_scan = new eDVBScan(channel); m_scan->connectEvent(slot(*this, &eComponentScan::scanEvent), m_scan_event_connection); m_scan->start(list); - + return 0; } @@ -126,3 +129,8 @@ int eComponentScan::isDone() { return m_done; } + +int eComponentScan::getError() +{ + return m_failed; +} diff --git a/lib/components/scan.h b/lib/components/scan.h index ca64f5e2..62456138 100644 --- a/lib/components/scan.h +++ b/lib/components/scan.h @@ -26,9 +26,11 @@ public: /* get number of services */ int getNumServices(); - /* true when done. */ + /* true when done or error */ int isDone(); + int getError(); + int start(); }; @@ -166,6 +166,9 @@ class serviceScan(Screen): if self["scan"].isDone(): self.close() + def cancel(self): + print "cancel not yet implemented ;)" + def __init__(self, session): Screen.__init__(self, session) @@ -173,5 +176,9 @@ class serviceScan(Screen): self["scan_state"] = Label("scan state") self["scan"] = ServiceScan(self["scan_progress"], self["scan_state"]) - self["okbutton"] = Button("ok", [self.ok]) - self["okbutton"].disable() + self["actions"] = ActionMap(["OkCancelActions"], + { + "ok": self.ok, + "cancel": self.cancel + }) + @@ -69,7 +69,6 @@ dom = xml.dom.minidom.parseString( <screen name="serviceScan" position="150,100" size="300,200" title="Service Scan"> <widget name="scan_progress" position="10,10" size="280,50" /> <widget name="scan_state" position="10,60" size="280,30" /> - <widget name="okbutton" position="10,100" size="280,40" /> </screen> </skin>""") |
