def __init__(self, **kwargs): ManagedWindow.__init__(self, kwargs.get('window')) if self.is_minimized: position=(random.uniform(ICONSIZE/2, WIDTH-ICONSIZE/2), random.uniform(ICONSIZE/2, HEIGHT-BARSIZE-ICONSIZE/2)) else: position=(random.uniform(ICONSIZE/2, WIDTH-ICONSIZE/2), random.uniform(HEIGHT-BARSIZE+ICONSIZE/2, HEIGHT-ICONSIZE/2)) MTScatterImage.__init__(self, filename=self.imgpath, do_rotation=False, do_scale=False, size=(ICONSIZE,ICONSIZE), pos=position)
def on_touch_up(self, touchlist, touchID, x, y): """Event handler for touch_up on the MTScatterImage - fires on finger release or end of kinetic motion, and sets appropriate restore state""" if is_in_bar(x, y): if self.is_minimized: print self.name, "Restoring!" self.restore() else: print self.name, "already restored" else: # (not is_in_bar(x, y)) if not self.is_minimized: print self.name, "Minimizing!" self.minimize() else: print self.name, "already minimized" self.update_minimization() #print "hey, touch up: ",self.name, touchlist, touchID, x, y # call superclass method to ensure we actually move. return MTScatterImage.on_touch_up(self, touchlist, touchID, x, y)