當前位置: 首頁>>代碼示例>>Python>>正文


Python QDialog.Accepted方法代碼示例

本文整理匯總了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) 
開發者ID:ksharindam,項目名稱:quartz-browser,代碼行數:27,代碼來源:main.py

示例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') 
開發者ID:ksharindam,項目名稱:quartz-browser,代碼行數:18,代碼來源:main.py

示例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) 
開發者ID:MACBIO,項目名稱:GeoWrap,代碼行數:9,代碼來源:test_geometry_wrapper_dialog.py

示例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) 
開發者ID:jungmannlab,項目名稱:picasso,代碼行數:7,代碼來源:simulate.py

示例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() 
開發者ID:ksharindam,項目名稱:quartz-browser,代碼行數:60,代碼來源:main.py


注:本文中的PyQt4.QtGui.QDialog.Accepted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。