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


Python repository.Clutter类代码示例

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


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

示例1: __init__

   def __init__(self):
    self.stage = Clutter.Stage()
    self.stage.set_size(400, 400)
    self.layout_manager = Clutter.BoxLayout()
    self.textures_box = Clutter.Actor(layout_manager=self.layout_manager)
    self.stage.add_actor(self.textures_box)

    self.video_texture = Clutter.Texture.new()

    self.video_texture.set_keep_aspect_ratio(True)
    self.video_texture.set_size(400,400)
    self.layout_manager.pack(self.video_texture, expand=False, x_fill=False, y_fill=False, x_align=Clutter.BoxAlignment.CENTER, y_align=Clutter.BoxAlignment.CENTER)

    self.camera = Cheese.Camera.new(self.video_texture, None, 100, 100)
    Cheese.Camera.setup(self.camera, None)
    Cheese.Camera.play(self.camera)

    def added(signal, data):
        uuid=data.get_uuid()
        node=data.get_device_node()
        print "uuid is " +str(uuid)
        print "node is " +str(node)
        self.camera.set_device_by_device_node(node)
        self.camera.switch_camera_device()

    device_monitor=Cheese.CameraDeviceMonitor.new()
    device_monitor.connect("added", added)
    device_monitor.coldplug()

    self.stage.show()
    Clutter.main()
开发者ID:aalex,项目名称:videocontrol,代码行数:31,代码来源:using_libcheese.py

示例2: clutter

    def clutter(self):
        if self.actor is None:
            if self._tag == 'img':
                self.actor = Clutter.Texture()
                self.actor.set_from_file(self._src)

            elif self._tag == 'video':
                self.actor = ClutterGst.VideoTexture()
                self.actor.set_seek_flags(ClutterGst.SeekFlags(1))
                self.actor.set_uri(self._src)
                self.actor.connect("eos", self._after)
            
            if self._region in region_names:
                parent = False
                for region in region_names[self._region]:
                    if not parent:
                        region.stage.add_actor(self.actor)
                        parent = True
                    else:
                        clone = Clutter.Clone.new(self.actor)
                        region.stage.add_actor(clone)
                        self.clone.append(clone)
            elif self._region in region_ids:
                region_ids[self._region].stage.add_actor(self.actor)
            else:
                stage.add_actor(self.actor)
        
        if self._tag == 'img':
            Clutter.threads_add_timeout(0, self._dur, self._after, None)
        elif self._tag == 'video':
            self.actor.set_progress(0.0)
            self.actor.set_playing(True)

        self.actor.show()
开发者ID:Kinkrsoftware,项目名称:SimpleSMIL,代码行数:34,代码来源:smil.py

示例3: on_key_press_event

def on_key_press_event(stage, event):
    scroll = stage.get_first_child()
    menu = scroll.get_first_child()
    key = event.keyval

    if key == Clutter.KEY_q:
        Clutter.main_quit()
        return True

    if key == Clutter.KEY_Up:
        item = menu.select_prev()
        if item is not None:
            pos = Clutter.Point()
            (pos.x, pos.y) = item.get_position()
            scroll.scroll_to_point(pos)
            return True

    if key == Clutter.KEY_Down:
        item = menu.select_next()
        if item is not None:
            pos = Clutter.Point()
            (pos.x, pos.y) = item.get_position()
            scroll.scroll_to_point(pos)
            return True

    if key == Clutter.KEY_Return or key == Clutter.KEY_KP_Enter:
        menu.activate_item()
        return True

    return False
开发者ID:GNOME,项目名称:pyclutter,代码行数:30,代码来源:actor-model.py

示例4: blink

    def blink(blinking_element, timeout_start, overall_duration, freq):
        """
        Make the given element blinking.

        :param blinking_element: any :class:`Scannable` instance.
        :param timeout_start: current timestamp, helps calculating
        when the animation should be over.
        :param overall_duration: total duration of the blinking animation.
        :param freq: frequency of blinking.
        """
        hilitten = False

        def switch_hilite():
            nonlocal hilitten

            when_to_exit = timeout_start + (overall_duration
                                            - 2*freq)/1000
            if time.time() > when_to_exit:
                if hasattr(blinking_element, "disable_lag_hilite"):
                    blinking_element.disable_lag_hilite()
                return False
            else:
                if hilitten:
                    if hasattr(blinking_element, "disable_lag_hilite"):
                        blinking_element.disable_lag_hilite()
                        hilitten = False
                else:
                    if hasattr(blinking_element, "enable_lag_hilite"):
                        blinking_element.enable_lag_hilite()
                        hilitten = True
                return True
        Clutter.threads_add_timeout(0, freq, switch_hilite)
开发者ID:bjura,项目名称:pisak,代码行数:32,代码来源:scanning.py

示例5: run

 def run(self, block):
     self.idx = 0
     self.items = block.get_children()
     self.limit = len(self.items)
     Clutter.threads_add_timeout(0, self.pace, self._on_timeout, None)
     self.is_running = True
     self._on_timeout(None)
开发者ID:bjura,项目名称:SwitchArtist,代码行数:7,代码来源:main.py

