def closeEvent(self, _event): try: if uni.isRaisedAnError is False: if uni.isContinueThreadAction(): uni.cancelThreadAction() _event.ignore() uni.isStartedCloseProcess = True uni.printForDevelopers("Started closeEvent") MApplication.setQuitOnLastWindowClosed(True) try: self.PlayerBar.MusicPlayer.stop() except: pass Details.closeAllDialogs() uni.printForDevelopers("Closed Dialogs") if uni.isRaisedAnError is False: if self.Table.checkUnSavedValues() is False: uni.isStartedCloseProcess = False uni.printForDevelopers("Close ignored") _event.ignore() uni.printForDevelopers("Before self.doBeforeCloseProcesses") if self.doBeforeCloseProcesses() is False: _event.ignore() return None uni.printForDevelopers("After self.doBeforeCloseProcesses") if isActivePyKDE4: uni.printForDevelopers("Before Save KDE Configs") kconf = MGlobal.config() kconfGroup = MConfigGroup(kconf, "DirectoryOperator") self.FileManager.dirOperator.writeConfig(kconfGroup) self.FileManager.actCollection.writeSettings(kconfGroup) uni.printForDevelopers("After Save KDE Configs") uni.printForDevelopers("Before Save Configs") uni.setMySetting(self.Table.hiddenTableColumnsSettingKey, self.Table.hiddenTableColumns) Bars.setAllBarsStyleToMySettings() Records.setRecordType(1) fu.writeToBinaryFile( fu.joinPath(fu.pathOfSettingsDirectory, "LastState"), self.saveState()) Records.restoreRecordType() geometry = [self.geometry().x(), self.geometry().y(), self.geometry().width(), self.geometry().height()] uni.setMySetting("MainWindowGeometries", geometry) uni.setMySetting("lastDirectory", self.FileManager.currentDirectory) uni.setMySetting("isMainWindowMaximized", self.isMaximized()) uni.setMySetting("isShowAdvancedSelections", self.SpecialTools.isShowAdvancedSelections) uni.setMySetting("tableType", uni.tableType) uni.setMySetting("activeTabNoOfSpecialTools", self.SpecialTools.tabwTabs.currentIndex()) uni.saveSettings() Settings.saveUniversalSettings() if uni.isActiveAmarok and uni.getBoolValue("amarokIsUseHost") is False: import Amarok uni.printForDevelopers("Before Amarok.stopEmbeddedDB") Amarok.stopEmbeddedDB() uni.printForDevelopers("After Amarok.stopEmbeddedDB") uni.printForDevelopers("After Save Configs") uni.printForDevelopers("Before self.doAfterCloseProcesses") self.doAfterCloseProcesses() uni.printForDevelopers("After self.doAfterCloseProcesses") except: if ReportBug.isClose is False: ReportBug.ReportBug() _event.ignore()
def __init__(self, _isOnlyReport=False): global bugDialog, lastErrorDetails self.pathOfReportFile = None realErrorDetails = "" if bugDialog is not None: self.pathOfReportFile = bugDialog.pathOfReportFile if lastErrorDetails is not None: realErrorDetails += lastErrorDetails errorDetails = "<b>" + str( translate("ReportBug", "Note : You can check and delete your personal informations.")) + "</b><br>" try: Records.saveAllRecords() except: pass try: uni.saveSettings() except: pass if _isOnlyReport is False: lastErrorDetailsValues = sys.exc_info() uni.isRaisedAnError = True cla, error, trbk = lastErrorDetailsValues try: excArgs = error.__dict__["args"] except: excArgs = "" try: tbf = "" for x in traceback.format_tb(trbk, 5): tbf += str(x) + "<br>" except: tbf = "" realErrorDetails += "<p><b><a name='errorDetails'>" + str( translate("ReportBug", "Errors : ")) + "</a></b>" + tbf + "</p>" realErrorDetails += ( "<p><b>" + str(translate("ReportBug", "Error Name : ")) + "</b>" + str(cla.__name__) + "<br><b>" + str(translate("ReportBug", "Error : ")) + "</b>" + str(error) + "<br><b>" + str(translate("ReportBug", "Error arguments : ")) + "</b>" + str(excArgs) + "</p><hr><p><b>" + str(translate("ReportBug", "Last Signal Sender (Object Name,Object Text) : ")) + "</b>"") try: realErrorDetails += uni.trUnicode(getMainWindow().sender().objectName()) except: pass realErrorDetails += "","" try: realErrorDetails += uni.trUnicode(getMainWindow().sender().text()) except: pass realErrorDetails += """ realErrorDetails += "</p>" realErrorDetails = realErrorDetails.replace("\\n", "<br>").replace("\'", "'") lastErrorDetails = realErrorDetails errorDetails += "<hr><b>" + str(translate("ReportBug", "Active Dialog`s Titles : ")) + "</b>" try: errorDetails += str(getApplication().activeModalWidget().windowTitle()) + "," except: pass try: errorDetails += str(getApplication().activePopupWidget().windowTitle()) + "," except: pass try: errorDetails += str(getApplication().activeWindow().windowTitle()) + "," except: pass errorDetails += "<br>" try: errorDetails += "<b>" + str(translate("ReportBug", "Application Version : ")) + "</b>" errorDetails += str(uni.version) + "<br>" except: errorDetails += "<br>" try: errorDetails += "<b>" + str(translate("ReportBug", "Is Starting Successfully : ")) + "</b>" errorDetails += str(uni.isStartingSuccessfully) + "<br>" errorDetails += "<b>" + str(translate("ReportBug", "Is Quick Make : ")) + "</b>" errorDetails += str(isQuickMake) + "<br>" errorDetails += "<b>" + str(translate("ReportBug", "Quick Make Parameters : ")) + "</b>" errorDetails += str(QuickMakeParameters) + "<br>" errorDetails += "<b>" + str(translate("ReportBug", "My Parameters : ")) + "</b>" errorDetails += str(myArgvs) + "<br>" errorDetails += "<b>FileSystemCharSet : </b>" errorDetails += str(fu.defaultFileSystemEncoding) + " / " + str( sys.getfilesystemencoding()).lower() + "<br>" errorDetails += "<b>SystemCharSet : </b>" errorDetails += str(sys.getdefaultencoding().lower()) + "<br>" try: errorDetails += "<b>OS Name : </b>" errorDetails += str(os.name) + "<br>" except: errorDetails += "<br>" try: import platform errorDetails += "<b>Python Version : </b>" errorDetails += str(platform.python_version()) + "<br>" errorDetails += "<b>uname : </b>" errorDetails += str(platform.uname()) + "<br>" try: errorDetails += "<b>Linux Distribution : </b>" errorDetails += str(platform.linux_distribution()) + "<br>" except: errorDetails += "<br>" except: errorDetails += "<br>" try: errorDetails += "<b>PyQt4 (Qt) Version : </b>" errorDetails += str(PYQT_VERSION_STR) + " (" + str(MT_VERSION_STR) + ")<br>" except: errorDetails += "<br>" try: from PyKDE4 import kdecore errorDetails += "<b>PyKDE4 Version : </b>" errorDetails += str(kdecore.versionString()) + "<br>" except: errorDetails += "<br>" settingKeys = list(uni.MySettings.keys()) settingKeys.sort() for keyName in settingKeys: if uni.willNotReportSettings.count(keyName) == 0: errorDetails += "<b>" + str(keyName) + " : " + "</b>" errorDetails += str(uni.MySettings[keyName]) + "<br>" except: pass try: errorDetails += "<b>" + str(translate("ReportBug", "Table Type No : ")) + "</b>" + str( uni.tableType) + "<br>" except: pass errorDetails += str(realErrorDetails) self.createErrorPage(errorDetails) if bugDialog is None: bugDialog = ReportBugDialog(errorDetails, self.pathOfReportFile) else: try: bugDialog.teErrorDetails.setHtml(str(errorDetails.replace("<hr>", ""))) except: bugDialog.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.")) bugDialog.teErrorDetails.setEnabled(False) bugDialog.show()
def loadFinished(self, _bitti): try: if (_bitti): if self.isDownloading is False: self.setFixedHeight(170) self.prgbState.setVisible(False) self.lblInfo.setVisible(True) self.updateInformations = str(self.wvWeb.page().mainFrame().toPlainText()).split("\n") if len(self.updateInformations) != 0: if self.updateInformations[0][0] == "V": self.pbtnRemindMeLater.setVisible(False) self.cbRemindMeLater.setVisible(False) self.pbtnDownloadAndInstall.setVisible(False) self.pbtnCheckForDeveloperVersion.setVisible(False) uni.setMySetting("remindMeLaterForUpdate", "-1") uni.setMySetting("remindMeLaterShowDateForUpdate", datetime.now().strftime("%Y %m %d %H %M %S")) uni.saveSettings() try: lastVersion = int(self.updateInformations[0].replace("V", "").replace(".", "")) except: lastVersion = uni.intversion - 1 if lastVersion > uni.intversion: self.pbtnDownloadAndInstall.setVisible(True) self.pbtnRemindMeLater.setVisible(True) self.cbRemindMeLater.setVisible(True) details = "" for detail in self.updateInformations[4:]: details += detail + "<br>" self.lblInfo.setText(str(translate("UpdateControl", "Version %s is available. Please download and install the new release.<br>" + "%s For detailed information: <a href='%s' target='_blank'>Hamsi Manager</a><br>You can download from <a href='%s' target='_blank'>Hamsi Manager %s</a>")) % ( self.updateInformations[0] + self.updateInformations[3], details, self.updateInformations[2], self.updateInformations[1], self.updateInformations[0])) self.setFixedHeight(330) elif lastVersion < uni.intversion: self.pbtnDownloadAndInstall.setVisible(True) if self.isNotInstall is False: self.pbtnDownloadAndInstall.setText( translate("UpdateControl", "Download and Install") + " (!)") else: self.pbtnDownloadAndInstall.setText(translate("UpdateControl", "Download") + " (!)") self.pbtnRemindMeLater.setVisible(True) self.cbRemindMeLater.setVisible(True) details = "" for detail in self.updateInformations[4:]: details += detail + "<br>" self.lblInfo.setText(str(str(translate("UpdateControl", "Lastest stable version is %s. You currently are using the version for developers.You can continue to use the current version.<br>If you want a more accurate version, please download and install this version.<br>%s For detailed information: <a href='%s' target='_blank'>Hamsi Manager</a><br>You can download from <a href='%s' target='_blank'>Hamsi Manager %s</a>")) % ( self.updateInformations[0] + self.updateInformations[3], details, self.updateInformations[2], self.updateInformations[1], self.updateInformations[0]))) self.pbtnCancel.setText(translate("UpdateControl", "Ok")) self.pbtnCheckForDeveloperVersion.setVisible(True) self.setFixedHeight(330) else: self.lblInfo.setText(str(translate("UpdateControl", "You are already using the latest release.<br>For detailed information: <a href='%s' target='_blank'>Hamsi Manager</a>")) % ( self.updateInformations[2])) self.pbtnCancel.setText(translate("UpdateControl", "Ok")) uni.setMySetting("lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) else: uni.setMySetting("lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) Dialogs.showError(translate("UpdateControl", "Cannot Fetch Release Information"), translate("UpdateControl", "Cannot fetch release information. Please retry later.<br>If you are constantly receiving this error, please visit \"http://hamsiapps.com/HamsiManager\".")) self.close() else: uni.setMySetting("lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) Dialogs.showError(translate("UpdateControl", "Cannot Fetch Release Information"), translate("UpdateControl", "Cannot fetch release information. Please retry later.<br>If you are constantly receiving this error, please visit \"http://hamsiapps.com/HamsiManager\".")) self.close() else: self.lblInfo.setText(translate("UpdateControl", "Download complete.")) else: uni.setMySetting("lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) Dialogs.showError(translate("UpdateControl", "Cannot Fetch Release Information"), translate("UpdateControl", "Cannot fetch release information. Please retry later.<br>If you are constantly receiving this error, please visit \"http://hamsiapps.com/HamsiManager\".")) self.close() except: ReportBug.ReportBug()
def remindMeLaterAndClose(self): uni.setMySetting("remindMeLaterForUpdate", self.cbRemindMeLater.value()) uni.saveSettings() self.close()
def loadFinished(self, _bitti): try: if (_bitti): if self.isDownloading is False: self.setFixedHeight(170) self.prgbState.setVisible(False) self.lblInfo.setVisible(True) self.updateInformations = str( self.wvWeb.page().mainFrame().toPlainText()).split( "\n") if len(self.updateInformations) != 0: if self.updateInformations[0][0] == "V": self.pbtnRemindMeLater.setVisible(False) self.cbRemindMeLater.setVisible(False) self.pbtnDownloadAndInstall.setVisible(False) self.pbtnCheckForDeveloperVersion.setVisible(False) uni.setMySetting("remindMeLaterForUpdate", "-1") uni.setMySetting( "remindMeLaterShowDateForUpdate", datetime.now().strftime("%Y %m %d %H %M %S")) uni.saveSettings() try: lastVersion = int( self.updateInformations[0].replace( "V", "").replace(".", "")) except: lastVersion = uni.intversion - 1 if lastVersion > uni.intversion: self.pbtnDownloadAndInstall.setVisible(True) self.pbtnRemindMeLater.setVisible(True) self.cbRemindMeLater.setVisible(True) details = "" for detail in self.updateInformations[4:]: details += detail + "<br>" self.lblInfo.setText( str( translate( "UpdateControl", "Version %s is available. Please download and install the new release.<br>" + "%s For detailed information: <a href='%s' target='_blank'>Hamsi Manager</a><br>You can download from <a href='%s' target='_blank'>Hamsi Manager %s</a>" )) % (self.updateInformations[0] + self.updateInformations[3], details, self.updateInformations[2], self.updateInformations[1], self.updateInformations[0])) self.setFixedHeight(330) elif lastVersion < uni.intversion: self.pbtnDownloadAndInstall.setVisible(True) if self.isNotInstall is False: self.pbtnDownloadAndInstall.setText( translate("UpdateControl", "Download and Install") + " (!)") else: self.pbtnDownloadAndInstall.setText( translate("UpdateControl", "Download") + " (!)") self.pbtnRemindMeLater.setVisible(True) self.cbRemindMeLater.setVisible(True) details = "" for detail in self.updateInformations[4:]: details += detail + "<br>" self.lblInfo.setText( str( str( translate( "UpdateControl", "Lastest stable version is %s. You currently are using the version for developers.You can continue to use the current version.<br>If you want a more accurate version, please download and install this version.<br>%s For detailed information: <a href='%s' target='_blank'>Hamsi Manager</a><br>You can download from <a href='%s' target='_blank'>Hamsi Manager %s</a>" )) % (self.updateInformations[0] + self.updateInformations[3], details, self.updateInformations[2], self.updateInformations[1], self.updateInformations[0]))) self.pbtnCancel.setText( translate("UpdateControl", "Ok")) self.pbtnCheckForDeveloperVersion.setVisible( True) self.setFixedHeight(330) else: self.lblInfo.setText( str( translate( "UpdateControl", "You are already using the latest release.<br>For detailed information: <a href='%s' target='_blank'>Hamsi Manager</a>" )) % (self.updateInformations[2])) self.pbtnCancel.setText( translate("UpdateControl", "Ok")) uni.setMySetting( "lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) else: uni.setMySetting( "lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) Dialogs.showError( translate("UpdateControl", "Cannot Fetch Release Information"), translate( "UpdateControl", "Cannot fetch release information. Please retry later.<br>If you are constantly receiving this error, please visit \"http://hamsiapps.com/HamsiManager\"." )) self.close() else: uni.setMySetting( "lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) Dialogs.showError( translate("UpdateControl", "Cannot Fetch Release Information"), translate( "UpdateControl", "Cannot fetch release information. Please retry later.<br>If you are constantly receiving this error, please visit \"http://hamsiapps.com/HamsiManager\"." )) self.close() else: self.lblInfo.setText( translate("UpdateControl", "Download complete.")) else: uni.setMySetting("lastUpdateControlDate", datetime.now().strftime("%Y %m %d %H %M %S")) Dialogs.showError( translate("UpdateControl", "Cannot Fetch Release Information"), translate( "UpdateControl", "Cannot fetch release information. Please retry later.<br>If you are constantly receiving this error, please visit \"http://hamsiapps.com/HamsiManager\"." )) self.close() except: ReportBug.ReportBug()
plt = MGlobalSettings.createApplicationPalette(config) else: plt = MApplication.desktop().palette() MApplication.setPalette(plt) uni.printForDevelopers("Before Core.checkMyModules") if Core.checkMyModules(HamsiManagerApp): setApplication(HamsiManagerApp) if CommandLineOptions.isQuickMake: uni.printForDevelopers("QuickMake") try: from Core import QuickMake quickMake = QuickMake.QuickMake() if CommandLineOptions.isQuickMake: res = HamsiManagerApp.exec_() uni.saveSettings() uni.printForDevelopers("Shutting down, result %d" % res) except: ReportBug.ReportBug() res = HamsiManagerApp.exec_() uni.printForDevelopers("Shutting down, result %d" % res) if CommandLineOptions.isQuickMake is False: uni.printForDevelopers("NotQuickMake") try: uni.printForDevelopers("Before MyMainWindow") from Core import MyMainWindow currentMainWindow = MyMainWindow.MyMainWindow() uni.printForDevelopers("After MyMainWindow") if str(currentMainWindow.windowTitle()) == "": currentMainWindow.setWindowTitle("Hamsi Manager " + uni.version)