Source code for tagit.controller.main
"""MainWindow and MainWidget controller.
Part of the tagit module.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2016
"""
# IMPORTS
# INNER-MODULE IMPORTS
from controller import Controller, DataController
from ..bindings import Binding
# EXPORTS
__all__ = ('CMainWindow', 'CMainWidget')
## CODE ##
[docs]class CMainWindow(Controller):
"""MainWindow controller.
Receives the key events and passes them on.
"""
def on_key_down(self, wx, (code, key), modifiers):
self.dispatch('on_key_down', wx, (code, key), modifiers)
def on_key_up(self, wx, (code, key)):
self.dispatch('on_key_up', wx, (code, key))
def on_keyboard(self, wx, (code, key), modifiers):
evt = ((code, key), modifiers)
if Binding.check(evt, self.settings.trace('bindings', 'app', 'show_help', Binding.simple(Binding.SLASH, [Binding.SHIFT]))):
printable = Binding.printable(self.settings['bindings'])
self.widget.display_keybindings(printable)
return True
self.dispatch('on_keyboard', wx, evt)
[docs]class CMainWidget(DataController): pass # Just needs to be there to store the data.
## EOF ##