Example #1
0
def command_full_up(rect, last_rect, new_img, screen, file, num_imgs, screen_height):
    "scroll image all the way upward to see the very bottom"
    gl.HAND_TOOL = 1
    if rect.bottom > screen_height:
        rect.bottom = screen_height
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect
Example #2
0
def command_full_right(rect, last_rect, new_img, screen, file, num_imgs):
    "scroll image to all the way to the right to see the very left side"
    gl.HAND_TOOL = 1
    if rect.left < 0:
        rect.left = 0
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect 
Example #3
0
def command_full_down(rect, last_rect, new_img, screen, file, num_imgs):
    "scroll image to all the way downward to see the very top"
    gl.HAND_TOOL = 1
    if rect.top < 0:
        rect.top = 0
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect
Example #4
0
def my_update_screen(new_img, rect, file):
    screen = get_surface()
    screen.fill(gl.IMGV_COLOR)
    screen.blit(new_img, rect)
    update()
    try:
        if gl.IMG_BORDER:
            img_border(new_img.get_width(), new_img.get_height(), rect)
        img_info(gl.files[file], file, new_img)
    except:
        pass
Example #5
0
File: pan.py Project: rkulla/imgv
def command_full_left(rect, last_rect, new_img, file):
    "scroll image to all the way to the left to see the very right side"
    screen = get_surface()
    screen_width = screen.get_width()
    gl.HAND_TOOL = 1
    if rect.right > screen_width:
        rect.right = screen_width
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(gl.files[file], file, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect
Example #6
0
def command_left(rect, last_rect, new_img, screen, file, num_imgs, screen_width):
    "scroll image to the left to see more of its right side"
    if (rect.right - screen_width <= gl.MOVE) and rect.right  > screen_width:
        rect.right = screen_width # snap
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    elif (rect.right - gl.MOVE) > screen_width:
        rect.right -= gl.MOVE
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect 
Example #7
0
def command_right(rect, last_rect, new_img, screen, file, num_imgs):
    "scroll image to the right to see more of its left side"
    if 0 - rect.left <= gl.MOVE:
        rect.left = 0 # snap
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    elif (rect.left + gl.MOVE) < 0:
        rect.left += gl.MOVE
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect 
Example #8
0
def command_down(rect, last_rect, new_img, screen, file, num_imgs):
    "scroll image to downward to see more of the top"
    gl.HAND_TOOL = 1
    if (0 - rect.top <= gl.MOVE):
        rect.top = 0
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    elif (rect.top + gl.MOVE) < 0:
        rect.top += gl.MOVE
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect
Example #9
0
def command_up(rect, last_rect, new_img, screen, file, num_imgs, screen_height):
    "scroll image upward to see more of the bottom"
    gl.HAND_TOOL = 1
    if (rect.bottom - screen_height <= gl.MOVE) and rect.bottom  > screen_height:
        rect.bottom = screen_height # snap
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    elif (rect.bottom - gl.MOVE) > screen_height:
        rect.bottom -= gl.MOVE
        screen.blit(new_img, rect)
        update(rect.union(last_rect))
        img_info(screen, gl.files[file], file, num_imgs, new_img, gl.NS_GLOBAL[0])
    drag_hand_cursor()
    return rect
Example #10
0
def my_update_screen(new_img, screen, rect, file, num_imgs, *ns):
    screen.fill(gl.IMGV_COLOR)
    screen.blit(new_img, rect)
    update()
#    rect = get_center(screen, new_img)
    if not ns:
        "ns wasn't passed, store last ns value in ns"
        ns = gl.NS_GLOBAL
    else:
        "ns was passed update gl.NS_GLOBAL"
        gl.NS_GLOBAL = ns
    try:
        if gl.IMG_BORDER:
            img_border(screen, new_img.get_width(), new_img.get_height(), rect[0], rect[1])
        img_info(screen, gl.files[file], file, num_imgs, new_img, ns[0])
    except:
        pass