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


Python Clutter.threads_add_timeout方法代码示例

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


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

示例1: run

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 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,代码行数:9,代码来源:main.py

示例2: clutter

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
    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,代码行数:36,代码来源:smil.py

示例3: load_popup

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
    def load_popup(self, message, unwind=None, unwind_data=None,
                   container=None, timeout=5000):
        """
        Load a pop-up view with some message displayed and then, after a
        given amount of time automatically load some another view or
        perform some operation.

        :param message: message to be displayed on the screen.
        :param unwind: name of a view that should be loaded after
        the `timeout` expires or callable that should be called then or None.
        :param unwind_data: data to be passed to an unwind handler or None.
        :param container: container that popup should be added to or None,
        if None then it will be displayed as a standard standalone view.
        :param timeout: time after which the `unwind`
        will be executed automatically, in miliseconds, default is 1 second, if -1 then
        the `unwind` to will not be executed at all.

        :return: None.
        """
        if timeout >= 0 and unwind is not None:
            if callable(unwind):
                handler = (lambda *_: unwind(unwind_data)) if \
                          unwind_data is not None else lambda *_: unwind()
            else:
                handler = lambda *_: self.load_view(unwind, unwind_data)

            Clutter.threads_add_timeout(0, timeout, handler)

        if container:
            self._display_popup_widget(container, message)
        else:
            self.load_view("popup", {"message": message})
开发者ID:Sasza,项目名称:pisak,代码行数:34,代码来源:window.py

示例4: _on_lag

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
    def _on_lag(self, lag_type, element_to_hilite, lag_duration):
        """
        Stops ('lags') the scanning proccess for the given amount of time
        and performes all the previously ordered actions, i.e. highlights
        the current element. In the end schedules an adequate closure.

        :param lag_type: type of lag to be performed. Currently there are
        only two of them: 'start_up' that can happen before the scanning
        proccess starts and 'select', after selection of an element.
        :param element_to_hilite: element that has scanning focus during the
        lag and that should be highlighted.
        :param lag_duration: duration of the lag in miliseconds.
        """
        if self.lag_hilite_mode == "blink":
            timeout_start = time.time()
            self.blink(element_to_hilite, timeout_start, lag_duration, 
                       self.blinking_freq)
        elif self.lag_hilite_mode == "still":
            if hasattr(element_to_hilite, "enable_lag_hilite"):
                element_to_hilite.enable_lag_hilite()
        if lag_type == "start_up":
            closure = self._do_start
            param = None
        elif lag_type == "select":
            closure = self._do_select
            param = element_to_hilite
        Clutter.threads_add_timeout(0, lag_duration, closure, param)
开发者ID:bjura,项目名称:SwitchDJ,代码行数:29,代码来源:scanning.py

示例5: blink

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
    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,代码行数:34,代码来源:scanning.py

示例6: run

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 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,代码行数:28,代码来源:widgets.py

示例7: run_automatic

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 def run_automatic(self):
     """
     Start automatic page flipping.
     """
     if self._page_count > 1:
         self.is_running = True
         Clutter.threads_add_timeout(0, self.idle_duration,
                                     self._automatic_timeout, None)
开发者ID:BrainTech,项目名称:pisak,代码行数:10,代码来源:pager.py

示例8: on_new_data

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
    def on_new_data(self, data):
        """
        Receives new raw data, parses them and schedules
        calling the main thread callback.

        :param data: raw data.
        """
        x, y = self.parse_coords(data)
        Clutter.threads_add_timeout(-100, 20, self.on_new_coords, x, y)
开发者ID:BrainTech,项目名称:pisak,代码行数:11,代码来源:cursor.py

示例9: __init__

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 def __init__(self):
     super().__init__()
     self.dynamic_canvas = DynamicCanvas()
     self.dynamic_canvas.set_x_expand(True)
     self.dynamic_canvas.set_y_expand(True)
     self.add_child(self.dynamic_canvas)
     self.layout = Clutter.BoxLayout()
     self.set_layout_manager(self.layout)
     Clutter.threads_add_timeout(0, 33, self._render, None)
开发者ID:karolaug,项目名称:pisak,代码行数:11,代码来源:canvas_app.py

示例10: _do_start

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 def _do_start(self, source=None):
     self.index = None
     self._cycle_count = 0
     self._expose_next(enforced=True)
     self.timeout_token = object()
     if hasattr(self.group, "disable_lag_hilite"):
         self.group.disable_lag_hilite()
     Clutter.threads_add_timeout(0, self.interval, self.cycle_timeout,
                                 self.timeout_token)
开发者ID:bjura,项目名称:SwitchDJ,代码行数:11,代码来源:scanning.py

示例11: _schedule_sending_data

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
    def _schedule_sending_data(self, direction):
        """
        Schedule sending the data as soon as it is available.
        Data should be loaded in a background.

        :param direction: -1 or 1, that is whether data should be
        sent from backward or forward.
        """
        Clutter.threads_add_timeout(0, 0.1, self._send_data, direction)
开发者ID:Sasza,项目名称:pisak,代码行数:11,代码来源:pager.py

示例12: start

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 def start(self):
     self.compute_sequence()
     if len(self._subgroups) == 0:
         # stop immediately
         self.index = None
         Clutter.threads_add_timeout(0, self.interval, self.cycle_timeout, self.timeout_token)
     else:
         self.index = None
         self._cycle_count = 0
         self._expose_next()
         self.timeout_token = object()
         Clutter.threads_add_timeout(0, self.interval, self.cycle_timeout, self.timeout_token)
开发者ID:karolaug,项目名称:pisak,代码行数:14,代码来源:scanning.py

示例13: start_cycle

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 def start_cycle(self):
     """
     Reimplementation of the generic scanning group method.
     Flips the target pager page and schedules the start
     of the page scanning cycle.
     """
     if self._target is not None:
         self._target.next_page()
         Clutter.threads_add_timeout(0, self._target.transition_duration,
                                     lambda *_: self._target.scan_page(),
                                     None)
     else:
         _LOG.warning("PageFlip without target: " + self.get_id())
开发者ID:Sasza,项目名称:pisak,代码行数:15,代码来源:pager.py

示例14: __init__

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [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 ()
开发者ID:lubosz,项目名称:gst-gl-tests,代码行数:51,代码来源:clutter-canvas.py

示例15: start

# 需要导入模块: from gi.repository import Clutter [as 别名]
# 或者: from gi.repository.Clutter import threads_add_timeout [as 别名]
 def start(self):
     """
     Method invoked by a group which wants its scanning cycle
     to be started.
     """
     self.compute_sequence()
     if len(self._subgroups) == 0:
         # stop immediately
         self.index = None
         Clutter.threads_add_timeout(0, self.interval, self.cycle_timeout,
                                     self.timeout_token)
     else:
         if self.start_up_lag > 0:
             self._on_lag("start_up", self.group, self.start_up_lag)
         else:
             self._do_start()
开发者ID:bjura,项目名称:SwitchDJ,代码行数:18,代码来源:scanning.py


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