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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
# fake-enigma
import fake_time
class slot:
def __init__(self):
self.list = [ ]
def get(self):
return self.list
def __call__(self):
for x in self.list:
x()
timers = set()
import time
##################### ENIGMA BASE
class eTimer:
def __init__(self):
self.timeout = slot()
self.next_activation = None
def start(self, msec, singleshot = False):
self.next_activation = time.time() + msec / 1000.0
self.msec = msec
self.singleshot = singleshot
timers.add(self)
def stop():
timers.remove(self)
def __repr__(self):
return "<eTimer timeout=%s next_activation=%s singleshot=%s>" % (repr(self.timeout), repr(self.next_activation), repr(self.singleshot))
def do(self):
if self.singleshot:
self.stop()
self.next_activation += self.msec / 1000.0
print "next activation now %d " % self.next_activation
self.timeout()
def runIteration():
running_timers = list(timers)
assert len(running_timers), "no running timers, so nothing will ever happen!"
running_timers.sort(key=lambda x: x.next_activation)
print running_timers
next_timer = running_timers[0]
now = time.time()
delay = next_timer.next_activation - now
if delay > 0:
time.sleep(delay)
now += delay
while len(running_timers) and running_timers[0].next_activation <= now:
running_timers[0].do()
running_timers = running_timers[1:]
stopped = False
def stop():
global stopped
print "STOP NOW"
stopped = True
def run():
stoptimer = eTimer()
stoptimer.start(10000)
stoptimer.timeout.get().append(stop)
while not stopped:
runIteration()
##################### ENIGMA GUI
eSize = None
ePoint = None
gFont = None
eWindow = None
eLabel = None
ePixmap = None
eWindowStyleManager = None
loadPNG = None
addFont = None
gRGB = None
eWindowStyleSkinned = None
eButton = None
eListboxPythonStringContent = None
eListbox = None
eEPGCache = None
getBestPlayableServiceReference = None
class eServiceReference:
isDirectory=1
mustDescent=2
canDescent=4
flagDirectory=isDirectory|mustDescent|canDescent
shouldSort=8
hasSortKey=16
sort1=32
isMarker=64
isGroup=128
def __init__(self, ref):
self.ref = ref
self.flags = 0
iRecordableService = None
quitMainloop = None
eAVSwitch = None
eDVBVolumecontrol = None
eDBoxLCD = None
class eServiceCenter:
@classmethod
def getInstance(self):
return self.instance
instance = None
def __init__(self):
eServiceCenter.instance = self
def info(self, ref):
return None
eServiceCenter()
##################### ENIGMA CONFIG
import Components.config
my_config = [
"config.skin.primary_skin=None\n"
]
Components.config.config.unpickle(my_config)
##################### ENIGMA CHROOT
import Tools.Directories
chroot="."
for (x, (y, z)) in Tools.Directories.defaultPaths.items():
Tools.Directories.defaultPaths[x] = (chroot + y, z)
Tools.Directories.defaultPaths[Tools.Directories.SCOPE_SKIN] = ("../data/", Tools.Directories.PATH_DONTCREATE)
##################### ENIGMA ACTIONS
class eActionMap:
def __init__(self):
pass
|