2008-11-27 20:09:11 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80
|
|
|
|
"""
|
|
|
|
OpenLP - Open Source Lyrics Projection
|
|
|
|
Copyright (c) 2008 Raoul Snyman
|
2009-03-22 07:13:34 +00:00
|
|
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri,
|
2008-11-27 20:09:11 +00:00
|
|
|
Carsten Tingaard, Jonathan Corwin
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; version 2 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
"""
|
|
|
|
|
|
|
|
class EventType(object):
|
|
|
|
"""
|
|
|
|
Types of events are stored in this class.
|
|
|
|
"""
|
|
|
|
# "Default" event - a non-event
|
|
|
|
Default = 0
|
|
|
|
# General application events
|
|
|
|
InitApplication = -1
|
|
|
|
ShowApplication = -2
|
|
|
|
BeforeAppClose = -3
|
|
|
|
ApplicationClose = -4
|
|
|
|
# Service events
|
|
|
|
BeforeLoadService = 1
|
|
|
|
AfterLoadService = 2
|
|
|
|
BeforeSaveService = 3
|
|
|
|
AfterSaveService = 4
|
|
|
|
# Preview events
|
|
|
|
PreviewBeforeLoad = 11
|
|
|
|
PreviewAfterLoad = 12
|
|
|
|
PreviewBeforeShow = 13
|
|
|
|
PreviewAfterShow = 14
|
|
|
|
|
2009-04-06 18:45:45 +00:00
|
|
|
ThemeListChanged = 15
|
|
|
|
|
2008-11-27 20:09:11 +00:00
|
|
|
|
|
|
|
class Event(object):
|
|
|
|
"""
|
|
|
|
Provides an Event class to encapsulate events within openlp.org.
|
|
|
|
"""
|
2009-03-23 20:18:06 +00:00
|
|
|
def __init__(self, event_type=EventType.Default, payload=None):
|
|
|
|
self.event_type = event_type
|
2009-03-22 07:13:34 +00:00
|
|
|
self.payload = payload
|
2009-04-06 18:45:45 +00:00
|
|
|
|
2009-03-22 07:13:34 +00:00
|
|
|
def get_type(self):
|
2009-03-23 20:18:06 +00:00
|
|
|
return self.event_type
|