Hi guys,
I have added the list of buttons for the channels and programs in the xbmc skin. I have one yellow box on the channel and program box for both buttons. I want to know how I can move the yellow box to go to the next program when I press on the left and right arrow buttons of the keyboard and how i can go to the next channel when I press on the up and down arrow buttons of the keyboard.
Here is the screenshot:
http://oi62.tinypic.com/30ag8k8.jpg
Here is the code:
def Channels(self):
for row in programs:
program = row[1].encode('ascii'), str(row[2]), str(row[3])
title = row[1].encode('ascii')
program_start_date = str(row[2])
program_end_date = str(row[3])
#convert the date formats into minutes
minutes_start = self.parseDateTimeToMinutesSinceEpoch(program_start_date)
minutes_end = self.parseDateTimeToMinutesSinceEpoch(program_end_date)
minutes_length = minutes_end - minutes_start
program_length = minutes_length
program_notification = program
programs_top = 315
program_height = 34.5
program_gap = 2.5
position_start = start_pos
position_top = programs_top + channel_index * (program_height + program_gap)
if 10 <= program_length < 60:
program_width = 342.5
elif 60 <= program_length < 90:
program_width = 690
elif 90 <= program_length < 105:
program_width = 1050
elif 105 <= program_length < 120:
program_width = 1400
elif 120 <= program_length < 150:
program_width = 1750
elif 150 <= program_length < 180:
program_width = 2100
elif 180 <= program_length < 210:
program_width = 2450
elif 210 <= program_length < 240:
program_width = 2800
elif 240 <= program_length < 270:
program_width = 3150
elif 270 <= program_length < 300:
program_width = 3500
elif 300 <= program_length < 330:
program_width = 3850
elif 330 <= program_length < 360:
program_width = 4200
elif 360 <= program_length < 390:
program_width = 3250
elif 390 <= program_length < 420:
program_width = 4550
elif 420 <= program_length < 450:
program_width = 4900
elif 450 <= program_length < 480:
program_width = 5250
start_pos += program_width + 2 * program_gap
if program_width > 1:
if yellow_flag:
if program_notification:
button_nofocus = 'changelang_yellow.png'
button_focus = 'channels_bar1.png'
else:
button_nofocus = 'changelang_yellow.png'
button_focus = 'channels_bar1.png'
yellow_flag = False
text_color = '0xFF000000'
else:
if program_notification:
button_nofocus = 'channels_bar1.png'
button_focus = 'channels_yellow.png'
else:
button_nofocus = 'channels_bar1.png'
button_focus = 'channels_yellow.png'
text_color = '0xFFFFFFFF'
if program_width < 1:
program_title = ''
else:
program_title = '[B]' + title + '[/B]'
program_controls = xbmcgui.ControlButton(
position_start,
position_top,
program_width,
program_height,
program_title,
textColor = text_color,
focusTexture = button_focus,
noFocusTexture = button_nofocus
)
self.addControl(program_controls)
def onAction(self, action):
if action == ACTION_MOVE_LEFT:
if action == ACTION_MOVE_RIGHT:
if action == ACTION_MOVE_UP:
if action == ACTION_MOVE_DOWN:
Do you know how I can move the yellow box to go to the next program when I press on the left and right arrow buttons of the keyboard and how i can go to the next channel when I press on the up and down arrow buttons of the keyboard??