예제 #1
0
파일: four.py 프로젝트: paulmadore/luckyde
def square_four(screen, file):
    wait_cursor()
    draw_lines(screen)
    num_imgs = len(gl.files)
    if file >= num_imgs or file <= 0:
        file = 0
    img_four_name = gl.files[file]
    img_four_file = file
    img_four = load_img(img_four_name, screen, 0)
    file = file + 1
    img_four = adjust_img_size(img_four, screen.get_width(), screen.get_height())
    img_four_rect = img_four.get_rect()
    img_four_rect[0] = (screen.get_width() / 2)
    img_four_rect[1] = (screen.get_height() / 2)
    screen.blit(img_four, img_four_rect)
    update(img_four_rect)
    draw_lines(screen)
    if gl.FOUR_STATUS_BARS:
        font_size = 9
        font = pygame.font.Font(gl.FONT_NAME, font_size)
        name = os.path.basename(img_four_name)
        name = check_truncate(screen.get_width(), name)
        img_status = "%s [%d/%d]" % (name, img_four_file + 1, num_imgs)
        raise_up = 12
        show_message(screen, img_status, ((screen.get_width() / 2) + (screen.get_width() / 4 - font.size(img_status)[0]/2), screen.get_height() - raise_up), font_size, ("bold"))
    normal_cursor()
    return (file, img_four_rect, img_four_name, img_four_file)
예제 #2
0
파일: res.py 프로젝트: rkulla/imgv
def index_fx(screen, it, font, msg):
    gl.NOT_HOVERED = 0
    fxpos = (it[0][0] - 10, it[0][1] + (font.size(it[1])[1] / 2) - 13,
             it[0][2], it[0][3])
    show_message(".", fxpos, 16, ("bold"))
    show_message("%s%s%s" % (" " * 20, msg, " " * 20), "bottom", 12)
    return fxpos
예제 #3
0
def view_filter(screen):
    paint_screen(screen, gl.BLACK)
    show_message(screen, "Current filter", "top", 20, ("underline", "bold"))
    show_message(screen, "Imgv will only display files whose filenames:", (5, 30), 15, ("bold"))
    line = 60
    for k in gl.FILTER_COMMAND.keys():
        font = pygame.font.Font(gl.FONT_NAME, 12)
        if k == "startwith":
            ren = font.render("Start with: %s" % gl.FILTER_COMMAND["startwith"], 1, (255, 255, 255), (0, 0, 0))
        if k == "notstartwith":
            ren = font.render("Do not start with:  %s" % gl.FILTER_COMMAND["notstartwith"], 1, (255, 255, 255), (0, 0, 0))
        if k == "endwith":
            ren = font.render("End with:  %s" % gl.FILTER_COMMAND["endwith"], 1, (255, 255, 255), (0, 0, 0))
        if k == "notendwith":
            ren = font.render("Do not end with:  %s" % gl.FILTER_COMMAND["notendwith"], 1, (255, 255, 255), (0, 0, 0))
        if k == "contain":
            ren = font.render("Contain:  %s" % gl.FILTER_COMMAND["contain"], 1, (255, 255, 255), (0, 0, 0))
        if k == "notcontain":
            ren = font.render("Do not contain:  %s" % gl.FILTER_COMMAND["notcontain"], 1, (255, 255, 255), (0, 0, 0))
        ren_rect = ren.get_rect()
        ren_rect[0] = 5
        ren_rect[1] = line
        screen.blit(ren, ren_rect)
        line = line + 30
        update(ren_rect)
    while 1:
        ev = pygame.event.wait()
        check_quit(ev)
        if ev.type == KEYDOWN or ev.type == MOUSEBUTTONDOWN:
            return
