python类Console()的实例源码

ironpython_console.py 文件源码 项目:isf 作者: w3h 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def clear_to_end_of_window(self):
        oldtop = self.WindowTop
        lastline = self.WindowTop+System.Console.WindowHeight
        pos = self.pos()
        w, h = self.size()
        length = w - pos[0] + min((lastline - pos[1] - 1), 5) * w - 1
        self.write_color(length * " ")
        self.pos(*pos)
        self.WindowTop = oldtop
ironpython_console.py 文件源码 项目:isf 作者: w3h 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def scroll_window(self, lines):
        '''Scroll the window by the indicated number of lines.'''
        top = self.WindowTop + lines
        if top < 0:
            top = 0
        if top + System.Console.WindowHeight > System.Console.BufferHeight:
            top = System.Console.BufferHeight
        self.WindowTop = top
ironpython_console.py 文件源码 项目:isf 作者: w3h 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def getkeypress(self):
        '''Return next key press event from the queue, ignoring others.'''
        ck = System.ConsoleKey
        while 1:
            e = System.Console.ReadKey(True)
            if e.Key == System.ConsoleKey.PageDown: #PageDown
                self.scroll_window(12)
            elif e.Key == System.ConsoleKey.PageUp:#PageUp
                self.scroll_window(-12)
            elif str(e.KeyChar) == "\000":#Drop deadkeys
                log("Deadkey: %s"%e)
                return event(self, e)
            else:
                return event(self, e)
ironpython_console.py 文件源码 项目:isf 作者: w3h 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def size(self, width=None, height=None):
        '''Set/get window size.'''
        sc = System.Console
        if width is not None and height is not None:
            sc.BufferWidth, sc.BufferHeight = width,height
        else:
            return sc.BufferWidth, sc.BufferHeight

        if width is not None and height is not None:
            sc.WindowWidth, sc.WindowHeight = width,height
        else:
            return sc.WindowWidth - 1, sc.WindowHeight - 1
ironpython_console.py 文件源码 项目:isf 作者: w3h 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def cursor(self, visible=True, size=None):
        '''Set cursor on or off.'''
        System.Console.CursorVisible = visible
ironpython_console.py 文件源码 项目:isf 作者: w3h 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def bell(self):
        System.Console.Beep()
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, newbuffer=0):
        '''Initialize the Console object.

        newbuffer=1 will allocate a new buffer so the old content will be restored
        on exit.
        '''
        self.serial = 0
        self.attr = System.Console.ForegroundColor
        self.saveattr = winattr[str(System.Console.ForegroundColor).lower()]
        self.savebg = System.Console.BackgroundColor
        log('initial attr=%s' % self.attr)
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _get(self):
        top = System.Console.WindowTop
        log("WindowTop:%s" % top)
        return top
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _set(self, value):
        top = System.Console.WindowTop
        log("Set WindowTop:old:%s,new:%s" % (top, value))
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def pos(self, x=None, y=None):
        '''Move or query the window cursor.'''
        if x is not None:
            System.Console.CursorLeft = x
        else:
            x = System.Console.CursorLeft
        if y is not None:
            System.Console.CursorTop = y
        else:
            y = System.Console.CursorTop
        return x, y
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def home(self):
        '''Move to home.'''
        self.pos(0, 0)

# Map ANSI color escape sequences into Windows Console Attributes
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def page(self, attr=None, fill=' '):
        '''Fill the entire screen.'''
        System.Console.Clear()
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def clear_to_end_of_window(self):
        oldtop = self.WindowTop
        lastline = self.WindowTop + System.Console.WindowHeight
        pos = self.pos()
        w, h = self.size()
        length = w - pos[0] + min((lastline - pos[1] - 1), 5) * w - 1
        self.write_color(length * " ")
        self.pos(*pos)
        self.WindowTop = oldtop
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def scroll_window(self, lines):
        '''Scroll the window by the indicated number of lines.'''
        top = self.WindowTop + lines
        if top < 0:
            top = 0
        if top + System.Console.WindowHeight > System.Console.BufferHeight:
            top = System.Console.BufferHeight
        self.WindowTop = top
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def getkeypress(self):
        '''Return next key press event from the queue, ignoring others.'''
        ck = System.ConsoleKey
        while 1:
            e = System.Console.ReadKey(True)
            if e.Key == System.ConsoleKey.PageDown:  #PageDown
                self.scroll_window(12)
            elif e.Key == System.ConsoleKey.PageUp:  #PageUp
                self.scroll_window(-12)
            elif str(e.KeyChar) == "\000":  #Drop deadkeys
                log("Deadkey: %s" % e)
                return event(self, e)
            else:
                return event(self, e)
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def size(self, width=None, height=None):
        '''Set/get window size.'''
        sc = System.Console
        if width is not None and height is not None:
            sc.BufferWidth, sc.BufferHeight = width, height
        else:
            return sc.BufferWidth, sc.BufferHeight

        if width is not None and height is not None:
            sc.WindowWidth, sc.WindowHeight = width, height
        else:
            return sc.WindowWidth - 1, sc.WindowHeight - 1
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def cursor(self, visible=True, size=None):
        '''Set cursor on or off.'''
        System.Console.CursorVisible = visible
ironpython_console.py 文件源码 项目:OWASP-ZSC-API 作者: viraintel 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def bell(self):
        System.Console.Beep()
ironpython_console.py 文件源码 项目:shadowbroker-auto 作者: wrfly 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self, newbuffer=0):
        u'''Initialize the Console object.

        newbuffer=1 will allocate a new buffer so the old content will be restored
        on exit.
        '''
        self.serial = 0
        self.attr = System.Console.ForegroundColor
        self.saveattr = winattr[str(System.Console.ForegroundColor).lower()]
        self.savebg = System.Console.BackgroundColor
        log(u'initial attr=%s' % self.attr)
ironpython_console.py 文件源码 项目:shadowbroker-auto 作者: wrfly 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _get(self):
        top = System.Console.WindowTop
        log(u"WindowTop:%s"%top)
        return top


问题


面经


文章

微信
公众号

扫码关注公众号