本文整理匯總了Python中ranger.gui.widgets.console.Console.close方法的典型用法代碼示例。如果您正苦於以下問題:Python Console.close方法的具體用法?Python Console.close怎麽用?Python Console.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ranger.gui.widgets.console.Console
的用法示例。
在下文中一共展示了Console.close方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: UI
# 需要導入模塊: from ranger.gui.widgets.console import Console [as 別名]
# 或者: from ranger.gui.widgets.console.Console import close [as 別名]
#.........這裏部分代碼省略.........
self.taskview.resize(1, 0, y - 2, x)
self.pager.resize(1, 0, y - 2, x)
self.titlebar.resize(0, 0, 1, x)
self.status.resize(self.settings.status_bar_on_top and 1 or y-1, 0, 1, x)
self.console.resize(y - 1, 0, 1, x)
def draw(self):
"""Draw all objects in the container"""
self.win.touchwin()
DisplayableContainer.draw(self)
if self._draw_title and self.settings.update_title:
cwd = self.fm.thisdir.path
if cwd.startswith(self.fm.home_path):
cwd = '~' + cwd[len(self.fm.home_path):]
if self.settings.shorten_title:
split = cwd.rsplit(os.sep, self.settings.shorten_title)
if os.sep in split[0]:
cwd = os.sep.join(split[1:])
try:
fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
decode('utf-8', 'replace')
sys.stdout.write("%sranger:%s%s" %
(curses.tigetstr('tsl').decode('latin-1'), fixed_cwd,
curses.tigetstr('fsl').decode('latin-1')))
sys.stdout.flush()
except:
pass
self.win.refresh()
def finalize(self):
"""Finalize every object in container and refresh the window"""
DisplayableContainer.finalize(self)
self.win.refresh()
def close_pager(self):
if self.console.visible:
self.console.focused = True
self.pager.close()
self.pager.visible = False
self.pager.focused = False
self.browser.visible = True
def open_pager(self):
self.browser.columns[-1].clear_image(force=True)
if self.console.focused:
self.console.focused = False
self.pager.open()
self.pager.visible = True
self.pager.focused = True
self.browser.visible = False
return self.pager
def open_embedded_pager(self):
self.browser.open_pager()
for column in self.browser.columns:
if column == self.browser.main_column:
break
column.level_shift(amount=1)
return self.browser.pager
def close_embedded_pager(self):
self.browser.close_pager()
for column in self.browser.columns:
column.level_restore()
def open_console(self, string='', prompt=None, position=None):
if self.console.open(string, prompt=prompt, position=position):
self.status.msg = None
def close_console(self):
self.console.close()
self.close_pager()
def open_taskview(self):
self.browser.columns[-1].clear_image(force=True)
self.pager.close()
self.pager.visible = False
self.pager.focused = False
self.console.visible = False
self.browser.visible = False
self.taskview.visible = True
self.taskview.focused = True
def redraw_main_column(self):
self.browser.main_column.need_redraw = True
def close_taskview(self):
self.taskview.visible = False
self.browser.visible = True
self.taskview.focused = False
def throbber(self, string='.', remove=False):
if remove:
self.titlebar.throbber = type(self.titlebar).throbber
else:
self.titlebar.throbber = string
def hint(self, text=None):
self.status.hint = text
示例2: UI
# 需要導入模塊: from ranger.gui.widgets.console import Console [as 別名]
# 或者: from ranger.gui.widgets.console.Console import close [as 別名]
#.........這裏部分代碼省略.........
split = cwd.rsplit(os.sep, self.settings.shorten_title)
if os.sep in split[0]:
cwd = os.sep.join(split[1:])
try:
fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
decode('utf-8', 'replace')
fmt_tup = (
curses.tigetstr('tsl').decode('latin-1'),
fixed_cwd,
curses.tigetstr('fsl').decode('latin-1'),
)
except UnicodeError:
pass
else:
sys.stdout.write("%sranger:%s%s" % fmt_tup)
sys.stdout.flush()
self.win.refresh()
def finalize(self):
"""Finalize every object in container and refresh the window"""
DisplayableContainer.finalize(self)
self.win.refresh()
def draw_images(self):
if self.pager.visible:
self.pager.draw_image()
elif self.browser.pager:
if self.browser.pager.visible:
self.browser.pager.draw_image()
else:
self.browser.columns[-1].draw_image()
def close_pager(self):
if self.console.visible:
self.console.focused = True
self.pager.close()
self.pager.visible = False
self.pager.focused = False
self.browser.visible = True
def open_pager(self):
self.browser.columns[-1].clear_image(force=True)
if self.console.focused:
self.console.focused = False
self.pager.open()
self.pager.visible = True
self.pager.focused = True
self.browser.visible = False
return self.pager
def open_embedded_pager(self):
self.browser.open_pager()
for column in self.browser.columns:
if column == self.browser.main_column:
break
column.level_shift(amount=1)
return self.browser.pager
def close_embedded_pager(self):
self.browser.close_pager()
for column in self.browser.columns:
column.level_restore()
def open_console(self, string='', prompt=None, position=None):
if self.console.open(string, prompt=prompt, position=position):