本文整理汇总了Python中FileUtils.getTempDir方法的典型用法代码示例。如果您正苦于以下问题:Python FileUtils.getTempDir方法的具体用法?Python FileUtils.getTempDir怎么用?Python FileUtils.getTempDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils.getTempDir方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: willDownload
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getTempDir [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()
示例2: saveAsImage
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getTempDir [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()
示例3: createErrorPage
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getTempDir [as 别名]
def createErrorPage(self, _errorDetails):
_errorDetails = _errorDetails.replace("\"", """).replace("\'", "'")
language = "en_GB"
if "language" in uni.MySettings:
language = uni.MySettings["language"]
htmlString = (
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' +
'<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Hamsi Manager</title></head><body>' +
'<center>' +
'<form action="http://hamsiapps.com/ForMyProjects/ReportBug.php" method="post">' +
'<TABLE><TR><TD valign="top">%s'
'</TD><TD colspan=2><textarea ROWS="7" COLS="40" name="userNotes"></textarea></TD></TR></TABLE>' +
'<TABLE><TR><TD valign="top" colspan=2>%s</TD><TD align="right"><input type="search" name="nameAndSurname" value=""></input></TD></TR>' +
'<TR><TD valign="top" colspan=2>%s</TD><TD align="right"><input type="search" name="mail" value=""></input></TD></TR></TABLE>' +
'<TABLE><TR><TD align="right"><input name="send" type="submit" value=" %s "></TD></TR></TABLE>' +
'<INPUT TYPE="hidden" name="error" value="%s" />' +
'<INPUT TYPE="hidden" name="thankYouMessages" value="%s" />' +
'<INPUT TYPE="hidden" name="p" value="HamsiManager" />' +
'<INPUT TYPE="hidden" name="l" value="' + str(language) + '" />' +
'<INPUT TYPE="hidden" name="v" value="' + str(uni.intversion) + '" /></form>' +
'%s</center></body></html>'
) % (
str(translate("ReportBug",
"<b>Error description :</b> <br>(Be can null)<br><b>Note:</b>Please write what you did before you received the error here.")),
str(translate("ReportBug", "<b>Name and Surname :</b> (Be can null)")),
str(translate("ReportBug",
"<b>E-mail address :</b> (Be can null)<br><b>Note:</b>Will be kept strictly confidential. It will be used solely to report you back once the problem is solved..")),
str(translate("ReportBug", "Report Bug")),
_errorDetails,
str(translate("ReportBug",
"Thank you for sending us your error report. You have already contributed a lot to make the next release even better..<br>")),
_errorDetails)
if self.pathOfReportFile is None:
import random
self.pathOfReportFile = fu.joinPath(fu.getTempDir(), "HamsiManager-ErrorOutput-" + str(
random.randrange(0, 1000000)) + ".html")
fu.writeToFile(self.pathOfReportFile, htmlString)
示例4: str
# 需要导入模块: import FileUtils [as 别名]
# 或者: from FileUtils import getTempDir [as 别名]
import FileUtils as fu
includes = []
excludes = ["_gtkagg", "_tkagg", "bsddb", "curses", "email",
"pywin.debugger", "pywin.debugger.dbgcon", "pywin.dialogs",
"tcl", "Tkconstants", "Tkinter", "PySide"]
path = sys.path + [HamsiManagerDirectory]
include_files = [(os.path.join(HamsiManagerDirectory, "Amarok"), "Amarok"),
(os.path.join(HamsiManagerDirectory, "Languages"), "Languages"),
(os.path.join(HamsiManagerDirectory, "MyPlugins"), "MyPlugins"),
(os.path.join(HamsiManagerDirectory, "SearchEngines"), "SearchEngines"),
(os.path.join(HamsiManagerDirectory, "Taggers"), "Taggers"),
(os.path.join(HamsiManagerDirectory, "Themes"), "Themes")]
fu.writeToFile(fu.joinPath(fu.getTempDir(), "HamsiManagerHasBeenBuilt"),
str(sys.argv) + "\nPlease, don't remove this file.")
include_files.append((os.path.join(fu.getTempDir(), "HamsiManagerHasBeenBuilt"), "HamsiManagerHasBeenBuilt"))
data_files = []
if os.name == "posix":
from Core import MyConfigure
installationDirectory = fu.joinPath("/", "usr", "lib", "HamsiManager-" + uni.version)
fileContent = MyConfigure.getConfiguredDesktopFileContent(installationDirectory, "/usr/bin/hamsi")
fu.writeToFile(fu.joinPath(fu.getTempDir(), "HamsiManager.desktop"), fileContent)
data_files.append(
(fu.joinPath("/", "usr", "share", "applications"), [fu.joinPath(fu.getTempDir(), "HamsiManager.desktop")]))
if uni.isAvailableKDE4():