Package bosco :: Module editor :: Class RunEditor
[hide private]
[frames] | no frames]

Class RunEditor

source code

object --+    
         |    
Observable --+
             |
            RunEditor

High level run editor. This class is intended as a model for a (graphical) editing front-end. The editor only edits one run at a time. Runs can be loaded from the database or read from an SI Reader station. If polling the reader is enabled, the edited run may change at any time!

Instance Methods [hide private]
a new object with type S, a subtype of T
__new__(classtype, *args, **kwargs)
Override class creation to ensure that only one RunEditor is instantiated.
source code
 
__init__(self, store, event)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
has_runner(self) source code
 
has_course(self) source code
 
has_run(self) source code
 
_get_runner_name(self) source code
 
runner_name(self) source code
 
_get_runner_number(self) source code
 
runner_number(self) source code
 
_get_runner_team(self) source code
 
runner_team(self) source code
 
_get_runner_sicard(self) source code
 
runner_sicard(self) source code
 
_get_run_id(self) source code
 
run_id(self) source code
 
_get_run_course(self) source code
 
run_course(self) source code
 
_get_run_validation(self) source code
 
run_validation(self) source code
 
_get_run_score(self) source code
 
run_score(self) source code
 
_get_run_override(self) source code
 
run_override(self) source code
 
_get_run_complete(self) source code
 
run_complete(self) source code
 
_get_team_validation(self) source code
 
team_validation(self) source code
 
_get_team_score(self) source code
 
team_score(self) source code
 
_raw_punchlist(self) source code
 
_get_punchlist(self) source code
 
punchlist(self) source code
 
_clear_cache(self) source code
 
get_runnerlist(self) source code
 
get_teamlist(self) source code
 
_create_virtual_sicard(self)
Creates a virtual SI-Card used when no real card number is available.
source code
 
set_runner(self, runner)
Changes the runner of the current run.
source code
 
set_runner_number(self, n, force=False) source code
 
set_runner_category(self, cat_name) source code
 
set_runner_given_name(self, n) source code
 
set_runner_surname(self, n) source code
 
set_runner_dateofbirth(self, d) source code
 
set_runner_team(self, team) source code
 
set_runner_club(self, clubname) source code
 
set_course(self, course) source code
 
set_override(self, override) source code
 
set_complete(self, complete) source code
 
parse_time(self, time) source code
 
set_manual_start_time(self, time) source code
 
set_manual_finish_time(self, time) source code
 
set_punchtime(self, punch, time) source code
 
set_ignore(self, punch, ignore) source code
 
load(self, run)
Loads a run into the editor.
source code
 
new(self, si_nr=None)
Create a new empty run.
source code
 
new_from_reader(self)
Creates a new empty run for the card currently inserted into the reader.
source code
 
delete(self)
Deletes the current run.
source code
 
commit(self)
Commit changes to the database.
source code
 
rollback(self)
Rollback all changes.
source code
 
_get_port(self) source code
 
port(self) source code
 
_get_status(self) source code
 
status(self) source code
 
_get_progress(self) source code
 
_set_progress(self, msg) source code
 
_get_sicard(self) source code
 
sicard(self) source code
 
_get_sicard_runner(self) source code
 
sicard_runner(self) source code
 
print_run(self) source code
 
connect_reader(self, port=None)
Connect an SI-Reader
source code
 
poll_reader(self)
Polls the sireader for changes.
source code
 
load_run_from_card(self)
Read out card data and create or load a run based on this data.
source code
 
_compare_run(self, run, card_data)
Compares run to card_data
source code
 
set_print_command(self, command) source code

Inherited from Observable: add_observer, remove_observer

Inherited from Observable (private): _notify_observers

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

Static Methods [hide private]
 
_format_time(time, date=True) source code
Class Variables [hide private]
  _station_codes = {SIStation.START: 'start', SIStation.FINISH: ...
  max_progress = 7
  __single = None
  __initialized = False
  run_readout_time = property(lambda obj: obj._run and obj._run....
  run_clear_time = property(lambda obj: obj._run and obj._run.cl...
  run_check_time = property(lambda obj: obj._run and obj._run.ch...
  run_card_start_time = property(lambda obj: obj._run and obj._r...
  run_manual_start_time = property(lambda obj: obj._run and obj....
  run_start_time = property(lambda obj: obj._run and obj._run.st...
  run_card_finish_time = property(lambda obj: obj._run and obj._...
  run_manual_finish_time = property(lambda obj: obj._run and obj...
  run_finish_time = property(lambda obj: obj._run and obj._run.f...
  runner_given_name = property(lambda obj: obj._run and obj._run...
  runner_surname = property(lambda obj: obj._run and obj._run.si...
  runner_dateofbirth = property(lambda obj: obj._run and obj._ru...
  runner_club = property(lambda obj: obj._run and obj._run.sicar...
  runner_category = property(lambda obj: obj._run and obj._run.s...
  print_command = property(lambda x: x._print_command)
  progress = property(_get_progress, _set_progress)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(classtype, *args, **kwargs)

source code 

Override class creation to ensure that only one RunEditor is instantiated.

Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__init__(self, store, event)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • store - Storm store of the runs
  • event - object of class (or subclass of) Event. This is used for run and team validation
Overrides: object.__init__

Note: Later "instantiations" of this singleton discard all arguments.

set_runner(self, runner)

source code 

Changes the runner of the current run. If no runner is found the run is disconnected from the current runner. If the current runner has multiple runs, a "virtual" sicard is created.

Parameters:
  • runner - ID of the new runner

load(self, run)

source code 

Loads a run into the editor. All uncommited changes to the previously loaded run will be lost!

Parameters:
  • run - run id

new(self, si_nr=None)

source code 

Create a new empty run. This rolls back any uncommited changes!

Parameters:
  • si_nr - number of the SI-Card

new_from_reader(self)

source code 

Creates a new empty run for the card currently inserted into the reader. If an open run for this card already exists, this run is loaded and no new run created.

connect_reader(self, port=None)

source code 

Connect an SI-Reader

Parameters:
  • port - serial port name, default autodetected

_compare_run(self, run, card_data)

source code 

Compares run to card_data

Returns:
True if card_data matches run, False otherwise

Class Variable Details [hide private]

_station_codes

Value:
{SIStation.START: 'start', SIStation.FINISH: 'finish', SIStation.CHECK\
: 'check', SIStation.CLEAR: 'clear'}

run_readout_time

Value:
property(lambda obj: obj._run and obj._run.readout_time and RunEditor.\
_format_time(obj._run.readout_time) or 'unknown')

run_clear_time

Value:
property(lambda obj: obj._run and obj._run.clear_time and RunEditor._f\
ormat_time(obj._run.clear_time) or 'unknown')

run_check_time

Value:
property(lambda obj: obj._run and obj._run.check_time and RunEditor._f\
ormat_time(obj._run.check_time) or 'unknown')

run_card_start_time

Value:
property(lambda obj: obj._run and obj._run.card_start_time and RunEdit\
or._format_time(obj._run.card_start_time) or 'unknown')

run_manual_start_time

Value:
property(lambda obj: obj._run and obj._run.manual_start_time and RunEd\
itor._format_time(obj._run.manual_start_time) or '')

run_start_time

Value:
property(lambda obj: obj._run and obj._run.start_time and RunEditor._f\
ormat_time(obj._run.start_time) or 'unknown')

run_card_finish_time

Value:
property(lambda obj: obj._run and obj._run.card_finish_time and RunEdi\
tor._format_time(obj._run.card_finish_time) or 'unknown')

run_manual_finish_time

Value:
property(lambda obj: obj._run and obj._run.manual_finish_time and RunE\
ditor._format_time(obj._run.manual_finish_time) or '')

run_finish_time

Value:
property(lambda obj: obj._run and obj._run.finish_time and RunEditor._\
format_time(obj._run.finish_time) or 'unknown')

runner_given_name

Value:
property(lambda obj: obj._run and obj._run.sicard.runner and obj._run.\
sicard.runner.given_name or '')

runner_surname

Value:
property(lambda obj: obj._run and obj._run.sicard.runner and obj._run.\
sicard.runner.surname or '')

runner_dateofbirth

Value:
property(lambda obj: obj._run and obj._run.sicard.runner and obj._run.\
sicard.runner.dateofbirth and obj._run.sicard.runner.dateofbirth.strft\
ime('%x') or '')

runner_club

Value:
property(lambda obj: obj._run and obj._run.sicard.runner and obj._run.\
sicard.runner.club and obj._run.sicard.runner.club.name or '')

runner_category

Value:
property(lambda obj: obj._run and obj._run.sicard.runner and obj._run.\
sicard.runner.category and obj._run.sicard.runner.category.name or '')