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


Python Log.outputs方法代码示例

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


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

示例1: setup_pipeline

# 需要导入模块: from calibre.utils.logging import Log [as 别名]
# 或者: from calibre.utils.logging.Log import outputs [as 别名]
    def setup_pipeline(self, *args):
        oidx = self.groups.currentIndex().row()
        input_format = self.input_format
        output_format = self.output_format
        output_path = 'dummy.'+output_format
        log = Log()
        log.outputs = []
        input_file = 'dummy.'+input_format
        if input_format in ARCHIVE_FMTS:
            input_file = 'dummy.html'
        self.plumber = Plumber(input_file, output_path, log)

        def widget_factory(cls):
            return cls(self.stack, self.plumber.get_option_by_name,
                self.plumber.get_option_help, self.db, self.book_id)

        self.mw = widget_factory(MetadataWidget)
        self.setWindowTitle(_('Convert')+ ' ' + unicode(self.mw.title.text()))
        lf = widget_factory(LookAndFeelWidget)
        hw = widget_factory(HeuristicsWidget)
        sr = widget_factory(SearchAndReplaceWidget)
        ps = widget_factory(PageSetupWidget)
        sd = widget_factory(StructureDetectionWidget)
        toc = widget_factory(TOCWidget)
        from calibre.gui2.actions.toc_edit import SUPPORTED
        toc.manually_fine_tune_toc.setVisible(output_format.upper() in SUPPORTED)
        debug = widget_factory(DebugWidget)

        output_widget = self.plumber.output_plugin.gui_configuration_widget(
                self.stack, self.plumber.get_option_by_name,
                self.plumber.get_option_help, self.db, self.book_id)
        input_widget = self.plumber.input_plugin.gui_configuration_widget(
                self.stack, self.plumber.get_option_by_name,
                self.plumber.get_option_help, self.db, self.book_id)
        while True:
            c = self.stack.currentWidget()
            if not c:
                break
            self.stack.removeWidget(c)

        widgets = [self.mw, lf, hw, ps, sd, toc, sr]
        if input_widget is not None:
            widgets.append(input_widget)
        if output_widget is not None:
            widgets.append(output_widget)
        widgets.append(debug)
        for w in widgets:
            self.stack.addWidget(w)
            w.set_help_signal.connect(self.help.setPlainText)

        self._groups_model = GroupModel(widgets)
        self.groups.setModel(self._groups_model)

        idx = oidx if -1 < oidx < self._groups_model.rowCount() else 0
        self.groups.setCurrentIndex(self._groups_model.index(idx))
        self.stack.setCurrentIndex(idx)
        try:
            shutil.rmtree(self.plumber.archive_input_tdir, ignore_errors=True)
        except:
            pass
开发者ID:Hainish,项目名称:calibre,代码行数:62,代码来源:single.py

示例2: complete

# 需要导入模块: from calibre.utils.logging import Log [as 别名]
# 或者: from calibre.utils.logging.Log import outputs [as 别名]
 def complete(self, wc):
     if wc == 2:
         self.complete_input()
     elif wc == 3:
         self.complete_output()
     else:
         q = list(self.words[1:3])
         q = [os.path.splitext(x)[0 if x.startswith('.') else 1].partition('.')[-1].lower() for x in q]
         if not q[1]:
             q[1] = 'oeb'
         q = tuple(q)
         if q in self.cache:
             ans = [x for x in self.cache[q] if x.startswith(self.prefix)]
         else:
             from calibre.ebooks.conversion.cli import create_option_parser
             from calibre.utils.logging import Log
             log = Log()
             log.outputs = []
             ans = []
             if not self.prefix or self.prefix.startswith('-'):
                 try:
                     parser, _ = create_option_parser(self.words[:3], log)
                     ans += list(get_opts_from_parser(parser, self.prefix))
                 except:
                     pass
         if self.previous.startswith('-'):
             ans += list(files_and_dirs(self.prefix, None))
         send(ans)
开发者ID:MarioJC,项目名称:calibre,代码行数:30,代码来源:complete.py

示例3: __init__

# 需要导入模块: from calibre.utils.logging import Log [as 别名]
# 或者: from calibre.utils.logging.Log import outputs [as 别名]
 def __init__(self, files):
     s = Stream()
     self.log_stream = s.stream
     log = Log()
     log.outputs = [s]
     ContainerBase.__init__(self, log=log)
     self.mime_map = {k:self.guess_type(k) for k in files}
     self.files = files
开发者ID:AEliu,项目名称:calibre,代码行数:10,代码来源:cascade.py

示例4: setup_pipeline

