Update of /cvsroot/freevo/freevo/src/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21045/src/plugins

Modified Files:
        mediamenu.py 
Log Message:
respect coding standard, use MainMenuItem

Index: mediamenu.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/mediamenu.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** mediamenu.py        31 Dec 2004 11:57:43 -0000      1.44
--- mediamenu.py        8 Jan 2005 11:09:51 -0000       1.45
***************
*** 1,44 ****
  # -*- coding: iso-8859-1 -*-
! # -----------------------------------------------------------------------
  # mediamenu.py - Basic menu for all kinds of media
! # -----------------------------------------------------------------------
  # $Id$
  #
! # Notes:
! # Todo:        
! #
! # -----------------------------------------------------------------------
! # $Log$
! # Revision 1.44  2004/12/31 11:57:43  dischi
! # renamed SKIN_* and OSD_* variables to GUI_*
! #
! # Revision 1.43  2004/11/27 13:26:56  dischi
! # smaller bugfixes
! #
! # Revision 1.42  2004/11/20 18:23:03  dischi
! # use python logger module for debug
! #
! # Revision 1.41  2004/11/01 20:15:40  dischi
! # fix debug
! #
! # Revision 1.40  2004/08/14 08:40:08  dischi
! # bugfix for new menu interface
! #
! # Revision 1.39  2004/07/26 18:10:18  dischi
! # move global event handling to eventhandler.py
! #
! # Revision 1.38  2004/07/25 19:47:39  dischi
! # use application and not rc.app
! #
! # Revision 1.37  2004/07/10 12:33:40  dischi
! # header cleanup
  #
! # Revision 1.36  2004/03/18 15:38:18  dischi
! # Automouter patch to check for hosts in mediamenu from Soenke Schwardt.
! # See doc of VIDEO_ITEMS for details
  #
! # -----------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
! # Copyright (C) 2002 Krister Lagerstrom, et al. 
  # Please see the file freevo/Docs/CREDITS for a complete list of authors.
  #
--- 1,16 ----
  # -*- coding: iso-8859-1 -*-
! # 
-----------------------------------------------------------------------------
  # mediamenu.py - Basic menu for all kinds of media
! # 
-----------------------------------------------------------------------------
  # $Id$
  #
! # This plugin can create submenus for the different kind of media plugins.
  #
! # First edition: Dirk Meyer <[EMAIL PROTECTED]>
! # Maintainer:    Dirk Meyer <[EMAIL PROTECTED]>
  #
! # 
-----------------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
! # Copyright (C) 2002-2004 Krister Lagerstrom, Dirk Meyer, et al.
  # Please see the file freevo/Docs/CREDITS for a complete list of authors.
  #
***************
*** 57,71 ****
  # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  #
! # ----------------------------------------------------------------------- */
! 
  
  import os
  import copy
  
  import config
- import menu
- 
- import directory
- import eventhandler
  
  import plugin
--- 29,41 ----
  # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  #
! # 
-----------------------------------------------------------------------------
  
+ # python imports
  import os
  import copy
+ import logging
  
+ # freevo imports
  import config
  
  import plugin
***************
*** 74,81 ****
  from event import *
  from item import Item
  
! import logging
  log = logging.getLogger()
  
  class PluginInterface(plugin.MainMenuPlugin):
      """
--- 44,56 ----
  from event import *
  from item import Item
+ from directory import DirItem
+ from mainmenu import MainMenuItem
+ from menu import Menu
  
! 
! # get logging object
  log = logging.getLogger()
  
+ 
  class PluginInterface(plugin.MainMenuPlugin):
      """
***************
*** 87,97 ****
          plugin.MainMenuPlugin.__init__(self)
          self.type = type
!         self.force_text_view = force_text_view or 
config.GUI_MEDIAMENU_FORCE_TEXTVIEW
  
  
      def items(self, parent):
!         return [ menu.MenuItem('', action=MediaMenu().main_menu,
!                                arg=(self.type,self.force_text_view), 
type='main',
!                                parent=parent, skin_type = self.type) ]
  
  
--- 62,74 ----
          plugin.MainMenuPlugin.__init__(self)
          self.type = type
!         self.force_text_view = force_text_view or \
!                                config.GUI_MEDIAMENU_FORCE_TEXTVIEW
  
  
      def items(self, parent):
!         return [ MainMenuItem('', action=MediaMenu().main_menu,
!                               arg=(self.type,self.force_text_view),
!                               type='main', parent=parent,
!                               skin_type = self.type) ]
  
  
***************
*** 102,106 ****
      directories and the ROM_DRIVES
      """
!     
      def __init__(self):
          Item.__init__(self)
--- 79,83 ----
      directories and the ROM_DRIVES
      """
! 
      def __init__(self):
          Item.__init__(self)
***************
*** 110,115 ****
      def main_menu_generate(self):
          """
!         generate the items for the main menu. This is needed when first 
generating
!         the menu and if something changes by pressing the EJECT button
          """
          items = copy.copy(self.normal_items)
--- 87,93 ----
      def main_menu_generate(self):
          """
!         generate the items for the main menu. This is needed when first
!         generating the menu and if something changes by pressing the EJECT
!         button
          """
          items = copy.copy(self.normal_items)
***************
*** 127,131 ****
                  dir_types[type] = [ 'dir', 'audiocd', 'audio', 'video',
                                      'vcd', 'dvd', 'empty_cdrom' ]
!                 
          if self.display_type:
              plugins_list = plugin.get('mainmenu_%s' % self.display_type)
