2023-09-25, 04:56
If I create a xbmcgui.ControlLabel it overwrites some of the text, particularly the time in the top right corner, two elements underneath the Kodi logo on the top left corner and the "Your library is currently empty..." text in unused menus.
This overwriting happens even if the control is not added using xbmcgui.Window.addControl
It seems that this is occurs usually with the first label that is created by the script - but not always.
I have tested this using Windows 10 with kodi 20.2 (though it occurs on previous versions at least down to 19 also)
The code below illustrates the problem (even if the line self.addControl(self.heading.timeCtrl) is commented out, the problem still occurs):
from datetime import datetime
import xbmcgui
def main():
displayRecordingList = UiLines()
displayRecordingList.createBookingsLines()
displayRecordingList.controlBooking('DO_MODAL')
class UiLines:
def __init__(self):
self.bookingLines = BookingDisplay()
self._bookingsLines = []
def createBookingsLines(self):
self._bookingsLines = self.bookingLines.createBookingDisplay()
def controlBooking(self, control):
if control == 'SHOW':
self.bookingLines.show()
elif control == 'DO_MODAL':
self.bookingLines.doModal()
elif control == 'CLOSE':
self.bookingLines.close()
class BookingDisplay(xbmcgui.Window):
def __init__(self):
super().__init__()
self.heading = CreateHeader()
def createBookingDisplay(self):
self.displayAndInitialise()
return self
def displayAndInitialise(self):
self.heading.drawHeading()
self.addControl(self.heading.timeCtrl)
class CreateHeader:
def __init__(self):
self.timeCtrl = xbmcgui.ControlLabel(100, 0, 500, 20, "", alignment=0x00000001)
def drawHeading(self):
self.timeCtrl.setLabel(datetime.now().strftime('%A %d %B %H:%M'))
if __name__ == "__main__":
main()
Any ideas as to what is causing this?
This overwriting happens even if the control is not added using xbmcgui.Window.addControl
It seems that this is occurs usually with the first label that is created by the script - but not always.
I have tested this using Windows 10 with kodi 20.2 (though it occurs on previous versions at least down to 19 also)
The code below illustrates the problem (even if the line self.addControl(self.heading.timeCtrl) is commented out, the problem still occurs):
from datetime import datetime
import xbmcgui
def main():
displayRecordingList = UiLines()
displayRecordingList.createBookingsLines()
displayRecordingList.controlBooking('DO_MODAL')
class UiLines:
def __init__(self):
self.bookingLines = BookingDisplay()
self._bookingsLines = []
def createBookingsLines(self):
self._bookingsLines = self.bookingLines.createBookingDisplay()
def controlBooking(self, control):
if control == 'SHOW':
self.bookingLines.show()
elif control == 'DO_MODAL':
self.bookingLines.doModal()
elif control == 'CLOSE':
self.bookingLines.close()
class BookingDisplay(xbmcgui.Window):
def __init__(self):
super().__init__()
self.heading = CreateHeader()
def createBookingDisplay(self):
self.displayAndInitialise()
return self
def displayAndInitialise(self):
self.heading.drawHeading()
self.addControl(self.heading.timeCtrl)
class CreateHeader:
def __init__(self):
self.timeCtrl = xbmcgui.ControlLabel(100, 0, 500, 20, "", alignment=0x00000001)
def drawHeading(self):
self.timeCtrl.setLabel(datetime.now().strftime('%A %d %B %H:%M'))
if __name__ == "__main__":
main()
Any ideas as to what is causing this?