示例#1
0
文件: check.py 项目: brion/pitivi
def initialize_modules():
    """
    Initialize the modules.

    This has to be done in a specific order otherwise the app
    crashes on some systems.
    """
    from gi.repository import Gdk
    Gdk.init([])
    from gi.repository import GtkClutter
    GtkClutter.init([])

    import gi
    if not gi.version_info >= (3, 11):
        from gi.repository import GObject
        GObject.threads_init()

    from gi.repository import Gst
    Gst.init(None)
    from gi.repository import GES
    GES.init()

    # This is required because of:
    # https://bugzilla.gnome.org/show_bug.cgi?id=656314
    from gi.repository import GdkX11
    GdkX11  # noop
示例#2
0
文件: gui_main.py 项目: bgribble/mfp
    def clutter_proc(self):
        try:
            from gi.repository import Clutter, GObject, Gtk, GtkClutter

            # explicit init seems to avoid strange thread sync/blocking issues
            GObject.threads_init()
            GtkClutter.init([])

            # create main window
            from mfp.gui.patch_window import PatchWindow
            self.appwin = PatchWindow()
            self.mfp = MFPCommand()

        except Exception as e:
            log.error("Fatal error during GUI startup")
            log.debug_traceback()
            return

        try:
            # direct logging to GUI log console
            Gtk.main()
        except Exception as e:
            log.error("Caught GUI exception:", e)
            log.debug_traceback()
            sys.stdout.flush()
示例#3
0
    def clutter_proc(self):
        try:
            from gi.repository import Clutter, GObject, Gtk, GtkClutter

            # explicit init seems to avoid strange thread sync/blocking issues
            GObject.threads_init()
            GtkClutter.init([])

            # create main window
            from mfp.gui.patch_window import PatchWindow
            self.appwin = PatchWindow()
            self.mfp = MFPCommand()

        except Exception as e:
            log.error("Fatal error during GUI startup")
            log.debug_traceback()
            return

        try:
            # direct logging to GUI log console
            Gtk.main()
        except Exception as e:
            log.error("Caught GUI exception:", e)
            log.debug_traceback()
            sys.stdout.flush()
示例#4
0
 def __init__(self):
     GLib.threads_init()
     Gdk.threads_init()
     GtkClutter.init([])
     Endless.Application.__init__(self,
                                  application_id='com.endlessm.photos',
                                  flags=Gio.ApplicationFlags.HANDLES_OPEN)
示例#5
0
	def __init__(self):
		GtkClutter.init([])
		
		# Build windows with the .ui file and connect signals
		self.builder = Gtk.Builder()
		self.builder.set_translation_domain(APP)
		self.builder.add_from_file(UI_FILE)
		self.builder.connect_signals(self)

		# Get objects from the builder
		window = self.builder.get_object('window')
		box = self.builder.get_object('box')
		self.entry_search = self.builder.get_object('entry_search')
		self.button_search = self.builder.get_object('button_search')
		self.error_dialog = self.builder.get_object('error_dialog')
		
		# Parameters
		self.is_highlight = True

		# Create map handle
		map_widget = GtkChamplain.Embed()
		self.map_view = map_widget.get_view()
		
		self.map_view.set_property('kinetic-mode', True)
		self.map_view.set_property('zoom-level', 3)
		self.map_view.set_property('zoom-on-double-click', True)
		
		# Polygon and Marker objects
		self.polygon = Polygon(self.map_view)
		self.marker = Marker(self.map_view)
		
		# Add map_widget to the GtkBox
		box.add(map_widget)
		
		window.show_all()
示例#6
0
文件: main.py 项目: jdahlin/proj
def main(args):
    GtkClutter.init([])
    if len(args) > 1:
        filename = args[1]
    else:
        filename = None
    app = App(filename=filename)
    Gtk.main()
示例#7
0
 def display_openstreetmap(self, latitude, longitude, accuracy):
     GtkClutter.init([])
     window = Gtk.Window()
     window.connect("delete-event", Gtk.main_quit)
     window.set_default_size(1000, 800)
     map_to_show = self.get_map(latitude, longitude)
     window.add(map_to_show)
     window.show_all()
     Gtk.main()
def show_position_on_map(latitude, longitude):
    GtkClutter.init([])
    window = Gtk.Window()
    window.connect("delete-event", Gtk.main_quit)
    window.set_default_size(500, 350)

    map_to_show = get_map(latitude, longitude)

    window.add(map_to_show)
    window.show_all()
    Gtk.main()
示例#9
0
def show_position_on_map(latitude, longitude):
    GtkClutter.init([])
    window = Gtk.Window()
    window.connect("delete-event", Gtk.main_quit)
    window.set_default_size(500, 350)

    map_to_show = get_map(latitude, longitude)

    window.add(map_to_show)
    window.show_all()
    Gtk.main()
示例#10
0
    def __init__(self):
        GtkClutter.init([])

        window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
        window.connect("destroy", Gtk.main_quit)
        window.connect("key-press-event", self.on_key_press)

        self.widget = GtkChamplain.Embed()
        self.widget.set_size_request(640, 480)
        self.view = self.widget.get_view()

        window.add(self.widget)
        window.show_all()
示例#11
0
    def create_window(self, argv, descriptor):
        """
        Create application main window as the Gtk.Window.

        :param: argv: application arguments.
        :param descriptor: general application descriptor.
        """
        gtk_window = Gtk.Window()
        embed = GtkClutter.Embed()
        gtk_window.add(embed)
        gtk_window.stage = embed.get_stage()
        clutter_window = window.Window(self, gtk_window.stage, descriptor)
        clutter_window.wrapper = gtk_window
        gtk_window.stage.set_title('PISAK')
        gtk_window.stage.set_position(unit.MONITOR_X, unit.MONITOR_Y)
        if arg_parser.get_args().debug:
            coeff = 0.7
            size = coeff * unit.w(1), coeff * unit.h(1)
            gtk_window.stage.set_size(*size)
            gtk_window.set_default_size(*size)
            gtk_window.set_resizable(True)
        else:
            gtk_window.stage.set_size(unit.w(1), unit.h(1))
            gtk_window.stage.set_fullscreen(True)
            gtk_window.fullscreen()
        gtk_window.connect("destroy", lambda _: Gtk.main_quit())
        return clutter_window
    def run(self):
        self.running = True

        self.load_options()  # loads from config file
        self.parse_options(
        )  # parses the command-line arguments, these take precedence over the saved config
        self.save_options()
        self.prepare_file_queues()

        self.set_title(self.options.title)
        self.screen = self.get_screen()

        self.embed = GtkClutter.Embed()
        self.add(self.embed)
        self.embed.set_visible(True)

        self.stage = self.embed.get_stage()
        self.stage.set_color(
            Clutter.Color.get_static(Clutter.StaticColor.BLACK))
        if self.options.mode == 'fullscreen':
            self.stage.hide_cursor()

        self.texture = Clutter.Texture.new()
        self.next_texture = None
        self.prev_texture = None
        self.data_queue = Queue()

        self.connect_signals()

        self.will_enlarge = random.choice((True, False))

        self.resize(600, 400)
        self.move_to_monitor(self.options.monitor)

        self.current_mode = self.options.mode
        self.mode_was_changed = False
        if self.options.mode == 'fullscreen':
            self.fullscreen()
            self.set_skip_taskbar_hint(True)
        elif self.options.mode == 'maximized':
            self.maximize()
        elif self.options.mode == 'desktop':
            self.maximize()
            self.set_decorated(False)
            self.set_keep_below(True)
        elif self.options.mode == 'undecorated':
            self.set_decorated(False)

        def after_show(*args):
            def f():
                self.move_to_monitor(self.options.monitor)
                self.prepare_next_data()
                self.next()

            GObject.timeout_add(200, f)

        self.connect('show', lambda *args: GObject.idle_add(after_show))

        self.show()
        Gtk.main()
示例#13
0
def main(init_zoom=17, update_freq=10, window_title=None):
	from trusas0.packing import AsyncIter, ReprUnpack
	
	signal.signal(signal.SIGINT, signal.SIG_DFL)
	GtkClutter.init([])

	window = Gtk.Window()
	if window_title is not None:
		window.set_title(window_title)
	
	window.connect("destroy", Gtk.main_quit)
	
	widget = GtkChamplain.Embed()
	widget.set_size_request(640, 480)
	
	map_view = widget.props.champlain_view
	
		


	markers = Champlain.MarkerLayer()
	map_view.add_layer(markers)
	current_pos = Champlain.Point()
	current_pos.hide()
	markers.add_marker(current_pos)
	
	has_any_locations = False
	
	map_view.set_zoom_level(init_zoom)
	def set_position(lat, lon, has_any_locations=has_any_locations):
		current_pos.show()
		map_view.center_on(lat, lon)
		current_pos.set_location(lat, lon)

	window.add(widget)
	window.show_all()

	input = AsyncIter(ReprUnpack(sys.stdin))
	def consume():
		for header, loc in input:
			set_position(loc['latitude'], loc['longitude'])
	
		return True
		
	GObject.timeout_add(int(1.0/update_freq*1000), consume)

	Gtk.main()
示例#14
0
	def on_activate(self, data=None):
		GtkClutter.init([])


		self.mainwin = MainWindow()
		self.mainwin.show_all()
		self.add_window(self.mainwin)

		self.interpreter = code.InteractiveInterpreter(locals={
			'__name__' : '__livepy__',
			'__doc__' : None,
			'Stage' : self.mainwin.view.stage,
			'Path'  : Clutter.Path,
			'Color' : VivoColor,
			'Text'  : Clutter.Text
			})

		self.mainwin.editor.view.get_buffer().connect('changed', self.on_editor_change)
示例#15
0
    def __init__(self):
        super(EmbededGtkClutterStage, self).__init__()

        GtkClutter.init(sys.argv)
        self.connect("destroy", lambda w: Gtk.main_quit())

        button = Gtk.Button("Hello")
        actor = GtkClutter.Actor(contents=button)

        embed = GtkClutter.Embed()

        hbox = Gtk.HBox(False, 2)
        hbox.add(embed)

        stage = embed.get_stage()
        stage.set_color(Clutter.Color.new(0, 0, 255, 255))

        stage.add_actor(actor)

        self.show_all()
示例#16
0
    def do_startup(self):
        Gtk.Application.do_startup(self)

        GtkClutter.init(sys.argv)

        action = Gio.SimpleAction.new("quit", None)
        action.connect("activate", self.quit_cb)
        self.add_action(action)

        menu = Gio.Menu()

        menu.append(_("About Clocks"), "win.about")

        quit = Gio.MenuItem()
        quit.set_attribute([("label", "s", _("Quit")),
                            ("action", "s", "app.quit"),
                            ("accel", "s", "<Primary>q")])
        menu.append_item(quit)

        self.set_app_menu(menu)
示例#17
0
    def __init__(self, app):
        Gtk.ApplicationWindow.__init__(self,
                                       title='ClutterBrowser',
                                       application=app)

        self.build_treeview()

        self.embed = GtkClutter.Embed()

        container = Clutter.Actor()
        self.embed.get_stage().add_child(container)

        self.actors = []

        for i in range(BROWSERS):
            actor = GtkClutter.Actor()
            #actor.set_x(i * 700)

            da = Gtk.DrawingArea()
            da.connect('draw', self.on_draw)

            actor.get_widget().add(da)
            container.add_child(actor)
            self.actors.append(actor)

        scw = Gtk.ScrolledWindow()
        scw.set_size_request(200, -1)
        scw.add(self._treeview)

        pane = Gtk.Paned()
        pane.add1(scw)
        pane.add2(self.embed)

        container.save_easing_state()
        container.set_easing_mode(Clutter.AnimationMode.EASE_IN_OUT_CUBIC)
        container.set_easing_duration(1500)

        self._container = container

        self.add(pane)
示例#18
0
def initialize_modules():
    """
    Initialize the modules.

    This has to be done in a specific order otherwise the app
    crashes on some systems.
    """
    from gi.repository import Gdk
    Gdk.init([])
    from gi.repository import GtkClutter
    GtkClutter.init([])

    import gi
    if not gi.version_info >= (3, 11):
        from gi.repository import GObject
        GObject.threads_init()

    from gi.repository import Gst
    Gst.init(None)
    from gi.repository import GES
    GES.init()

    from pitivi.utils import validate
    validate.init()
示例#19
0
def initialize_modules():
    """
    Initialize the modules.

    This has to be done in a specific order otherwise the app
    crashes on some systems.
    """
    from gi.repository import Gdk
    Gdk.init([])
    from gi.repository import GtkClutter
    GtkClutter.init([])

    import gi
    if not gi.version_info >= (3, 11):
        from gi.repository import GObject
        GObject.threads_init()

    from gi.repository import Gst
    Gst.init(None)
    from gi.repository import GES
    GES.init()

    from pitivi.utils import validate
    validate.init()