예제 #4
0
def save_remote_img(screen, file):
    save_path = gl.DATA_DIR + "downloads" + sep
    filename = gl.files[file]
    paint_screen(screen, gl.BLACK)
    try:
        im = Image.open(gl.REMOTE_IMG_DATA)

        show_message(screen, "Saving: %s" % basename(gl.files[file]), (20, 50), 12, ("bold"))
        show_message(screen, "From: %s" % filename[:filename.rindex('/')] + '/', (20, 70), 12, ("bold"))
        show_message(screen, "To: %s" % save_path, (20, 90), 12, ("bold"))

        im.save(save_path + basename(filename))

        show_message(screen, "Done", (20, 120), 12, ("bold", "underline"))
        show_message(screen, "[Press any key]", "bottom", 15)
        gl.ALREADY_DOWNLOADED = 1
        normal_cursor()
    except:
        return
    
    while 1:
        event = pygame.event.wait()
        check_quit(event)
        #if event.type == KEYDOWN or event.type == MOUSEBUTTONDOWN:
        if event.type == KEYDOWN and event.key not in (K_LALT, K_RALT):
            return
예제 #5
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))
예제 #6
0
 def histogram(self):
     if not self.pil_info:
         return
     w = self.screen.get_width()
     h = gl.ROW_SEP + 415
     hist = self.im.histogram()
     redlist = hist[0:255]
     greenlist = hist[256:(256 + 255)]
     bluelist = hist[(256 + 255 + 1):]
     wdiv = 1.3 # shorten the width of the histogram
     vdiv = max(hist) / 130 # shorten the height of the histogram
     wpos = 16
     vlen = 175
     if self.pixel_format == "Grayscale":
         for i, v in enumerate(hist):
             if v > vlen: v -= vlen # don't go outside of border on long histograms
             pygame.draw.line(self.screen, gl.SILVER, ((i / wdiv) + wpos, h), ((i / wdiv) + wpos, (h - (v / vdiv))), 1)
     else:
         for i, v in enumerate(redlist):
             if v > vlen: v -= vlen
             pygame.draw.line(self.screen, gl.RED, ((i / wdiv) + wpos, h), ((i / wdiv) + wpos, (h - (v / vdiv))), 1)
         for i, v in enumerate(greenlist):
             if v > vlen: v -= vlen
             pygame.draw.line(self.screen, gl.GREEN, ((i / wdiv) + wpos, h), ((i / wdiv) + wpos, (h - (v / vdiv))), 1)
         for i, v in enumerate(bluelist):
             if v > vlen: v -= vlen
             pygame.draw.line(self.screen, gl.BLUE, ((i / wdiv) + wpos, h), ((i / wdiv) + wpos, (h - (v / vdiv))), 1)
     show_message(self.screen, "Histogram", (wpos + 1, h - 174), 11, ("transparent"))
     pygame.draw.line(self.screen, gl.MSG_COLOR, (wpos - 2, h + 2), (wpos - 2, h - vlen)) # left side of border
     pygame.draw.line(self.screen, gl.MSG_COLOR, ((i / wdiv) + wpos, h - vlen), ((i / wdiv) + wpos, h + 2)) # right side
     pygame.draw.line(self.screen, gl.MSG_COLOR, (wpos - 2, h - vlen), ((i / wdiv) + wpos, h - vlen)) # top 
     pygame.draw.line(self.screen, gl.MSG_COLOR, (wpos - 2, h + 2), ((i / wdiv) + wpos, h + 2)) # bottom 
예제 #7
0
def do_view_tagged(screen, num_imgs, file):
    "show all tagged dir names"
    paint_screen(screen, gl.BLACK)
    (esc_rect, close_font) = close_button(screen)
    line = 5
    if len(gl.MULT_DIRS) == 0:
        show_message(screen, "[No directories are currently tagged]", "bottom", 12)
    for d in gl.MULT_DIRS:
        font = pygame.font.Font(gl.FONT_NAME, 9)
        ren = font.render(d, 1, (255, 255, 255), (0, 0, 0))
        ren_rect = ren.get_rect()
        ren_rect[0] = 5
        ren_rect[1] = line
        screen.blit(ren, ren_rect)
        line = line + 12
        update(ren_rect)
    pygame.event.set_allowed(MOUSEMOTION)
    while 1:
        ev = pygame.event.wait()
        check_quit(ev)
        hover_cursor(pygame.mouse.get_pos(), (esc_rect,))
        if ev.type == KEYDOWN and ev.key not in (K_LALT, K_RALT, K_TAB, K_LCTRL, K_RCTRL) or ev.type == MOUSEBUTTONDOWN:
            gl.ADDED_DIR_NUMS = 0
            (num_imgs, file) = show_dirs(screen, num_imgs, file)
            break # break event loop
예제 #8
0
def get_confirmation(screen, confirm_msg):
    paint_screen(screen, gl.IMGV_COLOR)
    pygame.display.update()
    normal_cursor()
    show_message(screen, confirm_msg, "top", 12, ("bold"))
    yes_rect = imgv_button(screen, " YES ", 0, 30, "midtop")
    no_rect = imgv_button(screen, " NO ", 0, 60, "midtop")
    pygame.event.set_blocked(MOUSEMOTION)
    while 1:
        event = pygame.event.poll()
        pygame.time.wait(1)
        cursor = pygame.mouse.get_pos()
        hover_button(yes_rect, cursor, screen, " YES ", 0, 30, "midtop")
        hover_button(no_rect, cursor, screen, " NO ", 0, 60, "midtop")
        hover_cursor(cursor, (yes_rect, no_rect))
        check_quit(event)
        if hit_key(event, K_ESCAPE):
            return 
        if hit_key(event, K_y):
            return "yes"
        if hit_key(event, K_n):
            return "no"
        if event.type == MOUSEBUTTONDOWN and pygame.mouse.get_pressed()[0]:
            if yes_rect.collidepoint(cursor):
                return "yes"
            if no_rect.collidepoint(cursor):
                return "no"
예제 #9
0
파일: error_screen.py 프로젝트: rkulla/imgv
def error_screen(screen, msg):
   paint_screen(gl.BLACK)
   while 1:
        event = pygame.event.wait()
        show_message(msg, "top", 12)
        check_quit(event)
        if (event.type == KEYDOWN and event.key not in (K_LALT, K_RALT, K_LCTRL, K_RCTRL)) or event.type == MOUSEBUTTONDOWN:
            return
예제 #10
0
def verbose_info(screen, new_img, file, num_imgs):
    # main engine
    wait_cursor()
    paint_screen(screen, gl.BLACK)
    try:
        (uniquecolors_rect, total_colors, row, font, im, verb) = print_verbose_info(screen, new_img, file, num_imgs)
    except:
        print 'print verbose'
        #(uniquecolors_rect, total_colors, row, font, im, verb) = junk_rect()#
       # uniquecolors_rect = junk_rect()#
       # total_colors = ""#
        verb = verbose(screen, file)#
        (uniquecolors_rect, total_colors, row, font, im) = verb.colors()
        #return
    if gl.SHOW_EXIFBUTTON:
        exif_rect = imgv_button(screen, " Exif Data ", 5, gl.ROW_SEP + 435, None)
    (esc_rect, close_font) = close_button(screen)
    normal_cursor()
    transparency = 0
    while 1:
        event = pygame.event.poll()
        pygame.time.wait(1)
        check_quit(event)
        cursor = pygame.mouse.get_pos()
        hover_cursor(cursor, (esc_rect, exif_rect, uniquecolors_rect))
        if gl.SHOW_EXIFBUTTON:
            hover_button(exif_rect, cursor, screen, " Exif Data ", 5, gl.ROW_SEP + 435, None)
        if gl.UNIQUE_COLORS == None and gl.SHOW_EXIFBUTTON and total_colors != "":
            hover_button(uniquecolors_rect, cursor, screen, " Unique colors ", (font.size(total_colors)[0] + 230), row, None)

        show_message(screen, convert_times(ctime(), 0), "bottom", 15, ("transparent"))

        if event.type == MOUSEBUTTONDOWN and pygame.mouse.get_pressed()[0]:
            if uniquecolors_rect != junk_rect():
                if uniquecolors_rect.collidepoint(cursor):
                    wait_cursor()
                    gl.UNIQUE_COLORS = comma_it(len(dict.fromkeys(im.getdata()))) # determine unique colors
                    before_color = gl.MSG_COLOR
                    if gl.MSG_COLOR == gl.SILVER:
                        gl.MSG_COLOR = (142, 142, 142)
                    else:
                        gl.MSG_COLOR = gl.SILVER
                    show_message(screen,  "Unique colors: %s%s" % (gl.UNIQUE_COLORS, ' ' * 12), ((font.size(total_colors)[0] + 235), row), 12, (""), (14, before_color))
                    gl.MSG_COLOR = before_color
                    normal_cursor()
            if exif_rect.collidepoint(cursor):
                wait_cursor()
                try:
                    verb.exif_data(file)
                except:
                    break
                normal_cursor()
            if esc_rect.collidepoint(cursor):
                before_exit()
                break
        if event.type == KEYDOWN and event.key not in (K_LALT, K_RALT, K_LCTRL, K_RCTRL, K_TAB):
            before_exit()
            break
