Hello folks,
for an addon (home automation/smart home) I need a slider control where I can set a temperature value of a thermostat. So I decided to use the DialogSlider.xml for this because it’s an default window (sliderdialog, 10145), but running in several issues.
class Slider():
device = None
DialogSlider = xbmcgui.Window(10145)
def __init__(self):
self.DialogSlider.show()
try:
self._header = self.DialogSlider.getControl(10)
self._value = self.DialogSlider.getControl(12)
self._slider = self.DialogSlider.getControl(11)
except RuntimeError:
pass
def update(self):
self._header.setLabel(device.name)
self._value.setLabel'device.temp[0])
self._slider.setPercent(device.temp[1])
def onClick(self, cid):
t.writeLog('clicked on ID %s' % (cid)) # t.writeLog is a special func to write in kodi.log
def onControl(self, cid):
t.writeLog('clicked on ID %s' % (cid)) t.writeLog is a special func to write in kodi.log
def onInit(self):
t.writeLog('Window Init') t.writeLog is a special func to write in kodi.log
def onAction(self, action):
t.writeLog(action.getId) t.writeLog is a special func to write in kodi.log
slider = Slider()
slider.device = device # thermostat object with formatted properties
slider.update()
Issues:
- without self.DialogSlider().show on __init__() I get a runtime error (control(id) doesn’t exists) and I couldn’t set the values of the controls of coarse.
- with self.DialogSlider().show on __init()__ I get an ’empty’ Dialog without values. The update() doesn’t refresh/update the Dialog window. On next call all controls are filled with correct values.
- None of the event handler (onClick, onControl, onInit, onAction) seems to be called.
Any hints would be very appreciate.