本文整理匯總了Python中calibre.gui2.comments_editor.Editor.set_base_url方法的典型用法代碼示例。如果您正苦於以下問題:Python Editor.set_base_url方法的具體用法?Python Editor.set_base_url怎麽用?Python Editor.set_base_url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類calibre.gui2.comments_editor.Editor
的用法示例。
在下文中一共展示了Editor.set_base_url方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Comments
# 需要導入模塊: from calibre.gui2.comments_editor import Editor [as 別名]
# 或者: from calibre.gui2.comments_editor.Editor import set_base_url [as 別名]
class Comments(Base):
def setup_ui(self, parent):
self._box = QGroupBox(parent)
self._box.setTitle('&'+self.col_metadata['name'])
self._layout = QVBoxLayout()
self._tb = CommentsEditor(self._box, toolbar_prefs_name=u'metadata-comments-editor-widget-hidden-toolbars')
self._tb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
# self._tb.setTabChangesFocus(True)
self._layout.addWidget(self._tb)
self._box.setLayout(self._layout)
self.widgets = [self._box]
def initialize(self, book_id):
path = self.db.abspath(book_id, index_is_id=True)
if path:
self._tb.set_base_url(QUrl.fromLocalFile(os.path.join(path, 'metadata.html')))
return Base.initialize(self, book_id)
def setter(self, val):
if not val or not val.strip():
val = ''
else:
val = comments_to_html(val)
self._tb.html = val
self._tb.wyswyg_dirtied()
def getter(self):
val = unicode(self._tb.html).strip()
if not val:
val = None
return val
@dynamic_property
def tab(self):
def fget(self):
return self._tb.tab
def fset(self, val):
self._tb.tab = val
return property(fget=fget, fset=fset)