Package Gnumed :: Package timelinelib :: Package wxgui :: Module component |
[frames] | no frames]

# Source Code for Module Gnumed.timelinelib.wxgui.component

     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  import wx
    20
    21  from timelinelib.db import db_open
    22  from timelinelib.wxgui.dialogs.mainframe import TimelinePanel
    23
    24
    25 -class DummyConfig(object):
    26
    27 -    def __init__(self):
    28          self.window_size = (100, 100)
    29          self.window_pos = (100, 100)
    30          self.window_maximized = False
    31          self.show_sidebar = True
    32          self.show_legend = True
    33          self.sidebar_width = 200
    34          self.recently_opened = []
    35          self.open_recent_at_startup = False
    36          self.balloon_on_hover = True
    37          self.week_start = "monaday"
    38          self.use_wide_date_range = False
    39          self.use_inertial_scrolling = False
    40
    43
    46
    47 -    def get_show_legend(self):
    48          return self.show_legend
    49
    50 -    def get_balloon_on_hover(self):
    51          return self.balloon_on_hover
    52
    53
    54 -class DummyStatusBarAdapter(object):
    55
    56 -    def set_text(self, text):
    57          pass
    58
    59 -    def set_hidden_event_count_text(self, text):
    60          pass
    61
    62 -    def set_read_only_text(self, text):
    63          pass
    64
    65
    66 -class DummyMainFrame(object):
    67
    68 -    def enable_disable_menus(self):
    69          pass
    70
    71
    72 -class TimelineComponent(TimelinePanel):
    73
    74 -    def __init__(self, parent):
    75          TimelinePanel.__init__(
    76              self, parent, DummyConfig(), self.handle_db_error,
    77              DummyStatusBarAdapter(), DummyMainFrame())
    78          self.activated()
    79
    80 -    def handle_db_error(self, e):
    81          pass
    82
    83 -    def open_timeline(self, path):
    84          timeline = db_open(path)
    85          self.drawing_area.set_timeline(timeline)
    86          self.sidebar.cattree.initialize_from_timeline_view(self.drawing_area)
    87
    88 -    def clear_timeline(self):
    89          self.drawing_area.set_timeline(None)
    90          self.sidebar.cattree.initialize_from_timeline_view(self.drawing_area)
    91