예제 #1
0
 def __init__(self):
     Player.__init__(self, 'audioplayer')
     WPlayer.__init__(self)
     self._getitems_keywords['edit_list'] = self._get_edit_list
     self._getitems_keywords['title'] = self._get_title
     self._getitems_keywords['artist'] = self._get_artist
     self._getitems_keywords['album'] = self._get_album
     self._getitems_keywords['track'] = self._get_track
     self.tasks.update({
         'show_help_playlist': Task(self._show_help_playlist),
         'hide_help_playlist': Task(self._hide_help_playlist)
     })
     self.set_items([], 'edit_list')
     self.eventhandler = AudioEventHandler(self)
     self.available_choices.append('edit_list')
     self._old_played_dt = None
     self._old_played = None
     self._current_played = None
     for sig in AudioPlayer.caching_sig:
         louie_connect(receiver=self._callback_fill_list,
                       sender='audio',
                       signal=sig)
     self._status_change_callback.task._considered_idle = True
     self._start_playing.task._considered_idle = True
     self.update_media_info.task._considered_idle = True
     return None
예제 #2
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)
예제 #3
0
 def __init__(self):
     self.switch_to_task = Task(self._switch_to)
     self.switch_to_task.delay = 3.0
     self.switch_to = self.switch_to_task.start
     self.close_player_task = Task(self._close_player)
     self.close_player_task.delay = 1.0
     self.close_player = self.close_player_task.start
     self.previous_resolution = None
     self.handle_events = True
     try:
         hdmi_plugged = open(
             '/sys/class/stmcoredisplay/display0/hdmi0.0/hotplug',
             'r').read().strip()
     except:
         if config.architecture != 'pc':
             hdmi_plugged = 'n'
         else:
             hdmi_plugged = 'y'
     finally:
         if hdmi_plugged != 'y':
             self.hdmi_sink = None
         else:
             self.hdmi_sink = self._get_hdmi_sink()
     self._initial_switch()
     wdb = pygui_globs['wydbus']
     if wdb:
         self.inst = wdb.instance('/com/wyplay/wycrs/wyhpd')
         self.inst.signal('plug', '', self.plug_hdmi, 0)
         self.inst.signal('unplug', '', self.unplug_hdmi, 0)
     return None
예제 #4
0
파일: transcode.py 프로젝트: rayman18/wydev
def _stop_transcode(stop_method, previous_resolution, player, output_file, psp_path):
	log.debug('transcode_stop()')
	stop_method()
	if change_resolution:
		Task(_set_resolution, previous_resolution).start(0.20000000000000001)
	Task(_copy_ts, output_file, psp_path).start(0)
	raise StopIteration()
예제 #5
0
 def __init__(self, grid):
     Menu.__init__(self,
                   name='EPG Control Window',
                   choices=[],
                   type='epg_control_window',
                   universe='tv')
     self.eventhandler = EpgControlWindowEventHandler(self)
     self._getitems_keywords.update({
         'date': self.get_date,
         'time_slice': self.get_time_slice,
         'favorite_list': self.get_favorite_list
     })
     self.grid = grid
     self.favorites = HiddenRoot().get_child('TV Favorites',
                                             self.grid).browse()
     self.acl = TVRootItem().get_acl(self.grid)
     if self.grid.channel_list['index'] is None:
         self.selected_favorite_pos = -1
     else:
         self.selected_favorite_pos = int(self.grid.channel_list['index'])
     self.field_dispatch = [
         self.select_date, self.select_visible_time_slice,
         self.select_favorite_list
     ]
     self.selected_field = 0
     self.start_time, self.end_time = grid.start_time, grid.end_time
     self.commit_task = Task(self._commit_changes)
     return None
예제 #6
0
파일: search.py 프로젝트: rayman18/wydev
 def __init__(self,
              name='Search menu',
              eventhandler=None,
              type='media_search',
              pattern=None,
              universe=None):
     self.eventhandler = SearchMenuEventHandler(self)
     Menu.__init__(self, name, type=type, universe=universe)
     self.kbd = SearchKeyboardWindow(_('Search'),
                                     text='',
                                     confirm_action=self.search,
                                     search_menu=self)
     self.pattern = pattern
     self.navigator = pygui_globs['menustack'].get_navigator()
     self.positions_dict = dict()
     self.pattern = None
     self._wil_result = None
     self._getitems_keywords['result_count'] = (
         lambda: self.get_result_count())
     self._getitems_keywords['title'] = (lambda: self.get_title())
     self.show()
     if not hasattr(self, 'move_navigator'):
         mn = Task(self._move_navigator)
         mn.delay = config.HMI_BASE['search_navigator_delay']
         self.move_navigator = mn.start
         self.move_navigator_task = mn
     if not self.pattern:
         self.ask_pattern()
     else:
         self.search()
     return None
예제 #7
0
class MonitorConfigurationItem(ParametersSetupItem):
	depth = 3
	def __init__(self, *args, **kw):
		ParametersSetupItem.__init__(self, *args, **kw)
		self.refresh_task = Task(self._refresh_infos)
		Task(self._set_preview_list).start(delay=1,loop=False)
		
	def browse(self, preview=False):
		if self.menu.selected_main.__eq__(self):
			self.refresh_task.start(delay=5, loop=True, init_delay=0, consider_idle=True)
			return self.preview_list

	def _set_preview_list(self):
#		log.debug('_set_preview_list call')
		self.preview_list = [HwMonitoringItem(type_='setupitem', device='Fan'),
			HwMonitoringItem(type_='setupitem', device='Cpu'),
			HwMonitoringItem(type_='setupitem', device='Hdd'),
			CpuLoadMonitoringItem(type_='setupitem'),
			MemLoadMonitoringItem(type_='setupitem')]

	def _refresh_infos(self):
#		log.debug('_refresh_infos call')
		if self.menu.selected_main.__eq__(self):
			for i in range(len(self.preview_list)):
				self.preview_list[i].reset_view()
		else:
			self.refresh_task.stop()
예제 #8
0
class MessageWindow(Window):

    type = 'message'

    def __init__(self, text, title='', button=False):
        Window.__init__(self)
        self.text = text
        self.title = title
        if button is not False:
            self.button = button
        else:
            self.button = Button(_('OK'))
        self._timeout_timer = None
        self.eventhandler = MessageEventHandler(self)
        return None

    def show(self, timeout=None, timeout_callback=None):
        self.timeout_callback = timeout_callback
        ret = Window.show(self)
        if timeout:

            def _MessageWindow__callback_runner():
                self.hide()
                if self.timeout_callback:
                    self.timeout_callback()
                return None

            self._timeout_timer = Task(_MessageWindow__callback_runner)
            self._timeout_timer.start(timeout)
        return ret

    def hide(self):
        if self._timeout_timer:
            self._timeout_timer.stop()
        return Window.hide(self)
예제 #9
0
파일: core.py 프로젝트: rayman18/wydev
 def __init__(self, signals=('on_start', 'on_stop'), delay=2, _check=False):
     self.signals = signals
     self._timer = Task(self.handler)
     self._delay = delay
     self._sender = None
     self._check = _check
     return None
예제 #10
0
	def create_content(self):
		if self._initialized:
			pass
		self._initialized = True
		self._last_timestamp = 0
		sel_task = Task(self._fix_selected)
		sel_task.delay = self.duration * 2
		sel_task._considered_idle = True
		self._schedule_selected = sel_task.start
		start = self.menu_list.selected_pos - self._selected
		GenericListing._create_content(self, start, self.style_name[:-6])
예제 #11
0
	def __init__(self):
		ScreenSaverMenu.__init__(self, type='text_screensaver')
		if user_config['power']['screensaver_text_type'] == 'time':
			self.text = '%d:%02d:%02d' % tuple(localtime(time())[3:6])
			self.refresh_task = Task(self._refresh_text)
		else:
			self.text = user_config['power']['screensaver_text']
			if len(self.text) > 100:
				self.text = self.text[:100]
		self._getitems_keywords['text'] = self._get_screensaver_text
		return None
예제 #12
0
 def device_activation_failed(self, dev, ssid):
     log.debug('sig DeviceActivationFailed (%s)', dev)
     for o in self._obs:
         try:
             o.device_activation_failed
         except AttributeError:
             log.debug('%r has not device_activation_failed', o)
         else:
             t = Task(o.device_activation_failed)
             t.args = (dev, ssid)
             t.start(0.5)
     return None
