Browse Source

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

Thomas Buck 1 year ago
parent
commit
babbf6be13
4 changed files with 26 additions and 18 deletions
  1. 2
    0
      copy.sh
  2. 11
    12
      draw.py
  3. 10
    3
      net.py
  4. 3
    3
      splash.py

+ 2
- 0
copy.sh View File

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

+ 11
- 12
draw.py View File

162
     import util
162
     import util
163
     t = util.getTarget()
163
     t = util.getTarget()
164
 
164
 
165
+    # show splash screen while initializing
165
     from splash import SplashScreen
166
     from splash import SplashScreen
166
     splash = SplashScreen(t)
167
     splash = SplashScreen(t)
167
     t.loop_start()
168
     t.loop_start()
171
     from manager import Manager
172
     from manager import Manager
172
     m = Manager(t)
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
     m.restart()
186
     m.restart()
188
     t.loop(m.draw)
187
     t.loop(m.draw)

+ 10
- 3
net.py View File

69
             self.failScreen.draw()
69
             self.failScreen.draw()
70
 
70
 
71
 if __name__ == "__main__":
71
 if __name__ == "__main__":
72
-    from draw import ScrollText
72
+    from solid import Solid
73
     import util
73
     import util
74
     t = util.getTarget()
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
     d = CheckHTTP("http://xythobuz.de")
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
     t.loop(d.draw)
87
     t.loop(d.draw)

+ 3
- 3
splash.py View File

8
 # ----------------------------------------------------------------------------
8
 # ----------------------------------------------------------------------------
9
 
9
 
10
 class SplashScreen:
10
 class SplashScreen:
11
-    def __init__(self, g, width = 32, height = 32):
11
+    def __init__(self, g):
12
         self.gui = g
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
     def draw(self):
16
     def draw(self):
17
         for x in range(0, int(self.gui.width / self.width)):
17
         for x in range(0, int(self.gui.width / self.width)):

Loading…
Cancel
Save