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


Python QTextBrowser.setPlainText方法代码示例

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


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

示例1: MovieRewindDialog

# 需要导入模块: from PyQt4.Qt import QTextBrowser [as 别名]
# 或者: from PyQt4.Qt.QTextBrowser import setPlainText [as 别名]
class MovieRewindDialog(QDialog):

    def __init__(self, movie):
        self.movie = movie
        QDialog.__init__(self, None)
        self.setObjectName("movie_warning")
        self.text_browser = QTextBrowser(self)
        self.text_browser.setObjectName("movie_warning_textbrowser")
        self.text_browser.setMinimumSize(400, 40)
        self.setWindowTitle('Rewind your movie?')
        self.text_browser.setPlainText(
            "You may want to rewind the movie now. If you save the part without " +
            "rewinding the movie, the movie file will become invalid because it " +
            "depends upon the initial atom positions. The atoms move as the movie " +
            "progresses, and saving the part now will save the final positions, " +
            "which are incorrect for the movie you just watched.")
        self.ok_button = QPushButton(self)
        self.ok_button.setObjectName("ok_button")
        self.ok_button.setText("Rewind movie")
        self.cancel_button = QPushButton(self)
        self.cancel_button.setObjectName("cancel_button")
        self.cancel_button.setText("No thanks")
        layout = QGridLayout(self)
        layout.addWidget(self.text_browser,0,0,0,1)
        layout.addWidget(self.ok_button,1,0)
        layout.addWidget(self.cancel_button,1,1)
        self.connect(self.ok_button,SIGNAL("clicked()"),self.rewindMovie)
        self.connect(self.cancel_button,SIGNAL("clicked()"),self.noThanks)
    def rewindMovie(self):
        self.movie._reset()
        self.accept()
    def noThanks(self):
        self.accept()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:35,代码来源:movieMode.py

示例2: _MovieRewindDialog

# 需要导入模块: from PyQt4.Qt import QTextBrowser [as 别名]
# 或者: from PyQt4.Qt.QTextBrowser import setPlainText [as 别名]
class _MovieRewindDialog(QDialog):
    """
    Warn the user that a given movie is not rewound,
    explain why that matters, and offer to rewind it
    (by calling its _reset method).
    """
    def __init__(self, movie):
        self.movie = movie
        QDialog.__init__(self, None)
        self.setObjectName("movie_warning")
        self.text_browser = QTextBrowser(self)
        self.text_browser.setObjectName("movie_warning_textbrowser")
        self.text_browser.setMinimumSize(400, 40)
        self.setWindowTitle('Rewind your movie?')
        self.text_browser.setPlainText( #bruce 080827 revised text
            "You may want to rewind the movie now. The atoms move as the movie "
            "progresses, and saving the part without rewinding will save the "
            "current positions, which is sometimes useful, but will make the "
            "movie invalid, because .dpb files only store deltas relative to "
            "the initial atom positions, and don't store the initial positions "
            "themselves." )
        self.ok_button = QPushButton(self)
        self.ok_button.setObjectName("ok_button")
        self.ok_button.setText("Rewind movie")
        self.cancel_button = QPushButton(self)
        self.cancel_button.setObjectName("cancel_button")
        self.cancel_button.setText("Exit command without rewinding") #bruce 080827 revised text
            # Note: this is not, in fact, a cancel button --
            # there is no option in the caller to prevent exiting the command.
            # There is also no option to "forward to final position",
            # though for a minimize movie, that might be most useful.
            # [bruce 080827 comment]
        layout = QGridLayout(self)
        layout.addWidget(self.text_browser, 0, 0, 0, 1)
        layout.addWidget(self.ok_button, 1, 0)
        layout.addWidget(self.cancel_button, 1, 1)
        self.connect(self.ok_button, SIGNAL("clicked()"), self.rewindMovie)
        self.connect(self.cancel_button, SIGNAL("clicked()"), self.noThanks)
    def rewindMovie(self):
        self.movie._reset()
        self.accept()
    def noThanks(self):
        self.accept()
    pass
开发者ID:elfion,项目名称:nanoengineer,代码行数:46,代码来源:movieMode.py

示例3: PermissionDialog

