Example #1
0
def open_url(screen, img):
    gl.ISURL = 1
    num_imgs = len(gl.files)
    paint_screen(screen, gl.BLACK)
    set_caption("Extract from Web - imgv")
    normal_cursor()
    show_message(screen, "Enter a Web URL to extract images from", 20, 15, ("transparent"))
    gl.URL = ask(screen, "http://")
    if gl.URL != None:
        gl.files = []
        wait_cursor()
        show_message(screen, "Loading. Please wait..", 39, 42, ("transparent"))
        for ext in gl.IMG_TYPES:
            if gl.URL.endswith(ext):
                gl.files.append(str("".join(gl.URL)))
                return (load_img(gl.files[0], screen), 1)
    else:
        return (img, num_imgs)
    gl.files = []
    check_indexhtml()
    if gl.URL_ERROR:
        gl.files.append(gl.ERROR_IMG)
        return (load_img(gl.ERROR_IMG, screen), len(gl.files))
    if len(gl.files) < 1:
        gl.files.append(gl.ERROR_IMG)
    gl.files = [x.replace(" ", "%20") for x in gl.files]  # urls need %20 for spaces
    return (load_img(gl.files[0], screen), len(gl.files))
Example #2
0
File: edit.py Project: rkulla/imgv
def color_msg(screen, msg):
    paint_screen(gl.BLACK)
    show_message(msg, (15, 20), 13, ("bold", "transparent"))
    show_message("Valid colors: BLACK, WHITE, PURPLE, BLUE, IMGV_LOGO_BLUE, SKY_BLUE, SILVER, GREEN, LIGHT_GREEN,", (15, 50), 13, ("transparent"))
    show_message("SADDLE_BROWN, RED, ORANGE, YELLOW, DARK_SLATE_BLUE, DARK_SLATE_GRAY, MID_GRAY.", (15, 70), 13, ("transparent"))
    show_message("You can also specify coma separated RGB color values in the format: n,n,n (where n is a number from 0 to 255)", (15, 100), 13, ("transparent"))
    return ask(screen, "Color")
Example #3
0
def do_change_drive(screen, num_imgs, file):
    paint_screen(screen, gl.BLACK)
    my_string = ask(screen, "Enter a Drive Letter")
    if my_string != None:
        gl.ADDED_DIR_NUMS = 0
        gl.DRIVE = my_string[0]
    (num_imgs, file) = show_dirs(screen, num_imgs, file)
    return (num_imgs, file)
Example #4
0
def do_donot_contain(screen):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Enter the string that you do not want image names to contain.", (10, 25), 12, ("bold"))
    show_message(screen, 'Example: Type blue to view only images that do not contain the string'
                         ' "blue" (i.e., my_blue_car.jpg)', (10, 55), 12)
    show_message(screen, '(To input multiple strings separate them with commas)', (10, 75), 11)
    notcontain_str = ask(screen, "Do not contain")
    if notcontain_str != None:
        gl.FILTER_COMMAND["notcontain"] = notcontain_str
    command_get_filter_info(screen)
Example #5
0
def do_contain(screen):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Enter the string you want all image names to contain.", (10, 25), 12, ("bold"))
    show_message(screen, 'Example: Type red to view all images that contain the string'
                         ' "red" (i.e., my_red_car.jpg)', (10, 55), 12)
    show_message(screen, '(To input multiple strings separate them with commas)', (10, 75), 11)
    contain_str = ask(screen, "Contain")
    if contain_str != None:
        gl.FILTER_COMMAND["contain"] = contain_str
    command_get_filter_info(screen)
Example #6
0
def do_donot_startwith(screen):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Enter the string that you do not want image names to start with.", (10, 25), 12, ("bold"))
    show_message(screen, 'Example: Type blue to view all images that do not start with the string'
                         ' "blue"', (10, 55), 12)
    show_message(screen, '(To input multiple strings separate them with commas)', (10, 75), 11)
    notstartwith_str = ask(screen, "Do not start with")
    if notstartwith_str != None:
        gl.FILTER_COMMAND["notstartwith"] = notstartwith_str
    command_get_filter_info(screen)
Example #7
0
def do_startwith(screen):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Enter the string you want all image names to start with.", (10, 25), 12, ("bold"))
    show_message(screen, 'Example: Type red to view only images that start with the string'
                         ' "red" (i.e., red_car.jpg)', (10, 55), 12)
    show_message(screen, '(To input multiple strings separate them with commas)', (10, 75), 11)
    startwith_str = ask(screen, "Start with")
    if startwith_str != None:
        gl.FILTER_COMMAND["startwith"] = startwith_str
    command_get_filter_info(screen)
Example #8
0
def do_donot_endwith(screen):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Enter the string that you do not want image names to end with.", (10, 25), 12, ("bold"))
    show_message(screen, 'Example 1: Type .jpg to view all images that do not end with the string'
                         ' ".jpg" (i.e., car.jpg)', (10, 55), 12)
    show_message(screen, 'Example 2: To only load images that are not GIFs, input:  .gif', (10, 75), 12)
    show_message(screen, '(To input multiple strings separate them with commas)', (10, 95), 11)
    notendwith_str = ask(screen, "Do not end with")
    if notendwith_str != None:
        gl.FILTER_COMMAND["notendwith"] = notendwith_str
    command_get_filter_info(screen)
Example #9
0
def do_endwith(screen):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Enter the string you want all image names to end with.", (10, 25), 12, ("bold"))
    show_message(screen, 'Example 1: Type .jpg to view all images that end with the string'
                         ' ".jpg" (i.e., dog.jpg)', (10, 55), 12)
    show_message(screen, 'Example 2: To load only jpegs and bitmaps, input:  .jpg, .jpeg, .bmp', (10, 75), 12)
    show_message(screen, '(To input multiple strings separate them with commas)', (10, 95), 11)
    endwith_str = ask(screen, "End with")
    if endwith_str != None:
        gl.FILTER_COMMAND["endwith"] = endwith_str
    command_get_filter_info(screen)
Example #10
0
def do_custom(screen, new_img, file, num_imgs, rect):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Enter a custom window size/resolution. (Example:  455x500)", "top", 12, ("bold"))
    res = ask(screen, "New size")
    if res == None:
        return rect
    try:
        res = res.lower().split('x')
        res = int(res[0]), int(res[1])
        rect = command_custom_res(screen, new_img, file, num_imgs, rect, res)
    except:
       return rect
    return rect
Example #11
0
def Input():
    inflate_width_key = pygame.K_q
    deflate_width_key = pygame.K_a

    inflate_height_key = pygame.K_w
    deflate_height_key = pygame.K_s

    make_player_entry = pygame.K_p
    make_player_exit = pygame.K_e

    global player_entry
    global player_exit

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            global running
            running = False
            return
        if event.type == pygame.MOUSEBUTTONDOWN:
            if event.button == 1:
                Select_Box()
            elif event.button == 3:
                Place_Box()

        if event.type == pygame.KEYDOWN:
            if event.key == inflate_width_key:
                Change_Box_Size(True, "Width")
            elif event.key == deflate_width_key:
                Change_Box_Size(False, "Width")
            if event.key == inflate_height_key:
                Change_Box_Size(True, "Height")
            elif event.key == deflate_height_key:
                Change_Box_Size(False, "Height")
            elif event.key == make_player_entry:
                mouse_pos = pygame.mouse.get_pos()
                player_entry = pygame.Rect(my_round(mouse_pos[0]),
                                           my_round(mouse_pos[1]), 10, 10)
            elif event.key == make_player_exit:
                mouse_pos = pygame.mouse.get_pos()
                player_exit = pygame.Rect(my_round(mouse_pos[0]),
                                          my_round(mouse_pos[1]), 10, 10)

            if event.key == pygame.K_f:
                file_name = ask(screen, "Desired file name?")
                Serialise(file_name)
