Python kivy.clock.Clock 模块,schedule_interval() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用kivy.clock.Clock.schedule_interval()

项目:PyWallet    作者:AndreMiras    | 项目源码 | 文件源码
def run_test(self, app, *args):
        Clock.schedule_interval(self.pause, 0.000001)
        self.helper_setup(app)
        self.helper_test_empty_account(app)
        self.helper_test_back_home_empty_account(app)
        self.helper_test_create_first_account(app)
        self.helper_test_create_account_form(app)
        self.helper_test_on_send_click(app)
        self.helper_test_address_alias(app)
        self.helper_test_delete_account(app)
        self.helper_test_delete_account_none_selected(app)
        self.helper_test_delete_account_twice(app)
        self.helper_test_dismiss_dialog_twice(app)
        self.helper_test_controller_fetch_balance(app)
        self.helper_test_delete_last_account(app)
        # Comment out if you are editing the test, it'll leave the
        # Window opened.
        app.stop()

    # same named function as the filename(!)
项目:pypilot    作者:pypilot    | 项目源码 | 文件源码
def build(self):
        self.client = False
        self.connect(3)
        Clock.schedule_interval(self.connect, 3)
        Clock.schedule_interval(self.update, .1)

        self.enabled = False
        self.mode = 'compass'
        self.heading_command = 0
        self.heading = 0

        self._anim = None

        self.texture = Image(source='compass.png').texture
        self.control = AutopilotControl()
        return self.control
项目:android-notification-buttons    作者:Bakterija    | 项目源码 | 文件源码
def build(self):
        self.root = NotificationDemo(self)
        if platform == 'android':
            try:
                self.service = autoclass(
                    'org.test.npexample.ServiceMyservice')
                mActivity = autoclass(
                    'org.kivy.android.PythonActivity').mActivity
                argument = ''
                self.service.start(mActivity, argument)
            except:
                self.service = AndroidService(
                    'Sevice example', 'service is running')
                self.service.start('Hello From Service')
        else:
            Window.system_size = cm(7), cm(12)

        self.client.on_connect = self.on_connect
        self.client.on_disconnect = self.on_disconnect
        Clock.schedule_once(self.try_connecting, 0)
        Clock.schedule_interval(self.handle_msg, 0.1)
        # def skipp(*a):
        #     self.root.ids.sm.current = 'main'
        # Clock.schedule_once(skipp, 0.5)
        return self.root
项目:MeetNet    作者:dimgold    | 项目源码 | 文件源码
def __init__(self,group,user):
        super(Showmap,self).__init__()

        self.user = user
        self.group = group
        self.usersloc = {} #user location for future zoom-in
        self.grouplab.text = 'Group '+str(group)
        self.gpar, self.mlist = self.load_points() # load map parameters
        self.mapview.lat = float(self.gpar['clat'])
        self.mapview.lon = float(self.gpar['clon'])
        self.lat = float(self.gpar['clat'])
        self.lon = float(self.gpar['clon'])
        self.mapview.zoom = int(self.gpar['zoom'])
        self.load_msg() # load message
        self.user_values = ['Points Center']            
        for i in self.mlist:
            self.mapview.add_marker(MMarker(i,self.user,False))
            self.user_values.append(i['name'])
            self.usersloc[i['name']]=(float(i['lat']),float(i['lon']))

        Clock.schedule_interval(self.callback, mapdelay) #refreshing data callback
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def load_audio_file(self, path):
        from kivy.core.audio import SoundLoader

        sound = SoundLoader.load(path)
        self._sound = sound

        if sound:
            update_bar_schedule = Clock.schedule_interval(self.update_bar, 1)
            self._update_bar_schedule = update_bar_schedule

            self.ids.p_bar.max = sound.length
            sound.volume = self.ids.volume_slider.value
            sound.play()
        else:
            print('Cannot play the file %s.' % path)
            error_msg = 'Cannot play the file %s.' % (path) if path else 'No file selected.'
            popup = Popup(title='Audio Error.',
                    content=Label(text= error_msg),
                    size_hint = (0.3, 0.3))
            popup.open()
