Gnumed.timelinelib.db.objects.subevent

Package Gnumed :: Package timelinelib :: Package db :: Package objects :: Module subevent |
[frames] | no frames]

# Source Code for Module Gnumed.timelinelib.db.objects.subevent

     1  # Copyright (C) 2009, 2010, 2011  Rickard Lindberg, Roger Lindberg
     2  #
     3  # This file is part of Timeline.
     4  #
     5  # Timeline is free software: you can redistribute it and/or modify
     6  # it under the terms of the GNU General Public License as published by
     7  # the Free Software Foundation, either version 3 of the License, or
     8  # (at your option) any later version.
     9  #
    10  # Timeline is distributed in the hope that it will be useful,
    11  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13  # GNU General Public License for more details.
    14  #
    15  # You should have received a copy of the GNU General Public License
    16  # along with Timeline.  If not, see <http://www.gnu.org/licenses/>.
    17
    18
    19  from timelinelib.db.objects.event import Event
    20
    21
    22 -class Subevent(Event):
    23
    24 -    def __init__(self, time_type, start_time, end_time, text, category=None,
    25                   container=None, cid=-1):
    26          Event.__init__(self, time_type, start_time, end_time, text, category,
    27                         False, False, False)
    28          self.container = container
    29          if self.container != None:
    30              self.container_id = self.container.cid()
    31          else:
    32              self.container_id = cid
    33
    34 -    def is_container(self):
    35          """Overrides parent method."""
    36          return False
    37
    38 -    def is_subevent(self):
    39          """Overrides parent method."""
    40          return True
    41
    42 -    def update_period(self, start_time, end_time):
    43          """Overrides parent method."""
    44          Event.update_period(self, start_time, end_time)
    45          self.container.update_container(self)
    46
    47 -    def update_period_o(self, new_period):
    48          """Overrides parent method."""
    49          Event.update_period(self, new_period.start_time, new_period.end_time)
    50          self.container.update_container(self)
    51
    52 -    def cid(self):
    53          return self.container_id
    54
    55 -    def register_container(self, container):
    56          self.container = container
    57          self.container_id = container.cid()
    58