示例#20
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.embed = GtkClutter.Embed()
        self.mainActor = self.embed.get_stage()

        self.videoPlayback = ClutterGst.Playback()
        self.videoContent = ClutterGst.Content()
        self.videoPlayback.set_seek_flags(ClutterGst.SeekFlags.ACCURATE)

        self.videoContent.set_player(self.videoPlayback)
        self.videoPlayback.connect("notify::progress", rewind_progress)

        self.set_startup_id('Oboi')
        self.set_type_hint(Gdk.WindowTypeHint.DESKTOP)
        self.set_skip_pager_hint(True)
        self.set_skip_taskbar_hint(True)
        self.set_accept_focus(True)
        self.stick()
        self.set_resizable(False)
        self.set_keep_below(True)
        self.set_decorated(False)

        self.drag_dest_set(Gtk.DestDefaults.MOTION | Gtk.DestDefaults.DROP,
                           None, Gdk.DragAction.MOVE)

        self.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK
                        | Gdk.EventMask.POINTER_MOTION_MASK
                        | Gdk.EventMask.SMOOTH_SCROLL_MASK)

        self.mainActor.set_background_color(
            Clutter.color_from_string("#000")[1])
        self.wallpaperActor = Clutter.Actor()

        self.videoPath = "file:///home/qwerty/Downloads/videoplayback.mp4"
        self.videoPlayback.set_uri(self.videoPath)
        print("Video path:", self.videoPlayback.get_uri())
        self.videoPlayback.set_playing(True)
        print("Is paying:", self.videoPlayback.get_playing())
        self.wallpaperActor.set_content(self.videoContent)
        # size = get_desktop_size()

        self.wallpaperActor.set_pivot_point(0.5, 0.5)
        self.wallpaperActor.scale_y = 1
        self.wallpaperActor.scale_x = 1

        self.mainActor.add_child(self.wallpaperActor)
        self.add(self.embed)
示例#21
0
 def create_window(self, argv, descriptor):
     gtk_window = Gtk.Window()
     embed = GtkClutter.Embed()
     gtk_window.add(embed)
     gtk_window.stage = embed.get_stage()
     clutter_window = window.Window(self, gtk_window.stage, descriptor)
     clutter_window.wrapper = gtk_window
     gtk_window.stage.set_title('Pisak Main')
     if arg_parser.get_args().debug:
         coeff = 0.7
         size = coeff * unit.w(1), coeff * unit.h(1)
         gtk_window.stage.set_size(*size)
         gtk_window.set_default_size(*size)
         gtk_window.set_resizable(True)
     else:
         gtk_window.stage.set_fullscreen(True)
         gtk_window.fullscreen()
     gtk_window.connect("destroy", lambda _: Gtk.main_quit())
     return clutter_window
示例#22
0
    def _createUi(self):
        self.embed = GtkClutter.Embed()
        self.embed.get_accessible().set_name("timeline canvas")  # for dogtail
        self.stage = self.embed.get_stage()

        self.timeline = TimelineStage(self)
        self.controls = ControlContainer(self.timeline)
        self.zoomBox = ZoomBox(self)
        self.shiftMask = False
        self.controlMask = False

        # TODO: make the bg a gradient from (0, 0, 0, 255) to (50, 50, 50, 255)
        self.stage.set_background_color(Clutter.Color.new(31, 30, 33, 255))
        self.timeline.set_position(CONTROL_WIDTH, 0)
        self.controls.set_position(0, 0)
        self.controls.set_z_position(2)

        self.stage.add_child(self.controls)
        self.stage.add_child(self.timeline)

        self.stage.connect("destroy", quit_)
        self.stage.connect("button-press-event", self._clickedCb)
        self.stage.connect("button-release-event", self._releasedCb)
        self.embed.connect("scroll-event", self._scrollEventCb)
        if self.gui:
            self.gui.connect("key-press-event", self._keyPressEventCb)
            self.gui.connect("key-release-event", self._keyReleaseEventCb)

        self.embed.connect("enter-notify-event", self._enterNotifyEventCb)

        self.point = Clutter.Point()
        self.point.x = 0
        self.point.y = 0

        self.scrolled = 0

        self.zoomed_fitted = True
        self.pressed = False

        self._packScrollbars(self)
        self.stage.show()
from gi.repository import Clutter
from gi.repository import GtkClutter
from gi.repository import Gtk
from gi.repository import Gst
from gi.repository import ClutterGst

# hokey way of importing from the directory above
import sys
from os.path import dirname, join
sys.path.append(join(dirname(__file__), '..'))

from helpers import maybe_stop_helper

if __name__ == '__main__':
    asyncio.set_event_loop_policy(gbulb.GtkEventLoopPolicy())
    GtkClutter.init([])
    Gst.init([])

    loop = asyncio.get_event_loop()

    window = Gtk.Window()

    clutter_embed = GtkClutter.Embed()
    window.add(clutter_embed)
    stage = clutter_embed.get_stage()

    # This gets bound onto the actor being managed by the layout; without it
    # the actor won't know its width for reflowing content
    bind_constraint = Clutter.BindConstraint.new(
        source=stage, coordinate=Clutter.BindCoordinate.SIZE, offset=0.0)
示例#24
0
import gi
import sys

gi.require_version('Gtk', '3.0')
gi.require_version('Clutter', '1.0')
gi.require_version('GtkClutter', '1.0')
from gi.repository import GtkClutter, Gtk

GtkClutter.init(sys.argv)
window = Gtk.Window(title="Cluter Gtk Example")
embed = GtkClutter.Embed(width_request=640, height_request=480)
window.add(embed)

edit = Gtk.TextView(width_request=640,
                    height_request=480,
                    wrap_mode=Gtk.WrapMode.CHAR)
edit.get_buffer().set_text("Edit me!")
embed.get_stage().add_child(GtkClutter.Actor.new_with_contents(edit))

window.connect("delete-event", Gtk.main_quit)
window.show_all()
Gtk.main()
示例#25
0
# Author: Robert Park <*****@*****.**>, (C) 2010
# Copyright: See COPYING file included with this distribution.

"""Control how the map is searched."""


from gi.repository import GtkClutter
GtkClutter.init([])

from os.path import join

from gg.territories import get_state, get_country
from gg.widgets import Widgets, MapView
from gg.build_info import PKG_DATA_DIR


# ListStore column names
LOCATION, LATITUDE, LONGITUDE = range(3)


