Пример #1
0
    def setupBDL(self, ui, window):
        self.ui = ui
        self.window = window
        self.ui.menuBar.hide(
        )  # TODO: qt designer can't add menus with a menubar???
        bdlWidgets.setBDLInstance(self)

        self.lastDir = '.'
        self.updateReady = False
        self.bdlAutoDetectIWADs = True
        self.bdlRejectBadIWADs = True
        config.loadConfig(self)

        self.connectWidgetSignals()
        update.checkUpdateSuccess(self)

        if self.updateReady:  # update is still queued from previous session
            self.ui.tabWidget.setTabText(3, 'bdl (!)')
            self.ui.bdlUpdateButton.setToolTip(
                'An update was found for you last session.')
            self.ui.bdlUpdateButton.setEnabled(True)
        else:  # no update queued -> if it's a new day check for updates
            try:
                if self.ui.bdlAutoUpdateCheck.isChecked():
                    lastCheck = datetime.strptime(
                        self.ui.bdlUpdateLastCheckLabel.text(),
                        'Last check: %m/%d/%y').date()
                    today = datetime.now().date()
                    if today > lastCheck:
                        update.checkUpdate(self)
            except:
                pass

        # Extra stuff
        self.ui.complevelCombo.setItemData(0, "-complevel 2", 3)
        self.ui.complevelCombo.setItemData(1, "-complevel 3", 3)
        self.ui.complevelCombo.setItemData(2, "-complevel 4", 3)
        self.ui.complevelCombo.setItemData(3, "-complevel 9", 3)
        self.ui.complevelCombo.setItemData(4, "-complevel 11", 3)

        self.autoRecording = False  # Not in config
        self.autoRecordTimer = QtCore.QTimer()
        self.autoRecordTimer.timeout.connect(self.autoRecordTimeout)
        self.autoRecordProcess = None
        self.autoRecordDemoAttempt = 1
        self.autoRecordDemoSession = 1

        self.ui.portRenameLineEdit.hide()
        self.ui.demoGroup.setMaximumHeight(
            80 if self.ui.demoGroup.isChecked() else 13)
        self.ui.warpGroup.setMaximumHeight(
            69 if self.ui.warpGroup.isChecked() else 13)
        self.ui.paramGroup.setMaximumHeight(
            16777215 if self.ui.paramGroup.isChecked() else 13)
        self.ui.demoRecordNameLineEdit.setTextMargins(0, 0, 8, 0)
        self.ui.bdlDownloadLabel.hide()
        self.ui.bdlDownloadProgress.hide()
        self.resetPWADsCheckable()
Пример #2
0
    def __init__(self, parent=None):
        super(MainWindows, self).__init__(parent)

        if os.path.exists('save.json') != True:
            defaultSAVE = {"mdp": []}
            with open('save.json', 'w', encoding='utf-8') as f:
                json.dump(defaultSAVE, f)

        self.updateINFO = checkUpdate()
        self.loadType()
        self.loadLangue()

        self.initUI()
Пример #3
0
 def callupdate(self):
     update_avalible = update.checkUpdate(self)
     if update_avalible > 0:
         self.update_btn.setEnabled(True)
         is_update = QMessageBox.information(
             self, "选择是否更新", "有可用更新,是否立即更新?",
             QMessageBox.Yes | QMessageBox.No)
         if is_update == QMessageBox.Yes:
             update.doUpdate(self)
             self.update_btn.setEnabled(False)
             is_showgxtxt = QMessageBox.information(
                 self, "是否查看更新日志", "更新完成,是否查看更新日志?",
                 QMessageBox.Yes | QMessageBox.No)
             if is_showgxtxt == QMessageBox.Yes:
                 self.showtxt()
             is_excute = QMessageBox.information(
                 self, "选择是否启动游戏", "更新完成,大侠要直接开始游戏么?",
                 QMessageBox.Yes | QMessageBox.No)
             if is_excute == QMessageBox.Yes:
                 self.excuteExe()
     elif update_avalible < 0:
         self.update_btn.setEnabled(True)
     else:
         pass
Пример #4
0
    def OnMenuSelect(self, event):
        """メニュー項目が選択されたときのイベントハンドら。"""
        #ショートカットキーが無効状態のときは何もしない
        if not self.parent.shortcutEnable:
            event.Skip()
            return

        selected = event.GetId()  #メニュー識別しの数値が出る

        if selected == menuItemsStore.getRef("FILE_OPEN"):
            d = views.mkOpenDialog.Dialog("fileOpenDialog")
            d.Initialize(0)  #0=ファイルダイアログ
            rtnCode = d.Show()
            if rtnCode == d.PLAYLIST:
                listManager.addItems([d.GetValue()],
                                     globalVars.app.hMainView.playlistView)
            elif rtnCode == d.QUEUE:
                listManager.addItems([d.GetValue()],
                                     globalVars.app.hMainView.queueView)
            else:
                return
        elif selected == menuItemsStore.getRef("DIR_OPEN"):
            d = views.mkOpenDialog.Dialog("directoryOpenDialog")
            d.Initialize(1)  #1=フォルダダイアログ
            rtnCode = d.Show()
            if rtnCode == d.PLAYLIST:
                listManager.addItems([d.GetValue()],
                                     globalVars.app.hMainView.playlistView)
            elif rtnCode == d.QUEUE:
                listManager.addItems([d.GetValue()],
                                     globalVars.app.hMainView.queueView)
            else:
                return
        elif selected == menuItemsStore.getRef("URL_OPEN"):
            d = views.mkOpenDialog.Dialog("urlOpenDialog")
            d.Initialize(2)  #2=URLダイアログ
            rtnCode = d.Show()
            if rtnCode == d.PLAYLIST:
                listManager.addItems([d.GetValue()],
                                     globalVars.app.hMainView.playlistView)
            elif rtnCode == d.QUEUE:
                listManager.addItems([d.GetValue()],
                                     globalVars.app.hMainView.queueView)
            else:
                return
        elif selected == menuItemsStore.getRef("M3U_OPEN"):
            m3uManager.loadM3u()
        elif selected == menuItemsStore.getRef("NEW_M3U8_SAVE"):
            m3uManager.saveM3u8()
        elif selected == menuItemsStore.getRef("M3U8_SAVE"):
            m3uManager.saveM3u8(globalVars.listInfo.playlistFile)
        elif selected == menuItemsStore.getRef("M3U_ADD"):
            m3uManager.loadM3u(None, m3uManager.ADD)
        elif selected == menuItemsStore.getRef("M3U_CLOSE"):
            m3uManager.closeM3u()
        elif selected == menuItemsStore.getRef("EXIT"):
            self.parent.hFrame.Close()
        #機能メニューのイベント
        elif selected >= constants.FILTER_LIST_MENU and selected < constants.FILTER_LIST_MENU + 500:
            globalVars.filter.get(selected -
                                  constants.FILTER_LIST_MENU).setEnable(
                                      event.IsChecked())
        elif selected == menuItemsStore.getRef("FILTER_SETTING"):
            d = filterSettingDialog.Dialog(*globalVars.filter.getDic())
            d.Initialize()
            if d.Show() == wx.ID_CANCEL:
                return
            globalVars.filter.loadDic(*d.GetValue())
        elif selected == menuItemsStore.getRef("SET_SLEEPTIMER"):
            globalVars.sleepTimer.set()
        elif selected == menuItemsStore.getRef("SET_EFFECTOR"):
            effector.effector()
        elif selected == menuItemsStore.getRef("SET_CURSOR_PLAYING"):
            if globalVars.eventProcess.playingList == constants.PLAYLIST:
                p = self.parent.playlistView
                p.Focus(p.getPointer())
                p.Select(-1, 0)
                p.Select(p.getPointer())
            else:
                globalVars.app.hMainView.notification.show(
                    _("プレイリスト上の項目を再生していません。"), 2)
        elif selected == menuItemsStore.getRef("ABOUT_PLAYING"):
            if globalVars.eventProcess.playingList == constants.PLAYLIST:
                listManager.infoDialog(listManager.getTuple(
                    constants.PLAYLIST))
            else:
                listManager.infoDialog(globalVars.listInfo.playingTmp)
        elif selected == menuItemsStore.getRef("SHOW_NET_CONTROLLER"):
            globalVars.lampController.showController()
        elif selected == menuItemsStore.getRef("SHOW_NET_FILE_MANAGER"):
            netFileManager.run()
        # 操作メニューのイベント
        elif selected == menuItemsStore.getRef("PLAY_PAUSE"):
            globalVars.eventProcess.playButtonControl()
        elif selected == menuItemsStore.getRef("STOP"):
            globalVars.eventProcess.stop()
        elif selected == menuItemsStore.getRef("PREVIOUS_TRACK"):
            globalVars.eventProcess.previousBtn()
        elif selected == menuItemsStore.getRef("NEXT_TRACK"):
            globalVars.eventProcess.nextFile(button=True)
        elif selected == menuItemsStore.getRef("VOLUME_100"):
            globalVars.eventProcess.changeVolume(vol=100)
        elif selected == menuItemsStore.getRef("VOLUME_UP"):
            globalVars.eventProcess.changeVolume(+1)
        elif selected == menuItemsStore.getRef("VOLUME_DOWN"):
            globalVars.eventProcess.changeVolume(-1)
        elif selected == menuItemsStore.getRef("MUTE"):
            globalVars.eventProcess.mute()
        elif selected == menuItemsStore.getRef("FAST_FORWARD"):
            globalVars.play.fastForward()
        elif selected == menuItemsStore.getRef("REWIND"):
            globalVars.play.rewind()
        elif selected == menuItemsStore.getRef("SAY_TIME"):
            pos = globalVars.play.getPosition()
            if pos == -1: time = _("情報がありません")
            else:
                hour = pos // 3600
                min = (pos - hour * 3600) // 60
                sec = int(pos - hour * 3600 - min * 60)
                if hour == 0: sHour = ""
                else: sHour = str(int(hour)) + _("時間") + " "
                if min == 0: sMin = ""
                else: sMin = str(int(min)) + _("分") + " "
                time = sHour + sMin + str(int(sec)) + _("秒")
            globalVars.app.say(time)
        elif selected == menuItemsStore.getRef("SKIP"):
            globalVars.eventProcess.skip(settings.getSkipInterval()[0])
        elif selected == menuItemsStore.getRef("REVERSE_SKIP"):
            globalVars.eventProcess.skip(settings.getSkipInterval()[0], False)
        elif selected == menuItemsStore.getRef("SKIP_INTERVAL_INCREASE"):
            globalVars.eventProcess.setSkipInterval()
        elif selected == menuItemsStore.getRef("SKIP_INTERVAL_DECREASE"):
            globalVars.eventProcess.setSkipInterval(False)
        elif selected == menuItemsStore.getRef("REPEAT_LOOP"):
            globalVars.eventProcess.repeatLoopCtrl()
        elif selected == menuItemsStore.getRef("REPEAT_LOOP_NONE"):
            globalVars.eventProcess.repeatLoopCtrl(0)
        elif selected == menuItemsStore.getRef("RL_REPEAT"):
            globalVars.eventProcess.repeatLoopCtrl(1)
        elif selected == menuItemsStore.getRef("RL_LOOP"):
            globalVars.eventProcess.repeatLoopCtrl(2)
        elif selected == menuItemsStore.getRef("SHUFFLE"):
            globalVars.eventProcess.shuffleSw()
        elif selected == menuItemsStore.getRef("MANUAL_SONG_FEED"):
            globalVars.eventProcess.setSongFeed()
        elif selected >= constants.DEVICE_LIST_MENU and selected < constants.DEVICE_LIST_MENU + 500:
            if selected == constants.DEVICE_LIST_MENU:
                globalVars.play.setDevice(PLAYER_DEFAULT_SPEAKER)
            else:
                globalVars.play.setDevice(selected -
                                          constants.DEVICE_LIST_MENU)
        elif selected >= constants.PLAYLIST_HISTORY and selected < constants.PLAYLIST_HISTORY + 20:
            m3uManager.loadM3u(
                globalVars.m3uHistory.getList()[selected -
                                                constants.PLAYLIST_HISTORY])
        elif selected == menuItemsStore.getRef("SET_STARTUPLIST"):
            startupListSetter.run()
        elif selected == menuItemsStore.getRef("FILE_ASSOCIATE"):
            fileAssocDialog.assocDialog()
        elif selected == menuItemsStore.getRef("SET_SENDTO"):
            sendToManager.sendToCtrl("LAMP")
        elif selected == menuItemsStore.getRef("SET_KEYMAP"):
            if self.setKeymap("MainView",
                              _("ショートカットキーの設定"),
                              filter=keymap.KeyFilter().SetDefault(
                                  False, False)):
                #ショートカットキーの変更適用とメニューバーの再描画
                self.parent.menu.InitShortcut()
                self.parent.menu.ApplyShortcut(self.parent.hFrame)
                self.parent.menu.Apply(self.parent.hFrame)
        elif selected == menuItemsStore.getRef("SET_HOTKEY"):
            if self.setKeymap("HOTKEY",
                              _("グローバルホットキーの設定"),
                              self.parent.hotkey,
                              filter=self.parent.hotkey.filter):
                #変更適用
                self.parent.hotkey.UnSet("HOTKEY", self.parent.hFrame)
                self.parent.applyHotKey()
        elif selected == menuItemsStore.getRef("ENVIRONMENT"):
            d = setting_dialog.settingDialog("environment_dialog")
            d.Initialize()
            d.Show()
        elif selected == menuItemsStore.getRef("HELP"):
            if os.path.exists("./readme.txt"):
                subprocess.Popen("start ./readme.txt", shell=True)
            else:
                dialog(_("ヘルプ"), _("ヘルプファイルが見つかりません。"))
        elif selected == menuItemsStore.getRef("CHECK_UPDATE"):
            update.checkUpdate()
        elif selected == menuItemsStore.getRef("VERSION_INFO"):
            versionDialog.versionDialog()
