Example #1
0
def exchandler(type, exc, tb):
    msg = traceback.format_exception(type, exc, tb)
    try:
        for i in globalVars.app.Manager.timers:
            i.Stop()
        globalVars.app.Manager.livePlayer.exit()
    except:
        pass
    if type == requests.exceptions.ConnectionError:
        simpleDialog.errorDialog(
            _("通信に失敗しました。インターネット接続を確認してください。プログラムを終了します。"))
    elif type == requests.exceptions.ProxyError:
        simpleDialog.errorDialog(
            _("通信に失敗しました。プロキシサーバーの設定を確認してください。プログラムを終了します。"))
    else:
        if not hasattr(sys, "frozen"):
            print("".join(msg))
            winsound.Beep(1000, 1000)
            try:
                globalVars.app.say(str(msg[-1]))
            except:
                pass
        else:
            simpleDialog.winDialog(
                "error",
                "An error has occured. Contact to the developer for further assistance. Detail:"
                + "\n".join(msg[-2:]))
    try:
        f = open("errorLog.txt", "a")
        f.writelines(msg)
        f.close()
    except:
        pass
    os._exit(1)
Example #2
0
File: update.py Project: riku22/TCV
 def run(self):
     self.log.info("downloading update file...")
     url = self.info["updater_url"]
     self._file_name = "update_file.zip"
     response = requests.get(url, stream=True)
     total_size = int(response.headers["Content-Length"])
     wx.CallAfter(self.dialog.gauge.SetRange, (total_size))
     now_size = 0
     broken = False
     with open(self._file_name, mode="wb") as f:
         for chunk in response.iter_content(chunk_size=1024):
             if self.needStop:
                 broken = True
                 print("broken!")
                 break
             f.write(chunk)
             now_size += len(chunk)
             wx.CallAfter(self.dialog.gauge.SetValue, (now_size))
             wx.YieldIfNeeded()
     if broken:
         self.log.info("downloading update file has canceled by user")
         os.remove(self._file_name)
         wx.CallAfter(self.dialog.end)
         return
     self.log.info("update file downloaded")
     wx.CallAfter(self.dialog.end)
     self.reserve = True
     simpleDialog.winDialog(_("アップデート"),
                            _("ダウンロードが完了しました。\nソフトウェア終了時に、自動でアップデートされます。"))
     return
Example #3
0
def exchandler(type, exc, tb):
    msg = traceback.format_exception(type, exc, tb)
    print("".join(msg))
    try:
        f = open("errorLog.txt", "a")
        f.writelines(msg)
        f.close()
    except:
        pass

    # パイプとミューテックスの終了
    try:
        import lampPipe, globalVars
        lampPipe.stopPipeServer()
        win32event.ReleaseMutex(globalVars.app.mutex)
    except:
        pass

    if hasattr(sys, "frozen") == False:
        winsound.Beep(1500, 100)
        winsound.Beep(1500, 100)
        winsound.Beep(1500, 300)
    else:
        simpleDialog.winDialog(
            "error",
            "An error has occured. Contact to the developer for further assistance. Detail:"
            + "\n".join(msg[-2:]))
    os._exit(1)
Example #4
0
	def InitSpeech(self):
		# 音声読み上げの準備
		try:
			self._InitSpeech()
		except OutputError as e:
			self.log.error("Failed to initialize speech output.")
			self.log.error(traceback.format_exc())
			simpleDialog.winDialog(_("音声エンジンエラー"), _("音声読み上げ機能の初期化に失敗したため、読み上げ機能を使用できません。出力先の変更をお試しください。"))
			self.speech = accessible_output2.outputs.nospeech.NoSpeech()
Example #5
0
def exchandler(type, exc, tb):
    msg = traceback.format_exception(type, exc, tb)
    if not hasattr(sys, "frozen"):
        print("".join(msg))
        winsound.Beep(1000, 1000)
        try:
            globalVars.app.say(str(msg[-1]))
        except:
            pass
    else:
        simpleDialog.winDialog(
            "error",
            "An error has occurred. Contact to the developer for further assistance. Detail:"
            + "\n".join(msg[-2:]))
    try:
        f = open("errorLog.txt", "a")
        f.writelines(msg)
        f.close()
    except:
        pass
    os._exit(1)
Example #6
0
File: update.py Project: riku22/TCV
 def update(self, auto=False):
     self.log.info("called update auto = %s" % str(auto))
     if not hasattr(sys, "frozen"):
         self.log.info("update is unavailable reason: not supported")
         if not auto:
             simpleDialog.winDialog(_("アップデート"),
                                    _("このバージョンではアップデートを使用できません。"))
         return
     # アップデータチェック
     updaterCheck = False
     try:
         if getUpdaterVersion()[0] == getUpdaterVersion()[1]:
             updaterCheck = True
     except:
         pass
     if not updaterCheck:
         self.log.info("update is unavailable reason: updater not found")
         simpleDialog.winDialog(
             _("アップデート"), _("アップデータが利用できません。お手数ですが、再度ソフトウェアをダウンロードしてください。"))
         return
     self.log.info("starting to check update...")
     params = {
         "name": constants.APP_NAME,
         "updater_version": constants.UPDATER_VERSION,
         "version": constants.APP_VERSION
     }
     timeout = globalVars.app.config.getint("general", "timeout", 3)
     try:
         response = requests.get(constants.UPDATE_URL,
                                 params,
                                 timeout=timeout)
     except requests.exceptions.ConnectTimeout:
         if not auto:
             self.log.info(
                 "failed to check update reason: connection timed out")
             simpleDialog.winDialog(_("アップデート"), _("サーバーへの通信がタイムアウトしました。"))
         return
     except requests.exceptions.ConnectionError as e:
         print(e)
         self.log.info(
             "failed to check update reason: connection is not successful")
         if not auto:
             simpleDialog.winDialog(
                 _("アップデート"), _("サーバーへの接続に失敗しました。インターネット接続などをご確認ください"))
         return
     except:
         traceback.print_exc()
         self.log.info("an error has occurred.")
         if not auto:
             simpleDialog.errorDialog(_("サーバーとの通信中に不明なエラーが発生しました。"))
         return
     if not response.status_code == 200:
         self.log.info(
             "failed to check update reason: the server returned invalid status code %d"
             % (response.status_code))
         if not auto:
             simpleDialog.winDialog(_("アップデート"), _("サーバーとの通信に失敗しました。"))
         return
     self.log.info(
         "checking update succeeded. analyzing the response from the server..."
     )
     self.info = response.json()
     code = self.info["code"]
     if code == errorCodes.UPDATER_LATEST:
         self.log.info(
             "update was not done reason: this is the latest version")
         if not auto:
             simpleDialog.winDialog(_("アップデート"),
                                    _("現在のバージョンが最新です。アップデートの必要はありません。"))
         return
     elif code == errorCodes.UPDATER_BAD_PARAM:
         self.log.info(
             "update was not done reason: Request parameter is invalid")
         if not auto:
             simpleDialog.winDialog(_("アップデート"),
                                    _("リクエストパラメーターが不正です。開発者まで連絡してください"))
         return
     elif code == errorCodes.UPDATER_NOT_FOUND:
         self.log.info("update was not done reason: not registered")
         if not auto:
             simpleDialog.winDialog(_("アップデート"),
                                    _("アップデーターが登録されていません。開発者に連絡してください。"))
         return
     elif code == errorCodes.UPDATER_NEED_UPDATE or errorCodes.UPDATER_VISIT_SITE:
         self.log.info("opening update dialog...")
         self.dialog = updateDialog.updateDialog()
         self.dialog.Initialize()
         self.dialog.Show()
     return