import gtk
import os
import pango
+import gobject
###########################################################
# Writing recognistion code
self.lineheight = (met.get_ascent() + met.get_descent()) / pango.SCALE
self.lineascent = met.get_ascent() / pango.SCALE
+ self.timeout = None
+
def close_application(self, widget):
self.save_page()
gtk.main_quit()
def press(self, c, ev):
# Start a new line
+ if self.timeout:
+ gobject.source_remove(self.timeout)
+ self.timeout = None
self.line = [ self.colourname, [int(ev.x), int(ev.y)] ]
return
def release(self, c, ev):
if self.line == None:
return
+ if self.timeout == None:
+ self.timeout = gobject.timeout_add(20*1000, self.tick)
+
if len(self.line) == 2:
# just set a cursor
self.flush_text()
self.line.append([x,y])
return
+ def tick(self):
+ # nothing for 20 seconds, flush the page
+ self.save_page()
+ gobject.source_remove(self.timeout)
+ self.timeout = None
+
def find_text(self, pos):
x = pos[0]; y = pos[1]
for i in range(0, len(self.lines)):