项目:KivyNBT    作者:Kovak    | 项目源码 | 文件源码
def __init__(self, data_dir, name, do_date=False, do_hour=False, **kwargs):
        super(DBInterface, self).__init__(**kwargs)

        self.ensure_dir(data_dir)
        if do_date:
            if do_hour:
                date = self.convert_time_to_json_ymdh(self.get_time())
            else:
                date = self.convert_time_to_json_ymd(self.get_time())
            json_name = data_dir + name + '-' + date + '.json'
            reset_json_name = (
                data_dir + name + '-' + date + '-reset_timers.json')
        else:
            json_name = data_dir + name + '.json'
            reset_json_name = data_dir + name + '-reset_timers.json'
        self.data = data = JsonStore(json_name)
        self.reset_timers = reset_timers = JsonStore(reset_json_name)
        self.sync = Clock.create_trigger(self.trigger_sync)
        self.check_reset(0.)
        Clock.schedule_interval(self.check_reset, 60.)
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def filter_ok(self, *args):
        if self.loaded == 'Yes':
            self.selectedtypes = []
            for i in range(len(self._log_analyzer.supported_types)):
                if self.filter_rows[i].active:
                    self.selectedtypes += [
                        list(self._log_analyzer.supported_types)[i]]
            if not self.selectedtypes == []:
                self.data_view = [
                    x for x in self.data_view if x["TypeID"] in self.selectedtypes]
                self.SetUpGrid(self.data_view, len(self.data_view), 'init')
                Clock.unschedule(self.check_scroll_limit)
                Clock.schedule_interval(self.check_scroll_limit, 0.11)
            self.dismiss_filter_popup()
        else:
            self.dismiss_filter_popup()
