本文整理汇总了Python中Core.Dialogs.ask方法的典型用法代码示例。如果您正苦于以下问题:Python Dialogs.ask方法的具体用法?Python Dialogs.ask怎么用?Python Dialogs.ask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.Dialogs
的用法示例。
在下文中一共展示了Dialogs.ask方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkEmbeddedDB
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def checkEmbeddedDB():
global isAskEmbeddedDBConfiguration
if uni.getBoolValue("isReadOnlyAmarokDB"):
if (fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/amarok") and
fu.isDir(fu.pathOfSettingsDirectory + "/Amarok/mysqle/mysql") and
fu.isFile(fu.pathOfSettingsDirectory + "/Amarok/my.cnf")):
return startReadOnlyEmbeddedDB()
else:
if isAskEmbeddedDBConfiguration:
isAskEmbeddedDBConfiguration = False
answer = Dialogs.ask(translate("Amarok", "Amarok Database Must Be Configure"),
translate("Amarok",
"Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?"))
if answer == Dialogs.Yes:
ReadOnlyEmbeddedDBConfigurator()
else:
return False
else:
if (fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/mysql/db.frm") and
fu.isFile(uni.getKDE4HomePath() + "/share/apps/amarok/mysqle/my.cnf")):
return startEmbeddedDB()
else:
if isAskEmbeddedDBConfiguration:
isAskEmbeddedDBConfiguration = False
answer = Dialogs.ask(translate("Amarok", "Amarok Database Must Be Configure"),
translate("Amarok",
"Amarok database must be configure for Hamsi Manager. Are you want to configure Amarok database?"))
if answer == Dialogs.Yes:
EmbeddedDBConfigurator()
else:
return False
return checkEmbeddedDB()
示例2: checkSource
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def checkSource(self, _oldPath, _objectType="fileAndDirectory", _isCheckWritable=True):
_path = fu.checkSource(_oldPath, _objectType, False)
if _path is None:
if _objectType == "file":
answer = Dialogs.ask(translate("QuickMake", "Cannot Find File"),
str(translate("FileUtils",
"\"%s\" : cannot find a file with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
_oldPath))
if answer == Dialogs.Yes:
self.organizeWithHamsiManager(_oldPath)
return None
elif _objectType == "directory":
answer = Dialogs.ask(translate("QuickMake", "Cannot Find Directory"),
str(translate("FileUtils",
"\"%s\" : cannot find a folder with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
_oldPath))
if answer == Dialogs.Yes:
self.organizeWithHamsiManager(_oldPath)
return None
else:
answer = Dialogs.ask(translate("QuickMake", "Cannot Find File Or Directory"),
str(translate("FileUtils",
"\"%s\" : cannot find a file or directory with this name.<br>Are you want to organize parent directory with Hamsi Manager?")) % Organizer.getLink(
_oldPath))
if answer == Dialogs.Yes:
self.organizeWithHamsiManager(_oldPath)
return None
if _isCheckWritable:
if fu.isWritableFileOrDir(_oldPath) is False:
return None
return _path
示例3: closeEvent
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def closeEvent(self, _event):
if self.isInstallFinished is False:
answer = Dialogs.ask(translate("Reconfigure", "Finalizing Configuration"),
translate("Reconfigure", "Are You Sure You Want To Quit?"))
if answer != Dialogs.Yes:
_event.ignore()
MApplication.setQuitOnLastWindowClosed(True)
示例4: cancelThreadAction
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def cancelThreadAction():
global threadActionState
from Core import Dialogs
answer = Dialogs.ask(translate("Universals", "Are You Sure?"),
translate("Universals", "Are you want to cancel these transactions?"))
if answer == Dialogs.Yes:
threadActionState = False
示例5: clear
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def clear(self):
try:
answer = Dialogs.ask(translate("ScriptManager", "Your Codes Will Be Deleted!.."),
translate("ScriptManager",
"Your codes will be deleted and the default codes will be installed. Do you wish to clear the current codes?"))
if answer == Dialogs.Yes:
Scripts.clearScript(fu.joinPath(Scripts.pathOfScripsDirectory, self.currentScriptFileName))
except:
ReportBug.ReportBug()
示例6: delete
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def delete(self):
try:
answer = Dialogs.ask(translate("ScriptManager", "Your Script Will Be Deleted!.."),
translate("ScriptManager",
"Your script will be deleted. Are you sure you want to delete current script?"))
if answer == Dialogs.Yes:
fu.removeFile(fu.joinPath(Scripts.pathOfScripsDirectory, self.currentScriptFileName))
self.refreshScriptList()
except:
ReportBug.ReportBug()
示例7: restore
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def restore(self):
answer = Dialogs.ask(translate("Amarok", "Restore Amarok Database"),
translate("Amarok", "Are you want to restore backup database?"))
if answer == Dialogs.Yes:
if isRunning():
self.stopEmbeddedDB(True)
Dialogs.show(translate("EmbeddedDBConfigurator", "Close Amarok"),
translate("EmbeddedDBConfigurator", "Please close Amarok if it is running."))
restoreEmbeddedDB()
Dialogs.show(translate("EmbeddedDBConfigurator", "Restore Completed"), translate("EmbeddedDBConfigurator",
"Restore successfully completed.<br> You can run Amarok now if you want."))
self.checkRunState()
示例8: doAfterRunProcessesStep1
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def doAfterRunProcessesStep1(self):
if str(fu.defaultFileSystemEncoding) != str(uni.MySettings["fileSystemEncoding"]):
answer = Dialogs.ask(
translate("HamsiManager", "Your System's \"File System Encoding\" Type Different"),
translate("HamsiManager",
"Your system's \"File System Encoding\" type different from the settings you select. Are you sure you want to continue?If you are not sure press the \"No\"."),
False, "Your System's \"File System Encoding\" Type Different")
if answer == Dialogs.No:
OptionsForm.OptionsForm(self, _focusTo="fileSystemEncoding")
if uni.getBoolValue("isMakeAutoDesign"):
self.TableToolsBar.setVisible(False)
self.ToolsBar.setVisible(False)
if isActivePyKDE4:
self.Browser.setVisible(False)
self.TreeBrowser.setVisible(False)
self.FileManager.urlNavigator.setMinimumWidth(150)
self.FileManager.tbarBrowserToolsFull.setVisible(False)
self.tabifyDockWidget(self.Browser, self.Places)
self.tabifyDockWidget(self.Browser, self.TreeBrowser)
self.tabifyDockWidget(self.Browser, self.DirOperator)
geometries = uni.getListValue("MainWindowGeometries")
self.setGeometry(int(geometries[0]), int(geometries[1]), 900, 600)
uni.setMySetting("isMakeAutoDesign", "False")
if uni.isShowVerifySettings and (uni.changedDefaultValuesKeys != [] or uni.newSettingsKeys != []):
answer = Dialogs.ask(translate("HamsiManager", "Added New Options And New Features"),
translate("HamsiManager",
"New options and new features added to Hamsi Manager. Are you want to change or verify new options?"),
False, "Added New Options And New Features")
if answer == Dialogs.Yes:
newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
OptionsForm.OptionsForm(self, "Normal", None, newOrChangedKeys)
elif uni.getBoolValue("isShowReconfigureWizard") and uni.isBuilt() is False:
from Tools import Configurator
Configurator.Configurator()
uni.setMySetting("isShowReconfigureWizard", "False")
示例9: checkMysqldSafe
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def checkMysqldSafe(_isAskIfNotFound=True):
from Core import Dialogs
if fu.isFile(MySettings["pathOfMysqldSafe"]) is False and fu.isFile(
"/usr/bin/" + MySettings["pathOfMysqldSafe"]) is False:
if _isAskIfNotFound:
answer = Dialogs.ask(translate("EmbeddedDBCore", "\"mysqld_safe\" Not Found"),
translate("EmbeddedDBCore",
"Executable \"mysqld_safe\" file is not found. Are you want to set path of this file?<br><b>Note :</b> \"mysql-common\" must be installed on your system."))
if answer == Dialogs.Yes:
from Options import OptionsForm
OptionsForm.OptionsForm(getMainWindow(), _focusTo="pathOfMysqldSafe")
else:
return False
else:
return True
示例10: reConfigure
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def reConfigure(self):
try:
oldPathOfExecutableHamsi = Settings.getUniversalSetting("HamsiManagerExecutableLinkPath", "/usr/bin/hamsi")
if fu.isFile(fu.joinPath(fu.HamsiManagerDirectory, "HamsiManager.desktop")):
if fu.isWritableFileOrDir(fu.joinPath(fu.HamsiManagerDirectory, "HamsiManager.desktop")):
MyConfigure.reConfigureFile(fu.joinPath(fu.HamsiManagerDirectory, "HamsiManager.desktop"))
if self.isCreateDesktopShortcut is not None:
if self.isCreateDesktopShortcut.checkState() == Mt.Checked:
desktopPath = uni.getUserDesktopPath()
if uni.isWindows:
MyConfigure.createShortCutFile(fu.joinPath(desktopPath, "Hamsi Manager.lnk"))
else:
fileContent = MyConfigure.getConfiguredDesktopFileContent()
fu.writeToFile(fu.joinPath(desktopPath, "HamsiManager.desktop"), fileContent)
if uni.isRunningAsRoot():
executableLink = str(self.leExecutableLink.text())
if self.isCreateExecutableLink is not None:
if self.isCreateExecutableLink.checkState() == Mt.Checked:
if executableLink.strip() != "":
HamsiManagerFileName = Execute.findExecutableBaseName("HamsiManager")
if fu.isFile(executableLink):
fu.removeFileOrDir(executableLink)
fu.createSymLink(fu.joinPath(fu.HamsiManagerDirectory, HamsiManagerFileName),
executableLink)
Settings.setUniversalSetting("HamsiManagerExecutableLinkPath", executableLink)
if oldPathOfExecutableHamsi != executableLink:
if fu.isFile(oldPathOfExecutableHamsi):
answer = Dialogs.ask(translate("Reconfigure", "Other Hamsi Manager Was Detected"),
str(translate("Reconfigure",
"Other Hamsi Manager executable file was detected. Are you want to delete old executable file? You can delete this old executable file : \"%s\"")) % (
oldPathOfExecutableHamsi))
if answer != Dialogs.Yes:
fu.removeFile(oldPathOfExecutableHamsi)
if fu.isDir("/usr/share/applications/"):
fileContent = MyConfigure.getConfiguredDesktopFileContent()
fu.writeToFile("/usr/share/applications/HamsiManager.desktop", fileContent)
if uni.isRunningAsRoot() is False:
if fu.isDir(fu.joinPath(fu.userDirectoryPath, ".local", "applications")) is False:
fu.makeDirs(fu.joinPath(fu.userDirectoryPath, ".local", "applications"))
fileContent = MyConfigure.getConfiguredDesktopFileContent()
fu.writeToFile(fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop"),
fileContent)
MyConfigure.installKDE4Languages()
self.isInstallFinished = True
except:
ReportBug.ReportBug()
示例11: removeOnlySubFiles
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def removeOnlySubFiles(self):
try:
_path = self.checkSource(str(QuickMakeParameters[1]), "directory")
if _path is not None:
answer = Dialogs.ask(translate("QuickMake", "All Files Will Be Removed"),
str(translate("QuickMake",
"Are you sure you want to remove only all files in \"%s\"?<br>Note:Do not will remove directory and subfolders.")) % Organizer.getLink(
_path))
if answer == Dialogs.Yes:
getMainWindow().setEnabled(False)
fu.removeOnlySubFiles(_path)
getMainWindow().setEnabled(True)
Dialogs.show(translate("QuickMake", "Removed Only All Files"),
str(translate("QuickMake",
"Removed only all files in \"%s\".<br>Note:Do not removed directory and subfolders.")) % Organizer.getLink(
_path))
self.close()
except:
ReportBug.ReportBug()
示例12: Clear
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def Clear(self):
try:
uni.isCanBeShowOnMainWindow = False
answer = Dialogs.ask(translate("Cleaner", "Your Files Will Be Removed"),
str(translate("Cleaner",
"The files in the \"%s\" folder will be cleared according to the criteria you set.<br>" +
"This action will delete the files completely, without any chance to recover.<br>" +
"Are you sure you want to perform the action?")) % Organizer.getLink(
Organizer.getLink(str(self.lePathOfProject.text()))))
if answer == Dialogs.Yes:
if fu.isWritableFileOrDir(str(self.lePathOfProject.text())):
if fu.clearCleaningDirectory(str(self.lePathOfProject.text()), True, True):
Dialogs.show(translate("Cleaner", "Directory Is Cleared"),
str(translate("Cleaner",
"This directory is cleared : \"%s\"")) % Organizer.getLink(
str(self.lePathOfProject.text())))
uni.isCanBeShowOnMainWindow = True
except:
ReportBug.ReportBug()
示例13: checkForSave
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def checkForSave(self):
try:
if self.currentScriptFileName is not None:
if fu.isFile(fu.joinPath(Scripts.pathOfScripsDirectory, self.currentScriptFileName)):
codes = Scripts.getScript(fu.joinPath(Scripts.pathOfScripsDirectory, self.currentScriptFileName))
if str(codes) != str(self.sciCommand.text()):
if self.cckbIsAutoSaveScripts.checkState() == Mt.Checked:
self.save()
else:
answer = Dialogs.ask(translate("ScriptManager", "Do You Wish To Save Your Codes?"),
translate("ScriptManager",
"Do you wish to save your codes so that you can continue later?"),
True)
if answer == Dialogs.Yes:
self.save()
elif answer == Dialogs.Cancel:
return False
return True
except:
ReportBug.ReportBug()
示例14: checkAmarok
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def checkAmarok(_isAlertIfNotAvailable=True, _isUseReadOnly=True):
global isAskEmbeddedDBConfiguration
if isLoadedMysql and uni.isAvailableKDE4():
if uni.getBoolValue("amarokIsUseHost"):
if _isUseReadOnly or uni.getBoolValue("isReadOnlyAmarokDBHost") is False:
return True
else:
if _isAlertIfNotAvailable:
answer = Dialogs.ask(translate("Amarok", "This Feature Is Not Usable"),
translate("Amarok",
"This feature is not usable with read only Amarok database. <br>Are you want to give permission to read and write for Amarok database?"))
if answer == Dialogs.Yes:
uni.setMySetting("isReadOnlyAmarokDBHost", False)
return True
else:
isAskEmbeddedDBConfiguration = True
return checkEmbeddedDB()
else:
if _isAlertIfNotAvailable:
Dialogs.showError(translate("Amarok", "Amarok Module Is Not Usable"),
translate("Amarok", "Please run Amarok once."))
return False
return False
示例15: triggered
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import ask [as 别名]
def triggered(self, _action):
try:
if _action.objectName() == "Edit Bookmarks":
getMainWindow().FileManager.bookmarks.makeRefresh()
getMainWindow().FileManager.bookmarks.show()
return
for info in BookmarksOfDirectories.fetchAll():
if info[1] == str(_action.objectName()):
if fu.isDir(str(info[2])):
getMainWindow().FileManager.goTo(str(info[2]))
return
else:
answer = Dialogs.ask(translate("BookmarksMenu", "Cannot Find Folder"),
str(translate("BookmarksMenu",
"\"%s\" cannot be found.<br>Delete this folder from the bookmarks?")) %
Organizer.getLink(info[1]))
if answer == Dialogs.Yes:
BookmarksOfDirectories.delete(str(info[0]))
self.makeRefresh()
getMainWindow().FileManager.bookmarks.makeRefresh()
getMainWindow().FileManager.makeRefreshOnlyFileList()
getMainWindow().FileManager.makeRefreshOnlyFileListByTree()
except:
ReportBug.ReportBug()