Example #12
0
def Input():
    inflate_width_key = pygame.K_q
    deflate_width_key = pygame.K_a

    inflate_height_key = pygame.K_w
    deflate_height_key = pygame.K_s

    make_player_entry = pygame.K_p
    make_player_exit = pygame.K_e

    global player_entry
    global player_exit

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            global running
            running = False
            return
        if event.type == pygame.MOUSEBUTTONDOWN:
            if event.button == 1:
                Select_Box()
            elif event.button == 3:
                Place_Box()

        if event.type == pygame.KEYDOWN:
            if event.key == inflate_width_key:
                Change_Box_Size(True, "Width")
            elif event.key == deflate_width_key:
                Change_Box_Size(False, "Width")
            if event.key == inflate_height_key:
                Change_Box_Size(True, "Height")
            elif event.key == deflate_height_key:
                Change_Box_Size(False, "Height")
            elif event.key == make_player_entry:
                mouse_pos = pygame.mouse.get_pos()
                player_entry = pygame.Rect(my_round(mouse_pos[0]), my_round(mouse_pos[1]), 10, 10)
            elif event.key == make_player_exit:
                mouse_pos = pygame.mouse.get_pos()
                player_exit = pygame.Rect(my_round(mouse_pos[0]), my_round(mouse_pos[1]), 10, 10)

            if event.key == pygame.K_f:
                file_name = ask(screen, "Desired file name?")
                Serialise(file_name)
Example #13
0
def hide(screen):
    paint_screen(screen, gl.BLACK)
    set_icon(pygame.image.load(gl.DATA_DIR + "imgv-icon-blank.png"))
    normal_cursor()
    while 1:
        event = pygame.event.poll()
        pygame.time.wait(150)
        check_quit(event)
        if event.type == KEYDOWN and event.key not in (K_LALT, K_RALT, K_LCTRL, K_RCTRL, K_TAB):
            if gl.CORRECT_PASSWORD.lower() not in ("none", None):
                pw = ask(screen, "Password")
                if pw == gl.CORRECT_PASSWORD:
                    break
                else:
                    show_message(screen, "Incorrect Password", (150), 24, ("bold", "transparent"))
                    show_message(screen, "Press any key to try again", (175), 12, ("bold", "transparent"))
                    f = open(gl.DATA_DIR + "security.log", "a")
                    f.write("Password failure: %s\n" % ctime())
                    f.close()
                    continue
            else:
                break
    set_icon(pygame.image.load(gl.DATA_DIR + "imgv-icon.png"))
Example #14
0
def command_file_master(screen, file_names, msg, down, button_op, disable_right_click, again):
    set_caption("Image Browser - imgv")
    screen_pause = place = marker = 0
    menu_items = []
    edit_rect = back_rect = forward_rect = sort_rect = junk_rect()
    (esc_rect, font) = close_button(screen)
    create_rect = imgv_button(screen, " Create New List ", 0, 18, "midtop")
    if len(file_names) < 1:
        my_string = ask(screen, "Create playlist first (Enter a name)")
        if my_string == None or my_string == []:
            return ([], [], [], []) # don't create a list
        if my_string != []: # create list
            if (len(my_string) > 0) and my_string != "\n":
                return (file_names, None, None, my_string)
    pygame.event.set_blocked(MOUSEMOTION)
    while 1:
        event = pygame.event.poll()
        pygame.time.wait(1)
        if screen_pause == 1:
            while 1:
                event = pygame.event.poll()
                pygame.time.wait(1)
                cursor = pygame.mouse.get_pos()
                hover_fx(screen, menu_items, cursor)
                hover_cursor(cursor, [esc_rect, edit_rect, sort_rect, back_rect, forward_rect, create_rect] + [x[0] for x in menu_items])
                if button_op:
                    hover_button(create_rect, cursor, screen, " Create New List ", 0, 18, "midtop")
                if (place + 1) < len(file_names):
                    hover_button(forward_rect, cursor, screen, " Next ", 10, 18, "topright")
                if (((place + 1) - gl.MAX_SCREEN_FILES) > 1):
                    hover_button(back_rect, cursor, screen, " Previous ", 10, 18, "topleft")
                if not gl.SORT_HIT:
                    hover_button(sort_rect, cursor, screen, " Sort ", 13, 42, "midtop")
                check_quit(event)
                if hit_key(event, K_ESCAPE):
                    return (None, None, None, None)
                if left_click(event):
                    if esc_rect.collidepoint(cursor):
                        return (None, None, None, None)
                if left_click(event):
                    for item in menu_items:
                        if item[0].collidepoint(cursor):
                            if pygame.mouse.get_pressed()[0] and (pygame.key.get_pressed()[K_LCTRL] or\
                               pygame.key.get_pressed()[K_RCTRL]):
                                return (file_names, item[1], "deleteit", None)
                            if again == "do again":
                                return (file_names, item[1], "do again", None)
                            return (file_names, item[1], menu_items, None)
                if right_click(event):
                    if not disable_right_click:
                        for item in menu_items:
                            if item[0].collidepoint(cursor):
                                if not os.path.isfile(gl.DATA_DIR + item[1]):
                                    if edit_rect != junk_rect():
                                        paint_screen(gl.BLACK)
                                    edit_rect = show_message(
                                    "%s doesn't exist in %s" % (item[1], gl.DATA_DIR), "top", 9, ("bold", "transparent"))
                                else:
                                    return (None, item[1], "rclicked", None)
                if hit_key(event, K_SPACE) or right_click(event):
                    if not place >= len(file_names):
                        screen_pause = 0
                        marker = 0
                        menu_items = []
                        break
                if left_click(event):
                    if forward_rect.collidepoint(cursor):
                        if not place >= len(file_names):
                            screen_pause = 0
                            marker = 0
                            menu_items = []
                            break
                if hit_key(event, K_BACKSPACE) or middle_click(event):
                    if ((place - marker) > 0):
                        paint_screen(gl.BLACK)
                        screen_pause = 0
                        place = place - (gl.MAX_SCREEN_FILES + marker)
                        marker = 0
                        menu_items = []
                        break
                if left_click(event):
                    if back_rect.collidepoint(cursor):
                        if ((place - marker) > 0):
                            paint_screen(gl.BLACK)
                            screen_pause = 0
                            place = place - (gl.MAX_SCREEN_FILES + marker)
                            marker = 0
                            menu_items = []
                            break
                if left_click(event):
                    if sort_rect.collidepoint(cursor):
                        gl.SORT_HIT = 1
                        file_names = basename_sort(file_names)
                        (file_names, menu_items, screen_pause, place, marker, forward_rect, back_rect, sort_rect) = file_master(screen, file_names, place, marker, menu_items, msg, down, button_op)
                        screen_pause = place = marker = 0
                        menu_items = []
                        break
                if left_click(event):
                    if create_rect.collidepoint(cursor):
                        my_string = ask(screen, "Enter name of list")
                        if my_string != None:
                            if (len(my_string) > 0) and my_string != "\n":
                                return (file_names, None, menu_items, my_string)
        (file_names, menu_items, screen_pause, place, marker, forward_rect, back_rect, sort_rect) =\
            file_master(screen, file_names, place, marker, menu_items, msg, down, button_op)
        pygame.time.delay(5)
Example #15
0
File: edit.py Project: rkulla/imgv
def preferences(screen):
    paint_screen(gl.BLACK)
    set_caption("imgv preferences")
    font_size = 12
    font = pygame.font.Font(gl.FONT_NAME, font_size)
    (esc_rect, font) = close_button(screen)
    pref_items = print_preferences(screen)

    (transparent_text_crect, transparent_text_ucrect, main_statusbar_crect, main_statusbar_ucrect, four_statusbars_crect, four_statusbars_ucrect, exif_statusbar_crect, exif_statusbar_ucrect, thumb_statusbars_crect, thumb_statusbars_ucrect, image_border_crect, image_border_ucrect, fit_image_rect, dirnum_colors_crect, dirnum_colors_ucrect, screen_bgcolor_rect, lock_zoom_crect, lock_zoom_ucrect, wrap_crect, wrap_ucrect, wrap_slideshow_crect, wrap_slideshow_ucrect, start_fullscreen_crect, start_fullscreen_ucrect, thumb_border_crect, thumb_border_ucrect, show_movies_crect, show_movies_ucrect, font_color_rect, font_bgcolor_rect, img_border_color_rect, thumb_border_color_rect, thumb_bgcolor_rect, four_divcolor_rect, button_bgcolor_rect, button_hover_color_rect, button_textcolor_rect, button_texthovercolor_rect, close_button_color_rect, gamma_rect, winsize_rect, thumbsize_rect, transeffect_rect, startdir_rect, external_editor_rect, fit_slideshow_rect, passwd_rect) = pref_options(screen)

    while 1:
        event = pygame.event.poll()
        pygame.time.wait(1)
        check_quit(event)
        cursor = pygame.mouse.get_pos()
        prefs_hover_fx(screen, pref_items, cursor, font)

        hover_cursor(cursor, [esc_rect, transparent_text_crect, transparent_text_ucrect, main_statusbar_crect, main_statusbar_ucrect, four_statusbars_crect, four_statusbars_ucrect, exif_statusbar_crect, exif_statusbar_ucrect, thumb_statusbars_crect, thumb_statusbars_ucrect, image_border_crect, image_border_ucrect, fit_image_rect, dirnum_colors_crect, dirnum_colors_ucrect, screen_bgcolor_rect, lock_zoom_crect, lock_zoom_ucrect, wrap_crect, wrap_ucrect, wrap_slideshow_crect, wrap_slideshow_ucrect, start_fullscreen_crect, start_fullscreen_ucrect, thumb_border_crect, thumb_border_ucrect, show_movies_crect, show_movies_ucrect, font_color_rect, font_bgcolor_rect, img_border_color_rect, thumb_border_color_rect, thumb_bgcolor_rect, four_divcolor_rect, button_bgcolor_rect, button_hover_color_rect, button_textcolor_rect, button_texthovercolor_rect, close_button_color_rect, gamma_rect, winsize_rect, thumbsize_rect, transeffect_rect, startdir_rect, external_editor_rect, fit_slideshow_rect, passwd_rect])

        if gl.NOT_HOVERED:
            show_message("%s%s" % (" " * 100, " " * 100), "bottom", 12, ("transparent"))
            prefs_blank_fx(screen, -1)
        if hit_key(event, K_ESCAPE):
            gl.ESCAPED = 1
            paint_screen(gl.BLACK)
            return
        if left_click(event):
            if esc_rect.collidepoint(cursor):
                gl.ESCAPED = 1
                paint_screen(gl.BLACK)
                return
            if transparent_text_ucrect.collidepoint(cursor):
                gl.TOGGLE_TRANSPARENT ^= 1
                write_cfg("TRANSPARENT_TEXT")
            if main_statusbar_ucrect.collidepoint(cursor):
                gl.TOGGLE_STATUS_BAR ^= 1
                write_cfg("MAIN_STATUS_BAR")
            if four_statusbars_ucrect.collidepoint(cursor):
                gl.FOUR_STATUS_BARS ^= 1
                write_cfg("FOUR_AT_A_TIME_STATUS_BARS")
            if exif_statusbar_ucrect.collidepoint(cursor):
                gl.ON_FLY_EXIF_STATUS_BAR ^= 1
                write_cfg("ON_THE_FLY_EXIF_STATUS_BAR")
            if thumb_statusbars_ucrect.collidepoint(cursor):
                gl.THUMB_STATUS_BARS ^= 1
                write_cfg("THUMBNAIL_STATUS_BARS")
            if image_border_ucrect.collidepoint(cursor):
                gl.IMG_BORDER ^= 1
                write_cfg("IMAGE_BORDER")
            if lock_zoom_ucrect.collidepoint(cursor):
                gl.PERSISTENT_ZOOM_VAL ^= 1
                write_cfg("PERSISTENT_ZOOM")
            if wrap_ucrect.collidepoint(cursor):
                gl.WRAP ^= 1
                write_cfg("WRAP")
            if wrap_slideshow_ucrect.collidepoint(cursor):
                gl.WRAP_SLIDESHOW ^= 1
                write_cfg("WRAP_SLIDESHOW")
            if start_fullscreen_ucrect.collidepoint(cursor):
                gl.START_FULLSCREEN ^= 1
                write_cfg("FULLSCREEN")
            if thumb_border_ucrect.collidepoint(cursor):
                gl.THUMB_BORDER_VAL ^= 1
                write_cfg("THUMB_BORDER")
            if show_movies_ucrect.collidepoint(cursor):
                gl.MOVIES_VAL ^= 1
                show_message("(You must restart imgv for this change to take effect)", (375, 204), 10, ("bold", "transparent"))
                write_cfg("MOVIES")
            if fit_image_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("Enter an option letter and press enter", (15, 20), 13, ("bold", "transparent"))
                show_message("A = Fit nothing.", (15, 60), 13, ("bold", "transparent"))
                show_message("B = Fit only large images to the window.", (15, 80), 13, ("bold", "transparent"))
                show_message("C = Fit all images to the window. (both in normal mode and Four-at-a-Time mode)", (15, 100), 13, ("bold", "transparent"))
                show_message("D = Fit the window to images.", (15, 120), 13, ("bold", "transparent"))
                answer = ask(screen, "Option")
                if answer != None and answer in ('a','A', 'b','B', 'c','C', 'd','D'):
                    dmap = {'a':0, 'b':1, 'c':2, 'd':3}
                    gl.FIT_IMAGE_VAL = dmap[answer.lower()]
                    write_cfg("FIT_IMAGE", str(gl.FIT_IMAGE_VAL))
                clean_prefs(screen)
            if fit_slideshow_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("Enter an option letter and press enter", (15, 20), 13, ("bold", "transparent"))
                show_message("A = Fit nothing.", (15, 60), 13, ("bold", "transparent"))
                show_message("B = Fit only large images to the window.", (15, 80), 13, ("bold", "transparent"))
                show_message("C = Fit all images to the window. (both in normal mode and Four-at-a-Time mode)", (15, 100), 13, ("bold", "transparent"))
                show_message("D = Fit the window to images.", (15, 120), 13, ("bold", "transparent"))
                answer = ask(screen, "Option")
                if answer != None and answer in ('a','A', 'b','B', 'c','C', 'd','D'):
                    dmap = {'a':0, 'b':1, 'c':2, 'd':3}
                    gl.FIT_IMAGE_SLIDESHOW_VAL = dmap[answer.lower()]
                    write_cfg("FIT_IMAGE_SLIDESHOW", str(gl.FIT_IMAGE_SLIDESHOW_VAL))
                clean_prefs(screen)
            if gamma_rect.collidepoint(cursor):
                new_gamma = do_gamma(screen)
                if new_gamma != None:
                    try:
                        set_gamma(float(new_gamma))
                    except:
                        print 'invalid gamma value: %s' % new_gamma
                clean_prefs(screen)
            if dirnum_colors_ucrect.collidepoint(cursor):
                gl.DIRNUM_COLORS ^= 1
                write_cfg("COLOR_DIRECTORY_NUMBERS")
            if screen_bgcolor_rect.collidepoint(cursor):
                answer = color_msg(screen, "Set this to the color you want the background in imgv to be. (Default is BLACK)")
                (gl.IMGV_COLOR, cfg_str) = color_change(answer, gl.IMGV_COLOR)
                color_clean(screen, "IMGV_COLOR", cfg_str)
            if font_color_rect.collidepoint(cursor):
                answer = color_msg(screen, "Set this to the font color you want. (Default is WHITE)")
                (gl.MSG_COLOR, cfg_str) = color_change(answer, gl.MSG_COLOR)
                gl.MENU_COLOR = gl.MSG_COLOR
                color_clean(screen, "FONT_COLOR", cfg_str)
            if font_bgcolor_rect.collidepoint(cursor):
                answer = color_msg(screen, "Font background color you want. (Default is BLACK)")
                (gl.FONT_BG, cfg_str) = color_change(answer, gl.FONT_BG)
                gl.MENU_COLOR = gl.MSG_COLOR
                color_clean(screen, "FONT_BGCOLOR", cfg_str)
            if img_border_color_rect.collidepoint(cursor):
                answer = color_msg(screen, "Set this to the color you want the image border to be when it's activated. (Default is LIGHT_GREEN)")
                (gl.IMG_BORDER_COLOR, cfg_str) = color_change(answer, gl.IMG_BORDER_COLOR)
                color_clean(screen, "IMAGE_BORDER_COLOR", cfg_str)
            if thumb_border_color_rect.collidepoint(cursor):
                answer = color_msg(screen, "Set this to the color you want the image divider to be in Four-at-a-Time mode. (Default is WHITE)")
                (gl.THUMB_BORDER_COLOR, cfg_str) = color_change(answer, gl.THUMB_BORDER_COLOR)
                color_clean(screen, "THUMB_BORDER_COLOR", cfg_str)
            if thumb_bgcolor_rect.collidepoint(cursor):
                answer = color_msg(screen, "Set this to the color you want the background of individual thumbnails to be. (Default is BLACK)")
                (gl.THUMB_BG_COLOR_VAL, cfg_str) = color_change(answer, gl.THUMB_BG_COLOR_VAL)
                color_clean(screen, "THUMB_BG_COLOR", cfg_str)
            if four_divcolor_rect.collidepoint(cursor):
                answer = color_msg(screen, "Set this to the color you want the image divider to be in Four-at-a-Time mode. (Default is WHITE)")
                (gl.FOUR_DIV_COLOR, cfg_str) = color_change(answer, gl.FOUR_DIV_COLOR)
                color_clean(screen, "FOUR_AT_A_TIME_DIVIDER_COLOR", cfg_str)
            if button_bgcolor_rect.collidepoint(cursor):
                answer = color_msg(screen, "Background color of buttons. (Default is IMGV_LOGO_BLUE)")
                (gl.BUTTON_BGCOLOR, cfg_str) = color_change(answer, gl.BUTTON_BGCOLOR)
                color_clean(screen, "BUTTON_BGCOLOR", cfg_str)
            if button_hover_color_rect.collidepoint(cursor):
                answer = color_msg(screen, "Color of buttons when your mouse cursor hovers over them. (Default is SKY_BLUE)")
                (gl.BUTTON_HOVERCOLOR, cfg_str) = color_change(answer, gl.BUTTON_HOVERCOLOR)
                color_clean(screen, "BUTTON_HOVERCOLOR", cfg_str)
            if button_textcolor_rect.collidepoint(cursor):
                answer = color_msg(screen, "Color of text on buttons. (Default is BLACK)")
                (gl.BUTTON_TEXTCOLOR, cfg_str) = color_change(answer, gl.BUTTON_TEXTCOLOR)
                color_clean(screen, "BUTTON_TEXTCOLOR", cfg_str)
            if button_texthovercolor_rect.collidepoint(cursor):
                answer = color_msg(screen, "Color of text on buttons when mouse cursor hovers over them. (Default is BLACK)")
                (gl.BUTTON_TEXTHOVERCOLOR, cfg_str) = color_change(answer, gl.BUTTON_TEXTHOVERCOLOR)
                color_clean(screen, "BUTTON_TEXTHOVERCOLOR", cfg_str)
            if close_button_color_rect.collidepoint(cursor):
                answer = color_msg(screen, "Color of the close/cancel buttons, the 'X' in the top/right corner of the screen. (Default is SADDLE_BROWN)")
                (gl.CLOSE_BUTTONCOLOR, cfg_str) = color_change(answer, gl.CLOSE_BUTTONCOLOR)
                color_clean(screen, "CLOSE_BUTTONCOLOR", cfg_str)
            if winsize_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("Default Window Size or resolution of imgv (in the format: width x height. Default is: 800x600)", (15, 80), 13, ("bold", "transparent"))
                answer = ask(screen, "New window size")
                if answer != None:
                    x = None
                    if answer.find('x') != -1:
                        x = 'x'
                    elif answer.find('X') != -1:
                        x = 'X'
                    if x != None:
                        gl.IMGV_RESOLUTION = int(answer.split(x)[0]), int(answer.split(x)[1])
                    write_cfg("IMGV_WINDOW_SIZE", answer)
                clean_prefs(screen)
            if thumbsize_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("The size you set will be used as the size of the thumbnail border/box, not the images themselves.", (15, 60), 13, ("bold", "transparent"))
                show_message("Values are in the format: width x height. Example: 100x100", (15, 100), 13, ("transparent"))
                show_message("To have imgv choose the best thumb size for a given default screen size use the default value of: AUTO", (15, 120), 13, ("transparent"))
                answer = ask(screen, "New thumbnail size")
                if answer != None:
                    gl.THUMB_VAL = answer
                    write_cfg("THUMB_SIZE", answer)
                clean_prefs(screen)
            if transeffect_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("Valid values: NONE (default), MELT, FADE_IN", (15, 60), 13, ("bold", "transparent"))
                show_message("You can also apply multiple effects by separating them with |'s such as: MELT|FADE_IN", (15, 90), 13, ("transparent"))
                answer = ask(screen, "Transitional effect")
                if answer != None:
                    gl.TRANS_FX = answer
                    write_cfg("TRANSITIONAL_EFFECT", answer)
                clean_prefs(screen)
            if startdir_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("Set this to an already existing directory that you want imgv to initially load images from.", (15, 60), 13, ("bold", "transparent"))
                if platform == 'win32':
                    show_message("For example: C:\photos\\", (15, 80), 13, ("transparent"))
                else:
                     show_message("For example: /home/photos/", (15, 80), 13, ("transparent"))
                show_message("Set to / (default) to have imgv load images from the root directory.", (15, 110), 13, ("transparent"))
                show_message("You an also specify a single image name.", (15, 150), 13, ("transparent"))
                show_message("For example: C:\pics\dog.jpg", (15, 170), 13, ("transparent"))
                answer = ask(screen, "Start directory")
                if answer != None:
                    gl.START_DIRECTORY_VAL = answer
                    write_cfg("START_DIRECTORY", answer)
                clean_prefs(screen)
            if external_editor_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("Path to an external image editing application (You must put quotes around the value)", (15, 60), 13, ("bold", "transparent"))
                show_message("For example, if you want to use Adobe Photoshop with imgv you might put:", (15, 80), 13, ("transparent"))
                show_message("\"C:\\Program Files\\Adobe\\Photoshop CS2\\Photoshop.exe\"", (15, 100), 13, ("transparent"))
                show_message("Set to \"None\" (default) if you don't need this feature.", (15, 130), 13, ("transparent"))
                answer = ask(screen, "External editor")
                if answer != None:
                    gl.EXTERNAL_EDITOR = answer
                    write_cfg("EXTERNAL_EDITOR", answer)
                clean_prefs(screen)
            if passwd_rect.collidepoint(cursor):
                paint_screen(gl.BLACK)
                show_message("Set this to the password you want to be used in the 'Hide Image' feature.", (15, 60), 13, ("bold", "transparent"))
                show_message("It's case sensitive and don't use quotes.", (15, 90), 13, ("transparent"))
                show_message("Set to None (default) if you don't want to be prompted for a password.", (15, 110), 13, ("transparent"))
                answer = ask(screen, "New password")
                if answer != None:
                    gl.CORRECT_PASSWORD = answer
                    write_cfg("PASSWORD", answer)
                clean_prefs(screen)
            (transparent_text_crect, transparent_text_ucrect, main_statusbar_crect, main_statusbar_ucrect, four_statusbars_crect, four_statusbars_ucrect, exif_statusbar_crect, exif_statusbar_ucrect, thumb_statusbars_crect, thumb_statusbars_ucrect, image_border_crect, image_border_ucrect, fit_image_rect, dirnum_colors_crect, dirnum_colors_ucrect, screen_bgcolor_rect, lock_zoom_crect, lock_zoom_ucrect, wrap_crect, wrap_ucrect, wrap_slideshow_crect, wrap_slideshow_ucrect, start_fullscreen_crect, start_fullscreen_ucrect, thumb_border_crect, thumb_border_ucrect, show_movies_crect, show_movies_ucrect, font_color_rect, font_bgcolor_rect, img_border_color_rect, thumb_border_color_rect, thumb_bgcolor_rect, four_divcolor_rect, button_bgcolor_rect, button_hover_color_rect, button_textcolor_rect, button_texthovercolor_rect, close_button_color_rect, gamma_rect, winsize_rect, thumbsize_rect, transeffect_rect, startdir_rect, external_editor_rect, fit_slideshow_rect, passwd_rect) = pref_options(screen)
        gl.NOT_HOVERED = 1
Example #16
0
File: edit.py Project: rkulla/imgv
def do_gamma(screen):
    paint_screen(gl.BLACK)
    show_message("Set the RGB gamma values on the display hardware while imgv is running.", 20, 13, ("bold"))
    show_message("Valid values are 0.3 to 4.4.  1.0 is the default. Higher than 1.0 = brighter. Lower than 1.0 = darker.", 40, 12)
    gl.CURRENT_GAMMA = new_gamma = ask(screen, "New gamma value")
    return new_gamma