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


Python MonoTextView.setText方法代码示例

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


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

示例1: LogView

# 需要导入模块: from cola.widgets.text import MonoTextView [as 别名]
# 或者: from cola.widgets.text.MonoTextView import setText [as 别名]
class LogView(QtGui.QWidget):
    """A simple dialog to display command logs."""
    def __init__(self, parent=None, output=None):
        QtGui.QWidget.__init__(self, parent)

        self._layout = QtGui.QVBoxLayout(self)
        self._layout.setMargin(0)

        self.output_text = MonoTextView(self)
        self._layout.addWidget(self.output_text)
        if output:
            self.set_output(output)

    def clear(self):
        self.output_text.clear()

    def set_output(self, output):
        self.output_text.setText(output)

    def log(self, status, output):
        if not output:
            return
        cursor = self.output_text.textCursor()
        cursor.movePosition(cursor.End)
        text = self.output_text
        cursor.insertText(time.asctime() + '\n')
        for line in unicode(core.decode(output)).splitlines():
            cursor.insertText(line + '\n')
        cursor.insertText('\n')
        cursor.movePosition(cursor.End)
        text.setTextCursor(cursor)
开发者ID:SecuraPaWn,项目名称:git-cola,代码行数:33,代码来源:log.py

示例2: LogWidget

# 需要导入模块: from cola.widgets.text import MonoTextView [as 别名]
# 或者: from cola.widgets.text.MonoTextView import setText [as 别名]
class LogWidget(QtGui.QWidget):
    """A simple dialog to display command logs."""
    def __init__(self, parent=None, output=None):
        QtGui.QWidget.__init__(self, parent)

        self.output_text = MonoTextView(self)
        if output:
            self.set_output(output)
        self.main_layout = qtutils.vbox(defs.no_margin, defs.spacing,
                                        self.output_text)
        self.setLayout(self.main_layout)
        self.connect(self, SIGNAL('log'), self.log)

    def clear(self):
        self.output_text.clear()

    def set_output(self, output):
        self.output_text.setText(output)

    def log_status(self, status, out, err=None):
        msg = []
        if out:
            msg.append(out)
        if err:
            msg.append(err)
        if status:
            msg.append(N_('exit code %s') % status)
        self.log('\n'.join(msg))

    def log(self, msg):
        if not msg:
            return
        cursor = self.output_text.textCursor()
        cursor.movePosition(cursor.End)
        text = self.output_text
        cursor.insertText(time.asctime() + '\n')
        for line in msg.splitlines():
            cursor.insertText(line + '\n')
        cursor.insertText('\n')
        cursor.movePosition(cursor.End)
        text.setTextCursor(cursor)

    def safe_log(self, msg):
        """A version of the log() method that can be called from other
        threads."""
        self.emit(SIGNAL('log'), msg)
开发者ID:007durgesh219,项目名称:git-cola,代码行数:48,代码来源:log.py

示例3: LogWidget

# 需要导入模块: from cola.widgets.text import MonoTextView [as 别名]
# 或者: from cola.widgets.text.MonoTextView import setText [as 别名]
class LogWidget(QtGui.QWidget):
    """A simple dialog to display command logs."""

    def __init__(self, parent=None, output=None):
        QtGui.QWidget.__init__(self, parent)

        self._layout = QtGui.QVBoxLayout(self)
        self._layout.setMargin(0)

        self.output_text = MonoTextView(self)
        self._layout.addWidget(self.output_text)
        if output:
            self.set_output(output)

    def clear(self):
        self.output_text.clear()

    def set_output(self, output):
        self.output_text.setText(output)

    def log_status(self, status, out, err=None):
        msg = out
        if err:
            msg += "\n" + err
        if status != 0:
            msg += "\n"
            msg += N_("exit code %s") % status
        self.log(msg)

    def log(self, msg):
        if not msg:
            return
        cursor = self.output_text.textCursor()
        cursor.movePosition(cursor.End)
        text = self.output_text
        cursor.insertText(time.asctime() + "\n")
        for line in msg.splitlines():
            cursor.insertText(line + "\n")
        cursor.insertText("\n")
        cursor.movePosition(cursor.End)
        text.setTextCursor(cursor)
开发者ID:jmvrbanac,项目名称:git-cola,代码行数:43,代码来源:log.py

示例4: LogWidget

# 需要导入模块: from cola.widgets.text import MonoTextView [as 别名]
# 或者: from cola.widgets.text.MonoTextView import setText [as 别名]
class LogWidget(QtGui.QWidget):
    """A simple dialog to display command logs."""
    def __init__(self, parent=None, output=None):
        QtGui.QWidget.__init__(self, parent)

        self._layout = QtGui.QVBoxLayout(self)
        self._layout.setMargin(defs.no_margin)

        self.output_text = MonoTextView(self)
        self._layout.addWidget(self.output_text)
        if output:
            self.set_output(output)

    def clear(self):
        self.output_text.clear()

    def set_output(self, output):
        self.output_text.setText(output)

    def log_status(self, status, out, err=None):
        msg = []
        if out:
            msg.append(out)
        if err:
            msg.append(err)
        if status:
            msg.append(N_('exit code %s') % status)
        self.log('\n'.join(msg))

    def log(self, msg):
        if not msg:
            return
        cursor = self.output_text.textCursor()
        cursor.movePosition(cursor.End)
        text = self.output_text
        cursor.insertText(time.asctime() + '\n')
        for line in msg.splitlines():
            cursor.insertText(line + '\n')
        cursor.insertText('\n')
        cursor.movePosition(cursor.End)
        text.setTextCursor(cursor)
开发者ID:jmdcal,项目名称:git-cola,代码行数:43,代码来源:log.py


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