Mercurial > pyntnclick
comparison tools/rect_drawer.py @ 198:e73d78d6dd83
Stubs for ftuture functionality
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Thu, 26 Aug 2010 08:47:08 +0200 |
parents | 640044d7ddda |
children | 4821c290286d |
comparison
equal
deleted
inserted
replaced
197:640044d7ddda | 198:e73d78d6dd83 |
---|---|
95 for col, rect in self.rects: | 95 for col, rect in self.rects: |
96 d.setdefault(col, []) | 96 d.setdefault(col, []) |
97 d[col].append(rect) | 97 d[col].append(rect) |
98 return d | 98 return d |
99 | 99 |
100 def print_rects(self): | 100 def print_objs(self): |
101 d = self._make_dict() | 101 d = self._make_dict() |
102 for (num, col) in enumerate(d): | 102 for (num, col) in enumerate(d): |
103 print 'Rect %d : ' % num | 103 print 'Rect %d : ' % num |
104 for r in d[col]: | 104 for r in d[col]: |
105 print ' (%d, %d, %d, %d),' % (r.x, r.y, r.w, r.h) | 105 print ' (%d, %d, %d, %d),' % (r.x, r.y, r.w, r.h) |
106 print | 106 print |
107 | |
108 def image_load(sef): | |
109 pass | |
110 | |
111 def image_mode(self): | |
112 self.mode = 'image' | |
113 self.start_pos = None | |
114 self.end_pos = None | |
107 | 115 |
108 def mouse_down(self, e): | 116 def mouse_down(self, e): |
109 if self.mode == 'del': | 117 if self.mode == 'del': |
110 pos = e.pos | 118 pos = e.pos |
111 cand = None | 119 cand = None |
160 app = RootWidget(display) | 168 app = RootWidget(display) |
161 image = AppImage(state) | 169 image = AppImage(state) |
162 app.add(image) | 170 app.add(image) |
163 draw = make_button('Draw Rect', image.draw_mode, 0) | 171 draw = make_button('Draw Rect', image.draw_mode, 0) |
164 app.add(draw) | 172 app.add(draw) |
165 delete = make_button('Del Rect', image.del_mode, 40) | 173 load_image = make_button("Load image", image.image_load, 40) |
174 app.add(load_image) | |
175 add_image = make_button("Place image", image.image_mode, 80) | |
176 app.add(add_image) | |
177 delete = make_button('Delete Objects', image.del_mode, 120) | |
166 app.add(delete) | 178 app.add(delete) |
167 palette = AppPalette(image) | 179 palette = AppPalette(image) |
168 palette.rect.move_ip(810, 80) | 180 palette.rect.move_ip(810, 160) |
169 app.add(palette) | 181 app.add(palette) |
170 print_rects = make_button("Print rects", image.print_rects, 240) | 182 print_rects = make_button("Print objects", image.print_objs, 320) |
171 app.add(print_rects) | 183 app.add(print_rects) |
172 quit_but = make_button("Quit", app.quit, 560) | 184 quit_but = make_button("Quit", app.quit, 560) |
173 app.add(quit_but) | 185 app.add(quit_but) |
174 app.run() | 186 app.run() |