I've made a good deal more progress, thanks alot to Rande. Its all working now except for I still have not figured out how to tuck things into sub menus.

Heres my current local_conf.py layout:

**** begin config ****

HA_ITEMS = [ ("Living Room",(
("Corner Light",(
("On","command to run when On is selected from menu"),
("Off","command"),
("Dim","command")
)),
("Ceiling Fan",(
("On","command"),
("Off","command")
)),
("TV",(
("On","command"),
("Off","command")
))
)),
("Bedroom",(
("Ceiling Lights",(
("On","command"),
("Off","command"),
("Dim","command")
)),
("Table Lamp",(
("On","command"),
("Off","command"),
("Dim","command")
))
)) ]


**** end config ****
and here is my automatedhouse.py code so far:

**** begin code ****

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 config(self):
               return [('HA_ITEMS',
                [ ("Living Room", "Corner Light","On,Off,Dim"),
                  ("Bedroom", "Ceiling Lights","On,Off,Dim") ],
               "Home automation items")]
       def actions(self):
               items = [(self.createMenu, _('Home Automation'))]
               return items

       def createMenu(self, arg=None, menuw=None):
               ha_menu_items=[]

for room in config.HA_ITEMS:
ha_menu_items+=[menu.MenuItem(room[0])]
for device in room[1]:
ha_menu_items+=[menu.MenuItem(device[0])]
for control in device[1]:
ha_menu_items+=[menu.MenuItem(control[0],os.system(control[1]))]
ha_menu=menu.Menu("Home Automation", ha_menu_items)
menuw.pushmenu(ha_menu)
menuw.refresh()


class PluginInterface(MainMenuPlugin):
   def items(self, parent):
       return [ HomeAutomationItem(parent) ]

**** end code ****








------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to