>> Is there a simple answer or should I just post what code I have?

> Better post the code so I can take a look.

Here you go.  Probably something fundamental that I still don't understand.



#python modules
import os, time, stat, re, copy

#freevo modules
import config, menu, rc, plugin, skin, osd, util
from gui.PopupBox import PopupBox
from gui.InputBox import *
from item import Item

#get the singletons so we get skin info and access the osd
skin = skin.get_singleton()
osd  = osd.get_singleton()

skin.register('configuration', ('screen', 'title', 'info', 'plugin'))

class PluginInterface(plugin.MainMenuPlugin):
    """
    """
    # make an init func that creates the cache dir if it don't exist
    def __init__(self):
        plugin.MainMenuPlugin.__init__(self)

    def items(self, parent):
        return [ ConfigurationMainMenuItem(parent) ]
   
class ConfigurationMainMenuItem(Item):
    """
    this is the item for the main menu and creates the list
    of SubItems
    """
    def __init__(self, parent):
        #what image shows on the main menu
        Item.__init__(self, parent, skin_type='commands')
        self.name = _('Configuration')

    def actions(self):
        """
        return a list of actions for this item
        """
        items = [ ( self.createConfigurationMenu , _('Configuration Menu' )) ]
        return items
 
    def createConfigurationMenu(self, arg=None, menuw=None):
        menuitems = []
        menuitems += [NetworkItem(self)]
 
        configurationMenu = menu.Menu(_('Configuration'), menuitems)
        menuw.pushmenu(configurationMenu)
        menuw.refresh()

class NetworkItem(Item):
    def __init__(self,parent):
        Item.__init__(self,parent)
        self.name=_('Network')
        config.IP_ADDRESS='192.168.1.123'
       
    def actions(self):
        items = [(self.getlines, _('Show Network Settings'))]
        return items

    def getlines(self, arg = None, menuw=None):
        lines=[]
        mi = menu.MenuItem('IP Address : '+config.IP_ADDRESS, self.editIP, 0)
        mi.arg=(mi, menuw)
        lines.append(mi)
        networkMenu = menu.Menu(_('Network Settings'), lines)
        menuw.pushmenu(networkMenu)
        menuw.refresh()
       
    def editIP(self, arg=None, menuw=None):
        ShowIP(arg)


class ShowIP:
    """
        Stub class - doesn't do anything other than allow the edit of a word and
        update the menu with the updated word
    """
    def __init__(self, (item, menuw)):
        self.menuw = menuw
        self.item = item
        self.menuw.hide(clear=False)
        ipb = InputBox(text=_('Enter new IP'), input_text = _(config.IP_ADDRESS), handler=self.modifyIP)
        ipb.show()
 
    def modifyIP(self, word=None):
        config.IP_ADDRESS=word
        self.item.name = 'IP Address : ' + word
        skin.force_redraw=True
        self.menuw.show()
        return







Reply via email to