本文整理汇总了Python中cola.widgets.text.MonoTextView.setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Python MonoTextView.setReadOnly方法的具体用法?Python MonoTextView.setReadOnly怎么用?Python MonoTextView.setReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cola.widgets.text.MonoTextView
的用法示例。
在下文中一共展示了MonoTextView.setReadOnly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AboutView
# 需要导入模块: from cola.widgets.text import MonoTextView [as 别名]
# 或者: from cola.widgets.text.MonoTextView import setReadOnly [as 别名]
class AboutView(QtGui.QDialog):
"""Provides the git-cola 'About' dialog.
"""
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setWindowTitle(N_('About git-cola'))
self.setWindowModality(Qt.WindowModal)
self.label = QtGui.QLabel()
self.pixmap = QtGui.QPixmap('icons:logo-top.png')
#self.label.setStyleSheet('QWidget {background: #000; }')
self.label.setPixmap(self.pixmap)
self.label.setAlignment(Qt.AlignRight | Qt.AlignTop)
palette = self.label.palette()
palette.setColor(QtGui.QPalette.Window, Qt.black)
self.label.setAutoFillBackground(True)
self.label.setPalette(palette)
self.text = MonoTextView(self)
self.text.setReadOnly(True)
self.text.setPlainText(COPYRIGHT)
self.close_button = QtGui.QPushButton()
self.close_button.setText(N_('Close'))
self.close_button.setDefault(True)
self.button_layout = QtGui.QHBoxLayout()
self.button_layout.addStretch()
self.button_layout.addWidget(self.close_button)
self.main_layout = QtGui.QVBoxLayout()
self.main_layout.setMargin(defs.no_margin)
self.main_layout.setSpacing(defs.spacing)
self.main_layout.addWidget(self.label)
self.main_layout.addWidget(self.text)
self.main_layout.addLayout(self.button_layout)
self.setLayout(self.main_layout)
self.resize(666, 420)
qtutils.connect_button(self.close_button, self.accept)
def set_version(self, version):
"""Sets the version field in the 'about' dialog"""
self.text.setPlainText(self.text.toPlainText().replace('$VERSION', version))