本文整理汇总了Python中gi.repository.GtkClutter.init方法的典型用法代码示例。如果您正苦于以下问题:Python GtkClutter.init方法的具体用法?Python GtkClutter.init怎么用?Python GtkClutter.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GtkClutter
的用法示例。
在下文中一共展示了GtkClutter.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize_modules
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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: clutter_proc
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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: __init__
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例4: main
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
def main(args):
GtkClutter.init([])
if len(args) > 1:
filename = args[1]
else:
filename = None
app = App(filename=filename)
Gtk.main()
示例5: show_position_on_map
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例6: __init__
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例7: main
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例8: on_activate
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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)
示例9: __init__
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例10: do_startup
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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)
示例11: initialize_modules
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例12: __init__
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
'''
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)
示例13: on_advanced_mode
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例14: _on_video_format_radio_clicked
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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()
示例15:
# 需要导入模块: from gi.repository import GtkClutter [as 别名]
# 或者: from gi.repository.GtkClutter import init [as 别名]
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)