本文整理汇总了Python中PyQt4.Qt.QTextBrowser.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Python QTextBrowser.setMinimumSize方法的具体用法?Python QTextBrowser.setMinimumSize怎么用?Python QTextBrowser.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser.setMinimumSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MovieRewindDialog
# 需要导入模块: from PyQt4.Qt import QTextBrowser [as 别名]
# 或者: from PyQt4.Qt.QTextBrowser import setMinimumSize [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()
示例2: _MovieRewindDialog
# 需要导入模块: from PyQt4.Qt import QTextBrowser [as 别名]
# 或者: from PyQt4.Qt.QTextBrowser import setMinimumSize [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
示例3: WikiHelpBrowser
# 需要导入模块: from PyQt4.Qt import QTextBrowser [as 别名]
# 或者: from PyQt4.Qt.QTextBrowser import setMinimumSize [as 别名]
class WikiHelpBrowser(QDialog):
"""
The WikiHelpBrowser Dialog.
"""
def __init__(self, text, parent=None, clicked_func=None, caption="(caption)", size=None):
QDialog.__init__(self, parent)
self.setWindowTitle(caption)
self.setWindowIcon(QtGui.QIcon("ui/border/MainWindow"))
self.setObjectName("WikiHelpBrowser")
TextBrowserLayout = QGridLayout(self)
TextBrowserLayout.setSpacing(5)
TextBrowserLayout.setMargin(2)
self.text_browser = QTextBrowser(self)
self.text_browser.setOpenExternalLinks(True)
self.text_browser.setObjectName("text_browser")
TextBrowserLayout.addWidget(self.text_browser, 0, 0, 1, 0)
self.text_browser.setMinimumSize(400, 200)
# make it pale yellow like a post-it note
self.text_browser.setHtml('<qt bgcolor="#FFFF80">' + text)
self.close_button = QPushButton(self)
self.close_button.setObjectName("close_button")
self.close_button.setText("Close")
TextBrowserLayout.addWidget(self.close_button, 1, 1)
spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
TextBrowserLayout.addItem(spacer, 1, 0)
self.resize(QSize(300, 300).expandedTo(self.minimumSizeHint()))
if size == 1:
self.text_browser.setMinimumSize(200, 400)
self.resize(QSize(300, 550).expandedTo(self.minimumSizeHint()))
if size == 2:
self.resize(QSize(650, 250).expandedTo(self.minimumSizeHint()))
self.connect(self.close_button, SIGNAL("clicked()"), self.close)
return
pass
示例4: PermissionDialog
# 需要导入模块: from PyQt4.Qt import QTextBrowser [as 别名]
# 或者: from PyQt4.Qt.QTextBrowser import setMinimumSize [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
#.........这里部分代码省略.........