Пример #1
0
 def start(self):
     """Starts the Clutter main event loop and sets our kernel startup routine.
     """
     # Register our function to initiate the kernel and start Clutter
     GObject.idle_add(self._wire_kernel)
     Clutter.init([])
     Clutter.main()
Пример #2
0
   def __init__(self):
    self.stage = Clutter.Stage()
    self.stage.set_size(400, 400)
    self.layout_manager = Clutter.BoxLayout()
    self.textures_box = Clutter.Actor(layout_manager=self.layout_manager)
    self.stage.add_actor(self.textures_box)

    self.video_texture = Clutter.Texture.new()

    self.video_texture.set_keep_aspect_ratio(True)
    self.video_texture.set_size(400,400)
    self.layout_manager.pack(self.video_texture, expand=False, x_fill=False, y_fill=False, x_align=Clutter.BoxAlignment.CENTER, y_align=Clutter.BoxAlignment.CENTER)

    self.camera = Cheese.Camera.new(self.video_texture, None, 100, 100)
    Cheese.Camera.setup(self.camera, None)
    Cheese.Camera.play(self.camera)

    def added(signal, data):
        uuid=data.get_uuid()
        node=data.get_device_node()
        print "uuid is " +str(uuid)
        print "node is " +str(node)
        self.camera.set_device_by_device_node(node)
        self.camera.switch_camera_device()

    device_monitor=Cheese.CameraDeviceMonitor.new()
    device_monitor.connect("added", added)
    device_monitor.coldplug()

    self.stage.show()
    Clutter.main()
Пример #3
0
    def run(self):
        """ Start the program. Can be called from
        this file or from a start-up script."""
        # Flip and move the stage to the right location
        # This has to be done in the application, since it is a
        # fbdev app
        if self.config.get("System", "rotation") == "90":
            self.config.ui.get_object("all").set_rotation_angle(
                Clutter.RotateAxis.Z_AXIS, 90.0)
            self.config.ui.get_object("all").set_position(480, 0)
        elif self.config.get("System", "rotation") == "270":
            self.config.ui.get_object("all").set_rotation_angle(
                Clutter.RotateAxis.Z_AXIS, -90.0)
            self.config.ui.get_object("all").set_position(0, 800)
        elif self.config.get("System", "rotation") == "180":
            self.config.ui.get_object("all").set_pivot_point(0.5, 0.5)
            self.config.ui.get_object("all").set_rotation_angle(
                Clutter.RotateAxis.Z_AXIS, 180.0)
        """ Start the process """
        self.running = True
        # Start the processes
        self.p0 = Thread(target=self.loop,
                         args=(self.config.push_updates, "Push updates"))
        self.p0.start()

        self.config.socks_client.start()
        logging.info("Toggle ready")
        Clutter.main()
Пример #4
0
def main():
    GLib.threads_init()
    Clutter.init(sys.argv)

    MainWindow()

    Clutter.main()
Пример #5
0
 def start(self):
     """Starts the Clutter main event loop and sets our kernel startup routine.
     """
     # Register our function to initiate the kernel and start Clutter
     GObject.idle_add(self._wire_kernel)
     Clutter.init([])
     Clutter.main()
Пример #6
0
 def run(self):
     """ Start the process """
     self.running = True
     # Start the processes
     self.p0 = Thread(target=self.loop, args=(self.events, "Push updates"))
     self.p0.start()
     logging.info("Toggle ready")
     Clutter.main()
Пример #7
0
    def __init__(self):
        Clutter.init()

        self.stage = TextStage()
        self.stage.connect("destroy", lambda *_: Clutter.main_quit())
        self.stage.show_all()

        Clutter.main()
Пример #8
0
    def __init__(self):
        Clutter.init()

        self.stage = TextStage()
        self.stage.connect("destroy", lambda *_: Clutter.main_quit())
        self.stage.show_all()

        Clutter.main()
Пример #9
0
 def run(self):
     # Import clutter only in the gobject thread
     # This function will be the running mainloop
     try:
         from gi.repository import Clutter as clutter
         clutter.threads_init()
         clutter.init([])
         clutter.main()
     except Exception, e:
         log.exception('unable to import clutter')
         return
