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


Python Logger.warning方法代码示例

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


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

示例1: enter_wpos

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def enter_wpos(self, axis, v):
        i = ord(axis) - ord('x')
        v = v.strip()
        if v.startswith('/'):
            # we divide current value by this
            try:
                d = float(v[1:])
                v = str(self.app.wpos[i] / d)
            except Exception:
                Logger.warning("DROWidget: cannot divide by: {}".format(v))
                self.app.wpos[i] = self.app.wpos[i]
                return

        try:
            # needed because the filter does not allow -ive numbers WTF!!!
            f = float(v.strip())
        except Exception:
            Logger.warning("DROWidget: invalid float input: {}".format(v))
            # set the display back to what it was, this looks odd but it forces the display to update
            self.app.wpos[i] = self.app.wpos[i]
            return

        Logger.debug("DROWidget: Set axis {} wpos to {}".format(axis, f))
        self.app.comms.write('G10 L20 P0 {}{}\n'.format(axis.upper(), f))
        self.app.wpos[i] = f 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:27,代码来源:main.py

示例2: _upload_gcode

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def _upload_gcode(self, file_path, dir_path):
        if not file_path:
            return

        try:
            self.nlines = Comms.file_len(file_path, self.app.fast_stream)  # get number of lines so we can do progress and ETA
            Logger.debug('MainWindow: number of lines: {}'.format(self.nlines))
        except Exception:
            Logger.warning('MainWindow: exception in file_len: {}'.format(traceback.format_exc()))
            self.nlines = None

        self.start_print_time = datetime.datetime.now()
        self.display('>>> Uploading file: {}, {} lines'.format(file_path, self.nlines))

        if not self.app.comms.upload_gcode(file_path, progress=lambda x: self.display_progress(x), done=self._upload_gcode_done):
            self.display('WARNING Unable to upload file')
            return
        else:
            self.is_printing = True 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:21,代码来源:main.py

示例3: import_module

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def import_module(self, name):
        try:
            modname = 'kivy.modules.{0}'.format(name)
            module = __import__(name=modname)
            module = sys.modules[modname]
        except ImportError:
            try:
                module = __import__(name=name)
                module = sys.modules[name]
            except ImportError:
                Logger.exception('Modules: unable to import <%s>' % name)
                raise
        # basic check on module
        if not hasattr(module, 'start'):
            Logger.warning('Modules: Module <%s> missing start() function' %
                           name)
            return
        if not hasattr(module, 'stop'):
            err = 'Modules: Module <%s> missing stop() function' % name
            Logger.warning(err)
            return
        self.mods[name]['module'] = module 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:24,代码来源:__init__.py

示例4: activate_module

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def activate_module(self, name, win):
        '''Activate a module on a window'''
        if name not in self.mods:
            Logger.warning('Modules: Module <%s> not found' % name)
            return

        mod = self.mods[name]

        # ensure the module has been configured
        if 'module' not in mod:
            self._configure_module(name)

        pymod = mod['module']
        if not mod['activated']:
            context = mod['context']
            msg = 'Modules: Start <{0}> with config {1}'.format(
                  name, context)
            Logger.debug(msg)
            pymod.start(win, context)
            mod['activated'] = True 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:22,代码来源:__init__.py

示例5: open

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def open(self, *largs):
        '''Show the view window from the :attr:`attach_to` widget. If set, it
        will attach to the nearest window. If the widget is not attached to any
        window, the view will attach to the global
        :class:`~kivy.core.window.Window`.
        '''
        if self._window is not None:
            Logger.warning('ModalView: you can only open once.')
            return self
        # search window
        self._window = self._search_window()
        if not self._window:
            Logger.warning('ModalView: cannot open view, no window found.')
            return self
        self._window.add_widget(self)
        self._window.bind(
            on_resize=self._align_center,
            on_keyboard=self._handle_keyboard)
        self.center = self._window.center
        self.bind(size=self._update_center)
        a = Animation(_anim_alpha=1., d=self._anim_duration)
        a.bind(on_complete=lambda *x: self.dispatch('on_open'))
        a.start(self)
        return self 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:26,代码来源:modalview.py

示例6: unload_file

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def unload_file(self, filename):
        '''Unload all rules associated with a previously imported file.

        .. versionadded:: 1.0.8

        .. warning::

            This will not remove rules or templates already applied/used on
            current widgets. It will only effect the next widgets creation or
            template invocation.
        '''
        # remove rules and templates
        self.rules = [x for x in self.rules if x[1].ctx.filename != filename]
        self._clear_matchcache()
        templates = {}
        for x, y in self.templates.items():
            if y[2] != filename:
                templates[x] = y
        self.templates = templates
        if filename in self.files:
            self.files.remove(filename)

        # unregister all the dynamic classes
        Factory.unregister_from_filename(filename) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:26,代码来源:lang.py

示例7: on_keyboard

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def on_keyboard(self, key, scancode=None, codepoint=None,
                    modifier=None, **kwargs):
        '''Event called when keyboard is used.

        .. warning::
            Some providers may omit `scancode`, `codepoint` and/or `modifier`!
        '''
        if 'unicode' in kwargs:
            Logger.warning("The use of the unicode parameter is deprecated, "
                           "and will be removed in future versions. Use "
                           "codepoint instead, which has identical "
                           "semantics.")

        # Quit if user presses ESC or the typical OSX shortcuts CMD+q or CMD+w
        # TODO If just CMD+w is pressed, only the window should be closed.
        is_osx = platform == 'darwin'
        if WindowBase.on_keyboard.exit_on_escape:
            if key == 27 or all([is_osx, key in [113, 119], modifier == 1024]):
                if not self.dispatch('on_request_close', source='keyboard'):
                    stopTouchApp()
                    self.close()
                    return True 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:24,代码来源:__init__.py

示例8: load

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def load(self, filename):
        if self._inline:
            data = filename.read()
            info = _img_sdl2.load_from_memory(data)
        else:
            info = _img_sdl2.load_from_filename(filename)
        if not info:
            Logger.warning('Image: Unable to load image <%s>' % filename)
            raise Exception('SDL2: Unable to load image')

        w, h, fmt, pixels, rowlength = info

        # update internals
        if not self._inline:
            self.filename = filename
        return [ImageData(
            w, h, fmt, pixels, source=filename,
            rowlength=rowlength)] 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:20,代码来源:img_sdl2.py

示例9: load_macros

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def load_macros(self):
        try:
            config = configparser.ConfigParser()
            config.read('mpg_rawhid.ini')
            # load user defined macro buttons
            for (key, v) in config.items('macros'):
                self.macrobut[key] = v

        except Exception as err:
            Logger.warning('MPG_rawhid: WARNING - exception parsing config file: {}'.format(err)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:12,代码来源:mpg_rawhid.py

示例10: load_macros

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def load_macros(self):
        try:
            config = configparser.ConfigParser()
            config.read('hb04.ini')
            # load user defined macro buttons
            for (key, v) in config.items('macros'):
                self.macrobut[key] = v

            # load any default settings
            self.mul = config.getint("defaults", "multiplier", fallback=8)

        except Exception as err:
            Logger.warning('HB04: WARNING - exception parsing config file: {}'.format(err)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:15,代码来源:hb04.py

示例11: _start_print

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def _start_print(self, file_path=None, directory=None):
        # start comms thread to stream the file
        # set comms.ping_pong to False for fast stream mode
        if file_path is None:
            file_path = self.app.gcode_file
        if directory is None:
            directory = self.last_path

        Logger.info('MainWindow: printing file: {}'.format(file_path))

        try:
            self.nlines = Comms.file_len(file_path, self.app.fast_stream)  # get number of lines so we can do progress and ETA
            Logger.debug('MainWindow: number of lines: {}'.format(self.nlines))
        except Exception:
            Logger.warning('MainWindow: exception in file_len: {}'.format(traceback.format_exc()))
            self.nlines = None

        self.start_print_time = datetime.datetime.now()
        self.display('>>> Running file: {}, {} lines'.format(file_path, self.nlines))
        if self.app.fast_stream:
            self.display('>>> Using fast stream')

        if self.app.comms.stream_gcode(file_path, progress=lambda x: self.display_progress(x)):
            self.display('>>> Run started at: {}'.format(self.start_print_time.strftime('%x %X')))
        else:
            self.display('WARNING Unable to start print')
            return

        self.set_last_file(directory, file_path)

        self.ids.print_but.text = 'Pause'
        self.is_printing = True
        self.paused = False 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:35,代码来源:main.py

示例12: get_path_instructions

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def get_path_instructions(self, gc, polygons, closed=False, rgbFace=None):
        '''With a graphics context and a set of polygons it returns a list
           of InstructionGroups required to render the path.
        '''
        instructions_list = []
        points_line = []
        for polygon in polygons:
            for x, y in polygon:
                x = x + self.widget.x
                y = y + self.widget.y
                points_line += [float(x), float(y), ]
            tess = Tesselator()
            tess.add_contour(points_line)
            if not tess.tesselate():
                Logger.warning("Tesselator didn't work :(")
                return
            newclip = self.handle_clip_rectangle(gc, x, y)
            if newclip > -1:
                instructions_list.append((self.clip_rectangles[newclip],
                        self.get_graphics(gc, tess, points_line, rgbFace,
                                          closed=closed)))
            else:
                instructions_list.append((self.widget,
                        self.get_graphics(gc, tess, points_line, rgbFace,
                                          closed=closed)))
        return instructions_list 
开发者ID:kivy-garden,项目名称:garden.matplotlib,代码行数:28,代码来源:backend_kivy.py

示例13: __init__

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def __init__(self, appID):
        Logger.info("KivMob: __init__ called.")
        self._banner_top_pos = True
        if platform == "android":
            Logger.info("KivMob: Android platform detected.")
            self.bridge = AndroidBridge(appID)
        elif platform == "ios":
            Logger.warning("KivMob: iOS not yet supported.")
            self.bridge = iOSBridge(appID)
        else:
            Logger.warning("KivMob: Ads will not be shown.")
            self.bridge = AdMobBridge(appID) 
开发者ID:MichaelStott,项目名称:KivMob,代码行数:14,代码来源:kivmob.py

示例14: _update_clr

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def _update_clr(self, dt):
        mode, clr_idx, text = self._upd_clr_list
        try:
            text = max(0, min(254, float(text)))
            if mode == 'rgb':
                self.color[clr_idx] = float(text) / 255.
            else:
                self.hsv[clr_idx] = float(text) / 255.
        except ValueError:
            Logger.warning('ColorPicker: invalid value : {}'.format(text)) 
开发者ID:the-duck,项目名称:launcher,代码行数:12,代码来源:main.py

示例15: _update_clr

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import warning [as 别名]
def _update_clr(self, dt):
        mode, clr_idx, text = self._upd_clr_list
        try:
            text = min(255, max(0, float(text)))
            if mode == 'rgb':
                self.color[clr_idx] = float(text) / 255.
            else:
                self.hsv[clr_idx] = float(text) / 255.
        except ValueError:
            Logger.warning('ColorPicker: invalid value : {}'.format(text)) 
开发者ID:snuq,项目名称:Snu-Photo-Manager,代码行数:12,代码来源:colorpickercustom.py


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