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


Python comments_editor.Editor类代码示例

本文整理汇总了Python中calibre.gui2.comments_editor.Editor的典型用法代码示例。如果您正苦于以下问题:Python Editor类的具体用法?Python Editor怎么用?Python Editor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Comments

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)
        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 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
开发者ID:089git,项目名称:calibre,代码行数:26,代码来源:custom_column_widgets.py

示例2: Comments

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 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)
开发者ID:bwhitenb5e,项目名称:calibre,代码行数:35,代码来源:custom_column_widgets.py

示例3: Ui_CommentsDialog

class Ui_CommentsDialog(object):
    def setupUi(self, CommentsDialog):
        CommentsDialog.setObjectName(_fromUtf8("CommentsDialog"))
        CommentsDialog.resize(400, 400)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.MinimumExpanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(CommentsDialog.sizePolicy().hasHeightForWidth())
        CommentsDialog.setSizePolicy(sizePolicy)
        self.verticalLayout = QtGui.QVBoxLayout(CommentsDialog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.textbox = Editor(CommentsDialog)
        self.textbox.setObjectName(_fromUtf8("textbox"))
        self.verticalLayout.addWidget(self.textbox)
        self.buttonBox = QtGui.QDialogButtonBox(CommentsDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(CommentsDialog)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), CommentsDialog.accept)
        QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), CommentsDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(CommentsDialog)

    def retranslateUi(self, CommentsDialog):
        CommentsDialog.setWindowTitle(_("Edit Comments"))
开发者ID:Eksmo,项目名称:calibre,代码行数:27,代码来源:comments_dialog_ui.py

示例4: __init__

 def __init__(self, field, is_new, parent, metadata, extra):
     Editor.__init__(self, parent, one_line_toolbar=False)
     self.is_new = is_new
     self.field = field
     self.metadata = metadata
     self.hide_tabs()
     if not is_new:
         self.hide_toolbars()
         self.set_readonly(True)
开发者ID:bjhemens,项目名称:calibre,代码行数:9,代码来源:diff.py

示例5: setup_ui

 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]
开发者ID:aimylios,项目名称:calibre,代码行数:10,代码来源:custom_column_widgets.py

示例6: setup_ui

 def setup_ui(self, parent):
     self._box = QGroupBox(parent)
     self._box.setTitle("&" + self.col_metadata["name"])
     self._layout = QVBoxLayout()
     self._tb = CommentsEditor(self._box)
     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]
开发者ID:GaryMMugford,项目名称:calibre,代码行数:10,代码来源:custom_column_widgets.py

示例7: Comments

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)
开发者ID:aimylios,项目名称:calibre,代码行数:41,代码来源:custom_column_widgets.py

示例8: setupUi