Пример #10
0
    def __init__(self):
        # initialize Clutter
        Clutter.init([])

        self.colors = {
            'white': Clutter.Color.new(0, 0, 0, 255),
            'blue': Clutter.Color.new(16, 16, 32, 255),
            'black': Clutter.Color.new(255, 255, 255, 128),
            'hand': Clutter.Color.new(16, 32, 16, 196)
        }

        # create a resizable stage
        stage = Clutter.Stage.new()
        stage.set_title("2D Clock")
        stage.set_user_resizable(True)
        stage.set_background_color(self.colors['blue'])
        stage.set_size(300, 300)
        stage.show()

        # our 2D canvas, courtesy of Cairo
        canvas = Clutter.Canvas.new()
        canvas.set_size(300, 300)

        actor = Clutter.Actor.new()
        actor.set_content(canvas)

        actor.set_content_scaling_filters(Clutter.ScalingFilter.TRILINEAR,
                                          Clutter.ScalingFilter.LINEAR)
        stage.add_child(actor)

        # bind the size of the actor to that of the stage
        actor.add_constraint(
            Clutter.BindConstraint.new(stage, Clutter.BindCoordinate.SIZE, 0))

        # resize the canvas whenever the actor changes size
        actor.connect("allocation-changed", self.on_actor_resize)

        # quit on destroy
        stage.connect("destroy", self.on_destroy)

        # connect our drawing code
        canvas.connect("draw", self.draw_clock)

        # invalidate the canvas, so that we can draw before the main loop starts
        Clutter.Content.invalidate(canvas)

        # set up a timer that invalidates the canvas every second
        Clutter.threads_add_timeout(GLib.PRIORITY_DEFAULT, 1000,
                                    self.invalidate_clock, canvas)

        Clutter.main()
Пример #11
0
  def run(self):
    """
        Start the program. Can be called from
        this file or from a start-up script.
        """
    """ Start the process """
    self.running = True
    # Start the processes
    self.p0 = Thread(target=self.loop, args=(self.config.push_updates, "Push updates"))
    self.p0.start()

    self.config.socks_client.start()
    logging.info("Toggle ready")
    Clutter.main()
Пример #12
0
 def main(self):
     """
     Starts the application main loop.
     """
     if hasattr(self.window, "wrapper") and isinstance(self.window.wrapper,
                                                       Gtk.Window):
         self.window.wrapper.show_all()
         _LOG.debug("Running GTK loop")
         Gtk.main()
     else:
         self.window.stage.show_all()
         _LOG.debug("Running Clutter loop")
         Clutter.main()
     self._shutdown_sound_effects_player()
Пример #13
0
  def __init__ (self):
    # initialize Clutter
    Clutter.init([])
    
    self.colors = {
      'white' : Clutter.Color.new(0, 0, 0, 255),
      'blue' : Clutter.Color.new(16, 16, 32, 255),
      'black' : Clutter.Color.new(255, 255, 255, 128),
      'hand' : Clutter.Color.new(16, 32, 16, 196)
    }

    # create a resizable stage
    stage = Clutter.Stage.new ()
    stage.set_title ("2D Clock")
    stage.set_user_resizable (True)
    stage.set_background_color (self.colors['blue'])
    stage.set_size (300, 300)
    stage.show ()

    # our 2D canvas, courtesy of Cairo
    canvas = Clutter.Canvas.new ()
    canvas.set_size (300, 300)

    actor = Clutter.Actor.new ()
    actor.set_content (canvas)
    
    actor.set_content_scaling_filters (Clutter.ScalingFilter.TRILINEAR,
                                       Clutter.ScalingFilter.LINEAR)
    stage.add_child (actor)

    # bind the size of the actor to that of the stage
    actor.add_constraint(Clutter.BindConstraint.new(stage, Clutter.BindCoordinate.SIZE, 0))

    # resize the canvas whenever the actor changes size
    actor.connect ("allocation-changed", self.on_actor_resize)

    # quit on destroy
    stage.connect ("destroy", self.on_destroy)

    # connect our drawing code
    canvas.connect ("draw", self.draw_clock)

    # invalidate the canvas, so that we can draw before the main loop starts
    Clutter.Content.invalidate (canvas)

    # set up a timer that invalidates the canvas every second
    Clutter.threads_add_timeout (GLib.PRIORITY_DEFAULT, 1000, self.invalidate_clock, canvas)

    Clutter.main ()
Пример #14
0
def main():
    if len(sys.argv) < 2:
        print "Usage: %s [OPTIONS] <video file> [logo file]" % (sys.argv[0])
    else:
        if DEBUG:
            Clutter.init(debugArgs)
        else:
            Clutter.init(sys.argv)

        filename = sys.argv[1]
        if len(sys.argv) > 2:
            logo = sys.argv[2]
        else:
            logo = None
        app = VideoApp(filename, logo)
        Clutter.main()
Пример #15
0
    def __init__(self):
        self.stage = Clutter.Stage()
        self.stage.set_size(400, 400)
        self.layout_manager = Clutter.BoxLayout()
        self.textures_box = Clutter.Actor(layout_manager=self.layout_manager)
        self.stage.add_actor(self.textures_box)

        self.video_texture = Clutter.Texture.new()

        self.video_texture.set_keep_aspect_ratio(True)
        self.video_texture.set_size(400, 400)
        self.layout_manager.pack(self.video_texture,
                                 expand=False,
                                 x_fill=False,
                                 y_fill=False,
                                 x_align=Clutter.BoxAlignment.CENTER,
                                 y_align=Clutter.BoxAlignment.CENTER)

        self.camera = Cheese.Camera.new(self.video_texture, None, 100, 100)
        Cheese.Camera.setup(self.camera, None)
        Cheese.Camera.play(self.camera)

        def added(signal, data):
            uuid = data.get_uuid()
            node = data.get_device_node()
            print "uuid is " + str(uuid)
            print "node is " + str(node)
            self.camera.set_device_by_device_node(node)
            self.camera.switch_camera_device()

        device_monitor = Cheese.CameraDeviceMonitor.new()
        device_monitor.connect("added", added)
        device_monitor.coldplug()

        self.stage.show()
        Clutter.main()
 def inputhook_clutter():
     # end the running mainloop when input is available on stdin
     GLib.io_add_watch(sys.stdin, GLib.IO_IN, _main_quit)
     # start the main loop
     Clutter.main()
     return 0
 def run(self):
     self.stage.show_all()
     idle_add_once(self.texturemgr.start)
     idle_add_once(self.texturemgr.enable.up)
     Clutter.main()
 def run(self):
     self.stage.show_all()
     idle_add_once(self.texturemgr.start)
     idle_add_once(self.texturemgr.enable.up)
     Clutter.main()
Пример #19
0
def main():
    Clutter.init(sys.argv)
    Test()
    Clutter.main()
Пример #20
0
	def run(self):
		self.show()
		Clutter.main()
 def inputhook_clutter():
     # end the running mainloop when input is available on stdin
     GLib.io_add_watch(sys.stdin, GLib.IO_IN, _main_quit)
     # start the main loop
     Clutter.main()
     return 0
Пример #22
0
def inputhook_clutter():
    GLib.io_add_watch(sys.stdin, GLib.IO_IN, _main_quit)
    Clutter.main()
    return 0
Пример #23
0
 def main(self):
     """
     Starts the application main loop.
     """
     self.stage.show_all()
     Clutter.main()
Пример #24
0
def main():
    Clutter.init([])
    stage = ButtonStage()
    stage.connect("destroy", lambda _: Clutter.main_quit())
    stage.show_all()
    Clutter.main()
Пример #25
0
 def main(self):
     Clutter.main()
Пример #26
0
 def main(self):
     """
     Starts the application main loop.
     """
     self.stage.show_all()
     Clutter.main()
Пример #27
0
 def run(self):
     self.show()
     Clutter.main()
Пример #28
0
from gi.repository import Clutter as clutter

stage = clutter.Stage()
stage.set_size(400, 400)

label = clutter.Text()
label.set_editable(False)
label.set_text("Clutter Label Text")
label.set_color(clutter.color_from_string("brown"))
# If no position is given it defaults to the upper most left corner.

stage.add(label)
stage.show_all()
stage.connect('destroy', clutter.main_quit)

clutter.main()
Пример #29
0
 def main(self):
     Clutter.main()
Пример #30
0
 def run(self):
     self.stage.show_all()
     self.stage.set_size(Gdk.Screen.width(), Gdk.Screen.height())
     self.stage.set_fullscreen(True)
     Clutter.main()
    np2 = lambda n: 2 ** math.ceil(math.log(n, 2))

    actor.set_shader_param_float("x_step", 1.0 / np2(actor.get_width()))
    actor.set_shader_param_float("x_step", 1.0 / np2(actor.get_height()))

if __name__ == "__main__":
    stage = Clutter.Stage()

    stage.set_title("Shaders")
    stage.set_color(Clutter.Color.new(0x61, 0x64, 0x8c, 0xff))
    stage.set_size(512, 384)
    stage.connect("destroy", Clutter.main_quit)

    # Here we create a texture-based actor from the file on disk.
    # Our actor will toggle through shading on right/left click. Unlike the
    # normal example, we'll start with the basic redhand to let you see how
    # things change...

    actor = Clutter.Texture(filename="../../data/redhand.png")

    actor.set_position(100, 100)
    actor.set_reactive(True)
    actor.connect("button-release-event", button_release_cb, None)

    stage.add_actor(actor)
    stage.show_all()

    Clutter.main()

Пример #32
0
def main():
    Clutter.init(sys.argv)
    Test()
    Clutter.main()