how to get list of arrays for button controls?

Discussion of plugin / script development for XBMC4Xbox
Post Reply
chris0147
Posts: 24
Joined: Thu Jun 19, 2014 4:48 pm

how to get list of arrays for button controls?

Post by chris0147 »

Hi guys

I need your help, I have got a problem with my code. I'm trying to fetch for each button when I stored them in the arrays using append method.

When I try this:

Code: Select all

if programs_width >= 181:
    for elem in self.program_buttons:
         position_x = self.program_buttons[elem.control][self.channels_Index].getX()
         position_y = self.program_buttons[elem.control][self.channels_Index].getY()
         self.program_buttons[elem.control][self.channels_Index].setPosition(position_x, position_y - 342)


It will not fetch for every button as i'm getting an error:

Code: Select all

position_x = self.program_buttons[elem.control][self.channels_Index].getX()
AttributeError: 'list' object has no attribute 'control'


Here is the full code:

Code: Select all

def GoRight(self):
    basex, basey = self.getControl(4207 + self.channels_Index).getPosition()
    basew = self.getControl(4207 + self.channels_Index).getWidth()

    # change program controls to display the proper junks
    if self.channels_Index == len(self.program_buttons[self.programs_Index]) - 1:
        CurrentRow = self.program_buttons[self.programs_Index][self.channels_Index].getX()
        pixel_end = 1073

        #Check on pixels size between start and end time
        if CurrentRow < pixel_end:
            programs_width = self.program_buttons[self.programs_Index][self.channels_Index].getWidth()
            #left, top = self.program_buttons[self.programs_Index][self.channels_Index].getPosition()
            #left = left - basex
            #print left
            #starttime = self.showTime + (left / (basew / 5400.0))
            #self.setChannelButtons(self.shownTime + 1800, self.centerChannel)
            #currentbutton_index = self.findButtonAtTime(self.programs_Index, starttime + 30)

            #if(currentbutton_index + 1) < len(self.program_buttons[self.programs_Index]):
                #self.channels_Index = currentbutton_index + 1
            #else:
                #self.channels_Index = len(self.program_buttons[self.programs_Index]) - 1

            if programs_width <= 0.:
                pass
                #hide the button

            else:
                self.programs_Index += 1

        else:
            programs_width = self.program_buttons[self.programs_Index][self.channels_Index].getWidth()

            if programs_width >= 181:
                for elem in self.program_buttons:
                    position_x = self.program_buttons[elem.control][self.channels_Index].getX()
                    position_y = self.program_buttons[elem.control][self.channels_Index].getY()
                    self.program_buttons[elem.control][self.channels_Index].setPosition(position_x, position_y - 342)

    #left = left - basex
    #starttime = self.shownTime + (left / (basew / 5400.0))
    #endtime = starttime + (width / (basew / 5400.0))
    self.setFocus(self.program_buttons[self.programs_Index][self.channels_Index])


I'm trying to find out how I can fetch for each button before I could do something.

Do you know how I can fetch for each button so I could controls them?
Post Reply