コード例 #1
0
ファイル: Row.py プロジェクト: radicaldelusion/Collections
    def addRadioButton(self, column, current, default, saveCallback=None, changeCallback=None, label='', columnspan=1, padX=0, textOffsetX=0, alignment=None, enabled=True):
        if alignment is not None:    
            radioB = pyxbmct.RadioButton(label, _alignment=alignment, textOffsetX=textOffsetX)
        else:                        
            radioB = pyxbmct.RadioButton(label, textOffsetX=textOffsetX)
            
        assignedValue = [False]     #this is a list only cause of python scope issues
        
        
        def init():
            radioB.setSelected(current)
            
        def onChange():
            assignedValue[0] = [True]
            if changeCallback:
                changeCallback(bool(radioB.isSelected()))
        
        def onDefault():
            radioB.setSelected(default)
            onChange()
        
        if saveCallback:            
            def onSave():
                if assignedValue[0]:
                    saveCallback(bool(radioB.isSelected()))
        else:
            onSave = None
 
 
        rowControl = self.addRowControl(radioB, column, columnspan, padX, action=onChange, onDefault=onDefault, onSave=onSave, init=init, enabled=enabled)        
        return rowControl
コード例 #2
0
    def __init__(self, context=None, window=None):
        self.title = i18n('Composite Playlist')
        self.description_label = i18n(
            'Generate a playlist from the information below')

        super(CompositePlaylistWindow, self).__init__(self.title)  # pylint: disable=super-with-arguments

        self._context = context
        self.window = window

        self.player = xbmc.Player()

        self.playlist_data = {
            'content': 'tvshows',
            'item_count': 50,
            'servers': [(i18n('All Servers'), None)],
            'source': (i18n('On Deck'), 'on_deck'),
            'shuffle': False
        }

        self._servers = []
        self._sources = [
            (i18n('All'), 'all'),
            (i18n('On Deck'), 'on_deck'),
            (i18n('Recently Added'), 'recent_added'),
            (i18n('Recently Released'), 'recent_released'),
        ]
        self._item_counts = [
            '1', '5', '10', '25', '50', '100', '250', '500', '1000'
        ]

        self.description = pyxbmct.Label(self.description_label, alignment=0)

        self.movies_radio = pyxbmct.RadioButton(self.bold(i18n('Movies')))
        self.tvshows_radio = pyxbmct.RadioButton(self.bold(i18n('TV Shows')))
        self.mixed_radio = pyxbmct.RadioButton(self.bold(i18n('Mixed')))

        self.item_count_label = pyxbmct.Label(self.bold(i18n('Item Count')),
                                              alignment=0)
        self.item_count = pyxbmct.Label(str(self.playlist_data['item_count']),
                                        alignment=1)
        self.item_count_list = pyxbmct.List()

        self.server_label = pyxbmct.Label(self.bold(i18n('Server(s)')),
                                          alignment=0)
        self.server_choice_label = pyxbmct.FadeLabel()
        self.server_list = pyxbmct.List()

        self.source_label = pyxbmct.Label(self.bold(i18n('Source')))
        self.source_choice_label = pyxbmct.FadeLabel()
        self.source_list = pyxbmct.List()

        self.shuffle_radio = pyxbmct.RadioButton(self.bold(i18n('Shuffle')))

        self.cancel_button = pyxbmct.Button(i18n('Cancel'))
        self.play_button = pyxbmct.Button(i18n('Play'))

        self.generated = False
コード例 #3
0
    if position < count - 1:
        position = position + 1
        window.setFocus(radiobuttons[position])
        clickcount = clickcount - 1
    elif position == count - 1:
        clickcount = clickcount - 1
        position = position + 1
        window.setFocus(button)


count = 0
controlurls = []
radiobuttons = []
for key, value in sockets.iteritems():
    radiobuttons.append("radiobutton" + str(count))
    radiobuttons[count] = pyxbmct.RadioButton(key)
    window.placeControl(radiobuttons[count], count, 0, columnspan=3)
    if str(value[2]) == '1':
        swstate = '0'
    else:
        swstate = '1'
    controlurl = "http://" + urlwebinterface + "?group=" + value[
        0] + "&switch=" + value[1] + "&action=" + swstate
    controlurls.append(controlurl)
    if value[2] == 1:
        radiobuttons[count].setSelected(True)

    count = count + 1

position = count
for x in range(count):
コード例 #4
0
 def create_checkbox(self, name, text, **kwargs):
     self.__put_object(name, pyxbmct.RadioButton(text, **kwargs))
     self.__get_object(name)._type = 'checkbox'