Explorar el Código

add splash when connecting to wifi. font test shows all available font files.

Thomas Buck hace 1 año
padre
commit
babbf6be13
Se han modificado 4 ficheros con 26 adiciones y 18 borrados
  1. 2
    0
      copy.sh
  2. 11
    12
      draw.py
  3. 10
    3
      net.py
  4. 3
    3
      splash.py

+ 2
- 0
copy.sh Ver fichero

@@ -8,6 +8,7 @@ cp util.py /pyboard
8 8
 cp manager.py /pyboard
9 9
 cp net.py /pyboard
10 10
 cp solid.py /pyboard
11
+cp splash.py /pyboard
11 12
 cp $1 /pyboard/main.py
12 13
 EOF
13 14
 else
@@ -19,6 +20,7 @@ cp util.py /pyboard
19 20
 cp manager.py /pyboard
20 21
 cp net.py /pyboard
21 22
 cp solid.py /pyboard
23
+cp splash.py /pyboard
22 24
 cp life.py /pyboard
23 25
 EOF
24 26
 fi

+ 11
- 12
draw.py Ver fichero

@@ -162,6 +162,7 @@ if __name__ == "__main__":
162 162
     import util
163 163
     t = util.getTarget()
164 164
 
165
+    # show splash screen while initializing
165 166
     from splash import SplashScreen
166 167
     splash = SplashScreen(t)
167 168
     t.loop_start()
@@ -171,18 +172,16 @@ if __name__ == "__main__":
171 172
     from manager import Manager
172 173
     m = Manager(t)
173 174
 
174
-    m.add(ScrollText(t, "tom-thumb Abcdefgh tom-thumb", "tom-thumb",
175
-                     1, 75, (0, 255, 0), (0, 0, 25)))
176
-    m.add(ScrollText(t, "antidote Abcdefgh antidote", "antidote",
177
-                     1, 75, (0, 255, 0), (0, 0, 25)))
178
-    m.add(ScrollText(t, "uushi Abcdefgh uushi", "uushi",
179
-                     1, 75, (0, 255, 0), (0, 0, 25)))
180
-    m.add(ScrollText(t, "lemon Abcdefgh lemon", "lemon",
181
-                     1, 75, (0, 255, 0), (0, 0, 25)))
182
-    m.add(ScrollText(t, "ib8x8u Abcdefgh ib8x8u", "ib8x8u",
183
-                     1, 75, (0, 255, 0), (0, 0, 25)))
184
-    m.add(ScrollText(t, "iv18x16u Abcdefgh iv18x16u", "iv18x16u",
185
-                     1, 75, (0, 255, 0), (0, 0, 25)))
175
+    scriptDir = os.path.dirname(os.path.realpath(__file__))
176
+    fontDir = os.path.join(scriptDir, "fonts")
177
+    for f in os.listdir(os.fsencode(fontDir)):
178
+        filename = os.fsdecode(f)
179
+        if not filename.endswith(".bdf"):
180
+            continue
181
+
182
+        fontName = filename[:-4]
183
+        s = fontName + " Abcdefgh " + fontName
184
+        m.add(ScrollText(t, s, fontName, 1, 75, (0, 255, 0), (0, 0, 25)))
186 185
 
187 186
     m.restart()
188 187
     t.loop(m.draw)

+ 10
- 3
net.py Ver fichero

@@ -69,12 +69,19 @@ class CheckHTTP:
69 69
             self.failScreen.draw()
70 70
 
71 71
 if __name__ == "__main__":
72
-    from draw import ScrollText
72
+    from solid import Solid
73 73
     import util
74 74
     t = util.getTarget()
75 75
 
76
+    # show splash screen while connecting to WiFi on Pico
77
+    from splash import SplashScreen
78
+    splash = SplashScreen(t)
79
+    t.loop_start()
80
+    splash.draw()
81
+    t.loop_end()
82
+
76 83
     d = CheckHTTP("http://xythobuz.de")
77
-    d.success(ScrollText(t, "Success", "ib8x8u"))
78
-    d.fail(ScrollText(t, "Failure", "ib8x8u"))
84
+    d.success(Solid(t, 1.0, (0, 255, 0)))
85
+    d.fail(Solid(t, 1.0, (255, 0, 0)))
79 86
 
80 87
     t.loop(d.draw)

+ 3
- 3
splash.py Ver fichero

@@ -8,10 +8,10 @@
8 8
 # ----------------------------------------------------------------------------
9 9
 
10 10
 class SplashScreen:
11
-    def __init__(self, g, width = 32, height = 32):
11
+    def __init__(self, g):
12 12
         self.gui = g
13
-        self.width = width
14
-        self.height = height
13
+        self.width = self.gui.panelW
14
+        self.height = self.gui.panelH
15 15
 
16 16
     def draw(self):
17 17
         for x in range(0, int(self.gui.width / self.width)):

Loading…
Cancelar
Guardar