ya2 · news · projects · code · about

changed the colors of the buttons
authorFlavio Calva <f.calva@gmail.com>
Sat, 8 Jan 2022 10:49:28 +0000 (11:49 +0100)
committerFlavio Calva <f.calva@gmail.com>
Sat, 8 Jan 2022 10:49:28 +0000 (11:49 +0100)
pmachines/scene.py

index 490ec327f87b345891be0e2a3a9c5357717b880a..3009fb7e6aff06f324b045aa59480e01b57ccd17 100644 (file)
@@ -33,24 +33,30 @@ class Scene(DirectObject):
             img.set_color(col)
             img.detach_node()
             return img
-        def load_images_btn(path):
-            colors = [
-                (.6, .6, .6, 1),  # ready
-                (1, 1, 1, 1), # press
-                (.8, .8, .8, 1), # rollover
-                (.4, .4, .4, .4)]  # disabled
+        def load_images_btn(path, col):
+            colors = {
+                'gray': [
+                    (.6, .6, .6, 1),  # ready
+                    (1, 1, 1, 1), # press
+                    (.8, .8, .8, 1), # rollover
+                    (.4, .4, .4, .4)],
+                'green': [
+                    (.1, .68, .1, 1),
+                    (.1, 1, .1, 1),
+                    (.1, .84, .1, 1),
+                    (.4, .1, .1, .4)]}[col]
             return [load_img_btn(path, col) for col in colors]
         abl, abr = base.a2dBottomLeft, base.a2dBottomRight
         btn_info = [
-            ('home', self.on_home, DISABLED, abl),
-            ('information', self.on_information, DISABLED, abl),
-            ('right', self.on_play, NORMAL, abr),
-            ('next', self.on_next, DISABLED, abr),
-            ('previous', self.on_prev, DISABLED, abr),
-            ('rewind', self.on_rewind, DISABLED, abr)]
+            ('home', self.on_home, DISABLED, abl, 'gray'),
+            ('information', self.on_information, DISABLED, abl, 'gray'),
+            ('right', self.on_play, NORMAL, abr, 'green'),
+            ('next', self.on_next, DISABLED, abr, 'gray'),
+            ('previous', self.on_prev, DISABLED, abr, 'gray'),
+            ('rewind', self.on_rewind, DISABLED, abr, 'gray')]
         num_l = num_r = 0
         for binfo in btn_info:
-            imgs = load_images_btn(binfo[0])
+            imgs = load_images_btn(binfo[0], binfo[4])
             if binfo[3] == base.a2dBottomLeft:
                 sign, num = 1, num_l
                 num_l += 1