예제 #11
0
파일: verbose.py 프로젝트: rkulla/imgv
 def system_info(self):
     info = pygame.display.Info()
     self.row += gl.ROW_SEP * 2
     show_message("Display Properties", self.row, self.font_size, ("bold", "underline", "transparent"))
     self.row += gl.ROW_SEP
     self.print_info("Using video driver: %s" % pygame.display.get_driver(), 20)
     self.print_info("Video mode is accelerated: %s" % ("No", "Yes")[info.hw], 27)
     self.print_info("Display depth (Bits Per Pixel): %d" % info.bitsize, 31)
     self.print_info("Screen size of imgv: %s" % gl.ORIG_WINSIZE, 21)
예제 #12
0
파일: verbose.py 프로젝트: rkulla/imgv
def remote_img_details(screen, new_img, rect, file):
    # show no details if image is on a web server
    paint_screen(gl.BLACK)
    while 1:
        event = pygame.event.wait()
        show_message(gl.REMOTE_IMG, (0, 30, 0, 0), 12)
        check_quit(event)
        if event.type == KEYDOWN or event.type == MOUSEBUTTONDOWN:
            return
예제 #13
0
파일: playlist.py 프로젝트: rkulla/imgv
def play_list_options_msg(screen, msg):
    paint_screen(gl.BLACK)
    show_message(msg, 100, 10)
    normal_cursor()
    while 1:
        event = pygame.event.wait()
        check_quit(event)
        if event.type == KEYDOWN or event.type == MOUSEBUTTONDOWN:
            wait_cursor()
            break
