本文整理汇总了Python中PyQt4.QtGui.QDialog.Accepted方法的典型用法代码示例。如果您正苦于以下问题:Python QDialog.Accepted方法的具体用法?Python QDialog.Accepted怎么用?Python QDialog.Accepted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDialog
的用法示例。
在下文中一共展示了QDialog.Accepted方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addToFavourites
# 需要导入模块: from PyQt4.QtGui import QDialog [as 别名]
# 或者: from PyQt4.QtGui.QDialog import Accepted [as 别名]
def addToFavourites(self):
dialog = QDialog(self)
addbmkdialog = Add_Bookmark_Dialog()
addbmkdialog.setupUi(dialog)
dialog.setWindowTitle('Add to HomePage')
addbmkdialog.titleEdit.setMaxLength(31)
addbmkdialog.titleEdit.setText(self.tabWidget.currentWidget().page().mainFrame().title())
addbmkdialog.addressEdit.setText(self.line.text())
if (dialog.exec_() == QDialog.Accepted):
title = unicode(addbmkdialog.titleEdit.text())
addr = unicode(addbmkdialog.addressEdit.text())
imgfile = str(time()) + '.jpg'
viewportsize = self.tabWidget.currentWidget().page().viewportSize()
contentsize = QSize(640, 640)
self.tabWidget.currentWidget().page().setViewportSize(contentsize)
img = QPixmap(contentsize)
painter = QPainter(img)
self.tabWidget.currentWidget().page().mainFrame().render(painter, 0xff)# 0xff=QWebFrame.AllLayers
painter.end()
self.tabWidget.currentWidget().page().setViewportSize(viewportsize)
icon = img.scaledToWidth(184, 1).copy(0,0, 180, 120)
icon.save(thumbnails_dir + imgfile)
self.favourites = importFavourites(configdir + 'favourites.txt')
self.favourites.append([title, addr, imgfile])
exportFavourites(configdir + 'favourites.txt', self.favourites)
示例2: addbookmark
# 需要导入模块: from PyQt4.QtGui import QDialog [as 别名]
# 或者: from PyQt4.QtGui.QDialog import Accepted [as 别名]
def addbookmark(self):
""" Opens add bookmark dialog and gets url from url box"""
dialog = QDialog(self)
addbmkdialog = Add_Bookmark_Dialog()
addbmkdialog.setupUi(dialog)
addbmkdialog.titleEdit.setText(self.tabWidget.currentWidget().page().mainFrame().title())
addbmkdialog.addressEdit.setText(self.line.text())
if (dialog.exec_() == QDialog.Accepted):
url = unicode(addbmkdialog.addressEdit.text())
bmk = [unicode(addbmkdialog.titleEdit.text()), url]
self.bookmarks = importBookmarks(configdir+"bookmarks.txt")
self.bookmarks.insert(0, bmk)
exportBookmarks(configdir+"bookmarks.txt", self.bookmarks)
icon = self.tabWidget.currentWidget().icon()
if not icon.isNull():
icon.pixmap(16, 16).save(icon_dir + url.split('/')[2] + '.png')
示例3: test_dialog_ok
# 需要导入模块: from PyQt4.QtGui import QDialog [as 别名]
# 或者: from PyQt4.QtGui.QDialog import Accepted [as 别名]
def test_dialog_ok(self):
"""Test we can click OK."""
button = self.dialog.button_box.button(QDialogButtonBox.Ok)
button.click()
result = self.dialog.result()
self.assertEqual(result, QDialog.Accepted)
示例4: setExt
# 需要导入模块: from PyQt4.QtGui import QDialog [as 别名]
# 或者: from PyQt4.QtGui.QDialog import Accepted [as 别名]
def setExt(parent=None):
dialog = CalibrationDialog(parent)
result = dialog.exec_()
bg, bgstd, las, time, conc = dialog.evalTable()
return (bg, bgstd, las, time, conc, result == QDialog.Accepted)
示例5: settingseditor
# 需要导入模块: from PyQt4.QtGui import QDialog [as 别名]
# 或者: from PyQt4.QtGui.QDialog import Accepted [as 别名]
def settingseditor(self):
""" Opens the settings manager dialog, then applies the change"""
dialog = QDialog(self)
websettingsdialog = Ui_SettingsDialog()
websettingsdialog.setupUi(dialog)
# Enable AdBlock
websettingsdialog.checkAdBlock.setChecked(webkit.enable_adblock)
# Fonts blocking
websettingsdialog.checkFontLoad.setChecked(webkit.block_fonts)
# Popups blocking
websettingsdialog.checkBlockPopups.setChecked(webkit.block_popups)
# Custom user agent
websettingsdialog.checkUserAgent.setChecked(webkit.use_custom_useragent)
websettingsdialog.useragentEdit.setText(webkit.user_agent)
# External download manager
websettingsdialog.checkDownMan.setChecked(self.useexternaldownloader)
websettingsdialog.downManEdit.setText(self.externaldownloader)
# RTSP media player command
websettingsdialog.mediaPlayerEdit.setText(webkit.video_player_command)
websettingsdialog.mediaPlayerEdit.setCursorPosition(0)
# Maximize on startup
websettingsdialog.checkMaximize.setChecked(self.maximizeonstartup)
# Font settings
websettingsdialog.spinFontSize.setValue(self.minfontsizeval)
websettingsdialog.standardfontCombo.setCurrentFont(QFont(self.standardfontval))
websettingsdialog.sansfontCombo.setCurrentFont(QFont(self.sansfontval))
websettingsdialog.seriffontCombo.setCurrentFont(QFont(self.seriffontval))
websettingsdialog.fixedfontCombo.setCurrentFont(QFont(self.fixedfontval))
# Clear Data buttons
websettingsdialog.clearCacheButton.clicked.connect(self.websettings.clearMemoryCaches)
websettingsdialog.cookiesButton.clicked.connect(cookiejar.clearCookies)
websettingsdialog.iconDBButton.clicked.connect(self.websettings.clearIconDatabase)
if dialog.exec_() == QDialog.Accepted:
# Enable AdBlock
webkit.enable_adblock = websettingsdialog.checkAdBlock.isChecked()
# Block Fonts
webkit.block_fonts = websettingsdialog.checkFontLoad.isChecked()
# Block Popups
webkit.block_popups = websettingsdialog.checkBlockPopups.isChecked()
# User Agent
webkit.use_custom_useragent = websettingsdialog.checkUserAgent.isChecked()
webkit.user_agent = websettingsdialog.useragentEdit.text()
# Download Manager
self.useexternaldownloader = websettingsdialog.checkDownMan.isChecked()
self.externaldownloader = websettingsdialog.downManEdit.text()
# Media Player Command
webkit.video_player_command = websettingsdialog.mediaPlayerEdit.text()
# Maximize on startup
self.maximizeonstartup = websettingsdialog.checkMaximize.isChecked()
self.minfontsizeval = websettingsdialog.spinFontSize.value()
self.standardfontval = websettingsdialog.standardfontCombo.currentText()
self.sansfontval = websettingsdialog.sansfontCombo.currentText()
self.seriffontval = websettingsdialog.seriffontCombo.currentText()
self.fixedfontval = websettingsdialog.fixedfontCombo.currentText()
self.applysettings()
self.savesettings()