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


Python App.get_running_app方法代码示例

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


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

示例1: open

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def open(self):
        self.app = App.get_running_app()
        self.ids.placeholder.add_widget(Label(text='Loading....'))
        self.manager.current = 'config_editor'
        self.config = ConfigParser.get_configparser('Smoothie Config')
        if self.config is None:
            self.config = ConfigParser(name='Smoothie Config')
        else:
            for section in self.config.sections():
                self.config.remove_section(section)

        # get config, parse and populate
        self.app.comms.redirect_incoming(self._add_line)
        # issue command
        self.app.comms.write('cat /sd/config.ini\n')
        self.app.comms.write('\n')  # get an ok to indicate end of cat 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:18,代码来源:configv2_editor.py

示例2: handle_exception

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def handle_exception(exc_type, exc_value, exc_traceback):
    """ handle all exceptions """

    # KeyboardInterrupt is a special case.
    # We don't raise the error dialog when it occurs.
    if issubclass(exc_type, KeyboardInterrupt):
        return

    Logger.error("Unhandled Exception:")
    Logger.error("".join(traceback.format_exception(exc_type, exc_value, exc_traceback)))
    try:
        App.get_running_app().stop()
    except Exception:
        pass


# we want to handle TERM signal cleanly (sent by sv down) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:19,代码来源:main.py

示例3: go_back_in_history

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def go_back_in_history():
    app = App.get_running_app()
    from utils import pause_app
    try:
        scr = app._navigation_higherarchy.pop()
        if scr.name == 'ScreenSchedule':
            # we are at top of Nav higherarchy
            pause_app()
            return

        # we are not at root of Nav higherarchy
        scr = app._navigation_higherarchy[-1]
        load_screen(
            scr.name,
            manager=scr.manager,
            store_back=False)
    except (IndexError, ScreenManagerException):
        # check if current screen is schedule screen?
        if app.navigation_manager.current == 'ScreenSchedule':
            pause_app()
            return
        load_screen("ScreenSchedule", manager=app.navigation_manager) 
开发者ID:pythonindia,项目名称:PyCon-Mobile-App,代码行数:24,代码来源:__init__.py

示例4: on_Exit

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def on_Exit(self):
        '''
        
        This function run when the process is completed or quit is pressed
        
        '''
        App.get_running_app().data.calibrationInProcess = False
        App.get_running_app().data.message_queue.put("Message: Notice: Exiting the calibration process early may result in incorrect calibration.")
        
        #remove the old widget
        try:
            self.cFrameWidgetSpace.remove_widget(self.currentWidget)
        except:
            pass #there was no widget to remove
        
        self.done() 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:18,代码来源:calibrationFrameWidget.py

示例5: on_Enter

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def on_Enter(self):
        '''
        
        This function runs when the step is entered
        
        '''
        self.data = App.get_running_app().data
        
        try:
        
            self.leftCorrectionFactor = (abs(self.data.motorsDist - self.data.leftChainMeasurement)/self.data.leftChainMeasurement)*100.0
            self.rightCorrectionFactor = (abs(self.data.motorsDist - self.data.rightChainMeasurement)/self.data.rightChainMeasurement)*100.0
            
            self.selfText.text = ("When measured manually: " + str(self.data.motorsDist) 
                + "\nWhen measured with the left chain:" + str(self.data.leftChainMeasurement) 
                + "\nWhen measured with the right chain:" + str(self.data.rightChainMeasurement)
                + "\n\nLeft chain correction factor: " + str(self.leftCorrectionFactor)
                + "\nRight chain correction factor: " + str(self.rightCorrectionFactor)
                )
        except:
            self.selfText.text = "unable to compute correction factors" 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:23,代码来源:computeChainCorrectionFactors.py

示例6: on_Enter

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def on_Enter(self):
        '''
        
        This function runs when the step is entered
        
        '''
        
        self.data = App.get_running_app().data
        
        tempString = "Lets review the measurements to make sure everything looks good. You can use the back button to repeat any step.\n\nThe current values are:"
        tempString = tempString + "\nDistance between motors: " + self.data.config.get('Maslow Settings', 'motorSpacingX') + "mm"
        tempString = tempString + "\nVertical motor offset: " + self.data.config.get('Maslow Settings', 'motorOffsetY') + "mm"
        tempString = tempString + "\nKinematics type: " + self.data.config.get('Advanced Settings', 'kinematicsType')
        tempString = tempString + "\nChain feed type: " + self.data.config.get('Advanced Settings', 'chainOverSprocket')
        if self.data.config.get('Advanced Settings', 'kinematicsType') == 'Triangular':
            tempString = tempString + "\nRotation radius: " + self.data.config.get('Advanced Settings', 'rotationRadius') + "mm"
            tempString = tempString + "\nChain sag correction value: " + self.data.config.get('Advanced Settings', 'chainSagCorrection')
        else:
            tempString = tempString + "\nSled mount spacing: " + self.data.config.get('Maslow Settings', 'sledWidth') + "mm"
        
        self.measurementsReadout.text = tempString 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:23,代码来源:reviewMeasurements.py

