예제 #1
0
 def __init__(self, config):
     self.signals = kaa.Signals('started', 'stopped', 'epg-update')
     self.config = config
     self.multiplexes = []
     self._schedule_id = 0
     self.__initialized = kaa.InProgress()
     self.schedules = {}
예제 #2
0
 def __init__(self):
     self.signals = kaa.Signals('locked', 'unlocked')
     self._clients = []
     self._in_progress = None
     # Precreate a finished InProgress object that we can return when
     # not locked.
     self._in_progress_finished = kaa.InProgress().finish(None)
예제 #3
0
    def __init__(self, pos=None, size=None, uri=None, player='gstreamer', context=None):
        """
        Create the video widget. The widget supports gstreamer
        (default) and mplayer but only gstreamer can be used as real
        widget for now. When choosing mplayer it will always open a
        full screen window to play the video.

        The playback can be configured using the config member
        dictionary. Please note, that gstreamer tries to figure out
        most of the stuff itself and AC3 and DTS passthrough only
        works when using pulseaudio and pulseaudio configured
        correctly (pavucontrol). Future versions of kaa.candy may have
        more or changed options.
        """
        super(Video, self).__init__(pos, size, context)
        self.uri = uri
        self.signals = kaa.Signals('finished', 'progress', 'streaminfo')
        self.state = STATE_IDLE
        # player configuration
        self.config = {
            'mplayer.vdpau': False,
            'mplayer.passthrough': False,
            'fresh-rate': None
        }
        # current streaminfo / audio / subtitle values
        self.streaminfo = {
            'audio': {},
            'subtitle': {},
            'is_menu': False,
        }
        self.aspect = ASPECT_ORIGINAL
        self.player = player or 'gstreamer'
예제 #4
0
 def __init__(self):
     self.parent = None
     self.active = False
     self.enabled = True
     self.visible = True
     self.signals = kaa.Signals()
     self.signals['activated'] = kaa.Signal()
     self.signals['deactivated'] = kaa.Signal()
예제 #5
0
 def __init__(self):
     """
     Create a new instance with initially no buttons.
     """
     self.buttons = []
     self.selected_button = None
     self.signals = kaa.Signals()
     self.signals['selection_changed'] = kaa.Signal()
예제 #6
0
 def __init__(self):
     self._stack = []
     self.locked = False
     if not hasattr(self, 'signals'):
         # The main menu inherits from appication which already
         # defines self.signals. ther menus need this because we
         # want to add a refresh signal
         self.signals = kaa.Signals()
     self.signals['refresh'] = kaa.Signal()
예제 #7
0
 def __init__(self, node=None):
     self.properties = ()
     self.parent = None
     self.children = None
     self.has_children = False
     self.type = ''
     self.signals = kaa.Signals()
     self.signals['property-changed'] = kaa.Signal()
     self.signals['child-added'] = kaa.Signal()
     self.signals['child-removed'] = kaa.Signal()
예제 #8
0
 def __init__(self, eventmap, capabilities=[]):
     """
     Init the Application object.
     """
     self.signals = kaa.Signals('show', 'hide', 'start', 'stop')
     self.__status = STATUS_IDLE
     self.__eventmap = eventmap
     self.__capabilities = 0
     self.context = WidgetContext(self.name)
     for cap in capabilities:
         self.__capabilities |= cap
예제 #9
0
 def __init__(self, address, password):
     self.signals = kaa.Signals('connected', 'disconnected', 'changed')
     self.recordings = Recordings(self)
     self.favorites = Favorites(self)
     self.channel = kaa.rpc.connect(address, password, retry=1)
     self.channel.register(self)
     self.channel.signals['open'].connect(self._connected)
     self.channel.signals['closed'].connect(self._disconnected)
     # connect kaa.epg database to port + 1
     address, port = address.split(':')
     kaa.epg.connect('%s:%s' % (address, int(port) + 1), password)
예제 #10
0
 def __init__(self, address, secret):
     self.connected = False
     self._num_programs = 0
     self._channels_by_name = {}
     self._channels_by_db_id = {}
     self._channels_by_tuner_id = {}
     self.rpc = None
     self.signals = kaa.Signals('connected', 'disconnected')
     self._server_address = address
     self._server_secret = secret
     self.channel = kaa.rpc.connect(self._server_address, auth_secret=self._server_secret, retry=1)
     self.channel.register(self)
     self.channel.signals['closed'].connect_weak(self._disconnected)
예제 #11
0
    def __init__(self, window):
        self._window = window

        # FIXME: connect to GTK signals
        self.signals = kaa.Signals(
            "key_press_event",  # key pressed
            "focus_in_event",  # window gets focus
            "focus_out_event",  # window looses focus
            "expose_event",  # expose event
            "map_event",  # ?
            "unmap_event",  # ?
            "resize_event",  # window resized
            "configure_event")  # ?

        self._display = X11Display(self._window.get_display().get_name())
예제 #12
0
 def __init__(self, client, **query):
     """
     Create a Query object and start the query on the client
     """
     # FIXME: progress and up-to-date seems not used
     self.signals = kaa.Signals('changed', 'progress', 'up-to-date')
     self.id = Query.NEXT_ID
     Query.NEXT_ID += 1
     # public variables
     self.result = []
     # internal variables
     self._query = query
     self._client = client
     self._beacon_monitoring = False
     # some shortcuts from the client
     self._rpc = self._client.rpc
     # InProgress object
     self._async = kaa.InProgress()
     # start inititial query
     self._beacon_start_query(query)
예제 #13
0
 def __init__(self):
     """
     """
     super(PluginInterface, self).__init__()
     self.signals = kaa.Signals('update')
     self.image_cache_images = {None: None}
     self.image_cache_hashes = {None: None}
     port = freevo.config.plugin.httpserver.port
     self.server = HTTPServer(("", port))
     self.server.serve_forever()
     self.server.add_json_handler('/event/', self.event)
     self.server.add_json_handler('/key/', self.key)
     self.server.add_json_handler('/view', self.view)
     self.server.add_json_handler('/select/', self.select)
     self.server.add_handler('/images/', self.images)
     self.server.add_static(
         '/', freevo.FREEVO_SHARE_DIR + '/httpserver/simple.html')
     self.server.add_static('/jquery',
                            freevo.FREEVO_SHARE_DIR + '/httpserver/jquery')
     freevo.signals['application-change'].connect(self.application_change)
     self.post_key = InputPlugin().post_key
예제 #14
0
 def __init__(self, name, duration):
     """
     Create a new instance.
     @param name: Name of the skin to render.
     @param duration: Time in seconds the dialog should be shown for by default.
     """
     self.name = name
     self._skin = None
     self.display = None
     self.duration = duration
     self.priority = Dialog.NORMAL_PRIORITY
     self.__first_show = True
     self.signals = kaa.Signals()
     self.signals['prepared'] = kaa.Signal()
     self.signals['shown'] = kaa.Signal()
     self.signals['hidden'] = kaa.Signal()
     self.signals['finished'] = kaa.Signal()
     self.updater = None
     self.__update_interval = 0
     self.last_render = 0.0
     if DEBUG_PERFORMANCE:
         self.__render_count = 0
         self.__first_render_time = 0.0
         self.__hide_time = 0.0
