Ejemplo n.º 1
0
class HelpUserConfigSetupItem(UserConfigSetupItem):

    depth = 2
    translation_dict = UnicodeDict({
        0: 'Never',
        1: 'Always',
        2: 'During few seconds'
    })
Ejemplo n.º 2
0
class ParentalRatingConfigSetupItem(ParentalDependantSetupItem):

    translation_dict = UnicodeDict({
        0: 'No rating',
        10: '-10 years',
        12: '10 - 12 years',
        16: '12 - 16 years',
        18: '16 - 18 years'
    })
Ejemplo n.º 3
0
class ScreenSaverTextTypeUserConfigSetupItem(UserConfigSetupItem):

    translation_dict = UnicodeDict({
        'time': 'Animated time',
        'text': 'Animated text'
    })

    def execute_action(self, val):
        reinit_screen_saver()
        self.reload_center_list(True)
        return None
Ejemplo n.º 4
0
 def __init__(self, *args, **kw):
     ParametersSetupItem.__init__(self, *args, **kw)
     self.preview_list = [
         TVReplayHDParametersSetupItem(name='TVReplay HD videos',
                                       menu=self.menu,
                                       domain='video',
                                       key='tvreplay_hd',
                                       choices_list=sorted(UnicodeDict({
                                           True:
                                           'Yes',
                                           False:
                                           'No'
                                       }),
                                                           reverse=False))
     ]
     return None
Ejemplo n.º 5
0
	return _do_updates

def selective_gui_updater(*names):
	def _do_updates(self, fn, *args, **args):
		ret = fn(self, *args, **kw)
		for it in names:
			try:
				res = self[it]
			except Exception, e:
				log.warning('Unable to update widget specified for %s with %s', it, res)
			louie_send(it, sender=self, value=res)
		return ret

	return (lambda fn: (lambda self, *args, **args: _do_updates(self, fn, *args, **kw)))

UNIVERSE_NAME_DICT = UnicodeDict({'video_image': 'Video/Photo', 'video_image_thumbnail': 'Video/Photo', 'video': 'Video', 'image': 'Image', 'image_thumbnail': 'Image', 'audio': 'Music', 'games': 'Games', 'radio': 'Radio', 'tv': 'TV', 'tv_navigator': 'TV', 'scheduled_navigator': 'TV', 'multiverse': 'Navigator', 'net_services': 'Internet Services', 'parameters': 'Parameters', 'parameters_setup': 'Parameters', 'notebook_setup_parameters': 'Parameters', 'channelscanner': 'Scan in progress...', 'markeraudio': 'Music', 'markervideo_image': 'Video/Photo', 'markervideo': 'Video', 'markerimage': 'Photo', 'markertv': 'TV', 'markertv_navigator': 'TV', 'markermultiverse': 'Navigator'})
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb765e34c>}
from __future__ import absolute_import
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.messages import send as louie_send
from peewee.notifier import Task
from pygui.facilities.l10n import UnicodeDict
log = GET_LOGGER(__name__)
__all__ = ['gui_updater', 'selective_gui_updater']
def gui_updater(fn):
	def _do_updates(self, *args, **args):
		ret = None
Ejemplo n.º 6
0
day = time_tuple[2]
wday = day_dict[time_tuple[6]]
return u'%s, %s %s %s' % (wday, day, month, year)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7708f2c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from datetime import datetime, timedelta
from time import mktime, localtime
from pygui.facilities.codemapping import day_dict, month_dict
from pygui.facilities.l10n import UnicodeDict
SLICES = ['morning', 'morning2', 'afternoon', 'afternoon2', 'evening', 'evening2', 'night']
NAMES = UnicodeDict({'morning': 'Morning', 'afternoon': 'Afternoon', 'evening': 'Evening', 'night': 'Night'})
BOUNDARIES = {'morning': (timedelta(hours=6), timedelta(hours=9)), 'morning2': (timedelta(hours=9), timedelta(hours=12)), 'afternoon': (timedelta(hours=12), timedelta(hours=15)), 'afternoon2': (timedelta(hours=15), timedelta(hours=18)), 'evening': (timedelta(hours=18), timedelta(hours=21)), 'evening2': (timedelta(hours=21), timedelta(hours=24)), 'night': (timedelta(hours=24), timedelta(hours=30))}
def get_slice_info(dt):
	day = datetime(dt.year, dt.month, dt.day)
	for slice in SLICES:
		start, end = BOUNDARIES[slice]
		if day + start <= dt:
			pass
		else:
			dt
		if day + start <= dt:
			return (day, slice)
			continue
	return (day - timedelta(days=1), slice)

def get_epg_day(dt):
Ejemplo n.º 7
0
Archivo: tv.py Proyecto: rayman18/wydev
class ProgramItem(MediaItem):

	EXTRA_INFO_FIELDS = [('videoFormat_16_9', _('16:9')), ('videoFormatHD', _('High definition')), ('nrAudioChannels', _('Multiple audio tracks')), ('nrSubtitleTracks', _('Subtitles')), ('subtitleHardOfHearing', _('Subtitles for hearing impaired')), ('audioHardOfHearing', _('Audio for hearing impaired')), ('audioVisuallyImpaired', _('Audio for visually impaired')), ('freeCaMode', _('Scrambled'))]
	_CONTENT_DESC_MAPPING = UnicodeDict({0: 'Undefined content', 16: 'Movie/Drama', 17: 'Detective/Thriller', 18: 'Adventure/Western/War', 19: 'Science fiction/Fantasy/Horror', 20: 'Comedy', 21: 'Soap/Melodrama/Folkloric', 22: 'Romance', 23: 'Serious/Classical/Religious/Historical movie/drama', 24: 'Adult movie/drama', 31: 'User defined', 32: 'News/Current affairs', 33: 'News/Weather report', 34: 'News magazine', 35: 'Documentary', 36: 'Discussion/Interview/Debate', 47: 'User defined', 48: 'Show/Game show', 49: 'Game show/Quiz/Contest', 50: 'Variety show', 51: 'Talk show', 63: 'User defined', 64: 'Sports', 65: 'Special Events (Olympic games, World cup...)', 66: 'Sports magazine', 67: 'Football/Soccer', 68: 'Tennis/Squash', 69: 'Team sports (other than football)', 70: 'Athletics', 71: 'Motor sports', 72: 'Water sports', 73: 'Winter sports', 74: 'Equestrian sports', 75: 'Martial arts', 79: 'User defined', 80: "Children's/Youth program", 81: "Pre-school children's program", 82: 'Entertainment program (6 to 14 years old)', 83: 'Entertainment program (10 to 16 years old)', 84: 'Informational/Educational/School program', 85: 'Cartoon/Puppet show', 95: 'User defined', 96: 'Music/Ballet/Dance', 97: 'Rock/Pop', 98: 'Serious/Classical music', 99: 'Folk/Traditional music', 100: 'Jazz', 101: 'Musical/Opera', 102: 'Ballet', 111: 'User defined', 112: 'Arts/Culture (other than music)', 113: 'Performing arts', 114: 'Fine arts', 115: 'Religion', 116: 'Popular culture/Traditional arts', 117: 'Literature', 118: 'Film/Cinema', 119: 'Experimental film/video', 120: 'Broadcasting/Press', 121: 'New media', 122: 'Arts/Culture magazine', 123: 'Fashion', 127: 'User defined', 128: 'Social/political issues/Economics', 129: 'Magazine/Report/Documentary', 130: 'Economics/Social advisory', 131: 'Remarkable people', 143: 'User defined', 144: 'Education/Science/Factual topic', 145: 'Nature/Animals/Environment', 146: 'Technology/Natural sciences', 147: 'Medicine/Physiology/Psychology', 148: 'Foreign countries/Expeditions', 149: 'Social/Spiritual sciences', 150: 'Further education', 151: 'Languages', 159: 'User defined', 160: 'Leisure hobby', 161: 'Tourism/Travel', 162: 'Handicraft', 163: 'Motoring', 164: 'Fitness and health', 165: 'Cooking', 166: 'Advertisement/Shopping', 167: 'Gardening', 175: 'User defined'})
	_SPECIAL_ATTRIBUTES_MAPPING = UnicodeDict({176: 'Original language', 177: 'Black and white', 178: 'Unpublished', 179: 'Live broadcast', 191: 'User defined', 255: 'User defined'})

	def __init__(self, wymedia_resource, type_='epg', **kw):
		self.id = wymedia_resource['id']
		if self.recording_status in RECS_TO_DISPLAY:
			type_ += '_recording'
		MediaItem.__init__(self, wymedia_resource, type_=type_, **kw)
		self.start_time = int(wymedia_resource['scheduledStartTime'])
		self.end_time = int(wymedia_resource['scheduledEndTime'])
		(self.duration, wymedia_resource['duration']) = (self.end_time - self.start_time, self.end_time - self.start_time)
		self.description = wymedia_resource.get('longDescription', '')
		self.short_description = wymedia_resource.get('description', '')
		desc_code = int(wymedia_resource.get('contentDesc', 0))
		self.content_type = self._CONTENT_DESC_MAPPING.get(desc_code, 'Undefined content')
		try:
			rating = int(wymedia_resource['maturityRating'])
		except KeyError:
			rating = int(wymedia_resource.get('rating', 0))
		if rating < 10:
			maturity_rating = 0
		elif rating == 10:
			maturity_rating = 10
		elif 10 < rating <= 12:
			maturity_rating = 12
		elif 12 < rating <= 16:
			maturity_rating = 16
		else:
			maturity_rating = 18
		self.wymedia_resource['maturityRating'] = maturity_rating
		return None

	def watch(self, observer):
		return None

	def unwatch(self, observer):
		return None

	# If this program has been scheduled for recording via the EPG
	# grid, recording_id holds the scheduled recording's Wyrecord ID.
	# Otherwise, it's 0 (well, wyrecord.recording.RECORDING_ID_NULL).
	@property
	def recording_id(self):
		return WyRecord().scheduler.GetRecordingIdFromProgramId(self.id)
	
	# If this program has been scheduled for recording via the EPG
	# grid, recording_status holds the scheduled recording's status
	# (one of the wyrecord.recording.RECORDING_STATUS_* constants).
	@property
	def recording_status(self):
		rec_id = self.recording_id
		if rec_id:
			return WyRecord().scheduler.GetRecording(rec_id).status
		return RECORDING_STATUS_UNKNOWN

	# Executing a ProgramItem will play the channel it's from
	# in the TV player. Better than raising an AttributeError, now,
	# don't you think?
	def execute(self):
		self.parent.execute()
		return None
Ejemplo n.º 8
0
class BooleanUserConfigSetupItem(UserConfigSetupItem):

    translation_dict = UnicodeDict({True: 'ON', False: 'OFF'})
Ejemplo n.º 9
0
# Add 'flac' to audio_codec_dict
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 ([email protected])
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

from __future__ import absolute_import

from pygui.facilities.l10n import UnicodeDict, Y_M_D, D_M_Y, M_D_Y

soundconfig_dict = UnicodeDict({
    1: 'Mono',
    2: 'Stereo',
    3: '2.1',
    6: '5.1',
    7: '6.1'
})

ui_aspect_ratio_dict = UnicodeDict({0: '16:9', 1: '4:3'})

player_aspect_ratio_dict = {0: '16_9', 1: '4_3'}

hdmiresolution_dict = UnicodeDict({
    (1920, 1080, 1, 50): '1080i/50Hz',
    (1920, 1080, 1, 60): '1080i/60Hz',
    (1280, 720, 0, 50): '720p/50Hz',
    (1280, 720, 0, 60): '720p/60Hz',
    (720, 576, 1, 50): '576i/50Hz',
    (720, 576, 0, 50): '576p/50Hz',
Ejemplo n.º 10
0
def browse(self):
	val = config.user_config[self.domain][self.key]
	for it, choice in itertools.izip(self.preview_list, self.choices_list):
		it.name = self.translation_dict.get(choice)
		if not(val == it.args[0] and 'checked'):
			pass
		it.display_type = 'not_checked'
	return self.preview_list

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76daaec>}
nname: 6
n 6(None)[translation_dict = UnicodeDict({True: 'ON', False: 'OFF'})
]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76dae6c>}
nname: 0
n 0(None)[ParametersSetupItem.__init__(self, *args, **kw)
self.domain = domain
self.key = key
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb766784c>}
nname: 245
Ejemplo n.º 11
0
class TVReplayHDParametersSetupItem(UserConfigSetupItem):

    translation_dict = UnicodeDict({True: 'Yes', False: 'No'})
Ejemplo n.º 12
0
# Review WyGui README & LICENSE files for further details.

from __future__ import absolute_import

import os

from peewee.debug import PRINT_EXCEPTION
from pygui.facilities.l10n import UnicodeDict
from pygui.item.core import ActionItem
from pygui.item.parameters import UserConfigSetupItem, ParametersSetupItem
from pygui.window import ConfirmWindow
from pygui.window.core import Button

THEMES_ENGINES = UnicodeDict({
    'wybox': 'Wyplayer',
    'zoltartv': 'ZoltarTV',
    'mediatec': 'MediaTec',
    'mediatitan': 'MediaTitan'
})
THEMES_SERIALIZED = UnicodeDict({True: 'ON', False: 'OFF'})


