gui builder work around - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: gui builder work around (/showthread.php?tid=25108) |
gui builder work around - nate12o6 - 2007-03-04 Hey gusy i dont know how many of you out there are using the visibility tag with HasFocus() but i found that it has issues with gui builder. I narowed it down to the setCondVisibility function where it executes self.win.controls[key]['control'].setVisible(xbmc.getCondVisibility(visible)). When you use HasFocus() visibility = Control.HasFocus(id). For some reason this should return true but it doesnt. This is my work around for this. It is not the best but at least it works until they can update it. def setCondVisibility(self): if (not self.fastMethod): self.lines[self.lineno + 1] = 'setting up visibility...' t = len(self.win.controls) pattern1 = 'control.hasfocus\(([0-9]+)\)' pattern2 = 'control.isvisible\(([0-9]+)\)' for cnt, key in enumerate(self.win.controls.keys()): if (not self.fastMethod): self.dlg.update(int((float(self.pct1) / float(t) * (cnt + 1)) + self.pct), self.lines[0], self.lines[1], self.lines[2]) try: visible = self.win.controls[key]['visible'] visibleChanged = False # fix Control.HasFocus(id) visibility condition items = re.findall(pattern1, visible) for item in items: xbmc.output(str(self.win.getFocus().getId())+" == "+str(self.win.controls[int(item)]['control'].getId())+"\n") visibleChanged = True xbmc.output("This is the Key: "+str(key)+"\n") self.win.controls[key]['control'].setVisible(self.win.getFocus() == self.win.controls[int(item)]['control']) if (len(items) > 0): continue # fix Control.IsVisible(id) visibility condition items = re.findall(pattern2, visible) for item in items: visibleChanged = True if (self.win.controls.has_key(self.navigation[int(item)][0])): actualId = self.win.controls[self.navigation[int(item)][0]]['controlId'] visible = re.sub(pattern2, 'control.isvisible(%d)' % actualId, visible) # set the controls new visible condition if (visibleChanged): self.win.controls[key]['visible'] = visible # set the controls initial visibility self.win.controls[key]['control'].setVisible(xbmc.getCondVisibility(visible)) except: pass self.debugWrite('setCondVisibility', True) Just a little heads up! Thanks to everyone that made guibuilder possible! - asg - 2007-03-04 could you post it in a code window or even upload it ? thanks in advance asciii - Nuka1195 - 2007-03-04 Yes, Control.HasFocus() does not work currently, but you should still set the command, for when it does work. - nate12o6 - 2007-03-04 Sorry about that there is the code again. Code: def setCondVisibility(self): Just a work around till the getCondVisibility is fixed for hasFocus. - Nuka1195 - 2007-03-05 Quote:added: xbmcgui.getCurrentWindowDialogID() method to python. Fixed in SVN, thanks for bringing this up. I'm curious, was this not working for you in a WindowDialog. A Window should have worked. - nate12o6 - 2007-03-05 No i was using my own script. I didnt know about the windows dialog script until i was almost done with mine. I find out about the guibuilder from the accuweather. - Nuka1195 - 2007-03-06 No, i meant in your script was it xbmcgui.Window or xbmcgui.WindowDialog? Doesn't matter thats all irrelevant now. theres a new method just added: Quote:added: setVisibleCondition() to python. This allow XBMC to take care of a controls visibility. - nate12o6 - 2007-03-06 oh heheh sorry for my ignorence. It was xbmcgui.Window . Thanks for helping getting this bug pushed through. That was like a 1 day turnaround - asg - 2007-03-06 @Nuka1195 could you please post a little example how to use the newly added function? thx asciii |