예제 #13
0
 def __init__(self, browse_at_init=True, *args, **kw):
     self.eventhandler = ParametersSubMenuEventHandler(self)
     NotebookSubMenu.__init__(self, *args, **kw)
     self.available_choices = ['main_list', 'center_list', 'options_list']
     self._getitems_keywords.update(
         dict(center_list=(lambda: self.get_item_list('center_list')),
              options_list=(lambda: self.get_item_list('options_list'))))
     if browse_at_init:
         self._browse_main()
     self.browse_selected_task = Task(self._browse_selected)
     self.browse_selected_task.delay = 0.5
     self.browse_selected = self.browse_selected_task.start
     return None
예제 #14
0
파일: epg_grid.py 프로젝트: rayman18/wydev
 def __init__(self, player, channel_list, universe='tv', selected_chan=0):
     Menu.__init__(self,
                   name='EPG Grid',
                   choices=[],
                   type='epg_grid',
                   universe=universe)
     self.eventhandler = EpgGridEventHandler(self)
     self.player = player
     self.start_time, self.end_time = ts.current_timeslice()
     self.lower_limit = ts.get_epg_day(self.start_time)
     self.upper_limit = self.start_time + datetime.timedelta(days=7)
     self.displayed_programs = []
     self.selected_program = 0
     self._summarized_info = dict()
     self._getitems_keywords.update({
         'clock': (lambda: None),
         'channel_list': (lambda: self.get_item_list('channel_list')),
         'channel_list_name': (lambda: self.channel_list.name),
         'info_press': (lambda: self._summarized_info['info_press']),
         'info_icon': (lambda: self._summarized_info['info_icon']),
         'selected_program_name':
         (lambda: self._summarized_info['program_name']),
         'selected_program_duration':
         (lambda: self._summarized_info['program_duration']),
         'selected_program_date':
         (lambda: self._summarized_info['program_date']),
         'selected_program_start_time':
         (lambda: self._summarized_info['program_start']),
         'selected_program_maturity_rating':
         (lambda: self._summarized_info['program_maturity_rating']),
         'selected_program_duration_caption': (lambda: _('Duration')),
         'epg_control_window_caption': (lambda: _('EPG Control Window'))
     })
     self.update_channels_timer = Task(self.update_channels)
     self.refresh_timer = Task(self.refresh)
     self.set_channel_list(channel_list)
     self.select(selected_chan, 'main_list')
     self.select(selected_chan, 'channel_list')
     self.update_programs()
     now = time()
     for i, prog in enumerate(self.displayed_programs):
         if prog.start_time <= now and prog.end_time >= now:
             self.selected_program = i
             self.select_program(0)
             break
     self.tick_timer = Task(self.tick_callback)
     self.tick_timer.start(5, loop=True)
     self.refresh_timer.start(AUTO_REFRESH_DELAY,
                              loop=True,
                              consider_idle=True)
     return None
예제 #15
0
 def text(self, sub, timestamp, lifetime):
     start_delay = timestamp / 1000000.0
     lifetime = lifetime / 1000.0
     if self.freezed:
         return 0
     full_sub = str(sub)
     full_sub = full_sub.replace('\r\n', '\n').replace('\r', '\n')
     full_sub = self.strip_tag(full_sub)
     self.task_list.append(
         Task(self.current_subs.append, full_sub).start(start_delay))
     self.task_list.append(
         Task(self.current_subs.remove,
              full_sub).start(start_delay + lifetime))
     return None
예제 #16
0
    def show(self, timeout=None, timeout_callback=None):
        self.timeout_callback = timeout_callback
        ret = Window.show(self)
        if timeout:

            def _MessageWindow__callback_runner():
                self.hide()
                if self.timeout_callback:
                    self.timeout_callback()
                return None

            self._timeout_timer = Task(_MessageWindow__callback_runner)
            self._timeout_timer.start(timeout)
        return ret
