Beispiel #1
0
    def draw_background(self):
        self.parent.erase()
        me2terminal.paint_background(self.parent)
        self.parent.addstr(1, 2, "  %s님의 " % (self.cur_userid), 
            curses.A_REVERSE | curses.A_BOLD | curses.color_pair(4))
        self.parent.addstr("%s  " % self.scope_label,  
            curses.A_REVERSE | curses.A_BOLD | curses.color_pair(4))
        self.parent.addstr(1, self.post_window.getmaxyx()[1]-21, "%3d번째 글부터 표시" % (self.offset+1), curses.A_NORMAL)
        self.parent.refresh()

        self.loc_map = {}
        frame.show_posts(self)
Beispiel #2
0
def draw_login_window(parent):
    global login_window
    global logo_window

    if login_window:
        login_window.erase()
        login_window.refresh()
        del login_window
    if logo_window:
        logo_window.erase()
        logo_window.refresh()
        del logo_window

    parent.erase()
    me2terminal.paint_background(parent)
    parent.refresh()

    LINES = parent.getmaxyx()[0]
    COLS = parent.getmaxyx()[1]

    # logo window
    logo_y = (LINES-LOGO_H) / 2 - 4
    logo_window = curses.newwin(LOGO_H, LOGO_W, logo_y, (COLS-LOGO_W)/2)
    line = 1
    for logo_line in LOGO:
        logo_window.addstr(line, 1, logo_line)
        line += 1
    logo_window.refresh()

    # login window
    login_width, login_height = (42, 7)
    login_window = curses.newwin(
        login_height, login_width, 
        logo_y + LOGO_H + 1,
        (COLS-login_width)/2)
    login_window.border()
    login_window.addstr(1, 1, 
        expand_to(title, login_width-2), 
        curses.A_REVERSE | curses.A_BOLD)
    login_window.addstr(3, 4, label_id)
    login_window.addstr(' ' * (login_width-2-length(label_id)-8), curses.A_UNDERLINE)
    login_window.addstr(5, login_width-2-length("[Enter]"), "[Enter]")
    login_window.refresh()
Beispiel #3
0
def get_userid(parent):
    global logo_window
    global login_window

    draw_login_window(parent)

    user_id = _input(parent, login_window, 3, 4+length(label_id))
    # It's show time! Let's move both windows to the right corner.
    if len(user_id) > 2:
        ly, lx = logo_window.getbegyx()
        y, x = login_window.getbegyx()
        for i in range(1, 1): 
            newy = y+i*1
            newly = ly-i*1
            try:
                if newly <= 1: newly = 1
                logo_window.mvwin(newly, lx)
                if newy >= parent.getmaxyx()[0]-8: newy = parent.getmaxyx()[0]-8
                login_window.mvwin(newy, x)
            except:
                break

            me2terminal.paint_background(parent)
            parent.refresh()
            login_window.refresh()
            logo_window.refresh()

            time.sleep(0.09)
    else: 
        return ''

    logo_window.erase()
    login_window.erase()
    logo_window.refresh()
    login_window.refresh()

    me2terminal.paint_background(parent)
    parent.refresh()

    del logo_window
    del login_window

    return user_id