本文整理汇总了Python中gi.repository.Clutter.init方法的典型用法代码示例。如果您正苦于以下问题:Python Clutter.init方法的具体用法?Python Clutter.init怎么用?Python Clutter.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Clutter
的用法示例。
在下文中一共展示了Clutter.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def main():
GLib.threads_init()
Clutter.init(sys.argv)
MainWindow()
Clutter.main()
示例2: __init__
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def __init__(self, argv, descriptor):
super().__init__()
Clutter.init(sys.argv)
# application main window, instance of :see: :class: `window.Window`:
self.window = None
# path to a file with style definition:
self.style = None
# dictionary for all the application basic elements:
self.box = {}
# if playing of the sound effects should be enabled:
self.sound_effects_enabled = False
# indicator of the application main loop status, should be used
# with caution as there will always be some non-zero time interval
# between setting this flag 'True' and actual launching of the loop and
# between actual quit of the loop and setting the flag 'False':
self.main_loop_is_running = False
# player of any audio effects:
self.sound_effects_player = None
self._sound_effects = {}
self._read_descriptor(descriptor)
self._configure()
self._initialize_style()
self._initialize_window(argv, descriptor)
self._initialize_sound_effects_player()
示例3: __init__
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def __init__(self):
Clutter.init([])
self.__latitude = None
self.__longitude = None
self.__selected_marker = None
self.__active_sensitive = False
self.__marker_last_location = None
self.__factory = Champlain.MapSourceFactory.dup_default()
self.__set_location_context_menu = None
self.__locations = []
self.__task_locations = {}
self.__tag_locations = {}
self.__view = None
self.__vbox_map = None
self.__map = None
self.__current_layer = None
self.__menu_item_tag_sidebar = None
self.__plugin_api = None
self.__where = Geoclue()
self.__where.client.connect_to_signal(
'LocationUpdated', self._location_updated
)
self.__where.client.Start()
self.__distance = 15
self.__preferences = None
示例4: __init__
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def __init__(self, container, argv):
PisakEduApp.APP = self
Clutter.init(argv)
self.stage = PisakEduStage(container)
self.stage.connect("destroy", lambda _: Clutter.main_quit())
self.stage.set_fullscreen(True)
self.stage.show_all()
示例5: start
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
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: __init__
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def __init__(self):
Clutter.init()
self.stage = TextStage()
self.stage.connect("destroy", lambda *_: Clutter.main_quit())
self.stage.show_all()
Clutter.main()
示例7: __init__
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def __init__(self, argv):
PisakSpellerApp.APP = self
Clutter.init(argv)
self.stage = PisakSpellerStage()
TimerCycle(self.stage.contents).start_cycle()
self.stage.connect("destroy", lambda _: Clutter.main_quit())
self.stage.set_fullscreen(True)
self.stage.show_all()
示例8: run
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
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
示例9: create_ui
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def create_ui(self):
Clutter.init()
Clutter.threads_init()
self.clutter = GtkClutter.Embed()
self.clutter.set_size_request(420, 280)
self.stage = self.clutter.get_stage()
self.stage.set_background_color(Clutter.Color
.from_string('#8c8c8c')[1])
self.stage.show_all()
self.widget.add(self.clutter)
示例10: __init__
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def __init__(self, argv):
"""
Initialize the application. Call methods that initialize
application stage, style and global sound effects player.
:param: argv application arguments
"""
super().__init__()
Gtk.init(sys.argv)
Clutter.init(sys.argv)
self._configure()
self._initialize_style()
self._initialize_window(argv)
self._initialize_sound_effects_player()
示例11: __init__
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
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 ()
示例12: main
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
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()
示例13: main
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def main():
Clutter.init(sys.argv)
# Tests
guy = PPGuy.PPGuy()
guy.set_property("direction", 100)
guy.connect("collide", collide_cb)
print guy.get_property("direction")
maze = PPMaze.PPMaze()
print maze.get_property("width")
print maze.get_property("height")
guy.emit("collide", PPGuy.PPGuy())
game = PPGame.PPGame()
Mx.Application.run(game)
示例14: enable
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
def enable(self, app=None):
"""Enable event loop integration with Clutter.
Parameters
----------
app : ignored
Ignored, it's only a placeholder to keep the call signature of all
gui activation methods consistent, which simplifies the logic of
supporting magics.
Notes
-----
This methods sets the PyOS_InputHook for Clutter, which allows
the Clutter to integrate with terminal based applications like
IPython.
"""
if GUI_CLUTTER not in self.manager.apps:
Clutter.init([])
self.manager.set_inputhook(inputhook_clutter)
self.manager._current_gui = GUI_CLUTTER
self.manager.apps[GUI_CLUTTER] = True
示例15: ObjectTest
# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import init [as 别名]
import sys
import unittest
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GObject, Gdk, Gio
from tests import skipIfGI
try:
from gi.repository import Clutter
Clutter
except ImportError:
Clutter = None
else:
status, argv = Clutter.init(sys.argv)
if status == Clutter.InitError.SUCCESS:
sys.argv = argv
else:
Clutter = None
class ObjectTest(unittest.TestCase):
def test_classes(self):
g = GObject.Object()
self.assertTrue(isinstance(g, GObject.Object))
a = Gtk.AccelMap()
self.assertTrue(isinstance(a, type(g)))
def test_init_1(self):