class SearchController():
    """Controls the behavior for searching the map."""
    last_search = None

    def __init__(self):
        """Make the search box and insert it into the window."""
        self.search = None
        self.results = Widgets.search_results
        search = Widgets.search_completion
        search.set_match_func(
            lambda c, s, itr, get:
示例#26
0
    def run(self):
        self.running = True

        self.window = Gtk.Window()

        self.load_options()  # loads from config file
        self.parse_options()  # parses the command-line arguments, these take precedence over the saved config
        self.save_options()
        self.prepare_file_queues()

        self.window.set_title(self.options.title)
        self.screen = self.window.get_screen()

        self.embed = GtkClutter.Embed()
        self.window.add(self.embed)
        self.embed.set_visible(True)

        self.stage = self.embed.get_stage()
        self.stage.set_color(Clutter.Color.get_static(Clutter.StaticColor.BLACK))
        if self.options.mode == "fullscreen":
            self.stage.hide_cursor()

        self.texture = Clutter.Texture.new()
        self.next_texture = None
        self.prev_texture = None
        self.data_queue = Queue()

        self.connect_signals()

        self.will_enlarge = random.choice((True, False))

        self.window.resize(600, 400)
        self.move_to_monitor(self.options.monitor)

        self.current_mode = self.options.mode
        self.mode_was_changed = False
        if self.options.mode == "fullscreen":
            self.window.fullscreen()
            self.window.set_skip_taskbar_hint(True)
        elif self.options.mode == "maximized":
            self.window.maximize()
        elif self.options.mode == "desktop":
            self.window.maximize()
            self.window.set_decorated(False)
            self.window.set_keep_below(True)

            # ensure window will get deiconified (i.e. unminimized) after "Show Desktop" button/shortcut
            def _window_state_changed(window, event, *args):
                if event.new_window_state & Gdk.WindowState.ICONIFIED:
                    self.window.deiconify()
                    self.window.present()

            self.window.connect("window-state-event", _window_state_changed)

        elif self.options.mode == "undecorated":
            self.window.set_decorated(False)

        if self.options.hide_from_taskbar:
            self.window.set_skip_taskbar_hint(True)

        def after_show(*args):
            def f():
                self.move_to_monitor(self.options.monitor)
                self.prepare_next_data()
                self.go_next()

            GObject.timeout_add(200, f)

        self.window.connect("show", lambda *args: GObject.idle_add(after_show))
        self.window.show()
        Gtk.main()
示例#27
0
            state |= Gtk.StateFlags.PRELIGHT

        self._context.set_state(state)

        Gtk.render_background(self._context, cr, 0, 0, width, height)
        Gtk.render_frame(self._context, cr, 0, 0, width, height)
        self._context.restore()
        return True


def on_button_clicked(actor):
    print('Clicked!')


if __name__ == '__main__':
    GtkClutter.init(None)

    # Our top-level window
    window = Gtk.Window(title='Test')
    window.connect('destroy', Gtk.main_quit)
    window.show()

    # The styled GtkClutterEmbed widget
    embed = StyledEmbed()
    # Keep the size of the stage tied to the size of the embedding widget
    embed.props.use_layout_size = True
    window.add(embed)
    embed.show()

    stage = embed.get_stage()
示例#28
0
    def on_contextmenu_tag_location(self, widget, plugin_api):
        wTree = Gtk.glade.XML(self.glade_file, "TagLocation")
        dialog = wTree.get_widget("TagLocation")
        plugin_api.set_parent_window(dialog)

        btn_zoom_in = wTree.get_widget("btn_zoom_in")
        btn_zoom_out = wTree.get_widget("btn_zoom_out")
        vbox_map = wTree.get_widget("vbox_map")

        tag = plugin_api.get_tagpopup_tag()
        dialog.set_title(tag.get_attribute("name") + "'s Location")

        # get the tag's location
        try:
            tag_location = eval(tag.get_attribute("location"))
        except:
            tag_location = None

        # get the tag's color
        try:
            tag_color = self.HTMLColorToRGB(tag.get_attribute("color"))
        except:
            tag_color = None

        champlain_view = champlain.View()
        champlain_view.set_property("scroll-mode",
                                    champlain.SCROLL_MODE_KINETIC)

        layer = MarkerLayer()

        marker_tag = None
        if tag_location:
            marker_tag = layer.add_marker(tag.get_attribute("name"),
                                          tag_location[0], tag_location[1],
                                          tag_color)
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    marker_tag = layer.add_marker(tag.get_attribute("name"),
                                                  self.location['latitude'],
                                                  self.location['longitude'],
                                                  tag_color)
            except:
                marker_tag = layer.add_marker(tag.get_attribute("name"), None,
                                              None)

        champlain_view.add_layer(layer)

        embed = GtkClutter.Embed()
        embed.set_size_request(400, 300)

        champlain_view.set_reactive(True)
        champlain_view.connect("button-release-event",
                               self.champlain__tag_change_marker,
                               champlain_view, marker_tag)

        layer.show_all()

        if tag_location:
            champlain_view.set_property("zoom-level", 9)
        elif self.location:
            champlain_view.set_property("zoom-level", 5)
        else:
            champlain_view.set_property("zoom-level", 1)

        vbox_map.add(embed)

        embed.realize()
        stage = embed.get_stage()
        champlain_view.set_size(400, 300)
        stage.add(champlain_view)

        # connect the toolbar buttons for zoom
        btn_zoom_in.connect("clicked", self.zoom_in, champlain_view)
        btn_zoom_out.connect("clicked", self.zoom_out, champlain_view)
        dialog.connect("response", self.tag_location_close, tag, marker_tag)

        dialog.show_all()

        if tag_location:
            champlain_view.center_on(marker_tag.get_property('latitude'),
                                     marker_tag.get_property('longitude'))
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    champlain_view.center_on(self.location['latitude'],
                                             self.location['longitude'])
            except:
                pass
示例#29
0
 def __init__(self):
     Gtk.Application.__init__(self)
     GtkClutter.init(sys.argv)
示例#30
0
import os
import sys
import math

from gi.repository import GtkClutter as gtkclutter
gtkclutter.init(sys.argv)

from gi.repository import Gtk as gtk, Cogl as cogl, Clutter as clutter, WebKit as webkit, JSCore as jscore, Gdk as gdk, GObject as gobject

BACKGROUND_IMAGE = 'Sommerspaziergang.jpg'

FRAMERATE = 30.0

CURVE_LINEAR = lambda x: x
CURVE_SINE = lambda x: math.sin(math.pi / 2 * x)

def rounded_rectangle(cr, x, y, w, h, r=20):
    # This is just one of the samples from
    # http://www.cairographics.org/cookbook/roundedrectangles/
    #   A****BQ
    #  H      C
    #  *      *
    #  G      D
    #   F****E

    cr.move_to(x+r,y)                      # Move to A
    cr.line_to(x+w-r,y)                    # Straight line to B
    cr.curve_to(x+w,y,x+w,y,x+w,y+r)       # Curve to C, Control points are both at Q
    cr.line_to(x+w,y+h-r)                  # Move to D
    cr.curve_to(x+w,y+h,x+w,y+h,x+w-r,y+h) # Curve to E
    cr.line_to(x+r,y+h)                    # Line to F
    def startup_cb(self, app):
        GObject.threads_init()
        Gst.init(None)
        GtkClutter.init()

        resource = Gio.Resource.load(os.path.join(MEDIA_PATH, "tarrabme-checker-resources.gresource"))
        Gio.resources_register(resource)

        self.load_config()

        self.style_provider = Gtk.CssProvider()
        style_file = Gio.File.new_for_uri('resource://org/me/tarrab/Checker/style.css')
        self.style_provider.load_from_file(style_file)

        Gtk.StyleContext.add_provider_for_screen(
            Gdk.Screen.get_default(),
            self.style_provider,
            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
        )

        icon = GdkPixbuf.Pixbuf.new_from_resource('/org/me/tarrab/Checker/tarrab-me-icon.png')

        action = Gio.SimpleAction.new('preferences', None)
        action.connect('activate', self.preferences_cb)
        self.add_action(action)

        action = Gio.SimpleAction.new('quit', None)
        action.connect('activate', self.quit_cb)
        self.add_action(action)

        app_menu = Gio.Menu()
        app_menu.append('Preferences', 'app.preferences')
        app_menu.append('Quit', 'app.quit')

        self.set_app_menu(app_menu)

        row_count = self.settings.get_int("row-count")
        column_count = self.settings.get_int("column-count")

        index = 0
        for win in range(self.settings.get_int("window-count")):
            window = Gtk.ApplicationWindow(self, type=Gtk.WindowType.TOPLEVEL)
            window.set_icon(icon)
            window.set_wmclass("tarrab_checker", "tarrab.me Checker")
            window.set_title("tarrab.me Checker")
            window.set_default_size(790, 450)

            self.toolbar = Gtk.HeaderBar()
            self.toolbar.set_halign(Gtk.Align.FILL)

            box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
            box.set_homogeneous(True)

            window.set_titlebar(box)

            self.add_window(window)

            grid = Gtk.Grid()
            grid.get_style_context().add_class('reader-grid')
            grid.set_row_homogeneous(True)
            grid.set_column_homogeneous(True)

            for row in range(row_count):
                grid.insert_row(0)
            for column in range(column_count):
                grid.insert_column(0)

            for row in range(row_count):
                for column in range(column_count):
                    index += 1
                    reader = Reader(window, self, "reader_" + str(index),
                                    label="Reader " + str(index))

                    reader.get_style_context().add_class('reader')

                    reader.get_style_context().add_class('reader-row-{}'.format(row))
                    if row == 0:
                        reader.get_style_context().add_class('reader-row-first')
                    if row == row_count - 1:
                        reader.get_style_context().add_class('reader-row-last')
                    reader.get_style_context().add_class('reader-column-{}'.format(column))
                    if column == 0:
                        reader.get_style_context().add_class('reader-column-first')
                    if column == column_count - 1:
                        reader.get_style_context().add_class('reader-column-last')

                    grid.attach(reader, column, row, 1, 1)

                    if row == 0:
                        reader.remove(reader.toolbar)
                        box.pack_start(reader.toolbar, True, True, 0)
                        if column == 0:
                            box.get_style_context().add_class('header-reader-first')
                        if column == column_count - 1:
                            box.get_style_context().add_class('header-reader-last')

            window.add(grid)
            window.show_all()
示例#32
0
label = Gtk.Label("x")

window = Gtk.Window()
vbox = Gtk.VBox()
window.add(vbox)

texture = Clutter.Texture.new()
sink = Gst.ElementFactory.make("cluttersink", "clutter")
sink.props.texture = texture
src = Gst.ElementFactory.make("videotestsrc", None)
pipeline = Gst.Pipeline()
pipeline.add(src)
pipeline.add(sink)
src.link(sink)

embed = GtkClutter.Embed()
embed.set_size_request(320, 240)

stage = embed.get_stage()
stage.add_child(texture)
stage.set_size(320, 240)
stage.show_all()

vbox.pack_start(embed, True, True, 0)
vbox.pack_start(label, False, False, 0)

window.connect("delete-event", Gtk.main_quit)

window.show_all()

pipeline.set_state(Gst.State.PLAYING)
示例#33
0
import sys
import code

# initialize gtkclutter
if __name__ == "__main__":
    from gi.repository import GtkClutter

    GtkClutter.init(sys.argv)

from gi.repository import Clutter, GLib, Gio, Gtk, Gdk, GtkSource

from gui import *
from sandbox import *
import user


class VivoApp(Gtk.Application):
    def __init__(self):
        super().__init__(application_id="apps.Vivo",
                         #flags=Gio.ApplicationFlags.HANDLES_OPEN
                         )

        self.connect("activate", self.on_activate)

    #	self.connect("command-line", self.on_command_line)

    def on_activate(self, data=None):

        self.mainwin = MainWindow()
        self.mainwin.show_all()
        self.add_window(self.mainwin)
示例#34
0
文件: camera.py 项目: Antergos/Cnchi
def cheese_init():
    """ Initialize libcheese, by initializing Clutter and GStreamer. """
    Gst.init(None)
    GtkClutter.init([])
示例#35
0
    def _on_video_format_radio_clicked(self, rgb_radio):
        """
        Called when the video format radio button is clicked.
        It stops the current video stream, sets the new mode and
        restarts it again.
        This way it can show either RGB or Infra-red video.
        """
        self.kinect.stop_video_stream()
        if rgb_radio.get_active():
            video_format = GFreenect.VideoFormat.RGB
        else:
            video_format = GFreenect.VideoFormat.IR_8BIT
        self.kinect.start_video_stream(GFreenect.Resolution.MEDIUM, video_format)

    def _on_delete_event(self, window, event):
        """
        Called when the window is closed.
        If there is a recognized Kinect device it stops the
        video and depth streams and quits the application.
        """
        if self.kinect:
            self.kinect.stop_video_stream()
            self.kinect.stop_depth_stream()
        Gtk.main_quit()


if __name__ == "__main__":
    GtkClutter.init(sys.argv)
    view = GFreenectView()
    Gtk.main()
示例#36
0
gi.require_version('ClutterGst', '3.0')
gi.require_version('Clutter', '1.0')

from gi.repository import Gtk, Gdk, GtkClutter, ClutterGst, Clutter, Gst, Gio

from utils import get_desktop_size
from video_wallpaper import VideoWallpaper
from shader_wallpaper import ShaderWallpaper

from OpenGL.GLUT import glutInit, glutMainLoop

if __name__ == '__main__':
    # app = App()
    # app.run(sys.argv)
    # chkDesktop()
    GtkClutter.init()
    ClutterGst.init()
    Gtk.init()
    Gst.init()
    # glutInit()
    size = get_desktop_size(0)
    window = VideoWallpaper(title="Test")
    # window = ShaderWallpaper(title="Test")
    window.move(1920, 0)
    window.set_actors_size(size)
    window.set_default_size(size[0], size[1])
    window.connect('destroy', Gtk.main_quit)
    window.show_all()

    # Clutter.main()
    Gtk.main()
示例#37
0
def cheese_init():
    """ Initialize libcheese, by initializing Clutter and GStreamer. """
    Gst.init(None)
    GtkClutter.init([])
示例#38
0
        popup_advanced_mode = Gtk.CheckMenuItem(_("Advanced Mode"))
        popup_advanced_mode.set_draw_as_radio(True)
        popup_advanced_mode.set_active(self.advanced_mode)
        popup_advanced_mode.show()
        popup.append(popup_advanced_mode)

        popup_normal_mode.connect('activate', self.on_normal_mode)
        popup_advanced_mode.connect('activate', self.on_advanced_mode)
        popup.popup(None, None, None, None, 0, 0)

    def on_advanced_mode(self, popup):
        self.advanced_mode = True
        self.settings.set_boolean(ADVANCED_GSETTING, True)
        if self.current_sidepage is not None:
            self.current_sidepage.build(self.advanced_mode)
        self.displayCategories()

    def on_normal_mode(self, popup):
        self.advanced_mode = False
        self.settings.set_boolean(ADVANCED_GSETTING, False)
        if self.current_sidepage is not None:
            self.current_sidepage.build(self.advanced_mode)
        self.displayCategories()

if __name__ == "__main__":
    GObject.threads_init()
    GtkClutter.init(None)
    Gst.init(None)
    MainWindow()
    Gtk.main()
示例#39
0
    def set_task_location(self, widget, plugin_api, location=None):
        wTree = Gtk.glade.XML(self.glade_file, "SetTaskLocation")
        dialog = wTree.get_widget("SetTaskLocation")
        plugin_api.set_parent_window(dialog)

        btn_zoom_in = wTree.get_widget("btn_zoom_in")
        btn_zoom_out = wTree.get_widget("btn_zoom_out")

        dialog_action_area_btn = wTree.get_widget("dialog_action_area_btn")
        btn_ok = wTree.get_widget("btn_ok")
        btn_cancel = wTree.get_widget("btn_cancel")
        btn_close = wTree.get_widget("btn_close")

        self.radiobutton1 = wTree.get_widget("radiobutton1")
        self.radiobutton2 = wTree.get_widget("radiobutton2")
        self.txt_new_tag = wTree.get_widget("txt_new_tag")
        self.cmb_existing_tag = wTree.get_widget("cmb_existing_tag")

        tabela = wTree.get_widget("tabela_set_task")

        vbox_map = wTree.get_widget("vbox_map")
        vbox_opt = wTree.get_widget("vbox_opt")

        champlain_view = champlain.View()
        champlain_view.set_property("scroll-mode",
                                    champlain.SCROLL_MODE_KINETIC)
        # champlain_view.set_property("zoom-on-double-click", False)

        # create a list of the tags and their attributes
        tag_list = []
        for tag in plugin_api.get_tags():
            tmp_tag = {}
            for attr in tag.get_all_attributes():
                if attr == "color":
                    color = self.HTMLColorToRGB(tag.get_attribute(attr))
                    tmp_tag[attr] = color
                    tmp_tag['has_color'] = "yes"
                elif attr == "location":
                    tmp_tag[attr] = eval(tag.get_attribute(attr))
                else:
                    tmp_tag[attr] = tag.get_attribute(attr)
            tag_list.append(tmp_tag)

        # checks if there is one tag with a location
        task_has_location = False
        for tag in tag_list:
            for key, item in list(tag.items()):
                if key == "location":
                    task_has_location = True
                    break

        # set the markers
        layer = MarkerLayer()

        self.marker_list = []
        if task_has_location:
            for tag in tag_list:
                for key, item in list(tag.items()):
                    if key == "location":
                        color = None
                        try:
                            if tag['has_color'] == "yes":
                                color = tag['color']
                        except:
                            # PROBLEM: the tag doesn't have color
                            # Possibility, use a color from another tag
                            pass

                        self.marker_list.append(
                            layer.add_marker(plugin_api.get_task_title(),
                                             tag['location'][0],
                                             tag['location'][1], color))
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    self.marker_list.append(
                        layer.add_marker(plugin_api.get_task_title(),
                                         self.location['latitude'],
                                         self.location['longitude']))
            except:
                self.marker_list.append(
                    layer.add_marker(plugin_api.get_task_title(), None, None))

        champlain_view.add_layer(layer)

        embed = GtkClutter.Embed()
        embed.set_size_request(400, 300)

        if not task_has_location:
            # method that will change the marker's position
            champlain_view.set_reactive(True)
            champlain_view.connect("button-release-event",
                                   self.champlain_change_marker,
                                   champlain_view)

        layer.show_all()

        if task_has_location:
            champlain_view.set_property("zoom-level", 9)
        elif self.location:
            champlain_view.set_property("zoom-level", 5)
        else:
            champlain_view.set_property("zoom-level", 1)

        vbox_map.add(embed)

        embed.realize()
        stage = embed.get_stage()
        champlain_view.set_size(400, 300)
        stage.add(champlain_view)

        # connect the toolbar buttons for zoom
        btn_zoom_in.connect("clicked", self.zoom_in, champlain_view)
        btn_zoom_out.connect("clicked", self.zoom_out, champlain_view)

        if task_has_location:
            dialog_action_area_btn.remove(btn_ok)
            dialog_action_area_btn.remove(btn_cancel)
            dialog.connect("response", self.task_location_close)
        else:
            dialog_action_area_btn.remove(btn_close)
            # show a close button or the ok/cancel
            dialog.connect("response", self.set_task_location_close,
                           plugin_api)

        # if there is no location set, we want to set it
        if not task_has_location:
            self.location_defined = False
            if len(plugin_api.get_tags()) > 0:
                liststore = Gtk.ListStore(str)
                self.cmb_existing_tag.set_model(liststore)
                for tag in plugin_api.get_tags():
                    liststore.append([tag.get_attribute("name")])
                self.cmb_existing_tag.set_text_column(0)
                self.cmb_existing_tag.set_active(0)
            else:
                # remove radiobutton2 and the comboboxentry
                tabela.remove(self.radiobutton1)
                tabela.remove(self.radiobutton2)
                tabela.remove(self.cmb_existing_tag)
                label = Gtk.Label()
                label.set_text("Associate with new tag: ")
                tabela.attach(label, 0, 1, 0, 1)
                label.show()
        else:
            self.location_defined = True
            vbox_opt.remove(tabela)
            dialog.set_title("View the task's location")

        dialog.show_all()

        if task_has_location:
            champlain_view.center_on(
                self.marker_list[0].get_property('latitude'),
                self.marker_list[0].get_property('longitude'))
        else:
            try:
                if self.location['longitude'] and self.location['latitude']:
                    champlain_view.center_on(self.location['latitude'],
                                             self.location['longitude'])
            except:
                pass
示例#40
0
#!/usr/bin/env python

from gi.repository import GtkClutter, Clutter
GtkClutter.init([])  # Must be initialized before importing those:
from gi.repository import Gtk
from gi.repository import GtkChamplain, Champlain

import os
import sys
os.chdir(os.path.dirname(os.path.abspath(__file__)))
sys.path.append('lib')

from libcnml import Status

from utils import APP_NAME, LOCALE_DIR

import gettext
gettext.bindtextdomain(APP_NAME, LOCALE_DIR)
gettext.textdomain(APP_NAME)
_ = gettext.gettext


# It's compound of two ChamplainMarkerLayer layers
class GtkGuifinetMap(GtkChamplain.Embed):
    def __init__(self, parent):
        GtkChamplain.Embed.__init__(self)
        self.set_size_request(640, 480)

        self.parent = parent
        self.view = self.get_view()
        self.view.set_reactive(True)
示例#41
0
    def __init__(self):
        signal.signal(signal.SIGINT, self._quit)
        signal.signal(signal.SIGTERM, self._quit)
        # SIGSEGV as a fail-safe
        signal.signal(signal.SIGSEGV, self._quit)

        # Initialize
        GtkClutter.init()
        ClutterGst.init()
        create_dir(VIDEO_WALLPAPER_PATH)

        self.config_handler = ConfigHandler(self._on_config_modified)
        self.config = self.config_handler.config
        self.current_video_path = self.config.video_path
        self.user_pause_playback = False
        self.is_any_maximized, self.is_any_fullscreen = False, False

        # Monitor Detect
        self.width, self.height = self.monitor_detect()

        # Actors initialize
        self.embed = GtkClutter.Embed()
        self.main_actor = self.embed.get_stage()
        self.main_actor.set_background_color(Clutter.Color.get_static(Clutter.StaticColor.BLACK))

        # Video initialize
        self.video_playback = ClutterGst.Playback()
        self.video_content = ClutterGst.Content()
        self.video_content.set_player(self.video_playback)

        # Playback settings
        self.video_playback.set_filename(self.config.video_path)
        self.video_playback.set_audio_volume(0.0 if self.config.mute_audio else self.config.audio_volume)
        self.video_playback.set_playing(True)
        self.video_playback.connect('eos', self._on_eos)
        self.main_actor.set_content(self.video_content)

        # Window settings
        self.window = Gtk.Window()
        self.window.add(self.embed)
        self.window.set_type_hint(Gdk.WindowTypeHint.DESKTOP)
        self.window.set_size_request(self.width, self.height)

        # button event
        self._build_context_menu()
        self.window.connect('button-press-event', self._on_button_press_event)
        self.window.show_all()

        self.active_handler = ActiveHandler(self._on_active_changed)
        self.window_handler = WindowHandler(self._on_window_state_changed)
        self.static_wallpaper_handler = StaticWallpaperHandler()
        self.static_wallpaper_handler.set_static_wallpaper()

        if self.config.video_path == '':
            # First time
            ControlPanel().run()
        elif not os.path.isfile(self.config.video_path):
            self._on_file_not_found(self.config.video_path)

        self.file_list = scan_dir()
        random.shuffle(self.file_list)
        self.current = 0
        if self.config.video_path in self.file_list:
            self.current = self.file_list.index(self.config.video_path)
        Gtk.main()
示例#42
0
'''
Created on Feb 14, 2016

@author: srikanth
'''


from gi.repository import GtkClutter, Clutter
GtkClutter.init([]) # Must be initialized before importing those:
from gi.repository import GObject, Gtk, Champlain, GtkChamplain, Pango

import os, sys
os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))

