Author: dmeyer
Date: Fri Oct 27 18:51:14 2006
New Revision: 8488

Modified:
   trunk/core/src/conf.py
   trunk/core/src/ipc/mbus_wrapper.py
   trunk/core/src/ipc/tvserver.py
   trunk/tvserver/src/favorite.py
   trunk/tvserver/src/recording.py
   trunk/ui/src/audio/audioitem.py
   trunk/ui/src/audio/plugins/mplayer.py
   trunk/ui/src/directory.py
   trunk/ui/src/gui/areas/default_areas.py
   trunk/ui/src/gui/widgets/infotext.py
   trunk/ui/src/image/viewer.py
   trunk/ui/src/mainmenu.py
   trunk/ui/src/playlist.py
   trunk/ui/src/plugins/idlebar/weather.py
   trunk/ui/src/sysconfig.py
   trunk/ui/src/tv/program.py
   trunk/ui/src/video/plugins/bookmarker.py
   trunk/ui/src/video/videoitem.py
   trunk/webserver/src/base.py
   trunk/webserver/src/pages/guide.py
   trunk/webserver/src/pages/recordings.py
   trunk/webserver/src/pages/search.py

Log:
remove stupid Unicode hack

Modified: trunk/core/src/conf.py
==============================================================================
--- trunk/core/src/conf.py      (original)
+++ trunk/core/src/conf.py      Fri Oct 27 18:51:14 2006
@@ -14,8 +14,7 @@
 #
 # This module provides some basic settings to solve that problems. It reads
 # a config file and stores everything in a struct. It will create necessary
-# directories for vfs and caching and provides helper function Unicode
-# to solve the encoding problem.
+# directories for caching.
 #
 # If you want to use an util module in a different project, you may also
 # need this file. The name freevo in the config file can be changed at the
@@ -56,21 +55,18 @@
 
 # That's it, you shouldn't need to make changes after this point
 
-__all__ = [ 'Unicode', 'cachefile', 'datafile', 'SHAREDIR',
-            'DATADIR', 'ENCODING' ]
+__all__ = [ 'cachefile', 'datafile', 'SHAREDIR', 'DATADIR', 'ENCODING' ]
 
 # Python imports
 import os
 import sys
 import locale
-import __builtin__
 import logging
 from logging.handlers import RotatingFileHandler
 import gettext
 import gc
 
 # kaa imports
-from kaa.strutils import to_unicode as Unicode
 from kaa.strutils import ENCODING
 from kaa.config import Var, Group, Dict, List
 from kaa.config import Config as KaaConfig
@@ -200,10 +196,6 @@
 # set log level
 logger.setLevel(logging.WARNING)
 
-# add Unicode to the global scope
-__builtin__.__dict__['Unicode'] = Unicode
-
-
 def garbage_collect():
     """
     Run garbage collector. It is not nice that we have to do this,

Modified: trunk/core/src/ipc/mbus_wrapper.py
==============================================================================
--- trunk/core/src/ipc/mbus_wrapper.py  (original)
+++ trunk/core/src/ipc/mbus_wrapper.py  Fri Oct 27 18:51:14 2006
@@ -57,6 +57,7 @@
 # kaa imports
 import kaa.notifier
 from kaa.notifier import Signal, OneShotTimer
+from kaa.strutils import str_to_unicode
 
 # freevo imports
 import freevo.conf as conf
@@ -85,7 +86,7 @@
     if isinstance(value, dict):
         return [ (k, _toMType(v)) for k,v in value.items() ]
     if isinstance(value, str):
-        return Unicode(value)
+        return str_to_unicode(value)
     return value
 
 

Modified: trunk/core/src/ipc/tvserver.py
==============================================================================
--- trunk/core/src/ipc/tvserver.py      (original)
+++ trunk/core/src/ipc/tvserver.py      Fri Oct 27 18:51:14 2006
@@ -218,9 +218,9 @@
 
         for rec in reclist:
             if rec.status == SCHEDULED:
-                self.comingup += u'%s\n' % Unicode(rec)
+                self.comingup += u'%s\n' % unicode(rec)
             if rec.status == RECORDING:
-                self.running += u'%s\n' % Unicode(rec)
+                self.running += u'%s\n' % unicode(rec)
 
         self.updating = 0
 
@@ -366,7 +366,7 @@
         days = (_('Mon'), _('Tue'), _('Wed'), _('Thu'), _('Fri'),
                 _('Sat'), _('Sun'))
         if prog.days in days:
-            days = [ Unicode(days.index(prog.dow)) ]
+            days = [ days.index(prog.dow) ]
         else:
             days = [ 0, 1, 2, 3, 4, 5, 6 ]
 

Modified: trunk/tvserver/src/favorite.py
==============================================================================
--- trunk/tvserver/src/favorite.py      (original)
+++ trunk/tvserver/src/favorite.py      Fri Oct 27 18:51:14 2006
@@ -38,7 +38,7 @@
 
 # kaa imports
 from kaa import xml
-from kaa.strutils import unicode_to_str
+from kaa.strutils import unicode_to_str, str_to_unicode
 
 # record imports
 from config import config
@@ -135,7 +135,7 @@
         """
         Return True if name, channel and start match this favorite.
         """
-        if Unicode(name.lower()) != self.name.lower() and not self.substring:
+        if str_to_unicode(name.lower()) != self.name.lower() and not 
self.substring:
             return False
         if name.lower().find(self.name.lower()) == -1:
             return False

Modified: trunk/tvserver/src/recording.py
==============================================================================
--- trunk/tvserver/src/recording.py     (original)
+++ trunk/tvserver/src/recording.py     Fri Oct 27 18:51:14 2006
@@ -100,13 +100,13 @@
         self.stop_padding  = config.record.stop_padding
         for key, value in info.items():
             if key in ('subtitle', 'description') and value:
-                setattr(self, key, Unicode(value))
+                setattr(self, key, str_to_unicode(value))
             elif key == 'url' and value:
                 self.url = unicode_to_str(value)
             elif key in ('start-padding', 'stop_padding'):
                 setattr(self, key, int(value))
             elif value:
-                self.info[key] = Unicode(value)
+                self.info[key] = str_to_unicode(value)
 
         self.recorder = None
         self.respect_start_padding = True
@@ -154,9 +154,9 @@
         if self.episode:
             info['episode'] = self.episode
         if self.url:
-            info['url'] = Unicode(self.url)
+            info['url'] = str_to_unicode(self.url)
         if self.description:
-            info['description'] = Unicode(self.description)
+            info['description'] = str_to_unicode(self.description)
         return self.id, self.name, self.channel, self.priority, self.start, \
                self.stop, self.status, self.start_padding, self.stop_padding, \
                info

Modified: trunk/ui/src/audio/audioitem.py
==============================================================================
--- trunk/ui/src/audio/audioitem.py     (original)
+++ trunk/ui/src/audio/audioitem.py     Fri Oct 27 18:51:14 2006
@@ -37,6 +37,9 @@
 import os
 import re
 
+# kaa imports
+from kaa.strutils import str_to_unicode
+
 # Freevo imports
 import config
 from menu import MediaItem, Action
@@ -72,15 +75,15 @@
         if mode == 'date':
             if self.filename:
                 return u'%s%s' % (os.stat(self.filename).st_ctime,
-                                  Unicode(self.filename))
+                                  str_to_unicode(self.filename))
         if mode == 'advanced':
             # sort by track number
             try:
                 return '%s %0.3i-%s' % (self['discs'], int(self['trackno']),
-                                        Unicode(self.url))
+                                        str_to_unicode(self.url))
             except ValueError:
-                return '%s-%s' % (Unicode(self['trackno']), Unicode(self.url))
-        return Unicode(self.url)
+                return '%s-%s' % (unicode(self['trackno']), 
str_to_unicode(self.url))
+        return str_to_unicode(self.url)
 
 
     def set_url(self, url):

Modified: trunk/ui/src/audio/plugins/mplayer.py
==============================================================================
--- trunk/ui/src/audio/plugins/mplayer.py       (original)
+++ trunk/ui/src/audio/plugins/mplayer.py       Fri Oct 27 18:51:14 2006
@@ -86,7 +86,7 @@
         filename = item.filename
 
         if filename and not os.path.isfile(filename):
-            return _('%s\nnot found!') % Unicode(item.url)
+            return _('file not found')
 
         if not filename:
             filename = item.url

Modified: trunk/ui/src/directory.py
==============================================================================
--- trunk/ui/src/directory.py   (original)
+++ trunk/ui/src/directory.py   Fri Oct 27 18:51:14 2006
@@ -41,6 +41,7 @@
 import kaa.notifier
 import kaa.beacon
 from kaa.weakref import weakref
+from kaa.strutils import str_to_unicode
 
 # freevo imports
 import config
@@ -164,7 +165,7 @@
         self.url = directory.filename
 
         if name:
-            self.name = Unicode(name)
+            self.name = str_to_unicode(name)
 
         if add_args == None and hasattr(parent, 'add_args'):
             add_args = parent.add_args

Modified: trunk/ui/src/gui/areas/default_areas.py
==============================================================================
--- trunk/ui/src/gui/areas/default_areas.py     (original)
+++ trunk/ui/src/gui/areas/default_areas.py     Fri Oct 27 18:51:14 2006
@@ -90,8 +90,7 @@
                     sn   = item.show_name
                     text = sn[1] + "x" + sn[2] + " - " + sn[3]
                 elif item.parent and len(item.parent.name) > 5 and \
-                         Unicode(item.name).\
-                         startswith(Unicode(item.parent.name)):
+                         item.name.startswith(item.parent.name):
                     text = item.name[len(item.parent.name):].strip(' -_')
                     if not text:
                         text = item.name

Modified: trunk/ui/src/gui/widgets/infotext.py
==============================================================================
--- trunk/ui/src/gui/widgets/infotext.py        (original)
+++ trunk/ui/src/gui/widgets/infotext.py        Fri Oct 27 18:51:14 2006
@@ -36,6 +36,9 @@
 # python imports
 import logging
 
+# kaa imports
+from kaa.strutils import to_unicode
+
 # gui imports
 from kaa.mevas.container import CanvasContainer
 from text import Text
@@ -87,7 +90,7 @@
         r = self.__item[attr]
         if r == None:
             return ''
-        return Unicode(r)
+        return to_unicode(r)
 
 
     def __eval(self, item, expression_list, function_calls):

Modified: trunk/ui/src/image/viewer.py
==============================================================================
--- trunk/ui/src/image/viewer.py        (original)
+++ trunk/ui/src/image/viewer.py        Fri Oct 27 18:51:14 2006
@@ -38,6 +38,7 @@
 
 # kaa imports
 import kaa.notifier
+from kaa.strutils import to_unicode
 
 # freevo imports
 import config
@@ -424,7 +425,7 @@
         for strtag in config.IMAGEVIEWER_OSD[self.osd_mode-1]:
             i = str(self.item[strtag[1]])
             if i:
-                osdstring += u' %s %s' % (Unicode(strtag[0]), Unicode(i))
+                osdstring += u' %s %s' % (to_unicode(strtag[0]), to_unicode(i))
 
        if osdstring == '':
             # If after all that there is nothing then tell the users that

Modified: trunk/ui/src/mainmenu.py
==============================================================================
--- trunk/ui/src/mainmenu.py    (original)
+++ trunk/ui/src/mainmenu.py    Fri Oct 27 18:51:14 2006
@@ -53,11 +53,11 @@
     This class is a main menu item. Items of this type can be returned by
     a MainMenuPlugin.
     """
