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


Python KMessageBox.warningContinueCancel方法代码示例

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


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

示例1: slotOptimiseDatabase

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import warningContinueCancel [as 别名]
 def slotOptimiseDatabase(self):
     self.loadDatabaseBuilder()
     dbBuild = self.renderThread.getObjectInstance(build.DatabaseBuilder)
     if dbBuild.isOptimizable():
         if KMessageBox.warningContinueCancel(self,
             i18n("This operation might take some time."),
             i18n("Optimise Database"), KStandardGuiItem.cont(),
             KStandardGuiItem.cancel(), 'database_optimise') \
                 == KMessageBox.Continue:
             QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
             self.currentJob = self.renderThread.enqueue(
                 build.DatabaseBuilder, 'optimize')
开发者ID:cburgmer,项目名称:eclectus,代码行数:14,代码来源:update.py

示例2: installDictionary

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import warningContinueCancel [as 别名]
    def installDictionary(self):
        if self.currentDictionary in self.dictionaryHasNewer \
            and not self.dictionaryHasNewer[self.currentDictionary] \
            and KMessageBox.warningContinueCancel(self,
                i18n("Local version is already up-to-date.\n\nInstall anyway?"),
                i18n("Reinstall"), KStandardGuiItem.cont(),
                KStandardGuiItem.cancel(), 'reinstall_confirmation') \
                == KMessageBox.Cancel:
            return

        downloader = self.getDownloader(self.currentDictionary)

        link = downloader.getDownloadLink()
        if not link:
            self.statusLabel.setText(i18n('Error getting download page "%1"',
                downloader.lastError))
            return

        self.statusLabel.setText(i18n('Downloading from %1...', link))
        self.checkVersionButton.setEnabled(False)
        self.dictionaryCombo.setEnabled(False)
        self.removeButton.setEnabled(False)
        self.installButton.setEnabled(False)
        self.setWorking(True)

        filePath, fileType = downloader.download()
        if filePath:
            self.statusLabel.setText(i18n('Installing...', link))

            dbBuild = self.renderThread.getObjectInstance(build.DatabaseBuilder)
            builderClass = dbBuild.getTableBuilder(self.currentDictionary)
            dbBuild.setBuilderOptions(builderClass, 
                {'filePath': unicode(filePath), 'fileType': unicode(fileType)})

            tables = [self.currentDictionary]

            # look for related tables and install them, too
            relatedKey = self.currentDictionary + '_related'
            if relatedKey in EclectusCommandLineBuilder.BUILD_GROUPS:
                tables.extend(
                    EclectusCommandLineBuilder.BUILD_GROUPS[relatedKey])
            # TODO UpdateVersion might be installed later
            # TODO if for the first time a new language is installed check if
            #  tables in BUILD_GROUPS (zh-cmn, ja) need to be installed

            self.currentJob = self.renderThread.enqueue(build.DatabaseBuilder,
                'build', tables)
        else:
            self.statusLabel.setText(i18n('Error downloading from "%1": "%2"',
                link, downloader.lastError))
            self.dictionaryCombo.setEnabled(True)
            self.setWorking(False)
开发者ID:cburgmer,项目名称:eclectus,代码行数:54,代码来源:update.py

示例3: validate

# 需要导入模块: from PyKDE4.kdeui import KMessageBox [as 别名]
# 或者: from PyKDE4.kdeui.KMessageBox import warningContinueCancel [as 别名]
 def validate(self):
     """Checks if the input is acceptable.
     
     If this method returns True, the dialog is accepted when OK is clicked.
     Otherwise a messagebox could be displayed, and the dialog will remain
     visible.
     """
     # strip off whitespace
     name = self.name.text().strip()
     self.name.setText(name)
     
     if not name:
         self.setCurrentPage(self.firstPage)
         self.name.setFocus()
         KMessageBox.error(self, i18n("Please enter a session name."))
         if self._originalName:
             self.name.setText(self._originalName)
         return False
     
     if name == 'none':
         self.setCurrentPage(self.firstPage)
         self.name.setFocus()
         KMessageBox.error(self, i18n(
             "Please do not use the name '%1'.", "none"))
         return False
     
     if '&' in name:
         self.setCurrentPage(self.firstPage)
         self.name.setFocus()
         KMessageBox.error(self, i18n(
             "Please do not use the ampersand (&) character "
             "in a session name."))
         return False
         
     if self._originalName != name and name in self.sm.names():
         self.setCurrentPage(self.firstPage)
         self.name.setFocus()
         if KMessageBox.warningContinueCancel(self, i18n(
             "Another session with the name %1 exists already.\n\n"
             "Do you want to overwrite it?", name), None,
             KStandardGuiItem.overwrite(), KStandardGuiItem.cancel(),
             "session_overwrite") == KMessageBox.Cancel:
             return False
         
     return True
开发者ID:Alwnikrotikz,项目名称:lilykde,代码行数:47,代码来源:sessions.py


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