First I want to thank everyone for the help so far.  Here is my code so far:

**** code start ****
import os
import sys
import menu
import config

from gui import ConfirmBox
from item import Item
from plugin import MainMenuPlugin

class HomeAutomationItem(Item):
def __init__(self, parent):
Item.__init__(self,parent)
self.name = _( 'Home Automation' )
def actions(self):
items = [(self.createMenu, _('Home Automation'))]
return items
def createMenu(self, arg=None, menuw=None):
ha_menu_items=[]
ha_menu_items+=[menu.MenuItem("Living Room",self.livingroom)]
ha_menu_items+=[menu.MenuItem("Master Bedroom",self.masterbedroom)]
ha_menu_items+=[menu.MenuItem("Office",self.office)]
ha_menu=menu.Menu("Home Automation", ha_menu_items)
menuw.pushmenu(ha_menu)
menuw.refresh()
def livingroom(self):
return
def masterbedroom(self):
return
def office(self):
return
class PluginInterface(MainMenuPlugin):
def items(self, parent):
return [ HomeAutomationItem(parent) ]


**** code end ****

The menus work fine, but of course as you can see they are hard coded in. So how can I have it read from a config file ('/etc/freevo/homeautomation.conf') and create these menus automatically? I would like my config file to look somewhat like the following:

[Living Room]
   [Corner Light]
       On,'command to execute when selected'
       Off,'command to execute when selected'
       Dim,'command to execute when selected'
   [Ceiling Fan]
       On,'command to execute when selected'
       Off,'command to execute when selected'
[Master Bedroom]
   [Ceiling Light]
       On,'command to execute when selected'
       Off,'command to execute when selected'
       Dim,'command to execute when selected'
[Office]
   [Wall Light]
       On,'command to execute when selected'
       Off,'command to execute when selected'
       Dim,'command to execute when selected'

My goal is to have my main menu of "Home Automation", with the sub menus "Living Room", "Master Bedroom", and "Office". Then "Living Room" would have the options to control either the "Corner Light" or "Ceiling Fan" and each of those items would have their sub-options of "On" and "Off", and "Dim" when applicable.

Ryan



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to