예제 #14
0
파일: file_master.py 프로젝트: rkulla/imgv
def file_master(screen, file_names, place, marker, menu_items, msg, down, button_op):
    paint_screen(gl.BLACK)
    show_message(msg, down, 10, ("bold", "transparent"))
    font = pygame.font.Font(gl.FONT_NAME, 9)
    font.set_bold(1)
    (esc_rect, esc_font) = close_button(screen)
    font_height = font.size(file_names[0])[1]
    screen_height = screen.get_height()
    name_max = 16
    max_file_width = 116
    line = 65 # leave room at top of screen for other stuff
    col = 5
    count = 0
    back_rect = forward_rect = sort_rect = junk_rect()
    for name in file_names[place:]:
        count = count + 1
        place = place + 1
        marker = marker + 1
        if count >= gl.MAX_SCREEN_FILES or place >= len(file_names):
            ren_name = os.path.basename(name)
            if len(ren_name) > name_max:
                ren_name = ren_name[:name_max] + '...' # truncate
                if ren_name[-4:] == '....':
                    ren_name = ren_name[:-1] # 3 .'s are enough
            ren = font.render(ren_name, 1, gl.MSG_COLOR, gl.BLACK)
            if (place + 1) < len(file_names):
                forward_rect = imgv_button(screen, " Next ", 10, 18, "topright")
            if (((place + 1) - gl.MAX_SCREEN_FILES) > 1):
                back_rect = imgv_button(screen, " Previous ", 10, 18, "topleft")
            if not gl.SORT_HIT:
                sort_rect = imgv_button(screen, " Sort ", 13, 42, "midtop")
            ren_rect = ren.get_rect()
            ren_rect[0] = col
            ren_rect[1] = line
            menu_items.append((ren_rect, name))
            screen.blit(ren, ren_rect)
            update(ren_rect)
            return (file_names, menu_items, 1, place, marker, forward_rect, back_rect, sort_rect)
        ren_name = os.path.basename(name)
        if len(ren_name) > name_max:
            ren_name = ren_name[:name_max] + '...'
            if ren_name[-4:] == '....':
                ren_name = ren_name[:-1]
        ren = font.render(ren_name, 1, gl.MSG_COLOR, gl.BLACK)
        ren_rect = ren.get_rect()
        ren_rect[0] = col
        ren_rect[1] = line
        menu_items.append((ren_rect, name))
        screen.blit(ren, ren_rect)
        line = line + 12
        if (line + font_height) >= (screen_height - 15):
            line = 65
            col = col + max_file_width
        update(ren_rect)
    return (file_names, menu_items, 0, place, marker, forward_rect, back_rect, sort_rect)
예제 #15
0
파일: verbose.py 프로젝트: rkulla/imgv
 def print_info(self, msg, emphasize_length):
     if msg == " ":
         return
     self.row += gl.ROW_SEP
     before_color = gl.MSG_COLOR
     if gl.MSG_COLOR == gl.SILVER:
         gl.MSG_COLOR = (142, 142, 142)
     else:
         gl.MSG_COLOR = gl.SILVER
     show_message(msg, (self.start_width, self.row), self.font_size, (""), (emphasize_length, before_color))
     gl.MSG_COLOR = before_color
예제 #16
0
파일: verbose.py 프로젝트: rkulla/imgv
 def exif_data(self, filen):
     paint_screen(gl.BLACK)
     close_button(self.screen)
     if not self.show_exif:
         gl.SHOW_EXIFBUTTON = 0
         return
     exif_info = []
     filename = gl.files[filen]
     try:
         file = open(filename, "rb")
     except:
         exif_info.append("%s unreadable" % filename)
         gl.SHOW_EXIFBUTTON = 0
         return
     data = exif.process_file(file)
     if not data:
         font_size = 13
         font = pygame.font.Font(gl.FONT_NAME, font_size)
         no_exif_msg = "No Exif information found"
         show_message(
             no_exif_msg,
             ((self.screen.get_width() / 2) - (font.size(no_exif_msg)[0] / 2), self.screen.get_height() / 2),
             font_size,
             ("bold", "transparent"),
         )
         gl.SHOW_EXIFBUTTON = 0
         return
     x = data.keys()
     x.sort()
     for i in x:
         if i in ("JPEGThumbnail", "TIFFThumbnail"):
             continue
         try:
             exif_info.append("%s:  %s" % (i, data[i].printable))
         except:
             exif_info.append("error", i, '"', data[i], '"')
     gl.SHOW_EXIFBUTTON = 0
     pos = 25
     show_message("Exif Information", "top", 13, ("underline", "bold", "transparent"))
     try:
         for line in exif_info:
             if type(line) is StringType and len(line) <= 250:  # parachutes on long lines without this
                 exif_font = pygame.font.Font(gl.FONT_NAME, 9)
                 ren = exif_font.render(line, 1, gl.MENU_COLOR)
                 ren_rect = ren.get_rect()
                 ren_rect[0] = 14
                 ren_rect[1] = pos
                 self.screen.blit(ren, ren_rect)
                 pos = pos + 9
     except:
         print "Couldn't exif"
         # pass
     flip()