项目:OpenTheDoor    作者:jalnanco    | 项目源码 | 文件源码
def build(self):
        global app
        app = self

        # background sound
        # start the background music
        # self.music = SoundLoader.load('sound/8bitattempt.ogg')
        # self.music.bind(on_stop=self.sound_replay)
        # self.music.play()

        # sound
        self.sound['swing'] = SoundLoader.load('sound/battle/swing.ogg')
        self.sound['coin'] = SoundLoader.load('sound/inventory/chainmail1.ogg')

        self.title = 'One RPG'
        self.game = TurnBattle()
        self.game.init()
        # self.game.load_enermy()
        # Clock.schedule_interval(self.game.update, 1.0 / 60.0)
        return self.game
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def third_screen(self):
        """
        Pull filament Screen:
            Display instructions to user -- Pull out filament
            Display button that will open fourth screen
        """
        # roboprinter.printer_instance._printer.jog('e', -130.00)
        c = Filament_Wizard_3_5(self.fourth_screen)
        back_destination = roboprinter.robo_screen()
        this_screen = self.sm._generate_backbutton_screen(name=self.name+'[2]', title=roboprinter.lang.pack['Filament_Wizard']['Title_25'], back_destination=back_destination, content=c)

        #end the event before starting it again
        if self.extrude_event != None:
            self.end_extrude_event()
        self.extrude_event = Clock.schedule_interval(self.retract, 1)


        # back_button deletes Second Screen, as back destination is first screen
        # second_screen = self.sm.get_screen(self.name+'[1]')
        # delete_second = partial(self.sm.remove_widget, second_screen)
        # this_screen.ids.back_button.bind(on_press=delete_second)
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def fifth_screen(self, *args):
        """
        Final screen / Confirm successful load:
            Extrude filament
            Display instruction to user -- Press okay when you see plastic extruding
            Display button that will move_to_main() AND stop extruding filament
        """
        if self.load_or_change == 'CHANGE':
            _title = roboprinter.lang.pack['Filament_Wizard']['Title_45']
            back_dest = self.name+'[3]'
        else:
            _title = roboprinter.lang.pack['Filament_Wizard']['Title_34']
            back_dest = self.name+'[3]'

        c = Filament_Wizard_5_5(self.end_wizard)
        back_destination = roboprinter.robo_screen()
        self.sm._generate_backbutton_screen(name=self.name+'[4]', title=_title, back_destination=back_destination, content=c)

        #end the event before starting it again
        if self.extrude_event != None:
            self.end_extrude_event()
        self.extrude_event = Clock.schedule_interval(self.extrude, 1)
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def __init__(self, keyboard_callback = None, default_text = '', name = 'keyboard_screen', title=lang.pack['Files']['Keyboard']['Default_Title'], back_destination=None,**kwargs):
        super(KeyboardInput, self).__init__(**kwargs)
        self.default_text = default_text
        self.back_destination = back_destination
        self.first_press = False
        if self.back_destination == None:
            self.back_destination = roboprinter.robo_screen()

        roboprinter.back_screen(name=name, 
                                title=title, 
                                back_destination=self.back_destination, 
                                content=self)
        self.current_screen = roboprinter.robo_screen()
        self._keyboard = None
        self._set_keyboard('keyboards/abc.json')

        if keyboard_callback != None:
            self.keyboard_callback = keyboard_callback

        self.keyboard_watch = Clock.schedule_interval(self.monitor_screen_change, 0.2)
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def copy_file(self, fsrc, fdst, progress_callback=None, complete_callback = None, length=16*1024, **kwargs):

        self.copied = 0
        self.file_size = 0
        self.length = length
        self.p_callback = progress_callback
        self.c_callback = complete_callback
        if not os.path.isfile(fsrc):
            Logger.info("Will not copy")
            return False

        else:
            self.file_size = float(os.path.getsize(fsrc))
        #make the new file
        self.src_obj = open(fsrc, 'rb')
        self.dst_obj = open(fdst, 'wb')
        #Do the copy as fast as possible without blocking the UI thread
        Clock.schedule_interval(self.copy_object, 0)
        return True

    #doing it this way with a clock object does not block the UI
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def __init__(self, selected_tool= "TOOL1" ,**kwargs):
        super(TemperatureControl, self).__init__(**kwargs)
        acceptable_toolheads = {"TOOL1": 'tool0',
                                "TOOL2": 'tool1',
                                "BED": 'bed',
                                "tool0": 'tool0',
                                "tool1": 'tool1',
                                "bed": 'bed'}

        if selected_tool in acceptable_toolheads:
            self.selected_tool = acceptable_toolheads[selected_tool]

        else:
            Logger.info("TOOL CANNOT BE SELECTED: " + selected_tool)
            self.selected_tool = 'tool0'
        Clock.schedule_interval(self.update, .1)
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def confirmation(self, action, language=None,lang_option = None, **kwargs):

        if action and language != None:
            self.old_language = lang.current_lang
            lang.reload_language(lang_option)
            roboprinter.printer_instance._settings.set(['Language'], lang_option)
            roboprinter.printer_instance._settings.save()

            layout = Language_Confirmation_Screen(language)

            title = lang.pack['Switch_Lang']['Confirmation']['Title'] + language
            name = 'confirm_language'
            back_destination = roboprinter.robo_screen()

            roboprinter.back_screen(
                name=name,
                title=title,
                back_destination=back_destination,
                content=layout
            )
            Clock.schedule_interval(self.Monitor_Screen, 0.2)

        else:
            self.select_language()
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def __init__(self, language, callback, lang_option):
        #temporarily switch to new language
        self.old_language = lang.current_lang
        self.switch_language(lang_option)

        self.title = lang.pack['Switch_Lang']['Choose']['Switch_to'] + language + lang.pack['Switch_Lang']['Choose']['Question']
        self.body_text = lang.pack['Switch_Lang']['Choose']['Are_You_Sure']
        self.option1_text = lang.pack['Switch_Lang']['Choose']['Yes_option']
        self.option2_text = lang.pack['Switch_Lang']['Choose']['No_option']
        self.option1_function = self.yes
        self.option2_function = self.no 

        self.callback = callback
        self.language = language
        self.lang_option = lang_option
        self.pressed_yes = False



        super(Switch_Language, self).__init__(self.title, self.body_text, self.option1_text, self.option2_text, self.option1_function, self.option2_function)
        Clock.schedule_interval(self.Monitor_Screen, 0.2)
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def generate_wifi_list_screen(self):
        self.wifi_grid = GridLayout(cols=1, padding=0, spacing=0)
        self.placeholder = WifiLoadingList()

        self.wifi_grid.add_widget(self.placeholder)



        self.rsm._generate_backbutton_screen(
            name=self.name,
            title=roboprinter.lang.pack['WiFi']['Select_Network'],
            back_destination=self.back_destination,
            content=self.wifi_grid,
            cta=self._refresh_wifi_list,
            icon='Icons/Manual_Control/refresh_icon.png')

        thread.start_new_thread(self._append_wifi_list, ())
        Clock.schedule_interval(self._wifi_callback, 1 / 30.)
        return
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def generate_connecting_screen(self, obj, *args):
        # remove keyboard from screen
        self.wifi_status = 'nothing'
        Window.release_all_keyboards()

        # wifi credentials
        if obj.id == 'encrypted':
            psk = obj.ids.password.text
        else:
            psk = ''
        ssid = obj.ssid
        self.wifi_data = {'ssid': ssid, 'psk': psk, 'force': True}

        # layout for connecting screen
        s = Screen(name=self.name+'[2]')
        c = WifiConnecting(ssid=ssid)
        s.add_widget(c)
        self.rsm.add_widget(s)
        self.rsm.current = s.name
        self.temp_screen = s

        thread.start_new_thread(self.connectWifi_thread, ())
        Clock.schedule_interval(self.connectWifi_callback, 1)
        #self.generate_confirmation_screen(s)
项目:SuperOcto    作者:mcecchi    | 项目源码 | 文件源码
def turn_off_splash(self, dt):
        temp1 = self.grab_target_and_actual('tool0')
        self.extruder_one_max_temp = temp1['target']
        self.extruder_one_temp = temp1['actual']

        temp2 = self.grab_target_and_actual('tool1')
        self.extruder_two_max_temp = temp2['target']
        self.extruder_two_temp = temp2['actual']

        bed = self.grab_target_and_actual('bed')
        self.bed_max_temp = bed['target']
        self.bed_temp = bed['actual']
        #turn off the splash screen
        if self.extruder_one_temp != 0 and self.startup == False:
            #Logger.info("Turning Off the Splash Screen!")
            self.detirmine_layout()

            #check for updates
            self.check_updates()
            #check for updates every hour
            Clock.schedule_interval(self.update_clock, 3600)
            self.startup = True


            return False
项目:displayminion    作者:cedarsuite    | 项目源码 | 文件源码
def connected(self):
        self.state = 'connected'
        self.trigger_event('connected')

        self.debug('Connected to server')

        self.time = MeteorTime(self.meteor)
        Clock.schedule_interval(self.time.update, 0.5)

        self.collections = 0
        self.collections_ready = 0

        for collection in ['settings', 'stages', 'minions',
                           'media', 'mediaplaylists',
                           'songs', 'songarrangements', 'songsections',
                           'presentations', 'presentationslides']:

            self.collections += 1
            self.meteor.subscribe(collection, callback=self.subscription_ready)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def third_screen(self):
        """
        Pull filament Screen:
            Display instructions to user -- Pull out filament
            Display button that will open fourth screen
        """
        # roboprinter.printer_instance._printer.jog('e', -130.00)
        c = Filament_Wizard_3_5(self.fourth_screen)
        back_destination = roboprinter.robo_screen()
        this_screen = self.sm._generate_backbutton_screen(name=self.name+'[2]', title=roboprinter.lang.pack['Filament_Wizard']['Title_25'], back_destination=back_destination, content=c)

        #end the event before starting it again
        if self.extrude_event != None:
            self.end_extrude_event()

        #extrude a little bit before retracting
        roboprinter.printer_instance._printer.extrude(20.0)
        self.extrude_event = Clock.schedule_interval(self.retract, 1)


        # back_button deletes Second Screen, as back destination is first screen
        # second_screen = self.sm.get_screen(self.name+'[1]')
        # delete_second = partial(self.sm.remove_widget, second_screen)
        # this_screen.ids.back_button.bind(on_press=delete_second)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def fifth_screen(self, *args):
        """
        Final screen / Confirm successful load:
            Extrude filament
            Display instruction to user -- Press okay when you see plastic extruding
            Display button that will move_to_main() AND stop extruding filament
        """
        if self.load_or_change == 'CHANGE':
            _title = roboprinter.lang.pack['Filament_Wizard']['Title_45']
            back_dest = self.name+'[3]'
        else:
            _title = roboprinter.lang.pack['Filament_Wizard']['Title_34']
            back_dest = self.name+'[3]'

        c = Filament_Wizard_5_5(self.end_wizard)
        back_destination = roboprinter.robo_screen()
        self.sm._generate_backbutton_screen(name=self.name+'[4]', title=_title, back_destination=back_destination, content=c)

        #end the event before starting it again
        if self.extrude_event != None:
            self.end_extrude_event()
        self.extrude_event = Clock.schedule_interval(self.extrude, 1)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def __init__(self, keyboard_callback = None, default_text = '', name = 'keyboard_screen', title=lang.pack['Files']['Keyboard']['Default_Title'], back_destination=None,**kwargs):
        super(KeyboardInput, self).__init__(**kwargs)
        self.default_text = default_text
        self.back_destination = back_destination
        self.first_press = False
        if self.back_destination == None:
            self.back_destination = roboprinter.robo_screen()

        roboprinter.back_screen(name=name, 
                                title=title, 
                                back_destination=self.back_destination, 
                                content=self)
        self.current_screen = roboprinter.robo_screen()
        self._keyboard = None
        self._set_keyboard('keyboards/abc.json')
        if keyboard_callback != None:
            self.keyboard_callback = keyboard_callback

        self.keyboard_watch = Clock.schedule_interval(self.monitor_screen_change, 0.2)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(UtilitiesContent, self).__init__()

        #add Icons
        self.wiz = Robo_Icons('Icons/White_Utilities/Wizards.png', roboprinter.lang.pack['RoboIcons']['Wizards'] , 'WIZARDS')
        self.rc = Robo_Icons('Icons/White_Utilities/Print tuning_White.png', roboprinter.lang.pack['RoboIcons']['Print_Tuning'], 'PRINT_TUNING')
        self.net = Robo_Icons('Icons/White_Utilities/Networking.png', roboprinter.lang.pack['RoboIcons']['Network'], 'NETWORK')
        self.upd = Robo_Icons('Icons/White_Utilities/Updates.png', roboprinter.lang.pack['RoboIcons']['Update'], 'UPDATES')
        self.sys = Robo_Icons('Icons/System_Icons/Shutdown 2.png', roboprinter.lang.pack['RoboIcons']['System'], 'SYSTEM')
        self.opt = Robo_Icons('Icons/White_Utilities/Options.png', roboprinter.lang.pack['RoboIcons']['Options'], 'OPTIONS')
        icons = [self.rc, self.wiz, self.net, self.upd, self.opt, self.sys]
        layout = Scroll_Box_Icons(icons)
        self.clear_widgets()
        self.add_widget(layout)

        self.state = 'NOT_PRINTING'
        self.last_state = None
        Clock.schedule_interval(self.monitor_layout, 1)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def __init__(self, selected_tool= "TOOL1" ,**kwargs):
        super(TemperatureControl, self).__init__(**kwargs)
        acceptable_toolheads = {"TOOL1": 'tool0',
                                "TOOL2": 'tool1',
                                "BED": 'bed',
                                "tool0": 'tool0',
                                "tool1": 'tool1',
                                "bed": 'bed'}

        if selected_tool in acceptable_toolheads:
            self.selected_tool = acceptable_toolheads[selected_tool]

        else:
            Logger.info("TOOL CANNOT BE SELECTED: " + selected_tool)
            self.selected_tool = 'tool0'
        Clock.schedule_interval(self.update, .1)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def __init__(self, language, callback, lang_option):
        #temporarily switch to new language
        self.old_language = lang.current_lang
        self.switch_language(lang_option)

        self.title = lang.pack['Switch_Lang']['Choose']['Switch_to'] + language + lang.pack['Switch_Lang']['Choose']['Question']
        self.body_text = lang.pack['Switch_Lang']['Choose']['Are_You_Sure']
        self.option1_text = lang.pack['Switch_Lang']['Choose']['Yes_option']
        self.option2_text = lang.pack['Switch_Lang']['Choose']['No_option']
        self.option1_function = self.yes
        self.option2_function = self.no 

        self.callback = callback
        self.language = language
        self.lang_option = lang_option
        self.pressed_yes = False



        super(Switch_Language, self).__init__(self.title, self.body_text, self.option1_text, self.option2_text, self.option1_function, self.option2_function)
        Clock.schedule_interval(self.Monitor_Screen, 0.2)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def generate_wifi_list_screen(self):
        self.wifi_grid = GridLayout(cols=1, padding=0, spacing=0)
        self.placeholder = WifiLoadingList()

        self.wifi_grid.add_widget(self.placeholder)



        self.rsm._generate_backbutton_screen(
            name=self.name,
            title=roboprinter.lang.pack['WiFi']['Select_Network'],
            back_destination=self.back_destination,
            content=self.wifi_grid,
            cta=self._refresh_wifi_list,
            icon='Icons/Manual_Control/refresh_icon.png')

        thread.start_new_thread(self._append_wifi_list, ())
        Clock.schedule_interval(self._wifi_callback, 1 / 30.)
        return
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def generate_connecting_screen(self, obj, *args):
        # remove keyboard from screen
        self.wifi_status = 'nothing'
        Window.release_all_keyboards()

        # wifi credentials
        if obj.id == 'encrypted':
            psk = obj.ids.password.text
        else:
            psk = ''
        ssid = obj.ssid
        self.wifi_data = {'ssid': ssid, 'psk': psk, 'force': True}

        # layout for connecting screen
        s = Screen(name=self.name+'[2]')
        c = WifiConnecting(ssid=ssid)
        s.add_widget(c)
        self.rsm.add_widget(s)
        self.rsm.current = s.name
        self.temp_screen = s

        thread.start_new_thread(self.connectWifi_thread, ())
        Clock.schedule_interval(self.connectWifi_callback, 1)
        #self.generate_confirmation_screen(s)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def __init__(self, file_data, **kwargs):
        super(PrintFile, self).__init__(**kwargs)
        self.queued_data = False
        self.found_meta_data = False
        self.exit = False
        self.file = file_data
        self.file_path = self.file['path']
        self.file_name = self.file['name']
        self.status = self.is_ready_to_print()

        Clock.schedule_interval(self.update, .2)

        self.current_z_offset = str("{0:.1f}".format(float(pconsole.home_offset['Z'])))

        cura_meta = self.check_saved_data()
        self.print_layer_height = '--'
        self.print_layers = '--'
        self.infill = '--'
        self.hours = 0
        self.minutes = 0
        self.seconds = 0
        self.populate_meta_data(cura_meta)
项目:RoboLCD    作者:victorevector    | 项目源码 | 文件源码
def __init__(self, title_text, body_text, button_text, bed_disconnect=False, start_refresh=False, **kwargs):
        self.clock_monitor = None
        self.changed_text = False
        self.reconnect_choice = button_text
        self.bed_disconnect = bed_disconnect
        self.start_refresh = start_refresh

        if self.bed_disconnect:
            if self.bed_checker != None:
                self.bed_checker.cancel()
                self.bed_checker = None

        Clock.schedule_interval(self.check_for_screen_change, 0.2)
        session_saver.register_event_updater("Refresh_screen", self.on_event)

        super(Refresh_Screen, self).__init__(title_text, body_text, self.reset, button_text)

        #Immediately start the refresh function as if someone had pressed the button
        if self.start_refresh:
            self.reset()
项目:zipper    作者:richarddun    | 项目源码 | 文件源码
def __init__(self,**kwargs):
        self.baseimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','enbar_noback.png'))
        self.hpimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','hbar.png'))
        self.mpimg = os.path.abspath(os.path.join(os.path.dirname('__file__'),'animation','effects','mpbar.png'))

        super(ZippyGame,self).__init__(**kwargs)
        tempscale = Window.height / 256.
        self.map = BaseMap(os.path.abspath(os.path.join(os.path.dirname('__file__'),'Maps','prototype1','16px-680x800-metal.tmx')),
            Window.size,tempscale)
        spawn = self.map.map.layers['start'].find('spawn')[0]
        self.zipmeter = ZipMeter()
        self.sprite = Player_Sprite((spawn.px,spawn.py),self.map)
        self.add_widget(self.map)
        self.map.add_widget(self.sprite)
        self.add_widget(self.zipmeter)
        Clock.schedule_interval(self.update, 1.0/60.0)