class LauncherGTK:

    def __init__(self):
        self.window = Gtk.Window()
        self.window.set_border_width(10)
        self.window.set_title("libchamplain Gtk+ demo (python introspection)")
        self.window.connect("destroy", Gtk.main_quit)

        vbox = Gtk.VBox(False, 10)

        embed = GtkChamplain.Embed()

        self.view = embed.get_view()
        self.view.set_reactive(True)
        self.view.connect('button-release-event', self.mouse_click_cb,
            self.view)
示例#43
0
    def main(self):
        #    Clutter.init(sys.argv)
        Gtk.init(sys.argv)
        GtkClutter.init(sys.argv)

        window = Gtk.Window()
        window.resize(800, 600)
        window.set_title("Clutter tests window")  # Window's title
        window.move(100, 100)
        window.connect('destroy',
                       lambda x: Gtk.main_quit())  # Connect signal 'destroy'
        window.set_decorated(False)

        self.screen = window.get_screen()

        self.visual = self.screen.get_rgba_visual()
        if self.visual and self.screen.is_composited():
            window.set_visual(self.visual)
        window.set_app_paintable(True)
        window.connect("draw", area_draw)

        box = Gtk.VBox()
        box.set_margin_top(30)
        box.set_margin_bottom(30)
        box.set_margin_left(30)
        box.set_margin_right(30)
        make_transparent(box)
        window.add(box)

        embed = GtkClutter.Embed()
        make_transparent(embed)
        box.add(embed)

        stage = embed.get_stage()
        #    stage = Clutter.Stage()     # Create the Stage
        color = Clutter.Color.new(77, 75, 69, 0.9 * 255)
        stage.set_use_alpha(True)
        stage.set_color(color)
        #stage.set_opacity(128)
        stage.set_size(800, 600)
        stage.set_title("Clutter tests stage")  # Window's title
        #stage.set_fullscreen(True)

        layout = Clutter.BinLayout()
        stage.set_layout_manager(layout)
        #
        folder = '/d/Pics/Wallpapers/Favorites/'
        images = [
            os.path.join(folder, f) for f in os.listdir(folder)
            if f.endswith('.jpg')
        ]
        self.current = images[1]

        self.current_texture = get_texture(self.current)
        stage.add_actor(self.current_texture)

        web_view = WebKit.WebView()
        web_view.set_transparent(True)
        make_transparent(web_view)
        web_view.set_can_focus(True)
        web_view.load_string(
            "<html><body style='background: rgba(100, 0, 0, 0.5); color: white;'>AAAAAAAAAAA</body></html>",
            "text/html", "UTF-8", "file://" + os.path.dirname(__file__) + "/")
        web_view_actor = GtkClutter.Actor.new_with_contents(web_view)
        #        web_view_actor.set_width(800)
        make_transparent(web_view_actor.get_widget())
        layout.add(web_view_actor, Clutter.BinAlignment.FILL,
                   Clutter.BinAlignment.END)
        #        web_view_actor.set_opacity(0)
        #        web_view_actor.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 1000, ["opacity"], [255])

        #    stage.show_all()
        window.show_all()

        def go(*args):
            self.current = images[(images.index(self.current) + 1) %
                                  len(images)]
            nextt = get_texture(self.current)
            nextt.set_opacity(0)
            nextt.set_x((stage.get_width() - nextt.get_width()) / 2)
            nextt.set_y((stage.get_height() - nextt.get_height()) / 2)
            stage.add_actor(nextt)

            def a():
                a1 = self.current_texture.animatev(
                    Clutter.AnimationMode.EASE_OUT_SINE, 250, ["opacity"], [0])
                nextt.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 250,
                               ["opacity"], [255])
                previoust = self.current_texture
                self.current_texture = nextt
                a1.connect('completed', lambda x: previoust.destroy())
                stage.raise_child(web_view_actor, None)

            GObject.idle_add(a)

        stage.connect('button-press-event', go)

        #    Clutter.main()                   # Start the application
        Gtk.main()  # Start the application
示例#44
0
#!/usr/bin/python

from gi.repository import Gdk
from gi.repository import ClutterGst
from gi.repository import Clutter
from gi.repository import GtkClutter
from gi.repository import Gst
from gi.repository import Gtk

Gdk.init([])
Gtk.init([])
GtkClutter.init([])
Gst.init([])
Clutter.init([])
ClutterGst.init([])

window = Gtk.Window()

texture = Clutter.Texture.new()
sink = Gst.ElementFactory.make("cluttersink", None)
sink.props.texture = texture
src = Gst.ElementFactory.make("videotestsrc", None)
pipeline = Gst.Pipeline()
pipeline.add(src, sink)
src.link(sink)

embed = GtkClutter.Embed()
embed.set_size_request(320, 240)

stage = embed.get_stage()
stage.add_child(texture)
示例#45
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#

import logging
from logging import Handler

from gi.repository import Clutter as clutter
from gi.repository import GObject as gobject
from gi.repository import GtkClutter as cluttergtk
from gi.repository import Gdk as gdk
from gi.repository import Gtk as gtk

# Init Clutter
cluttergtk.init(0, "")

import settings

from pointsons.ui.osc_control import OSCControl
from pointsons.ui.configuration import UIConfiguration

from pointsons.configuration import Configurations

