I want to group some controls to a ControlGroup, so I can display and hide them.
How do I do this?
thanks
import xbmc, xbmcplugin, xbmcgui, xbmc, xbmcaddon
class TestWindow(xbmcgui.WindowDialog):
def __init__(self):
background = xbmcgui.ControlImage(120, 40, 1040, 600, 'ContentPanel.png')
self.addControl(background)
self.btnClose = xbmcgui.ControlButton(1083, 54, 64, 32, '', noFocusTexture='DialogCloseButton.png', focusTexture='DialogCloseButton-focus.png')
self.addControl(self.btnClose)
# I want to group these controls in grpinfo =============================
#===========================================================
self.grpinfo = xbmcgui.ControlGroup(400, 70, 520, 400)
self.addControl(self.grpinfo)
self.lbl_0 = xbmcgui.ControlLabel(414, 110, 157, 40, 'Hello World 0', alignment=0x00000001)
self.addControl(self.lbl_0)
self.lbl_1 = xbmcgui.ControlLabel(414, 150, 157, 40, 'Hello World 1', alignment=0x00000001)
self.addControl(self.lbl_1)
#===========================================================
#===========================================================
self.btnHide = xbmcgui.ControlButton(310, 580, 160, 40, 'Hide group', alignment=0x00000006, font='font12')
self.addControl(self.btnHide)
self.btnView = xbmcgui.ControlButton(560, 580, 160, 40, 'View group', alignment=0x00000006, font='font12')
self.addControl(self.btnView)
def onControl(self, control):
if control == self.btnClose:
self.close()
if control == self.btnHide:
self.grpinfo.setVisible(False)
if control == self.btnView:
self.grpinfo.setVisible(True)
addon_url = sys.argv[0]
addon_id = int(sys.argv[1])
paramstring = sys.argv[2]
if paramstring == '?test=true':
window = TestWindow()
window.doModal()
else:
tester = xbmcgui.ListItem('Window test')
url = addon_url + '?test=true'
xbmcplugin.addDirectoryItem(addon_id, url, tester, isFolder=False)
xbmcplugin.endOfDirectory(addon_id)