Author: dmeyer
Date: Sat Feb 10 20:19:33 2007
New Revision: 9198
Added:
trunk/ui/src/plugins/idlebar/plugin.py
Modified:
trunk/ui/src/plugins/idlebar/__init__.py
trunk/ui/src/plugins/idlebar/clock.py
trunk/ui/src/plugins/idlebar/logo.py
Log:
idlebar cleanup
Modified: trunk/ui/src/plugins/idlebar/__init__.py
==============================================================================
--- trunk/ui/src/plugins/idlebar/__init__.py (original)
+++ trunk/ui/src/plugins/idlebar/__init__.py Sat Feb 10 20:19:33 2007
@@ -38,33 +38,27 @@
import kaa.notifier
# freevo imports
-from freevo.ui import plugin, gui, application
+from freevo.ui.plugin import Plugin
+from freevo.ui import gui, application
from freevo.ui.config import config
from freevo.ui.gui import theme, imagelib, widgets, animation
from freevo.ui.event import *
+from plugin import IdleBarPlugin
+
# get logging object
log = logging.getLogger()
# get gui config object
guicfg = config.gui
-class PluginInterface(plugin.Plugin):
+class PluginInterface(Plugin):
"""
- To activate the idle bar, put the following in your local_conf.py:
- plugin.activate('idlebar')
- You can then add various plugins. Plugins inside the idlebar are
- sorted based on the level (except the clock, it's always on the
- right side). Use 'freevo plugins -l' to see all available plugins,
- and 'freevo plugins -i idlebar.<plugin>' for a specific plugin.
"""
- def __init__(self):
+ def plugin_activate(self, level):
"""
init the idlebar
"""
- plugin.Plugin.__init__(self)
- plugin.register(self, 'idlebar')
-
# register for signals
application.signals['changed'].connect(self._app_change)
@@ -81,12 +75,6 @@
self._timer = kaa.notifier.Timer(self.poll)
self._timer.start(30)
- # Getting current LOCALE
- try:
- locale.resetlocale()
- except:
- pass
-
def update(self):
"""
@@ -102,7 +90,7 @@
x2 = w - guicfg.display.overscan.x
y2 = h
- for p in plugin.get('idlebar'):
+ for p in IdleBarPlugin.plugins():
width = p.draw(x2 - x1, y2 - y1)
if width == p.NO_CHANGE:
if p.align == 'left':
@@ -227,50 +215,3 @@
return
if self.update():
gui.get_display().update()
-
-
-
-class IdleBarPlugin(plugin.Plugin):
- def __init__(self):
- plugin.Plugin.__init__(self)
- self._plugin_type = 'idlebar'
- self.objects = []
- self.NO_CHANGE = -1
- self.align = 'left'
- self.__x = 0
- self.__y = 0
- self.width = 0
- if not plugin.getbyname('idlebar'):
- plugin.activate('idlebar')
-
-
- def draw(self, width, height):
- return self.NO_CHANGE
-
-
-
- def clear(self):
- self.__x = 0
- self.__y = 0
- for o in self.objects:
- o.unparent()
- self.objects = []
-
-
- def set_pos(self, (x, y)):
- """
- move to x position
- """
- if x == self.__x and y == self.__y:
- return
- for o in self.objects:
- o.move_relative(((x - self.__x), (y - self.__y)))
- self.__x = x
- self.__y = y
-
-
- def update(self):
- """
- Force idlebar update.
- """
- plugin.getbyname('idlebar').poll()
Modified: trunk/ui/src/plugins/idlebar/clock.py
==============================================================================
--- trunk/ui/src/plugins/idlebar/clock.py (original)
+++ trunk/ui/src/plugins/idlebar/clock.py Sat Feb 10 20:19:33 2007
@@ -33,16 +33,11 @@
from freevo.ui import gui
from freevo.ui.gui import theme, widgets
-from freevo.ui.plugins.idlebar import IdleBarPlugin
+from plugin import IdleBarPlugin
class PluginInterface(IdleBarPlugin):
"""
Shows the current time.
-
- Activate with:
- plugin.activate('idlebar.clock', level=50)
- Note: The clock will always be displayed on the right side of
- the idlebar.
"""
def __init__(self, format=''):
IdleBarPlugin.__init__(self)
Modified: trunk/ui/src/plugins/idlebar/logo.py
==============================================================================
--- trunk/ui/src/plugins/idlebar/logo.py (original)
+++ trunk/ui/src/plugins/idlebar/logo.py Sat Feb 10 20:19:33 2007
@@ -34,7 +34,7 @@
import freevo.conf
from freevo.ui import gui
from freevo.ui.gui import theme, widgets
-from freevo.ui.plugins.idlebar import IdleBarPlugin
+from plugin import IdleBarPlugin
class PluginInterface(IdleBarPlugin):
"""
Added: trunk/ui/src/plugins/idlebar/plugin.py
==============================================================================
--- (empty file)
+++ trunk/ui/src/plugins/idlebar/plugin.py Sat Feb 10 20:19:33 2007
@@ -0,0 +1,86 @@
+# -*- coding: iso-8859-1 -*-
+# -----------------------------------------------------------------------------
+# idlebar/plugin.py - Basic Idlebar plugin
+# -----------------------------------------------------------------------------
+# $Id: mainmenu.py 9193 2007-02-10 19:34:15Z dmeyer $
+#
+# -----------------------------------------------------------------------------
+# 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 freevo.ui import plugin
+
+class IdleBarPlugin(plugin.Plugin):
+ def __init__(self):
+ plugin.Plugin.__init__(self)
+ self._plugin_type = 'idlebar'
+ self.objects = []
+ self.NO_CHANGE = -1
+ self.align = 'left'
+ self.__x = 0
+ self.__y = 0
+ self.width = 0
+ if not plugin.getbyname('idlebar'):
+ plugin.activate('idlebar')
+
+
+ def draw(self, width, height):
+ return self.NO_CHANGE
+
+
+
+ def clear(self):
+ self.__x = 0
+ self.__y = 0
+ for o in self.objects:
+ o.unparent()
+ self.objects = []
+
+
+ def set_pos(self, (x, y)):
+ """
+ move to x position
+ """
+ if x == self.__x and y == self.__y:
+ return
+ for o in self.objects:
+ o.move_relative(((x - self.__x), (y - self.__y)))
+ self.__x = x
+ self.__y = y
+
+
+ def update(self):
+ """
+ Force idlebar update.
+ """
+ plugin.getbyname('idlebar').poll()
+
+
+ def plugins():
+ """
+ Static function to return all IdlebarPlugins.
+ """
+ return plugin.get('idlebar')
+
+ plugins = staticmethod(plugins)
-------------------------------------------------------------------------
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