本文整理汇总了Python中Core.Dialogs.askSpecial方法的典型用法代码示例。如果您正苦于以下问题:Python Dialogs.askSpecial方法的具体用法?Python Dialogs.askSpecial怎么用?Python Dialogs.askSpecial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.Dialogs
的用法示例。
在下文中一共展示了Dialogs.askSpecial方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import askSpecial [as 别名]
def __init__(self, _filePath, _isOpenDetailsOnNewWindow):
try:
if uni.getBoolValue("isForceOpenWithDefaultApplication"):
_path = fu.checkSource(_filePath)
Execute.openWith([_path])
else:
_path = fu.checkSource(_filePath, "file", False)
if _path is not None:
isOpened = False
mtype = fu.getMimeType(_path)
if mtype[0] is not None:
if mtype[0].split("/")[0] == "text":
TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
isOpened = True
elif mtype[0].split("/")[0] == "audio":
if Taggers.getTagger(True) is not None:
MusicDetails.MusicDetails(_path, _isOpenDetailsOnNewWindow)
isOpened = True
elif mtype[0].split("/")[0] == "image":
ImageDetails.ImageDetails(_path, "file", _isOpenDetailsOnNewWindow)
isOpened = True
elif fu.isBinary(_path) is False:
TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
isOpened = True
else:
if fu.isBinary(_path) is False:
TextDetails.TextDetails(_path, _isOpenDetailsOnNewWindow)
isOpened = True
if isOpened is False:
if uni.getBoolValue("isOpenWithDefaultApplication"):
Execute.openWith([_path])
else:
Dialogs.showError(translate("Details", "File Is Not Supported"),
str(translate("Details",
"\"%s\" couldn't opened. This file is not supported.")) % Organizer.getLink(
str(_path)))
elif fu.isDir(_filePath):
if uni.getBoolValue("isOpenWithDefaultApplication"):
Execute.openWith([_filePath])
else:
Dialogs.showError(translate("Details", "Directories Is Not Supported"),
str(translate("Details",
"\"%s\" couldn't opened. Directories is not supported to show details.")) % Organizer.getLink(
str(_filePath)))
else:
Dialogs.showError(translate("Details", "File Is Not Exist"),
str(translate("Details",
"\"%s\" couldn't opened. This file is not exist.")) % Organizer.getLink(
str(_filePath)))
except:
answer = Dialogs.askSpecial(translate("Details", "File Couldn't Opened"),
str(translate("Details",
"\"%s\" couldn't opened. This file may is not supported. <br>If you think this is a bug, please report us.")) % Organizer.getLink(
str(_filePath)),
translate("QuickMake", "Report This Bug"), translate("QuickMake", "OK"), None)
if answer == translate("QuickMake", "Report This Bug"):
ReportBug.ReportBug()
示例2: __init__
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import askSpecial [as 别名]
def __init__(self, _errorDetails="", _pathOfReportFile=None):
global isClose
currentMainWindow = getMainWindow()
if uni.isStartingSuccessfully:
isShowFixMe = False
else:
isShowFixMe = True
if currentMainWindow is None:
setMainWindow(self)
try: MDialog.__init__(self, currentMainWindow)
except: MDialog.__init__(self, None)
self.pathOfReportFile = _pathOfReportFile
self.namMain = None
self.nrqPost = None
self.nrpBack = None
isClose = False
try:
if isActivePyKDE4:
self.setButtons(MDialog.NoDefault)
except: pass
try:
if Dialogs.pnlState is not None:
Dialogs.showState("", 1, 1)
except: pass
pnlMain = MWidget(self)
self.vblMain = MVBoxLayout(pnlMain)
self.pbtnSendAndClose = MPushButton(translate("ReportBug", "Send And Close"))
self.pbtnCancel = MPushButton(translate("ReportBug", "Cancel"))
self.connect(self.pbtnSendAndClose, SIGNAL("clicked()"), self.sendAndClose)
self.connect(self.pbtnCancel, SIGNAL("clicked()"), self.cancel)
self.pbtnShowDetailsPage = MPushButton(translate("ReportBug", "Show Details File"))
self.pbtnCheckUpdate = MPushButton(translate("ReportBug", "Check Update"))
self.cckbIsSendTableContents = Options.MyCheckBox(self, translate("ReportBug",
"Send Table Contents For More Details"), 0,
_stateChanged=self.isSendTableContents)
self.teErrorDetails = MTextEdit()
try:
self.teErrorDetails.setHtml(str(_errorDetails.replace("<hr>", "")))
except:
self.teErrorDetails.setHtml(translate("ReportBug",
"I cannot send the error details due to some character errors.<br>To see the details, please click on the \"Show details file\" button."))
self.teErrorDetails.setEnabled(False)
self.connect(self.pbtnShowDetailsPage, SIGNAL("clicked()"), self.showDetailsPage)
self.connect(self.pbtnCheckUpdate, SIGNAL("clicked()"), self.checkUpdate)
self.teErrorDetails.setMinimumHeight(220)
self.vblMain.addWidget(self.teErrorDetails, 20)
self.vblMain.addWidget(self.cckbIsSendTableContents, 1)
lblUserNotes = MLabel(translate("ReportBug", "Notes : "))
lblName = MLabel(translate("ReportBug", "Name And Surname : "))
lblEMailAddress = MLabel(translate("ReportBug", "E-mail Address : "))
lblAlert = MLabel(translate("ReportBug",
"Note : Will be kept strictly confidential. It will be used solely to learn information about of your report."))
self.teUserNotes = MTextEdit(self)
self.leName = MLineEdit(self)
self.leEMailAddress = MLineEdit(self)
hbox1 = MHBoxLayout()
hbox1.addWidget(lblUserNotes, 1)
hbox1.addWidget(self.teUserNotes, 20)
hbox2 = MHBoxLayout()
hbox2.addWidget(lblName, 1)
hbox2.addWidget(self.leName, 20)
hbox3 = MHBoxLayout()
hbox3.addWidget(lblEMailAddress, 1)
hbox3.addWidget(self.leEMailAddress, 20)
hbox0 = MHBoxLayout()
hbox0.addWidget(self.pbtnShowDetailsPage, 1)
hbox0.addWidget(self.pbtnCheckUpdate, 1)
hbox0.addStretch(2)
hbox0.addWidget(self.pbtnSendAndClose, 1)
hbox0.addWidget(self.pbtnCancel, 1)
VBox1 = MVBoxLayout()
VBox1.addLayout(hbox2)
VBox1.addLayout(hbox3)
VBox1.addWidget(lblAlert)
gboxContactInformations = MGroupBox(translate("ReportBug", "Contact Informations : "))
gboxContactInformations.setLayout(VBox1)
self.vblMain.addLayout(hbox1, 1)
self.vblMain.addWidget(gboxContactInformations, 1)
self.vblMain.addLayout(hbox0, 1)
try:
if isActivePyKDE4:
self.setMainWidget(pnlMain)
else:
self.setLayout(self.vblMain)
except:
self.setLayout(self.vblMain)
self.setWindowTitle(translate("ReportBug", "Please Report This Bug!.."))
self.setMaximumSize(600, 375)
self.show()
self.setMaximumSize(10000, 10000)
if isShowFixMe and isQuickMake is False and uni.loggingLevel != logging.DEBUG:
try:
answer = Dialogs.askSpecial(translate("ReportBug", "I Have A Suggestion!"),
translate("ReportBug", "<b>Please check the following: ;</b><br>" +
"<b>1-)</b>If you have received this error when you were checking the last folder, reset the \"Last Directory\",<br>" +
"<b>2-)</b>If you have received this error due to your changed settings, reset the \"Settings\",<br>" +
"<b>3-)</b>If you continue to receive this error even after resetting the settings, reset \"All\".<br>" +
"<br><b>You can enable Hamsi Manager to run as normal.<br>Please take a moment to send us the error report.</b>"),
translate("ReportBug", "Last Directory"),
#.........这里部分代码省略.........
示例3: install
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import askSpecial [as 别名]
def install(self):
try:
MApplication.processEvents()
self.installationDirectory = str(self.leInstallationDirectory.text())
if len(self.installationDirectory) > 0:
if self.installationDirectory[-1] == fu.sep:
self.installationDirectory = self.installationDirectory[:-1]
if self.installationDirectory == fu.HamsiManagerDirectory:
self.pageNo -= 1
self.lblActions.setText("")
Dialogs.showError(translate("Install", "The path you selected is not valid."),
translate("Install",
"The selected path is Hamsi Manager source directory.<br>Please choose a valid installation path."))
elif fu.isFile(self.installationDirectory) is False:
isMakeInstall = True
if fu.isDir(self.installationDirectory) is False:
self.lblActions.setText(translate("Install", "Creating Installation Folder..."))
fu.makeDirs(self.installationDirectory)
elif len(fu.listDir(self.installationDirectory)) > 0:
currenctAnswer = Dialogs.askSpecial(
translate("Install", "The Installation Path You Selected Is Not Empty."),
translate("Install",
"If the path you selected is an \"Hamsi Manager\" installation path, <b>I recommend you to delete the older files.</b><br>Do you want me to clear the installation path/folder for you?<br><b>Note: </b> Your personal settings are <b>never deleted</b>."),
translate("Install", "Yes (Recommended)"),
translate("Install", "No (Overwrite)"),
translate("Install", "Cancel"))
if currenctAnswer == translate("Install", "Yes (Recommended)"):
self.lblActions.setText(translate("Install", "Clearing Installation Path..."))
try:fu.removeFileOrDir(self.installationDirectory)
except:pass
fu.makeDirs(self.installationDirectory)
isMakeInstall = True
elif currenctAnswer == translate("Install", "No (Overwrite)"):
isMakeInstall = True
else:
isMakeInstall = False
if isMakeInstall:
Settings.setUniversalSetting("pathOfInstallationDirectory", self.installationDirectory)
directoriesAndFiles = fu.readDirectoryWithSubDirectories(fu.HamsiManagerDirectory)
self.prgbState.setRange(0, len(directoriesAndFiles))
self.lblActions.setText(translate("Install", "Copying Files And Folders..."))
installFileName = Execute.findExecutableBaseName("HamsiManagerInstaller")
for fileNo, fileName in enumerate(directoriesAndFiles):
MApplication.processEvents()
newFileName = self.installationDirectory + fileName.replace(fu.HamsiManagerDirectory,"")
if fu.isDir(fileName) and fileName.find(".svn") == -1:
try: fu.makeDirs(newFileName)
except: pass
elif (fu.isFile(fileName) and fu.getBaseName(fileName) != "install.py" and
fu.getBaseName(fileName) != installFileName and fileName.find(".svn") == -1):
try:
fu.copyFileOrDir(fileName, newFileName)
except:
fileContent = fu.readFromBinaryFile(fileName)
fu.writeToBinaryFile(newFileName, fileContent)
self.prgbState.setValue(fileNo + 1)
self.pageNo += 1
MyConfigure.installKDE4Languages()
else:
self.pageNo -= 1
else:
self.pageNo -= 1
self.lblActions.setText("")
Dialogs.showError(translate("Install", "The path you selected is not valid."),
translate("Install",
"The selected path points to a file not a folder.<br>Please choose a valid installation path."))
else:
self.pageNo -= 1
self.lblActions.setText("")
Dialogs.showError(translate("Install", "The path you selected is not valid."),
translate("Install",
"The selected path points to a file not a folder.<br>Please choose a valid installation path."))
self.pageChanged(True)
except:
from Core import ReportBug
ReportBug.ReportBug()
示例4: translate
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import askSpecial [as 别名]
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(self.installationDirectory)
fu.writeToFile(fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop"),
fileContent)
self.isInstallFinished = True
self.close()
except:
from Core import ReportBug
ReportBug.ReportBug()
if uni.isRunningAsRoot() is False and uni.isRunableAsRoot():
answer = Dialogs.askSpecial(translate("Install", "Are You Want To Run As Root?"), translate("Install",
"Hamsi Manager Installer is running with user privileges.<br>Do you want to run Hamsi Manager installer with root rights?<br><b>Note: </b>The other users on your system has to inherit these permissions and install the program to a location other than their /home directories."),
translate("Install", "Yes"), translate("Install", "No (Continue as is)"), None)
if answer == translate("Install", "Yes"):
NewApp = Execute.executeAsRootWithThread([], "HamsiManagerInstaller")
sys.exit()
try:
MainWidget = Main()
MainWidget.setWindowTitle(translate("Install", "Hamsi Manager Installer") + " " + uni.version)
MainWidget.setGeometry(300, 300, 650, 350)
MainWidget.show()
uni.isStartingSuccessfully = True
except:
from Core import ReportBug
ReportBug.ReportBug()
sys.exit(HamsiManagerApp.exec_())
示例5: __init__
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import askSpecial [as 别名]
def __init__(self):
if len(QuickMakeParameters) > 1 or (len(QuickMakeParameters) == 1 and (
QuickMakeParameters[0] == "plugins" or QuickMakeParameters[0] == "configurator")):
answer = None
makeThisAction = None
actionName = None
isShowQuickMakeWindow = True
tempWindow = MMainWindow()
self.quickMakeWindow = QuickMakeWindow()
setMainWindow(self.quickMakeWindow)
isShowEmendWidgets = False
isCorrectCommand = True
if QuickMakeParameters[0] == "configurator":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.configurator
actionName = translate("QuickMake", "Hamsi Manager Configurator")
elif QuickMakeParameters[0] == "plugins":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.plugins
actionName = translate("QuickMake", "My Plugins")
elif QuickMakeParameters[0] == "pack":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.pack
actionName = translate("QuickMake", "Pack It Now")
elif QuickMakeParameters[0] == "hash":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.hash
actionName = translate("QuickMake", "Get Hash Digest")
elif QuickMakeParameters[0] == "checkIcon":
makeThisAction = self.quickMakeWindow.checkIcon
actionName = translate("QuickMake", "Check Directory Icon Now")
elif QuickMakeParameters[0] == "clearEmptyDirectories":
makeThisAction = self.quickMakeWindow.clearEmptyDirectories
actionName = translate("QuickMake", "Clear Empty Directories Now")
elif QuickMakeParameters[0] == "clearUnneededs":
makeThisAction = self.quickMakeWindow.clearUnneededs
actionName = translate("QuickMake", "Clear Unneededs Now")
elif QuickMakeParameters[0] == "clearIgnoreds":
makeThisAction = self.quickMakeWindow.clearIgnoreds
actionName = translate("QuickMake", "Clear Ignoreds Now")
elif QuickMakeParameters[0] == "emendFile":
isShowEmendWidgets = True
makeThisAction = self.quickMakeWindow.emendFile
actionName = translate("QuickMake", "Auto Emend Now")
elif QuickMakeParameters[0] == "emendDirectory":
isShowEmendWidgets = True
makeThisAction = self.quickMakeWindow.emendDirectory
actionName = translate("QuickMake", "Auto Emend Now")
elif QuickMakeParameters[0] == "emendDirectoryWithContents":
isShowEmendWidgets = True
makeThisAction = self.quickMakeWindow.emendDirectoryWithContents
actionName = translate("QuickMake", "Auto Emend Now (With Contents)")
elif QuickMakeParameters[0] == "copyPath":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.copyPath
actionName = translate("QuickMake", "Copy Path To Clipboard")
elif QuickMakeParameters[0] == "fileTree":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.fileTree
actionName = translate("QuickMake", "Build File Tree")
elif QuickMakeParameters[0] == "removeOnlySubFiles":
makeThisAction = self.quickMakeWindow.removeOnlySubFiles
actionName = translate("QuickMake", "Remove Sub Files")
elif QuickMakeParameters[0] == "clear":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.clear
actionName = translate("QuickMake", "Clear It Now")
elif QuickMakeParameters[0] == "textCorrector":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.textCorrector
actionName = translate("QuickMake", "Text Corrector")
elif QuickMakeParameters[0] == "search":
isShowQuickMakeWindow = False
makeThisAction = self.quickMakeWindow.search
actionName = translate("QuickMake", "Search")
else:
isCorrectCommand = False
if isCorrectCommand:
if isShowQuickMakeWindow:
if uni.getBoolValue("isShowQuickMakeWindow"):
self.quickMakeWindow.createWindow(actionName, makeThisAction, isShowEmendWidgets)
self.quickMakeWindow.show()
else:
makeThisAction()
else:
makeThisAction()
else:
answer = Dialogs.askSpecial(translate("QuickMake", "Incorrect Command"),
translate("QuickMake",
"Your action unable to process.Please try again or report this bug."),
translate("QuickMake", "Report This Bug"), translate("QuickMake", "Close"))
else:
answer = Dialogs.askSpecial(translate("QuickMake", "Missing Command"),
translate("QuickMake",
"Your action unable to process.Please try again or report this bug."),
translate("QuickMake", "Report This Bug"), translate("QuickMake", "Close"))
if answer == translate("QuickMake", "Report This Bug"):
ReportBug.ReportBug(True)
示例6: translate
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import askSpecial [as 别名]
else:
if fu.isFile(fu.joinPath(desktopPath, "HamsiManager.desktop")):
fu.removeFileOrDir(fu.joinPath(desktopPath, "HamsiManager.desktop"))
if fu.isFile(fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop")):
fu.removeFileOrDir(
fu.joinPath(fu.userDirectoryPath, ".local", "applications", "HamsiManager.desktop"))
self.isUninstallFinished = True
self.close()
except:
from Core import ReportBug
ReportBug.ReportBug()
if uni.isRunningAsRoot() is False and uni.isRunableAsRoot():
answer = Dialogs.askSpecial(translate("Uninstall", "Are You Want To Run As Root?"), translate("Uninstall",
"Hamsi Manager Uninstaller is running with user privileges.<br>Do you want to run Hamsi Manager Uninstaller with root rights?"),
translate("Uninstall", "Yes"), translate("Uninstall", "No (Continue as is)"), None)
if answer == translate("Uninstall", "Yes"):
NewApp = Execute.executeAsRootWithThread([], "HamsiManagerUninstaller")
sys.exit()
try:
MainWidget = Main()
MainWidget.setWindowTitle(translate("Uninstall", "Hamsi Manager Uninstaller") + " " + uni.version)
MainWidget.setGeometry(300, 300, 650, 350)
MainWidget.show()
uni.isStartingSuccessfully = True
except:
from Core import ReportBug
ReportBug.ReportBug()
sys.exit(HamsiManagerApp.exec_())