本文整理汇总了Python中Core.Dialogs.getSaveFileName方法的典型用法代码示例。如果您正苦于以下问题:Python Dialogs.getSaveFileName方法的具体用法?Python Dialogs.getSaveFileName怎么用?Python Dialogs.getSaveFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core.Dialogs
的用法示例。
在下文中一共展示了Dialogs.getSaveFileName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: destinationClicked
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import getSaveFileName [as 别名]
def destinationClicked(self):
imagePath = Dialogs.getSaveFileName(translate("ImageDetails", "Save As"),
self.lePathOfDestination.text(), str(
translate("ImageDetails", "Images (*.%s)") % uni.getStringFromList(uni.getListValue("imageExtensions"),
" *.")), 0)
if imagePath is not None:
self.lePathOfDestination.setText(imagePath)
示例2: willDownload
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import getSaveFileName [as 别名]
def willDownload(self, _request):
try:
defaultFileName = str(MFileInfo(str(trStr(_request.url()))).fileName())
fileDialogTitle = translate("UpdateControl", "You Can Click Cancel To Update Without Saving The Package.")
if self.isNotInstall:
fileDialogTitle = translate("UpdateControl", "Save New Version Of Hamsi Manager")
fileName = Dialogs.getSaveFileName(fileDialogTitle,
fu.joinPath(fu.getDirName(fu.HamsiManagerDirectory), defaultFileName))
if self.isNotInstall is False or fileName is not None:
if fileName is None:
import random
fileName = fu.joinPath(fu.getTempDir(), defaultFileName[:-7] + "-" + str(
random.randrange(0, 1000000)) + defaultFileName[-7:])
self.pbtnDownloadAndInstall.setEnabled(False)
newRequest = _request
newRequest.setAttribute(MNetworkRequest.User, trQVariant(fileName))
networkManager = self.wvWeb.page().networkAccessManager()
reply = networkManager.get(newRequest)
self.isFileExist = True
self.connect(reply, SIGNAL("downloadProgress(qint64,qint64)"), self.downloading)
self.connect(reply, SIGNAL("finished()"), self.downloaded)
self.connect(reply, SIGNAL("error(QNetworkReply::NetworkError)"), self.errorOccurred)
except:
ReportBug.ReportBug()
示例3: saveAsImage
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import getSaveFileName [as 别名]
def saveAsImage(self):
try:
if self.lstwImages.currentRow() != -1:
imagePath = Dialogs.getSaveFileName(translate("MusicDetails", "Save As"),
fu.getDirName(self.musicValues["path"]),
str(translate("MusicDetails", "Images (*.%s)")) % (str(
self.musicValues["images"][self.lstwImages.currentRow()][
2]).split("/")[1]), 0)
if imagePath is not None:
sourceFile = fu.joinPath(fu.getTempDir(), "HamsiManager-image-file." +
self.musicValues["images"][self.lstwImages.currentRow()][2].split("/")[1])
fu.writeToBinaryFile(sourceFile, self.musicValues["images"][self.lstwImages.currentRow()][3])
fu.moveOrChange(sourceFile, imagePath)
except:
ReportBug.ReportBug()
示例4: clickedAnAction
# 需要导入模块: from Core import Dialogs [as 别名]
# 或者: from Core.Dialogs import getSaveFileName [as 别名]
def clickedAnAction(_action):
try:
actionName = _action.objectName()
if actionName == "Open State":
f = Dialogs.getOpenFileName(translate("MenuBar", "Open State Of Hamsi Manager"),
fu.userDirectoryPath,
translate("MenuBar", "Application Runner") + " (*.desktop)")
if f is not None:
Settings.openStateOfSettings(f)
elif actionName == "Save State":
f = Dialogs.getSaveFileName(translate("MenuBar", "Save State Of Hamsi Manager"),
fu.joinPath(fu.userDirectoryPath, "HamsiManager.desktop"),
translate("MenuBar", "Application Runner") + " (*.desktop)")
if f is not None:
Settings.saveStateOfSettings(f)
Dialogs.show(translate("MenuBar", "Current State Saved"),
translate("MenuBar",
"Current state saved with preferences.<br>You can continue where you left off."))
elif actionName == "With This Profile (My Settings)":
if Execute.executeAsRootWithThread(["--sDirectoryPath", fu.pathOfSettingsDirectory], "HamsiManager"):
getMainWindow().close()
else:
Dialogs.showError(translate("MenuBar", "Can Not Run As Root"),
translate("MenuBar", "Hamsi Manager can not run as root."))
elif actionName == "With Root Profile (Own Settings)":
if Execute.executeAsRootWithThread([], "HamsiManager"):
getMainWindow().close()
else:
Dialogs.showError(translate("MenuBar", "Can Not Run As Root"),
translate("MenuBar", "Hamsi Manager can not run as root."))
elif actionName == "Quit":
getMainWindow().close()
elif actionName == "HTML Format":
if _action.parent().objectName() == "Export To File":
getMainTable().exportValues("file", "html", "title")
elif _action.parent().objectName() == "Show In New Window":
getMainTable().exportValues("dialog", "html", "title")
elif _action.parent().objectName() == "Copy To Clipboard":
getMainTable().exportValues("clipboard", "html", "title")
elif actionName == "Text Format":
if _action.parent().objectName() == "Export To File":
getMainTable().exportValues("file", "plainText", "title")
elif _action.parent().objectName() == "Show In New Window":
getMainTable().exportValues("dialog", "plainText", "title")
elif _action.parent().objectName() == "Copy To Clipboard":
getMainTable().exportValues("clipboard", "plainText", "title")
elif actionName == "HTML Format (File Tree)":
if _action.parent().objectName() == "Export To File":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "file", "html", "fileTree",
"title")
elif _action.parent().objectName() == "Show In New Window":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "dialog", "html", "fileTree",
"title")
elif _action.parent().objectName() == "Copy To Clipboard":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "clipboard", "html", "fileTree",
"title")
elif actionName == "Text Format (File Tree)":
if _action.parent().objectName() == "Export To File":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "file", "plainText", "fileTree",
"title")
elif _action.parent().objectName() == "Show In New Window":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "dialog", "plainText", "fileTree",
"title")
elif _action.parent().objectName() == "Copy To Clipboard":
fu.getFileTree((getMainWindow().FileManager.currentDirectory), 0, "clipboard", "plainText",
"fileTree", "title")
elif actionName == "About QT":
if isActivePyKDE4:
QMessageBox.aboutQt(getMainWindow(), translate("MenuBar", "About QT"))
else:
MMessageBox.aboutQt(getMainWindow(), translate("MenuBar", "About QT"))
elif actionName == "Options":
from Options import OptionsForm
OptionsForm.OptionsForm(getMainWindow())
elif actionName == "My Plugins":
import MyPlugins
MyPlugins.MyPlugins()
elif actionName == "Reconfigure":
from Tools import Configurator
Configurator.Configurator("configurePage")
elif actionName == "My Plugins (System)":
Execute.execute(["--qm", "--plugins", "--runAsRoot"], "HamsiManager")
elif actionName == "Reconfigure (System)":
Execute.execute(["--qm", "--configurator", "--runAsRoot"], "HamsiManager")
elif actionName == "Update":
from Core import UpdateControl
UpdateControl.UpdateControl(getMainWindow())
elif actionName == "Report Bug":
ReportBug.ReportBug(True)
elif actionName == "Suggest Idea":
from Core import SuggestIdea
SuggestIdea.SuggestIdea()
elif actionName == "About Hamsi Manager":
if isActivePyKDE4 is False:
MMessageBox.about(getMainWindow(), translate("MenuBar", "About Hamsi Manager"),
#.........这里部分代码省略.........