Exemple #1
0
def print_menu(menu_win, highlight):
    x = 2
    y = 2
    uni.box(menu_win, 0, 0)
    for i in range(0, n_choices):
        if (highlight == i + 1):
            uni.wattron(menu_win, uni.A_REVERSE)
            uni.mvwaddstr(menu_win, y, x, choices[i])
            uni.wattroff(menu_win, uni.A_REVERSE)
        else:
            uni.mvwaddstr(menu_win, y, x, choices[i])
        y += 1
    uni.wrefresh(menu_win)
Exemple #2
0
def print_in_middle(win, starty, startx, width, string, color):
    if (win == None): win = stdscr
    y, x = uni.getyx(win)
    if (startx != 0): x = startx
    if (starty != 0): y = starty
    if (width == 0): width = 80
    length = len(string)
    temp = (width - length) / 2
    x = startx + int(temp)
    uni.wattron(win, color)
    uni.mvwaddstr(win, y, x, string)
    uni.wattroff(win, color)
    uni.refresh()
Exemple #3
0
    def draw_boardareaarea(self):
        uc.werase(self.win_board)

        uc.box(self.win_boardarea, 0, 0)

        uc.wmove(self.win_boardarea, 1, 2)
        if self.on_menu:
            s = self.player.board.__str__()
        else:
            s = self.player.board.show_new_ship(self.new_ship_x,
                                                self.new_ship_y,
                                                self.menu[self.menu_hi].id,
                                                self.menu[self.menu_hi].length,
                                                self.new_ship_hor)

        for chr in s:
            if chr == '~':
                uc.wattron(self.win_board, uc.COLOR_PAIR(11))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(11))
            elif chr == 'O':
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))
            elif chr == '#':
                uc.wattron(self.win_board, uc.COLOR_PAIR(13))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(13))
            else:
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))

        uc.wrefresh(self.win_boardarea)
        uc.update_panels()
Exemple #4
0
	def draw_board(self):
		uc.wclear(self.win_board1)
		uc.wclear(self.win_baord2)

		uc.box(self.win_boardarea, 0, 0)

		uc.wmove(self.win_boardarea, 1, 2)

		s1 = self.player.board.__str__()
		s2 = self.player_enemy.board.__str__()

		for chr in s1:
			if chr == '~':
				uc.wattron(self.win_board, uc.COLOR_PAIR(11))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(11))
			elif chr == 'O':
				uc.wattron(self.win_board, uc.COLOR_PAIR(12))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(12))
			elif chr == '#':
				uc.wattron(self.win_board, uc.COLOR_PAIR(13))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(13))
			else:
				uc.wattron(self.win_board, uc.COLOR_PAIR(12))
				uc.waddstr(self.win_board, chr)
				uc.wattroff(self.win_board, uc.COLOR_PAIR(12))

		uc.wrefresh(self.win_boardarea)
		uc.update_panels()
Exemple #5
0
 def refresh(self):
     if self.enabled:
         x = 2
         y = 2
         box(self.game_stat_window, 0, 0)
         mvwaddstr(self.game_stat_window, y, x, " " * 127)
         if self.game_interface.game_initialized:
             for param in self.game_interface.game.player.strings_info:
                 wattron(self.game_stat_window, A_REVERSE)
                 mvwaddstr(self.game_stat_window, y, x, param, RED_WHITE)
                 wattroff(self.game_stat_window, A_REVERSE)
                 x += 5 + len(param)
         wrefresh(self.game_stat_window)
         update_panels()
         doupdate()
Exemple #6
0
 def refresh(self):
     if self.enabled:
         x = 2
         y = 2
         box(self.game_stat_window, 0, 0)
         mvwaddstr(self.game_stat_window, y, x, " " * 127)
         if self.game_interface.game_initialized:
             for param in self.game_interface.game.player.strings_info:
                 wattron(self.game_stat_window, A_REVERSE)
                 mvwaddstr(self.game_stat_window, y, x, param, RED_WHITE)
                 wattroff(self.game_stat_window, A_REVERSE)
                 x += 5 + len(param)
         wrefresh(self.game_stat_window)
         update_panels()
         doupdate()
