Package libxyz :: Package ui :: Module cmd :: Class Cmd

[hide private]
[frames] | no frames]

# Class Cmd

source code

    lowui.FlowWidget --+
                       |
                      Cmd

Command line widget

Instance Methods | [hide private]

__init__(self, xyz) | source code

_update_conf_hook(self, var, val, sect) Hook for update conf event | source code

_save_history_hook(self) Save history at shutdown | source code

_load_history_hook(self) Load history at startup | source code

_init_plugin(self) Init virtual plugin | source code

selectable(self) | source code

rows(self, (maxcol,), focus=False) Return the number of lines that will be rendered | source code

render(self, (maxcol,), focus=False) Render the command line | source code

_get_visible(self, maxcol) Calculate and return currently visible piece of cmd data | source code

get_cursor_coords(self, (maxcol,)) Return the (x,y) coordinates of cursor within widget. | source code

_put_object(self, char) | source code

keypress(self, size, key) Process pressed key | source code

_save_undo(self) Save undo data | source code

_restore_undo(self) Restore one undo level | source code

_save_history(self) Save typed command history | source code

_clear_cmd(self) Internal clear | source code

_move_cursor(self, direction, chars=None, topred=None) Generic cursor moving procedure | source code

_delete(self, direction, chars=None, topred=None) Generic delete procedure | source code

del_char_left(self) Delete single character left to the cursor | source code

del_char(self) Delete single character under the cursor | source code

del_word_left(self) Delete a word left to the cursor | source code

del_word_right(self) Delete a word right to the cursor | source code

clear(self) Clear the whole cmd line | source code

clear_left(self) Clear the cmd line from the cursor to the left | source code

clear_right(self) Clear the cmd line from the cursor to the right | source code

cursor_begin(self) Move cursor to the beginning of the command line | source code

cursor_end(self) Move cursor to the end of the command line | source code

cursor_left(self) Move cursor left | source code

cursor_right(self) Move cursor right | source code

cursor_word_left(self) Move cursor one word left | source code

cursor_word_right(self) Move cursor one word right | source code

execute(self) Execute cmd contents | source code

replace_aliases(self, data) Check if first word of the command line (which is supposed to be a command to execute) is in our aliases table, if it is, replace it. | source code

is_empty(self) Return True if cmd is empty, i.e. | source code

undo(self) Restore one level from undo buffer | source code

undo_clear(self) Clear undo buffer | source code

history_prev(self) Scroll through list of saved commands backward | source code

history_next(self) Scroll through list of saved commands forward | source code

history_clear(self) Clear commands history | source code

show_history(self) Show commands history list | source code

put_active_object(self) Put currently selected VFS object name in panel to cmd line | source code

put_active_object_path(self) Put currently selected VFS object full path in panel to cmd line | source code

put_inactive_object(self) Put selected VFS object name in inactive panel to cmd line | source code

put_inactive_object_path(self) Put selected VFS object full path in inactive panel to cmd line | source code

put_active_cwd(self) Put current working directory of active panel to cmd line | source code

put_inactive_cwd(self) Put current working directory of inactive panel to cmd line | source code

put(self, obj, space=True) Put arbitrary string to cmd line starting from the cursor position | source code

get(self) Get cmd contents | source code

append(self, obj) Append arbitrary string at the end of cmd | source code

_put_engine(self, obj, space=True) Put list content to cmd | source code

escape(self, obj, join=False) Escape filename | source code

_set_prompt(self, new) Set command line prompt | source code

Class Variables | [hide private]

| resolution = `u"cmd",`
| LEFT = `u"left"`
| RIGHT = `u"right"`
| END = `u"end"`
| UNDER = `u"under"`

Method Details | [hide private]

### __init__(self, xyz)
(Constructor)

source code

Parameters:
  - `xyz` - XYZData instance

    Resources used: text, prompt

### _move_cursor(self, direction, chars=None, topred=None)

source code

Generic cursor moving procedure

Parameters:
  - `direction` - LEFT or RIGHT
  - `chars` - Number of character to move or END to move to the end in corresponding direction
  - `topred` - Predicate function which must return True if char under the cursor is endpoint in move

### _delete(self, direction, chars=None, topred=None)

source code

Generic delete procedure

Parameters:
  - `direction` - LEFT, RIGHT or UNDER
  - `chars` - Number of characters to delete
  - `topred` - Predicate function which must return True if char under the cursor is endpoint in delete
Decorators:
  - `@refresh`

### replace_aliases(self, data)

source code

Check if first word of the command line (which is supposed to be a command to execute) is in our aliases table, if it is, replace it.

Parameters:
  - `data` - String

### is_empty(self)

source code

Return True if cmd is empty, i.e. has no contents

### put(self, obj, space=True)

source code

Put arbitrary string to cmd line starting from the cursor position

Parameters:
  - `space` - Flag indicating whether to append space char after the obj

### escape(self, obj, join=False)

source code

Escape filename

Parameters:
  - `obj` - String to escape
  - `join` - If False return list otherwise return joined string