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


Python Clock.schedule_once方法代码示例

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


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

示例1: insert

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def insert(self, before):
        # now see which line is selected and insert before or after that
        i = self.rv.selected_idx
        if i < 0:
            # print("No line is selected")
            return
        if not before:
            # insert after selected line
            i = i + 1

        self.rv.data.insert(i, {'value': "ENTER TEXT", 'index': i, 'ro': False})
        self.max_cnt += 1
        # we need to renumber all following lines
        for j in range(i + 1, self.max_cnt):
            self.rv.data[j]['index'] = j

        self.rv.refresh_from_data()
        Clock.schedule_once(partial(self._refocus_it, i), 0.3) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:20,代码来源:text_editor.py

示例2: change_scroll_y

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def change_scroll_y(self, txt, scroll):
        if self._do_cursor_scroll:

            lines_lenght = len(txt._lines)
            line_pos = txt.cursor_row +1

            norm_y = float(line_pos) / lines_lenght
            scroll.scroll_y  = abs(norm_y-1)
            if line_pos == 1:
                scroll.scroll_y  = 1

        # scroll scroll numbers
        line_num =  txt.cursor_row + 1
        children = self.ids.numbering.children[::-1]
        if children:
            child = children[line_num-1]
            self.ids.number_scroll.scroll_to(child, dp(5))

            Clock.schedule_once(lambda dt: setattr(child, 'state', 'down'))
            def toggle(chd):
                if chd!=child:
                    chd.state='normal'
            map(lambda child: toggle, ToggleButtonBehavior.get_widgets(child.group)) 
开发者ID:mahart-studio,项目名称:kivystudio,代码行数:25,代码来源:__init__.py

示例3: add_widget

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def add_widget(self, widget, tab_type=''):
        if len(self.children) > 1:
            if tab_type =='code' or tab_type =='new_file' or tab_type=='unsupported':
                tab = TabToggleButton(text=os.path.split(widget.filename)[1],
                                    filename=widget.filename)
                widget.tab = tab
                widget.tab_type = tab_type
                self.code_manager.add_widget(widget, widget.filename, tab_type=tab_type)

            elif tab_type=='welcome':
                self.code_manager.add_widget(widget, 'kivystudiowelcome', tab_type=tab_type)
                tab = TabToggleButton(text='Welcome',filename='kivystudiowelcome')

            tab.bind(state=self.change_screen)
            self.tab_manager.add_widget(tab)
            Clock.schedule_once(lambda dt: setattr(tab, 'state', 'down'))

        else:
            super(CodePlace, self).add_widget(widget) 
开发者ID:mahart-studio,项目名称:kivystudio,代码行数:21,代码来源:codeplace.py

示例4: initialize

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def initialize(self):
        
        self.motorSpacingError.bind(value=self.onSliderChange)
        self.motorVerticalError.bind(value=self.onSliderChange)
        self.sledMountSpacingError.bind(value=self.onSliderChange)
        self.vertBitDist.bind(value=self.onSliderChange)
        self.leftChainOffset.bind(value=self.onSliderChange)
        self.rightChainOffset.bind(value=self.onSliderChange)
        self.rotationRadiusOffset.bind(value=self.onSliderChange)
        self.chainSagCorrectionOffset.bind(value=self.onSliderChange)

        self.vertCGDist.bind(value=self.onSliderChange)
        self.gridSize.bind(value=self.onSliderChange)
        
        Clock.schedule_once(self.moveToCenter, 3)
        
        #start with our current kinematics type
        self.kinematicsSelect.text = self.data.config.get('Advanced Settings', 'kinematicsType')
          
        self.recompute() 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:22,代码来源:simulationCanvas.py

示例5: open_menu

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def open_menu(self, *args):
        
        self.clear_widgets()
        for i in self.choices:
            kwargs = copy(self.item_args)
            kwargs.update(i)
            ml = self.item_cls(**kwargs)
            try:
                if ml.text == 'Position Text Placeholder':
                    ml.text = '[color=3333ff]X: ' + str('%.3f'%(self.xPosition)) + 'mm\nY: ' + str('%.3f'%(self.yPosition)) + 'mm [/color]'
                if ml.text == '[color=3333ff]Move Here[/color]':
                    ml.callback = partial(self.parent.parent.parent.moveToPos, self.xPosition, self.yPosition)
                if ml.text == '[color=3333ff]Mark Here[/color]':
                    ml.callback = partial(self.parent.parent.parent.createMark, self.xPosition, self.yPosition)
                if ml.text == '[color=3333ff]Set Home[/color]':
                    ml.callback = partial(self.parent.parent.parent.setHome, self.xPosition, self.yPosition)
            except:
                print "unable to link circular menu functions"
            self.animation.start(ml)
            self.add_widget(ml)
            
        
        Clock.schedule_once(self.dismiss, self.close_After_Timeout) #close the menu if not used for close_After_Timeout seconds 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:25,代码来源:modernMenu.py

示例6: callBackMechanism

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def callBackMechanism(self, callback) :
        '''
        
        Call the loadNextLine function periodically in a non-blocking way to
        update the gcode.
        
        '''
        
        with self.scatterObject.canvas:
            self.line = Line(points = (), width = 1, group = 'gcode')
        
        #Draw numberOfTimesToCall lines on the canvas
        numberOfTimesToCall = 500
        for _ in range(numberOfTimesToCall):
            self.loadNextLine()
        
        #Repeat until end of file
        if self.lineNumber < min(len(self.data.gcode),self.maxNumberOfLinesToRead):
            Clock.schedule_once(self.callBackMechanism) 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:21,代码来源:gcodeCanvas.py

示例7: on_enter

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def on_enter(self):

        if not self.running:

            # The screen hasn't been run before so let's tell the user
            # that we need to get the photos
            self.loading = PhotoLoading(name="loading")
            self.photoscreen.add_widget(self.loading)
            self.photoscreen.current = "loading"

            # Retrieve photos
            Clock.schedule_once(self.getPhotos, 0.5)

        else:
            # We've been here before so just show the photos
            self.timer = Clock.schedule_interval(self.showPhoto,
                                                 self.photoduration) 
开发者ID:elParaguayo,项目名称:RPi-InfoScreen-Kivy,代码行数:19,代码来源:screen.py

示例8: _load_source

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def _load_source(self, *_):
        self.set_angle()
        source = self.source
        photo = self.photoinfo
        self.nocache = True
        if not source and not photo:
            if self._coreimage is not None:
                self._coreimage.unbind(on_texture=self._on_tex_change)
            self.texture = None
            self._coreimage = None
        elif not photo:
            Clock.schedule_once(lambda *dt: self._load_source(), .25)
        else:
            ThumbLoader.max_upload_per_frame = 50
            ThumbLoader.num_workers = 4
            ThumbLoader.loading_image = 'data/loadingthumbnail.png'
            self._coreimage = image = ThumbLoader.image(source, load_callback=self.load_thumbnail, nocache=self.nocache, mipmap=self.mipmap, anim_delay=self.anim_delay)
            image.bind(on_load=self._on_source_load)
            image.bind(on_texture=self._on_tex_change)
            self.texture = image.texture 
开发者ID:snuq,项目名称:Snu-Photo-Manager,代码行数:22,代码来源:generalelements.py

示例9: program_run

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def program_run(self, index, button):
        """Loads the currently viewed photo in an external program using an external program preset.
        Argument:
            index: Integer, index of the preset to use.
            button: Widget, the button that called this function.
        """

        name, command, argument = self.programs[index]
        if os.path.isfile(command):
            button.disabled = True  # Disable the button so the user knows something is happening
            photo_info = self.database_exists(self.fullpath)
            if photo_info:
                photo_file = os.path.join(photo_info[2], photo_info[0])
                abs_photo = os.path.abspath(photo_file)
                argument_replace = argument.replace('%i', '"'+abs_photo+'"')
                argument_replace = argument_replace.replace('%%', '%')

                run_command = command+' '+argument_replace
                Clock.schedule_once(lambda *dt: self.program_run_finish(run_command, photo_info, button))
        else:
            self.popup_message(text='Not A Valid Program') 
开发者ID:snuq,项目名称:Snu-Photo-Manager,代码行数:23,代码来源:main.py

示例10: rescale_interface

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def rescale_interface(self, *_, force=False):
        if self.last_width == 0:
            first_change = True
        else:
            first_change = False
        if Window.width != self.last_width or force:
            self.popup_x = int(Window.width * .75)
            self.last_width = Window.width
            if first_change:
                Clock.schedule_once(lambda x: self.rescale_interface(force=True))
                return
            if desktop:
                button_multiplier = 1
            else:
                button_multiplier = 2
            self.button_scale = int((Window.height / interface_multiplier) * int(self.config.get("Settings", "buttonsize")) / 100) * button_multiplier
            self.padding = self.button_scale / 4
            self.text_scale = int((self.button_scale / 3) * int(self.config.get("Settings", "textsize")) / 100)
            if self.standalone:
                Clock.schedule_once(lambda x: self.show_album())
            else:
                Clock.schedule_once(self.show_database) 
开发者ID:snuq,项目名称:Snu-Photo-Manager,代码行数:24,代码来源:main.py

示例11: _refocus_it

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def _refocus_it(self, i, *largs):
        self.rv.view_adapter.get_visible_view(i).ti.focus = True
        Clock.schedule_once(partial(self._select_it, i)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:5,代码来源:text_editor.py

示例12: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [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

示例13: _refocus_text_input

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def _refocus_text_input(self, *args):
        Clock.schedule_once(self._refocus_it) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:4,代码来源:main.py

示例14: __init__

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def __init__(self, **kwargs):
        super(MacrosWidget, self).__init__(**kwargs)
        self.app = App.get_running_app()
        # we do this so the kv defined buttons are loaded first
        Clock.schedule_once(self._load_user_buttons)
        self.toggle_buttons = {} 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:8,代码来源:macros_widget.py

示例15: show

# 需要导入模块: from kivy.clock import Clock [as 别名]
# 或者: from kivy.clock.Clock import schedule_once [as 别名]
def show(self, desc):
        self.text = desc
        anim = Animation(y = metrics.dp(50), t = 'in_out_expo')
        anim.start(self)
        Clock.schedule_once(self.exit, 5) 
开发者ID:anselm94,项目名称:segreto-3,代码行数:7,代码来源:widget.py


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