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


Python Clock.create_trigger方法代码示例

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


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

示例1: editor_popup

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def editor_popup(title, content, answerCallback, size_hint=(None, None), size=(dp(500), dp(220)), hide_ok=False, auto_dismiss_time=None):

    def auto_dismiss(*args):
        popup.dismiss()

    def on_title(instance, title):
        popup.title = title

    content.bind(on_title=on_title)
    content = EditorPopup(content=content, hide_ok=hide_ok)
    content.bind(on_answer=answerCallback)
    popup = Popup(title=title,
                    content=content,
                    size=size, size_hint=size_hint,
                    auto_dismiss=True,
                  title_size=sp(18))
    popup.open()

    if auto_dismiss_time:
        Clock.create_trigger(auto_dismiss, auto_dismiss_time)()

    return popup 
开发者ID:autosportlabs,项目名称:RaceCapture_App,代码行数:24,代码来源:alertview.py

示例2: schedule_once

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def schedule_once(self, callback, timeout=0):
        '''Schedule an event in <timeout> seconds. If <timeout> is unspecified
        or 0, the callback will be called after the next frame is rendered.

        :returns:

            A :class:`ClockEvent` instance. As opposed to
            :meth:`create_trigger` which only creates the trigger event, this
            method also schedules it.

        .. versionchanged:: 1.0.5
            If the timeout is -1, the callback will be called before the next
            frame (at :meth:`tick_draw`).
        '''
        if not callable(callback):
            raise ValueError('callback must be a callable, got %s' % callback)
        event = ClockEvent(
            self, False, callback, timeout, self._last_tick, _hash(callback),
            True)
        return event 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:22,代码来源:clock.py

示例3: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        self._refresh_flags = dict(self._refresh_flags)
        self._refresh_trigger = Clock.create_trigger(self.refresh_views, -1)

        if self._layout_manager is None:
            self.layout_manager = LinearRecycleLayoutManager()
        if self._adapter is None:
            self.adapter = RecycleAdapter()
        super(RecycleView, self).__init__(**kwargs)
        if self._container is None:
            self.container = RecycleViewLayout(size_hint=(None, None))

        fbind = self.fbind if _kivy_1_9_1 else self.fast_bind
        fbind('size', self.ask_refresh_from_data, extent='data_size')
        fbind('scroll_x', self.ask_refresh_viewport)
        fbind('scroll_y', self.ask_refresh_viewport)
        self._refresh_trigger() 
开发者ID:kivy-garden,项目名称:garden.recycleview,代码行数:19,代码来源:recycleview.py

示例4: create_trigger

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def create_trigger(self, callback, timeout=0):
        '''Create a Trigger event. Check module documentation for more
        information.

        :returns:

            A :class:`ClockEvent` instance. To schedule the callback of this
            instance, you can call it.

        .. versionadded:: 1.0.5
        '''
        ev = ClockEvent(self, False, callback, timeout, 0, _hash(callback))
        ev.release()
        return ev 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:16,代码来源:clock.py

示例5: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        super(MainWindow, self).__init__(**kwargs)
        self.app = App.get_running_app()
        self._trigger = Clock.create_trigger(self.async_get_display_data)
        self._q = queue.Queue()
        self.config = self.app.config
        self.last_path = self.config.get('General', 'last_gcode_path')
        self.paused = False
        self.last_line = 0

        # print('font size: {}'.format(self.ids.log_window.font_size))
        # Clock.schedule_once(self.my_callback, 2) # hack to overcome the page layout not laying out initially 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:14,代码来源:main.py

示例6: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        super(Graph, self).__init__(**kwargs)

        with self.canvas:
            self._fbo = Fbo(size=self.size, with_stencilbuffer=self._with_stencilbuffer)

        with self._fbo:
            self._background_color = Color(*self.background_color)
            self._background_rect = Rectangle(size=self.size)
            self._mesh_ticks_color = Color(*self.tick_color)
            self._mesh_ticks = Mesh(mode='lines')
            self._mesh_rect_color = Color(*self.border_color)
            self._mesh_rect = Mesh(mode='line_strip')

        with self.canvas:
            Color(1, 1, 1)
            self._fbo_rect = Rectangle(size=self.size, texture=self._fbo.texture)

        mesh = self._mesh_rect
        mesh.vertices = [0] * (5 * 4)
        mesh.indices = range(5)

        self._plot_area = StencilView()
        self.add_widget(self._plot_area)

        t = self._trigger = Clock.create_trigger(self._redraw_all)
        ts = self._trigger_size = Clock.create_trigger(self._redraw_size)
        tc = self._trigger_color = Clock.create_trigger(self._update_colors)

        self.bind(center=ts, padding=ts, precision=ts, plots=ts, x_grid=ts,
                  y_grid=ts, draw_border=ts)
        self.bind(xmin=t, xmax=t, xlog=t, x_ticks_major=t, x_ticks_minor=t,
                  xlabel=t, x_grid_label=t, ymin=t, ymax=t, ylog=t,
                  y_ticks_major=t, y_ticks_minor=t, ylabel=t, y_grid_label=t,
                  font_size=t, label_options=t, x_ticks_angle=t)
        self.bind(tick_color=tc, background_color=tc, border_color=tc)
        self._trigger() 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:39,代码来源:__init__.py

示例7: _trigger_update_clr

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def _trigger_update_clr(self, mode, clr_idx, text):
        self._upd_clr_list = mode, clr_idx, text
        ev = self._update_clr_ev
        if ev is None:
            ev = self._update_clr_ev = Clock.create_trigger(self._update_clr)
        ev() 
开发者ID:snuq,项目名称:Snu-Photo-Manager,代码行数:8,代码来源:colorpickercustom.py

示例8: _trigger_update_hex

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def _trigger_update_hex(self, text):
        self._upd_hex_list = text
        ev = self._update_hex_ev
        if ev is None:
            ev = self._update_hex_ev = Clock.create_trigger(self._update_hex)
        ev() 
开发者ID:snuq,项目名称:Snu-Photo-Manager,代码行数:8,代码来源:colorpickercustom.py

示例9: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, url, on_success=None, on_redirect=None,
                 on_failure=None, on_error=None, on_progress=None,
                 req_body=None, req_headers=None, chunk_size=8192,
                 timeout=None, method=None, decode=True, debug=False,
                 file_path=None):
        super(UrlRequest, self).__init__()
        self._queue = deque()
        self._trigger_result = Clock.create_trigger(self._dispatch_result, 0)
        self.daemon = True
        self.on_success = WeakMethod(on_success) if on_success else None
        self.on_redirect = WeakMethod(on_redirect) if on_redirect else None
        self.on_failure = WeakMethod(on_failure) if on_failure else None
        self.on_error = WeakMethod(on_error) if on_error else None
        self.on_progress = WeakMethod(on_progress) if on_progress else None
        self.decode = decode
        self.file_path = file_path
        self._debug = debug
        self._result = None
        self._error = None
        self._is_finished = False
        self._resp_status = None
        self._resp_headers = None
        self._resp_length = -1
        self._chunk_size = chunk_size
        self._timeout = timeout
        self._method = method

        #: Url of the request
        self.url = url

        #: Request body passed in __init__
        self.req_body = req_body

        #: Request headers passed in __init__
        self.req_headers = req_headers

        # save our request to prevent GC
        g_requests.append(self)

        self.start() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:42,代码来源:urlrequest.py

示例10: schedule_interval

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def schedule_interval(self, callback, timeout):
        '''Schedule an event to be called every <timeout> seconds.

        :returns:

            A :class:`ClockEvent` instance. As opposed to
            :meth:`create_trigger` which only creates the trigger event, this
            method also schedules it.
        '''
        if not callable(callback):
            raise ValueError('callback must be a callable, got %s' % callback)
        event = ClockEvent(
            self, True, callback, timeout, self._last_tick, _hash(callback),
            True)
        return event 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:17,代码来源:clock.py

示例11: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        self._trigger_position_visible_slides = Clock.create_trigger(
            self._position_visible_slides, -1)
        super(Carousel, self).__init__(**kwargs)
        self._skip_slide = None 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:7,代码来源:carousel.py

示例12: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        self._trigger_load = Clock.create_trigger(self._load_from_text, -1)
        self._parser = rst.Parser()
        self._settings = frontend.OptionParser(
            components=(rst.Parser, )).get_default_values()
        super(RstDocument, self).__init__(**kwargs) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:8,代码来源:rst.py

示例13: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        self._trigger_layout = Clock.create_trigger(self._do_layout, -1)
        super(TreeView, self).__init__(**kwargs)
        tvlabel = TreeViewLabel(text='Root', is_open=True, level=0)
        for key, value in self.root_options.items():
            setattr(tvlabel, key, value)
        self._root = self.add_node(tvlabel, None)
        self.bind(
            pos=self._trigger_layout,
            size=self._trigger_layout,
            indent_level=self._trigger_layout,
            indent_start=self._trigger_layout)
        self._trigger_layout() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:15,代码来源:treeview.py

示例14: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        self._trigger_title = Clock.create_trigger(self._update_title, -1)
        self._anim_collapse = None
        super(AccordionItem, self).__init__(**kwargs)
        self.bind(title=self._trigger_title,
                  title_template=self._trigger_title,
                  title_args=self._trigger_title)
        self._trigger_title() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:10,代码来源:accordion.py

示例15: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import create_trigger [as 别名]
def __init__(self, **kwargs):
        if self.__class__ == Layout:
            raise Exception('The Layout class cannot be used.')
        self._trigger_layout = Clock.create_trigger(self.do_layout, -1)
        super(Layout, self).__init__(**kwargs) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:7,代码来源:layout.py


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