from pointsons.ui.bowl import Bowl

from pointsons import logger


class BowlConfigUI(object):
    def __init__(self):
示例#46
0
    def main(self):
    #    Clutter.init(sys.argv)
        Gtk.init(sys.argv)
        GtkClutter.init(sys.argv)

        window = Gtk.Window()
        window.resize(800, 600)
        window.set_title("Clutter tests window")          # Window's title
        window.move(100, 100)
        window.connect('destroy', lambda x: Gtk.main_quit())  # Connect signal 'destroy'
        window.set_decorated(False)

        self.screen = window.get_screen()

        self.visual = self.screen.get_rgba_visual()
        if self.visual and self.screen.is_composited():
            window.set_visual(self.visual)
        window.set_app_paintable(True)
        window.connect("draw", area_draw)

        box = Gtk.VBox()
        box.set_margin_top(30)
        box.set_margin_bottom(30)
        box.set_margin_left(30)
        box.set_margin_right(30)
        make_transparent(box)
        window.add(box)

        embed = GtkClutter.Embed()
        make_transparent(embed)
        box.add(embed)

        stage = embed.get_stage()
    #    stage = Clutter.Stage()     # Create the Stage
        color = Clutter.Color.new(77, 75, 69, 0.9 * 255)
        stage.set_use_alpha(True)
        stage.set_color(color)
        #stage.set_opacity(128)
        stage.set_size(800, 600)
        stage.set_title("Clutter tests stage")          # Window's title
        #stage.set_fullscreen(True)

        layout = Clutter.BinLayout()
        stage.set_layout_manager(layout)
