Package hsh :: Package curses_display :: Module list_view :: Class ListView
[hide private]
[frames] | no frames]

Class ListView

             object --+    
                      |    
              view.View --+
                          |
             object --+   |
                      |   |
jobs.JobManagerListener --+
                          |
             object --+   |
                      |   |
       jobs.JobListener --+
                          |
                         ListView

Displays a list of job information. Instances need to be configured by specifying a format for display and a function for filtering those to display.

It contains a list of job display objects, and tracks and highlights a focussed one.

Nested Classes [hide private]
  JobFormatFetcher
Class to simplify accessing a job's formatted header and output.
  JobFormatAssembler
Small class to assemble the formatted job output.
Instance Methods [hide private]
 
__init__(self, display, name, job_filter, job_header_fmt, header='', show_job_output=False, sync_main_job=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
set_visible_job(self, job)
Implementation of abstract method from View.
 
on_add_job(self, job)
Add a single job to the list.
 
on_remove_job(self, job)
A job is removed from the manager, so remove it from the list.
 
on_job_output(self, job)
 
on_job_terminate(self, job)
 
on_job_raw_output(self, job, text, channel)
 
_get_job_header_size(self)
Return the number of lines used by each job header.
 
_load_job(self)
Ask the job manager to load a new job on disk, which will be inserted at the front of the list.
 
_get_job_option(self, option, job=None)
Fetch an option from self.job_options.
 
_set_job_option(self, option, value, job=None)
Set an option in self.job_options.
 
_set_curjob(self, newjob=None, next=False, prev=False, dispmode='')
Update the current job and related state.
 
current_job(self)
Return the current job as a hsh.jobs.Job object.
 
last_job(self)
Return the last job as a hsh.jobs.Job object or None.
 
set_current_job(self, job)
Update the list's current job to the given hsh.jobs.Job object, and change display position so it's visible.
 
get_predecessor(self, job)
Given a job, fetch one from the list which falls before it based on jobid.
 
get_successor(self, job)
Given a job, fetch one from the list which falls after it based on jobid.
 
draw_cursor(self, win)
Draw cursor at the current job.
boolean
draw(self, win, force_redraw, search=None)
This default implementation of draw() is purely illustrative, and only draws the header.
 
move_search(self, pattern, forward=True, from_end=False)
Update the display position so the next match of the given pattern is visible.
 
move_up(self, ki)
 
move_down(self, ki)
 
move_job_top(self, ki)
 
move_job_bottom(self, ki)
 
page_up(self, ki)
 
page_down(self, ki)
 
hide_output(self, ki)
 
next_job(self, ki)
 
prev_job(self, ki)
 
restart_job(self, ki)
 
edit_job(self, ki)
 
select_job(self, ki)
 
input_command(self, ki, overwrite)
Insert the current job's command line to input view, and if overwrite is True, remove any existing input.
 
delete_job(self, ki)
 
toggle_wrap(self, ki)

Inherited from view.View: change_view, delete_left, delete_line, delete_right, draw_header, draw_line, get_face, get_name, has_terminal, header_info, insert, is_dirty, min_height, min_width, move_bottom, move_end, move_left, move_right, move_start, move_top, next_window, paste, putch, quit, set_dirty, set_focus, set_has_terminal, show_search, 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, job_filter, job_header_fmt, header='', show_job_output=False, sync_main_job=False)
(Constructor)

 

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

Overrides: object.__init__
(inherited documentation)

set_visible_job(self, job)

 

Implementation of abstract method from View.

Overrides: view.View.set_visible_job

on_add_job(self, job)

 

Add a single job to the list.

Overrides: jobs.JobManagerListener.on_add_job

on_remove_job(self, job)

 

A job is removed from the manager, so remove it from the list.

Overrides: jobs.JobManagerListener.on_remove_job

on_job_output(self, job)

 
Overrides: jobs.JobListener.on_job_output

on_job_terminate(self, job)

 
Overrides: jobs.JobListener.on_job_terminate

on_job_raw_output(self, job, text, channel)

 
Overrides: jobs.JobListener.on_job_raw_output

_load_job(self)

 

Ask the job manager to load a new job on disk, which will be inserted at the front of the list. Return the loaded job or None.

_set_curjob(self, newjob=None, next=False, prev=False, dispmode='')

 

Update the current job and related state.

dispmode takes one of the following values to define how the display position should be updated:

  • "" - Don't update the display position.
  • "tail" - Show the tail of the new current job.
  • "head" - Show the head of the new current job.
  • "still" - Update display position to keep the screen as still as possible.
Parameters:
  • newjob (integer) - The new current job as in index into self.jobs or None.
  • next (boolean) - True to use the job after current job instead of newjob
  • prev (boolean) - True to use the job before current job instead of newjob
  • dispmode (string) - How to update display position.

current_job(self)

 

Return the current job as a hsh.jobs.Job object.

Overrides: view.View.current_job

set_current_job(self, job)

 

Update the list's current job to the given hsh.jobs.Job object, and change display position so it's visible. If the job object isn't in the list, set the current job to None.

get_predecessor(self, job)

 

Given a job, fetch one from the list which falls before it based on jobid. Return None if no predecessor could be found. Load jobs from disk if needed.

get_successor(self, job)

 

Given a job, fetch one from the list which falls after it based on jobid. Return None if no successor could be found. Load jobs from disk if needed.

draw_cursor(self, win)

 

Draw cursor at the current job.

Overrides: view.View.draw_cursor

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_search(self, pattern, forward=True, from_end=False)

 

Update the display position so the next match of the given pattern is visible.

Overrides: view.View.move_search

move_up(self, ki)

 
Overrides: view.View.move_up

move_down(self, ki)

 
Overrides: view.View.move_down

page_up(self, ki)

 
Overrides: view.View.page_up

page_down(self, ki)

 
Overrides: view.View.page_down

next_job(self, ki)

 
Overrides: view.View.next_job

prev_job(self, ki)

 
Overrides: view.View.prev_job

restart_job(self, ki)

 
Overrides: view.View.restart_job

edit_job(self, ki)

 
Overrides: view.View.edit_job

delete_job(self, ki)

 
Overrides: view.View.delete_job

toggle_wrap(self, ki)

 
Overrides: view.View.toggle_wrap