项目:Self-Driving-Car    作者:Ujjwal-9    | 项目源码 | 文件源码
def build(self): # building the app
        parent = Game()
        parent.serve_car()
        Clock.schedule_interval(parent.update, 1.0 / 60.0)
        self.painter = MyPaintWidget()
        clearbtn = Button(text='clear')
        savebtn = Button(text='save',pos=(parent.width,0))
        loadbtn = Button(text='load',pos=(2*parent.width,0))
        clearbtn.bind(on_release=self.clear_canvas)
        savebtn.bind(on_release=self.save)
        loadbtn.bind(on_release=self.load)
        parent.add_widget(self.painter)
        parent.add_widget(clearbtn)
        parent.add_widget(savebtn)
        parent.add_widget(loadbtn)
        return parent
项目:DemoKivyContacts    作者:HeaTTheatR    | 项目源码 | 文件源码
def build(self):
        self.use_kivy_settings = False
        self.title = data.string_lang_title  # ????????? ???? ?????????
        self.icon = 'data/images/logo.png'  # ?????? ???? ?????????

        self.config = ConfigParser()
        self.config.read('{}/program.ini'.format(data.prog_path))

        # ??????? ????? ?????????.
        self.screen = StartScreen(events_callback=self.events_program)
        self.nav_drawer = NavDrawer(title=data.string_lang_menu)

        self.manager_tab_contacts = self.screen.ids.screen_manager_tab_contacts
        self.manager_tab_groups = self.screen.ids.screen_manager_tab_groups

        # ?????????, ???????????? ?? ????? ?????????.
        self._check_existence_contacts()
        self.info_contacts, self.info_groups = self._read_data()
        self.old_info_groups = self.info_groups

        if self.info_contacts.__len__():  # Activity ?? ??????? ?????????
            Clock.schedule_interval(self.load_contacts, 0)

        return self.screen
项目:KivyTrek    作者:peterLaurence    | 项目源码 | 文件源码
def toggle_state(self):
        try:
            if not self.sensorEnabled:
                rotation.enable()
                Clock.schedule_interval(self.get_readings, 1 / 20.)

                self.sensorEnabled = True
                self.compass_status = "Stop compass"
            else:
                rotation.disable()
                Clock.unschedule(self.get_readings)

                self.sensorEnabled = False
                self.compass_status = "Start compass"
        except NotImplementedError:
            import traceback

            traceback.print_exc()
            self.compass_status = self.NOT_IMPLEMENTED
项目:KivyCleanMasterDemo    作者:HeaTTheatR    | 项目源码 | 文件源码
def on_events(self, *args):
        """?????????? ??????? ??????????."""

        try:
            # ??????? ?????????? - ??? ???? ????????????? ?????????.
            _args = args[0]
            event = _args if isinstance(_args, str) else _args.id
        except AttributeError:
            # ??????? ??????????, ?????? ??????? - ??? ??????? ???????.
            event = args[1]

        if event == "About":  # ??????? Activity About
            self.show_about()
        elif event == "on_previous" or event in (1000, 27):  # ?????????? Activity
            self.back_screen()
        elif event == "JUNK FILES":  # ??????? Activity JUNK FILES
            self.show_junk_files()
            # ????????? ???????? ???????? STORAGE/RAM.
            self.Clock.unschedule(self.calc_elliptical_length)
            # ?????? ???????? ????????? ???????.
            self.Clock.schedule_interval(self.animation_clean, 0.2)
        elif event == "STOP":   # ????????? ???????? JUNK FILES
            Clock.unschedule(self.animation_clean)
            self.back_screen()
        return True
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def build(self):
        self.root = RootScroller()

        ndata = []
        for i in range(0, 10160):
            # ndata.append( {'text': 't {}'.format(i)})
            ndata.append( {'text': '[color=#FE2E2E]{}[/color] \n {}'.format(
                i, full_string[randrange(0, len(full_string), 1):]
            )})
        self.root.ids.data_box.data = ndata

        Clock.schedule_interval(self.test_interval, 0)
        Clock.schedule_once(self.test_once, 1)
        return self.root
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def build(self):
        self.root = RootScroller()

        ndata = []
        for i in range(0, 10160):
            # ndata.append( {'text': 't {}'.format(i)})
            ndata.append( {'text': '[color=#FE2E2E]{}[/color] \n {}'.format(
                i, full_string[randrange(0, len(full_string), 1):]
            )})
        self.root.ids.data_box.data = ndata

        Clock.schedule_interval(self.test_interval, 0)
        Clock.schedule_once(self.test_once, 1)
        Clock.schedule_interval(self.test2, 3)
        return self.root
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def __init__(self, term_widget,**kwargs):
        self.register_event_type('on_data')
        self.register_event_type('on_data_append')
        self.register_event_type('on_input')
        super(TerminalWidgetSystem, self).__init__(**kwargs)
        self.term_widget = term_widget
        self.id = self._next_id
        self.add_text(
            'TerminalWidgetSystem: id:%s initialised' % self._next_id)
        self._next_id += 1
        Clock.schedule_interval(self.on_every_second, 1)
        self.fbind('time_stamp_mode', self.on_time_stamp_mode_reload_data)

        app = App.get_running_app()
        self.exec_locals = {
            'app': app, 'self': self, 'add_text': self.add_text,
            'term_widget': self.term_widget,
            'hide': self.term_widget.animate_out}
        for x in self.exec_locals:
            self.autocompleter.add_word(x)
        for item in self.plugins:
            self.autocompleter.add_word(item)
        for item in self.properties():
            self.autocompleter.add_word(item)

        shared_globals.set_app_name(app.name)
        self._import_built_in_plugins()
        self._load_input_log()
项目:kivy_soil    作者:Bakterija    | 项目源码 | 文件源码
def on_state(self, _, value):
        if value == 'connected':
            Clock.schedule_interval(self.update, 0.15)
        elif value == 'disconnected':
            Clock.unschedule(self.update)
项目:kivy-chat    作者:yingshaoxo    | 项目源码 | 文件源码
def connect(self):
        self.host = self.root.ids.server.text
        self.nick = self.root.ids.nickname.text

        self.is_stop = False
        self.loop = asyncio.get_event_loop()

        if self.reconnect():

            self.clock_receive = Clock.schedule_interval(self.receive_msg, 1)
            self.clock_detect = Clock.schedule_interval(self.detect_if_offline, 3)

            self.root.current = 'chatroom'
            self.save_config()
            print('-- connecting to ' + self.host)
项目:kivy-chat    作者:yingshaoxo    | 项目源码 | 文件源码
def connect(self):
        self.host = self.root.ids.server.text
        self.nick = self.root.ids.nickname.text

        self.is_stop = False
        self.loop = asyncio.get_event_loop()

        if self.reconnect():

            self.clock_receive = Clock.schedule_interval(self.receive_msg, 1)
            self.clock_detect = Clock.schedule_interval(self.detect_if_offline, 3)

            self.root.current = 'chatroom'
            self.save_config()
            print('-- connecting to ' + self.host)
