Make --blackout option turn off screen
[progcomp2013.git] / qchess / src / graphics.py
index 0097ec2..fefcbf3 100644 (file)
@@ -29,6 +29,7 @@ class GraphicsThread(StoppableThread):
                self.cond = threading.Condition()
                self.sleep_timeout = None
                self.last_event = time.time()
+               self.blackout = False
 
                #print "Test font"
                pygame.font.Font(os.path.join(os.path.curdir, "data", "DejaVuSans.ttf"), 32).render("Hello", True,(0,0,0))
@@ -62,8 +63,11 @@ class GraphicsThread(StoppableThread):
 
                                #print "Display pieces"
                                self.board.display_pieces(window = self.window, grid_sz = self.grid_sz) # Draw the board                
+                               self.blackout = False
                                
-                       else:
+                       elif pygame.mouse.get_focused() and not self.blackout:
+                               os.system("xset dpms force off")
+                               self.blackout = True
                                self.window.fill((0,0,0))
 
                        pygame.display.flip()
@@ -88,7 +92,7 @@ class GraphicsThread(StoppableThread):
                                
                                
                                        
-
+  
                                
                                                                
                                                

UCC git Repository :: git.ucc.asn.au