X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=qchess%2Fsrc%2Fgraphics.py;h=72b907f36d9f9ee528daafc40619f201cf0c5c4d;hb=b62f274ce80bc47fd5bd684cc4157860b8ad65f4;hp=0097ec2e92173b794f25e470c9fa2d11fd314cd7;hpb=545652c966aa156faa9301a709dc9ad565df4c9b;p=progcomp2013.git diff --git a/qchess/src/graphics.py b/qchess/src/graphics.py index 0097ec2..72b907f 100644 --- a/qchess/src/graphics.py +++ b/qchess/src/graphics.py @@ -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): - + @@ -363,6 +367,18 @@ class GraphicsThread(StoppableThread): #print "Reject " + str(i) + str(event.pos) + " vs " + str(t) + # Function to choose between dedicated server or normal play + def SelectServer(self): + + choice = self.SelectButton(["Normal", "Join Eigenserver"],prompt="Game type?") + if choice == 0: + return None + choice = self.SelectButton(["progcomp.ucc", "other"], prompt="Address?") + if choice == 0: + return "progcomp.ucc.asn.au" + else: + return self.getstr(prompt = "Enter address:") + # Function to pick players in a nice GUI way def SelectPlayers(self, players = []): @@ -425,7 +441,7 @@ class GraphicsThread(StoppableThread): time.sleep(1) p = None players.append(p) - elif choice == 2: + elif choice == 1: address = "" while address == "": self.board.display_grid(self.window, self.grid_sz)