@Roman_V_M: Thank you very much for this. What I want to achieve is I want to use the same buttons id when I readd the buttons after I removed them using in python. I tried to use the grouplist control but it will slow down and freeze the screen.
So how I can use the same buttons id when I readd them?
If the simple list of button object can do the trick, I wonder how I can readd the list of buttons in the same list of buttons when I call on two different threads?
e.g:
Code:
class ProgramControls(object):
def __init__(self, control, program):
self.control = control
self.program = program
class MyClass(xbmcgui.WindowXML):
def __init__(self):
self.program_buttons = list()
def GoDown(self):
if self.channels_Index == 0:
....code list
#if channels is greater than 7
else:
self.channels_Index += 1
self.programs_Index += 69
if programs_button > 1:
#add the program buttons
program_controls = xbmcgui.ControlButton(
int(pos_start),
int(pos_top),
int(pos_width),
int(pos_height),
prog_title,
focusTexture = self.path + self.button_focus,
noFocusTexture = self.path + self.button_nofocus,
textColor ='0xFFFFFFFF',
focusedColor ='0xFF000000'
)
self.addControl(program_controls)
self.program_buttons.append(ProgramControls(program_controls, program))
def All_Channels(self):
...code list goes here
program_controls = xbmcgui.ControlButton(
int(position_start),
int(position_top),
int(program_width),
int(program_height),
program_title,
focusTexture = path + self.button_focus,
noFocusTexture = path + self.button_nofocus,
textColor ='0xFFFFFFFF',
focusedColor ='0xFF000000'
)
self.program_buttons.append(ProgramControls(program_controls, program))
programs_button = [elem.control for elem in self.program_buttons]
#add the programs buttons
if programs_button > 1:
self.addControls(programs_button)
def Remove_Controls(self):
controls = [elem.control for elem in self.program_buttons]
try:
self.removeControls(controls)
except RuntimeError:
for elem in self.program_buttons:
try:
self.removeControl(elem.control)
except RuntimeError:
pass # happens if we try to remove a control that doesn't exist
del self.program_buttons[:]
I use All_Channels to add the list of buttons when I hit on the enter button of the keyboard to call on All_Channels function so I can add the list of program buttons in the array.
When I hit on the down arrow button, it will call the GoDown function to add the list of buttons. I want to readd the list of buttons in the same array as the All_Channels buttons.
How I can do that?