当前位置: 首页>>代码示例>>Python>>正文


Python curses.panel方法代码示例

本文整理汇总了Python中curses.panel方法的典型用法代码示例。如果您正苦于以下问题:Python curses.panel方法的具体用法?Python curses.panel怎么用?Python curses.panel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在curses的用法示例。


在下文中一共展示了curses.panel方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _createWindow

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def _createWindow(
        self, title, nlines, ncols, begin_y=0, begin_x=0
    ):
        """
        Initialize a curses window based on the sizes required.
        """
        if self.usesCurses:
            self.window = curses.newwin(nlines, ncols, begin_y, begin_x)
            self.window.nodelay(1)
            self.panel = curses.panel.new_panel(self.window)
            eval("self.panel.%s()" % (self.z_order,))
        else:
            self.window = None
        self.title = title
        self.nlines = nlines
        self.ncols = ncols
        self.iter = 0
        self.lastResult = {} 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:20,代码来源:dashboard.py

示例2: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def __init__(self, stdscr, title, footer=None, size=(None, None), default=None, resize_callback=None):
        self.stdscr = stdscr
        self.resize_callback = resize_callback
        self.content = [] if default is None else default.split()
        self.cursor_pos = 0
        self.pad_y, self.pad_x = 2, 2

        self.title = title
        self.footer = footer
        self.size = size
        if self.footer:
            self.pad_y += 1

        self.setup_windows()
        self.full_redraw()
        self.panel = curses.panel.new_panel(self.window)
        self.hide() 
开发者ID:ihabunek,项目名称:toot,代码行数:19,代码来源:app.py

示例3: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def __init__(self, title, dimensions):
        height, width, y, x = dimensions

        self._win = curses.newwin(height, width, y, x)
        self._win.box()
        self._panel = curses.panel.new_panel(self._win)
        self.title = title
        self._id = uuid1()

        self._set_title()

        self.hide() 
开发者ID:PacktPublishing,项目名称:Python-Programming-Blueprints,代码行数:14,代码来源:panel.py

示例4: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def __init__(self, stdscr):
        """create and initialize the window. This will also subsequently
        call the paint() method."""
        self.stdscr = stdscr
        self.posx = 0
        self.posy = 0
        self.width = 10
        self.height = 10
        self.termwidth = 10
        self.termheight = 10
        self.win = None
        self.panel = None
        self.__create_win() 
开发者ID:caktux,项目名称:pytrader,代码行数:15,代码来源:pytrader.py

示例5: __del__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def __del__(self):
        del self.panel
        del self.win
        curses.panel.update_panels()
        curses.doupdate() 
开发者ID:caktux,项目名称:pytrader,代码行数:7,代码来源:pytrader.py

示例6: done_paint

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def done_paint(self):
        """update the sreen after paint operations, this will invoke all
        necessary stuff to refresh all (possibly overlapping) windows in
        the right order and then push it to the screen"""
        curses.panel.update_panels()
        curses.doupdate() 
开发者ID:caktux,项目名称:pytrader,代码行数:8,代码来源:pytrader.py

示例7: __create_win

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def __create_win(self):
        """create the window. This will also be called on every resize,
        windows won't be moved, they will be deleted and recreated."""
        self.__calc_size()
        try:
            self.win = curses.newwin(self.height, self.width, self.posy, self.posx)
            self.panel = curses.panel.new_panel(self.win)
            self.win.scrollok(True)
            self.win.keypad(1)
            self.do_paint()
        except Exception:
            self.win = None
            self.panel = None 
开发者ID:caktux,项目名称:pytrader,代码行数:15,代码来源:pytrader.py

示例8: _createWindow

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def _createWindow(
        self, title, nlines, ncols, begin_y=0, begin_x=0
    ):
        """
        Initialize a curses window based on the sizes required.
        """
        self.window = curses.newwin(nlines, ncols, begin_y, begin_x)
        self.window.nodelay(1)
        self.panel = curses.panel.new_panel(self.window)
        eval("self.panel.%s()" % (self.z_order,))
        self.title = title
        self.nlines = nlines
        self.ncols = ncols
        self.iter = 0
        self.lastResult = {} 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:17,代码来源:dashview.py

示例9: test_userptr_without_set

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def test_userptr_without_set(stdscr):
    w = curses.newwin(10, 10)
    p = curses.panel.new_panel(w)
    # try to access userptr() before calling set_userptr() -- segfaults
    try:
        p.userptr()
        raise RuntimeError, 'userptr should fail since not set'
    except curses.panel.error:
        pass 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:11,代码来源:test_curses.py

示例10: show

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def show(self):
        self.panel.top()
        self.panel.show()
        self.window.refresh()
        curses.panel.update_panels() 
开发者ID:ihabunek,项目名称:toot,代码行数:7,代码来源:app.py

示例11: hide

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def hide(self):
        self.panel.hide()
        curses.panel.update_panels() 
开发者ID:ihabunek,项目名称:toot,代码行数:5,代码来源:app.py