# 需要导入模块: from calibre.utils.logging import Log [as 别名]
# 或者: from calibre.utils.logging.Log import outputs [as 别名]
    def setup_pipeline(self, *args):
        oidx = self.groups.currentIndex().row()
        output_format = self.output_format

        input_path = 'dummy.epub'
        output_path = 'dummy.'+output_format
        log = Log()
        log.outputs = []
        self.plumber = Plumber(input_path, output_path, log,
                merge_plugin_recs=False)

        def widget_factory(cls):
            return cls(self.stack, self.plumber.get_option_by_name,
                self.plumber.get_option_help, self.db)

        self.setWindowTitle(_('Bulk Convert'))
        lf = widget_factory(LookAndFeelWidget)
        hw = widget_factory(HeuristicsWidget)
        sr = widget_factory(SearchAndReplaceWidget)
        ps = widget_factory(PageSetupWidget)
        sd = widget_factory(StructureDetectionWidget)
        toc = widget_factory(TOCWidget)

        output_widget = None
        name = self.plumber.output_plugin.name.lower().replace(' ', '_')
        try:
            output_widget = importlib.import_module(
                    'calibre.gui2.convert.'+name)
            pw = output_widget.PluginWidget
            pw.ICON = I('back.png')
            pw.HELP = _('Options specific to the output format.')
            output_widget = widget_factory(pw)
        except ImportError:
            pass

        while True:
            c = self.stack.currentWidget()
            if not c: break
            self.stack.removeWidget(c)

        widgets = [lf, hw, ps, sd, toc, sr]
        if output_widget is not None:
            widgets.append(output_widget)
        for w in widgets:
            self.stack.addWidget(w)
            self.connect(w, SIGNAL('set_help(PyQt_PyObject)'),
                    self.help.setPlainText)

        self._groups_model = GroupModel(widgets)
        self.groups.setModel(self._groups_model)

        idx = oidx if -1 < oidx < self._groups_model.rowCount() else 0
        self.groups.setCurrentIndex(self._groups_model.index(idx))
        self.stack.setCurrentIndex(idx)
        try:
            shutil.rmtree(self.plumber.archive_input_tdir, ignore_errors=True)
        except:
            pass
开发者ID:Eksmo,项目名称:calibre,代码行数:60,代码来源:bulk.py

示例5: setup_pipeline

# 需要导入模块: from calibre.utils.logging import Log [as 别名]
# 或者: from calibre.utils.logging.Log import outputs [as 别名]
    def setup_pipeline(self, *args):
        oidx = self.groups.currentIndex().row()
        output_format = self.output_format

        input_path = 'dummy.epub'
        output_path = 'dummy.'+output_format
        log = Log()
        log.outputs = []
        self.plumber = Plumber(input_path, output_path, log,
                merge_plugin_recs=False)

        def widget_factory(cls):
            return cls(self.stack, self.plumber.get_option_by_name,
                self.plumber.get_option_help, self.db)

        self.setWindowTitle(_('Bulk Convert'))
        lf = widget_factory(LookAndFeelWidget)
        hw = widget_factory(HeuristicsWidget)
        sr = widget_factory(SearchAndReplaceWidget)
        ps = widget_factory(PageSetupWidget)
        sd = widget_factory(StructureDetectionWidget)
        toc = widget_factory(TOCWidget)
        toc.manually_fine_tune_toc.hide()

        output_widget = self.plumber.output_plugin.gui_configuration_widget(
                self.stack, self.plumber.get_option_by_name,
                self.plumber.get_option_help, self.db)

        while True:
            c = self.stack.currentWidget()
            if not c:
                break
            self.stack.removeWidget(c)

        widgets = [lf, hw, ps, sd, toc, sr]
        if output_widget is not None:
            widgets.append(output_widget)
        for w in widgets:
            self.stack.addWidget(w)
            self.connect(w, SIGNAL('set_help(PyQt_PyObject)'),
                    self.help.setPlainText)

        self._groups_model = GroupModel(widgets)
        self.groups.setModel(self._groups_model)

        idx = oidx if -1 < oidx < self._groups_model.rowCount() else 0
        self.groups.setCurrentIndex(self._groups_model.index(idx))
        self.stack.setCurrentIndex(idx)
        try:
            shutil.rmtree(self.plumber.archive_input_tdir, ignore_errors=True)
        except:
            pass
开发者ID:089git,项目名称:calibre,代码行数:54,代码来源:bulk.py

示例6: genesis

# 需要导入模块: from calibre.utils.logging import Log [as 别名]
# 或者: from calibre.utils.logging.Log import outputs [as 别名]
    def genesis(self, gui):
        log = Log()
        log.outputs = []

        self.plumber = Plumber('dummy.epub', 'dummy.epub', log, dummy=True,
                merge_plugin_recs=False)

        def widget_factory(cls):
            return cls(self, self.plumber.get_option_by_name,
                self.plumber.get_option_help, None, None)

        self.load_conversion_widgets()
        widgets = list(map(widget_factory, self.conversion_widgets))
        self.model = Model(widgets)
        self.list.setModel(self.model)

        for w in widgets:
            w.changed_signal.connect(self.changed_signal)
            self.stack.addWidget(w)

        self.list.currentChanged = self.category_current_changed
        self.list.setCurrentIndex(self.model.index(0))
开发者ID:Eksmo,项目名称:calibre,代码行数:24,代码来源:conversion.py


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