本文整理汇总了Python中ranger.gui.widgets.titlebar.TitleBar类的典型用法代码示例。如果您正苦于以下问题:Python TitleBar类的具体用法?Python TitleBar怎么用?Python TitleBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TitleBar类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
def setup(self):
"""Build up the UI by initializing widgets."""
# Create a title bar
self.titlebar = TitleBar(self.win)
self.add_child(self.titlebar)
# Create the browser view
self.browser = BrowserView(self.win, self.settings.column_ratios)
self.settings.signal_bind('setopt.column_ratios',
self.browser.change_ratios)
self.add_child(self.browser)
# Create the process manager
self.taskview = TaskView(self.win)
self.taskview.visible = False
self.add_child(self.taskview)
# Create the status bar
self.status = StatusBar(self.win, self.browser.main_column)
self.add_child(self.status)
# Create the console
self.console = Console(self.win)
self.add_child(self.console)
self.console.visible = False
# Create the pager
self.pager = Pager(self.win)
self.pager.visible = False
self.add_child(self.pager)
示例2: setup
def setup(self):
"""Build up the UI by initializing widgets."""
from ranger.gui.widgets.view_miller import ViewMiller
from ranger.gui.widgets.titlebar import TitleBar
from ranger.gui.widgets.console import Console
from ranger.gui.widgets.statusbar import StatusBar
from ranger.gui.widgets.taskview import TaskView
from ranger.gui.widgets.pager import Pager
# Create a title bar
self.titlebar = TitleBar(self.win)
self.add_child(self.titlebar)
# Create the browser view
self.settings.signal_bind("setopt.viewmode", self._set_viewmode)
self._viewmode = None
# The following line sets self.browser implicitly through the signal
self.viewmode = self.settings.viewmode
self.add_child(self.browser)
# Create the process manager
self.taskview = TaskView(self.win)
self.taskview.visible = False
self.add_child(self.taskview)
# Create the status bar
self.status = StatusBar(self.win, self.browser.main_column)
self.add_child(self.status)
# Create the console
self.console = Console(self.win)
self.add_child(self.console)
self.console.visible = False
# Create the pager
self.pager = Pager(self.win)
self.pager.visible = False
self.add_child(self.pager)
示例3: UI
#.........这里部分代码省略.........
getkey = self.win.getch()
if getkey is not -1:
keys.append(getkey)
if len(keys) == 1:
keys.append(-1)
elif keys[0] == 27:
keys[0] = ALT_KEY
if self.settings.xterm_alt_key:
if len(keys) == 2 and keys[1] in range(127, 256):
if keys[0] == 195:
keys = [ALT_KEY, keys[1] - 64]
elif keys[0] == 194:
keys = [ALT_KEY, keys[1] - 128]
self.handle_keys(*keys)
self.set_load_mode(previous_load_mode)
if self.settings.flushinput and not self.console.visible:
curses.flushinp()
else:
# Handle simple key presses, CTRL+X, etc here:
if key > 0:
if self.settings.flushinput and not self.console.visible:
curses.flushinp()
if key == curses.KEY_MOUSE:
self.handle_mouse()
elif key == curses.KEY_RESIZE:
self.update_size()
else:
if not self.fm.input_is_blocked():
self.handle_key(key)
def setup(self):
"""Build up the UI by initializing widgets."""
from ranger.gui.widgets.browserview import BrowserView
from ranger.gui.widgets.titlebar import TitleBar
from ranger.gui.widgets.console import Console
from ranger.gui.widgets.statusbar import StatusBar
from ranger.gui.widgets.taskview import TaskView
from ranger.gui.widgets.pager import Pager
# Create a title bar
self.titlebar = TitleBar(self.win)
self.add_child(self.titlebar)
# Create the browser view
self.browser = BrowserView(self.win, self.settings.column_ratios)
self.settings.signal_bind('setopt.column_ratios',
self.browser.change_ratios)
self.add_child(self.browser)
# Create the process manager
self.taskview = TaskView(self.win)
self.taskview.visible = False
self.add_child(self.taskview)
# Create the status bar
self.status = StatusBar(self.win, self.browser.main_column)
self.add_child(self.status)
# Create the console
self.console = Console(self.win)
self.add_child(self.console)
self.console.visible = False
# Create the pager
self.pager = Pager(self.win)
self.pager.visible = False
示例4: UI
#.........这里部分代码省略.........
for _ in range(4):
getkey = self.win.getch()
if getkey != -1:
keys.append(getkey)
if len(keys) == 1:
keys.append(-1)
elif keys[0] == 27:
keys[0] = ALT_KEY
if self.settings.xterm_alt_key:
if len(keys) == 2 and keys[1] in range(127, 256):
if keys[0] == 195:
keys = [ALT_KEY, keys[1] - 64]
elif keys[0] == 194:
keys = [ALT_KEY, keys[1] - 128]
self.handle_keys(*keys)
self.set_load_mode(previous_load_mode)
if self.settings.flushinput and not self.console.visible:
curses.flushinp()
else:
# Handle simple key presses, CTRL+X, etc here:
if key >= 0:
if self.settings.flushinput and not self.console.visible:
curses.flushinp()
if key == curses.KEY_MOUSE:
self.handle_mouse()
elif key == curses.KEY_RESIZE:
self.update_size()
else:
if not self.fm.input_is_blocked():
self.handle_key(key)
def setup(self):
"""Build up the UI by initializing widgets."""
from ranger.gui.widgets.titlebar import TitleBar
from ranger.gui.widgets.console import Console
from ranger.gui.widgets.statusbar import StatusBar
from ranger.gui.widgets.taskview import TaskView
from ranger.gui.widgets.pager import Pager
# Create a titlebar
self.titlebar = TitleBar(self.win)
self.add_child(self.titlebar)
# Create the browser view
self.settings.signal_bind('setopt.viewmode', self._set_viewmode)
self._viewmode = None
# The following line sets self.browser implicitly through the signal
self.viewmode = self.settings.viewmode
self.add_child(self.browser)
# Create the process manager
self.taskview = TaskView(self.win)
self.taskview.visible = False
self.add_child(self.taskview)
# Create the status bar
self.status = StatusBar(self.win, self.browser.main_column)
self.add_child(self.status)
# Create the console
self.console = Console(self.win)
self.add_child(self.console)
self.console.visible = False
# Create the pager
self.pager = Pager(self.win)
示例5: UI
#.........这里部分代码省略.........
getkey = self.win.getch()
if getkey is not -1:
keys.append(getkey)
if len(keys) == 1:
keys.append(-1)
elif keys[0] == 27:
keys[0] = ALT_KEY
if self.settings.xterm_alt_key:
if len(keys) == 2 and keys[1] in range(127, 256):
if keys[0] == 195:
keys = [ALT_KEY, keys[1] - 64]
elif keys[0] == 194:
keys = [ALT_KEY, keys[1] - 128]
self.handle_keys(*keys)
self.set_load_mode(previous_load_mode)
if self.settings.flushinput and not self.console.visible:
curses.flushinp()
else:
# Handle simple key presses, CTRL+X, etc here:
if key > 0:
if self.settings.flushinput and not self.console.visible:
curses.flushinp()
if key == curses.KEY_MOUSE:
self.handle_mouse()
elif key == curses.KEY_RESIZE:
self.update_size()
else:
if not self.fm.input_is_blocked():
self.handle_key(key)
def setup(self):
"""Build up the UI by initializing widgets."""
from ranger.gui.widgets.browserview import BrowserView
from ranger.gui.widgets.titlebar import TitleBar
from ranger.gui.widgets.console import Console
from ranger.gui.widgets.statusbar import StatusBar
from ranger.gui.widgets.taskview import TaskView
from ranger.gui.widgets.pager import Pager
# Create a title bar
self.titlebar = TitleBar(self.win)
self.add_child(self.titlebar)
# Create the browser view
self.browser = BrowserView(self.win, self.settings.column_ratios)
self.settings.signal_bind("setopt.column_ratios", self.browser.change_ratios)
self.add_child(self.browser)
# Create the process manager
self.taskview = TaskView(self.win)
self.taskview.visible = False
self.add_child(self.taskview)
# Create the status bar
self.status = StatusBar(self.win, self.browser.main_column)
self.add_child(self.status)
# Create the console
self.console = Console(self.win)
self.add_child(self.console)
self.console.visible = False
# Create the pager
self.pager = Pager(self.win)
self.pager.visible = False
self.add_child(self.pager)
示例6: DefaultUI
class DefaultUI(UI):
def setup(self):
"""Build up the UI by initializing widgets."""
# Create a title bar
self.titlebar = TitleBar(self.win)
self.add_child(self.titlebar)
# Create the browser view
self.browser = BrowserView(self.win, self.settings.column_ratios)
self.settings.signal_bind('setopt.column_ratios',
self.browser.change_ratios)
self.add_child(self.browser)
# Create the process manager
self.taskview = TaskView(self.win)
self.taskview.visible = False
self.add_child(self.taskview)
# Create the status bar
self.status = StatusBar(self.win, self.browser.main_column)
self.add_child(self.status)
# Create the console
self.console = Console(self.win)
self.add_child(self.console)
self.console.visible = False
# Create the pager
self.pager = Pager(self.win)
self.pager.visible = False
self.add_child(self.pager)
def update_size(self):
"""resize all widgets"""
UI.update_size(self)
y, x = self.env.termsize
self.browser.resize(1, 0, y - 2, x)
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(y - 1, 0, 1, x)
self.console.resize(y - 1, 0, 1, x)
def notify(self, *a, **k):
return self.status.notify(*a, **k)
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):
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()
return self.browser.pager
def close_embedded_pager(self):
self.browser.close_pager()
def open_console(self, string='', prompt=None, position=None):
if self.console.open(string, prompt=prompt, position=position):
self.status.msg = None
self.console.on_close = self.close_console
self.console.visible = True
self.status.visible = False
def close_console(self):
self.console.visible = False
self.status.visible = True
self.close_pager()
def open_taskview(self):
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
self.fm.hint('*tasks:* *dd*:remove *J*:move_down *H*:move_up')
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
#.........这里部分代码省略.........