| 1 | # -*- coding: UTF-8 -*-
|
|---|
| 2 |
|
|---|
| 3 | #-------------------------------------------------------
|
|---|
| 4 | #
|
|---|
| 5 | # Streetinfo
|
|---|
| 6 | #
|
|---|
| 7 | # Dieses Plugin holt vom Internet die aktuellen
|
|---|
| 8 | # Staumeldungen aus Deutschland.
|
|---|
| 9 | #
|
|---|
| 10 | #
|
|---|
| 11 | # Wir wuenschen allen Benutzern staufreie Fahrt!
|
|---|
| 12 | #
|
|---|
| 13 | # Version 1.0
|
|---|
| 14 | #
|
|---|
| 15 | # 14.04.2011
|
|---|
| 16 | #
|
|---|
| 17 | # Datenquelle: http://mobile.verkehrsinformation.de
|
|---|
| 18 | # Datenquelle: http://www.verkehrsinfo.de/
|
|---|
| 19 | # Datenquelle: http://www.svz-bw.de
|
|---|
| 20 | #
|
|---|
| 21 | #
|
|---|
| 22 | # @Bauernbub
|
|---|
| 23 | #
|
|---|
| 24 | #-------------------------------------------------------
|
|---|
| 25 |
|
|---|
| 26 | from Components.ActionMap import HelpableActionMap
|
|---|
| 27 | from Components.ActionMap import ActionMap, NumberActionMap
|
|---|
| 28 | from Components.AVSwitch import AVSwitch
|
|---|
| 29 | from Components.Label import Label
|
|---|
| 30 | from Components.Button import Button
|
|---|
| 31 | from Components.Sources.StaticText import StaticText
|
|---|
| 32 | from Components.ScrollLabel import ScrollLabel
|
|---|
| 33 | from Components.MenuList import MenuList
|
|---|
| 34 | from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
|
|---|
| 35 | from Components.Pixmap import Pixmap
|
|---|
| 36 | from Components.PluginComponent import plugins
|
|---|
| 37 | from Components.Console import Console
|
|---|
| 38 | from Components.ConfigList import ConfigListScreen, ConfigList
|
|---|
| 39 | from Components.config import config, ConfigSubsection, ConfigText, ConfigSubList, getConfigListEntry, ConfigSelection, ConfigIP, ConfigYesNo, ConfigSequence, ConfigNumber, ConfigInteger, ConfigPassword, NoSave, ConfigEnableDisable
|
|---|
| 40 | from enigma import eListboxPythonMultiContent, ePicLoad, eServiceReference, eTimer, getDesktop, gFont, RT_HALIGN_LEFT
|
|---|
| 41 |
|
|---|
| 42 | from os import listdir, popen
|
|---|
| 43 | from Plugins.Plugin import PluginDescriptor
|
|---|
| 44 | from Screens.ChoiceBox import ChoiceBox
|
|---|
| 45 | from Screens.HelpMenu import HelpableScreen
|
|---|
| 46 | from Screens.InfoBar import MoviePlayer
|
|---|
| 47 | from Screens.MessageBox import MessageBox
|
|---|
| 48 | from Screens.Screen import Screen
|
|---|
| 49 | from Components.FileList import FileList
|
|---|
| 50 | from time import sleep
|
|---|
| 51 | from Tools.BoundFunction import boundFunction
|
|---|
| 52 | from Tools.Directories import resolveFilename, SCOPE_PLUGINS, fileExists
|
|---|
| 53 | from Tools.HardwareInfo import HardwareInfo
|
|---|
| 54 | from Tools.LoadPixmap import LoadPixmap
|
|---|
| 55 | from twisted.web.client import downloadPage, getPage
|
|---|
| 56 | import htmlentitydefs, re, urllib2, urllib
|
|---|
| 57 | from re import sub, split, search, match, findall
|
|---|
| 58 | import os
|
|---|
| 59 | from os import system, remove, path, walk, makedirs, listdir
|
|---|
| 60 | from time import *
|
|---|
| 61 | from Scroll import Scroll
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | ###################################################
|
|---|
| 66 | global MAIN_PAGE
|
|---|
| 67 | global city, link
|
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php"
|
|---|
| 72 | PNG_PATH = resolveFilename(SCOPE_PLUGINS)+"/Extensions/StreetInfo/picon/"
|
|---|
| 73 | deviceName = HardwareInfo().get_device_name()
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | data = "svz_bw_tpl: svz_bw;6e09bde33fae46dde0bb68bfc4ecaf63:medgr1mavnfd2hsj7vfrejut82m38ghv;JASLIDESHOWPLAY:1"
|
|---|
| 77 | cookiehead = {
|
|---|
| 78 | "Keep-Alive":"800",
|
|---|
| 79 | "Referer":"http://www.aaf-board.com",
|
|---|
| 80 | "Cookie:": data,
|
|---|
| 81 | "Connection":"keep-alive"
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/startservice.cfg"):
|
|---|
| 86 | file = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/startservice.cfg","r")
|
|---|
| 87 | link = str(file.readline().strip())
|
|---|
| 88 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region" + link + "search"
|
|---|
| 89 | file.close()
|
|---|
| 90 | else:
|
|---|
| 91 | link = "=2&tmp="
|
|---|
| 92 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region=2&tmp=search"
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 | #---------------------- Skin Funktionen ---------------------------------------------------
|
|---|
| 96 | def getAspect():
|
|---|
| 97 | val = AVSwitch().getAspectRatioSetting()
|
|---|
| 98 | return val/2
|
|---|
| 99 |
|
|---|
| 100 | def getScale():
|
|---|
| 101 | return AVSwitch().getFramebufferScale()
|
|---|
| 102 |
|
|---|
| 103 | def applySkinVars(skin,dict):
|
|---|
| 104 | for key in dict.keys():
|
|---|
| 105 | try:
|
|---|
| 106 | skin = skin.replace('{'+key+'}',dict[key])
|
|---|
| 107 | except Exception,e:
|
|---|
| 108 | print e,"@key=",key
|
|---|
| 109 | return skin
|
|---|
| 110 |
|
|---|
| 111 | def transHTML(text):
|
|---|
| 112 | text = text.replace(' '," ").replace(''',"'").replace('ß',"sz").replace('"','"').replace('–',"-")
|
|---|
| 113 | text = text.replace('©.*'," ").replace('&',"&").replace('ü',"ue").replace('ä',"ae").replace('ö',"oe")
|
|---|
| 114 | text = text.replace('Ü',"Ue").replace('Ä',"Ae").replace('Ö',"Oe")
|
|---|
| 115 | text = text.replace('ß',"ae").replace('»',"").replace('“','"').replace('”','"')
|
|---|
| 116 | text = text.replace('\xfc',"ue").replace('\xd6',"Oe").replace('\xf6',"oe").replace('\xe4',"ae")
|
|---|
| 117 | return text
|
|---|
| 118 |
|
|---|
| 119 | #------------------------------------------------------------------------------------------
|
|---|
| 120 | #---------------------------------- MainMenuList ---------------------------------------
|
|---|
| 121 | #------------------------------------------------------------------------------------------
|
|---|
| 122 | class MainMenuList(MenuList):
|
|---|
| 123 | def __init__(self):
|
|---|
| 124 | MenuList.__init__(self, [], False, eListboxPythonMultiContent)
|
|---|
| 125 |
|
|---|
| 126 | self.l.setFont(0, gFont("Regular",20))
|
|---|
| 127 | self.l.setFont(1, gFont("Regular", 24))
|
|---|
| 128 | self.listCompleted = []
|
|---|
| 129 | self.callback = None
|
|---|
| 130 | self.idx = 0
|
|---|
| 131 | self.thumb = ""
|
|---|
| 132 | self.pos = 20
|
|---|
| 133 | ##print "[StreetInfo] MainMenuList"
|
|---|
| 134 | #------------------------------------------------------------------------------------------
|
|---|
| 135 | #------------------------------------------ Spinner ---------------------------------------
|
|---|
| 136 | #------------------------------------------------------------------------------------------
|
|---|
| 137 |
|
|---|
| 138 | class StreetPreviewCache(Screen):
|
|---|
| 139 | skin = """
|
|---|
| 140 | <screen position="center,center" size="76,76" flags="wfNoBorder" backgroundColor="#ffffff" >
|
|---|
| 141 | <eLabel position="2,2" zPosition="1" size="72,72" font="Regular;18" backgroundColor="#252525" />
|
|---|
| 142 | <widget name="spinner" position="14,14" zPosition="4" size="48,48" alphatest="on" />
|
|---|
| 143 | </screen>"""
|
|---|
| 144 |
|
|---|
| 145 | def __init__(self, session):
|
|---|
| 146 | self.session = session
|
|---|
| 147 | Screen.__init__(self, session)
|
|---|
| 148 |
|
|---|
| 149 | self["spinner"] = Pixmap()
|
|---|
| 150 | self.curr = 0
|
|---|
| 151 |
|
|---|
| 152 | self.timer = eTimer()
|
|---|
| 153 | self.timer.callback.append(self.showNextSpinner)
|
|---|
| 154 |
|
|---|
| 155 | def start(self):
|
|---|
| 156 | self.show()
|
|---|
| 157 | self.timer.start(120, False)
|
|---|
| 158 |
|
|---|
| 159 | def stop(self):
|
|---|
| 160 | self.hide()
|
|---|
| 161 | self.timer.stop()
|
|---|
| 162 |
|
|---|
| 163 | def showNextSpinner(self):
|
|---|
| 164 | self.curr += 1
|
|---|
| 165 | if self.curr > 10:
|
|---|
| 166 | self.curr = 0
|
|---|
| 167 | png = LoadPixmap(cached=True, path=PNG_PATH + str(self.curr) + ".png")
|
|---|
| 168 | self["spinner"].instance.setPixmap(png)
|
|---|
| 169 |
|
|---|
| 170 | #------------------------------------------------------------------------------------------
|
|---|
| 171 | # ------------------------------ Stauinfo ---------------------------------------
|
|---|
| 172 | #------------------------------------------------------------------------------------------
|
|---|
| 173 | class Streetview(Screen, HelpableScreen):
|
|---|
| 174 |
|
|---|
| 175 | desktop = getDesktop(0)
|
|---|
| 176 | size = desktop.size()
|
|---|
| 177 | width = size.width()
|
|---|
| 178 | ##print "Desktop ", size, width
|
|---|
| 179 | if width == 1024:
|
|---|
| 180 | skin = """<screen position="center,65" size="880,480" title="Stauinfo V 1.0" backgroundColor="#000000" >"""
|
|---|
| 181 | skin += """<widget name="textlist" zPosition="-1" position="0,67" size="880,363" font="Regular;22" halign="left" transparent="1" />
|
|---|
| 182 | <widget source="Titel" render="Label" position="20,3" zPosition="3" size="860,40" font="Regular;36" valign="center" halign="center" transparent="1" foregroundColor="#f47d19"/>
|
|---|
| 183 | <widget source="Titel2" render="Label" position="280,5" zPosition="2" size="440,40" font="Regular;28" valign="center" halign="left" transparent="1" foregroundColor="#f47d19"/>
|
|---|
| 184 | <widget source="key_red" render="Label" position="70,438" zPosition="2" size="200,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff" />
|
|---|
| 185 | <widget source="key_green" render="Label" position="260,438" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 186 | <widget source="key_yellow" render="Label" position="450,438" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 187 | <widget source="key_blue" render="Label" position="640,438" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 188 | <widget source="key_ok" render="Label" position="730,438" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 189 | <ePixmap position="30,443" size="36,25" pixmap="skin_default/buttons/key_red.png" transparent="1" alphatest="on" />
|
|---|
| 190 | <ePixmap position="220,443" size="36,25" pixmap="skin_default/buttons/key_green.png" transparent="1" alphatest="on" />
|
|---|
| 191 | <ePixmap position="410,443" size="36,25" pixmap="skin_default/buttons/key_yellow.png" transparent="1" alphatest="on" />
|
|---|
| 192 | <ePixmap position="600,443" size="36,25" pixmap="skin_default/buttons/key_blue.png" transparent="1" alphatest="on" />
|
|---|
| 193 | <eLabel position="5,437" zPosition="2" size="870,2" backgroundColor="#e0eeee" />
|
|---|
| 194 | </screen>"""
|
|---|
| 195 | else:
|
|---|
| 196 | skin = """<screen position="center,center" size="890,505" title="Stauinfo V 1.0" backgroundColor="#000000" >"""
|
|---|
| 197 | skin += """<widget name="Mlist" position="0,90" size="890,365" zPosition="-1" backgroundColor="#000000" backgroundColorSelected="#f7f7f7" selectionDisabled="1" scrollbarMode="showOnDemand" />
|
|---|
| 198 | <widget name="textlist" zPosition="-1" position="0,67" size="880,373" font="Regular;26" halign="left" transparent="1" />
|
|---|
| 199 | <widget source="Titel" render="Label" position="20,13" zPosition="3" size="870,40" font="Regular;36" valign="center" halign="center" transparent="1" foregroundColor="#f47d19"/>
|
|---|
| 200 | <widget source="Titel2" render="Label" position="280,15" zPosition="2" size="440,40" font="Regular;28" valign="center" halign="left" transparent="1" foregroundColor="#f47d19"/>
|
|---|
| 201 | <widget source="key_red" render="Label" position="70,463" zPosition="2" size="200,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff" />
|
|---|
| 202 | <widget source="key_green" render="Label" position="260,463" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 203 | <widget source="key_yellow" render="Label" position="450,463" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 204 | <widget source="key_blue" render="Label" position="640,463" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 205 | <widget source="key_ok" render="Label" position="730,463" zPosition="2" size="180,40" font="Regular;20" valign="center" halign="left" transparent="1" foregroundColor="#ffffff"/>
|
|---|
| 206 | <ePixmap position="30,468" size="36,25" pixmap="skin_default/buttons/key_red.png" transparent="1" alphatest="on" />
|
|---|
| 207 | <ePixmap position="220,468" size="36,25" pixmap="skin_default/buttons/key_green.png" transparent="1" alphatest="on" />
|
|---|
| 208 | <ePixmap position="410,468" size="36,25" pixmap="skin_default/buttons/key_yellow.png" transparent="1" alphatest="on" />
|
|---|
| 209 | <ePixmap position="600,468" size="36,25" pixmap="skin_default/buttons/key_blue.png" transparent="1" alphatest="on" />
|
|---|
| 210 | <eLabel position="5,455" zPosition="2" size="880,2" backgroundColor="#e0eeee" />
|
|---|
| 211 | </screen>"""
|
|---|
| 212 |
|
|---|
| 213 | def __init__(self, session):
|
|---|
| 214 | self.session = session
|
|---|
| 215 | global MAIN_PAGE
|
|---|
| 216 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php" + "?region=2&tmp=search"
|
|---|
| 217 |
|
|---|
| 218 | Screen.__init__(self, session)
|
|---|
| 219 | self["navigationTitle"] = Label(" ")
|
|---|
| 220 | self["Mlist"] = MainMenuList()
|
|---|
| 221 | self["Titel"] = StaticText()
|
|---|
| 222 | self["Titel2"] = StaticText()
|
|---|
| 223 | self["Titel2"].text = _("Stauinfos werden gesucht ...")
|
|---|
| 224 | self["key_green"] = StaticText()
|
|---|
| 225 | self["key_yellow"] = StaticText()
|
|---|
| 226 | self["key_red"] = StaticText()
|
|---|
| 227 | self["key_blue"] = StaticText()
|
|---|
| 228 | self["key_ok"] = StaticText()
|
|---|
| 229 | self["key_red"].text = _("Stau-Karte")
|
|---|
| 230 | self["key_green"].text = _("Stau-Cam")
|
|---|
| 231 | self["key_yellow"].text = _("Favorit")
|
|---|
| 232 | self["key_blue"].text = _("Home")
|
|---|
| 233 | self["key_ok"].text = _("(OK) Auswahl")
|
|---|
| 234 | self["textlist"] = Scroll("")
|
|---|
| 235 |
|
|---|
| 236 | HelpableScreen.__init__(self)
|
|---|
| 237 | self["actions"] = HelpableActionMap(self, "AAFKeyActions",
|
|---|
| 238 | {
|
|---|
| 239 | "cancel": (self.exit, "Beenden"),
|
|---|
| 240 | "menu": (self.Menu, "Menu"),
|
|---|
| 241 | "showEventInfo": (self.info, "Info"),
|
|---|
| 242 | "ok": (self.OK, "ok"),
|
|---|
| 243 | "left": (self.left, "Seite hoch"),
|
|---|
| 244 | "right": (self.right, "Seite runter"),
|
|---|
| 245 | "up": (self.up, "Hoch"),
|
|---|
| 246 | "down": (self.down, "Runter"),
|
|---|
| 247 | "red": (self.red, "Red"),
|
|---|
| 248 | "green": (self.Cam, "Green"),
|
|---|
| 249 | "yellow": (self.Fav1, "Yellow"),
|
|---|
| 250 | "blue": (self.Fav0, "Blue"),
|
|---|
| 251 | }, -2)
|
|---|
| 252 | self.StartPageFirst()
|
|---|
| 253 |
|
|---|
| 254 |
|
|---|
| 255 | def StartPageFirst(self):
|
|---|
| 256 | print "[StreetInfo] StartPageFirst:"
|
|---|
| 257 | self.cacheDialog = self.session.instantiateDialog(StreetPreviewCache)
|
|---|
| 258 | self["textlist"].callback = self.deactivateCacheDialog
|
|---|
| 259 | self.working = False
|
|---|
| 260 | self["textlist"].show
|
|---|
| 261 | self.cacheTimer = eTimer()
|
|---|
| 262 | self.cacheDialog.start()
|
|---|
| 263 | self.onLayoutFinish.append(self.getPage)
|
|---|
| 264 |
|
|---|
| 265 | def StartPage(self):
|
|---|
| 266 | global MAIN_PAGE, city, link
|
|---|
| 267 | self["Titel"].text = _(" ")
|
|---|
| 268 | self["Titel2"].text = _("suche Stauinfos ...")
|
|---|
| 269 | self.working = False
|
|---|
| 270 | print "[StreetInfo] Link City:" ,link
|
|---|
| 271 | self["textlist"].show
|
|---|
| 272 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region" + link + "search"
|
|---|
| 273 | self.getPage()
|
|---|
| 274 |
|
|---|
| 275 | def getPage(self, page=None):
|
|---|
| 276 | print "[StreetInfo] getPage:"
|
|---|
| 277 | self.working = True
|
|---|
| 278 | if not page:
|
|---|
| 279 | page = ""
|
|---|
| 280 | url = "%s%s"%(MAIN_PAGE, page)
|
|---|
| 281 | print "[StreetInfo] Url:" , url
|
|---|
| 282 | getPage(url).addCallback(self.getStauPage).addErrback(self.error)
|
|---|
| 283 |
|
|---|
| 284 | def error(self, err=""):
|
|---|
| 285 | print "[StreetInfo] Error:", err
|
|---|
| 286 | self.working = False
|
|---|
| 287 | self.deactivateCacheDialog()
|
|---|
| 288 |
|
|---|
| 289 | def deactivateCacheDialog(self):
|
|---|
| 290 | self.cacheDialog.stop()
|
|---|
| 291 | self.working = False
|
|---|
| 292 |
|
|---|
| 293 | def exit(self):
|
|---|
| 294 | self.close()
|
|---|
| 295 | self.deactivateCacheDialog()
|
|---|
| 296 |
|
|---|
| 297 | def Fav0(self):
|
|---|
| 298 | global MAIN_PAGE, city, link
|
|---|
| 299 | if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/startservice.cfg"):
|
|---|
| 300 | file = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/startservice.cfg","r")
|
|---|
| 301 | link = str(file.readline().strip())
|
|---|
| 302 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region" + link + "search"
|
|---|
| 303 | file.close()
|
|---|
| 304 | else:
|
|---|
| 305 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region=2&tmp=search"
|
|---|
| 306 | self.StartPage()
|
|---|
| 307 |
|
|---|
| 308 | def Fav1(self):
|
|---|
| 309 | global MAIN_PAGE, city, link
|
|---|
| 310 | if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/fav1.cfg"):
|
|---|
| 311 | file = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/fav1.cfg","r")
|
|---|
| 312 | link = str(file.readline().strip())
|
|---|
| 313 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region" + link + "search"
|
|---|
| 314 | file.close()
|
|---|
| 315 | else:
|
|---|
| 316 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region=2&tmp=search"
|
|---|
| 317 | self.StartPage()
|
|---|
| 318 |
|
|---|
| 319 | def Fav2(self):
|
|---|
| 320 | global MAIN_PAGE, city, link
|
|---|
| 321 | if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/fav2.cfg"):
|
|---|
| 322 | file = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/fav2.cfg","r")
|
|---|
| 323 | link = str(file.readline().strip())
|
|---|
| 324 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region" + link + "search"
|
|---|
| 325 | file.close()
|
|---|
| 326 | else:
|
|---|
| 327 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php?region=2&tmp=search"
|
|---|
| 328 | self.StartPage()
|
|---|
| 329 |
|
|---|
| 330 | #------------------------------------------------------------------------------------------
|
|---|
| 331 | def Cam(self):
|
|---|
| 332 | panelmenu = ""
|
|---|
| 333 | self.session.open(CamPanel,panelmenu)
|
|---|
| 334 |
|
|---|
| 335 | #------------------------------------------------------------------------------------------
|
|---|
| 336 |
|
|---|
| 337 | def OK(self):
|
|---|
| 338 | panelmenu = ""
|
|---|
| 339 | self.session.openWithCallback(self.MenuCallback, CityPanel,panelmenu)
|
|---|
| 340 |
|
|---|
| 341 | def info(self):
|
|---|
| 342 | message = "%s" % (_("\nInfo = diese Infodatei\n\nRot = Staukarte grafisch\n\nGruen = Staukameras aus verschi. Ländern\n\nGelb = springe zu Favorit\n\nBlau = springe zu Home-Favorit\n\nMenu = Landkarte\n\n\n @ AAF-Bauernbub"))
|
|---|
| 343 | self.session.open( MessageBox, message, MessageBox.TYPE_INFO)
|
|---|
| 344 |
|
|---|
| 345 | def settings_menu(self):
|
|---|
| 346 | self.session.open(StreetConfigScreen)
|
|---|
| 347 |
|
|---|
| 348 | def MenuCallback(self):
|
|---|
| 349 | self.StartPage()
|
|---|
| 350 |
|
|---|
| 351 | #------------------------------------------------------------------------------------------
|
|---|
| 352 | def loadPicture(self,url=""):
|
|---|
| 353 | devicepath = "/tmp/brd_solo.jpg"
|
|---|
| 354 | path = "/tmp"
|
|---|
| 355 | h = urllib.urlretrieve(url, devicepath)
|
|---|
| 356 | filelist = devicepath
|
|---|
| 357 | self.session.open(PicView, filelist, 0, path, False)
|
|---|
| 358 |
|
|---|
| 359 | #------------------------------------------------------------------------------------------
|
|---|
| 360 | def left(self):
|
|---|
| 361 | if not self.working:
|
|---|
| 362 | self["textlist"].firstPage()
|
|---|
| 363 |
|
|---|
| 364 | def right(self):
|
|---|
| 365 | if not self.working:
|
|---|
| 366 | self["textlist"].lastPage()
|
|---|
| 367 |
|
|---|
| 368 | def up(self):
|
|---|
| 369 | if not self.working:
|
|---|
| 370 | self["textlist"].pageUp()
|
|---|
| 371 |
|
|---|
| 372 | def down(self):
|
|---|
| 373 | if not self.working:
|
|---|
| 374 | self["textlist"].pageDown()
|
|---|
| 375 |
|
|---|
| 376 | def red(self):
|
|---|
| 377 | if not self.working:
|
|---|
| 378 | self.url="http://www.verkehrsinfo.de/google/maps/brd_solo.jpg"
|
|---|
| 379 | self.loadPicture(self.url)
|
|---|
| 380 |
|
|---|
| 381 | def Menu(self):
|
|---|
| 382 | if not self.working:
|
|---|
| 383 | land = str(self.land[0].lstrip())
|
|---|
| 384 | land = transHTML(land)
|
|---|
| 385 |
|
|---|
| 386 | #if land == "Baden-Württemberg":
|
|---|
| 387 | # land = "Baden-Wuerttemberg"
|
|---|
| 388 | #if land == "Thüringen":
|
|---|
| 389 | # land = "Thueringen"
|
|---|
| 390 | devicepath = "/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/Lander/" + land + ".jpg"
|
|---|
| 391 | path = "/tmp"
|
|---|
| 392 | filelist = devicepath
|
|---|
| 393 | print "[StreetInfo] ", filelist
|
|---|
| 394 | self.session.open(PicView, filelist, 0, path, False)
|
|---|
| 395 | # ----------------------------------------------------------------------
|
|---|
| 396 | def getStauPage(self,html):
|
|---|
| 397 | # ---------- Verkehrsdaten -----------
|
|---|
| 398 | # <font face="arial" size="2" color="black"><b><a href="/index.php?region=13&tmp=search">Sachsen-Anhalt</a>
|
|---|
| 399 | print "suche ....."
|
|---|
| 400 |
|
|---|
| 401 | fulltext = re.compile(r'Staumeldungen.+? (.+?) ', re.DOTALL)
|
|---|
| 402 | self.land = fulltext.findall(html)
|
|---|
| 403 | print "land:" ,self.land[0].lstrip()
|
|---|
| 404 |
|
|---|
| 405 | fulltext = re.compile(r'<font face="arial" size="2" color="black">(.+?)</td>', re.DOTALL)
|
|---|
| 406 | info = fulltext.findall(html)
|
|---|
| 407 |
|
|---|
| 408 | wert = len(info)
|
|---|
| 409 | x = 2
|
|---|
| 410 | textall = ""
|
|---|
| 411 | while x < wert:
|
|---|
| 412 | textz = str(sub('<br><br> ',"\n\n",info[x]))
|
|---|
| 413 | textz = str(sub('<[^>]*>',"",textz))
|
|---|
| 414 | textz = str(sub(' ',"",textz))
|
|---|
| 415 |
|
|---|
| 416 | #print "[StreetInfo] ", textz
|
|---|
| 417 | #print "--------------------------------------------"
|
|---|
| 418 | textall = textall + textz + "\n--------------------------------------------------------------------------------------------------------------------------------------------\n"
|
|---|
| 419 | x = x +1
|
|---|
| 420 |
|
|---|
| 421 | self["Titel2"].text = _(" ")
|
|---|
| 422 | textall = transHTML(textall)
|
|---|
| 423 | self["Titel"].text = _("Stauinfo für " + self.land[0].lstrip())
|
|---|
| 424 | self["textlist"].setText(textall)
|
|---|
| 425 | self.working = False
|
|---|
| 426 | self.deactivateCacheDialog()
|
|---|
| 427 | self["textlist"].show
|
|---|
| 428 |
|
|---|
| 429 | #------------------------------------------------------------------------------------------
|
|---|
| 430 | def konvert_uml(self,Satz):
|
|---|
| 431 | ffile = open("/tmp/foreca.tmp", "w")
|
|---|
| 432 | ffile.write(str(Satz))
|
|---|
| 433 | ffile.close()
|
|---|
| 434 | os.system("/usr/lib/enigma2/python/Plugins/Extensions/Foreca/filter.sh")
|
|---|
| 435 | ffile = open("/tmp/foreca.tmp", "r" )
|
|---|
| 436 | for line in ffile:
|
|---|
| 437 | Satz = line.lstrip()
|
|---|
| 438 | ffile.close
|
|---|
| 439 | return Satz
|
|---|
| 440 |
|
|---|
| 441 | # -------------------------------------------------------------------
|
|---|
| 442 | class CityPanelList(MenuList):
|
|---|
| 443 | def __init__(self, list, font0 = 22, font1 = 16, itemHeight = 30, enableWrapAround = True):
|
|---|
| 444 | MenuList.__init__(self, [], False, eListboxPythonMultiContent)
|
|---|
| 445 | self.l.setFont(0, gFont("Regular", font0))
|
|---|
| 446 | self.l.setFont(1, gFont("Regular", font1))
|
|---|
| 447 | self.l.setItemHeight(itemHeight)
|
|---|
| 448 |
|
|---|
| 449 | # -------------------------------------------------------------------
|
|---|
| 450 | class CityPanel(Screen, HelpableScreen):
|
|---|
| 451 | global city, link
|
|---|
| 452 | def __init__(self, session, panelmenu):
|
|---|
| 453 | self.session = session
|
|---|
| 454 | self.skin = """
|
|---|
| 455 | <screen name="SenderPanel" position="center,center" size="430,540" title="Auswahl Stauinfo" backgroundColor="#252525">
|
|---|
| 456 | <widget name="Mlist" position="10,10" size="400,490" zPosition="2" foregroundColor="#ffffff" backgroundColor="#252525" backgroundColorSelected="#565656" scrollbarMode="showOnDemand" />
|
|---|
| 457 | <eLabel position="0,515" zPosition="2" size="430,1" backgroundColor="#c1cdc1" />
|
|---|
| 458 | <widget source="key_green" render="Label" position="100,512" zPosition="2" size="150,30" font="Regular;20" valign="center" halign="left" transparent="1" />
|
|---|
| 459 | <widget source="key_blue" render="Label" position="300,512" zPosition="2" size="250,30" font="Regular;20" valign="center" halign="left" transparent="1" />
|
|---|
| 460 | <ePixmap position="50,515" size="36,25" pixmap="skin_default/buttons/key_green.png" transparent="1" alphatest="on" />
|
|---|
| 461 | <ePixmap position="250,515" size="36,25" pixmap="skin_default/buttons/key_blue.png" transparent="1" alphatest="on" />
|
|---|
| 462 | </screen>"""
|
|---|
| 463 |
|
|---|
| 464 | Screen.__init__(self, session)
|
|---|
| 465 | self.Mlist = []
|
|---|
| 466 | self.getStreetPage()
|
|---|
| 467 |
|
|---|
| 468 | self.onChangedEntry = []
|
|---|
| 469 | self["Mlist"] = CityPanelList([])
|
|---|
| 470 | self["key_green"] = StaticText()
|
|---|
| 471 | self["key_blue"] = StaticText()
|
|---|
| 472 | self["key_green"].text = _("Fav1")
|
|---|
| 473 | self["key_blue"].text = _("Start")
|
|---|
| 474 |
|
|---|
| 475 | HelpableScreen.__init__(self)
|
|---|
| 476 | self["actions"] = HelpableActionMap(self, "AAFKeyActions",
|
|---|
| 477 | {
|
|---|
| 478 | "cancel": (self.Exit, "Beenden"),
|
|---|
| 479 | "left": (self.left, "Seite hoch"),
|
|---|
| 480 | "right": (self.right, "Seite runter"),
|
|---|
| 481 | "up": (self.up, "Hoch"),
|
|---|
| 482 | "down": (self.down, "Runter"),
|
|---|
| 483 | "ok": (self.ok, "OK"),
|
|---|
| 484 | "green": (self.green, "Grun"),
|
|---|
| 485 | "blue": (self.blue, "Blau"),
|
|---|
| 486 | }, -2)
|
|---|
| 487 |
|
|---|
| 488 | def up(self):
|
|---|
| 489 | self["Mlist"].up()
|
|---|
| 490 | self["Mlist"].selectionEnabled(1)
|
|---|
| 491 |
|
|---|
| 492 | def down(self):
|
|---|
| 493 | self["Mlist"].down()
|
|---|
| 494 | self["Mlist"].selectionEnabled(1)
|
|---|
| 495 |
|
|---|
| 496 | def left(self):
|
|---|
| 497 | self["Mlist"].pageUp()
|
|---|
| 498 |
|
|---|
| 499 | def right(self):
|
|---|
| 500 | self["Mlist"].pageDown()
|
|---|
| 501 |
|
|---|
| 502 | def Exit(self):
|
|---|
| 503 | self.close()
|
|---|
| 504 |
|
|---|
| 505 | def ok(self):
|
|---|
| 506 | global city, link
|
|---|
| 507 | city = self['Mlist'].l.getCurrentSelection()[0][0]
|
|---|
| 508 | link = self['Mlist'].l.getCurrentSelection()[0][1]
|
|---|
| 509 | print "[StreetInfo] Select: ", city
|
|---|
| 510 | self.close()
|
|---|
| 511 |
|
|---|
| 512 | def blue(self):
|
|---|
| 513 | link = self['Mlist'].l.getCurrentSelection()[0][1]
|
|---|
| 514 | ##print "[StreetInfo] Service:", link
|
|---|
| 515 | fwrite = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/startservice.cfg", "w")
|
|---|
| 516 | fwrite.write(link)
|
|---|
| 517 | fwrite.close()
|
|---|
| 518 | message = "%s %s" % (_("Dieses Bundesland wurde als Startservice gesetzt!\n\n "), self['Mlist'].l.getCurrentSelection()[0][0])
|
|---|
| 519 | self.session.open( MessageBox, message, MessageBox.TYPE_INFO, timeout=3)
|
|---|
| 520 |
|
|---|
| 521 | def green(self):
|
|---|
| 522 | link = self['Mlist'].l.getCurrentSelection()[0][1]
|
|---|
| 523 | fwrite = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/fav1.cfg", "w")
|
|---|
| 524 | fwrite.write(link)
|
|---|
| 525 | fwrite.close()
|
|---|
| 526 | message = "%s %s" % (_("Dieses Bundesland wurde als Favorit 1 gesetzt!\n\n "), self['Mlist'].l.getCurrentSelection()[0][0])
|
|---|
| 527 | self.session.open( MessageBox, message, MessageBox.TYPE_INFO, timeout=3)
|
|---|
| 528 |
|
|---|
| 529 | def yellow(self):
|
|---|
| 530 | link = self['Mlist'].l.getCurrentSelection()[0][1]
|
|---|
| 531 | fwrite = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/fav2.cfg", "w")
|
|---|
| 532 | fwrite.write(link)
|
|---|
| 533 | fwrite.close()
|
|---|
| 534 | message = "%s %s" % (_("Dieses Bundesland wurde als Favorit 2 gesetzt!\n\n "), self['Mlist'].l.getCurrentSelection()[0][0])
|
|---|
| 535 | self.session.open( MessageBox, message, MessageBox.TYPE_INFO, timeout=3)
|
|---|
| 536 |
|
|---|
| 537 | def CityEntryItem(self,entry):
|
|---|
| 538 | rot = 16711680
|
|---|
| 539 | gruen = 60928
|
|---|
| 540 | dgruen = 52480
|
|---|
| 541 | drot = 0xf47d19
|
|---|
| 542 | mblau = 8900346
|
|---|
| 543 | hblau = 11592447
|
|---|
| 544 | dblau = 5215437
|
|---|
| 545 | weiss = 0xffffff
|
|---|
| 546 | orange = 0xf47d19
|
|---|
| 547 | grau = 0x565656
|
|---|
| 548 |
|
|---|
| 549 | res = [entry]
|
|---|
| 550 | # return (eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text, color, color_sel, backcolor, backcolor_sel, border_width, border_color)
|
|---|
| 551 | #res.append(MultiContentEntryPixmapAlphaTest(pos=(2, 5), size=(100, 60), png=entry[0])) # png vorn
|
|---|
| 552 | res.append(MultiContentEntryText(pos=(30, 6), size=(300, 35), font=0, text=entry[0], color=mblau, color_sel=mblau, backcolor_sel=grau))
|
|---|
| 553 | return res
|
|---|
| 554 |
|
|---|
| 555 | # --------------------------------------------------------------------------
|
|---|
| 556 | def getStreetLand(self,html):
|
|---|
| 557 | # ---------- Verkehrsdaten -----------
|
|---|
| 558 | # <font face="arial" size="2" color="black"><b><a href="/index.php?region=13&tmp=search">Sachsen-Anhalt</a>
|
|---|
| 559 | print "suche ....."
|
|---|
| 560 |
|
|---|
| 561 | fulltext = re.compile(r'<a href=.+?region(.+?)search', re.DOTALL)
|
|---|
| 562 | link_land = fulltext.findall(html)
|
|---|
| 563 | fulltext = re.compile(r'sear.+?>(.+?)<', re.DOTALL)
|
|---|
| 564 | b_land = fulltext.findall(html)
|
|---|
| 565 | #print b_land
|
|---|
| 566 | wert = len(b_land) -1
|
|---|
| 567 | x = 0
|
|---|
| 568 | while x < wert:
|
|---|
| 569 | #print b_land[x]
|
|---|
| 570 | #print link_land[x]
|
|---|
| 571 | #print "--------------------------------------------"
|
|---|
| 572 | self.Mlist.append(self.CityEntryItem((_(b_land[x]), link_land[x])))
|
|---|
| 573 | x = x +1
|
|---|
| 574 |
|
|---|
| 575 | self["Mlist"].l.setList(self.Mlist)
|
|---|
| 576 | self["Mlist"].selectionEnabled(1)
|
|---|
| 577 | self["Mlist"].show
|
|---|
| 578 |
|
|---|
| 579 | # --------------------------------------------------------------------------
|
|---|
| 580 |
|
|---|
| 581 | def getStreetPage(self, page=None):
|
|---|
| 582 | print "[StreetInfo] getPage:"
|
|---|
| 583 | self.working = True
|
|---|
| 584 | MAIN_PAGE = "http://mobile.verkehrsinformation.de/index.php"
|
|---|
| 585 | print "[StreetInfo] Url:" , MAIN_PAGE
|
|---|
| 586 | getPage(MAIN_PAGE).addCallback(self.getStreetLand).addErrback(self.error)
|
|---|
| 587 |
|
|---|
| 588 | def error(self, err=""):
|
|---|
| 589 | print "[StreetInfo] Error:", err
|
|---|
| 590 | self.working = False
|
|---|
| 591 | self.deactivateCacheDialog()
|
|---|
| 592 |
|
|---|
| 593 | def deactivateCacheDialog(self):
|
|---|
| 594 | self.cacheDialog.stop()
|
|---|
| 595 | self.working = False
|
|---|
| 596 |
|
|---|
| 597 |
|
|---|
| 598 | # -------------------------------------------------------------------
|
|---|
| 599 | class CamPanel(Screen, HelpableScreen):
|
|---|
| 600 | global camtext, camlink
|
|---|
| 601 | def __init__(self, session, panelmenu):
|
|---|
| 602 | self.session = session
|
|---|
| 603 | self.skin = """
|
|---|
| 604 | <screen name="SenderPanel" position="center,center" size="670,440" title="Auswahl Webcam" backgroundColor="#252525">
|
|---|
| 605 | <widget name="Mlist" position="10,10" size="650,423" zPosition="2" foregroundColor="#ffffff" backgroundColor="#252525" backgroundColorSelected="#565656" scrollbarMode="showOnDemand" />
|
|---|
| 606 | </screen>"""
|
|---|
| 607 |
|
|---|
| 608 | Screen.__init__(self, session)
|
|---|
| 609 | self.Mlist = []
|
|---|
| 610 |
|
|---|
| 611 | if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/cam.cfg"):
|
|---|
| 612 | file = open("/usr/lib/enigma2/python/Plugins/Extensions/StreetInfo/cam.cfg", "r")
|
|---|
| 613 | for line in file:
|
|---|
| 614 | if len(line) >= 10:
|
|---|
| 615 | camtext = line.split(",")[0]
|
|---|
| 616 | camlink = line.split(",")[1]
|
|---|
| 617 | self.Mlist.append(self.CamEntryItem((_(camtext), camlink)))
|
|---|
| 618 | file.close
|
|---|
| 619 |
|
|---|
| 620 | self.onChangedEntry = []
|
|---|
| 621 | self["Mlist"] = CityPanelList([])
|
|---|
| 622 | self["Mlist"].l.setList(self.Mlist)
|
|---|
| 623 | self["Mlist"].selectionEnabled(1)
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 | HelpableScreen.__init__(self)
|
|---|
| 627 | self["actions"] = HelpableActionMap(self, "AAFKeyActions",
|
|---|
| 628 | {
|
|---|
| 629 | "cancel": (self.Exit, "Beenden"),
|
|---|
| 630 | "left": (self.left, "Seite hoch"),
|
|---|
| 631 | "right": (self.right, "Seite runter"),
|
|---|
| 632 | "up": (self.up, "Hoch"),
|
|---|
| 633 | "down": (self.down, "Runter"),
|
|---|
| 634 | "ok": (self.ok, "OK"),
|
|---|
| 635 | }, -2)
|
|---|
| 636 |
|
|---|
| 637 | def up(self):
|
|---|
| 638 | self["Mlist"].up()
|
|---|
| 639 | self["Mlist"].selectionEnabled(1)
|
|---|
| 640 |
|
|---|
| 641 | def down(self):
|
|---|
| 642 | self["Mlist"].down()
|
|---|
| 643 | self["Mlist"].selectionEnabled(1)
|
|---|
| 644 |
|
|---|
| 645 | def left(self):
|
|---|
| 646 | self["Mlist"].pageUp()
|
|---|
| 647 |
|
|---|
| 648 | def right(self):
|
|---|
| 649 | self["Mlist"].pageDown()
|
|---|
| 650 |
|
|---|
| 651 | def Exit(self):
|
|---|
| 652 | self.close()
|
|---|
| 653 |
|
|---|
| 654 | def ok(self):
|
|---|
| 655 | global camtext, camlink
|
|---|
| 656 | camtext = self['Mlist'].l.getCurrentSelection()[0][0]
|
|---|
| 657 | camlink = self['Mlist'].l.getCurrentSelection()[0][1]
|
|---|
| 658 | print "[StreetInfo] Select: ", camlink
|
|---|
| 659 |
|
|---|
| 660 | self.url= camlink
|
|---|
| 661 | self.loadCam(self.url)
|
|---|
| 662 | #self.close()
|
|---|
| 663 |
|
|---|
| 664 | def loadCam(self,url=""):
|
|---|
| 665 | devicepath = "/tmp/brd_solo.jpg"
|
|---|
| 666 | path = "/tmp"
|
|---|
| 667 |
|
|---|
| 668 | # send Cookie-Information to svz and you become rights
|
|---|
| 669 | data = "svz_bw_tpl: svz_bw;6e09bde33fae46dde0bb68bfc4ecaf63:medgr1mavnfd2hsj7vfrejut82m38ghv;JASLIDESHOWPLAY:1"
|
|---|
| 670 | cookiehead = {
|
|---|
| 671 | "Keep-Alive":"800",
|
|---|
| 672 | "Referer":"http://www.svz-bw.de",
|
|---|
| 673 | "Cookie:": data,
|
|---|
| 674 | "Connection":"keep-alive"
|
|---|
| 675 | }
|
|---|
| 676 |
|
|---|
| 677 | agt = "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2"
|
|---|
| 678 | downloadPage(url,devicepath,headers=cookiehead,agent=agt).addCallback(self.onLastFinished).addErrback(self.onLoadFailed)
|
|---|
| 679 |
|
|---|
| 680 | #h = urllib.urlretrieve(url, devicepath)
|
|---|
| 681 | #filelist = devicepath
|
|---|
| 682 | #self.session.open(PicView, filelist, 0, path, False)
|
|---|
| 683 |
|
|---|
| 684 | def onLastFinished(self,url=None):
|
|---|
| 685 | devicepath = "/tmp/brd_solo.jpg"
|
|---|
| 686 | path = "/tmp"
|
|---|
| 687 | filelist = devicepath
|
|---|
| 688 | self.session.open(PicView, filelist, 0, path, False)
|
|---|
| 689 |
|
|---|
| 690 | def onLoadFailed(self,error):
|
|---|
| 691 | print "[BoardViewer] ReadBoard:onLoadFAILED",error
|
|---|
| 692 |
|
|---|
| 693 | def CamEntryItem(self,entry):
|
|---|
| 694 | rot = 16711680
|
|---|
| 695 | gruen = 60928
|
|---|
| 696 | dgruen = 52480
|
|---|
| 697 | drot = 0xf47d19
|
|---|
| 698 | mblau = 8900346
|
|---|
| 699 | hblau = 11592447
|
|---|
| 700 | dblau = 5215437
|
|---|
| 701 | weiss = 0xffffff
|
|---|
| 702 | orange = 0xf47d19
|
|---|
| 703 | grau = 0x565656
|
|---|
| 704 |
|
|---|
| 705 | res = [entry]
|
|---|
| 706 | # return (eListboxPythonMultiContent.TYPE_TEXT, pos[0], pos[1], size[0], size[1], font, flags, text, color, color_sel, backcolor, backcolor_sel, border_width, border_color)
|
|---|
| 707 | #res.append(MultiContentEntryPixmapAlphaTest(pos=(2, 5), size=(100, 60), png=entry[0])) # png vorn
|
|---|
| 708 | res.append(MultiContentEntryText(pos=(30, 6), size=(620, 35), font=0, text=entry[0], color=mblau, color_sel=mblau, backcolor_sel=grau))
|
|---|
| 709 | return res
|
|---|
| 710 |
|
|---|
| 711 | #------------------------------------------------------------------------------------------
|
|---|
| 712 | #-------------------------- Bildbetrachter der Grossbilder --------------------------------
|
|---|
| 713 | #------------------------------------------------------------------------------------------
|
|---|
| 714 | class PicView(Screen):
|
|---|
| 715 | def __init__(self, session, filelist, index, path, startslide):
|
|---|
| 716 | self.session = session
|
|---|
| 717 | self.bgcolor = "#00000000"
|
|---|
| 718 | space = 5
|
|---|
| 719 | size_w = getDesktop(0).size().width()
|
|---|
| 720 | size_h = getDesktop(0).size().height()
|
|---|
| 721 |
|
|---|
| 722 | self.skindir = "/tmp"
|
|---|
| 723 | self.skin = "<screen position=\"0,0\" size=\"" + str(size_w) + "," + str(size_h) + "\" > \
|
|---|
| 724 | <eLabel position=\"0,0\" zPosition=\"0\" size=\""+ str(size_w) + "," + str(size_h) + "\" backgroundColor=\""+ self.bgcolor +"\" /><widget name=\"pic\" position=\"" + str(space) + "," + str(space) + "\" size=\"" + str(size_w-(space*2)) + "," + str(size_h-(space*2)) + "\" zPosition=\"1\" alphatest=\"on\" /></screen>"
|
|---|
| 725 |
|
|---|
| 726 | Screen.__init__(self, session)
|
|---|
| 727 | self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "DirectionActions", "MovieSelectionActions", "MenuActions", "SetupActions"],
|
|---|
| 728 | {
|
|---|
| 729 | "cancel": self.Exit,
|
|---|
| 730 | }, -1)
|
|---|
| 731 |
|
|---|
| 732 | self["pic"] = Pixmap()
|
|---|
| 733 | self.filelist = filelist
|
|---|
| 734 | self.old_index = 0
|
|---|
| 735 | self.lastindex = index
|
|---|
| 736 | self.currPic = []
|
|---|
| 737 | self.shownow = True
|
|---|
| 738 | self.dirlistcount = 0
|
|---|
| 739 | self.index = 0
|
|---|
| 740 | self.picload = ePicLoad()
|
|---|
| 741 | self.picload.PictureData.get().append(self.finish_decode)
|
|---|
| 742 | self.onLayoutFinish.append(self.setPicloadConf)
|
|---|
| 743 | self.startslide = startslide
|
|---|
| 744 |
|
|---|
| 745 | def setPicloadConf(self):
|
|---|
| 746 | sc = getScale()
|
|---|
| 747 | self.picload.setPara([self["pic"].instance.size().width(), self["pic"].instance.size().height(), sc[0], sc[1], 0, 1, self.bgcolor])
|
|---|
| 748 | self.start_decode()
|
|---|
| 749 |
|
|---|
| 750 | def ShowPicture(self):
|
|---|
| 751 | if self.shownow and len(self.currPic):
|
|---|
| 752 | self.shownow = False
|
|---|
| 753 | self["pic"].instance.setPixmap(self.currPic[0].__deref__())
|
|---|
| 754 |
|
|---|
| 755 | def finish_decode(self, picInfo=""):
|
|---|
| 756 | ptr = self.picload.getData()
|
|---|
| 757 | if ptr != None:
|
|---|
| 758 | self.currPic = []
|
|---|
| 759 | self.currPic.append(ptr)
|
|---|
| 760 | self.ShowPicture()
|
|---|
| 761 |
|
|---|
| 762 | def start_decode(self):
|
|---|
| 763 | self.picload.startDecode(self.filelist)
|
|---|
| 764 |
|
|---|
| 765 | def Exit(self):
|
|---|
| 766 | del self.picload
|
|---|
| 767 | self.close(self.lastindex + self.dirlistcount)
|
|---|
| 768 |
|
|---|
| 769 |
|
|---|
| 770 | #------------------------------------------------------------------------------------------
|
|---|
| 771 | #-----------------------Haupt Programm ----------------------------------------------------
|
|---|
| 772 | #------------------------------------------------------------------------------------------
|
|---|
| 773 | def start(session, **kwargs):
|
|---|
| 774 | session.open(Streetview)
|
|---|
| 775 |
|
|---|
| 776 | def Plugins(**kwargs):
|
|---|
| 777 | return PluginDescriptor(name="StreetInfo", description="Stauwarnungen", where=[PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU], fnc=start)
|
|---|