#.........这里部分代码省略.........
        self._7.addWidget(self.label, 0, 0, 1, 1)
        self.title = EnLineEdit(Form)
        self.title.setToolTip(_("Change the title of this book"))
        self.title.setObjectName(_fromUtf8("title"))
        self._7.addWidget(self.title, 0, 1, 1, 1)
        self.label_2 = QtGui.QLabel(Form)
        self.label_2.setText(_("&Author(s): "))
        self.label_2.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self._7.addWidget(self.label_2, 1, 0, 1, 1)
        self.label_6 = QtGui.QLabel(Form)
        self.label_6.setText(_("Author So&rt:"))
        self.label_6.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self._7.addWidget(self.label_6, 2, 0, 1, 1)
        self.author_sort = EnLineEdit(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.author_sort.sizePolicy().hasHeightForWidth())
        self.author_sort.setSizePolicy(sizePolicy)
        self.author_sort.setToolTip(
            _("Change the author(s) of this book. Multiple authors should be separated by a comma")
        )
        self.author_sort.setObjectName(_fromUtf8("author_sort"))
        self._7.addWidget(self.author_sort, 2, 1, 1, 1)
        self.label_3 = QtGui.QLabel(Form)
        self.label_3.setText(_("&Publisher: "))
        self.label_3.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self._7.addWidget(self.label_3, 3, 0, 1, 1)
        self.label_4 = QtGui.QLabel(Form)
        self.label_4.setText(_("Ta&gs: "))
        self.label_4.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self._7.addWidget(self.label_4, 4, 0, 1, 1)
        self.tags = EditWithComplete(Form)
        self.tags.setToolTip(
            _(
                "Tags categorize the book. This is particularly useful while searching. <br><br>They can be any words or phrases, separated by commas."
            )
        )
        self.tags.setObjectName(_fromUtf8("tags"))
        self._7.addWidget(self.tags, 4, 1, 1, 1)
        self.label_7 = QtGui.QLabel(Form)
        self.label_7.setText(_("&Series:"))
        self.label_7.setTextFormat(QtCore.Qt.PlainText)
        self.label_7.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self._7.addWidget(self.label_7, 5, 0, 1, 1)
        self.series = EditWithComplete(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(10)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.series.sizePolicy().hasHeightForWidth())
        self.series.setSizePolicy(sizePolicy)
        self.series.setToolTip(_("List of known series. You can add new series."))
        self.series.setWhatsThis(_("List of known series. You can add new series."))
        self.series.setEditable(True)
        self.series.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically)
        self.series.setObjectName(_fromUtf8("series"))
        self._7.addWidget(self.series, 5, 1, 1, 1)
        self.series_index = QtGui.QDoubleSpinBox(Form)
        self.series_index.setPrefix(_("Book "))
        self.series_index.setMaximum(9999999999.99)
        self.series_index.setProperty("value", 1.0)
        self.series_index.setObjectName(_fromUtf8("series_index"))
        self._7.addWidget(self.series_index, 6, 1, 1, 1)
        self.publisher = EditWithComplete(Form)
        self.publisher.setEditable(True)
        self.publisher.setObjectName(_fromUtf8("publisher"))
        self._7.addWidget(self.publisher, 3, 1, 1, 1)
        self.author = EditWithComplete(Form)
        self.author.setEditable(True)
        self.author.setObjectName(_fromUtf8("author"))
        self._7.addWidget(self.author, 1, 1, 1, 1)
        self.verticalLayout_2.addLayout(self._7)
        self.comment = Editor(Form)
        self.comment.setObjectName(_fromUtf8("comment"))
        self.verticalLayout_2.addWidget(self.comment)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.label_5.setBuddy(self.cover_path)
        self.label.setBuddy(self.title)
        self.label_2.setBuddy(self.author)
        self.label_6.setBuddy(self.author_sort)
        self.label_3.setBuddy(self.publisher)
        self.label_4.setBuddy(self.tags)
        self.label_7.setBuddy(self.series)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
        Form.setTabOrder(self.title, self.author)
        Form.setTabOrder(self.author, self.author_sort)
        Form.setTabOrder(self.author_sort, self.publisher)
        Form.setTabOrder(self.publisher, self.tags)
        Form.setTabOrder(self.tags, self.series)
        Form.setTabOrder(self.series, self.series_index)
        Form.setTabOrder(self.series_index, self.cover_path)
        Form.setTabOrder(self.cover_path, self.cover_button)
        Form.setTabOrder(self.cover_button, self.opt_prefer_metadata_cover)
开发者ID:yeyanchao,项目名称:calibre,代码行数:101,代码来源:metadata_ui.py

示例9: setupUi


