i-have-a-dreambox.com | Dreambox - Support

Register Calendar Members List Team Members Galerie to Portal Go to the Main Page

Boardrules Frequently Asked Questions Statistik Statistik Search Pinwand Dreambox Blog Ihad/Gemini Fan-Shop
i-have-a-dreambox.com | Dreambox - Support » ...::: Dreambox Software :::... » Dreambox Plugins (Enigma2) » Bundesliga tabellen plugin (need help) ! » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Add Thread to Favorites
Post New Thread Post Reply
Go to the bottom of this page Bundesliga tabellen plugin (need help) !
Author
Post « Previous Thread | Next Thread »
dirtylion
V.I.P.


images/avatars/avatar-17391.png

Registration Date: 20.01.2008
Posts: 638
External Storage: HDD
Which Image: Sonstige
Welcher Bildschirm: Samsung 46"

Fragezeichen Bundesliga tabellen plugin (need help) ! Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

hi,

Ich versuche mich immer mehr mit python anzufreunden smile
im bereich engima2 und gui habe ich meine probleme unglücklich
evtl. kann mir einer von euch weiterhelfen..

Ich bastel hier gerade ein kleines Bundesliga Tabellen plugin.

http://www.pic-upload.de/view-9711443/IMG_0040.jpg.html


code:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
 
# -*- coding: utf-8 -*-
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Button import Button
from Components.Sources.List import List
from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from enigma import eListboxPythonMultiContent, eListbox, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER

import urllib, re, time

class startDemoScreen(Screen):
skin = """
<screen position="center,center" size="600,450" title="%s" >
<widget source="tab1" render="Listbox" scrollbarMode="showOnDemand" position="15,5" size="580,450" zPosition="3" transparent="1" backgroundColor="black" >
<convert type="TemplatedMultiContent">
{ "templates":
{"default": (20, [
MultiContentEntryText(pos = (0, 0), size = (580, 20), font = 0, flags = RT_HALIGN_LEFT, text = 0, backcolor=0xFF000005, color=0xFF000006),
], False, "showNever";),
"notselected": (20, [
MultiContentEntryText(pos = (0, 0), size = (580, 20), font = 0, flags = RT_HALIGN_LEFT, text = 0, backcolor=0xFF000005, color=0xFF000006),
], True, "showNever";)
},
"fonts": [gFont("Regular", 18)],
"itemHeight": 20
}
</convert>
</widget>
<ePixmap name="red" position="5,400" zPosition="4" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
<widget name="key_red" position="5,400" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
<ePixmap name="green" position="150,400" zPosition="4" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
<widget name="key_green" position="150,400" zPosition="5" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
</screen>"""% _("Bundesliga Portal";)

def __init__(self, session, plugin_path):
self.skin_path = plugin_path
self.plugin_path = plugin_path
Screen.__init__(self, session)
self["actions"] = ActionMap(["SetupActions", "ColorActions"],
{
"green": self.settings,
"cancel": self.close,
}, -1)
self.url = "http://fussballdaten.de/bundesliga/"
self["key_green"] = Button(_("Start";))
self["key_red"] = Button(_("Cancel";))
self["tab1"] = List([])

def settings(self):
tab1 = []
tab1.append(("", "", 0x80ffcc00, 0x000000))
data = urllib.urlopen(self.url).read()

platz = re.findall("<tr.*?<td class=.Platz.*?.>;(.*?)</td>", data)
lplatz = re.findall("<td class=.VPlatz.>;(.*?)</td>", data)
tendenz = re.findall("<td class=.Tendenz.>;(.*?)</td>", data)
logoverein = re.findall("<td class=.Verein.><span class=.Logo.><img alt=.*? src=./bilder/t-vereine/15x15/(.*?)...>", data)
verein = re.findall("<td class=.Verein.><span class=.Logo.><img alt=.*?src=.*?></span><a href=.*?>;(.*?)</a></td>", data)
spiele = re.findall("<td class=.Spiele.>;(.*?)</td>", data)
siege = re.findall("<td class=.S.>;(.*?)</td>", data)
unen = re.findall("<td class=.U.>;(.*?)</td>", data)
nieder = re.findall("<td class=.N.>;(.*?)</td>", data)
torver = re.findall("<td class=.Torverhaeltnis.>;(.*?)</td>", data)
diff = re.findall("<td class=.Diff.>;(.*?)</td>", data)
punkte = re.findall("<td class=.Punkte.>;(.*?)</td>", data)

count = 0
while (count < 18):

tmp_platz = platz[count]
tmp_lplatz = lplatz[count]
tmp_vereinslogo = logoverein[count]
tmp_vereinsname = verein[count]
tmp_spiele = spiele[count]
tmp_siege = siege[count]
tmp_u = unen[count]
tmp_n = nieder[count]
tmp_torv = torver[count]
tmp_diff = diff[count]
tmp_punkte = punkte[count]

tmp = tmp_platz + " " + tmp_lplatz + " " + tmp_vereinsname + " " + tmp_spiele + " " + tmp_siege + " " + tmp_u + " " + tmp_n + " " + tmp_torv + " " + tmp_diff + " " + tmp_punkte

count = count + 1
tab1.append((tmp , 0x80615e5e) )

self["tab1"].setList(tab1)

def main(session, **kwargs):
session.open(startDemoScreen, plugin_path)

def Plugins(path,**kwargs):
global plugin_path
plugin_path = path
return [
PluginDescriptor(name="Bundesliga Portal",description="Bundesliga", where = [ PluginDescriptor.WHERE_PLUGINMENU ], fnc = main),
PluginDescriptor(name="Bundesliga Portal", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)
]

in der variable "tmp_vereinslogo" steht der filename vom gif z.b "3026.gif"

die vereinlogos wollte ich nun vor jedem verein darstellen.
die logos liegen alle im script ordner /logos/..

desweiteren wollte ich das alles noch etwas sauberer darstellen wenn dazu evtl. noch jemand eine idee hat. Augenzwinkern

so:
1. (1.) Borussia Dortmund 31 21 6 4 62:19 +43 69
2. (2.) Bayer Leverkusen 31 19 7 5 62:41 +21 64

__________________
myAbo.tv
Sport Portal
Tipp Spiel
Bundesliga Ticker

This post has been edited 6 time(s), it was last edited by dirtylion: 24.04.2011 18:12.

24.04.2011 18:06 dirtylion is offline Search for Posts by dirtylion Add dirtylion to your Buddy List
Tree Structure | Board Structure
Jump to:
Post New Thread Post Reply
i-have-a-dreambox.com | Dreambox - Support » ...::: Dreambox Software :::... » Dreambox Plugins (Enigma2) » Bundesliga tabellen plugin (need help) !

Privacy policy | Team | Suchen | Hilfe


Powered by Burning Board 2.3.6 © 2001-2003 WoltLab GbR