2015-01-13, 05:07
huh, ok, so after a couple of days I've actually found out I can change the menu items by declaring the items at the top and rem'ming out the line which set the menu items up previously:
so that leaves me being able to set the menu options the way I would like, but now how to code the menu to say if number 1 is selected, run this script..?
Code:
import os
import xbmc
import xbmcaddon
import pyxbmct.addonwindow as pyxbmct
_addon = xbmcaddon.Addon()
_addon_path = _addon.getAddonInfo('path')
items = ('Number1','Number2')
class MyAddon(pyxbmct.AddonDialogWindow):
def __init__(self, title=''):
super(MyAddon, self).__init__(title)
self.setGeometry(500, 450, 9, 4)
self.set_active_controls()
self.set_navigation()
self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
def set_active_controls(self):
self.list = pyxbmct.List()
self.placeControl(self.list, 0, 0, 15, 4)
#items = ['Item {0}'.format(i) for i in range(1, 8)]
self.list.addItems(items)
self.connect(self.list, lambda: xbmc.executebuiltin('Notification(Note!,{0} selected.)'.format(
self.list.getListItem(self.list.getSelectedPosition()).getLabel())))
self.connectEventList(
[pyxbmct.ACTION_MOVE_DOWN,
pyxbmct.ACTION_MOVE_UP,
pyxbmct.ACTION_MOUSE_WHEEL_DOWN,
pyxbmct.ACTION_MOUSE_WHEEL_UP,
pyxbmct.ACTION_MOUSE_MOVE],
self.list_update)
self.button = pyxbmct.Button('Close')
self.placeControl(self.button, 8, 3)
self.connect(self.button, self.close)
def set_navigation(self):
self.setFocus(self.list)
def list_update(self):
try:
if self.getFocus() == self.list:
self.list_item_label.setLabel(self.list.getListItem(self.list.getSelectedPosition()).getLabel())
else:
self.list_item_label.setLabel('')
except (RuntimeError, SystemError):
pass
def setAnimation(self, control):
control.setAnimations([('WindowOpen', 'effect=fade start=0 end=100 time=500',),
('WindowClose', 'effect=fade start=100 end=0 time=500',)])
def Number1()
xbmc.executebuiltin('Notification(Note!,Number 1 Selected!)')
def Number2()
xbmc.executebuiltin('Notification(Note!,Number 2 Selected!)')
if __name__ == '__main__':
window = MyAddon('Scripts')
window.doModal()
so that leaves me being able to set the menu options the way I would like, but now how to code the menu to say if number 1 is selected, run this script..?