예제 #17
0
파일: res.py 프로젝트: paulmadore/luckyde
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
예제 #18
0
def ask(screen, question, hist_list=[''], count=0):
    current_string = []
    (esc_rect, font) = close_button(screen)
    if question in ("Password", "New password"):
        paint_screen(screen, gl.BLACK, esc_rect) # Erase the close button, no need for it 
    if gl.ISURL:
        display_box(screen, "%s%s_" % (question, "".join(current_string)))
    else:
        display_box(screen, "%s: %s_" % (question, "".join(current_string)))
    while 1:
        (inkey, value) = get_key(esc_rect)
        if inkey == K_BACKSPACE:
            if len(current_string) == 1:
                # allows backspacing to work on the "readline" strings
                current_string = list(current_string[0])
            current_string = current_string[0:-1]
        elif inkey == K_RETURN:
            gl.SKIP = 0 # reset to render message properly
            show_message(screen, ' ' * 40, "bottom", 12) # erase message
            break
        elif inkey == K_ESCAPE:
            gl.ISURL = 0
            if gl.WAS_IN_CHANGE_DRIVES:
                gl.ADDED_DIR_NUMS = 0
            paint_screen(screen, gl.BLACK, Rect(0, 255, screen.get_width(), 100)) # erase box from screen
            show_message(screen, ' ' * 40, "bottom", 12) # erase message
            return None
        elif inkey == K_UP:
            if count < len(hist_list):
                current_string = current_string[1:]
                current_string.insert(0, hist_list[-count - 1])
                count = count + 1
        elif inkey == K_DOWN:
            if count > 0:
                count = count - 1
                current_string = current_string[1:]
                current_string.insert(0, hist_list[-count])
        elif inkey <= 127:
            current_string.append(value)
        if gl.ISURL:
            display_box(screen, "%s%s_" % (question, "".join(current_string)))
        else:
            display_box(screen, "%s: %s_" % (question, "".join(current_string)))

    current_string = "".join(current_string)
    hist_list.append(current_string)
    if gl.ISURL:
        gl.ISURL = 0
        return "%s%s" % ("http://", current_string)
    else:
        return current_string
예제 #19
0
파일: edit.py 프로젝트: 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")
예제 #20
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)
예제 #21
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)
예제 #22
0
def pause(screen):
    while 1:
        set_caption("[Slideshow Paused] - imgv")
        ren_rect = show_message(screen, "Paused", 30, 23, ("bold"))
        event = pygame.event.wait()
        check_quit(event)
        if event.type == KEYDOWN and event.key not in(K_LALT, K_RALT, K_LCTRL, K_RCTRL, K_TAB):
            set_caption("Slideshow = imgv")
            paint_screen(screen, gl.BLACK, ren_rect)
            break
예제 #23
0
파일: verbose.py 프로젝트: rkulla/imgv
 def __init__(self, screen, file):
     if screen.get_width() == 640:
         self.font_size = 10
     else:
         self.font_size = 12
     self.font = pygame.font.Font(gl.FONT_NAME, self.font_size)
     gl.ROW_SEP = self.font.get_linesize()  # recommended line separation size
     self.start_width = 230
     self.show_exif = 1
     self.row = 11
     show_message("Image Properties", self.row, self.font_size, ("bold", "underline", "transparent"))
     self.row += gl.ROW_SEP
     self.prev_pic_row = self.row + gl.ROW_SEP + 5
     self.screen = screen
     self.pil_info = 1
     self.bitsperpixel = None
     try:
         self.im = Image.open(gl.files[file])
     except:
         self.pil_info = 0
         self.show_exif = 0