Exemple #7
0
 def _refresh(self):
     x = 2
     y = 2
     box(self.menu_window, 0, 0)
     for i in range(0, len(self.topics)):
         if self.topics_pointer == i:
             wattron(self.menu_window, A_REVERSE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_REVERSE)
         elif i in self.locked_topics:
             wattron(self.menu_window, A_UNDERLINE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_UNDERLINE)
         else:
             mvwaddstr(self.menu_window, y, x, self.topics[i])
         y += 1
     wrefresh(self.menu_window)
     update_panels()
     doupdate()
Exemple #8
0
 def _refresh(self):
     x = 2
     y = 2
     box(self.menu_window, 0, 0)
     for i in range(0, len(self.topics)):
         if self.topics_pointer == i:
             wattron(self.menu_window, A_REVERSE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_REVERSE)
         elif i in self.locked_topics:
             wattron(self.menu_window, A_UNDERLINE)
             mvwaddstr(self.menu_window, y, x, self.topics[i])
             wattroff(self.menu_window, A_UNDERLINE)
         else:
             mvwaddstr(self.menu_window, y, x, self.topics[i])
         y += 1
     wrefresh(self.menu_window)
     update_panels()
     doupdate()
Exemple #9
0
    def draw_shipmenu(self):
        uc.wclear(self.win_shipmenu)

        offset_x = 2
        offset_y = 1

        uc.box(self.win_shipmenu, 0, 0)
        uc.wmove(self.win_shipmenu, offset_y, offset_x)
        uc.waddstr(self.win_shipmenu, 'ship menu:')
        offset_y += 2

        for ele in self.menu:
            if (self.on_menu and self.menu_hi == self.menu.index(ele)):
                uc.wattron(self.win_shipmenu, uc.A_REVERSE)
                uc.mvwaddstr(self.win_shipmenu, offset_y, offset_x, ele)
                uc.wattroff(self.win_shipmenu, uc.A_REVERSE)
                offset_y += 2
            else:
                uc.mvwaddstr(self.win_shipmenu, offset_y, offset_x, ele)
                offset_y += 2

        uc.wrefresh(self.win_shipmenu)
Exemple #10
0
    def draw_board(self):
        uc.wclear(self.win_board)

        offset_x = 2
        offset_y = 1

        uc.box(self.win_boardarea, 0, 0)

        uc.wmove(self.win_boardarea, offset_y, offset_x)
        if self.on_menu:
            s = self.player.board.__str__()
        else:
            s = self.player.board.show_new_ship(self.new_ship_x,
                                                self.new_ship_y,
                                                self.menu[self.menu_hi].id,
                                                self.menu[self.menu_hi].length,
                                                self.new_ship_hor)

        uc.init_pair(11, uc.COLOR_BLUE, uc.COLOR_BLACK)
        uc.init_pair(12, uc.COLOR_WHITE, uc.COLOR_BLACK)
        uc.init_pair(13, uc.COLOR_RED, uc.COLOR_BLACK)

        for chr in s:
            if chr == '~':
                uc.wattron(self.win_board, uc.COLOR_PAIR(11))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(11))
            elif chr == 'O':
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))
            elif chr == '#':
                uc.wattron(self.win_board, uc.COLOR_PAIR(13))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(13))
            else:
                uc.wattron(self.win_board, uc.COLOR_PAIR(12))
                uc.waddstr(self.win_board, chr)
                uc.wattroff(self.win_board, uc.COLOR_PAIR(12))

        uc.wbkgd(self.win_statusbar, uc.COLOR_PAIR(11))

        uc.wrefresh(self.win_boardarea)
        uc.update_panels()