예제 #15
0
    def __init__(self, display=None, window=None, **kwargs):
        """
        Create a new X11 window or wrap an existing X11 window.  If display is
        None, it will use the default display (based on the DISPLAY environment
        variable).  If window is a numeric, it will consider it a window id and
        can be used to wrap an existing X11 window.  The window parameter may
        also be a lower level _X11.X11Window object.

        If window is none, then a new window will be created, and the
        following kwargs apply:
           size: 2-tuple of width and height for the window (required)
           title: A string representing the window's title (optional)
           parent: An existing X11Window object of which the new window will
                   be a subwindow.
           input_only: A boolean, default False, which indicates whether this
                       window only captures mouse and key events, but doesn't
                       have a graphics surface.
           proxy_for: An X11Window to which all mouse and key events received 
                      by this window will be sent.
           composite: A boolean to indicate whether the window can make use of 
                      the XComposite extension to display translucent areas by 
                      drawing to the window using an image with an alpha channel.
        
        The following kwargs apply in either case:
           window_events: A boolean, default True, to indicate whether the 
                          client wishes to receive window (un)map/focus/expose
                          events.
           mouse_events: A boolean, default True, to indicate whether the 
                         client wishes to receive mouse button pressed/release
                         events.
           key_events: A boolean, default True, to indicate whether the client
                       wishes to receive key button pressed/release events.
        """
        display = get_display(display)
        if window:
            if isinstance(window, (long, int)):
                # Create new X11Window object based on existing window id.
                self._window = _X11.X11Window(display._display, (-1, -1),
                                              window=long(window),
                                              **kwargs)
            elif isinstance(window, _X11.X11Window):
                self._window = window
            else:
                raise ValueError, "window parameter must be an integer."
        else:
            if "title" in kwargs:
                assert (type(kwargs["title"]) == str)
            if "parent" in kwargs:
                assert (isinstance(kwargs["parent"], X11Window))
                kwargs["parent"] = kwargs["parent"]._window
            if 'composite' in kwargs and kwargs['composite']:
                kwargs['argb'] = True
            if "proxy_for" in kwargs:
                assert (isinstance(kwargs["proxy_for"], X11Window))
                self.proxy_for = kwargs["proxy_for"]

            w, h = kwargs.get('size', (1, 1))
            self._window = _X11.X11Window(display._display, (w or 1, h or 1),
                                          **kwargs)

        if 'composite' in kwargs and kwargs['composite']:
            display.composite_redirect = self._window.wid
        self._display = display
        display._windows[self._window.wid] = weakref.ref(self)
        self._cursor_hide_timeout = 1
        self._cursor_hide_timer = kaa.WeakOneShotTimer(self._cursor_hide_cb)
        self._cursor_visible = True
        self._fs_size_save = None
        self._last_configured_size = 0, 0

        self.signals = kaa.Signals(
            "key_press_event",  # key pressed
            "key_release_event",  # key release
            "button_press_event",  # Button pressed
            "button_release_event",  # Button released
            "focus_in_event",  # window gets focus
            "focus_out_event",  # window looses focus
            "expose_event",  # expose event
            "map_event",  # shown/mapped on to the screen
            "unmap_event",  # hidden/unmapped from the screen
            "resize_event",  # window resized
            "delete_event",
            "configure_event")  # ?
예제 #16
0
import kaa.beacon

initialized = False

WORKER_THREAD = 'WEBMETADATA'

kaa.metadata.enable_feature('VIDEO_SERIES_PARSER')
kaa.register_thread_pool(WORKER_THREAD, kaa.ThreadPool())

import tv
import movie

from tv.core import Series, Season, Episode
from movie.core import Movie

signals = kaa.Signals('sync', 'changed')


def init(base):
    """
    Initialize the kaa.webmetadata databases
    """
    global initialized
    if initialized:
        return
    for module in tv, movie:
        module.init(base)
    initialized = True
    for module in tv.backends.values() + movie.backends.values():
        module.signals['changed'].connect(signals['changed'].emit)
예제 #17
0
import time
import os
import sys
import gc
import kaa
import kaa.rpc

sig = kaa.Signals('one', 'two', 'three')

# Named thread pools used later.
kaa.register_thread_pool('yield', kaa.ThreadPool())
kaa.register_thread_pool('foo', kaa.ThreadPool())


class Server(object):
    def __init__(self):
        self.s = kaa.rpc.Server('test')
        self.s.register(self)

    @kaa.rpc.expose('test1')
    def test1(self, x):
        return x, kaa.is_mainthread()

    @kaa.rpc.expose('test2')
    @kaa.threaded('yield')
    def test2(self, x):
        return x, kaa.is_mainthread()

    @kaa.rpc.expose('test3')
    @kaa.coroutine()
    def test3(self, x):
예제 #18
0
import kaa


def myfunc(value):
    print 'x', value


signals = kaa.Signals('foo', 'bar')
signals.connect('foo', myfunc)

signals['foo'].emit(1)
signals.emit('foo', 2)

sig2 = kaa.Signals(signals, 'new')
print sig2.keys()
예제 #19
0
 def __init__(self):
     self.signals = kaa.Signals('added', 'removed')
     self._dict = {}