Gnumed.timelinelib.db.objects.container

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

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

     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  from timelinelib.db.strategies import DefaultContainerStrategy
    21
    22
    23 -class Container(Event):
    24
    25 -    def __init__(self, time_type, start_time, end_time, text, category=None,
    26                   cid=-1):
    27          Event.__init__(self, time_type, start_time, end_time, text, category,
    28                         False, False, False)
    29          self.container_id = cid
    30          self.events = []
    31          self.strategy = DefaultContainerStrategy(self)
    32
    33 -    def is_container(self):
    34          return True
    35
    36 -    def is_subevent(self):
    37          return False
    38
    39 -    def cid(self):
    40          return self.container_id
    41
    42 -    def set_cid(self, cid):
    43          self.container_id = cid
    44
    45 -    def register_subevent(self, subevent):
    46          self.strategy.register_subevent(subevent)
    47
    48 -    def unregister_subevent(self, subevent):
    49          self.strategy.unregister_subevent(subevent)
    50
    51 -    def update_container(self, subevent):
    52          self.strategy.update(subevent)
    53
    54 -    def update_properties(self, text, category=None):
    55          self.text = text
    56          self.category = category
    57