當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。