Background: I'm building a custom Xbox with a stripped down Belkin wireless router with DD-WRT installed inside of it, and I need to set it up as a Repeater Bridge (already done, works fine). But the thing is, there will be times where I'll need to connect it to other wifi networks or change the way the router behaves through a set of predefined commands. Later on it will eventually scan for nearby access points, return a list of SSID's (and ask for a passkey if required), but baby steps first, right?
Anyways, so main question: What's the best way to display (and later update) text on screen?
Current code (works)
Code: Select all
import xbmc, xbmcgui import sys import telnetlib host = "192.168.1.2" user = "root" password = "admin" tn = telnetlib.Telnet(host) tn.read_until("login: ") tn.write(user + "\n") if password: tn.read_until("Password: ") tn.write(password + "\n") tn.write("nvram show\n") tn.write("exit\n") nvram_result = tn.read_all() ACTION_PREVIOUS_MENU = 10 class toolsmain(xbmcgui.Window): def __init__(self): self.strActionInfo = xbmcgui.ControlLabel(20, 20, 200, 600, '', 'font13', '0xFF00FF00') self.addControl(self.strActionInfo) self.strActionInfo.setLabel('DD-WRT Tools') def onAction(self, action): if action == ACTION_PREVIOUS_MENU: self.confirmexit() def confirmexit(self): dialog = xbmcgui.Dialog() if dialog.yesno("Confirm Exit", "Are you sure you want to exit?"): self.close() mydisplay = toolsmain() mydisplay.strActionInfo.setLabel(nvram_result) mydisplay .doModal() del mydisplay
Edit: fixed the above code to display in full width thanks to a member's recommendation at the Xbmc.org forums. If anyone's interested in this idea to use, feel free to contact me via this thread or through PM.