Package Gnumed :: Package timelinelib :: Package wxgui :: Package frames :: Package mainframe :: Module menucontroller |
[frames] | no frames]

# Source Code for Module Gnumed.timelinelib.wxgui.frames.mainframe.menucontroller

     1  # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018  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 -class MenuController(object):
    20
    21 -    def __init__(self):
    22          self.current_timeline = None
    23          self._has_timeline = False
    24          self.menus_requiring_timeline = []
    25          self.menus_requiring_writable_timeline = []
    26          self.menus_requiring_visible_timeline_view = []
    27
    28 -    def on_timeline_change(self, timeline):
    29          self.current_timeline = timeline
    30          self._has_timeline = self.current_timeline is not None
    31
    34
    37
    40
    41 -    def enable_disable_menus(self, timeline_view_visible):
    42          for menu in self.menus_requiring_writable_timeline:
    43              self._enable_disable_menu_requiring_writable_timeline(menu)
    44          for menu in self.menus_requiring_timeline:
    45              self._enable_disable_menu_requiring_timeline(menu)
    46          for menu in self.menus_requiring_visible_timeline_view:
    47              self._enable_disable_menu_requiring_visible_timeline_view(menu, timeline_view_visible)
    48
    56
    59
    62