def __init__(self, item, menu, name, **kw): self.item = item self.actions_dict = { 'hide': { 'handler': self.hide, 'caption': _('Hide'), 'checked': bool(self.item['hidden']), 'args': ('hide', ), 'kwargs': {} }, 'unhide': { 'handler': self.hide, 'caption': _('Unhide'), 'checked': not bool(self.item['hidden']), 'args': ('unhide', ), 'kwargs': {} } } self.title = name self.field = 'protection' if item['hidden']: name = _('Hidden') else: name = _('Unhide') ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) self.radio = True return None
def __init__(self, menu, name, **kw): self.player = menu current_ratio = menu.aspect_ratio self.actions_dict = { '4_3': { 'handler': self.set_aspect_ratio, 'caption': _('4:3'), 'checked': current_ratio == '4_3', 'args': ('4_3', ), 'kwargs': {} }, '16_9': { 'handler': self.set_aspect_ratio, 'caption': _('16:9'), 'checked': current_ratio == '16_9', 'args': ('16_9', ), 'kwargs': {} } } self.radio = True ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) return None
def __init__(self, player, *args, **kw): ActionContainer.__init__(self, *args, **kw) self.player = player self.radio = True sel = ((True, False) if self.player.playmode == 'track' else (False, True)) self.actions_dict = { 'track': { 'handler': self.set_play_mode, 'caption': _('One'), 'checked': sel[0], 'args': ('track', ), 'kwargs': {}, 'pos': 1 }, 'all': { 'handler': self.set_play_mode, 'caption': _('List'), 'checked': sel[1], 'args': ('all', ), 'kwargs': {}, 'pos': 2 } } return None
def __init__(self, item, menu, name, **kw): self.item = item self._dvd = menu.wydvd self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) audio_id = self._dvd.get_audio_stream() self.radio = True for s in xrange(self._dvd.get_available_stream()['nb_audio']): tt = self._dvd.get_audio_info(s) key = tt['language'] if key not in ('\xff\xff', ''): try: lang = country_dict[key]['language'] except KeyError: lang = key caption = '%s %s %d' % (lang, tt['coding'], tt['channels']) self.actions_dict[s] = dict(handler=self.audiostreams, caption=caption, checked=s == audio_id, args=(s, ), kwargs=dict(), pos=s) return None
def __init__(self, item, menu, name, **kw): self.item = item self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) self.radio = True lang_dict = {} for i, sub in enumerate(self.menu.get_audio_substreams()): lang = sub[0] try: caption = _(country_dict[lang[:2]]['language']) except KeyError: caption = lang if len(sub) > 3 and sub[3] not in ('mp2', ): caption += '-' + audio_codec_substitution_dict.get( sub[3], sub[3]) num = lang_dict.get(caption, 0) lang_dict[caption] = num + 1 if num: caption += '-%d' % num sid = sub[2] self.actions_dict[sid] = dict(handler=self.substreams, caption=caption, checked=sub[1], pos=i, args=(self.menu, sid), kwargs=dict()) return None
def __init__(self, item, menu, name, **kw): self.item = item self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) self.radio = True lang_dict = {} for sub in self.menu.get_subtitles(): try: caption = _(country_dict[sub[0][:2]]['language']) except KeyError: caption = _(sub[0]) try: nb = lang_dict[caption] lang_dict[caption] = nb + 1 caption = '%s-%.2d' % (caption, nb) except KeyError: lang_dict[caption] = 2 sid = sub[2] self.actions_dict[sid] = dict(handler=self.subtitles, caption=caption, checked=sub[1], args=(self.menu, sid), kwargs=dict(), pos=sid + 1) return None
def __init__(self, name, menu, **kw): pos = 0 self.player = menu self.actions_dict = dict() for buf_size in range(2, 64, 2): self.actions_dict[str(buf_size)] = dict(handler=self.set_buf_size, caption='%dMB'%buf_size, checked=(self.player.copy_buf_size == buf_size), pos=pos, args=(buf_size), kwargs=dict()) pos += 1 self.radio = True ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
def __init__(self, name, item, menu, **kw): self.item = item self.item.media_update() self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) self.radio = True pos = 0 for format in self.item.available_formats: caption = dailymotion_format_dict.get(format) self.actions_dict[format] = dict(handler=self.set_dailymotion_format, caption=caption, checked=format in self.item.choosen_format, pos=pos, args=(format,), kwargs=dict()) pos += 1
def __init__(self, item, menu, name, **kw): self.item = item self._dvd = menu.wydvd self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) _title = self._dvd.get_title_location()['num'] _angle = self._dvd.get_current_angle() self.radio = True for angle in xrange(1, self._dvd.get_number_of_angle(title=_title) + 1): caption = _('Angle %d') % angle self.actions_dict[angle] = dict(handler=self.camera, caption=caption, checked=angle == _angle, args=(angle,), kwargs=dict(), pos=angle)
def __init__(self, item, player, menu, name, **kw): self.item = item self._dvd = menu.wydvd self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) _ptt = self._dvd.get_ptt_location()['num'] _title = self._dvd.get_title_location()['num'] self.radio = True for ptt in xrange(1, self._dvd.get_number_of_ptt(_title) + 1): caption = _('Chapter %d') % ptt self.actions_dict[ptt] = dict(handler=self.chapters, caption=caption, checked=ptt == _ptt, args=(ptt, _title, player), kwargs=dict(), pos=ptt)
def __init__(self, item, menu, name, **kw): self.item = item self._dvd = menu.wydvd self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) audio_id = self._dvd.get_audio_stream() self.radio = True for s in xrange(self._dvd.get_available_stream()['nb_audio']): tt = self._dvd.get_audio_info(s) key = tt['language'] if key not in ('\xff\xff', ''): try: lang = country_dict[key]['language'] except KeyError: lang = key caption = '%s %s %d' % (lang, tt['coding'], tt['channels']) self.actions_dict[s] = dict(handler=self.audiostreams, caption=caption, checked=s == audio_id, args=(s,), kwargs=dict(), pos=s) continue
def __init__(self, item, player, name, **kw): self.item = item self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=player, **kw) _size = player.get_subs_size() self.radio = True for size in xrange(5, 100, 5): caption = _('%d') % size self.actions_dict[size] = dict(handler=self._set_subs_size, caption=caption, checked=(size == _size), args=(size, player), kwargs=dict(), pos=size) return None
def __init__(self, item, menu, name, **kw): self.item = item self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) self.radio = True from pygui.facilities.codemapping import transition_dict for trans in HMI_PHOTO['transitions']: caption = '%s' % transition_dict.get(trans, trans) self.actions_dict[trans] = dict( handler=self.transitions, caption=caption, checked=user_config['photo']['transition'] == trans, args=(trans, ), kwargs=dict()) return None
def __init__(self, item, menu, name, **kw): self.item = item self.actions_dict = { 'on': { 'handler': self.check_active, 'caption': _('Active'), 'checked': self.item.active, 'args': ('on', ), 'kwargs': {} }, 'off': { 'handler': self.check_active, 'caption': _('Inactive'), 'checked': not self.item.active, 'args': ('off', ), 'kwargs': {} } } ActionContainer.__init__(self, name, type_='info', menu=menu, **kw) return None
def __init__(self, item, menu, name, **kw): self.item = item self._dvd = menu.wydvd self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) sub_id = self._dvd.get_sub_stream() sub_ok = self._dvd.is_sub_enabled() self.radio = True self.actions_dict[-1] = { 'handler': self.subtitles, 'caption': _('OFF'), 'checked': not sub_ok, 'args': (-1, False), 'kwargs': dict(), 'pos': 0 } for s in xrange(self._dvd.get_available_stream()['nb_sub']): tt = self._dvd.get_sub_info(s) key = tt['language'] if key not in ('\xff\xff', ''): try: lang = country_dict[key]['language'] except KeyError: lang = key caption = '%i-%s' % (s, lang) self.actions_dict[s] = dict( handler=self.subtitles, caption=caption, checked=(sub_ok if s == sub_id else False), args=(s, True), kwargs=dict(), pos=s + 1) if len(self.actions_dict) == 1: self.actions_dict = dict() return None
def __init__(self, menu, name, **kw): self.player = menu current_format = menu.display_format values = [('letter_box', _('Original')), ('pan_scan', _('Full screen')), ('fullscreen', _('Cinema'))] actions_dict = {} for key, caption in values: action = { 'handler': self.set_display_format, 'caption': caption, 'checked': current_format == key, 'args': (key, ), 'kwargs': {} } actions_dict[key] = action self.actions_dict = actions_dict self.radio = True ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) return None
def __init__(self, player, *args, **kw): ActionContainer.__init__(self, *args, **kw) self.player = player self.radio = True if not self.player.repeat_mode: sel = (True, False, False) elif self.player.repeat_mode == 'track': sel = (False, True, False) elif self.player.repeat_mode == 'all': sel = (False, False, True) self.actions_dict = { 'off': { 'handler': self.set_repeat, 'caption': _('OFF'), 'checked': sel[0], 'args': ('off', ), 'kwargs': {}, 'pos': 1 }, 'track': { 'handler': self.set_repeat, 'caption': _('Track'), 'checked': sel[1], 'args': ('track', ), 'kwargs': {}, 'pos': 2 }, 'all': { 'handler': self.set_repeat, 'caption': _('All'), 'checked': sel[2], 'args': ('all', ), 'kwargs': {}, 'pos': 3 } } return None
def __init__(self, item, menu, name, **kw): self.item = item self._dvd = menu.wydvd self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) sub_id = self._dvd.get_sub_stream() sub_ok = self._dvd.is_sub_enabled() self.radio = True self.actions_dict[-1] = {'handler': self.subtitles, 'caption': _('OFF'), 'checked': not sub_ok, 'args': (-1, False), 'kwargs': dict(), 'pos': 0} for s in xrange(self._dvd.get_available_stream()['nb_sub']): tt = self._dvd.get_sub_info(s) key = tt['language'] if key not in ('\xff\xff', ''): try: lang = country_dict[key]['language'] except KeyError: lang = key caption = '%i-%s' % (s, lang) if s == sub_id: pass self.actions_dict[s] = dict(handler=self.subtitles, caption=caption, checked=s == sub_id, args=(s, True), kwargs=dict(), pos=s + 1) continue if len(self.actions_dict) == 1: self.actions_dict = dict()
def __init__(self, player, *args, **kw): ActionContainer.__init__(self, *args, **kw) self.radio = True self.player = player sel = ((False, True) if self.player.random_mode else (True, False)) self.actions_dict = { 'off': { 'handler': self.set_random, 'caption': _('OFF'), 'checked': sel[0], 'args': ('off', ), 'kwargs': {}, 'pos': 1 }, 'on': { 'handler': self.set_random, 'caption': _('ON'), 'checked': sel[1], 'args': ('on', ), 'kwargs': {}, 'pos': 2 } } return None
def __init__(self, name, menu, **kw): self.player = menu self.actions_dict = {'yes': {'handler': self.set_delete_record, 'caption': _('Yes'), 'checked': (self.player.delete_record == 'yes'), 'pos': 0, 'args': ('yes',), 'kwargs': {}}, 'no': {'handler': self.set_delete_record, 'caption': _('No'), 'checked': (self.player.delete_record == 'no'), 'pos': 1, 'args': ('no',), 'kwargs': {}}} self.radio = True ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
def __init__(self, item, menu, name, **kw): self.item = item if not self.item['maturity_rating']: rate = 0 else: rate = self.item['maturity_rating'] self.title = name self.field = 'parental_rating' self.actions_dict = { '0': { 'handler': self.rate, 'caption': _('No rating'), 'checked': rate == 0, 'args': ('0', ), 'kwargs': {}, 'pos': 0 }, '10': { 'handler': self.rate, 'caption': _('-10 years'), 'checked': rate == 10, 'args': ('10', ), 'kwargs': {}, 'pos': 1 }, '12': { 'handler': self.rate, 'caption': _('10 - 12 years'), 'checked': rate == 12, 'args': ('12', ), 'kwargs': {}, 'pos': 2 }, '16': { 'handler': self.rate, 'caption': _('12 - 16 years'), 'checked': rate == 16, 'args': ('16', ), 'kwargs': {}, 'pos': 3 }, '18': { 'handler': self.rate, 'caption': _('16 - 18 years'), 'checked': rate == 18, 'args': ('18', ), 'kwargs': {}, 'pos': 4 }, '99': { 'handler': self.rate, 'caption': _('Hidden'), 'checked': rate == 99, 'args': ('99', ), 'kwargs': {}, 'pos': 5 } } if rate not in self.actions_dict: rate = '0' name = self.actions_dict[rate]['caption'] ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) self.radio = True self._update_checked(rate) return None
]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb76a1dec>} nname: 0 n 0(None)[from __future__ import absolute_import from pygui.shared import pygui_globs from pygui.facilities.codemapping import country_dict from pygui.item.containers import ActionContainer class DvDSubtitlesActionItem(ActionContainer): def __init__(self, item, menu, name, **kw): self.item = item self._dvd = menu.wydvd self.actions_dict = dict() ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw) sub_id = self._dvd.get_sub_stream() sub_ok = self._dvd.is_sub_enabled() self.radio = True self.actions_dict[-1] = {'handler': self.subtitles, 'caption': _('OFF'), 'checked': not sub_ok, 'args': (-1, False), 'kwargs': dict(), 'pos': 0} for s in xrange(self._dvd.get_available_stream()['nb_sub']): tt = self._dvd.get_sub_info(s) key = tt['language'] if key not in ('\xff\xff', ''): try: lang = country_dict[key]['language'] except KeyError: lang = key caption = '%i-%s' % (s, lang) if s == sub_id: pass