Package hsh :: Package curses_display :: Module keyvalue_view :: Class KeyValueView
[hide private]
[frames] | no frames]

Class KeyValueView

object --+    
         |    
 view.View --+
             |
            KeyValueView

An abstract superclass for views that display and permit editing of key-value type information. It will be used by the alias and environment views.

Subclasses need to provide self.content_dict with a mutable dictionary that this class will modify.

The view location and current key are tracked by self.curkey and self.dispkey. The position of the cursor on the line is tracked by self.cursor_pos, a 3-tuple: first element is 0 if the cursor is in the key or 1 if it's in the value; the second is the cursor position in the string; the third is the first character from the string to draw.

Instance Methods [hide private]
 
__init__(self, display, name, content_dict)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
start_editing(self)
 
get_focus_text(self)
Return a string with the text of the key or value with focus.
 
insert_text(self, text)
 
align_cursor(self)
 
draw_cursor(self, win)
Default implementation does not draw a cursor.
boolean
draw(self, win, force_redraw, search=None)
This default implementation of draw() is purely illustrative, and only draws the header.
 
move_left(self, ki)
 
move_right(self, ki)
 
move_up(self, ki)
 
move_down(self, ki)
 
move_start(self, ki)
 
move_end(self, ki)
 
page_up(self, ki)
 
page_down(self, ki)
 
cycle_field(self, ki)
 
save_field(self, ki)
 
delete_left(self, ki)
 
delete_right(self, ki)
 
delete_line(self, ki)
 
insert(self, ki)
 
paste(self, ki)

Inherited from view.View: change_view, current_job, delete_job, draw_header, draw_line, edit_job, get_face, get_name, has_terminal, header_info, is_dirty, min_height, min_width, move_bottom, move_search, move_top, next_job, next_window, prev_job, putch, quit, restart_job, set_dirty, set_focus, set_has_terminal, set_visible_job, show_search, toggle_wrap, wants_terminal

Inherited from view.View (private): _content_win

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, display, name, content_dict)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

draw_cursor(self, win)

 

Default implementation does not draw a cursor.

Overrides: view.View.draw_cursor
(inherited documentation)

draw(self, win, force_redraw, search=None)

 

This default implementation of draw() is purely illustrative, and only draws the header. Subclasses will certainly override it.

Parameters:
  • force_redraw - If true the view object shouldn't try to optimize.
  • search - a regular expression object whose matches should be highlighted.
Returns: boolean
True means something was drawn or the cursor position has changed. This result is used by the main drawing loop to decide whether to draw the cursor, or take a nap.
Overrides: view.View.draw
(inherited documentation)

move_left(self, ki)

 
Overrides: view.View.move_left

move_right(self, ki)

 
Overrides: view.View.move_right

move_up(self, ki)

 
Overrides: view.View.move_up

move_down(self, ki)

 
Overrides: view.View.move_down

move_start(self, ki)

 
Overrides: view.View.move_start

move_end(self, ki)

 
Overrides: view.View.move_end

page_up(self, ki)

 
Overrides: view.View.page_up

page_down(self, ki)

 
Overrides: view.View.page_down

delete_left(self, ki)

 
Overrides: view.View.delete_left

delete_right(self, ki)

 
Overrides: view.View.delete_right

delete_line(self, ki)

 
Overrides: view.View.delete_line

insert(self, ki)

 
Overrides: view.View.insert

paste(self, ki)

 
Overrides: view.View.paste