当前位置: 首页>>代码示例>>Python>>正文


Python repository.GtkClutter类代码示例

本文整理汇总了Python中gi.repository.GtkClutter的典型用法代码示例。如果您正苦于以下问题:Python GtkClutter类的具体用法?Python GtkClutter怎么用?Python GtkClutter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GtkClutter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initialize_modules

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
开发者ID:brion,项目名称:pitivi,代码行数:26,代码来源:check.py

示例2: clutter_proc

    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()
开发者ID:bgribble,项目名称:mfp,代码行数:25,代码来源:gui_main.py

示例3: __init__

	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()
开发者ID:tux-00,项目名称:pygtk-osm,代码行数:35,代码来源:viewer.py

示例4: main

def main(args):
    GtkClutter.init([])
    if len(args) > 1:
        filename = args[1]
    else:
        filename = None
    app = App(filename=filename)
    Gtk.main()
开发者ID:jdahlin,项目名称:proj,代码行数:8,代码来源:main.py

示例5: show_position_on_map

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()
开发者ID:parinporecha,项目名称:GeoClue2-Locator-python,代码行数:11,代码来源:where-am-i.py

示例6: __init__

    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()
开发者ID:StanciuMarius,项目名称:Libchamplain-map-wrapping,代码行数:13,代码来源:keyboard-mapping.py

示例7: main

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()
开发者ID:jampekka,项目名称:trajexp,代码行数:47,代码来源:location_plotter.py

示例8: on_activate

	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)
开发者ID:heuripedes,项目名称:vivo,代码行数:18,代码来源:foo.py

示例9: __init__

    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()
开发者ID:wlemuel,项目名称:Petro-UI,代码行数:20,代码来源:test_window.py

示例10: do_startup

    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)
开发者ID:danigm,项目名称:gnome-clocks,代码行数:20,代码来源:app.py

示例11: initialize_modules

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()
开发者ID:MathieuDuponchelle,项目名称:Pitivi,代码行数:24,代码来源:check.py

示例12: __init__

'''
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)
开发者ID:srikanthperesandra,项目名称:osmrepository,代码行数:30,代码来源:sample.py

示例13: on_advanced_mode

        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()
开发者ID:askuhn,项目名称:Cinnamon,代码行数:30,代码来源:cinnamon-settings.py

示例14: _on_video_format_radio_clicked

    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()
开发者ID:elima,项目名称:GFreenect,代码行数:30,代码来源:testview.py

示例15:

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)
开发者ID:dsalisbury,项目名称:pythonmisc,代码行数:30,代码来源:gst_in_clutter_layout.py


注:本文中的gi.repository.GtkClutter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。