示例12: __init__

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def __init__(self, lines=0, columns=0, 
            minimum_lines = 24,
            minimum_columns = 80,
            show_atx = 0, 
            show_aty = 0,
             **keywords):

        
    # Putting a default in here will override the system in _create_screen. For testing?
        if not lines:
            lines = self.__class__.DEFAULT_LINES
        if not columns:
            columns = self.__class__.DEFAULT_COLUMNS
            
        if lines:   minimum_lines   = lines
        if columns: minimum_columns = columns

        self.lines = lines #or 25
        self.columns = columns #or 80

        self.min_l = minimum_lines
        self.min_c = minimum_columns

        # Panels can be bigger than the screen area. These two variables
        # set which bit of the panel should be visible.
        # ie. They are about the virtual, not the physical, screen.
        self.show_from_y = 0
        self.show_from_x = 0
        self.show_atx = show_atx or self.__class__.SHOW_ATX
        self.show_aty = show_aty or self.__class__.SHOW_ATY
        self.ALL_SHOWN = False
        
        global APPLICATION_THEME_MANAGER
        if APPLICATION_THEME_MANAGER is None:
            self.theme_manager = ThemeManagers.ThemeManager()
        else:
            self.theme_manager = APPLICATION_THEME_MANAGER
        
        self.keypress_timeout = None
        

        self._create_screen() 
开发者ID:hexway,项目名称:apple_bleee,代码行数:44,代码来源:proto_fm_screen_area.py

示例13: displayWindow

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def displayWindow(self, wtype):
        """
        Toggle the specified window, or reset to launch state if None.
        """

        # Toggle a specific window on or off
        if isinstance(wtype, type):
            if wtype not in [type(w) for w in self.windows]:
                self.windows.append(wtype(self.usesCurses, self).makeWindow())
                self.windows[-1].activate()
            else:
                for window in self.windows:
                    if type(window) == wtype:
                        window.deactivate()
                        self.windows.remove(window)
                    if len(self.windows) == 0:
                        self.displayWindow(self.registered_windows["h"])

            self.resetWindows()

        # Reset the screen to the default config
        else:
            if self.windows:
                for window in self.windows:
                    window.deactivate()
                self.windows = []
            top = 0

            if len(self.servers) > 1:
                self.server_window = ServersMenu(self.usesCurses, self).makeWindow()
                self.windows.append(self.server_window)
                self.windows[-1].activate()
                top += self.windows[-1].nlines + 1
            help_top = top

            if wtype is None:
                # All windows in registered order
                ordered_windows = self.registered_windows.values()
            else:
                ordered_windows = list(wtype)
            for wtype in filter(lambda x: x.all, ordered_windows):
                new_win = wtype(self.usesCurses, self).makeWindow(top=top)
                logging.debug('created %r at panel level %r' % (new_win, new_win.z_order))
                self.windows.append(wtype(self.usesCurses, self).makeWindow(top=top))
                self.windows[-1].activate()
                top += self.windows[-1].nlines + 1

            # Don't display help panel if the window is too narrow
            if self.usesCurses:
                term_w, term_h = terminal_size()
                logging.debug("HelpWindow: rows: %s  cols: %s" % (term_h, term_w))
                if int(term_w) > 100:
                    logging.debug('HelpWindow: term_w > 100, making window with top at %d' % (top))
                    self.windows.append(HelpWindow(self.usesCurses, self).makeWindow(top=help_top))
                    self.windows[-1].activate()

        if self.usesCurses:
            curses.panel.update_panels()
        self.updateDisplay(True) 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:61,代码来源:dashboard.py

示例14: displayWindow

# 需要导入模块: import curses [as 别名]
# 或者: from curses import panel [as 别名]
def displayWindow(self, wtype):
        """
        Toggle the specified window, or reset to launch state if None.
        """

        # Toggle a specific window on or off
        if isinstance(wtype, type):
            if wtype not in [type(w) for w in self.windows]:
                self.windows.append(wtype(self).makeWindow())
                self.windows[-1].activate()
            else:
                for window in self.windows:
                    if type(window) == wtype:
                        window.deactivate()
                        self.windows.remove(window)
                    if len(self.windows) == 0:
                        self.displayWindow(self.registered_windows["h"])

            self.resetWindows()

        # Reset the screen to the default config
        else:
            if self.windows:
                for window in self.windows:
                    window.deactivate()
                self.windows = []
            top = 0

            self.server_window = ServersMenu(self).makeWindow()
            self.windows.append(self.server_window)
            self.windows[-1].activate()
            top += self.windows[-1].nlines + 1
            help_top = top

            if wtype is None:
                # All windows in registered order
                ordered_windows = self.registered_windows.values()
            else:
                ordered_windows = list(wtype)
            for wtype in filter(lambda x: x.all, ordered_windows):
                new_win = wtype(self).makeWindow(top=top)
                logging.debug('created %r at panel level %r' % (new_win, new_win.z_order))
                self.windows.append(wtype(self).makeWindow(top=top))
                self.windows[-1].activate()
                top += self.windows[-1].nlines + 1

            # Don't display help panel if the window is too narrow
            term_w, term_h = terminal_size()
            logging.debug("HelpWindow: rows: %s  cols: %s" % (term_h, term_w))
            if int(term_w) > 100:
                logging.debug("HelpWindow: term_w > 100, making window with top at %d" % (top))
                self.windows.append(HelpWindow(self).makeWindow(top=help_top))
                self.windows[-1].activate()

        curses.panel.update_panels()
        self.updateDisplay(True) 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:58,代码来源:dashview.py


注:本文中的curses.panel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。