Author: dmeyer
Date: Mon Apr 23 19:36:51 2007
New Revision: 9499
Modified:
trunk/ui/src/application/__init__.py
trunk/ui/src/application/handler.py
trunk/ui/src/input/__init__.py
trunk/ui/src/input/plugins/interface.py
trunk/ui/src/menu/__init__.py
Log:
move input mapping around and add some doc
Modified: trunk/ui/src/application/__init__.py
==============================================================================
--- trunk/ui/src/application/__init__.py (original)
+++ trunk/ui/src/application/__init__.py Mon Apr 23 19:36:51 2007
@@ -4,6 +4,11 @@
# -----------------------------------------------------------------------------
# $Id$
#
+# Import information. This module depends on the following freevo.ui modules:
+# freevo.ui.event for the event definitions
+# freevo.ui.menu for the MenuWidget
+# freevo.ui.gui for gui callbacks
+#
# -----------------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2005-2007 Dirk Meyer, et al.
@@ -42,5 +47,11 @@
"""
return _handler.get_active()
+def get_eventmap():
+ """
+ Return current eventmap.
+ """
+ return _handler.eventmap
+
# signals defined by the application base code
signals = _handler.signals
Modified: trunk/ui/src/application/handler.py
==============================================================================
--- trunk/ui/src/application/handler.py (original)
+++ trunk/ui/src/application/handler.py Mon Apr 23 19:36:51 2007
@@ -45,7 +45,6 @@
import kaa.notifier
# freevo imports
-from freevo.ui.input import set_mapping
from freevo.ui.event import TOGGLE_APPLICATION
# the logging object
@@ -72,6 +71,8 @@
self.applications = []
self.current = None
self.windows = []
+ self.eventmap = None
+
# callback for events
kaa.notifier.EventHandler(self.handle).register()
@@ -90,7 +91,7 @@
if self.windows:
focus = self.windows[-1]
log.info('set focus to %s' % focus)
- set_mapping(focus.eventmap)
+ self.eventmap = focus.eventmap
if app == self.current:
# same app as before
Modified: trunk/ui/src/input/__init__.py
==============================================================================
--- trunk/ui/src/input/__init__.py (original)
+++ trunk/ui/src/input/__init__.py Mon Apr 23 19:36:51 2007
@@ -1,19 +1,41 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------------
+# input - Input Submodule
+# -----------------------------------------------------------------------------
+# $Id$
+#
+# This module does not import anything from Freevo, plugins do. This module
+# is very ugly. The EVENTMAP should not be defined here in one big file, each
+# application should define it's own list of events. This means the video, dvd
+# and vcd eventmap should be defined in the video submodule.
+# The global eventmap variable could be in application. But application needs
+# menu right now and menu needs the eventmap for menu mapping. This needs to
+# be made clean.
+#
+# -----------------------------------------------------------------------------
+# Freevo - A Home Theater PC framework
+# Copyright (C) 2005-2007 Dirk Meyer, et al.
+#
+# First Edition: Dirk Meyer <[EMAIL PROTECTED]>
+# Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
+#
+# Please see the file AUTHORS for a complete list of authors.
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
+# CHANTABILITY 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
+#
+# -----------------------------------------------------------------------------
+
from keymap import KEYBOARD_MAP, REMOTE_MAP, DIRECTFB_MAP
from eventmap import EVENTMAP
-
-# set key mapping for input
-_mapping = None
-
-def set_mapping(mapping):
- """
- Set new key mapping.
- """
- global _mapping
- _mapping = mapping
-
-
-def get_mapping():
- """
- Get current key mapping.
- """
- return _mapping
Modified: trunk/ui/src/input/plugins/interface.py
==============================================================================
--- trunk/ui/src/input/plugins/interface.py (original)
+++ trunk/ui/src/input/plugins/interface.py Mon Apr 23 19:36:51 2007
@@ -38,9 +38,10 @@
# freevo imports
from freevo import plugin
-from freevo.ui import input
from freevo.ui import config
+from freevo.ui.input import EVENTMAP
from freevo.ui.event import Event
+from freevo.ui.application import get_eventmap
# get logging object
log = logging.getLogger('input')
@@ -56,7 +57,7 @@
Create eventmap on activate. FIXME: changing the setting during
runtime has no effect.
"""
- self.eventmap = copy.deepcopy(input.EVENTMAP)
+ self.eventmap = copy.deepcopy(EVENTMAP)
for app, mapping in config.input.eventmap.items():
for key, command in mapping.items():
self.eventmap[app][key] = Event(*command.split(' '))
@@ -69,7 +70,7 @@
if not key:
return None
- for c in (input.get_mapping(), 'global'):
+ for c in (get_eventmap(), 'global'):
if not self.eventmap.has_key(c):
continue
if not self.eventmap[c].has_key(key):
@@ -77,4 +78,4 @@
return self.eventmap[c][key].post(event_source='user')
- log.warning('no event mapping for key %s in %s' % (key,
input.get_mapping()))
+ log.warning('no event mapping for key %s in %s' % (key,
get_eventmap()))
Modified: trunk/ui/src/menu/__init__.py
==============================================================================
--- trunk/ui/src/menu/__init__.py (original)
+++ trunk/ui/src/menu/__init__.py Mon Apr 23 19:36:51 2007
@@ -4,6 +4,10 @@
# -----------------------------------------------------------------------------
# $Id$
#
+# Import information. This module depends on the following freevo.ui modules:
+# freevo.ui.event for the event definitions
+# freevo.ui.config for config.menu.arrow_navigation
+#
# -----------------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2005-2007 Dirk Meyer, et al.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog