예제 #1
0
 def restrict_pos(self):
     x1 = rog.view_port_x()
     x2 = x1 + rog.view_w() - 1
     y1 = rog.view_port_y()
     y2 = y1 + rog.view_h() - 1
     self.x = maths.restrict(self.x, x1, x2)
     self.y = maths.restrict(self.y, y1, y2)
예제 #2
0
 def user_input(self, pcAct):
     for act, arg in pcAct:
         if act=="target":
             self.y += arg[1]*self.scrollspd
             self.y=maths.restrict(self.y,0,self.maxy)
         elif act=="page up":    self.y = max(0,         self.y -int(self.pagescroll))
         elif act=="page down":  self.y = min(self.maxy, self.y +int(self.pagescroll))
         elif act=="home":       self.y = 0
         elif act=="end":        self.y = max(0,         self.maxy -self.pagescroll)
         elif (act=="select" or act=="exit"): self.set_result('exit')
         self.update()
예제 #3
0
 def putCursor(self, new):
     pos = maths.restrict(new, 0, min(self.w - 1, len(self.text)))
     self.cursor.set_pos(self.x + pos, self.y)