Logo Search packages:      
Sourcecode: lfm version File versions  Download package

def lfm::lfm::Lfm::init_curses (   self  ) 

initialize curses stuff: windows, colors, ...

Definition at line 92 of file lfm.py.

00092                          :
        """initialize curses stuff: windows, colors, ..."""

        self.maxh, self.maxw = self.win.getmaxyx()
        curses.cbreak()
        curses.raw()
        cursor_hide()

        # create top and bottom windows
        try:
            self.win_title = curses.newwin(1, 0, 0, 0)
            self.win_status = curses.newwin(1, 0, self.maxh-1, 0)
        except curses.error:
            print 'Can\'t create windows'
            sys.exit(-1)

        # colors
        if curses.has_colors():
            self.colors = self.prefs.colors

            # Translation table: color name -> curses color name.
            self.coltbl = {
                'black': curses.COLOR_BLACK,
                'blue': curses.COLOR_BLUE,
                'cyan': curses.COLOR_CYAN,
                'green': curses.COLOR_GREEN,
                'magenta': curses.COLOR_MAGENTA,
                'red': curses.COLOR_RED,
                'white': curses.COLOR_WHITE,
                'yellow': curses.COLOR_YELLOW }

            # Defaults of base objects. object, foregrounf, background
            colors = [
                ('title', 'yellow', 'blue'),
                ('files', 'white', 'black'),
                ('current_file', 'blue', 'cyan'),
                ('messages', 'magenta', 'cyan'),
                ('help', 'green', 'black'),
                ('file_info', 'red', 'black'),
                ('error_messages1', 'white', 'red'),
                ('error_messages2', 'black', 'red'),
                ('buttons', 'yellow', 'red'),
                ('selected_file', 'yellow', 'black'),
                ('current_selected_file', 'yellow', 'cyan') ]

            # Initialize every color pair with user colors or with the defaults.
            for i in range(len(colors)):
                curses.init_pair(i+1,
                    self.__set_color(self.colors[colors[i][0]][0], self.coltbl[colors[i][1]]),
                    self.__set_color(self.colors[colors[i][0]][1], self.coltbl[colors[i][2]]))

            self.win_title.attrset(curses.color_pair(1) | curses.A_BOLD)
            self.win_title.bkgdset(curses.color_pair(1))
            self.win_status.attrset(curses.color_pair(1))
            self.win_status.bkgdset(curses.color_pair(1))


    def resize(self):


Generated by  Doxygen 1.6.0   Back to index