Beispiel #1
0
    def initialize(self):
        _import()
        """アプリを初期化する。"""
        self.setGlobalVars()

        self.proxyEnviron = proxyUtil.virtualProxyEnviron()
        self.setProxyEnviron()
        self.installThreadExcepthook()
        # update関係を準備
        if self.config.getboolean("general", "update"):
            globalVars.update.update(True)
        self.hMainView = main.MainView()
        if self.config.getboolean(self.hMainView.identifier, "maximized",
                                  False):
            self.hMainView.hFrame.Maximize()
        self.hMainView.Show()
        # sessions.dat対応
        if self.config.getint("general", "fileVersion", 100) == 100:
            if os.path.exists(constants.SESSION_FILE_NAME):
                try:
                    os.remove(constants.SESSION_FILE_NAME)
                    self.log.debug("File %s deleted." %
                                   constants.SESSION_FILE_NAME)
                except Exception as e:
                    self.log.error("Failed to delete file %s: e" %
                                   constants.SESSION_FILE_NAME)
            self.config["general"]["fileVersion"] = 101
        self.accountManager = twitcasting.accountManager.AccountManager()
        self.hasAccountIssue = False
        self.Manager = manager.manager(self.hMainView)
        self.postItem = twitcasting.postItem.PostItem()
        if len(self.accountManager.tokens) == 0:
            simpleDialog.dialog(
                _("アカウント登録"),
                _("アカウントが登録されていません。ライブに接続する前に、設定メニューのアカウントマネージャからアカウントの登録を行ってください。"
                  ))
            self.hasAccountIssue = True
            return True
        for i in self.accountManager.tokens:
            if datetime.datetime.now().timestamp() > i["expires_at"]:
                simpleDialog.dialog(
                    _("アカウントの再登録"),
                    _("期限が切れたトークンが見つかりました。設定メニューのアカウントマネージャから、再度アカウントの追加を行ってください。"
                      ))
                self.accountManager.deleteAccount(
                    self.accountManager.tokens.index(i))
                self.hasAccountIssue = True
        self.accountManager.removeUnavailableTokens()
        if len(sys.argv) == 2:
            self.hMainView.Clear()
            self.Manager.connect(sys.argv[1])
            return True
        if self.hasAccountIssue == False and self.config.getboolean(
                "general", "autoconnect", True) == True:
            self.hMainView.events.connect()
            return True
Beispiel #2
0
    def initialize(self):
        _import()
        self.log.debug(str(sys.argv))
        # 多重起動処理8
        try:
            self.mutex = win32event.CreateMutex(None, 1, constants.PIPE_NAME)
        except:
            pass
        if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS:
            try:
                lampPipe.sendPipe()
            except:
                pass
            self.mutex = 0
            sys.exit()
        else:
            lampPipe.startPipeServer()

        # プロキシの設定を適用
        self.proxyEnviron = proxyUtil.virtualProxyEnviron()
        if self.config.getboolean("network", "manual_proxy", False):
            sv = self.config.getstring("network", "proxy_server", "")
            pr = self.config.getint("network", "proxy_port", 8080, 0, 65535)
            self.proxyEnviron.set_environ(sv, pr)
        else:
            self.proxyEnviron.set_environ()

        self.SetGlobalVars()
        # メインビューを表示
        self.hMainView = main.MainView()
        if self.config.getboolean(self.hMainView.identifier, "maximized",
                                  False):
            self.hMainView.hFrame.Maximize()
        self.hMainView.Show()
        # update関係を準備
        if self.config.getboolean("general", "update"):
            globalVars.update.update(True)
        m3uloaded = False  #条件に基づいてファイルの読み込み
        if len(sys.argv) == 2 and os.path.isfile(sys.argv[1]):
            if os.path.splitext(
                    sys.argv[1])[1].lower() in globalVars.fileExpansions:
                globalVars.eventProcess.forcePlay(sys.argv[1])
            elif os.path.splitext(
                    sys.argv[1])[1] == ".m3u" or os.path.splitext(
                        sys.argv[1])[1] == ".m3u8":
                m3uManager.loadM3u(sys.argv[1])
                m3uloaded = True
        startupList = globalVars.app.config.getstring("player",
                                                      "startupPlaylist", "")
        if startupList != "" and m3uloaded == False:
            m3uManager.loadM3u(startupList, 1)
        return True