-    def __init__( self, name='', action=None, arg=None, type=None, image=None,
+    def __init__( self, name=u'', action=None, arg=None, type=None, image=None,
                   icon=None, parent=None, skin_type=None):
 
         Item.__init__(self, parent)
-        self.name = Unicode(name)
+        self.name = name
         self.icon = icon
         self.image = image
         self.type = type

Modified: trunk/ui/src/playlist.py
==============================================================================
--- trunk/ui/src/playlist.py    (original)
+++ trunk/ui/src/playlist.py    Fri Oct 27 18:51:14 2006
@@ -40,6 +40,7 @@
 
 # kaa imports
 import kaa.beacon
+from kaa.strutils import str_to_unicode
 
 # freevo imports
 import config
@@ -76,7 +77,7 @@
         build:    create the playlist. This means unfold the directories
         """
         MediaItem.__init__(self, parent, type='playlist')
-        self.name     = Unicode(name)
+        self.name = str_to_unicode(name)
 
         # variables only for Playlist
         self.playlist     = playlist
@@ -215,7 +216,7 @@
                 for p in self.get_plugins:
                     for i in p.get(self, [os.path.join(curdir, ss_name[0])]):
                         if i.type == 'image':
-                            i.name     = Unicode(ss_caption[0])
+                            i.name = str_to_unicode(ss_caption[0])
                             i.duration = int(ss_delay[0])
                             self.playlist.append(i)
                             break

Modified: trunk/ui/src/plugins/idlebar/weather.py
==============================================================================
--- trunk/ui/src/plugins/idlebar/weather.py     (original)
+++ trunk/ui/src/plugins/idlebar/weather.py     Fri Oct 27 18:51:14 2006
@@ -124,7 +124,7 @@
 
             icon = os.path.join(config.IMAGE_DIR, 'weather', self.cache_icon)
             font = gui.theme.font('small0')
-            temp = Unicode('%s\xb0' % self.cache_temp)
+            temp = unicode('%s\xb0' % self.cache_temp)
 
             # icon object
             img = gui.widgets.Image(icon, pos=(5, 5))

Modified: trunk/ui/src/sysconfig.py
==============================================================================
--- trunk/ui/src/sysconfig.py   (original)
+++ trunk/ui/src/sysconfig.py   Fri Oct 27 18:51:14 2006
@@ -31,7 +31,7 @@
 #
 # -----------------------------------------------------------------------------
 
-__all__ = [ 'CONF', 'Unicode', 'cachefile', 'datafile' ]
+__all__ = [ 'CONF', 'cachefile', 'datafile' ]
 
 # Python imports
 import os
@@ -87,9 +87,6 @@
     exec('%s = CONF.%s' % (key.upper(), key))
 
 
-# encoding helper functions
-Unicode = conf.Unicode
-
 # helper functions to get dirs
 cachefile = conf.cachefile
 datafile  = conf.datafile

Modified: trunk/ui/src/tv/program.py
==============================================================================
--- trunk/ui/src/tv/program.py  (original)
+++ trunk/ui/src/tv/program.py  Fri Oct 27 18:51:14 2006
@@ -116,13 +116,13 @@
         return the specific attribute as string or an empty string
         """
         if key == 'start':
-            return Unicode(time.strftime(config.TV_TIMEFORMAT,
+            return unicode(time.strftime(config.TV_TIMEFORMAT,
                                          time.localtime(self.start)))
         if key == 'stop':
-            return Unicode(time.strftime(config.TV_TIMEFORMAT,
+            return unicode(time.strftime(config.TV_TIMEFORMAT,
                                          time.localtime(self.stop)))
         if key == 'date':
-            return Unicode(time.strftime(config.TV_DATEFORMAT,
+            return unicode(time.strftime(config.TV_DATEFORMAT,
                                          time.localtime(self.start)))
         if key == 'time':
             return self['start'] + u' - ' + self['stop']

Modified: trunk/ui/src/video/plugins/bookmarker.py
==============================================================================
--- trunk/ui/src/video/plugins/bookmarker.py    (original)
+++ trunk/ui/src/video/plugins/bookmarker.py    Fri Oct 27 18:51:14 2006
@@ -129,7 +129,7 @@
             time = '%0.2d:%0.2d:%0.2d' % (hour,min,sec)
 
             # set a new title
-            copy.name = Unicode(_('Jump to %s') % (time))
+            copy.name = _('Jump to %s') % (time)
             if not copy.mplayer_options:
                 copy.mplayer_options = ''
             copy.mplayer_options += ' -ss %s' % time

Modified: trunk/ui/src/video/videoitem.py
==============================================================================
--- trunk/ui/src/video/videoitem.py     (original)
+++ trunk/ui/src/video/videoitem.py     Fri Oct 27 18:51:14 2006
@@ -44,7 +44,7 @@
 import logging
 
 # kaa imports
-from kaa.strutils import unicode_to_str
+from kaa.strutils import unicode_to_str, str_to_unicode
 
 # freevo imports
 import config
@@ -141,7 +141,7 @@
             self.tv_show_name = show_name[0]
             self.tv_show_ep   = show_name[3]
         if self.mode == 'file' and os.path.isfile(self.filename):
-            self.sort_name += u'  ' + Unicode(os.stat(self.filename).st_ctime)
+            self.sort_name += u'  ' + 
str_to_unicode(str(os.stat(self.filename).st_ctime))
 
 
     def set_url(self, url):
@@ -256,7 +256,7 @@
         if mode == 'date' and self.mode == 'file' and \
                os.path.isfile(self.filename):
             return u'%s%s' % (os.stat(self.filename).st_ctime,
-                              Unicode(self.filename))
+                              str_to_unicode(self.filename))
         return self.sort_name
 
 

Modified: trunk/webserver/src/base.py
==============================================================================
--- trunk/webserver/src/base.py (original)
+++ trunk/webserver/src/base.py Fri Oct 27 18:51:14 2006
@@ -194,7 +194,7 @@
 
         for ch in channels:
             self.res += '<option value="%s" ' % ch.name 
-            if ch.name == Unicode(chan):
+            if ch.name == chan:
                 self.res += 'selected '
 
             if ch.tuner_id:

Modified: trunk/webserver/src/pages/guide.py
==============================================================================
--- trunk/webserver/src/pages/guide.py  (original)
+++ trunk/webserver/src/pages/guide.py  Fri Oct 27 18:51:14 2006
@@ -247,7 +247,7 @@
                         colspan = intervals
                         # prog.title = string.replace(prog.title, "&", "SUB")
                         # prog.desc = string.replace(prog.desc, "&", "SUB")
-                        cell += u'%s' % Unicode(prog.title)
+                        cell += u'%s' % prog.title
                         if colspan > c_left:
                             # show extends past visible range,
                             # insert right arrows

Modified: trunk/webserver/src/pages/recordings.py
==============================================================================
--- trunk/webserver/src/pages/recordings.py     (original)
+++ trunk/webserver/src/pages/recordings.py     Fri Oct 27 18:51:14 2006
@@ -35,6 +35,7 @@
 import logging
 
 # kaa imports
+from kaa.strutils import str_to_unicode
 import kaa.epg
 
 # freevo core imports
@@ -79,8 +80,7 @@
 
             prog = None
             for p in progs:
-                if Unicode(chan) == \
-                       kaa.epg.get_channel(p.channel).name \
+                if str_to_unicode(chan) == kaa.epg.get_channel(p.channel).name 
\
                    and int(start) == p.start:
                     prog = p
 
@@ -155,15 +155,15 @@
             t = time.strftime('%b %d ' + config.style.timeformat, 
time.localtime(prog.stop))
             self.tableCell(t, colspan)
 
-            self.tableCell(Unicode(channel), colspan)
-            self.tableCell(Unicode(prog['title']), colspan)
+            self.tableCell(channel, colspan)
+            self.tableCell(prog['title'], colspan)
             if prog.has_key('subtitle'):
-                self.tableCell(Unicode(prog['subtitle']), colspan)
+                self.tableCell(prog['subtitle'], colspan)
             else:
                 self.tableCell(u'', colspan)
 
             if prog.has_key('description'):
-                cell = Unicode(prog['description'])
+                cell = prog['description']
             else:
                 cell = _('no description available')
             self.tableCell(cell, colspan)
@@ -172,7 +172,7 @@
                     'title="Remove Scheduled Recording">'+_('Remove')+'</a>'+\
                     '|' + '<a href="search?find=%s&search_title=on" ' +\
                     'title="Search for other airings">' + _('Search') +
-                    '</a>') % (prog.channel, prog.start, 
Unicode(prog['title']))
+                    '</a>') % (prog.channel, prog.start, prog['title'])
             self.tableCell(cell, colspan)
             self.tableRowClose()
 

Modified: trunk/webserver/src/pages/search.py
==============================================================================
--- trunk/webserver/src/pages/search.py (original)
+++ trunk/webserver/src/pages/search.py Fri Oct 27 18:51:14 2006
@@ -123,9 +123,9 @@
                                            time.localtime(p.stop)),
                              'class="'+status+'" colspan="1"')
 
-                self.tableCell(Unicode(p.channel.name), 'class="'+status+'" 
colspan="1"')
-                self.tableCell(Unicode(p.title), 'class="'+status+'" 
colspan="1"')
-                # self.tableCell(Unicode(p.subtitle), 'class="'+status+'" 
colspan="1"')
+                self.tableCell(p.channel.name, 'class="'+status+'" 
colspan="1"')
+                self.tableCell(p.title, 'class="'+status+'" colspan="1"')
+                # self.tableCell(p.subtitle, 'class="'+status+'" colspan="1"')
 
                 if p.description == u'':
                     cell = \

-------------------------------------------------------------------------
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

Reply via email to