예제 #17
0
 def __init__(self):
     self._obs = []
     self._wdb = peewee_dbus
     self._wymts = self._wdb.reference('com.wyplay.wymts',
                                       '/com/wyplay/wymts',
                                       'com.wyplay.wymts')
     self._wymts_sig = self._wdb.instance('/com/wyplay/wymts')
     self._wymts_sig.signal('Connected', 's', self.connected, 0)
     self._wymts_sig.signal('Disconnected', 's', self.disconnected, 0)
     self._IsConnected = self._wymts.method('IsConnected', 's', 'b')
     self._current_mode = 'mtp_off'
     self._task_control = Task(self._set_control)
     self.startup()
     return None
예제 #18
0
 def __init__(self):
     Player.__init__(self, 'imageviewer')
     self.eventhandler = ImageEventHandler(self)
     self._getitems_keywords.update(item_name=self._get_item_name,
                                    picture_1=(lambda: None),
                                    picture_2=(lambda: None))
     self.tasks.update({
         'display_timer': Task(self.play_next),
         'select_next': Task(self.select, 1),
         'transition': Task(self._transition)
     })
     self.tasks['transition'].delay = 0
     self.speed = 1
     self._paused = True
     self.direction = 1
     return None
예제 #19
0
	def __init__(self, post_key):
		Thread.__init__(self)
		self.post_key = post_key
		self.running = False
		self.setDaemon(True)
		self.setName('Network Remote')
		Task(self.start).start(0.10000000000000001)
예제 #20
0
	def create_content(self, win):
		wid = ConfirmWindow.create_content(self, win, sync_ui=False)
		wid.get_obj_by_name('title').set_text(win.title)
		self._key_container = wid.get_obj_by_name('standard_keys')
		self._but_container = wid.get_obj_by_name('action_keys')
		self._max_displayed_keys = win.get_max_keys_number()
		Task(self._sync_ui, wid).start(0.10000000000000001)
		return wid
예제 #21
0
	def reinit_box(self):
		import os
		from pygui.config import rw_dir
		from pygui.facilities.power import reboot
		f = open(os.path.join(rw_dir, 'reset-all'), 'w')
		f.flush()
		os.fsync(f.fileno())
		f.close()
		Task(reboot).start(delay=1)
예제 #22
0
 def _autohide(self):
     if not self.children:
         log.debug('%s no children: calling hide()', self)
         Task(self._autohide_timeout.stop).start(0)
         self.hide()
     else:
         log.debug('%s has children %s ! avoid autohide', self,
                   self.children)
     return None
예제 #23
0
 def device_added(self, obj, name):
     log.debug('sig DeviceAdded(%s, %s)', obj, name)
     for o in self._obs:
         try:
             o.device_added
         except AttributeError:
             log.debug('%r has not device_added', o)
         else:
             Task(o.device_added).start(2)
     return None
예제 #24
0
파일: core.py 프로젝트: rayman18/wydev
 def __init__(self, type_, universe=None):
     self.stack = pygui_globs['menustack']
     self.total_time = 0.0
     self.time_elapsed = 0.0
     Menu.__init__(self, [], type=type_, universe=universe)
     self._getitems_keywords.update(
         dict(time_elapsed=(
             lambda: _seconds_to_hhmmss(round(self.time_elapsed))),
              time_remaining=(lambda: _guarded_seconds_to_hhmmss(
                  round(self.total_time) - round(self.time_elapsed))),
              time_total=(lambda: _guarded_seconds_to_hhmmss(
                  round(self.total_time))),
              progressbar=self._get_progressbar,
              status_icon=self._get_status_icon,
              playmode_icon=self._get_playmode_icon,
              subtitles=(lambda: '')))
     self.tasks['tick'] = Task(self.tick_callback)
     self.tasks['screensaver_block'] = Task((lambda: None))
     return None
예제 #25
0
 def wireless_network_disappeared(self, dev, net):
     log.debug('sig WirelessNetworkDisappeared (%s) on (%s)', net, dev)
     for o in self._obs:
         try:
             o.wireless_network_disappeared
         except AttributeError:
             log.debug('%r has not wireless_network_disappeared', o)
         else:
             Task(o.wireless_network_disappeared).start(0.5)
     return None
예제 #26
0
 def wireless_now_active(self, dev, ssid):
     log.debug('sig DeviceNowActive (%s)', dev)
     for o in self._obs:
         try:
             o.device_now_active
         except AttributeError:
             log.debug('%r has not device_now_active', o)
         else:
             Task(o.device_now_active).start(0.5)
     return None