#
        folder = '/d/Pics/Wallpapers/Favorites/'
        images = [os.path.join(folder, f) for f in os.listdir(folder) if f.endswith('.jpg')]
        self.current = images[1]

        self.current_texture = get_texture(self.current)
        stage.add_actor(self.current_texture)

        web_view = WebKit.WebView()
        web_view.set_transparent(True)
        make_transparent(web_view)
        web_view.set_can_focus(True)
        web_view.load_string("<html><body style='background: rgba(100, 0, 0, 0.5); color: white;'>AAAAAAAAAAA</body></html>", "text/html", "UTF-8", "file://" + os.path.dirname(__file__) + "/")
        web_view_actor = GtkClutter.Actor.new_with_contents(web_view)
#        web_view_actor.set_width(800)
        make_transparent(web_view_actor.get_widget())
        layout.add(web_view_actor, Clutter.BinAlignment.FILL, Clutter.BinAlignment.END)
#        web_view_actor.set_opacity(0)
#        web_view_actor.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 1000, ["opacity"], [255])

        #    stage.show_all()
        window.show_all()

        def go(*args):
            self.current = images[(images.index(self.current) + 1) % len(images)]
            nextt = get_texture(self.current)
            nextt.set_opacity(0)
            nextt.set_x((stage.get_width() - nextt.get_width()) / 2)
            nextt.set_y((stage.get_height() - nextt.get_height()) / 2)
            stage.add_actor(nextt)
            def a():
                a1 = self.current_texture.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 250, ["opacity"], [0])
                nextt.animatev(Clutter.AnimationMode.EASE_OUT_SINE, 250, ["opacity"], [255])
                previoust = self.current_texture
                self.current_texture = nextt
                a1.connect('completed', lambda x: previoust.destroy())
                stage.raise_child(web_view_actor, None)
            GObject.idle_add(a)

        stage.connect('button-press-event', go)

    #    Clutter.main()                   # Start the application
        Gtk.main()                   # Start the application