| |
- ranger.core.shared.EnvironmentAware(builtins.object)
-
- Displayable(ranger.core.shared.EnvironmentAware, ranger.core.shared.FileManagerAware, ranger.gui.curses_shortcuts.CursesShortcuts)
-
- DisplayableContainer
- ranger.core.shared.FileManagerAware(builtins.object)
-
- Displayable(ranger.core.shared.EnvironmentAware, ranger.core.shared.FileManagerAware, ranger.gui.curses_shortcuts.CursesShortcuts)
-
- DisplayableContainer
- ranger.gui.curses_shortcuts.CursesShortcuts(ranger.core.shared.SettingsAware)
-
- Displayable(ranger.core.shared.EnvironmentAware, ranger.core.shared.FileManagerAware, ranger.gui.curses_shortcuts.CursesShortcuts)
-
- DisplayableContainer
class Displayable(ranger.core.shared.EnvironmentAware, ranger.core.shared.FileManagerAware, ranger.gui.curses_shortcuts.CursesShortcuts) |
|
Displayables are objects which are displayed on the screen.
This is just the abstract class, defining basic operations
such as resizing, printing, changing colors.
Subclasses of displayable can extend these methods:
draw() -- draw the object. Is only called if visible.
poke() -- is called just before draw(), even if not visible.
finalize() -- called after all objects finished drawing.
click(event) -- called with a MouseEvent. This is called on all
visible objects under the mouse, until one returns True.
press(key) -- called after a key press on focused objects.
destroy() -- called before destroying the displayable object
Additionally, there are these methods:
__contains__(item) -- is the item (y, x) inside the widget?
These attributes are set:
Modifiable:
focused -- Focused objects receive press() calls.
visible -- Visible objects receive draw() and finalize() calls
need_redraw -- Should the widget be redrawn? This variable may
be set at various places in the script and should eventually be
handled (and unset) in the draw() method.
Read-Only: (i.e. reccomended not to change manually)
win -- the own curses window object
parent -- the parent (DisplayableContainer) object or None
x, y, wid, hei -- absolute coordinates and boundaries
settings, fm -- inherited shared variables |
|
- Method resolution order:
- Displayable
- ranger.core.shared.EnvironmentAware
- ranger.core.shared.FileManagerAware
- ranger.gui.curses_shortcuts.CursesShortcuts
- ranger.core.shared.SettingsAware
- builtins.object
Methods defined here:
- __bool__ = __nonzero__(self)
- __contains__(self, item)
- Checks if item is inside the boundaries.
item can be an iterable like [y, x] or an object with x and y methods.
- __init__(self, win, env=None, fm=None, settings=None)
- __nonzero__(self)
- Always True
- __str__(self)
- click(self, event)
- Called when a mouse key is pressed and self.focused is True.
Override this!
- contains_point(self, y, x)
- Test whether the point lies inside this object.
x and y should be absolute coordinates.
- destroy(self)
- Called when the object is destroyed.
Override this!
- draw(self)
- Draw the oject.
Called on every main iteration if visible. Containers should call
draw() on their contained objects here. Override this!
- finalize(self)
- Called after every displayable is done drawing.
Override this!
- poke(self)
- Called before drawing, even if invisible
- press(self, key)
- Called when a key is pressed and self.focused is True.
Override this!
- resize(self, y, x, hei=None, wid=None)
- Resize the widget
Methods inherited from ranger.core.shared.EnvironmentAware:
env = None
Data descriptors inherited from ranger.core.shared.EnvironmentAware:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
- addch(self, *args)
- addnstr(self, *args)
- addstr(self, *args)
- color(self, *keys)
- Change the colors from now on.
- color_at(self, y, x, wid, *keys)
- Change the colors at the specified position
- color_reset(self)
- Change the colors to the default colors
- set_fg_bg_attr(self, fg, bg, attr)
|
class DisplayableContainer(Displayable) |
|
DisplayableContainers are Displayables which contain other Displayables.
This is also an abstract class. The methods draw, poke, finalize,
click, press and destroy are extended here and will recursively
call the function on all contained objects.
New methods:
add_child(object) -- add the object to the container.
remove_child(object) -- remove the object from the container.
New attributes:
container -- a list with all contained objects (rw) |
|
- Method resolution order:
- DisplayableContainer
- Displayable
- ranger.core.shared.EnvironmentAware
- ranger.core.shared.FileManagerAware
- ranger.gui.curses_shortcuts.CursesShortcuts
- ranger.core.shared.SettingsAware
- builtins.object
Methods defined here:
- __init__(self, win, env=None, fm=None, settings=None)
- add_child(self, obj)
- Add the objects to the container.
- click(self, event)
- Recursively called on objects in container
- destroy(self)
- Recursively called on objects in container
- draw(self)
- Recursively called on visible objects in container
- finalize(self)
- Recursively called on visible objects in container
- poke(self)
- Recursively called on objects in container
- press(self, key)
- Recursively called on objects in container
- remove_child(self, obj)
- Remove the object from the container.
Methods inherited from Displayable:
- __bool__ = __nonzero__(self)
- Always True
- __contains__(self, item)
- Checks if item is inside the boundaries.
item can be an iterable like [y, x] or an object with x and y methods.
- __nonzero__(self)
- Always True
- __str__(self)
- contains_point(self, y, x)
- Test whether the point lies inside this object.
x and y should be absolute coordinates.
- resize(self, y, x, hei=None, wid=None)
- Resize the widget
Methods inherited from ranger.core.shared.EnvironmentAware:
env = None
Data descriptors inherited from ranger.core.shared.EnvironmentAware:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from ranger.gui.curses_shortcuts.CursesShortcuts:
- addch(self, *args)
- addnstr(self, *args)
- addstr(self, *args)
- color(self, *keys)
- Change the colors from now on.
- color_at(self, y, x, wid, *keys)
- Change the colors at the specified position
- color_reset(self)
- Change the colors to the default colors
- set_fg_bg_attr(self, fg, bg, attr)
| |