Exemple #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
Exemple #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
Exemple #3
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
Exemple #4
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
Exemple #5
0
    def initialize(self):
        """アプリを初期化する。"""
        self.initUpdater()
        # プロキシの設定を適用
        self.proxyEnviron = proxyUtil.virtualProxyEnviron()
        self.setProxyEnviron()
        # スレッドで例外が起きてもsys.exceptHookが呼ばれるようにする
        self.installThreadExcepthook()
        # アップデートを実行
        if self.config.getboolean("general", "update"):
            globalVars.update.update(True)

        t = misc.Timer()

        wx.DisableAsserts()
        self.error_sound_handle = None
        self.InitSound()
        self.LoadUserCommandSettings()
        self.LoadUserExtentionSettings()
        self.InitCaches()
        workerThreads.Start()

        # 起動サウンドの再生
        self.PlaySound(self.config["sounds"]["startup"])

        self.log.debug("finished environment setup (%f seconds from start)" %
                       t.elapsed)

        # メインビューを表示
        from views import main
        self.hMainView = main.View("mainView")
        self.hMainView.Initialize()
        misc.InitContextMenu(self.hMainView.hFrame.GetHandle())
        self.log.debug("Finished mainView setup (%f seconds from start)" %
                       t.elapsed)
        return True