예제 #27
0
 def device_no_longer_active(self, dev):
     log.debug('sig DeviceNoLongerActive (%s)', dev)
     for o in self._obs:
         try:
             o.device_no_longer_active
         except AttributeError:
             log.debug('%r has not device_no_longer_active', o)
         else:
             Task(o.device_no_longer_active).start(0.5)
     return None
예제 #28
0
파일: wymodcp.py 프로젝트: rayman18/wydev
 def __init__(self, post_key):
     Thread.__init__(self)
     self.post_key = post_key
     self.running = False
     self.setDaemon(True)
     self.setName('WyModCP Plugin')
     if platform.machine() == 'sh4':
         Task(self.start).start(0.10000000000000001)
     else:
         self.start()
예제 #29
0
    def browse_previous(self):
        try:
            last_context = self._history.pop()
            if hasattr(self.selected, 'unwatch'):
                self.selected.unwatch(self._selection_changed)
        except IndexError:
            if self.selected and self.selected.parent:
                self.go_to_item(self.selected.parent, 'event_left')
                louie_send('on_root', sender=self)
            return None
        if last_context is not None:
            louie_send('hide_program_bar', sender=self)
            louie_send('event_left', sender=self)

            @selective_gui_updater('parent_item_name', 'parent_icon_name')
            def _set_prev_content(self, preview_list):
                prev_items = last_context['items']
                if isinstance(prev_items, WindowedItemList):
                    prev_items.menu = self
                    prev_items._fill_cache()
                self.set_items(prev_items, 'main_list',
                               last_context['position'])
                _sel = self.selected
                if isinstance(_sel, ScheduledRecordItem):
                    preview_list = _sel.browse()
                    louie_send('hide_preview_program_bar', sender=self)
                    self.show_help()
                elif isinstance(_sel, (AllChannelsList, Playlist)):
                    louie_send('hide_preview_program_bar', sender=self)
                    self.show_help_right()
                elif isinstance(_sel, ChannelItem):
                    louie_send('show_preview_program_bar', sender=self)
                    self.show_help()
                    for it in ('program_start_time', 'program_stop_time',
                               'program_remaining_time',
                               'program_elapsed_time', 'program_duration',
                               'program_content_type', 'program_description'):
                        louie_send(it, sender=self, value=None)
                elif isinstance(
                        _sel, DirItem
                ) and _sel.wymedia_resource['backend'] == 'wyrecord':
                    self.show_help_right()
                self.set_items(preview_list, 'preview_list', -1)
                louie_send('not_empty_preview', self)
                louie_send('hide_program_info', sender=self)
                return None

            self.tasks['set_prev_content'] = Task(
                _set_prev_content, self,
                (self.choices[0:10] if self.choices else [EmptyProgramItem()]))
            self.tasks['set_prev_content'].start(
                config.HMI_BASE['navigator_listing_delay'])
            return True
        return False
예제 #30
0
 def __init__(self,
              name,
              choices=None,
              type='undefined',
              universe=None,
              timeout=None,
              parent=None,
              zone=None):
     self.name = name
     self.type = type
     self.universe = universe
     self.tasks = {
         'show_help': Task(self._show_help),
         'hide_help': Task(self._hide_help),
         'error_timeout': Task(self._error_canceler)
     }
     if not hasattr(self, 'zone'):
         self.zone = zone
     self.item_lists_dict = {}
     if choices is None:
         choices = []
     self.set_items(choices, self.active_list)
     self.available_choices = [self.active_list]
     self.item = None
     self._getitems_keywords = dict(
         menu_name=(lambda: self.name),
         item_name=self._get_item_name,
         main_list=(lambda: self.get_item_list('main_list')),
         menu_type_name=(lambda: self.type),
         parent_item_name=self._get_parent_item_name)
     if not hasattr(self, 'eventhandler'):
         self.eventhandler = MenuEventHandler(self)
     self.children = []
     self.parent = parent
     if timeout is not None:
         self._autohide_timeout = Task(self._autohide)
         self._autohide_timeout.delay = timeout
         self._autohide_timeout.ival = timeout
     else:
         self._autohide_timeout = None
     return None