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


Python Logger.info方法代码示例

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


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

示例1: _load_modules

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def _load_modules(self):
        if not self.config.has_section('modules'):
            return

        try:
            for key in self.config['modules']:
                Logger.info("load_modules: loading module {}".format(key))
                mod = importlib.import_module('modules.{}'.format(key))
                if mod.start(self.config['modules'][key]):
                    Logger.info("load_modules: loaded module {}".format(key))
                    self.loaded_modules.append(mod)
                else:
                    Logger.info("load_modules: module {} failed to start".format(key))

        except Exception:
            Logger.warn("load_modules: exception: {}".format(traceback.format_exc())) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:18,代码来源:main.py

示例2: _new_macro

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def _new_macro(self, opts):
        if opts and opts['Name'] and opts['Command']:
            btn = Factory.MacroButton()
            btn.text = opts['Name']
            btn.bind(on_press=partial(self.send, opts['Command']))
            btn.ud = True
            self.add_widget(btn)
            # write it to macros.ini
            try:
                config = configparser.ConfigParser()
                config.read(self.macro_file)
                if not config.has_section("macro buttons"):
                    config.add_section("macro buttons")
                config.set("macro buttons", opts['Name'], opts['Command'])
                with open(self.macro_file, 'w') as configfile:
                    config.write(configfile)

                Logger.info('MacrosWidget: added macro button {}'.format(opts['Name']))

            except Exception as err:
                Logger.error('MacrosWidget: ERROR - exception writing config file: {}'.format(err)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:23,代码来源:macros_widget.py

示例3: apply_device

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def apply_device(device, scale, orientation):
    name, width, height, dpi, density = devices[device]
    if orientation == 'portrait':
        width, height = height, width
    Logger.info('Screen: Apply screen settings for {0}'.format(name))
    Logger.info('Screen: size={0}x{1} dpi={2} density={3} '
                'orientation={4}'.format(width, height, dpi, density,
                                         orientation))
    try:
        scale = float(scale)
    except:
        scale = 1
    environ['KIVY_METRICS_DENSITY'] = str(density * scale)
    environ['KIVY_DPI'] = str(dpi * scale)
    Config.set('graphics', 'width', str(int(width * scale)))
    # simulate with the android bar
    # FIXME should be configurable
    Config.set('graphics', 'height', str(int(height * scale - 25 * density)))
    Config.set('graphics', 'fullscreen', '0')
    Config.set('graphics', 'show_mousecursor', '1') 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:22,代码来源:screen.py

示例4: usage

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def usage(device=None):
    if device:
        Logger.error('Screen: The specified device ({0}) is unknown.',
                     device)
    print('\nModule usage: python main.py -m screen:deviceid[,orientation]\n')
    print('Available devices:\n')
    print('{0:12} {1:<22} {2:<8} {3:<8} {4:<5} {5:<8}'.format(
        'Device ID', 'Name', 'Width', 'Height', 'DPI', 'Density'))
    for device, info in devices.items():
        print('{0:12} {1:<22} {2:<8} {3:<8} {4:<5} {5:<8}'.format(
            device, *info))
    print('\n')
    print('Simulate a medium-density screen such as Motolora Droid 2:\n')
    print('    python main.py -m screen:droid2\n')
    print('Simulate a high-density screen such as HTC One X, in portrait:\n')
    print('    python main.py -m screen:onex,portrait\n')
    print('Simulate the iPad 2 screen\n')
    print('    python main.py -m screen:ipad\n')
    print('If the generated window is too large, you can specify a scale:\n')
    print('    python main.py -m screen:note2,portrait,scale=.75\n')
    sys.exit(1) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:23,代码来源:screen.py

示例5: on_activated

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def on_activated(self, instance, activated):
        if not activated:
            self.grect.size = 0, 0
            if self.at_bottom:
                anim = Animation(top=0, t='out_quad', d=.3)
            else:
                anim = Animation(y=self.height, t='out_quad', d=.3)
            anim.bind(on_complete=self.animation_close)
            anim.start(self.layout)
            self.widget = None
            self.widget_info = False
        else:
            self.win.add_widget(self)
            Logger.info('Inspector: inspector activated')
            if self.at_bottom:
                Animation(top=60, t='out_quad', d=.3).start(self.layout)
            else:
                Animation(y=self.height - 60, t='out_quad', d=.3).start(
                    self.layout) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:21,代码来源:inspector.py

示例6: load

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def load(self):
        self.unload()
        ff_opts = {'vn': True, 'sn': True}  # only audio
        self._ffplayer = MediaPlayer(self.source,
                                     callback=self._callback_ref,
                                     loglevel='info', ff_opts=ff_opts)
        player = self._ffplayer
        player.set_volume(self.volume)
        player.toggle_pause()
        self._state = 'paused'
        # wait until loaded or failed, shouldn't take long, but just to make
        # sure metadata is available.
        s = time.clock()
        while ((not player.get_metadata()['duration'])
               and not self.quitted and time.clock() - s < 10.):
            time.sleep(0.005) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:18,代码来源:audio_ffpyplayer.py

示例7: play

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def play(self):
        if self._ffplayer and self._state == 'paused':
            self._ffplayer.toggle_pause()
            self._state = 'playing'
            return

        self.load()
        self._out_fmt = 'rgba'
        ff_opts = {
            'paused': True,
            'out_fmt': self._out_fmt
        }
        self._ffplayer = MediaPlayer(
                self._filename, callback=self._callback_ref,
                thread_lib='SDL',
                loglevel='info', ff_opts=ff_opts)

        self._thread = Thread(target=self._next_frame_run, name='Next frame')
        self._thread.daemon = True
        self._thread.start() 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:22,代码来源:video_ffpyplayer.py

示例8: remove_widget

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def remove_widget(self, widget):
        content = self.content
        if content is None:
            return
        if widget in (content, self._tab_layout):
            super(TabbedPanel, self).remove_widget(widget)
        elif isinstance(widget, TabbedPanelHeader):
            if not (self.do_default_tab and widget is self._default_tab):
                self_tabs = self._tab_strip
                self_tabs.width -= widget.width
                self_tabs.remove_widget(widget)
                if widget.state == 'down' and self.do_default_tab:
                    self._default_tab.on_release()
                self._reposition_tabs()
            else:
                Logger.info('TabbedPanel: default tab! can\'t be removed.\n' +
                            'Change `default_tab` to a different tab.')
        else:
            self._childrens.pop(widget, None)
            if widget in content.children:
                content.remove_widget(widget) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:23,代码来源:tabbedpanel.py

示例9: _change_port

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def _change_port(self, s):
        if s:
            Logger.info('MainWindow: Selected port {}'.format(s))

            if s.startswith('network'):
                mb = InputBox(title='Network address', text='Enter network address as "ipaddress[:port]"', cb=self._new_network_port)
                mb.open()

            else:
                self.config.set('General', 'serial_port', s)
                self.config.write() 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:13,代码来源:main.py

示例10: _start_print

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

示例11: stream_finished

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def stream_finished(self, ok):
        ''' called when streaming gcode has finished, ok is True if it completed '''
        self.ids.print_but.text = 'Run'
        self.is_printing = False
        now = datetime.datetime.now()
        self.display('>>> Run finished {}'.format('ok' if ok else 'abnormally'))
        self.display(">>> Run ended at : {}, last Z: {}, last line: {}".format(now.strftime('%x %X'), self.wpos[2], self.last_line))
        et = datetime.timedelta(seconds=int((now - self.start_print_time).seconds))
        self.display(">>> Elapsed time: {}".format(et))
        self.eta = '--:--:--'
        Logger.info('MainWindow: Run finished {}, last Z: {}, last line: {}'.format('ok' if ok else 'abnormally', self.wpos[2], self.last_line)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:13,代码来源:main.py

示例12: _start_sd_print

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def _start_sd_print(self, file_path, directory):
        Logger.info("MainWindow: SDcard print: {}".format(file_path))
        self.app.comms.write('play {}\n'.format(file_path)) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:5,代码来源:main.py

示例13: get_application_config

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def get_application_config(self):
        # allow a command line argument to select a different config file to use
        if(len(sys.argv) > 1):
            ext = sys.argv[1]
            self.config_file = '%(appdir)s/%(appname)s-%(ext)s.ini' % {'appname': self.name, 'appdir': self.directory, 'ext': ext}
        else:
            self.config_file = '%(appdir)s/%(appname)s.ini' % {'appname': self.name, 'appdir': self.directory}

        Logger.info("SmoothieHost: config file is: {}".format(self.config_file))
        return super(SmoothieHost, self).get_application_config(defaultpath=self.config_file) 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:12,代码来源:main.py

示例14: build

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def build(self):
            Window.size = (1024, 768)
            self.sm = ScreenManager()
            self.sm.add_widget(StartScreen(name='start'))
            self.sm.add_widget(GcodeViewerScreen(name='gcode'))
            self.sm.add_widget(ExitScreen(name='main'))
            self.sm.current = 'gcode'

            level = LOG_LEVELS.get('debug') if len(sys.argv) > 2 else LOG_LEVELS.get('info')
            Logger.setLevel(level=level)
            # logging.getLogger().setLevel(logging.DEBUG)
            return self.sm 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:14,代码来源:viewer.py

示例15: _read_stream

# 需要导入模块: from kivy.logger import Logger [as 别名]
# 或者: from kivy.logger.Logger import info [as 别名]
def _read_stream(self):
        try:
            stream = urllib.request.urlopen(self.url)
        except Exception as err:
            self.quit = True
            Logger.error("MjpegViewer: Failed to open url: {} - error: {}".format(self.url, err))
            return None

        Logger.info("MjpegViewer: started thread")
        bytes = b''
        while not self.quit:
            try:
                # read in stream until we get the entire frame
                bytes += stream.read(1024)
                a = bytes.find(b'\xff\xd8')
                b = bytes.find(b'\xff\xd9')
                if a != -1 and b != -1:
                    jpg = bytes[a:b + 2]
                    bytes = bytes[b + 2:]

                    data = io.BytesIO(jpg)
                    im = CoreImage(data, ext="jpeg", nocache=True)
                    self.update_image(im)

            except Exception as err:
                Logger.error("MjpegViewer: Failed to read_queue url: {} - error: {}".format(self.url, err))
                return None
        Logger.info("MjpegViewer: ending thread") 
开发者ID:wolfmanjm,项目名称:kivy-smoothie-host,代码行数:30,代码来源:camera_screen.py


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