#.........这里部分代码省略.........
        self.cover = ImageView(self.groupBox_4)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.cover.sizePolicy().hasHeightForWidth())
        self.cover.setSizePolicy(sizePolicy)
        self.cover.setObjectName(_fromUtf8("cover"))
        self._3.addWidget(self.cover)
        self._2.addLayout(self._3, 0, 0, 1, 1)
        self.horizontalLayout.addWidget(self.groupBox_4)
        self.verticalLayout_2 = QtGui.QVBoxLayout()
        self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2"))
        self._7 = QtGui.QGridLayout()
        self._7.setObjectName(_fromUtf8("_7"))
        self.label = QtGui.QLabel(Form)
        self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label.setObjectName(_fromUtf8("label"))
        self._7.addWidget(self.label, 0, 0, 1, 1)
        self.title = EnLineEdit(Form)
        self.title.setObjectName(_fromUtf8("title"))
        self._7.addWidget(self.title, 0, 1, 1, 1)
        self.label_2 = QtGui.QLabel(Form)
        self.label_2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self._7.addWidget(self.label_2, 1, 0, 1, 1)
        self.label_6 = QtGui.QLabel(Form)
        self.label_6.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self._7.addWidget(self.label_6, 2, 0, 1, 1)
        self.author_sort = EnLineEdit(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.author_sort.sizePolicy().hasHeightForWidth())
        self.author_sort.setSizePolicy(sizePolicy)
        self.author_sort.setObjectName(_fromUtf8("author_sort"))
        self._7.addWidget(self.author_sort, 2, 1, 1, 1)
        self.label_3 = QtGui.QLabel(Form)
        self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self._7.addWidget(self.label_3, 3, 0, 1, 1)
        self.label_4 = QtGui.QLabel(Form)
        self.label_4.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self._7.addWidget(self.label_4, 4, 0, 1, 1)
        self.tags = EditWithComplete(Form)
        self.tags.setObjectName(_fromUtf8("tags"))
        self._7.addWidget(self.tags, 4, 1, 1, 1)
        self.label_7 = QtGui.QLabel(Form)
        self.label_7.setTextFormat(QtCore.Qt.PlainText)
        self.label_7.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self._7.addWidget(self.label_7, 5, 0, 1, 1)
        self.series = EditWithComplete(Form)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(10)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.series.sizePolicy().hasHeightForWidth())
        self.series.setSizePolicy(sizePolicy)
        self.series.setEditable(True)
        self.series.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically)
        self.series.setObjectName(_fromUtf8("series"))
        self._7.addWidget(self.series, 5, 1, 1, 1)
        self.series_index = QtGui.QDoubleSpinBox(Form)
        self.series_index.setMaximum(9999999999.99)
        self.series_index.setProperty("value", 1.0)
        self.series_index.setObjectName(_fromUtf8("series_index"))
        self._7.addWidget(self.series_index, 6, 1, 1, 1)
        self.publisher = EditWithComplete(Form)
        self.publisher.setEditable(True)
        self.publisher.setObjectName(_fromUtf8("publisher"))
        self._7.addWidget(self.publisher, 3, 1, 1, 1)
        self.author = EditWithComplete(Form)
        self.author.setEditable(True)
        self.author.setObjectName(_fromUtf8("author"))
        self._7.addWidget(self.author, 1, 1, 1, 1)
        self.verticalLayout_2.addLayout(self._7)
        self.comment = Editor(Form)
        self.comment.setObjectName(_fromUtf8("comment"))
        self.verticalLayout_2.addWidget(self.comment)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.label_5.setBuddy(self.cover_path)
        self.label.setBuddy(self.title)
        self.label_2.setBuddy(self.author)
        self.label_6.setBuddy(self.author_sort)
        self.label_3.setBuddy(self.publisher)
        self.label_4.setBuddy(self.tags)
        self.label_7.setBuddy(self.series)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
        Form.setTabOrder(self.title, self.author)
        Form.setTabOrder(self.author, self.author_sort)
        Form.setTabOrder(self.author_sort, self.publisher)
        Form.setTabOrder(self.publisher, self.tags)
        Form.setTabOrder(self.tags, self.series)
        Form.setTabOrder(self.series, self.series_index)
        Form.setTabOrder(self.series_index, self.cover_path)
        Form.setTabOrder(self.cover_path, self.cover_button)
        Form.setTabOrder(self.cover_button, self.opt_prefer_metadata_cover)
开发者ID:Eksmo,项目名称:calibre,代码行数:101,代码来源:metadata_ui.py


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