예제 #24
0
파일: error_box.py 프로젝트: rkulla/imgv
def errorbox(title, msg):
    "display a pygame error box"
    clean_screen()
    init_screen()
    screen = set_mode((450, 150))
    normal_cursor()
    set_caption(title)
    show_message(msg, (10, 10), 12, ("bold"))
    ok_rect = imgv_button(screen, " OK ", 20, screen.get_height() - 40, "midtop")
    while 1:
        event = wait()
        cursor = get_pos()
        check_quit(event)
        hover_button(ok_rect, cursor, screen, " OK ", 20, screen.get_height() - 40, "midtop")
        hover_cursor(cursor, [ok_rect])
        if left_click(event):
            if ok_rect.collidepoint(cursor):
                clean_screen()
                raise SystemExit
        if hit_key(event, K_SPACE):
            clean_screen()
            raise SystemExit
예제 #25
0
파일: hide.py 프로젝트: paulmadore/luckyde
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"))
예제 #26
0
파일: imgv.py 프로젝트: rkulla/imgv
 def __init__(self):
     init_screen()
     wait_cursor()
     self.gfx = {}
     self.gfx['screen'] = pygame.display.set_mode(gl.DEFAULT_RES, RESIZABLE)
     set_caption(gl.TITLE)
     if gl.REMOTE == 1:
         show_message("Loading image. Please wait..", 34, 42)
     self.gfx['file'] = 0
     if len(gl.files) < 1:
         gl.files = [gl.IMGV_LOGO]
     self.gfx['img'] = load_img(gl.files[self.gfx['file']])
     wait_cursor()
     self.gfx['refresh_img'] = self.gfx['img']
     self.gfx['new_img'] = self.gfx['img']
     self.gfx['rect'] = get_center(self.gfx['screen'], self.gfx['new_img'])
     my_update_screen(self.gfx['new_img'], self.gfx['rect'], self.gfx['file'])
     normal_cursor()
     if gl.START_FULLSCREEN:
         command_fullscreen()
         my_update_screen(self.gfx['new_img'], self.gfx['rect'], self.gfx['file'])
     self.minus1 = 0
     self.minus2 = 0
     self.last_rect = Rect(self.gfx['rect'])
예제 #27
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)
예제 #28
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)
예제 #29
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)
예제 #30
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)
예제 #31
0
    msg1 = dt1 + " " + time1 + " " + script.upper() + " Total Cost is: " + str(round(totalcost,2))  + \
           " Loss Limit:" + str(loss) + " Profit Limit:" + str(profit) + "\n"
    msg2= "Current CALL Premium :"+ str(celtp) + " PUT Premium :" + str(peltp) + " Total LTP: " \
           + str(round(totalltp,2))
    if abs(totalcost - totalltp) >= loss:
        print("Reached loss limit of ", loss)
        type1 = "L"
        msg3 = "!! LOSS !! Difference between Total Cost & Total LTP is: " + str(
            round(abs(totalcost - totalltp), 2)) + "\n"
    elif abs(totalltp - totalcost) >= profit:
        print("Reached max profit limit", profit)
        type1 = "P"
        msg3 = "** PROFIT ** Difference between Total Cost & Total LTP is: " + str(
            round(abs(totalltp - totalcost), 2)) + "\n"
    else:
        type1 = "N"
        msg3 = "No PROFIT or Loss ** Difference between Total Cost & Total LTP is: " + str(
            round(abs(totalcost - totalltp), 2)) + "\n"

    show_message(type1, msg1, msg2, msg3)
    update_excels(script, dt2, time1, totalcost, celtp, peltp, msg3)

append_excels(script, dt2, time1, totalcost, celtp, peltp)
#
format_excels_cepe()
dttime.sleep(3)
df_to_html()
print("Program Finished ...")

#format_masters()