Mercurial > boomslang
annotate pyntnclick/tools/utils.py @ 690:4a933444c99b pyntnclick
The return of the rects to the rect drawer
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Tue, 14 Feb 2012 12:24:33 +0200 |
parents | ebc48b397fd5 |
children | 60bf20849231 |
rev | line source |
---|---|
589
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
1 # Misc utils I don't know where else to put |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
2 |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
3 |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
4 def list_scenes(get_initial_state): |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
5 """List the scenes in the state""" |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
6 state = get_initial_state() |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
7 print 'Available scenes are : ' |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
8 for scene in state.scenes: |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
9 print ' ', scene |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
10 print 'Available details are : ' |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
11 for detail in state.detail_views: |
ebc48b397fd5
Turn rect_drawer into a command line option
Neil Muller <neil@dip.sun.ac.za>
parents:
diff
changeset
|
12 print ' ', detail |
690
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
13 |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
14 def draw_rect_image(surface, color, rect, thickness): |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
15 """Draw a rectangle with lines thickness wide""" |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
16 # top |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
17 surface.fill(color, (rect.left, rect.top, rect.width, thickness)) |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
18 # bottom |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
19 surface.fill(color, (rect.left, rect.bottom - thickness, rect.width, |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
20 thickness)) |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
21 # left |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
22 surface.fill(color, (rect.left, rect.top, thickness, rect.height)) |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
23 # right |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
24 surface.fill(color, (rect.right - thickness, rect.top, thickness, |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
25 rect.height)) |
4a933444c99b
The return of the rects to the rect drawer
Neil Muller <neil@dip.sun.ac.za>
parents:
589
diff
changeset
|
26 |