示例7: on_Enter

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def on_Enter(self):
        '''
        
        This function runs when the step is entered
        
        '''
        self.data = App.get_running_app().data
        self.data.measureRequest = self.readMotorSpacing
        
        self.originalChainOverSproketDir = self.data.config.get('Advanced Settings', 'chainOverSprocket')
        
        #pretend we are in the "Top" configuration during this step
        App.get_running_app().data.config.set('Advanced Settings', 'chainOverSprocket', 'Top')
        
        #set the threshold for warning that the machine is off target to 200mm esentially turning it off. We dont' want this to trigger when pulling the chain tight
        self.data.gcode_queue.put("$42=200 ") 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:18,代码来源:measureOneChain.py

示例8: on_Enter

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def on_Enter(self):
        '''
        
        This function runs when the step is entered
        
        '''
        self.data = App.get_running_app().data
        self.data.measureRequest = self.readMotorSpacing
        
        self.originalChainOverSproketDir = App.get_running_app().data.config.get('Advanced Settings', 'chainOverSprocket')
        
        #pretend we are in the "Top" configuration during this step
        App.get_running_app().data.config.set('Advanced Settings', 'chainOverSprocket', 'Top')
        
        #set the threshold for warning that the machine is off target to 200mm essentially turning it off. We don't want this to trigger when pulling the chain tight
        self.data.gcode_queue.put("$42=2000 ") 
开发者ID:MaslowCNC,项目名称:GroundControl,代码行数:18,代码来源:measureDistBetweenMotors.py

示例9: __init__

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def __init__(self, *args, **kwargs):
        super(InterpreterInput, self).__init__(*args, **kwargs)

        self.register_event_type('on_request_completions')
        self.register_event_type('on_clear_completions')
        self.register_event_type('on_get_completions')

        if platform != 'android':
            from pygments.lexers import PythonLexer
            self.lexer = PythonLexer()

        App.get_running_app().bind(on_pause=self.on_pause)

    #     self.text = '''for i in range(5):
    # print(i)
    # time.sleep(1)''' 
开发者ID:inclement,项目名称:Pyonic-interpreter,代码行数:18,代码来源:interpreter.py

示例10: go_back

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def go_back(self):
        app = App.get_running_app()

        if self.current == 'interpreter':  # current top level screen
            app.back_button_leave_app()

        self.transition = SlideTransition(direction='right')

        if self.current == self.back_screen_name:
            self.back_screen_name = 'interpreter'

        if self.back_screen_name in self.screen_names:
            self.current = self.back_screen_name
        else:
            self.current = 'interpreter'
        self.transition = SlideTransition(direction='left') 
开发者ID:inclement,项目名称:Pyonic-interpreter,代码行数:18,代码来源:main.py

示例11: on_touch_down

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def on_touch_down(self, touch):
        app = App.get_running_app()
        if self.collide_point(*touch.pos):
            if touch.is_double_tap and not app.shift_pressed:
                if self.displayable:
                    if self.total_photos_numeric > 0:
                        app.show_album(self)
            else:
                self.parent.selected = {}
                self.parent.selected = self.data
                self.on_press()
            if self.dragable:
                self.drag = True
                app = App.get_running_app()
                temp_coords = self.to_parent(touch.opos[0], touch.opos[1])
                widget_coords = (temp_coords[0]-self.pos[0], temp_coords[1]-self.pos[1])
                window_coords = self.to_window(touch.opos[0], touch.opos[1])
                app.drag_treeview(self, 'start', window_coords, offset=widget_coords) 
开发者ID:snuq,项目名称:Snu-Photo-Manager,代码行数:20,代码来源:generalelements.py

示例12: __init__

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def __init__(self, *args, **kwargs):
        super(MySettingsPanel, self).__init__(*args, **kwargs)
        if App.get_running_app().is_desktop == 0:
            # For RPI gets the instance of the ContentPanel which is a ScrollView
            # and sets the friction attr in the effects
            # This may only work with an panel of type SettingsWithNoMenu
            self.interface.effect_y.friction = 1.0 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:9,代码来源:configv2_editor.py

示例13: on_config_change

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def on_config_change(self, config, section, key, value):
        app = App.get_running_app()
        app.comms.write('config-set "{}" {} {}\n'.format(section, key, value)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:5,代码来源:configv2_editor.py

示例14: __init__

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def __init__(self, vid, pid):
        # Teensy vendor ID and product ID
        self.vid = vid
        self.pid = pid
        self.hid = RawHID()
        self.macrobut = {}
        self.app = App.get_running_app() 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:9,代码来源:mpg_rawhid.py

示例15: __init__

# 需要导入模块: from kivy.app import App [as 别名]
# 或者: from kivy.app.App import get_running_app [as 别名]
def __init__(self, **kwargs):
        super(ToolScripts, self).__init__(**kwargs)
        self.app = App.get_running_app()

    # public methods 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:7,代码来源:tool_scripts.py


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