# 需要导入模块: from PyQt4.Qt import QTextBrowser [as 别名]
# 或者: from PyQt4.Qt.QTextBrowser import setPlainText [as 别名]
class PermissionDialog(QDialog, threading.Thread):

    # Politely explain what we're doing as clearly as possible. This will be the
    # user's first experience of the sponsorship system and we want to use the
    # Google axiom of "Don't be evil".
    text = ("We would like to use your network connection to update a list of our " +
            "sponsors. This enables us to recoup some of our development costs " +
            "by putting buttons with sponsor logos on some dialogs. If you click " +
            "on a sponsor logo button, you will get a small window with some " +
            "information about that sponsor. May we do this? Otherwise we'll " +
            "just use buttons with our own Nanorex logo.")

    def __init__(self, win):
        self.xmlfile = os.path.join(_sponsordir, 'sponsors.xml')
        self.win = win

        self.needToAsk = False
        self.downloadSponsors = False
        threading.Thread.__init__(self)

        if not self.refreshWanted():
            return
        if env.prefs[sponsor_permanent_permission_prefs_key]:
            # We have a permanent answer so no need for a dialog
            if env.prefs[sponsor_download_permission_prefs_key]:
                self.downloadSponsors = True
            return

        self.needToAsk = True
        QDialog.__init__(self, None)
        self.setObjectName("Permission")
        self.setModal(True) #This fixes bug 2296. Mitigates bug 2297
        layout = QGridLayout()
        self.setLayout(layout)
        layout.setMargin(0)
        layout.setSpacing(0)
        layout.setObjectName("PermissionLayout")
        self.text_browser = QTextBrowser(self)
        self.text_browser.setObjectName("text_browser")
        layout.addWidget(self.text_browser,0,0,1,4)
        self.text_browser.setMinimumSize(400, 80)
        self.setWindowTitle('May we use your network connection?')
        self.setWindowIcon(geticon('ui/border/MainWindow.png'))
        self.text_browser.setPlainText(self.text)
        self.accept_button = QPushButton(self)
        self.accept_button.setObjectName("accept_button")
        self.accept_button.setText("Always OK")
        self.accept_once_button = QPushButton(self)
        self.accept_once_button.setObjectName("accept_once_button")
        self.accept_once_button.setText("OK now")
        self.decline_once_button = QPushButton(self)
        self.decline_once_button.setObjectName("decline_once_button")
        self.decline_once_button.setText("Not now")
        self.decline_always_button = QPushButton(self)
        self.decline_always_button.setObjectName("decline_always_button")
        self.decline_always_button.setText("Never")
        layout.addWidget(self.accept_button,1,0)
        layout.addWidget(self.accept_once_button,1,1)
        layout.addWidget(self.decline_once_button,1,2)
        layout.addWidget(self.decline_always_button,1,3)
        self.connect(self.accept_button,SIGNAL("clicked()"),self.acceptAlways)
        self.connect(self.accept_once_button,SIGNAL("clicked()"),self.acceptJustOnce)
        self.connect(self.decline_once_button,SIGNAL("clicked()"),self.declineJustOnce)
        self.connect(self.decline_always_button,SIGNAL("clicked()"),self.declineAlways)

    def acceptAlways(self):
        env.prefs[sponsor_download_permission_prefs_key] = True
        env.prefs[sponsor_permanent_permission_prefs_key] = True
        self.downloadSponsors = True
        self.close()

    def acceptJustOnce(self):
        env.prefs[sponsor_permanent_permission_prefs_key] = False
        self.downloadSponsors = True
        self.close()

    def declineAlways(self):
        env.prefs[sponsor_download_permission_prefs_key] = False
        env.prefs[sponsor_permanent_permission_prefs_key] = True
        self.close()

    def declineJustOnce(self):
        env.prefs[sponsor_permanent_permission_prefs_key] = False
        self.close()


    def run(self):
        #
        # Implements superclass's threading.Thread.run() function
        #
        if self.downloadSponsors:
            _download_xml_file(self.xmlfile)
        self.finish()
        env.prefs[sponsor_md5_mismatch_flag_key] = self.md5Mismatch()


    def refreshWanted(self):
        if not os.path.exists(self.xmlfile):
            return True

#.........这里部分代码省略.........
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:103,代码来源:Sponsors.py


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