示例6: __init__

    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
开发者ID:elianerpereira,项目名称:gtg-1,代码行数:28,代码来源:geolocalized_tasks.py

示例7: button_press_handler

	def button_press_handler(self, widget, event):
		print(event)
		if event.button == 1:
			self.dash.show(self, event.time)
			self.dash.window.focus(event.time)
		elif event.button == 3:
			Clutter.main_quit()
开发者ID:gschwind,项目名称:page-launcher,代码行数:7,代码来源:main.py

示例8: start

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

示例9: __init__

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

示例10: do_button_press_event

 def do_button_press_event (self, actor, event):
     if event.button == 1:
         self._is_pressed = True
         Clutter.grab_pointer(self)
         return True
     else:
         return False
开发者ID:CodeforBirmingham,项目名称:subte,代码行数:7,代码来源:shapes.py

示例11: main

def main(args):
    Gst.init()
    record_view = RecordView()

    if args.interactive:
        gui_thread = Thread(target=record_view.show_and_run)
        gui_thread.daemon = True
        gui_thread.start()
    else:
        record_view.show()

    while record_view.video_view is None:
        time.sleep(.1)
        print 'waiting for GUI'

    view = record_view.video_view

    def add_svg(view, svg_path):
        actor = SvgGroup.from_path(svg_path)
        view.stage.add_actor(actor)
        actor.add_constraint(Clutter.BindConstraint
                             .new(view.stage, Clutter.BindCoordinate.SIZE, 0))

    if args.svg_path is not None:
        Clutter.threads_add_idle(GLib.PRIORITY_DEFAULT, add_svg, view,
                                 args.svg_path)

    if args.interactive:
        raw_input()
    else:
        record_view.show_and_run()

    return record_view
开发者ID:cfobel,项目名称:clutter-webcam-viewer,代码行数:33,代码来源:__main__.py

示例12: _do_run_app

 def _do_run_app(self, app_exec):
     cmd = ["python3", app_exec]
     cmd.extend(sys.argv[1:])
     self.current_app = subprocess.Popen(cmd)
     self.current_app.wait()
     Clutter.threads_add_idle(0, self.maximize_panel, None)
     self.current_app = None
开发者ID:bjura,项目名称:SwitchDJ,代码行数:7,代码来源:app_manager.py

示例13: __init__

    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()
开发者ID:BrainTech,项目名称:pisak,代码行数:32,代码来源:application.py

示例14: __init__

    def __init__(self):
        self.stage = Clutter.Stage()
        self.stage.set_title('Clutter example')
        self.stage.set_background_color(Clutter.color_from_string('#BBB')[1])
        self.stage.set_size(300.0, 300.0)

        self.actor = Clutter.Actor()
        self.actor.set_background_color(Clutter.color_from_string('#DA0060')[1])
        self.actor.set_position(75.0, 75.0)
        self.actor.set_size(150.0, 150.0)
        self.actor.set_pivot_point(0.5, 0.5)

        self.rotation = Clutter.PropertyTransition(property_name='rotation-angle-z')
        self.rotation.set_animatable(self.actor)
        self.rotation.set_duration(5000)
        self.rotation.set_from(0.0)
        self.rotation.set_to(360.0)
        self.rotation.set_repeat_count(-1)
        self.rotation.start()

        text = Clutter.Text.new_full('Arial Black 12', 'Click me!', Clutter.color_from_string('black')[1])
        self.actor.add_child(text)

        self.stage.add_child(self.actor)
        self.stage.show()
        self.actor.set_reactive(True)

        self.stage.set_user_resizable(True)
        self.actor.connect('button-press-event', self.color_actor)
        self.stage.connect('key-press-event', self.on_key_press)
        self.stage.connect('destroy', lambda *_: Clutter.main_quit())
开发者ID:vindolin,项目名称:IPython-Clutter-GUI-Integration,代码行数:31,代码来源:cluttergui.py

示例15: run

 def run(self):
     """
     Run automatic slideshow. Turn on the fullscreen mode if the
     corresponding property is setted to True.
     """
     if self.slideshow_on_fullscreen:
         self.fullscreen_on = True
         self.stage = self.get_stage()
         self.cover_frame = Clutter.Actor()
         self.cover_frame.set_size(unit.size_pix[0], unit.size_pix[1])
         self.slide.remove_transition("x")
         self.remove_child(self.slide)
         self.cover_frame.add_child(self.slide)
         self.slide.set_x(0)
         cover_frame_color = Clutter.Color.new(0, 0, 0, 255)
         self.cover_frame.set_background_color(cover_frame_color)
         if (self.cached_slide_width is None and
                 self.cached_slide_height is None):
             self.cached_slide_width, self.cached_slide_height = \
                 self.slide.get_size()
         self.slide.set_size(unit.size_pix[0], unit.size_pix[1])
         self.stage.add_child(self.cover_frame)
     self.slideshow_on = True
     Clutter.threads_add_timeout(0, self.idle_duration,
                                     lambda _: self.slideshow_timeout(),
                                     None)
开发者ID:karolaug,项目名称:pisak,代码行数:26,代码来源:widgets.py


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