diff --git a/plugin.py b/plugin.py
index 9ac8667..07884f2 100644
a
|
b
|
class scheduler_select(gtk.DrawingArea):
|
293 | 293 | self.start_point = self.get_point(event) |
294 | 294 | self.button_state_temp = copy.deepcopy(self.button_state) |
295 | 295 | |
| 296 | self.new_state = self.button_state[self.start_point[0]][self.start_point[1]] |
| 297 | |
| 298 | if event.button == 1: |
| 299 | self.new_state += 1 |
| 300 | if self.new_state > 2: |
| 301 | self.new_state = 0 |
| 302 | |
| 303 | elif event.button == 3: |
| 304 | self.new_state -= 1 |
| 305 | if self.new_state < 0: |
| 306 | self.new_state = 2 |
| 307 | |
| 308 | self.button_state[self.start_point[0]][self.start_point[1]] = self.new_state |
| 309 | |
| 310 | self.queue_draw() |
| 311 | |
296 | 312 | #if the same box -> change it |
297 | 313 | def mouse_up(self, widget, event): |
298 | 314 | self.mouse_press = False |
299 | | end_point = self.get_point(event) |
300 | | |
301 | | #change color on mouseclick depending on the button |
302 | | if end_point[0] is self.start_point[0] and end_point[1] is self.start_point[1]: |
303 | | if event.button == 1: |
304 | | self.button_state[end_point[0]][end_point[1]] += 1 |
305 | | if self.button_state[end_point[0]][end_point[1]] > 2: |
306 | | self.button_state[end_point[0]][end_point[1]] = 0 |
307 | | elif event.button == 3: |
308 | | self.button_state[end_point[0]][end_point[1]] -= 1 |
309 | | if self.button_state[end_point[0]][end_point[1]] < 0: |
310 | | self.button_state[end_point[0]][end_point[1]] = 2 |
311 | | self.queue_draw() |
| 315 | |
| 316 | self.queue_draw() |
312 | 317 | |
313 | 318 | #if box changed and mouse is pressed draw all boxes from start point to end point |
314 | 319 | #set hover text etc.. |
… |
… |
class scheduler_select(gtk.DrawingArea):
|
325 | 330 | |
326 | 331 | for x in xrange(min(points[0]), max(points[0])+1): |
327 | 332 | for y in xrange(min(points[1]), max(points[1])+1): |
328 | | self.button_state[x][y] = self.button_state[self.start_point[0]][self.start_point[1]] |
| 333 | self.button_state[x][y] = self.new_state |
329 | 334 | |
330 | 335 | self.queue_draw() |
331 | 336 | |