2007-03-04, 09:21
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!
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!