Пример #5
0
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with XBMC; see the file COPYING.  If not, write to
#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html
#

import xbmc
import utilsOTT as utils
import update

NOHOME = utils.getSetting('NOHOME') == 'true'

update.checkUpdate()

if __name__ == '__main__':
    if NOHOME:
        xbmc.executebuiltin('RunScript(script.tvguidedixie)')

    else:
        param = None

        if len(sys.argv) > 1:
            param = sys.argv[1]

        xbmc.executebuiltin('Dialog.Close(busydialog)')
        utils.Launch(param)
Пример #6
0
    def OnMenuSelect(self, event):
        """メニュー項目が選択されたときのイベントハンドら。"""
        #ショートカットキーが無効状態のときは何もしない
        if not self.parent.shortcutEnable:
            event.Skip()
            return

        selected = event.GetId()  #メニュー識別しの数値が出る

        #特殊なイベントと思われる
        if selected < 10 and selected > 0:
            event.Skip()
            return

        if not self.parent.menu.IsEnable(selected):
            event.Skip()
            return

        #終了
        if selected == menuItemsStore.getRef("EXIT"):
            self.parent.hFrame.Close()
        #バージョン情報
        elif selected == menuItemsStore.getRef("SET_KEYMAP"):
            if self.setKeymap("MainView",
                              _("ショートカットキーの設定"),
                              filter=keymap.KeyFilter().SetDefault(
                                  False, False)):
                #ショートカットキーの変更適用とメニューバーの再描画
                self.parent.menu.InitShortcut()
                self.parent.menu.ApplyShortcut(self.parent.hFrame)
                self.parent.menu.Apply(self.parent.hFrame)
        elif selected == menuItemsStore.getRef("SET_HOTKEY"):
            if self.setKeymap("HOTKEY",
                              _("グローバルホットキーの設定"),
                              self.parent.hotkey,
                              filter=self.parent.hotkey.filter):
                #変更適用
                self.parent.hotkey.UnSet("HOTKEY", self.parent.hFrame)
                self.parent.applyHotKey()
        elif selected == menuItemsStore.getRef("VERSION_INFO"):
            views.versionDialog.versionDialog()
        #接続
        elif selected == menuItemsStore.getRef("CONNECT"):
            self.connect()
        #切断
        elif selected == menuItemsStore.getRef("DISCONNECT"):
            globalVars.app.Manager.disconnect()
        #履歴
        elif selected == menuItemsStore.getRef("VIEW_HISTORY"):
            self.viewHistory()
        #お気に入り
        elif selected == menuItemsStore.getRef("VIEW_FAVORITES"):
            self.viewFavorites()
        #コメントのコピー
        elif selected == menuItemsStore.getRef("COPY_COMMENT"):
            globalVars.app.Manager.copyComment()
        #コメントの詳細を表示
        elif selected == menuItemsStore.getRef("VIEW_COMMENT"):
            viewCommentDialog = views.viewComment.Dialog(
                globalVars.app.Manager.connection.comments[
                    self.parent.commentList.GetFocusedItem()])
            viewCommentDialog.Initialize()
            viewCommentDialog.Show()
        #選択中のコメントに返信
        elif selected == menuItemsStore.getRef("REPLY2SELECTED_COMMENT"):
            self.parent.commentBodyEdit.SetValue(
                "@" + globalVars.app.Manager.connection.comments[
                    self.parent.commentList.GetFocusedItem()]["from_user"]
                ["screen_id"] + " ")
            self.parent.commentBodyEdit.SetInsertionPointEnd()
            self.parent.commentBodyEdit.SetFocus()
        #全てのコメントを選択
        elif selected == menuItemsStore.getRef("SELECT_ALL_COMMENT"):
            self.selectAllComment()
        #配信者に返信
        elif selected == menuItemsStore.getRef("REPLY2BROADCASTER"):
            self.parent.commentBodyEdit.SetValue(
                "@" +
                globalVars.app.Manager.connection.movieInfo["broadcaster"]
                ["screen_id"] + " ")
            self.parent.commentBodyEdit.SetInsertionPointEnd()
            self.parent.commentBodyEdit.SetFocus()
        #コメントの削除
        elif selected == menuItemsStore.getRef("DELETE_SELECTED_COMMENT"):
            dlg = simpleDialog.yesNoDialog(_("確認"), _("選択中のコメントを削除しますか?"))
            if dlg == wx.ID_NO:
                return
            globalVars.app.Manager.deleteComment()
        #お気に入りに追加
        elif selected == menuItemsStore.getRef("ADD_FAVORITES"):
            if globalVars.app.Manager.connection.userId in globalVars.app.Manager.favorites:
                simpleDialog.errorDialog(_("すでに登録されています。"))
                return
            dlg = simpleDialog.yesNoDialog(
                _("確認"),
                _("%sのライブをお気に入りに追加しますか?") %
                (globalVars.app.Manager.connection.userId))
            if dlg == wx.ID_NO:
                return
            globalVars.app.Manager.addFavorites()
        #配信者の情報
        elif selected == menuItemsStore.getRef("VIEW_BROADCASTER"):
            viewBroadcasterDialog = views.viewBroadcaster.Dialog(
                globalVars.app.Manager.connection.movieInfo["broadcaster"])
            viewBroadcasterDialog.Initialize()
            viewBroadcasterDialog.Show()
        #ブラウザで開く
        elif selected == menuItemsStore.getRef("OPEN_LIVE"):
            globalVars.app.Manager.openLiveWindow()
        # アイテム投下
        elif selected == menuItemsStore.getRef("POST_ITEM"):
            accounts = list(globalVars.app.config["advanced_ids"].keys())
            if len(accounts) == 0:
                simpleDialog.errorDialog(
                    _("この機能を使用する前に、設定メニューの拡張機能用アカウントの設定から、使用するアカウントを登録してください。")
                )
                return
            if not globalVars.app.postItem.login(
                    globalVars.app.postItem.getDefaultAccount()):
                return
            items = globalVars.app.postItem.getItemList()
            if len(items) == 0:
                if len(accounts) == 1 and globalVars.app.postItem.getUserId(
                        globalVars.app.postItem.getDefaultAccount(
                        )) == globalVars.app.Manager.connection.userId:
                    simpleDialog.errorDialog(_("自分のライブにアイテムを投下することはできません。"))
                    return
                for i in range(1, len(accounts)):
                    globalVars.app.postItem.setDefaultAccountIndex(i)
                    if not globalVars.app.postItem.login(
                            globalVars.app.postItem.getDefaultAccount()):
                        return
                    items = globalVars.app.postItem.getItemList()
                    if len(items) > 0:
                        d = views.postItem.Dialog(accounts, items)
                        d.Initialize()
                        d.Show()
                        return
                simpleDialog.errorDialog(_("アイテム情報の取得に失敗しました。"))
                return
            d = views.postItem.Dialog(accounts, items)
            d.Initialize()
            d.Show()
        #設定
        elif selected == menuItemsStore.getRef("SETTING"):
            self.settings()
        # コメントリスト表示設定
        elif selected == menuItemsStore.getRef("COMMENT_LIST_CONFIGURATION"):
            d = views.commentListConfiguration.Dialog()
            d.Initialize()
            d.Show()
        #効果音設定
        elif selected == menuItemsStore.getRef("INDICATOR_SOUND_SETTING"):
            self.indicatorSoundSettings()
        #コメント文字列置換設定
        elif selected == menuItemsStore.getRef("COMMENT_REPLACE"):
            self.commentReplace()
        #表示名置換設定
        elif selected == menuItemsStore.getRef("USER_NAME_REPLACE"):
            self.userNameReplace()
        #アカウントマネージャ
        elif selected == menuItemsStore.getRef("ACCOUNT_MANAGER"):
            self.accountManager()
        elif selected == menuItemsStore.getRef("advanced_ACCOUNT_MANAGER"):
            self.advancedAccountManager()
        #SAPI設定を開く
        elif selected == menuItemsStore.getRef("SAPI_SETTING"):
            file = os.path.join(os.getenv("windir"), "SysWOW64", "Speech",
                                "SpeechUX", "sapi.cpl")
            if os.path.exists(file) == False:
                file = file.replace("syswow64", "system32")
            os.system(file)
        #読み上げ出力先の変更
        elif selected == menuItemsStore.getRef("CHANGE_SPEECH_OUTPUT"):
            d = views.changeSpeechOutput.Dialog()
            d.Initialize()
            d.Show()
        #コメント送信(ホットキー)
        elif selected == menuItemsStore.getRef("POST_COMMENT"):
            self.postComment(None)
        #再生
        elif selected == menuItemsStore.getRef("PLAY"):
            globalVars.app.Manager.play()
        #停止
        elif selected == menuItemsStore.getRef("STOP"):
            globalVars.app.Manager.stop()
        #音量を上げる
        elif selected == menuItemsStore.getRef("VOLUME_UP"):
            globalVars.app.Manager.volumeUp()
        #音量を下げる
        elif selected == menuItemsStore.getRef("VOLUME_DOWN"):
            globalVars.app.Manager.volumeDown()
        #音量のリセット
        elif selected == menuItemsStore.getRef("RESET_VOLUME"):
            globalVars.app.Manager.resetVolume()
        #再生デバイス変更
        elif selected == menuItemsStore.getRef("CHANGE_DEVICE"):
            changeDeviceDialog = views.changeDevice.Dialog()
            changeDeviceDialog.Initialize()
            ret = changeDeviceDialog.Show()
            if ret == wx.ID_CANCEL: return
            globalVars.app.Manager.changeDevice(changeDeviceDialog.GetData())
            return
        #音声停止
        elif selected == menuItemsStore.getRef("SILENCE"):
            try:
                globalVars.app.speech.silence()
            except AttributeError:
                pass
        # URLスキームの設定
        elif selected == menuItemsStore.getRef("CUSTOM_URL_SCHEME"):
            self.toggleCustomUrlScheme()
        #ヘルプを開く
        elif selected == menuItemsStore.getRef("HELP"):
            self.help()
        #更新を確認
        elif selected == menuItemsStore.getRef("CHECK4UPDATE"):
            update.checkUpdate()
        #コメントリストのコンテキストメニューを開く
        elif selected == menuItemsStore.getRef("POPUP_OPEN_COMMENT"):
            return self.commentContextMenu()
        #URLを開く
        elif selected >= constants.MENU_URL_FIRST:
            obj = event.GetEventObject()
            webbrowser.open(obj.GetLabel(selected))
        #ユーザー情報のコンテキストメニューを開く
        elif selected == menuItemsStore.getRef("POPUP_OPEN_USER_INFO"):
            return self.userInfoContextMenu()
        # アイテム履歴
        elif selected == menuItemsStore.getRef("ITEM_HISTORY"):
            self.itemHistory()
Пример #7
0
    def OnMenuSelect(self, event):
        """メニュー項目が選択されたときのイベントハンドら。"""
        #ショートカットキーが無効状態のときは何もしない
        if not self.parent.shortcutEnable:
            event.Skip()
            return

        selected = event.GetId()  #メニュー識別しの数値が出る

        # ウィンドウを隠す
        if selected == menuItemsStore.getRef("HIDE"):
            self.hide()

        # ウィンドウを表示
        if selected == menuItemsStore.getRef("SHOW"):
            self.show()

        # 終了
        if selected == menuItemsStore.getRef("EXIT"):
            self.exitWithConfirmation()

        # ツイキャス連携の有効化
        if selected == menuItemsStore.getRef("TC_ENABLE"):
            if event.IsChecked():
                if not globalVars.app.tc.initialize():
                    self.parent.menu.CheckMenu("TC_ENABLE", False)
                    return
                globalVars.app.tc.start()
            else:
                globalVars.app.tc.exit()
            globalVars.app.config["twitcasting"]["enable"] = event.IsChecked()
            if globalVars.app.config.write() != errorCodes.OK:
                errorDialog(
                    _("設定の保存に失敗しました。下記のファイルへのアクセスが可能であることを確認してください。") + "\n" +
                    os.path.abspath(constants.SETTING_FILE_NAME))

        # ツイキャス:コメント保存
        if selected == menuItemsStore.getRef("TC_SAVE_COMMENTS"):
            globalVars.app.config["twitcasting"][
                "savecomments"] = event.IsChecked()
            if globalVars.app.config.write() != errorCodes.OK:
                errorDialog(
                    _("設定の保存に失敗しました。下記のファイルへのアクセスが可能であることを確認してください。") + "\n" +
                    os.path.abspath(constants.SETTING_FILE_NAME))

        # ツイキャス:ユーザ情報を更新
        if selected == menuItemsStore.getRef("TC_UPDATE_USER"):
            globalVars.app.tc.updateUser()

        # ツイキャス:Twitterから一括追加
        if selected == menuItemsStore.getRef("TC_ADD_TW"):
            globalVars.app.tc.addUsersFromTwitter()

        # ツイキャス:過去ライブの録画
        if selected == menuItemsStore.getRef("TC_RECORD_ARCHIVE"):
            d = SimpleInputDialog.Dialog(_("URLを入力"), _("再生ページのURL"))
            d.Initialize()
            if d.Show() == wx.ID_CANCEL: return
            globalVars.app.tc.downloadArchive(d.GetData())

        # ツイキャス:一括録画
        if selected == menuItemsStore.getRef("TC_RECORD_ALL"):
            d = SimpleInputDialog.Dialog(_("ユーザ名を入力"), _("ユーザ名"))
            d.Initialize()
            if d.Show() == wx.ID_CANCEL: return
            globalVars.app.tc.recordAll(d.GetData())

        # ツイキャス:ユーザ名を指定して録画
        if selected == menuItemsStore.getRef("TC_RECORD_USER"):
            d = SimpleInputDialog.Dialog(_("ユーザ名を入力"), _("ユーザ名"))
            d.Initialize()
            if d.Show() == wx.ID_CANCEL: return
            globalVars.app.tc.record(d.GetData())

        # ツイキャス:トークンを削除
        if selected == menuItemsStore.getRef("TC_REMOVE_TOKEN"):
            if not os.path.exists(constants.AC_TWITCASTING):
                errorDialog(_("すでに削除されています。"))
                return
            d = yesNoDialog(_("アクセストークンの削除"),
                            _("ツイキャス連携機能を無効化し、アクセストークンを削除します。よろしいですか?"))
            if d == wx.ID_NO:
                return
            if globalVars.app.tc.running:
                globalVars.app.tc.exit()
                self.parent.menu.CheckMenu("TC_ENABLE", False)
            os.remove(constants.AC_TWITCASTING)
            dialog(_("完了"), _("アクセストークンを削除しました。"))

        # ツイキャス:トークンを再設定
        if selected == menuItemsStore.getRef("TC_SET_TOKEN"):
            globalVars.app.tc.setToken()

        # ツイキャス:ユーザの管理
        if selected == menuItemsStore.getRef("TC_MANAGE_USER"):
            d = tcManageUser.Dialog()
            d.Initialize()
            if d.Show() == wx.ID_CANCEL:
                return
            globalVars.app.tc.users = d.GetValue()
            globalVars.app.tc.saveUserList()

        # スペース連携の有効化
        if selected == menuItemsStore.getRef("SPACES_ENABLE"):
            if event.IsChecked():
                if not globalVars.app.spaces.initialize():
                    self.parent.menu.CheckMenu("SPACES_ENABLE", False)
                    return
                globalVars.app.spaces.start()
            else:
                globalVars.app.spaces.exit()
            globalVars.app.config["spaces"]["enable"] = event.IsChecked()
            if globalVars.app.config.write() != errorCodes.OK:
                errorDialog(
                    _("設定の保存に失敗しました。下記のファイルへのアクセスが可能であることを確認してください。") + "\n" +
                    os.path.abspath(constants.SETTING_FILE_NAME))

        # スペース:フォロー中のユーザを追加
        if selected == menuItemsStore.getRef("SPACES_ADD_FOLLOWING"):
            globalVars.app.spaces.addFollowingUsers()

        # スペース:URLを指定して録画
        if selected == menuItemsStore.getRef("SPACES_UPDATE_USER"):
            globalVars.app.spaces.updateUser()

        # スペース:URLを指定して録画
        if selected == menuItemsStore.getRef("SPACES_URL_REC"):
            d = SimpleInputDialog.Dialog(_("URLを入力"), _("スペースのURL"))
            d.Initialize()
            if d.Show() == wx.ID_CANCEL: return
            ret = globalVars.app.spaces.recFromUrl(d.GetData())
            if ret == errorCodes.SPACE_ENDED:
                errorDialog(_("このスペースは既に終了しています。"))
            elif ret == errorCodes.INVALID_URL:
                errorDialog(_("入力されたURLが正しくありません。"))
            elif ret == errorCodes.SPACE_NOT_STARTED:
                errorDialog(_("このスペースはまだ開始されていません。"))

        # スペース:トークンの管理
        if selected == menuItemsStore.getRef("SPACES_TOKEN_MANAGER"):
            globalVars.app.spaces.openTokenManager()

        # スペース:ユーザの管理
        if selected == menuItemsStore.getRef("SPACES_MANAGE_USER"):
            d = spacesManageUser.Dialog()
            d.Initialize()
            if d.Show() == wx.ID_CANCEL:
                return
            globalVars.app.spaces.users.setData(d.GetValue())
            globalVars.app.spaces.users.save()

        # 設定
        if selected == menuItemsStore.getRef("OP_SETTINGS"):
            d = settingsDialog.Dialog()
            d.Initialize()
            d.Show()

        # キーボードショートカットの設定
        if selected == menuItemsStore.getRef("OP_SHORTCUT"):
            if self.setKeymap("MainView",
                              _("ショートカットキーの設定"),
                              filter=keymap.KeyFilter().SetDefault(
                                  False, False)):
                #ショートカットキーの変更適用とメニューバーの再描画
                self.parent.menu.InitShortcut()
                self.parent.menu.ApplyShortcut(self.parent.hFrame)
                self.parent.menu.Apply(self.parent.hFrame)

        # グローバルホットキーの設定
        if selected == menuItemsStore.getRef("OP_HOTKEY"):
            if self.setKeymap("HOTKEY",
                              _("グローバルホットキーの設定"),
                              self.parent.hotkey,
                              filter=self.parent.hotkey.filter):
                #変更適用
                self.parent.hotkey.UnSet("HOTKEY", self.parent.hFrame)
                self.parent.applyHotKey()

        # スタートアップに登録
        if selected == menuItemsStore.getRef("OP_STARTUP"):
            self.registerStartup()

        # 更新の確認
        if selected == menuItemsStore.getRef("HELP_UPDATE"):
            update.checkUpdate()
        # バージョン情報
        if selected == menuItemsStore.getRef("HELP_VERSIONINFO"):
            d = versionDialog.dialog()
            d.Initialize()
            r = d.Show()
Пример #8
0
    def connectWidgetSignals(self):
        # Connecting slots, signals, and menus
        self.ui.iwadMenuButton.setMenu(self.ui.iwadMenu)
        self.ui.portMenuButton.setMenu(self.ui.portMenu)
        self.ui.bdlMenuButton.setMenu(self.ui.bdlMenu)

        self.ui.launchButton.clicked.connect(self.prepareLaunch)

        self.ui.pwadAdd.clicked.connect(lambda: self.addFile(self.ui.pwadList))
        self.ui.pwadRem.clicked.connect(
            lambda: self.removeListItem(self.ui.pwadList))

        self.ui.iwadList.itemDoubleClicked.connect(self.resetIWADFlags)
        self.ui.iwadList.model().rowsInserted.connect(
            self.changeDoomCapitalization)
        self.ui.iwadList.currentItemChanged[QtWidgets.QListWidgetItem,
                                            QtWidgets.QListWidgetItem].connect(
                                                self.fillWarpMapCombo)
        self.ui.iwadAdd.clicked.connect(lambda: self.addFile(self.ui.iwadList))
        self.ui.iwadRem.clicked.connect(
            lambda: self.removeListItem(self.ui.iwadList))
        # TODO: crossplatform -> explorer /select is windows only

        self.ui.iwadBrowseLocalFiles.triggered.connect(lambda: subprocess.Popen(
            f'explorer /select,{os.path.abspath(self.ui.iwadList.currentItem().data(3))}'
        ))
        self.ui.iwadClearAll.triggered.connect(
            lambda: self.clearListWidgetItems(self.ui.iwadList))
        self.ui.iwadAutoAddSteamIWADs.triggered.connect(
            lambda: config.findSteamIWADs(self))
        self.ui.iwadSteamUDoom.triggered.connect(lambda: webbrowser.open(
            'https://store.steampowered.com/app/2280/Ultimate_Doom/'))
        self.ui.iwadSteamDoom2.triggered.connect(lambda: webbrowser.open(
            'https://store.steampowered.com/app/2300/DOOM_II/'))
        self.ui.iwadSteamFinalDoom.triggered.connect(lambda: webbrowser.open(
            'https://store.steampowered.com/app/2290/Final_DOOM/'))
        self.ui.iwadSteamClassicComplete.triggered.connect(
            lambda: webbrowser.open('https://store.steampowered.com/sub/18397/'
                                    ))
        self.ui.iwadDealsUDoom.triggered.connect(lambda: webbrowser.open(
            'https://isthereanydeal.com/game/ultimatedoom/info/'))
        self.ui.iwadDealsDoom2.triggered.connect(lambda: webbrowser.open(
            'https://isthereanydeal.com/game/doomii/info/'))
        self.ui.iwadDealsFinalDoom.triggered.connect(lambda: webbrowser.open(
            'https://isthereanydeal.com/game/finaldoom/info/'))
        self.ui.iwadDealsClassicComplete.triggered.connect(
            lambda: webbrowser.open(
                'https://isthereanydeal.com/game/doomclassiccomplete/info/'))

        self.ui.portAdd.triggered.connect(
            lambda: self.addFile(self.ui.portCombo))
        self.ui.portRem.triggered.connect(lambda: self.ui.portCombo.removeItem(
            self.ui.portCombo.currentIndex()))
        self.ui.portClearAll.triggered.connect(lambda: self.clearPorts())
        # TODO: again, windows only
        self.ui.portBrowseLocalFiles.triggered.connect(lambda: subprocess.Popen(
            f'explorer /select,{os.path.abspath(self.ui.portCombo.currentData(3))}'
        ))
        self.ui.portRename.triggered.connect(self.renamePort)
        self.ui.portRenameLineEdit.returnPressed.connect(self.renamePort)
        self.ui.portMoveUp.triggered.connect(lambda: self.movePort('up'))
        self.ui.portMoveDown.triggered.connect(lambda: self.movePort('down'))
        self.ui.portMoveToTop.triggered.connect(lambda: self.movePort('top'))
        self.ui.portMoveToBottom.triggered.connect(
            lambda: self.movePort('bottom'))

        self.ui.demoGroup.toggled.connect(
            lambda: self.ui.demoGroup.setMaximumHeight(80 if self.ui.demoGroup.
                                                       isChecked() else 13))
        self.ui.warpGroup.toggled.connect(
            lambda: self.ui.warpGroup.setMaximumHeight(69 if self.ui.warpGroup.
                                                       isChecked() else 13))
        self.ui.paramGroup.toggled.connect(
            lambda: self.ui.paramGroup.setMaximumHeight(
                16777215 if self.ui.paramGroup.isChecked() else 13))

        self.ui.demoRecordBrowseButton.clicked.connect(
            lambda: self.addFile(self.ui.demoRecordNameLineEdit))
        self.ui.demoPlayBrowseButton.clicked.connect(
            lambda: self.addFile(self.ui.demoPlayPathLineEdit))
        self.ui.demoRecordNameLineEdit.textChanged.connect(
            lambda: self.ui.demoRecordRadio.setChecked(True))
        self.ui.demoRecordNameLineEdit.selectionChanged.connect(
            lambda: self.ui.demoRecordRadio.setChecked(True))
        self.ui.demoPlayPathLineEdit.textChanged.connect(
            lambda: self.ui.demoPlayRadio.setChecked(True))
        self.ui.demoPlayPathLineEdit.selectionChanged.connect(
            lambda: self.ui.demoPlayRadio.setChecked(True))

        self.ui.bdlCapitalization.toggled.connect(
            self.changeDoomCapitalization)
        self.ui.bdlCapitalizationCombo.currentIndexChanged.connect(
            self.changeDoomCapitalization)
        self.ui.bdlPWADsCheckable.toggled.connect(self.resetPWADsCheckable)
        self.ui.bdlUpdateCheckNowButton.clicked.connect(
            lambda: update.checkUpdate(self))
        self.ui.bdlUpdateButton.clicked.connect(lambda: update.update(self))

        self.ui.bdlMenuSaveini.triggered.connect(self.saveCustomConfig)
        self.ui.bdlMenuLoadini.triggered.connect(self.loadCustomConfig)
        self.ui.bdlMenuClearEverything.triggered.connect(self.clearEverything)
        self.ui.bdlMenuAbout.triggered.connect(self.openAboutDialog)

        self.ui.commandLinePreviewButton.clicked.connect(
            lambda: self.showPopup(title="Command line preview",
                                   text=self.prepareLaunch(noLaunch=True),
                                   icon=QtWidgets.QMessageBox.Information))
Пример #9
0
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with XBMC; see the file COPYING.  If not, write to
#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html
#

import xbmc
import utilsOTT as utils
import update

NOHOME = utils.getSetting('NOHOME') == 'true'

update.checkUpdate()

if __name__ == '__main__':
    
    if NOHOME:
        xbmc.executebuiltin('RunScript(script.tvguidedixie)')

    else:
        param = None

        if len(sys.argv) > 1:
            param = sys.argv[1]

        xbmc.executebuiltin('Dialog.Close(busydialog)')
        utils.Launch(param)