Beispiel #3
0
	def initialize(self):
		"""アプリを初期化する。"""
		#実行環境の取得(exeファイルorインタプリタ)
		self.frozen=hasattr(sys,"frozen")
		self.InitLogger()
		self.LoadSettings()
		locale.setlocale(locale.LC_TIME,self.config["general"]["locale"])
		self.SetTimeZone()
		self.InitTranslation()

		# 音声読み上げの準備
		reader=self.config["autoReadingOptions"]["output"]
		if(reader=="PCTK"):
			self.log.info("use reader 'PCTalker'")
			self.speech=accessible_output2.outputs.pc_talker.PCTalker()
		elif(reader=="NVDA"):
			self.log.info("use reader 'NVDA'")
			self.speech=accessible_output2.outputs.nvda.NVDA()
		#SAPI4はバグってるっぽいので無効にしておく
		#elif(reader=="SAPI4"):
			#self.log.info("use reader 'SAPI4'")
			#self.speech=accessible_output2.outputs.sapi4.Sapi4()
		elif(reader=="SAPI5"):
			self.log.info("use reader 'SAPI5'")
			self.speech=accessible_output2.outputs.sapi5.SAPI5()
		elif(reader=="AUTO"):
			self.log.info("use reader 'AUTO'")
			self.speech=accessible_output2.outputs.auto.Auto()
		elif(reader=="JAWS"):
			self.log.info("use reader 'JAWS'")
			self.speech=accessible_output2.outputs.jaws.Jaws()
		elif(reader=="CLIPBOARD"):
			self.log.info("use reader 'CLIPBOARD'")
			self.speech=accessible_output2.outputs.clipboard.Clipboard()
		elif(reader=="NOSPEECH"):
			self.log.info("use reader 'NOSPEECH'")
			self.speech=accessible_output2.outputs.nospeech.NoSpeech()
		else:
			self.config.set("speech","reader","AUTO")
			self.log.warning("Setting missed! speech.reader reset to 'AUTO'")
			self.speech=accessible_output2.outputs.auto.Auto()

		# メインビューを表示
		self.hMainView=main.MainView()
		self.hMainView.Show()
		self.Manager = manager.manager(self.hMainView)
		return True
Beispiel #4
0
	def initialize(self):
		"""アプリを初期化する。"""
		# プロキシの設定を適用
		if self.config.getboolean("network", "auto_proxy"):
			self.proxyEnviron = proxyUtil.virtualProxyEnviron()
			self.proxyEnviron.set_environ()
		else:
			self.proxyEnviron = None
		self.setGlobalVars()
		# update関係を準備
		if self.config.getboolean("general", "update"):
			globalVars.update.update(True)
		# メインビューを表示
		self.hMainView=main.MainView()
		if self.config.getboolean(self.hMainView.identifier,"maximized",False):
			self.hMainView.hFrame.Maximize()
		self.hMainView.Show()
		return True
Beispiel #5
0
    def initialize(self):
        _import()
        """アプリを初期化する。"""
        self.setGlobalVars()

        self.proxyEnviron = proxyUtil.virtualProxyEnviron()
        self.setProxyEnviron()
        self.installThreadExcepthook()
        # update関係を準備
        if self.config.getboolean("general", "update"):
            globalVars.update.update(True)
        self.hMainView = main.MainView()
        if self.config.getboolean(self.hMainView.identifier, "maximized",
                                  False):
            self.hMainView.hFrame.Maximize()
        self.hMainView.Show()
        self.accountManager = twitcasting.accountManager.AccountManager()
        self.hasAccountIssue = False
        self.Manager = manager.manager(self.hMainView)
        if len(self.accountManager.tokens) == 0:
            simpleDialog.dialog(
                _("アカウント登録"),
                _("アカウントが登録されていません。ライブに接続する前に、設定メニューのアカウントマネージャからアカウントの登録を行ってください。"
                  ))
            self.hasAccountIssue = True
            return True
        for i in self.accountManager.tokens:
            if datetime.datetime.now().timestamp() > i["expires_at"]:
                simpleDialog.dialog(
                    "",
                    _("期限が切れたトークンが見つかりました。設定メニューのアカウントマネージャから、再度アカウントの追加を行ってください。"
                      ))
                self.accountManager.deleteAccount(
                    self.accountManager.tokens.index(i))
                self.hasAccountIssue = True
        if len(sys.argv) == 2:
            self.hMainView.Clear()
            self.Manager.connect(sys.argv[1])
            return True
        if self.hasAccountIssue == False and self.config.getboolean(
                "general", "autoconnect", True) == True:
            self.hMainView.events.connect()
            return True