Exemplo n.º 1
0
 def on_key_release(self, symbol, modifiers):
     self.try_redraw()
     if not graphics.drawing and self.current_tool.key_release != tool.Tool.key_release:
         graphics.enter_canvas_mode()
         graphics.drawing = True
         self.current_tool.key_release(symbol, modifiers)
         graphics.drawing = False
         graphics.exit_canvas_mode()
Exemplo n.º 2
0
 def on_text(self, text):
     self.try_redraw()
     if not graphics.drawing and self.current_tool.text != tool.Tool.text:
         graphics.enter_canvas_mode()
         graphics.drawing = True
         self.current_tool.text(text)
         graphics.drawing = False
         graphics.exit_canvas_mode()
Exemplo n.º 3
0
 def on_key_press(self, symbol, modifiers):
     self.try_redraw()
     if modifiers & key.MOD_ACCEL:
         if symbol == key.F:
             graphics.toggle_fullscreen()
         elif symbol == key.Z:
             self.undo()
         elif symbol == key.S:
             self.save()
         elif symbol == key.O:
             self.open()
     if not graphics.drawing and self.current_tool.key_press != tool.Tool.key_press:
         graphics.enter_canvas_mode()
         graphics.drawing = True
         self.current_tool.key_press(symbol, modifiers)
         graphics.drawing = False
         graphics.exit_canvas_mode()
     if symbol == key.ESCAPE: return True    #stop Pyglet from quitting
Exemplo n.º 4
0
 def on_mouse_release(self, x, y, button, modifiers):
     self.try_redraw()
     if graphics.drawing:
         self.current_tool.stop_drawing(x,y)
         graphics.drawing = False
         graphics.exit_canvas_mode()