Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
UCC
progcomp2013
Commits
6632f343
Commit
6632f343
authored
Apr 02, 2013
by
Sam Moore
Browse files
Make --blackout option turn off screen
Because the SDL_ENABLE_SCREENSAVER flag wasn't working
parent
639646ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
qchess/qchess.py
View file @
6632f343
...
@@ -1954,6 +1954,7 @@ class GraphicsThread(StoppableThread):
...
@@ -1954,6 +1954,7 @@ class GraphicsThread(StoppableThread):
self
.
cond
=
threading
.
Condition
()
self
.
cond
=
threading
.
Condition
()
self
.
sleep_timeout
=
None
self
.
sleep_timeout
=
None
self
.
last_event
=
time
.
time
()
self
.
last_event
=
time
.
time
()
self
.
blackout
=
False
#print "Test font"
#print "Test font"
pygame
.
font
.
Font
(
os
.
path
.
join
(
os
.
path
.
curdir
,
"data"
,
"DejaVuSans.ttf"
),
32
).
render
(
"Hello"
,
True
,(
0
,
0
,
0
))
pygame
.
font
.
Font
(
os
.
path
.
join
(
os
.
path
.
curdir
,
"data"
,
"DejaVuSans.ttf"
),
32
).
render
(
"Hello"
,
True
,(
0
,
0
,
0
))
...
@@ -1987,8 +1988,11 @@ class GraphicsThread(StoppableThread):
...
@@ -1987,8 +1988,11 @@ class GraphicsThread(StoppableThread):
#print "Display pieces"
#print "Display pieces"
self
.
board
.
display_pieces
(
window
=
self
.
window
,
grid_sz
=
self
.
grid_sz
)
# Draw the board
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
))
self
.
window
.
fill
((
0
,
0
,
0
))
pygame
.
display
.
flip
()
pygame
.
display
.
flip
()
...
@@ -2013,7 +2017,7 @@ class GraphicsThread(StoppableThread):
...
@@ -2013,7 +2017,7 @@ class GraphicsThread(StoppableThread):
...
@@ -2687,4 +2691,4 @@ if __name__ == "__main__":
...
@@ -2687,4 +2691,4 @@ if __name__ == "__main__":
sys
.
exit
(
102
)
sys
.
exit
(
102
)
# --- main.py --- #
# --- main.py --- #
# EOF - created from make on
Fri Mar
2
9
1
8:33:24
WST 2013
# EOF - created from make on
Tue Apr
2 1
5:05:07
WST 2013
qchess/src/graphics.py
View file @
6632f343
...
@@ -29,6 +29,7 @@ class GraphicsThread(StoppableThread):
...
@@ -29,6 +29,7 @@ class GraphicsThread(StoppableThread):
self
.
cond
=
threading
.
Condition
()
self
.
cond
=
threading
.
Condition
()
self
.
sleep_timeout
=
None
self
.
sleep_timeout
=
None
self
.
last_event
=
time
.
time
()
self
.
last_event
=
time
.
time
()
self
.
blackout
=
False
#print "Test font"
#print "Test font"
pygame
.
font
.
Font
(
os
.
path
.
join
(
os
.
path
.
curdir
,
"data"
,
"DejaVuSans.ttf"
),
32
).
render
(
"Hello"
,
True
,(
0
,
0
,
0
))
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):
...
@@ -62,8 +63,11 @@ class GraphicsThread(StoppableThread):
#print "Display pieces"
#print "Display pieces"
self
.
board
.
display_pieces
(
window
=
self
.
window
,
grid_sz
=
self
.
grid_sz
)
# Draw the board
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
))
self
.
window
.
fill
((
0
,
0
,
0
))
pygame
.
display
.
flip
()
pygame
.
display
.
flip
()
...
@@ -88,7 +92,7 @@ class GraphicsThread(StoppableThread):
...
@@ -88,7 +92,7 @@ class GraphicsThread(StoppableThread):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment