Esempio n. 1
0
def get_action_info_list(context):
	stack = pygui_globs['menustack']
	act = []
	fl = markerlists().get(context['menu'].universe)
	if context['menu'].type in ('image', 'video', 'video_image'):
		pass
	menu_video_photo = False
	if context['menu'].type in ('audio',):
		pass
	menu_music = False
	if isinstance(stack.menus_stack[-2], menu.MarkerNavigator):
		for stack_layer in reversed(stack.menus_stack):
			if isinstance(stack_layer, menu.Navigator) and not isinstance(stack_layer, menu.MarkerNavigator):
				break
				continue
		if stack_layer:
			act.append(ActionItem(_('Display'), type_='action', action=(lambda : stack.back_to_menu(stack_layer))))
	if (menu_music or menu_video_photo) and (user_config['security']['parent_mode'] or not user_config['security']['parental_control']):
		if context['parent']['backend'] != 'upnp':
			act.append(ActionItem(_('Create a new folder'), type_='action', action=execute_mkdir, args=[context]))
	if fl and context['parent']['backend'] != 'upnp' and (user_config['security']['parent_mode'] or not user_config['security']['parental_control']):
		act.append(ActionItem(_('Duplicate marked item'), type_='action', action=execute_copy_marked_items, args=[context['parent'], fl]))
		for plugin_name in ('marker_create_playlist',):
			plugin = actions[plugin_name]
			act.append(ActionItem(_(plugin.caption), type_='action', action=plugin.execute, args=[context]))
	if menu_video_photo and any(<genexpr>(context['menu'].get_item_list('main_list'))):
		act.append(ActionItem(_('Display "%s" as thumbnails') % context['parent'].name, type_='action', action=push_thumbnail_menu, args=(context, stack)))
Esempio n. 2
0
def get_action_info_list(context):
	menu = context['menu']
	menu_type = menu.type
	act = []
	act.append(ActionItem(_('Choose an URL'), type_='action', action=execute_goto, args=[context]))
	act.append(ActionItem(_('Add to favorites'), type_='action', action=execute_bookmark, args=[context]))
	for item in menu.bookmarks:
		act.append(ActionItem(item.name, type_='action', action=menu.play, args=[item]))
	return act
Esempio n. 3
0
def get_action_info_list(context):
	stack = pygui_globs['menustack']
	menu = context['menu']
	previous_menu = stack.menus_stack[-2]
	act = [ActionItem(_('Program a recording'), type_='action', action=schedule_record, args=[context['selected'], previous_menu, stack]), ActionItem(_('Go to scheduled recordings'), type_='action', action=goto_schedule_record, args=[context['selected'], previous_menu, stack]), DisplayFormatActionItem(menu, _('Picture size'))]
	if 'tv' in plugins:
		act.insert(0, ActionItem(_('Display program guide'), type_='action', action=display_epg, args=[context['menu'], stack]))
		act.append(SubtitlesActionItem(context['selected'], menu, _('Subtitles')))
		act.append(AudioSubstreamsActionItem(context['selected'], menu, _('Audio tracks')))
	return act
Esempio n. 4
0
 def browse(self, preview=False):
     return [
         ActionItem(name=_('Automatic'),
                    type_='setupparameters',
                    action=self._callback,
                    args=('upnp', )),
         ActionItem(name=_('Manual'),
                    type_='setupparameters',
                    action=self._callback,
                    args=('static', ))
     ]
Esempio n. 5
0
 def browse(self, preview=False):
     return [
         ActionItem(name=_('Ethernet'),
                    type_='setupparameters',
                    action=self._callback,
                    args=('802.3', )),
         ActionItem(name=_('Wireless'),
                    type_='setupparameters',
                    action=self._callback,
                    args=('802.11', ))
     ]
Esempio n. 6
0
 def __init__(self,
              name,
              type_,
              check=True,
              end_action=None,
              end_action_args=(),
              end_action_kw={}):
     ActionItem.__init__(self, name, type_, action=self._launch_qa_menu)
     self._check = check
     self._end_action = end_action
     self._end_action_args = end_action_args
     self._end_action_kw = end_action_kw
     return None
Esempio n. 7
0
 def browse(self, preview=False):
     return [
         ActionItem(name=_('Yes'),
                    type_='setupitem',
                    action=(lambda: TNTAutomaticScanItem(parent=None,
                                                         name=_('Yes'),
                                                         menu=self.menu,
                                                         type_='setupitem').
                            execute())),
         ActionItem(name=_('No'),
                    type_='setupitem',
                    action=(lambda: self.menu._set_options_list(None)))
     ]
Esempio n. 8
0
def get_action_info_list(context):
	act = []
	if context['selected'] is None:
		return ret
	fl = get_marker_from_item(context['selected'])
	import pygui.menu as menu
	if context['selected'].type in ('dir',):
		act.append(ActionItem(_('Delete highlighted directory'), type_='action', action=execute_delete, args=[context, fl]))
	else:
		if 'image' in context['selected'].type:
			act.append(ActionItem(_('Delete'), type_='action', action=execute_delete, args=[context, fl]))
	act.append(ActionItem(_('Back to Navigator'), type_='action', action=context['menu'].hide))
	return act
Esempio n. 9
0
 def __init__(self, extra_num, *args, **kw):
     ParametersSetupItem.__init__(self, *args, **kw)
     self.extra_num = extra_num
     self.Start_Extra_Item = ActionItem(_('Start Extra'),
                                        type_='setupitem',
                                        display_type=self._get_extra_status(
                                            'yes', 1),
                                        action=self._start_extra,
                                        args=[])
     self.Stop_Extra_Item = ActionItem(_('Stop Extra'),
                                       type_='setupitem',
                                       display_type=self._get_extra_status(
                                           'no', 1),
                                       action=self._stop_extra,
                                       args=[])
     self.Enable_Extra_Item = ActionItem(
         _('Enable Extra'),
         type_='setupitem',
         display_type=self._get_extra_status('running', 2),
         action=self._enable_extra,
         args=[])
     self.Disable_Extra_Item = ActionItem(
         _('Disable Extra'),
         type_='setupitem',
         display_type=self._get_extra_status('stopped', 2),
         action=self._disable_extra,
         args=[])
     self.preview_list = [
         self.Start_Extra_Item, self.Stop_Extra_Item,
         self.Enable_Extra_Item, self.Disable_Extra_Item
     ]
Esempio n. 10
0
    def browse(self, preview=False):
        if not self._items:

            def _validate(kb):
                self.pattern = kb._text
                YoutubeConfig().AddUser(self.pattern)
                new_dir = YoutubePlaylistContainer(
                    self.pattern, (lambda query=self.pattern: Youtube_GData.
                                   search_playlist(username=query)),
                    menu=self.menu,
                    parent=self)
                self._items.append(new_dir)
                kb.hide()
                self.menu.get_item_list('main_list').append(new_dir)
                return None

            def _search():
                kb = KeyboardWindow(_('User name'),
                                    text=self.pattern,
                                    confirm_action=_validate)
                kb.show()
                return None

            self._items = [
                ActionItem(_('Add User') + '...', type_='exe', action=_search)
            ]
            for username in YoutubeConfig().GetUsers():
                self._items.append(
                    YoutubePlaylistContainer(
                        username, (lambda name=username: Youtube_GData.
                                   search_playlist(username=name)),
                        menu=self.menu,
                        parent=self))
        return self._items
Esempio n. 11
0
    def browse(self, preview=False):
        win = LoadingWindow()
        win.show()
        if not self._items:

            def _validate_password(kb):
                self.password = kb._text
                kb.hide()
                try:
                    PicasaGData.ClientLogin(self.email, self.password)
                except:
                    MessageWindow(text=_('Invalid email or password'),
                                  title=_('Picasa Error'),
                                  button=False).show(timeout=5)
                    kb.hide()
                    return None
                PicasaConfig().AddPrivateUser(self.email, self.password)
                userfeed = PicasaGData.GetUserFeed(user='******')
                new_user = PicasaPrivateUserContainer(
                    name=userfeed.nickname.text,
                    username=self.email,
                    menu=self.menu,
                    parent=self,
                    thumbnail=userfeed.thumbnail.text)
                self._items.append(new_user)
                self.menu.get_item_list('main_list').append(new_user)
                return None

            def _validate_email(kb):
                self.email = kb._text
                kb.hide()
                kb = KeyboardWindow(_('Enter password'),
                                    text=self.password,
                                    confirm_action=_validate_password)
                kb.show()
                return None

            def _add_user():
                kb = KeyboardWindow(_('Enter email'),
                                    text=self.email,
                                    confirm_action=_validate_email)
                kb.show()
                return None

            self._items = [
                ActionItem(_('Add Users') + '...',
                           type_='exe',
                           action=_add_user)
            ]
            for username in PicasaConfig().GetPrivateUsers():
                userfeed = PicasaGData.GetUserFeed(user=username)
                self._items.append(
                    PicasaPrivateUserContainer(
                        name=userfeed.nickname.text,
                        username=username,
                        menu=self.menu,
                        parent=self,
                        thumbnail=userfeed.thumbnail.text))
        win.hide()
        return self._items
Esempio n. 12
0
 def browse(self, preview=False):
     return [
         IpSetupItem(can_modify=True,
                     callback=self._update_values,
                     callback_args=('ipAddress', ),
                     active_values=self._default_values),
         NetmaskSetupItem(can_modify=True,
                          callback=self._update_values,
                          callback_args=('netmask', ),
                          active_values=self._default_values),
         GatewaySetupItem(can_modify=True,
                          callback=self._update_values,
                          callback_args=('gateway', ),
                          active_values=self._default_values),
         DnsSetupItem(dns_num=1,
                      can_modify=True,
                      callback=self._update_values,
                      callback_args=('dns1', ),
                      active_values=self._default_values),
         DnsSetupItem(dns_num=2,
                      can_modify=True,
                      callback=self._update_values,
                      callback_args=('dns2', ),
                      active_values=self._default_values),
         ActionItem(_('Apply'),
                    type_='setupitem',
                    action=self._callback,
                    args=[self._default_values])
     ]
Esempio n. 13
0
 def __init__(self, *args, **kw):
     global glob_usb_mode_dict, glob_current_usb_mode, glob_ps3_fw_dict, glob_current_ps3_fw, glob_usb_mode_orig
     self._get_psfreedom_conf()
     glob_usb_mode_orig = glob_current_usb_mode
     ParametersSetupItem.__init__(self, *args, **kw)
     self.USBModeItem = PSFreedomCommonSetupItem(name=_(
         'Mode: %s' % (glob_usb_mode_dict[glob_current_usb_mode])),
                                                 type_='setupitem',
                                                 menu=self.menu,
                                                 display_type=None,
                                                 action=self._set_usb_mode)
     self.PS3FwVersionItem = PSFreedomCommonSetupItem(
         name=_('PS3 firmware: v%s' %
                (glob_ps3_fw_dict[glob_current_ps3_fw])),
         type_='setupitem',
         menu=self.menu,
         display_type=None,
         action=self._set_ps3_fw_version)
     self.PSFreedomStatusItem = PSFreedomCommonSetupItem(name=_(
         'Status: %s' % (self._get_psfreedom_status())),
                                                         type_='setupitem',
                                                         menu=self.menu,
                                                         display_type=None,
                                                         action=None)
     self.SaveSettingsItem = ActionItem(name=_('Save settings'),
                                        type_='setupitem',
                                        display_type=None,
                                        action=self._save_usb_mode)
     self.refresh_task = Task(self._refresh_status)
Esempio n. 14
0
 def browse(self, preview=False):
     return [
         ActionItem(name=self.iter_.get(i, str(i)),
                    type_='unknown',
                    menu=self.menu,
                    action=self.parent._select_option,
                    kwargs=dict(chosen_value=i)) for i in sorted(self.iter_)
     ]
Esempio n. 15
0
def get_action_info_list(context):
	menu = context['menu']
	menu_type = menu.type
	selected_item = context['selected']
	act = []
	if 'video' in menu_type:
		act.append(DisplayFormatActionItem(menu, _('Display format')))
	if selected_item.type in ('audio',):
		act.append(RepeatAudioActionItem(name=_('Repeat'), player=menu, type_='action'))
		act.append(RandomModeActionItem(name=_('Random'), player=menu, type_='action'))
	if selected_item.type in ('video',):
		act.append(SubtitlesActionItem(selected_item, menu, _('Subtitles')))
		act.append(AudioSubstreamsActionItem(selected_item, menu, _('Audio language')))
		if selected_item['backend'] not in ('wyrecord',):
			act.append(PlayModeVideoActionItem(name=_('Play mode'), player=menu, type_='action'))
		act.append(RepeatVideoActionItem(name=_('Repeat'), player=menu, type_='action'))
	tmp_left = ActionItem(_('Left rotation'), type_='action', action=rotate_left, args=[context])
	tmp_right = ActionItem(_('Right rotation'), type_='action', action=rotate_right, args=[context])
	if selected_item.type in ('image',):
		act.append(TransitionsActionItem(selected_item, menu, _('Transitions')))
		act.append(ActionItem(_('Left rotation'), type_='action', action=rotate_left, args=[context]))
		act.append(ActionItem(_('Right rotation'), type_='action', action=rotate_right, args=[context]))
	if selected_item.type in ('net',):
		act.append(ActionItem(_('Play embedded audio'), type_='action', action=play_embedded_audio, args=[context]))
		act.append(ActionItem(_('Play embedded video'), type_='action', action=play_embedded_video, args=[context]))
		act.append(ActionItem(_('Play embedded image'), type_='action', action=play_embedded_image, args=[context]))
	return act
Esempio n. 16
0
def get_action_info_list(context):
	menu_type = context['menu'].type
	from pygui.markerlist import markerlists
	fl = markerlists().get(context['menu'].universe)
	if fl is not None:
		fl.menu = context['menu']
	act = []
	if user_config['security']['parent_mode'] or not user_config['security']['parental_control']:
		if menu_type in ('tv_navigator',):
			selected = context['selected']
			if isinstance(selected, Playlist):
				act.append(ActionItem(_('Rename'), type_='action', action=execute_rename, args=[context]))
				act.append(ActionItem(_('Delete'), type_='action', action=execute_delete, args=[context, fl]))
			return act
		if menu_type in ('scheduled_navigator',):
			act.append(ActionItem(_('Rename'), type_='action', action=execute_rename_record, args=[context]))
			act.append(ActionItem(_('Delete'), type_='action', action=execute_cancel_record, args=[context]))
			return act
		if context['selected']['backend'] != 'upnp':
			act.append(ActionItem(_('Rename'), type_='action', action=execute_rename, args=[context]))
			act.append(ActionItem(_('Delete'), type_='action', action=execute_delete, args=[context, fl]))
	if 'transcode' in plugins and context['selected'].type in ('video',):
		from pygui.shared import pygui_globs
		psp_path = pygui_globs['psp_path']
		if psp_path:
			from pygui.actions.jobs.transcode import transcode
			context['psp_path'] = psp_path
			act.append(ActionItem(_('Transcode to PSP\xe2\x84\xa2'), type_='action', action=transcode, args=[context]))
	return act
Esempio n. 17
0
 def browse(self, preview=False):
     from pygui.facilities.codemapping import wifi_security_dict
     return [
         ActionItem(infos['caption'],
                    type_='setupitem',
                    action=self._callback,
                    args=(infos, ))
         for key_type, infos in wifi_security_dict.items()
     ]
Esempio n. 18
0
def get_action_info_list(context):
    return [
        ActionItem(_('Search'),
                   type_='action',
                   action=push_search_menu,
                   args=[context, pygui_globs['menustack']]),
        ChangeYoutubeVideoFormatItem(_('Choose video format'),
                                     context['selected'], context['menu'])
    ]
Esempio n. 19
0
class TNTScanMenuSetupItem(ParametersSetupItem):

    depth = 2

    def __init__(self, *args, **kw):
        ParametersSetupItem.__init__(self, *args, **kw)
        self.include_scrambled = user_config['tv']['scan_with_scrambled']
        self.all_channels_item = ActionItem(
            _('Free and pay channels'),
            type_='setupitem',
            display_type=('checked'
                          if self.include_scrambled else 'not_checked'),
            action=self.set_include_scrambled,
            args=(True, ))
        self.free_channels_only_item = ActionItem(
            _('Free channels only'),
            type_='setupitem',
            display_type=('not_checked'
                          if self.include_scrambled else 'checked'),
            action=self.set_include_scrambled,
            args=(False, ))
        self.preview_list = [
            self.all_channels_item, self.free_channels_only_item,
            TNTAutomaticScanItem(parent=self,
                                 name='Start scan',
                                 type_='setupitem')
        ]
        return None

    # Set whether to include scrambled channels in the scan, and
    # update the display accordingly.
    #
    # Note: Canal+, being scrambled only part of the time, is considered
    # a free (not scrambled) channel for the purposes of the scan.
    def set_include_scrambled(self, value):
        self.include_scrambled = value
        self.all_channels_item.display_type = ('checked'
                                               if value else 'not_checked')
        self.free_channels_only_item.display_type = ('not_checked'
                                                     if value else 'checked')
        self.all_channels_item.reset_view()
        self.free_channels_only_item.reset_view()
        return None
Esempio n. 20
0
def get_action_info_list(context):
	stack = pygui_globs['menustack']
	menu_type = context['menu'].type
	act = [ActionItem(_('Search'), type_='action', action=push_search_menu, args=[context])]
	if menu_type in ('image', 'video', 'video_image', 'audio'):
		if user_config['security']['parental_control']:
			if user_config['security']['parent_mode']:
				name = _('Set to child mode')
				action = switch_to_children_mode
				if user_config['security']['show_hidden']:
					pass
				val, name_hide = (True, _('Display hidden items'))
				act.append(ActionItem(name_hide, type_='action', action=display_hidden_items, args=[val, context, stack]))
			else:
				name = _('Set to parent mode')
				action = switch_to_parent_mode
			act.append(ActionItem(name, type_='action', action=action, args=[context, stack]))
	if menu_type in ('tv_navigator',):
		act = [ActionItem(_('Display program guide'), type_='action', action=display_epg, args=[context['menu'], stack])]
	return act
Esempio n. 21
0
 def __init__(self, universe_name, universe, related_items, *args, **kw):
     self._universe = universe
     self.universe_name = universe_name
     self.related_items = related_items
     self._to_delete = False
     self._total_size = 0
     l = []
     for i in related_items:
         if int(i['storageUsed']):
             l.append(int(i['storageUsed']))
         else:
             l.append(0)
     name = '%s %s' % (universe_name, bytes_to_human(sum(l)))
     ActionItem.__init__(self,
                         name,
                         type_='setupitem',
                         display_type='not_checked',
                         *args,
                         **kw)
     self.action = self._action
     return None
Esempio n. 22
0
def get_action_info_list(context):
	if context is None:
		return []
	if context['menu'].type in ('image', 'video', 'video_image'):
		pass
	menu_video_photo = False
	if context['menu'].type in ('audio',):
		pass
	menu_music = False
	fl = markerlists().get(context['menu'].universe)
	fl.menu = context['menu']
	act = [ActionItem(_('Display marker list'), type_='action', action=execute_show_marker, args=(context, fl))]
Esempio n. 23
0
def get_action_info_list(context):
	stack = pygui_globs['menustack']
	previous_menu = stack.menus_stack[-2]
	player = context['menu']
	wydvd = context['menu'].wydvd
	tmp = [DvDSubtitlesActionItem(context['selected'], context['menu'], _('Subtitles')),
				 DvDAudioStreamsActionItem(context['selected'], context['menu'], _('Sound track')),
				 DvDChaptersActionItem(context['selected'], player, context['menu'], _('Select chapter')),
				 DvDCameraAnglesActionItem(context['selected'], context['menu'], _('Change camera angle'))]
	actions_list = [act for act in tmp if act.actions_dict]
	actions_list.append(ActionItem(_('Go to DVD menu'), type_='action', action=go_to_menu, args=[context]))
	return actions_list
Esempio n. 24
0
	def __init__(self, item, data, name):
		self.rating_launcher = None
		if user_config['security']['parental_control'] and user_config['security']['parent_mode'] and data:
			self.rate_menu = RatingInfoMenu(item, self)
			current_rating = self.rate_menu.get_current_rating()
			rating_launcher = ActionItem(current_rating, type_='info', menu=self, display_type=None, action=self.show_rating, args=(), kwargs={})
			rating_launcher.title = _('Rating')
			rating_launcher.field = 'rating'
			data.append(rating_launcher)
			self.rating_launcher = rating_launcher
		else:
			self.rate_menu = None
		InfoMenu.__init__(self, item, data, name, type='media_info')
		self._getitems_keywords['hd_info_icon'] = (lambda : None)
		self._getitems_keywords['snd_info_icon'] = (lambda : None)
		log.debug('InfoWindow for %s: %s', item, item.wymedia_resource)
		try:
			item.watch(self._selection_changed)
			item.async_media_update()
		except AttributeError:
			log.warn('%s.watch failed !', item)
		return None
Esempio n. 25
0
    def browse(self, preview=False):
        win = LoadingWindow()
        win.show()
        if not self._items:

            def _validate(kb):
                self.pattern = kb._text
                try:
                    userfeed = PicasaGData.GetUserFeed(user=self.pattern)
                except GooglePhotosException:
                    MessageWindow(
                        text=_('User does not exist in Picasa database'),
                        title=_('Picasa Error'),
                        button=False).show(timeout=5)
                    kb.hide()
                    return None
                PicasaConfig().AddPublicUser(self.pattern)
                new_user = PicasaPublicUserContainer(
                    name=userfeed.nickname.text,
                    username=self.pattern,
                    menu=self.menu,
                    parent=self,
                    thumbnail=userfeed.thumbnail.text)
                self._items.append(new_user)
                kb.hide()
                self.menu.get_item_list('main_list').append(new_user)
                return None

            def _search():
                kb = KeyboardWindow(_('User name'),
                                    text=self.pattern,
                                    confirm_action=_validate)
                kb.show()
                return None

            self._items = [
                ActionItem(_('Search Users') + '...',
                           type_='exe',
                           action=_search)
            ]
            for username in PicasaConfig().GetPublicUsers():
                userfeed = PicasaGData.GetUserFeed(user=username)
                self._items.append(
                    PicasaPublicUserContainer(
                        name=userfeed.nickname.text,
                        username=username,
                        menu=self.menu,
                        parent=self,
                        thumbnail=userfeed.thumbnail.text))
        win.hide()
        return self._items
Esempio n. 26
0
 def __init__(self,
              can_modify,
              callback=None,
              callback_args=(),
              active_values=None,
              **kw):
     self._can_modify = can_modify
     self._callback = callback
     self._callback_args = callback_args
     if not active_values:
         active_cfg = wn_cfg.getActiveConfigurationInfos()
         active_values = wn_dev.getDeviceInfos(active_cfg['interface'])
     _default = ('0.0.0.0' if can_modify else _('Disconnected'))
     self.addr = (active_values[self.attribute]
                  if active_values[self.attribute] else _default)
     ActionItem.__init__(self,
                         name=_(self.pattern_name) % dict(
                             ((elt, getattr(self, elt))
                              for elt in self.pattern_values['name'])),
                         action=self._modify,
                         type_='setupitem',
                         **kw)
     return None
Esempio n. 27
0
 def __init__(self, *args, **kw):
     ParametersSetupItem.__init__(self, *args, **kw)
     self.include_scrambled = user_config['tv']['scan_with_scrambled']
     self.all_channels_item = ActionItem(
         _('Free and pay channels'),
         type_='setupitem',
         display_type=('checked'
                       if self.include_scrambled else 'not_checked'),
         action=self.set_include_scrambled,
         args=(True, ))
     self.free_channels_only_item = ActionItem(
         _('Free channels only'),
         type_='setupitem',
         display_type=('not_checked'
                       if self.include_scrambled else 'checked'),
         action=self.set_include_scrambled,
         args=(False, ))
     self.preview_list = [
         self.all_channels_item, self.free_channels_only_item,
         TNTAutomaticScanItem(parent=self,
                              name='Start scan',
                              type_='setupitem')
     ]
     return None
Esempio n. 28
0
 def __init__(self, domain, key, choices_list, *args, **kw):
     ParametersSetupItem.__init__(self, *args, **kw)
     self.domain = domain
     self.key = key
     self.choices_list = choices_list
     try:
         value = config.user_config[domain][key]
         self.preview_list = [
             ActionItem(name=self.translation_dict.get(val, str(val)),
                        display_type=('checked'
                                      if val == value else 'not_checked'),
                        type_='setupitem',
                        action=self._select_option,
                        args=[val]) for val in choices_list
         ]
     except AttributeError, e:
         PRINT_EXCEPTION(e)
Esempio n. 29
0
	def browse(self, preview=False):
		if not self._items:
			def _validate(kb):
				self.pattern = kb._text
				ShoutCastConfig().AddSearch(self.pattern)
				new_dir = ShoutCastSubSearchFolder(self.pattern, what=self.pattern, parent=self, menu=self.menu)
				self._items.append(new_dir)
				kb.hide()
				self.menu.get_item_list('main_list').append(new_dir)
				return None

			def _search():
				kb = KeyboardWindow('Search for:', text=self.pattern, confirm_action=_validate)
				kb.show()
				return None

			from pygui.item.core import ActionItem
			self._items = [ActionItem(_('Search') + '...', type_='exe', action=_search)]
			for search in ShoutCastConfig().GetSearchs():
				self._items.append(ShoutCastSubSearchFolder(search, what=search, parent=self, menu=self.menu))
		return self._items
Esempio n. 30
0
    def browse(self, preview=False):
        if not self._items:

            def _validate(kb):
                self.pattern = kb._text
                YoutubeConfig().AddSearch(self.pattern)
                new_dir = YouTubeSubContainer(
                    self.pattern,
                    (lambda query=self.pattern: Youtube_GData.search_video(
                        video=query,
                        lang=user_config['video']['youtube_languages'])),
                    menu=self.menu,
                    parent=self)
                self._items.append(new_dir)
                kb.hide()
                self.menu.get_item_list('main_list').append(new_dir)
                return None

            def _search():
                kb = KeyboardWindow(_('Video name'),
                                    text=self.pattern,
                                    confirm_action=_validate)
                kb.show()
                return None

            self._items = [
                ActionItem(_('Search') + '...', type_='exe', action=_search)
            ]
            for search in YoutubeConfig().GetSearchs():
                self._items.append(
                    YouTubeSubContainer(
                        search,
                        (lambda query=search: Youtube_GData.search_video(
                            video=query,
                            lang=user_config['video']['youtube_languages'])),
                        menu=self.menu,
                        parent=self))
        return self._items