示例#1
0
文件: imgv.py 项目: rkulla/imgv
 def start_auto_repeat(self):
     screen = self.gfx['screen']
     rect = self.gfx['rect']
     new_img = self.gfx['new_img']
     file = self.gfx['file']
     if gl.MY_KEYDOWN:
         if rect.bottom > screen.get_height():
             command_up(rect, self.last_rect, new_img, file)
             if gl.IMG_BORDER:
                 self.border_fix()
                 img_border(new_img, rect)
     if gl.MY_KEYUP:
         if rect.top < 0:
             command_down(rect, self.last_rect, new_img, file)
             if gl.IMG_BORDER:
                 self.border_fix()
                 img_border(new_img, rect)
     if gl.MY_KEYRIGHT:
         if rect.right > screen.get_width():
             command_left(rect, self.last_rect, new_img, file)
             if gl.IMG_BORDER:
                 self.border_fix()
                 img_border(new_img, rect)
     if gl.MY_KEYLEFT:
         if rect.left < 0:
             command_right(rect, self.last_rect, new_img, file)
             if gl.IMG_BORDER:
                 self.border_fix()
                 img_border(new_img, rect)
     if self.event.type == MOUSEBUTTONDOWN:
         if self.event.dict['button'] == 4:  # mouse wheel up
             if rect.top < 0:
                 command_down(rect, self.last_rect, new_img, file)
                 if gl.IMG_BORDER:
                     self.border_fix()
                     img_border(new_img, rect)
         if self.event.dict['button'] == 5:  # mouse wheel down
             if rect.bottom > screen.get_height():
                 command_up(rect, self.last_rect, new_img, file)
                 if gl.IMG_BORDER:
                     self.border_fix()
                     img_border(new_img, rect)
示例#2
0
def start_auto_repeat(rect, last_rect, new_img, screen, file, num_imgs, screen_width, screen_height, event):
    if gl.MY_KEYDOWN:
        if rect.bottom > screen_height:
            command_up(rect, last_rect, new_img, screen, file, num_imgs, screen_height)
            if gl.IMG_BORDER:
                border_fix(screen)
                img_border(screen, new_img.get_width(), new_img.get_height(), rect[0], rect[1])
    if gl.MY_KEYUP:
        if rect.top < 0:
            command_down(rect, last_rect, new_img, screen, file, num_imgs)
            if gl.IMG_BORDER:
                border_fix(screen)
                img_border(screen, new_img.get_width(), new_img.get_height(), rect[0], rect[1])
    if gl.MY_KEYRIGHT:
        if rect.right > screen_width:
            command_left(rect, last_rect, new_img, screen, file, num_imgs, screen_width)   
            if gl.IMG_BORDER:
                border_fix(screen)
                img_border(screen, new_img.get_width(), new_img.get_height(), rect[0], rect[1])
    if gl.MY_KEYLEFT:
        if rect.left < 0:
            command_right(rect, last_rect, new_img, screen, file, num_imgs)
            if gl.IMG_BORDER:
                border_fix(screen)
                img_border(screen, new_img.get_width(), new_img.get_height(), rect[0], rect[1])
    if event.type == MOUSEBUTTONDOWN:
        if event.dict['button'] == 4: # mouse wheel up
            if rect.top < 0:
                command_down(rect, last_rect, new_img, screen, file, num_imgs)
                if gl.IMG_BORDER:
                    border_fix(screen)
                    img_border(screen, new_img.get_width(), new_img.get_height(), rect[0], rect[1])
        if event.dict['button'] == 5: # mouse wheel down
            if rect.bottom > screen_height:
                command_up(rect, last_rect, new_img, screen, file, num_imgs, screen_height)
                if gl.IMG_BORDER:
                    border_fix(screen)
                    img_border(screen, new_img.get_width(), new_img.get_height(), rect[0], rect[1])