Пример #1
0
def main(*args, **kwargs):
    '''Client code main loop.'''

    # Import statements are inside the function so that they aren't imported
    # every time something from the client is imported

    # cluttergtk must be imported before the first import of clutter so it
    # must be imported even though pylint complains about it not being used.
    import cluttergtk
    import clutter
    import gobject
    import gtk

    from entertainerlib.client.translation_setup import TranslationSetup
    TranslationSetup()

    from entertainerlib.backend.backend_server import BackendServer
    from entertainerlib.configuration import Configuration
    from entertainerlib.client.client import Client

    gobject.threads_init()
    gtk.gdk.threads_init()
    clutter.threads_init()

    config = Configuration()
    if config.start_auto_server:
        print "Entertainer backend starting..."
        BackendServer()

    client_client = Client()
    client_client.start()
Пример #2
0
	def run( self, args, ramps, dict ):

		window = gtk.Window()
		window.connect('destroy', gtk.main_quit)
		window.set_title('cluttergtk.Embed')
		vbox = gtk.VBox(False, 6)
		window.add(vbox)
		embed = cluttergtk.Embed()
		vbox.pack_start(embed, True, True, 0)
		embed.set_size_request( screen_width, screen_height )
		embed.realize()
		#self.stage = clutter.Stage()
		self.stage = embed.get_stage()
		self.stage.set_color(clutter.Color( 0x20, 0x20, 0x20, 0xff ) )
		#self.stage.set_size( screen_width, screen_height )
		self.stage.set_reactive( True )
		self.stage.set_title( "Anagramps!" )

		bg = clutter.Texture()
		bg.set_from_file( "table.png" )
		bg.set_position( 0, 0 )
		self.stage.add( bg )

		game = random.sample( ramps, 1 )[ 0 ][ -1 : : -1 ]
		#game = ramps[ int( sys.argv[ 1 ] ) ][ -1 : : -1 ]
		#print game
		self.dict = dict
		self.play( game )

		self.stage.show_all()
		#timeline.start()
		clutter.threads_init()

		window.show_all()
		#clutter.main()
		gtk.main()

		return 0
Пример #3
0
import os
import signal
import logging
import urllib2
from random import randint
from threading import Thread, Event, Condition, RLock

import flickrapi
import glib
import gobject
from gtk import gdk
import clutter
import clutter.x11

gobject.threads_init()
clutter.threads_init()

log = logging.getLogger('flickrsaver')
log.setLevel(logging.DEBUG)

API_KEY = "59b92bf5694c292121537c3a754d7b85"
flickr = flickrapi.FlickrAPI(API_KEY)

""" Where we keep photos """
cache_dir = os.path.join(glib.get_user_cache_dir(), 'flickrsaver')

class PhotoSource(object):
    def get_photo(self):
        """ Return the (filename, fp) of a photo from the source, where
            fp is an open file descriptor. """
        raise NotImplementedError