Преглед изворни кода

reduce brightness even more at night

Thomas Buck пре 1 година
родитељ
комит
85ba4d1e6f
2 измењених фајлова са 23 додато и 11 уклоњено
  1. 18
    10
      mapper.py
  2. 5
    1
      util.py

+ 18
- 10
mapper.py Прегледај датотеку

@@ -151,22 +151,30 @@ class MapperReduceBrightness(MapperNull):
151 151
 
152 152
         # TODO ntptime is setting to UTC, host is on proper timezone
153 153
         if useNTP:
154
-            # 8pm utc == 10pm cest germany
155
-            night = (now[0], now[1], now[2], 20, 0, 0, 0, 0)
154
+            # 6pm utc == 8pm cest germany
155
+            evening = (now[0], now[1], now[2], 18, 0, 0, 0, 0)
156 156
 
157
-            # 5am utc == 7am cest germany
158
-            morning = (now[0], now[1], now[2], 5, 0, 0, 0, 0)
157
+            # 0am utc == 2am cest germany
158
+            night = (now[0], now[1], now[2], 0, 0, 0, 0, 0)
159
+
160
+            # 6am utc == 8am cest germany
161
+            morning = (now[0], now[1], now[2], 6, 0, 0, 0, 0)
159 162
         else:
160
-            # 10pm cest germany
161
-            night = (now[0], now[1], now[2], 22, 0, 0, 0, 0)
163
+            # 8pm cest germany
164
+            evening = (now[0], now[1], now[2], 20, 0, 0, 0, 0)
165
+
166
+            # 2am cest germany
167
+            night = (now[0], now[1], now[2], 2, 0, 0, 0, 0)
162 168
 
163
-            # 7am cest germany
164
-            morning = (now[0], now[1], now[2], 7, 0, 0, 0, 0)
169
+            # 8am cest germany
170
+            morning = (now[0], now[1], now[2], 8, 0, 0, 0, 0)
165 171
 
166
-        if (now > morning) and (now < night):
172
+        if (now >= morning) and (now < evening):
167 173
             self.factor = 1.0
168
-        else:
174
+        elif (now >= evening) or (now < night):
169 175
             self.factor = 0.42
176
+        else:
177
+            self.factor = 0.1
170 178
 
171 179
     def buttons(self):
172 180
         keys = self.input.get()

+ 5
- 1
util.py Прегледај датотеку

@@ -88,7 +88,11 @@ def getTarget(i = None):
88 88
 
89 89
             # If this fails fall back to the SDL/pygame GUI
90 90
             from test import TestGUI
91
-            target = TestGUI()
91
+            ui = TestGUI()
92
+
93
+            # TODO hard-coded adjustments
94
+            from mapper import MapperReduceBrightness
95
+            target = MapperReduceBrightness(ui, i)
92 96
 
93 97
             if targetPlatform == None:
94 98
                 # only print once

Loading…
Откажи
Сачувај