--- 105,109 ----
                  dir_types[type] = [ 'dir', 'audiocd', 'audio', 'video',
                                      'vcd', 'dvd', 'empty_cdrom' ]
! 
          if self.display_type:
              plugins_list = plugin.get('mainmenu_%s' % self.display_type)
***************
*** 134,140 ****
  
          dir_type = dir_types.get( self.display_type, [ ] )
!         
          for p in plugins_list:
!             
              if isinstance( p, plugins.rom_drives.rom_items ):
                  # do not show media from other menus
--- 112,118 ----
  
          dir_type = dir_types.get( self.display_type, [ ] )
! 
          for p in plugins_list:
! 
              if isinstance( p, plugins.rom_drives.rom_items ):
                  # do not show media from other menus
***************
*** 156,160 ****
  
          self.menuw = menuw
!         
          if self.display_type == 'video':
              title = _('Movie')
--- 134,138 ----
  
          self.menuw = menuw
! 
          if self.display_type == 'video':
              title = _('Movie')
***************
*** 167,171 ****
  
          menutitle = _('%s Main Menu') % title
!         
          if self.display_type:
              items = getattr(config, '%s_ITEMS' % self.display_type.upper())
--- 145,149 ----
  
          menutitle = _('%s Main Menu') % title
! 
          if self.display_type:
              items = getattr(config, '%s_ITEMS' % self.display_type.upper())
***************
*** 189,206 ****
                  pos = filename.find(':/')
                  if pos > 0:
!                     if filename.find(':/') < filename.find('/'):              
          
                          hostname = filename[0:pos]
                          filename = filename[pos+1:]
                          try:
!                             if os.system( config.HOST_ALIVE_CHECK % hostname 
) != 0:
                                  reachable = 0
                          except:
                              log.exception('Error parsing %s' % filename)
!                        
                  if reachable:
                      if vfs.isdir(filename):
!                         item = directory.DirItem(String(filename), self,
!                                                  
display_type=self.display_type,
!                                                  add_args=add_args)
                          if title:
                              item.name = title
--- 167,185 ----
                  pos = filename.find(':/')
                  if pos > 0:
!                     if filename.find(':/') < filename.find('/'):
                          hostname = filename[0:pos]
                          filename = filename[pos+1:]
                          try:
!                             alive = config.HOST_ALIVE_CHECK % hostname
!                             if os.system(alive) != 0:
                                  reachable = 0
                          except:
                              log.exception('Error parsing %s' % filename)
! 
                  if reachable:
                      if vfs.isdir(filename):
!                         item = DirItem(String(filename), self,
!                                        display_type=self.display_type,
!                                        add_args=add_args)
                          if title:
                              item.name = title
***************
*** 220,224 ****
                                      i.name = title
                              self.normal_items += items
!                             
              except:
                  log.exception('Error parsing %s' % str(item))
--- 199,203 ----
                                      i.name = title
                              self.normal_items += items
! 
              except:
                  log.exception('Error parsing %s' % str(item))
***************
*** 231,238 ****
              items[0](menuw=menuw)
              return
!         
!         item_menu = menu.Menu(menutitle, items,
!                               item_types = '%s main menu' % self.display_type,
!                               umount_all=1, reload_func = self.reload)
          item_menu.skin_force_text_view = force_text_view
          self.menuw = menuw
--- 210,217 ----
              items[0](menuw=menuw)
              return
! 
!         type = '%s main menu' % self.display_type
!         item_menu = Menu(menutitle, items, item_types = type, umount_all=1,
!                          reload_func = self.reload)
          item_menu.skin_force_text_view = force_text_view
          self.menuw = menuw
***************
*** 241,247 ****
  
      def reload(self):
!         menuw = self.menuw
! 
!         menu = menuw.menustack[1]
  
          sel = menu.choices.index(menu.selected)
--- 220,227 ----
  
      def reload(self):
!         """
!         Reload the menu. maybe a disc changed or some other plugin.
!         """
!         menu = self.menuw.menustack[1]
  
          sel = menu.choices.index(menu.selected)
***************
*** 258,267 ****
      def eventhandler(self, event = None, menuw=None):
          """
!         eventhandler for the main menu. The menu must be regenerated
          when a disc in a rom drive changes
          """
          if plugin.isevent(event):
              if not menuw:
!                 menuw = self.menuw
  
              menu = menuw.menustack[1]
--- 238,248 ----
      def eventhandler(self, event = None, menuw=None):
          """
!         Eventhandler for the media main menu. The menu must be regenerated
          when a disc in a rom drive changes
          """
          if plugin.isevent(event):
              if not menuw:
!                 # nothing to do when no menuw is shown
!                 return False
  
              menu = menuw.menustack[1]
***************
*** 277,289 ****
                      menu.selected = None
  
!             if menu == menuw.menustack[-1] and eventhandler.is_menu():
                  menuw.refresh()
              # others may need this event, too
              return False
  
-         if event in (PLAY_END, USER_END, STOP) and event.context != 'menu':
-             menuw.show()
-             return True
- 
          # give the event to the next eventhandler in the list
          return Item.eventhandler(self, event, menuw)
--- 258,266 ----
                      menu.selected = None
  
!             if menu == menuw.menustack[-1] and menuw.visible:
                  menuw.refresh()
              # others may need this event, too
              return False
  
          # give the event to the next eventhandler in the list
          return Item.eventhandler(self, event, menuw)



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to