Whats wrong with this
#1
whats wrong with this code i cant see anything but xbmc just keeps saying things are wrong like that line : except: emulating = false , but i cant see anything wrong with it



Quote:import xbmc, xbmcgui, urllib
try: emulating = xbmcgui.emulating
except: emulating = false

#get the controller codes
action_move_left = 1
action_move_right = 2
action_move_up = 3
action_move_down = 4
action_page_up = 5
action_page_down = 6
action_select_item = 7
action_highlight_item = 8
action_parent_dir = 9
action_previous_menu = 10
action_show_info = 11
action_pause = 12
action_stop = 13
action_next_item = 14
action_prev_item = 15

class myclass(xbmcgui.window):
def_init_(self):
if emulating: xbmcgui.window.(self)
self.addcontrol(xbmcgui.controlimage(0,0,720,480, "q\\scripts\\temp\\background.gif"))


#make the buttons!
self.button0 = xbmcgui.controlbutton(250, 150, 120, 30 "quit")
self.addcontrol(self.button0)
self.button1 = xbmcgui.controlbutton(250, 250, 120, 30 "enter url")
self.addcontrol(self.button1)
self.setfocus(self.button0)
self.button0.controldown(self.button1)
self.button1.controlup(self.button0)

def onaction(self, action):
if action == action_previous_menu:
self.close()

def oncontrol(self, control):
if control == self.button0:
self.close()
if control == self.button1:
keyboard = xbmc.keyboard("enter text")
keyboard.domodal()
if (keyboard.isconfirmed()):
webfile = (keyboard.gettext())
localfile = "q:\\scripts\\temp"
self.downloadurl(webfile,localfile)

def downloadurl(self,source, destination):
try:
loc = urllib.urlopener()
loc.retrieve(source,destination)
self.message("download successful!")
except:
self.message("download failed , please check url and try again")


def message(self, messagetext):
dialog = xbmcgui.dialog()
dialog.ok("my message title", messagetext)

mydisplay = myclass()
mydisplay.domodal()
del mydisplay


Reply

Logout Mark Read Team Forum Stats Members Help
Whats wrong with this0