class ThemeEngineUserConfigSetupItem(UserConfigSetupItem):

    translation_dict = THEMES_ENGINES


class SerializedThemeUserConfigSetupItem(UserConfigSetupItem):

    translation_dict = THEMES_SERIALIZED

Ejemplo n.º 13
0
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

from __future__ import absolute_import

from peewee.debug import PRINT_EXCEPTION, DEBUG
from pygui.facilities.l10n import UnicodeDict
from pygui.item.containers import GenericContainer
from pygui.item.core import Item
from time import time
from wyrecord import WyRecord
from wyrecord.recordscheduler import RECORDING_FLAG_SCHEDULED, RECORDING_FLAG_CANCELED, RECORDING_FLAG_COMPLETED, RECORDING_FLAG_ALL

_wyrec = WyRecord()
PERIODICITY = UnicodeDict({'daily': 'Every day', 'weekly': 'Every week'})


class ScheduledRecordRootItem(GenericContainer):
    def __init__(self, menu=None, display_type=None, parent=None):
        Item.__init__(self, _('My scheduled recordings'), 'schedule_dir', menu,
                      display_type, parent)
        return None

    # Return all the scheduled records.
    #
    # If scheduled_only is True (default), only the scheduled records
    # are returned. Otherwise, completed, canceled and other bogus
    # records are included in the result set.
    def browse(self, scheduled_only=True, preview=False):
        _list = []
Ejemplo n.º 14
0
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

from __future__ import absolute_import

import pygui.config as config

from pygui.facilities.codemapping import hdmiresolution_dict
from pygui.facilities.l10n import UnicodeDict
from pygui.facilities.mixer import Mix as Mixer
from pygui.item.core import ActionItem
from pygui.item.parameters import ParametersSetupItem, UserConfigSetupItem, BooleanUserConfigSetupItem
from pygui.shared import pygui_globs
from pygui.window import BigMessageWindow, ConfirmWindow, Button

HDMI_BOOL_OPTIONS = UnicodeDict({False: 'ON', True: 'OFF'})
SPDIF_SURROUND = UnicodeDict({True: '5.1', False: 'Stereo'})
COMPOSITE_OUT = UnicodeDict({'pal': 'PAL', 'ntsc': 'NTSC'})


# Generic Resolution setup item
class ResolutionSetupItem(UserConfigSetupItem):

    depth = 2

    def _set_resolution(self, resolution):
        if resolution in COMPOSITE_OUT:
            real_resolution = config.cvbs_resolution[resolution]
        else:
            real_resolution = resolution
        w, h, interlaced, freq = real_resolution
Ejemplo n.º 15
0
# 2012-11-15
# Add item to switch on/off folder preview.
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 ([email protected])
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

from __future__ import absolute_import

from pygui.facilities.l10n import UnicodeDict
from pygui.item.parameters import UserConfigSetupItem, ParametersSetupItem

SYSTEM_ITEM_BOOL = UnicodeDict({True: 'Yes', False: 'No'})


class NetworkSleepSetupItem(UserConfigSetupItem):

    translation_dict = SYSTEM_ITEM_BOOL


class HdmiCECSetupItem(UserConfigSetupItem):

    translation_dict = SYSTEM_ITEM_BOOL


class PreviewFolderSetupItem(UserConfigSetupItem):

    translation_dict = SYSTEM_ITEM_BOOL
Ejemplo n.º 16
0
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 ([email protected])
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[return GeneralConfigurationItem(name=_('General'), type_='general', display_type='setup_general', menu=menu)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770564c>}
nname: 6
n 6(None)[depth = 2
translation_dict = UnicodeDict({0: 'Never', 1: 'Always', 2: 'During few seconds'})
]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7705ccc>}
nname: 0
n 0(None)[return [CountryUserConfigSetupItem(name='Country', menu=self.menu, domain='base', key='country', choices_list=config.HMI_BASE['country']), OSDLanguageUserConfigSetupItem(name='Language', exec_callback=True, menu=self.menu, domain='base', key='language', choices_list=config.HMI_BASE['osd_languages']), DateParametersContainer(name='Date and Time', type_='setupitem', menu=self.menu), ProtectionParametersSetupItem(name='Access and protections', type_='setupitem', menu=self.menu), HelpUserConfigSetupItem(name='Help banner', type_='setupitem', menu=self.menu, domain='base', key='help_banner', choices_list=range(3))]
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770898c>}
nname: 0
n 0(None)[self._name = _('General')
]: