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()
Example #2
0
 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()
Example #3
0
 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()
Example #4
0
    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="&nbsp;&nbsp;&nbsp;%s&nbsp;&nbsp;&nbsp;&nbsp;"></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)
Example #5
0
    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()
Example #6
0
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():