项目:Boundary-Trees    作者:jayricco    | 项目源码 | 文件源码
def build(self):
        view = GroundTruthWidget(size=(view_size[0]*2, view_size[1]), img_size=img_size, view_size=view_size)
        evt = Clock.schedule_interval(view.sample_gt, 1.0/60.0)
        view.event = evt
        return view
项目:glucometer    作者:johnyburd    | 项目源码 | 文件源码
def start_pb(self):
        event = Clock.schedule_interval(self.update_pb, 1 / 60.)
项目:glucometer    作者:johnyburd    | 项目源码 | 文件源码
def build(self):
        game = FlappyBirdGame()
        Clock.schedule_interval(game.update, 1.0/60.0)
        return game
项目:pi-photo-booth    作者:gamblecd    | 项目源码 | 文件源码
def preview(self, generator=None):
        log.debug("Starting Preview")
        if not generator:
            log.info("Creating Generator from Camera")
            generator = self.cam.generate_preview()
        self.image_generator = self.previewer.producer(generator)
        self.previewing = Clock.schedule_interval(self.update_image, 1 / 30)
项目:pi-photo-booth    作者:gamblecd    | 项目源码 | 文件源码
def countdown(self, seconds=None, callback=None):
        if not seconds:
            seconds = self.starting_number
        self.generator = utils.count_down(seconds)
        self.callback = callback
        self.event = Clock.schedule_interval(self.update_count, 0.2)
项目:MeetNet    作者:dimgold    | 项目源码 | 文件源码
def __init__(self,dat,user,opened=False):
        super(MMarker,self).__init__()
        self.user = user
        if opened:
            self.is_open = opened
        self.name = dat['name']
        if self.name == self.user:
            self.source = "marker2.png"
        self.lat = dat['lat']
        self.lon =  dat['lon']
        self.lab.text = "[b]%s[/b] \n Was here \n   Date:%s \n Time: %s" % (dat['name'],dat['date'],dat['time'])
        self.pic.source = dat['pic']
        Clock.schedule_interval(self.checkagain,markerdelay) #refreshing data
项目:MeetNet    作者:dimgold    | 项目源码 | 文件源码
def build(self):
        self.user = ''
        self.gps = gps
        Clock.schedule_interval(self.call_send,gpsdelay)
        try:
            self.gps.configure(on_location=self.on_location)
            self.gps.start()
        except NotImplementedError:
            import traceback
            traceback.print_exc()
            self.speed = 'GPS is not implemented for your platform'
项目:MeetNet    作者:dimgold    | 项目源码 | 文件源码
def __init__(self, max_workers=None, cap_time=None):
        if max_workers is None:
            max_workers = Downloader.MAX_WORKERS
        if cap_time is None:
            cap_time = Downloader.CAP_TIME
        super(Downloader, self).__init__()
        self.is_paused = False
        self.cap_time = cap_time
        self.executor = ThreadPoolExecutor(max_workers=max_workers)
        self._futures = []
        Clock.schedule_interval(self._check_executor, 1 / 60.)
        if not exists(CACHE_DIR):
            makedirs(CACHE_DIR)
项目:MeetNet    作者:dimgold    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        from kivy.base import EventLoop
        EventLoop.ensure_window()
        self._invalid_scale = True
        self._tiles = []
        self._tiles_bg = []
        self._tilemap = {}
        self._layers = []
        self._default_marker_layer = None
        self._need_redraw_all = False
        self._transform_lock = False
        self.trigger_update(True)
        self.canvas = Canvas()
        self._scatter = MapViewScatter()
        self.add_widget(self._scatter)
        with self._scatter.canvas:
            self.canvas_map = Canvas()
            self.canvas_layers = Canvas()
        with self.canvas:
            self.canvas_layers_out = Canvas()
        self._scale_target_anim = False
        self._scale_target = 1.
        self._touch_count = 0
        Clock.schedule_interval(self._animate_color, 1 / 60.)
        self.lat = kwargs.get("lat", self.lat)
        self.lon = kwargs.get("lon", self.lon)
        super(MapView, self).__init__(**kwargs)
项目:krpc-library    作者:krpc    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(Menu, self).__init__(**kwargs)
        self.active_widget = None
        self.message_buffer = [{}]
        Clock.schedule_interval(self.update_msg, 1.0)