#if 0 /* #endif #python modules import os, popen2, fcntl, select, time import pygame import osd #freevo modules import config, menu, rc, plugin, skin, util import event as em from item import Item from gui.AlertBox import AlertBox from gui.RegionScroller import RegionScroller from gui.ListBox import ListBox from gui.AlertBox import PopupBox from gui.GUIObject import Align #get the sinfletons so we can add our menu and get skin info skin = skin.get_singleton() menuwidget = menu.get_singleton() osd = osd.get_singleton() class CommandMainMenuItem(Item): def actions(self): """ return a list of actions for this item """ items = [ ( self.doCmd, 'Do the command' ) ] return items def doCmd(self, arg=None, menuw=None): popup_string=_(self.mode + " net...") pop = PopupBox(text=popup_string) pop.show() #os.system('sudo /etc/init.d/net.wlan0 start') os.system('/etc/init.d/net.wlan0 ' + self.mode) if self.mode == 'start': self.mode = 'stop' else : self.mode = 'start' pop.destroy() osd.update() class PluginInterface(plugin.MainMenuPlugin): """ A quick plugin to start the network from the main menu. """ def items(self, parent): menu_items = skin.settings.mainmenu.items item = CommandMainMenuItem() item.name = _('Toggle Net') item.parent = parent item.mode = 'start' return [ item ]