Author: dmeyer
Date: Wed Feb 7 19:20:06 2007
New Revision: 9171
Added:
trunk/ui/src/audio/config.cxml
trunk/ui/src/audio/plugins/config.cxml
trunk/ui/src/config.cxml
trunk/ui/src/gui/config.cxml
trunk/ui/src/image/config.cxml
trunk/ui/src/plugins/config.cxml
trunk/ui/src/video/config.cxml
Modified:
trunk/ui/bin/freevo
trunk/ui/setup.py
trunk/ui/share/freevo_config.py
trunk/ui/src/audio/interface.py
trunk/ui/src/config.py
trunk/ui/src/gui/areas/area.py
trunk/ui/src/gui/compat.py
trunk/ui/src/gui/displays/__init__.py
trunk/ui/src/gui/displays/dfb.py
trunk/ui/src/gui/displays/fb.py
trunk/ui/src/gui/displays/imlib2.py
trunk/ui/src/gui/font.py
trunk/ui/src/gui/theme.py
trunk/ui/src/gui/windows/inputbox.py
trunk/ui/src/gui/windows/waitbox.py
trunk/ui/src/image/fxdhandler.py
trunk/ui/src/image/imageitem.py
trunk/ui/src/image/interface.py
trunk/ui/src/image/viewer.py
trunk/ui/src/input/plugins/dfbevents.py
trunk/ui/src/plugins/idlebar/__init__.py
trunk/ui/src/plugins/mediamenu.py
trunk/ui/src/plugins/osd.py
trunk/ui/src/plugins/shutdown.py
trunk/ui/src/video/interface.py
trunk/ui/src/video/videoitem.py
Log:
switch some config variables to kaa.config style
Modified: trunk/ui/bin/freevo
==============================================================================
--- trunk/ui/bin/freevo (original)
+++ trunk/ui/bin/freevo Wed Feb 7 19:20:06 2007
@@ -95,7 +95,7 @@
import freevo
from freevo.ui import config
- if config.GUI_DISPLAY == 'SDL':
+ if config.config.gui.display.engine.lower() == 'sdl':
import pygame
except ImportError, i:
@@ -121,7 +121,7 @@
return True
lirc.stop()
options = ''
- if config.GUI_DISPLAY in ( 'imlib2', ) and not \
+ if config.config.gui.display.engine.lower() in ( 'imlib2', ) and not \
(os.environ.has_key('DISPLAY') and os.environ['DISPLAY']):
options = '-fs'
log.info('start freevo %s', options)
@@ -223,7 +223,7 @@
"""
fade out
"""
- self.engine.hide(config.GUI_FADE_STEPS)
+ self.engine.hide(config.config.gui.theme.fadestep)
def destroy(self):
@@ -242,9 +242,9 @@
# force fullscreen mode
# deactivate screen blanking and set osd to fullscreen
- if sys.argv[1] == '-force-fs':
+ if '-force-fs' in sys.argv[1]:
os.system('xset -dpms s off')
- config.GUI_FULLSCREEN = 1
+ displays.fullscreen = True
try:
freevo.ipc.Instance('freevo', **config.MBUS_ADDR)
Modified: trunk/ui/setup.py
==============================================================================
--- trunk/ui/setup.py (original)
+++ trunk/ui/setup.py Wed Feb 7 19:20:06 2007
@@ -6,12 +6,12 @@
#
# -----------------------------------------------------------------------------
# Freevo - A Home Theater PC framework
-# Copyright (C) 2002-2005 Krister Lagerstrom, Dirk Meyer, et al.
+# Copyright (C) 2002 Krister Lagerstrom, 2003-2007 Dirk Meyer, et al.
#
# First Edition: Dirk Meyer <[EMAIL PROTECTED]>
# Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
#
-# Please see the file doc/CREDITS for a complete list of authors.
+# 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
@@ -29,14 +29,38 @@
#
# -----------------------------------------------------------------------------
+# python imports
+import sys
+import os
+import stat
+
# Freevo distutils stuff
from freevo.distribution import setup, VERSION
+import freevo.conf
data_files = []
# add some files to Docs
for f in ('COPYING', 'ChangeLog', 'INSTALL', 'README'):
data_files.append(('share/doc/freevo-%s' % VERSION, ['%s' % f ]))
+if len(sys.argv) > 1 and not '--help' in sys.argv and \
+ not '--help-commands' in sys.argv:
+ def cxml_finder(result, dirname, names):
+ for name in names:
+ if name.endswith('.cxml'):
+ result.append(os.path.join(dirname, name))
+ return result
+ cxml_files = []
+ os.path.walk('./src', cxml_finder, cxml_files)
+ if not os.path.isfile('build/config.cxml') or \
+ os.stat('build/config.cxml')[stat.ST_MTIME] < \
+ max(*[os.stat(x)[stat.ST_MTIME] for x in cxml_files ]):
+ if not os.path.isdir('build'):
+ os.mkdir('build')
+ freevo.conf.xmlconfig('build/config.cxml', cxml_files)
+
+ data_files.append(('share/freevo/config', [ 'build/config.cxml' ]))
+
# now start the python magic
setup (name = 'freevo',
version = VERSION,
Modified: trunk/ui/share/freevo_config.py
==============================================================================
--- trunk/ui/share/freevo_config.py (original)
+++ trunk/ui/share/freevo_config.py Wed Feb 7 19:20:06 2007
@@ -73,16 +73,6 @@
# Items in the main menu.
plugin.activate('tv', level=10)
-plugin.activate('video', level=20)
-plugin.activate('audio', level=30)
-plugin.activate('image', level=40)
-plugin.activate('shutdown', level=50)
-
-# shutdown plugin config
-SHUTDOWN_CONFIRM = True # ask before shutdown
-SHUTDOWN_SYS_CMD = 'shutdown -h now' # or 'sudo shutdown -h now'
-RESTART_SYS_CMD = 'shutdown -r now' # like SHUTDOWN_SYS_CMD, only for reboot
-SHUTDOWN_SYS_DEFAULT = False # Performs a whole system shutdown at
SHUTDOWN!
# Audio Mixer
MIXER_MAJOR_AUDIO_CTRL = 'VOL' # 'VOL', 'PCM' 'OGAIN' etc.
@@ -193,193 +183,6 @@
# ======================================================================
-# Freevo movie settings:
-# ======================================================================
-
-#
-# Where the movie files can be found.
-# This is a list of items (e.g. directories, fxd files). The items themselves
-# can also be a list of (title, file)
-#
-# Example: VIDEO_ITEMS = [ ('action movies', '/files/movies/action'),
-# ('funny stuff', '/files/movies/comedy') ]
-#
-# Some people access movies on a different machine using an automounter.
-# To avoid timeouts, you can specify the machine name in the directory
-# to check if the machine is alive first
-# Directory myserver:/files/server-stuff will show the item for the
-# directory /files/server-stuff if the computer myserver is alive.
-#
-VIDEO_ITEMS = None
-
-#
-# The list of filename suffixes that are used to match the files that
-# are played wih MPlayer.
-#
-VIDEO_SUFFIX = [ 'avi', 'mpg', 'mpeg', 'wmv', 'bin', 'rm',
- 'divx', 'ogm', 'vob', 'asf', 'm2v', 'm2p',
- 'mp4', 'viv', 'nuv', 'mov', 'iso',
- 'nsv', 'mkv', 'ts', 'rmvb', 'cue' ]
-
-#
-# Config for xml support in the movie browser
-# the regexp has to be with ([0-9]|[0-9][0-9]) so we can get the numbers
-#
-VIDEO_SHOW_REGEXP = "s?([0-9]|[0-9][0-9])[xe]([0-9]|[0-9][0-9])[^0-9]"
-
-
-# ======================================================================
-# Freevo audio settings:
-# ======================================================================
-
-#
-# Where the Audio (mp3, ogg) files can be found.
-# This is a list of items (e.g. directories, fxd files). The items itself
-# can also be a list of (title, file)
-#
-# To add webradio support, add fxd/webradio.fxd to this list
-#
-AUDIO_ITEMS = None
-
-#
-# The list of filename suffixes that are used to match the files that
-# are played as audio.
-#
-AUDIO_SUFFIX = [ 'mp3', 'ogg', 'wav','m4a', 'wma', 'aac', 'flac', 'mka',
- 'ac3' ]
-
-#
-# Show video files in the audio menu (for music-videos)
-#
-AUDIO_SHOW_VIDEOFILES = False
-
-plugin.activate('audio.artist')
-
-# ======================================================================
-# Freevo image viewer settings:
-# ======================================================================
-
-#
-# Where image files can be found.
-# This is a list of items (e.g. directories, fxd files). The items itself
-# can also be a list of (title, file)
-#
-IMAGE_ITEMS = None
-
-#
-# The list of filename suffixes that are used to match the files that
-# are used for the image viewer.
-#
-IMAGE_SUFFIX = [ 'jpg','gif','png', 'jpeg','bmp','tiff','psd' ]
-
-
-#
-# Mode of the blending effect in the image viewer between two images
-# Possible values are:
-#
-# None: no blending
-# -1 random effect
-# 0 alpha blending
-# 1 wipe effect
-#
-IMAGEVIEWER_BLEND_MODE = -1
-
-#
-# What information to display by pressing DISPLAY.
-# You can add as many lists as you want and the viewer will toggle
-# between no osd and the lists.
-#
-# Warning: this list may change in future versions of Freevo to support
-# nice stuff like line breaks.
-#
-IMAGEVIEWER_OSD = [
- # First OSD info
- [ (_('Title')+': ', 'name'),
- (_('Description')+': ','description'),
- (_('Author')+': ', 'author') ],
-
- # Second OSD info
- [ (_('Title')+': ', 'name'),
- (_('Date')+': ' , 'date'),
- ('W:', 'width'),
- ('H:', 'height'),
- (_('Model')+': ', 'hardware'),
- (_('Software')+': ', 'software') ]
- ]
-
-
-#
-# Default duration for images in a playlist. If set to 0, you need
-# to press a button to get to the next image, a value > 0 is the time
-# in seconds for an auto slideshow
-#
-IMAGEVIEWER_DURATION = 0
-
-# ======================================================================
-# Freevo GUI settings:
-# ======================================================================
-
-#
-# GUI default font. It is only used for debug/error stuff, not regular
-# skinning.
-#
-GUI_FONT_DEFAULT_NAME = 'Vera'
-GUI_FONT_DEFAULT_SIZE = 18
-
-#
-# System Path to search for fonts not included in the Freevo distribution
-#
-GUI_FONT_PATH = [ '/usr/X11R6/lib/X11/fonts/truetype/' ]
-
-#
-# Font aliases
-# All names must be lowercase! All alternate fonts must be in './share/fonts/'
-#
-GUI_FONT_ALIASES = { 'Arial_Bold' : 'VeraBd' }
-
-#
-# Overscan on the tv output. Set this values if you can't see everything
-# from Freevo on the tv screen.
-#
-GUI_OVERSCAN_X = 0
-GUI_OVERSCAN_Y = 0
-
-#
-# Output display to use. Possible values are SDL (using pygame),
-# Imlib2 (X only) and fb (framebuffer).
-#
-GUI_DISPLAY = 'imlib2'
-
-#
-# Special settings for fb display
-#
-GUI_DISPLAY_FB_NORM = 'pal' # pal or ntsc
-GUI_DISPLAY_FB_MODE = '' # set to 'mga' for special G400 support
-
-#
-# Window / Display size
-#
-GUI_WIDTH = 800
-GUI_HEIGHT = 600
-
-
-#
-# Fade steps on application change.
-#
-GUI_FADE_STEPS = 10
-
-#
-# XML file for the skin. If GUI_XML_FILE is set, this skin will be
-# used, otherwise the skin will rememeber the last choosen skin.
-#
-GUI_XML_FILE = 'blurr'
-
-GUI_DFB_LAYER = 0
-
-# start GUI in fullscreen mode
-GUI_FULLSCREEN = False
-
-# ======================================================================
# Freevo remote control settings:
# ======================================================================
Added: trunk/ui/src/audio/config.cxml
==============================================================================
--- (empty file)
+++ trunk/ui/src/audio/config.cxml Wed Feb 7 19:20:06 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<config name="audio" plugin="30">
+ <desc lang="en">audio configuration</desc>
+ <list name="items">
+ <desc>
+ Set audio items for the media menu. This is a list with path
+ and name. To set the subdir audio in your home directory and
+ /audio write
+
+ audio.items[0].path = $(HOME)/audio
+ audio.items[0].name = My Music
+ audio.items[1].path = /audio
+ audio.items[1].name = More Music
+ </desc>
+ <var name="path" type="str">
+ <desc>Path of the directory / file.</desc>
+ </var>
+ <var name="name" type="unicode">
+ <desc>Name in the mediamenu</desc>
+ </var>
+ </list>
+ <var name="suffix" default="mp3,ogg,wav,m4a,wma,aac,flac,mka,ac3">
+ <desc>Comma seperated list of audio suffixes.</desc>
+ </var>
+ <var name="include-video" default="False">
+ <!-- FIXME: not used -->
+ <desc>Include video files in audio listing (e.g. music videos)</desc>
+ </var>
+</config>
Modified: trunk/ui/src/audio/interface.py
==============================================================================
--- trunk/ui/src/audio/interface.py (original)
+++ trunk/ui/src/audio/interface.py Wed Feb 7 19:20:06 2007
@@ -45,7 +45,8 @@
import stat
# Freevo imports
-from freevo.ui import config, util, plugin, fxditem
+from freevo.ui import util, plugin, fxditem
+from freevo.ui.config import config
from freevo.ui.menu import MediaPlugin
# AudioItem
@@ -69,7 +70,7 @@
fxditem.add_parser(['audio'], 'audio', fxdhandler)
# activate the mediamenu for audio
- args = _('Audio Main Menu'), 'audio', config.AUDIO_ITEMS
+ args = _('Audio Main Menu'), 'audio', config.audio.items
plugin.activate('mediamenu', level=level, args=args)
@@ -77,7 +78,7 @@
"""
return the list of suffixes this class handles
"""
- return [ 'beacon:audio' ] + config.AUDIO_SUFFIX
+ return [ 'beacon:audio' ] + config.audio.suffix.split(',')
def get(self, parent, listing):
Added: trunk/ui/src/audio/plugins/config.cxml
==============================================================================
--- (empty file)
+++ trunk/ui/src/audio/plugins/config.cxml Wed Feb 7 19:20:06 2007
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<config name="">
+ <desc lang="en">Freevo Config</desc>
+ <group name="directory">
+ <desc>Directory view configuration</desc>
+ </group>
+</config>
Added: trunk/ui/src/config.cxml
==============================================================================
--- (empty file)
+++ trunk/ui/src/config.cxml Wed Feb 7 19:20:06 2007
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<config name="audio.plugin">
+ <desc lang="en">audio plugins</desc>
+ <group name="artist" plugin="10">
+ <desc>Show audio files sorted by artist and album</desc>
+ </group>
+</config>
Modified: trunk/ui/src/config.py
==============================================================================
--- trunk/ui/src/config.py (original)
+++ trunk/ui/src/config.py Wed Feb 7 19:20:06 2007
@@ -4,27 +4,14 @@
# -----------------------------------------------------------------------------
# $Id$
#
-# Try to find the freevo_config.py config file in the following places:
-# 1) ./freevo_config.py Defaults from the freevo dist
-# 2) ~/.freevo/freevo_config.py The user's private config
-# 3) /etc/freevo/freevo_config.py Systemwide config
-#
-# Customize freevo_config.py from the freevo dist and copy it to one
-# of the other places where it will not get overwritten by new
-# checkouts/installs of freevo.
-#
-# The format of freevo_config.py might change, in that case you'll
-# have to update your customized version.
-#
-# Note: this file needs a huge cleanup!!!
-#
# -----------------------------------------------------------------------------
# Freevo - A Home Theater PC framework
-# Copyright (C) 2002-2005 Krister Lagerstrom, Dirk Meyer, et al.
+# Copyright (C) 2002 Krister Lagerstrom, 2003-2007 Dirk Meyer, et al.
#
# First Edition: Krister Lagerstrom <[EMAIL PROTECTED]>
+# Maintainer: Dirk Meyer <[EMAIL PROTECTED]>
#
-# Please see the file doc/CREDITS for a complete list of authors.
+# 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
@@ -45,10 +32,7 @@
# python imports
import sys
import os
-import re
-import pwd
import logging
-import copy
import kaa.strutils
import kaa.popcorn
@@ -64,24 +48,32 @@
# get logging object
log = logging.getLogger('config')
-kaa.popcorn.config.load('/etc/freevo/player.conf')
-# if started as user add personal config file
-if os.getuid() > 0:
- cfgdir = os.path.expanduser('~/.freevo')
- kaa.popcorn.config.load(os.path.join(cfgdir, 'player.conf'))
-
-# save the file again in case it did not exist or the variables changed
-kaa.popcorn.config.save()
-
-#
-# Read the environment set by the start script
-#
+# generate config
+pycfgfile = freevo.conf.datafile('freevo_config.py')
+cfgdir = os.path.join(freevo.conf.SHAREDIR, 'config')
+cfgsource = [ os.path.join(cfgdir, f) for f in os.listdir(cfgdir) ]
+freevo.conf.xmlconfig(pycfgfile, cfgsource)
+execfile(pycfgfile)
+
+# add external stuff
+config.add_variable('player', kaa.popcorn.config)
+
+# load config
+config.load(os.path.expanduser('~/.freevo/freevo2.conf'), create=True)
+
+# plugins ist a list of known plugins
+for p in plugins:
+ c = config
+ for attr in p.split('.'):
+ c = getattr(c, attr)
+ if c.activate:
+ plugin.activate(p.replace('plugin.', '').replace('..', '.'),
level=c.activate)
+
ICON_DIR = os.path.join(freevo.conf.SHAREDIR, 'icons')
IMAGE_DIR = os.path.join(freevo.conf.SHAREDIR, 'images')
-
#
-# Load freevo_config.py:
+# Load old freevo_config.py:
#
FREEVO_CONFIG = os.path.join(freevo.conf.SHAREDIR, 'freevo_config.py')
if os.path.isfile(FREEVO_CONFIG):
@@ -113,36 +105,3 @@
log.info('Loading cfg overrides: %s' % overridefile)
execfile(overridefile, globals(), locals())
break
-
-else:
- locations = ''
- for dirname in freevo.conf.cfgfilepath:
- locations += ' %s\n' % dirname
- log.critical("""local_conf.py not found
-Freevo is not completely configured to start
-
-The configuration is based on three files. This may sound oversized, but this
-way it's easier to configure. First Freevo loads a file called 'freevo.conf'.
-This file will be generated by 'freevo setup'. Use 'freevo setup --help' to get
-information about the parameter. Based on the informations in that file, Freevo
-will guess some settings for your system. This takes place in a file called
-'freevo_config.py'. Since this file may change from time to time, you should
-not edit this file. After freevo_config.py is loaded, Freevo will look for a
-file called 'local_conf.py'. You can overwrite the variables from
-'freevo_config.py' in here. There is an example for 'local_conf.py' called
-'local_conf.py.example' in the Freevo distribution.
-
-The location of freevo_config.py is %s
-Freevo searches for freevo.conf and local_conf.py in the following locations:
-%s
-
-Since it's highly unlikly you want to start Freevo without further
-configuration, Freevo will exit now.
-""" % (FREEVO_CONFIG, locations))
- sys.exit(0)
-
-#
-# force fullscreen when freevo is it's own windowmanager
-#
-if len(sys.argv) >= 2 and sys.argv[1] == '--force-fs':
- GUI_FULLSCREEN = 1
Modified: trunk/ui/src/gui/areas/area.py
==============================================================================
--- trunk/ui/src/gui/areas/area.py (original)
+++ trunk/ui/src/gui/areas/area.py Wed Feb 7 19:20:06 2007
@@ -53,8 +53,8 @@
import os
# freevo imports
-from freevo.ui import config
from freevo.ui import util
+from freevo.ui.config import config
# gui imports
from freevo.ui.gui.widgets import Rectangle, Text, Textbox, Image
@@ -62,6 +62,9 @@
import logging
log = logging.getLogger('gui')
+# overscan config object
+overscan = config.gui.display.overscan
+
class Area(object):
"""
The base call for all areas. Each class inheriting from Area needs
@@ -236,12 +239,12 @@
if bg.type == 'image' and bg.visible:
# if this is the real background image, ignore the
- # OVERSCAN to fill the whole screen
+ # overscan to fill the whole screen
if bg.label == 'background':
- bg.x -= config.GUI_OVERSCAN_X
- bg.y -= config.GUI_OVERSCAN_Y
- bg.width += 2 * config.GUI_OVERSCAN_X
- bg.height += 2 * config.GUI_OVERSCAN_Y
+ bg.x -= overscan.x
+ bg.y -= overscan.y
+ bg.width += 2 * overscan.x
+ bg.height += 2 * overscan.y
if bg.label == 'watermark' and self.menu.selected.image:
imagefile = self.menu.selected.image
else:
Modified: trunk/ui/src/gui/compat.py
==============================================================================
--- trunk/ui/src/gui/compat.py (original)
+++ trunk/ui/src/gui/compat.py Wed Feb 7 19:20:06 2007
@@ -34,15 +34,15 @@
def __init__(self):
from freevo.ui.gui.areas import Handler
- from freevo.ui import config
- self.GUI_FADE_STEPS = config.GUI_FADE_STEPS
+ from freevo.ui.config import config
+ self._fade_steps = config.gui.theme.fadestep
self.engine = Handler(self.name, self.areas)
def show(self):
if BaseApplication.visible and BaseApplication.visible != self:
- BaseApplication.visible.hide(self.GUI_FADE_STEPS)
+ BaseApplication.visible.hide(self._fade_steps)
BaseApplication.visible = self
- self.engine.show(self.GUI_FADE_STEPS)
+ self.engine.show(self._fade_steps)
def hide(self, fade=0):
if BaseApplication.visible == self:
Added: trunk/ui/src/gui/config.cxml
==============================================================================
--- (empty file)
+++ trunk/ui/src/gui/config.cxml Wed Feb 7 19:20:06 2007
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<config name="gui">
+ <desc lang="en">gui configuration</desc>
+
+ <group name="display">
+ <desc>display settings</desc>
+ <var name="engine" default="imlib2">
+ <desc>engine to use</desc>
+ </var>
+ <var name="width" default="800">
+ <desc>display width</desc>
+ </var>
+ <var name="height" default="600">
+ <desc>display height</desc>
+ </var>
+ <group name="overscan">
+ <var name="x" default="0"/>
+ <var name="y" default="0"/>
+ </group>
+ <group name="dfb">
+ <desc>settings used for display.engine = dfb</desc>
+ <var name="layer" default="0"/>
+ </group>
+ <group name="fb">
+ <desc>settings used for display.engine = fb</desc>
+ <var name="norm" default="pal">
+ <values>
+ <value>pal</value>
+ <value>ntsc</value>
+ </values>
+ </var>
+ <var name="mga" default="False"/>
+ </group>
+ <var name="fullscreen" default="False"/>
+ </group>
+
+ <group name="font">
+ <var name="default" default="Vera"/>
+ <list name="path">
+ <var type="str"/>
+ <set key="0" value="/usr/X11R6/lib/X11/fonts/truetype/"/>
+ </list>
+ <dict name="alias">
+ <var type="str"/>
+ <set key="Arial_Bold" value="VeraBd"/>
+ </dict>
+ </group>
+
+ <group name="theme">
+ <var name="engine" default="blurr"/>
+ <var name="fadestep" default="10"/>
+ </group>
+
+</config>
\ No newline at end of file
Modified: trunk/ui/src/gui/displays/__init__.py
==============================================================================
--- trunk/ui/src/gui/displays/__init__.py (original)
+++ trunk/ui/src/gui/displays/__init__.py Wed Feb 7 19:20:06 2007
@@ -37,7 +37,7 @@
import kaa.notifier
# freevo imports
-from freevo.ui import config
+from freevo.ui.config import config
# gui imports
from freevo.ui import gui
@@ -49,6 +49,10 @@
# Stack of the current active displays
display_stack = []
+# gui.display config object
+config = config.gui.display
+
+fullscreen = config.fullscreen
def get():
"""
@@ -57,8 +61,8 @@
"""
if display_stack:
return display_stack[-1]
- exec('from %s import Display' % config.GUI_DISPLAY.lower())
- size = (config.GUI_WIDTH, config.GUI_HEIGHT)
+ exec('from %s import Display' % config.engine.lower())
+ size = (config.width, config.height)
display = Display(size, True)
display_stack.append(display)
animation.create(display)
@@ -138,7 +142,7 @@
d.stop()
# switch to none display
from none import Display
- size = (config.GUI_WIDTH, config.GUI_HEIGHT)
+ size = (config.width, config.height)
display_stack = [ Display(size) ]
Modified: trunk/ui/src/gui/displays/dfb.py
==============================================================================
--- trunk/ui/src/gui/displays/dfb.py (original)
+++ trunk/ui/src/gui/displays/dfb.py Wed Feb 7 19:20:06 2007
@@ -41,7 +41,7 @@
from kaa.mevas.displays.directfbcanvas import DirectFBCanvas
# freevo imports
-from freevo.ui import config
+from freevo.ui.config import config
# display imports
from display import Display as Base
@@ -52,5 +52,5 @@
Display class for DirectFB output
"""
def __init__(self, size, default=False):
- DirectFBCanvas.__init__(self, size, config.GUI_DFB_LAYER)
+ DirectFBCanvas.__init__(self, size, config.gui.display.dfb.layer)
Base.__init__(self)
Modified: trunk/ui/src/gui/displays/fb.py
==============================================================================
--- trunk/ui/src/gui/displays/fb.py (original)
+++ trunk/ui/src/gui/displays/fb.py Wed Feb 7 19:20:06 2007
@@ -46,23 +46,26 @@
# display imports
from display import Display as Base
+# gui.display.fb config object
+config = config.gui.display.fb
+
class Display(FramebufferCanvas, Base):
"""
Display class for framebuffer output
"""
- def __init__(self, size, default=False):
- if config.GUI_DISPLAY_FB_MODE == 'mga':
+ def __init__(self, size, default=False, fullscreen=False):
+ if config.mga:
# switch heads
os.system('matroxset -f /dev/fb1 -m 0')
os.system('matroxset -f /dev/fb0 -m 3')
- if config.GUI_DISPLAY_FB_NORM == 'pal':
+ if config.norm == 'pal':
# switch to PAL
os.system('matroxset 1')
else:
# switch to NTSC
os.system('matroxset -f /dev/fb0 2 2')
# activate framebuffer with tv norm
- FramebufferCanvas.__init__(self, size, config.GUI_DISPLAY_FB_NORM)
+ FramebufferCanvas.__init__(self, size, config.norm)
else:
# activate framebuffer without changing the resolution
@@ -80,7 +83,7 @@
Stop the display
"""
if Base.stop(self):
- if config.GUI_DISPLAY_FB_MODE == 'mga':
+ if config.mga:
# switch heads back
os.system('matroxset -f /dev/fb0 -m 1')
os.system('matroxset -f /dev/fb1 -m 0')
Modified: trunk/ui/src/gui/displays/imlib2.py
==============================================================================
--- trunk/ui/src/gui/displays/imlib2.py (original)
+++ trunk/ui/src/gui/displays/imlib2.py Wed Feb 7 19:20:06 2007
@@ -33,14 +33,14 @@
# python imports
from freevo.ui import plugin
-from freevo.ui import config
# mevas imports
from kaa.mevas.displays.imlib2canvas import Imlib2Canvas
# display imports
from display import Display as Base
-
+# FIXME: ugly hack
+import freevo.ui.gui.displays as config
class Display(Imlib2Canvas, Base):
"""
@@ -50,7 +50,7 @@
Imlib2Canvas.__init__(self, size)
Base.__init__(self)
plugin.activate( 'input.x11' )
- if config.GUI_FULLSCREEN:
+ if config.fullscreen:
# FIXME: use xrandr to set resolution if possible
self.update()
self._window.set_fullscreen()
Modified: trunk/ui/src/gui/font.py
==============================================================================
--- trunk/ui/src/gui/font.py (original)
+++ trunk/ui/src/gui/font.py Wed Feb 7 19:20:06 2007
@@ -39,7 +39,7 @@
# freevo imports
import freevo.conf
-from freevo.ui import config
+from freevo.ui.config import config
# get logging object
log = logging.getLogger('gui')
@@ -47,6 +47,9 @@
# list of fonts already known to be not found
font_warning = []
+# get gui.font config object
+fontcfg = config.gui.font
+
class Font(object):
"""
Freevo GUI font object based on the mevas font.
@@ -90,8 +93,8 @@
log.debug('Couldn\'t load font "%s"' % name)
# Ok, see if there is an alternate font to use
- if name in config.GUI_FONT_ALIASES:
- alt_fname = config.GUI_FONT_ALIASES[name]
+ if name in fontcfg.alias:
+ alt_fname = fontcfg.alias[name]
log.debug('trying alternate: %s' % alt_fname)
try:
return kaa.mevas.imagelib.load_font(alt_fname, ptsize)
@@ -108,7 +111,7 @@
# init mevas font (imlib2)
FONT_DIR = os.path.join(freevo.conf.SHAREDIR, 'fonts')
kaa.mevas.imagelib.add_font_path(FONT_DIR)
-DEFAULT_FONT = os.path.join(FONT_DIR, config.GUI_FONT_DEFAULT_NAME)
+DEFAULT_FONT = os.path.join(FONT_DIR, fontcfg.default)
# the font cache object for 'get'
font_info_cache = {}
Modified: trunk/ui/src/gui/theme.py
==============================================================================
--- trunk/ui/src/gui/theme.py (original)
+++ trunk/ui/src/gui/theme.py Wed Feb 7 19:20:06 2007
@@ -77,6 +77,9 @@
current_theme = None
+guicfg = config.config.gui
+overscan = config.config.gui.display.overscan
+
def get():
"""
get current fxd theme
@@ -582,12 +585,12 @@
XMLData.parse(self, node, scale, current_dir)
if x != self.x:
try:
- self.x += config.GUI_OVERSCAN_X
+ self.x += overscan.x
except TypeError:
pass
if y != self.y:
try:
- self.y += config.GUI_OVERSCAN_Y
+ self.y += overscan.y
except TypeError:
pass
for subnode in node.children:
@@ -600,12 +603,12 @@
self.images[label].parse(subnode, scale, current_dir)
if x != self.images[label].x:
try:
- self.images[label].x += config.GUI_OVERSCAN_X
+ self.images[label].x += overscan.x
except TypeError:
pass
if y != self.images[label].y:
try:
- self.images[label].y += config.GUI_OVERSCAN_Y
+ self.images[label].y += overscan.y
except TypeError:
pass
@@ -623,17 +626,17 @@
def rect(self, type):
if type == 'screen':
- return (self.x - config.GUI_OVERSCAN_X,
- self.y - config.GUI_OVERSCAN_X,
- self.width + 2 * config.GUI_OVERSCAN_X,
- self.height + 2 * config.GUI_OVERSCAN_X)
+ return (self.x - overscan.x,
+ self.y - overscan.x,
+ self.width + 2 * overscan.x,
+ self.height + 2 * overscan.x)
return (self.x, self.y, self.width, self.height)
def pos(self, type):
if type == 'screen':
- return (self.x - config.GUI_OVERSCAN_X,
- self.y - config.GUI_OVERSCAN_X)
+ return (self.x - overscan.x,
+ self.y - overscan.x)
return (self.x, self.y)
@@ -1332,10 +1335,10 @@
if file_geometry:
w, h = file_geometry.split('x')
else:
- w, h = config.GUI_WIDTH, config.GUI_HEIGHT
+ w, h = guicfg.display.width, guicfg.display.height
- scale = (float(config.GUI_WIDTH-2*config.GUI_OVERSCAN_X)/float(w),
- float(config.GUI_HEIGHT-2*config.GUI_OVERSCAN_Y)/float(h))
+ scale = (float(guicfg.display.width-2*overscan.x)/float(w),
+ float(guicfg.display.height-2*overscan.y)/float(h))
include = attr_str(node, 'include', '')
@@ -1415,8 +1418,8 @@
"""
Set the basic skin fxd file and store it
"""
- config.GUI_XML_FILE = os.path.splitext(os.path.basename(name))[0]
- log.info('load basic skin settings: %s' % config.GUI_XML_FILE)
+ log.info('load basic skin settings: %s',
+ os.path.splitext(os.path.basename(name))[0])
try:
# try to load the new skin
@@ -1451,5 +1454,5 @@
"""
global current_theme
# load the fxd file at set current_theme
- current_theme = set_base_fxd(config.GUI_XML_FILE)
- current_theme.filename = config.GUI_XML_FILE
+ current_theme = set_base_fxd(guicfg.theme.engine)
+ current_theme.filename = guicfg.theme.engine
Modified: trunk/ui/src/gui/windows/inputbox.py
==============================================================================
--- trunk/ui/src/gui/windows/inputbox.py (original)
+++ trunk/ui/src/gui/windows/inputbox.py Wed Feb 7 19:20:06 2007
@@ -35,7 +35,7 @@
import logging
# freevo imports
-from freevo.ui import config
+from freevo.ui.config import config
from freevo.ui.event import *
# gui imports
@@ -48,6 +48,8 @@
# get logging object
log = logging.getLogger()
+# overscan config object
+overscan = config.gui.display.overscan
class InputBox(Window):
"""
@@ -122,8 +124,8 @@
text_height = int(self.widget_normal.font.height * 1.2)
w = max(min(int(math.sqrt(text_height * text_width * 4 / 3)),
displays.get().width - 60 - \
- 2 * config.GUI_OVERSCAN_X), width)
- self.h = displays.get().height - 100 - 2 * config.GUI_OVERSCAN_Y
+ 2 * overscan.x), width)
+ self.h = displays.get().height - 100 - 2 * overscan.y
# now create the label
self.label = Textbox(text, self.get_content_pos(), (w, self.h),
Modified: trunk/ui/src/gui/windows/waitbox.py
==============================================================================
--- trunk/ui/src/gui/windows/waitbox.py (original)
+++ trunk/ui/src/gui/windows/waitbox.py Wed Feb 7 19:20:06 2007
@@ -39,7 +39,7 @@
import logging
# freevo imports
-from freevo.ui import config
+from freevo.ui.config import config
# gui imports
from freevo.ui.gui import displays
@@ -51,6 +51,8 @@
# get logging object
log = logging.getLogger()
+# overscan config object
+overscan = config.gui.display.overscan
class WaitBox(Window):
"""
@@ -74,8 +76,8 @@
text_height = int(self.widget_normal.font.height * 1.2)
w = max(min(int(math.sqrt(text_height * text_width * 4 / 3)),
displays.get().width - 60 - \
- 2 * config.GUI_OVERSCAN_X), width)
- h = displays.get().height - 100 - 2 * config.GUI_OVERSCAN_Y
+ 2 * overscan.x), width)
+ h = displays.get().height - 100 - 2 * overscan.y
# now create the label
self.label = Textbox(text, self.get_content_pos(), (w, h),
Added: trunk/ui/src/image/config.cxml
==============================================================================
--- (empty file)
+++ trunk/ui/src/image/config.cxml Wed Feb 7 19:20:06 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>
+<config name="image" plugin="40">
+ <desc lang="en">image configuration</desc>
+ <list name="items">
+ <desc>
+ Set image items for the media menu. This is a list with path
+ and name. To set the subdir image in your home directory and
+ /image write
+
+ image.items[0].path = $(HOME)/image
+ image.items[0].name = My Home Images
+ image.items[1].path = /image
+ image.items[1].name = My Local Images
+ </desc>
+ <var name="path" type="str">
+ <desc>Path of the directory / file.</desc>
+ </var>
+ <var name="name" type="unicode">
+ <desc>Name in the mediamenu</desc>
+ </var>
+ </list>
+ <var name="suffix" default="jpg,gif,png,jpeg,bmp,tiff">
+ <desc>Comma seperated list of image suffixes.</desc>
+ </var>
+ <group name="viewer">
+ <var name="duration" default="0">
+ <desc>
+ Default duration for the image viewer. If greater 0, the
+ imageviewer will be in auto-slideshow mode.
+ </desc>
+ </var>
+ <var name="blend-mode" default="random">
+ <desc>
+ Blend effect when switching from one image to another. Possible
+ values are random, alpha, wipe and none.
+ </desc>
+ <values>
+ <value>random</value>
+ <value>alpha</value>
+ <value>wipe</value>
+ <value>none</value>
+ </values>
+ </var>
+ </group>
+</config>
Modified: trunk/ui/src/image/fxdhandler.py
==============================================================================
--- trunk/ui/src/image/fxdhandler.py (original)
+++ trunk/ui/src/image/fxdhandler.py Wed Feb 7 19:20:06 2007
@@ -58,7 +58,7 @@
from kaa.strutils import unicode_to_str
# Freevo imports
-from freevo.ui import config
+from freevo.ui.config import config
from freevo.ui import plugin
from freevo.ui import menu
@@ -90,7 +90,7 @@
if child.name == 'directory':
# for directories add all files in it
recursive = fxd.getattr(child, 'recursive', 0)
- files = match_files(fname, config.IMAGE_SUFFIX, recursive)
+ files = match_files(fname, config.image.suffix.split(','),
recursive)
elif child.name == 'file':
# add the given filename
@@ -98,7 +98,7 @@
# get duration until the next images comes up
duration = fxd.getattr(child, 'duration', 0) or \
- config.IMAGEVIEWER_DURATION
+ config.image.viewer.duration
for file in files:
items.append(ImageItem(file, None, duration))
Modified: trunk/ui/src/image/imageitem.py
==============================================================================
--- trunk/ui/src/image/imageitem.py (original)
+++ trunk/ui/src/image/imageitem.py Wed Feb 7 19:20:06 2007
@@ -38,7 +38,7 @@
import time
# freevo imports
-from freevo.ui import config
+from freevo.ui.config import config
from freevo.ui.menu import MediaItem, Action
from viewer import viewer
@@ -46,7 +46,7 @@
"""
An item for image files
"""
- def __init__(self, url, parent, duration = config.IMAGEVIEWER_DURATION):
+ def __init__(self, url, parent, duration = config.image.viewer.duration):
MediaItem.__init__(self, parent, type='image')
# set url and parse the name
self.set_url(url)
Modified: trunk/ui/src/image/interface.py
==============================================================================
--- trunk/ui/src/image/interface.py (original)
+++ trunk/ui/src/image/interface.py Wed Feb 7 19:20:06 2007
@@ -40,8 +40,9 @@
__all__ = [ 'PluginInterface' ]
# freevo imports
-from freevo.ui import config, plugin, fxditem
+from freevo.ui import plugin, fxditem
from freevo.ui.menu import MediaPlugin
+from freevo.ui.config import config
# ImageItem
from imageitem import ImageItem
@@ -63,7 +64,7 @@
fxditem.add_parser(['image'], 'slideshow', fxdhandler)
# activate the mediamenu for image
- args = _('Image Main Menu'), 'image', config.IMAGE_ITEMS
+ args = _('Image Main Menu'), 'image', config.image.items
plugin.activate('mediamenu', level=level, args=args)
@@ -71,7 +72,7 @@
"""
return the list of suffixes this class handles
"""
- return [ 'beacon:image' ] + config.IMAGE_SUFFIX
+ return [ 'beacon:image' ] + config.image.suffix.split(',')
def get(self, parent, listing):
Modified: trunk/ui/src/image/viewer.py
==============================================================================
--- trunk/ui/src/image/viewer.py (original)
+++ trunk/ui/src/image/viewer.py Wed Feb 7 19:20:06 2007
@@ -40,8 +40,9 @@
from kaa.strutils import to_unicode
# freevo imports
-from freevo.ui import config, plugin, gui
+from freevo.ui import plugin, gui
from freevo.ui.gui import theme, imagelib, widgets
+from freevo.ui.config import config
# cache for loading images
from freevo.ui.util import ObjectCache
@@ -59,6 +60,26 @@
# global viewer, will be set to the ImageViewer
viewer = None
+# gui.display.overscan config
+overscan = config.gui.display.overscan
+# set config to image.viewer config
+config = config.image.viewer
+
+# FIXME: this belongs to the theme
+IMAGEVIEWER_OSD = [
+ # First OSD info
+ [ (_('Title')+': ', 'name'),
+ (_('Description')+': ','description'),
+ (_('Author')+': ', 'author') ],
+
+ # Second OSD info
+ [ (_('Title')+': ', 'name'),
+ (_('Date')+': ' , 'date'),
+ ('W:', 'width'),
+ ('H:', 'height'),
+ (_('Model')+': ', 'hardware'),
+ (_('Software')+': ', 'software') ]
+ ]
class ImageViewer(Application):
"""
@@ -250,11 +271,11 @@
image = widgets.Image(image, (x, y))
if (self.last_image and self.last_item != item and
- config.IMAGEVIEWER_BLEND_MODE != None):
+ config.blend_mode != 'none'):
# blend over to the new image
gui.get_display().add_child(image)
a = Transition([self.last_image], [image], 20,
- (gui_width, gui_height),
config.IMAGEVIEWER_BLEND_MODE)
+ (gui_width, gui_height), config.blend_mode)
# start the animation and wait until it's done
a.start()
a.wait()
@@ -359,7 +380,7 @@
if event == TOGGLE_OSD:
# show/hide image information
- self.osd_mode = (self.osd_mode+1) % (len(config.IMAGEVIEWER_OSD)+1)
+ self.osd_mode = (self.osd_mode+1) % (len(IMAGEVIEWER_OSD)+1)
self.drawosd()
self.engine.update()
return True
@@ -424,7 +445,7 @@
# create the osdstring to write
osdstring = u''
- for strtag in config.IMAGEVIEWER_OSD[self.osd_mode-1]:
+ for strtag in IMAGEVIEWER_OSD[self.osd_mode-1]:
i = str(self.item[strtag[1]])
if i:
osdstring += u' %s %s' % (to_unicode(strtag[0]), to_unicode(i))
@@ -440,9 +461,9 @@
gui_height = gui.get_display().height
# create the text widget
- pos = (config.GUI_OVERSCAN_X + 10, config.GUI_OVERSCAN_Y + 10)
- size = (gui_width - 2 * config.GUI_OVERSCAN_X - 20,
- gui_height - 2 * config.GUI_OVERSCAN_Y - 20)
+ pos = (overscan.x + 10, overscan.y + 10)
+ size = (gui_width - 2 * overscan.x - 20,
+ gui_height - 2 * overscan.y - 20)
self.osd_text = widgets.Textbox(osdstring, pos, size,
theme.font('default'),
'left', 'bottom', mode='soft')
@@ -457,7 +478,7 @@
if rect[1] < 100:
# text too small, set to a minimum position
self.osd_text.set_pos((self.osd_text.get_pos()[0], gui_height - \
- config.GUI_OVERSCAN_Y - 100))
+ overscan.y - 100))
rect = rect[0], 100
# now draw a box around the osd
Modified: trunk/ui/src/input/plugins/dfbevents.py
==============================================================================
--- trunk/ui/src/input/plugins/dfbevents.py (original)
+++ trunk/ui/src/input/plugins/dfbevents.py Wed Feb 7 19:20:06 2007
@@ -54,7 +54,7 @@
def __init__(self):
InputPlugin.__init__(self)
- if config.GUI_DISPLAY.lower() == 'dfb':
+ if config.gui.display.engine.lower() == 'dfb':
self.dfb = displays.get().dfb
else:
self.dfb = directfb.DirectFB()
Added: trunk/ui/src/plugins/config.cxml
==============================================================================
--- (empty file)
+++ trunk/ui/src/plugins/config.cxml Wed Feb 7 19:20:06 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<config name="plugin">
+ <group name="shutdown" plugin="90">
+ <desc>Shutdown plugin for the main menu</desc>
+
+ <var name="confirm" default="True">
+ <desc>Show window asking for confirmation of shutdown</desc>
+ </var>
+ <var name="default" default="freevo">
+ <desc>
+ Default item. Either 'system' for system shutdown or 'freevo'
for
+ Freevo shutdown.
+ </desc>
+ <values>
+ <value>system</value>
+ <value>freevo</value>
+ </values>
+ </var>
+ <group name="command">
+ <var name="halt" default="shutdown -h now">
+ <desc>command to execute on system shutdown</desc>
+ </var>
+ <var name="restart" default="shutdown -h now">
+ <desc>command to execute on system restart</desc>
+ </var>
+ </group>
+ </group>
+</config>
Modified: trunk/ui/src/plugins/idlebar/__init__.py
==============================================================================
--- trunk/ui/src/plugins/idlebar/__init__.py (original)
+++ trunk/ui/src/plugins/idlebar/__init__.py Wed Feb 7 19:20:06 2007
@@ -45,6 +45,8 @@
# get logging object
log = logging.getLogger()
+# get gui config object
+guicfg = config.config.gui
class PluginInterface(plugin.Plugin):
"""
@@ -92,11 +94,11 @@
changed = False
w = gui.get_display().width
- h = config.GUI_OVERSCAN_Y + 60
+ h = guicfg.display.overscan.y + 60
- x1 = config.GUI_OVERSCAN_X
- y1 = config.GUI_OVERSCAN_Y
- x2 = w - config.GUI_OVERSCAN_X
+ x1 = guicfg.display.overscan.x
+ y1 = guicfg.display.overscan.y
+ x2 = w - guicfg.display.overscan.x
y2 = h
for p in plugin.get('idlebar'):
@@ -161,7 +163,7 @@
size = (s.width, s.height)
self.background = imagelib.load('background', size)
if self.background:
- size = (s.width, config.GUI_OVERSCAN_Y + 60)
+ size = (s.width, guicfg.display.overscan.y + 60)
self.background.crop((0,0), size)
self.background = widgets.Image(self.background, (0,0))
self.background.set_alpha(230)
@@ -185,7 +187,7 @@
# get gui informations
w = gui.get_display().width
- h = config.GUI_OVERSCAN_Y + 60
+ h = guicfg.display.overscan.y + 60
f = theme.image('idlebar')
@@ -197,7 +199,7 @@
self.container.add_child(self.bar)
if fade:
- fade = config.GUI_FADE_STEPS
+ fade = guicfg.theme.fadestep
else:
fade = 0
if fullscreen:
Modified: trunk/ui/src/plugins/mediamenu.py
==============================================================================
--- trunk/ui/src/plugins/mediamenu.py (original)
+++ trunk/ui/src/plugins/mediamenu.py Wed Feb 7 19:20:06 2007
@@ -61,7 +61,7 @@
the 'video', 'audio', 'image' or 'games' plugin.
"""
def __init__(self, name, type, items):
- if items is None:
+ if not items:
self.reason = 'No items defined for %s menu' % type
return
MainMenuPlugin.__init__(self)
@@ -94,6 +94,9 @@
self._items = items
for filename in self._items:
+ if hasattr(filename, 'path'):
+ # kaa.config object
+ filename = filename.path.replace('$(HOME)',
os.environ.get('HOME'))
if not isinstance(filename, (str, unicode)):
filename = filename[1]
filename = os.path.abspath(filename)
@@ -119,7 +122,11 @@
try:
# split the list on dir/file, title and add_args
add_args = None
- if isinstance(item, (str, unicode)):
+ if hasattr(item, 'path'):
+ # kaa.config object
+ title = unicode(item.name)
+ filename = item.path.replace('$(HOME)',
os.environ.get('HOME'))
+ elif isinstance(item, (str, unicode)):
# only a filename is given
title, filename = u'', item
elif self.display_type == 'games':
Modified: trunk/ui/src/plugins/osd.py
==============================================================================
--- trunk/ui/src/plugins/osd.py (original)
+++ trunk/ui/src/plugins/osd.py Wed Feb 7 19:20:06 2007
@@ -39,8 +39,9 @@
from kaa.notifier import OneShotTimer, EventHandler
# freevo imports
-from freevo.ui import config, plugin, gui
+from freevo.ui import plugin, gui
from freevo.ui.gui import theme, widgets
+from freevo.ui.config import config
from freevo.ui.event import OSD_MESSAGE
@@ -87,18 +88,17 @@
# get the osd from from the settings
font = theme.font('osd')
- over_x = config.GUI_OVERSCAN_X
- over_y = config.GUI_OVERSCAN_Y
+ overscan = config.display.overscan
# create the text object
- y = over_y + 10
+ y = overscan.y + 10
if plugin.getbyname('idlebar') != None:
y += 60
- self.gui_object = widgets.Text(self.message, (over_x, y),
- (display.width - 10 - 2 * over_x,
- over_y + 10 + font.height),
+ self.gui_object = widgets.Text(self.message, (overscan.x, y),
+ (display.width - 10 - 2 * overscan.x,
+ overscan.y + 10 + font.height),
font, align_h='right')
# make sure the object is on top of everything else
Modified: trunk/ui/src/plugins/shutdown.py
==============================================================================
--- trunk/ui/src/plugins/shutdown.py (original)
+++ trunk/ui/src/plugins/shutdown.py Wed Feb 7 19:20:06 2007
@@ -38,12 +38,15 @@
import kaa.notifier
# freevo imports
-from freevo.ui import config, gui
+from freevo.ui import gui
from freevo.ui.menu import Action
from freevo.ui.application import ConfirmWindow
from freevo.ui.mainmenu import MainMenuItem, MainMenuPlugin
from freevo.ui.gui import theme, widgets
+from freevo.ui.config import config
+# get shutdown config
+config = config.plugin.shutdown
class ShutdownItem(MainMenuItem):
"""
@@ -57,7 +60,7 @@
"""
return a list of actions for this item
"""
- if config.SHUTDOWN_CONFIRM:
+ if config.confirm:
items = [ Action(_('Shutdown Freevo'), self.confirm_freevo),
Action(_('Shutdown system'), self.confirm_system),
Action(_('Restart Freevo'), self.confirm_freevo_restart),
@@ -68,7 +71,7 @@
Action(_('Restart Freevo'),
self.shutdown_freevo_restart),
Action(_('Restart system'), self.shutdown_sys_restart) ]
- if config.SHUTDOWN_SYS_DEFAULT:
+ if config.default == 'system':
items = [ items[1], items[0], items[2] ]
return items
@@ -140,7 +143,7 @@
shutdown the complete system
"""
self.show_gui_message(_('shutting down system...'))
- kaa.notifier.OneShotTimer(os.system, config.SHUTDOWN_SYS_CMD).start(1)
+ kaa.notifier.OneShotTimer(os.system, config.command.halt).start(1)
def shutdown_freevo_restart(self):
@@ -157,7 +160,7 @@
restart the complete system
"""
self.show_gui_message(_('restarting system...'))
- kaa.notifier.OneShotTimer(os.system, config.RESTART_SYS_CMD).start(1)
+ kaa.notifier.OneShotTimer(os.system, config.command.restart).start(1)
Added: trunk/ui/src/video/config.cxml
==============================================================================
--- (empty file)
+++ trunk/ui/src/video/config.cxml Wed Feb 7 19:20:06 2007
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<config name="video" plugin="20">
+ <desc lang="en">video plugin</desc>
+ <list name="items">
+ <desc>
+ Set video items for the media menu. This is a list with path
+ and name. To set the subdir video in your home directory and
+ /video write
+
+ video.items[0].path = $(HOME)/video
+ video.items[0].name = My Home Videos
+ video.items[1].path = /video
+ video.items[1].name = My Local Videos
+ </desc>
+ <var name="path" type="str">
+ <desc>Path of the directory / file.</desc>
+ </var>
+ <var name="name" type="unicode">
+ <desc>Name in the mediamenu</desc>
+ </var>
+ </list>
+ <var name="suffix"
default="bin,viv,iso,nsv,rmvb,cue,avi,mpg,mpeg,wmv,rm,divx,ogm,vob,asf,m2v,m2p,mp4,nuv,mov,mkv,ts">
+ <desc>Comma seperated list of video suffixes.</desc>
+ </var>
+ <var name="show-regexp"
+ default="s?([0-9]|[0-9][0-9])[xe]([0-9]|[0-9][0-9])[^0-9]">
+ <desc>
+ Regular expression to detect tv show by name, season, epsiode
+ and title. Do not change this unless you know what you are doing.
+ </desc>
+ </var>
+</config>
Modified: trunk/ui/src/video/interface.py
==============================================================================
--- trunk/ui/src/video/interface.py (original)
+++ trunk/ui/src/video/interface.py Wed Feb 7 19:20:06 2007
@@ -41,8 +41,9 @@
import string
# freevo imports
-from freevo.ui import config, util, plugin, fxditem
+from freevo.ui import util, plugin, fxditem
from freevo.ui.menu import Files, MediaPlugin
+from freevo.ui.config import config
# video imports
from videoitem import VideoItem
@@ -67,7 +68,7 @@
database.update()
# activate the mediamenu for video
- args = _('Video Main Menu'), 'video', config.VIDEO_ITEMS
+ args = _('Video Main Menu'), 'video', config.video.items
plugin.activate('mediamenu', level=level, args=args)
@@ -75,7 +76,7 @@
"""
return the list of suffixes this class handles
"""
- return [ 'beacon:video' ] + config.VIDEO_SUFFIX
+ return [ 'beacon:video' ] + config.video.suffix.split(',')
def get(self, parent, listing):
Modified: trunk/ui/src/video/videoitem.py
==============================================================================
--- trunk/ui/src/video/videoitem.py (original)
+++ trunk/ui/src/video/videoitem.py Wed Feb 7 19:20:06 2007
@@ -47,8 +47,8 @@
from kaa.strutils import unicode_to_str, str_to_unicode
# freevo imports
-from freevo.ui import config
from freevo.ui import util
+from freevo.ui.config import config
from freevo.ui.application import MessageWindow, ConfirmWindow
from freevo.ui.menu import Menu, MediaItem, Files, Action
@@ -64,7 +64,7 @@
log = logging.getLogger('video')
# compile VIDEO_SHOW_REGEXP
-regexp = config.VIDEO_SHOW_REGEXP
+regexp = config.video.show_regexp
VIDEO_SHOW_REGEXP_MATCH = re.compile("^.*" + regexp).match
VIDEO_SHOW_REGEXP_SPLIT = re.compile("[\.\- ]*" + regexp + "[\.\- ]*").split
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog