def _createUi(self, q): hookPrefsButton = QtWidgets.QPushButton(my.tr("Edit /H Hook Code")) skqss.class_(hookPrefsButton, 'btn btn-info') hookPrefsButton.setToolTip(my.tr("Modify the game-specific ITH hook code") + " (Alt+H)") hookPrefsButton.setStatusTip(hookPrefsButton.toolTip()) hookPrefsButton.clicked.connect(self._showHookPrefs) helpButton = QtWidgets.QPushButton(tr_("Help")) helpButton.setToolTip(tr_("Help")) skqss.class_(helpButton, 'btn btn-success') helpButton.clicked.connect(lambda: self.helpDialog.show()) wikiButton = QtWidgets.QPushButton(tr_("Wiki")) wikiButton.setToolTip(tr_("Wiki")) skqss.class_(wikiButton, 'btn btn-default') import main wikiButton.clicked.connect(lambda: main.manager().openWiki('VNR/Text Settings')) #cancelButton = QtWidgets.QPushButton(tr_("Cancel")) #cancelButton.clicked.connect(self.q.hide) threadArea = QtWidgets.QScrollArea() threadArea.setWidget(skwidgets.SkLayoutWidget(self.threadLayout)) threadArea.setWidgetResizable(True) threadGroup = QtWidgets.QGroupBox() threadGroup.setTitle(mytr_("Text threads")) threadGroup.setLayout(skwidgets.SkWidgetLayout(threadArea)) #threadGroup.setLayout(self.threadLayout) option = QtWidgets.QGroupBox(tr_("Options")) optionLayout = QtWidgets.QVBoxLayout() row = QtWidgets.QHBoxLayout() row.addWidget(QtWidgets.QLabel(mytr_("Game language")+ ":")) row.addWidget(self.languageEdit) row.addStretch() row.addWidget(QtWidgets.QLabel(tr_("Text encoding") + ":")) row.addWidget(self.encodingEdit) optionLayout.addLayout(row) optionLayout.addWidget(self.keepsThreadsButton) optionLayout.addWidget(self.removesRepeatButton) optionLayout.addWidget(self.ignoresRepeatButton) optionLayout.addWidget(self.keepsSpaceButton) option.setLayout(optionLayout) layout = QtWidgets.QVBoxLayout() row = QtWidgets.QHBoxLayout() row.addWidget(self.saveButton) row.addWidget(hookPrefsButton) row.addWidget(self.resetButton) row.addWidget(wikiButton) row.addWidget(helpButton) #row.addWidget(QtWidgets.QLabel( # " <= " + my.tr("click help if you have questions") #)) row.addStretch() layout.addLayout(row) row = QtWidgets.QHBoxLayout() row.addWidget(option) row.addStretch() layout.addLayout(row) layout.addWidget(threadGroup) #msg = QtWidgets.QLabel(my.tr("WARNING: PLEASE DO NOT TURN ON REPETITION FILTERS UNLESS THERE ARE REPETITIONS!")) msgLabel = QtWidgets.QLabel(my.tr("Don't forget to maximize the text speed (see Help).")) skqss.class_(msgLabel, "text-success") layout.addWidget(msgLabel) wikiLabel = QtWidgets.QLabel(my.tr('Please check this <a href="http://sakuradite.com/wiki/en/VNR/Game_Settings">Game Settings</a> wiki if there is no correct text.')) wikiLabel.setOpenExternalLinks(True) #skqss.class_(wikiLabel, "text-info") layout.addWidget(wikiLabel) #buttons = QtWidgets.QHBoxLayout() #buttons.addStretch() #buttons.addWidget(cancelButton) #buttons.addWidget(self.saveButton) #layout.addLayout(buttons) #layout.addWidget(introLabel) #layout.setContentsMargins(18, 18, 18, 9) # left, top, right, bottom #self.q.setCentralWidget(skwidgets.SkLayoutWidget(layout)) q.setLayout(layout) skwidgets.shortcut('alt+h', self._showHookPrefs, parent=q)
def _createUi(self, q): self.userTab = _prefs.UserTab() self.textTab = _prefs.TextTab() self.ttsTab = _prefs.TtsTab() self.ocrTab = _prefs.OcrTab() #self.srTab = _prefs.SrTab() self.gameTab = _prefs.GameTab() self.shortcutsTab = _prefs.ShortcutsTab() self.uiTab = _prefs.UiTab() self.recordingsTab = _prefs.RecordingsTab() self.i18nTab = _prefs.I18nTab() self.engineTab = _prefs.EngineTab() self.internetTab = _prefs.InternetTab() self.featureTab = _prefs.FeatureTab() #self.pluginTab = _prefs.PluginTab() self.translationTab = _prefs.TranslationTab() self.machineTranslationTab = _prefs.MachineTranslationTab() self.dictionaryTranslationTab = _prefs.DictionaryTranslationTab() self.romanTranslationTab = _prefs.RomanTranslationTab() self.chineseTranslationTab = _prefs.ChineseTranslationTab() #self.translationScriptTab = _prefs.TranslationScriptTab() self.termTab = _prefs.TermTab() self.downloadsTab = _prefs.DownloadsTab() self.dictionaryDownloadsTab = _prefs.DictionaryDownloadsTab() self.launcherDownloadsTab = _prefs.LauncherDownloadsTab() self.fontDownloadsTab = _prefs.FontDownloadsTab() self.libraryTab = _prefs.LibraryTab() self.localeLibraryTab = _prefs.LocaleLibraryTab() self.translatorLibraryTab = _prefs.TranslatorLibraryTab() self.dictionaryLibraryTab = _prefs.DictionaryLibraryTab() self.ttsLibraryTab = _prefs.TtsLibraryTab() self.ocrLibraryTab = _prefs.OcrLibraryTab() #for t in self.itertabs(): # t.setSizePolicy(QtWidgets.QSizePolicy.Expanding, # QtWidgets.QSizePolicy.Expanding) container = QtWidgets.QScrollArea() # widget container container.setWidgetResizable(True) # false by default container.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) container.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) #container.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) #container.setAlignment(Qt.AlignTop | Qt.AlignHCenter) self.controller = skmvc.SkWidgetTreeController( parent=q, container=container, data={ 'display': tr_("Preferences"), 'children': [ { 'widget': self.userTab, 'user': self._indexWidget(self.userTab), 'decoration': rc.icon('pref-user'), 'display': tr_("Account"), 'toolTip': my.tr("User account"), }, { 'widget': self.engineTab, 'user': self._indexWidget(self.engineTab), #'display': u"%s (α)" % mytr_("Embedded"), 'display': mytr_("Embedded"), 'decoration': rc.icon('pref-config'), 'toolTip': my.tr("Embedded subtitles"), }, { 'widget': self.downloadsTab, 'user': self._indexWidget(self.downloadsTab), 'decoration': rc.icon('pref-download'), 'display': tr_("Downloads"), 'toolTip': my.tr("Download additional resources"), 'children': [ { 'widget': self.launcherDownloadsTab, 'user': self._indexWidget(self.launcherDownloadsTab), 'decoration': rc.icon('pref-locale'), 'display': tr_("Launch"), 'toolTip': my.tr("Locale changers"), }, { 'widget': self.dictionaryDownloadsTab, 'user': self._indexWidget(self.dictionaryDownloadsTab), 'decoration': rc.icon('pref-dict'), 'display': tr_("Dictionaries"), 'toolTip': my.tr("Manage dictionaries"), }, { 'widget': self.fontDownloadsTab, 'user': self._indexWidget(self.fontDownloadsTab), 'decoration': rc.icon('pref-font'), 'display': tr_("Fonts"), 'toolTip': my.tr("Manage fonts"), }, ] }, { 'widget': self.libraryTab, 'user': self._indexWidget(self.libraryTab), 'decoration': rc.icon('pref-library'), 'display': tr_("Locations"), 'toolTip': my.tr("Locations of external libraries"), 'children': [ { 'widget': self.localeLibraryTab, 'user': self._indexWidget(self.localeLibraryTab), 'decoration': rc.icon('pref-locale'), 'display': tr_("Launch"), 'toolTip': my.tr("Locations of external locale changers"), }, { 'widget': self.translatorLibraryTab, 'user': self._indexWidget(self.translatorLibraryTab), 'decoration': rc.icon('pref-tr-path'), 'display': tr_("Translators"), 'toolTip': my.tr("Locations of external translators"), }, { 'widget': self.dictionaryLibraryTab, 'user': self._indexWidget(self.dictionaryLibraryTab), 'decoration': rc.icon('pref-dict'), 'display': tr_("Dictionaries"), 'toolTip': my.tr("Locations of external dictionary"), }, { 'widget': self.ttsLibraryTab, 'user': self._indexWidget(self.ttsLibraryTab), 'decoration': rc.icon('pref-tts-path'), 'display': mytr_("TTS"), 'toolTip': my.tr("Locations of external TTS"), }, { 'widget': self.ocrLibraryTab, 'user': self._indexWidget(self.ocrLibraryTab), 'decoration': rc.icon('pref-ocr-path'), 'display': mytr_("OCR"), 'toolTip': my.tr("Locations of external OCR libraries"), }, ] }, { 'widget': self.translationTab, 'user': self._indexWidget(self.translationTab), 'decoration': rc.icon('pref-tr'), 'display': tr_("Translation"), 'toolTip': my.tr("Machine translators"), 'children': [ { 'widget': self.machineTranslationTab, 'user': self._indexWidget(self.machineTranslationTab), 'decoration': rc.icon('pref-tr-path'), 'display': tr_("Translators"), 'toolTip': my.tr("Preferred machine translators"), }, { 'widget': self.dictionaryTranslationTab, 'user': self._indexWidget( self.dictionaryTranslationTab), 'decoration': rc.icon('pref-dict'), 'display': tr_("Dictionaries"), 'toolTip': my.tr("Preferred look-up dictionaries"), }, { 'widget': self.romanTranslationTab, 'user': self._indexWidget(self.romanTranslationTab), 'decoration': rc.icon('pref-roman'), 'display': mytr_("C/K Ruby"), 'toolTip': my. tr("Romanization of texts in Chinese and Korean" ), }, { 'widget': self.chineseTranslationTab, 'user': self._indexWidget(self.chineseTranslationTab), 'decoration': rc.icon('pref-zh'), 'display': tr_("Chinese"), 'toolTip': my.tr("Preferred Chinese variant"), }, #{ 'widget': self.translationScriptTab, # 'user': self._indexWidget(self.translationScriptTab), # 'decoration': rc.icon('pref-script'), # 'display': tr_("Scripts"), # 'toolTip': my.tr("Translation replacement scripts"), #}, ] }, { 'widget': self.ttsTab, 'user': self._indexWidget(self.ttsTab), 'decoration': rc.icon('pref-tts'), 'display': mytr_("Text-To-Speech"), 'toolTip': mytr_("Text-To-Speech") + " (TTS)", }, #{ 'widget': self.srTab, # 'user': self._indexWidget(self.srTab), # 'decoration': rc.icon('pref-sr'), # 'display': u"%s (α)" % mytr_("ASR"), # 'toolTip': mytr_("Automatic speech recognition") + " (ASR)", #}, { 'widget': self.ocrTab, 'user': self._indexWidget(self.ocrTab), 'decoration': rc.icon('pref-ocr'), 'display': u"%s (α)" % mytr_("OCR"), 'toolTip': mytr_("Optical character recognition") + " (OCR)", }, { 'widget': self.textTab, 'user': self._indexWidget(self.textTab), 'display': tr_("Font"), 'decoration': rc.icon('pref-text'), 'toolTip': my.tr("Text rendering"), }, { 'widget': self.gameTab, 'user': self._indexWidget(self.gameTab), 'decoration': rc.icon('pref-app'), 'display': tr_("Launch"), 'toolTip': my.tr("Game launch settings"), }, { 'widget': self.shortcutsTab, 'user': self._indexWidget(self.shortcutsTab), 'decoration': rc.icon('pref-shortcuts'), 'display': mytr_("Shortcuts"), 'toolTip': my.tr("Mouse and keyboard shortcuts"), }, { 'widget': self.recordingsTab, 'user': self._indexWidget(self.recordingsTab), 'decoration': rc.icon('pref-rec'), 'display': mytr_("Recordings"), 'toolTip': my.tr("Game recordings"), }, { 'widget': self.uiTab, 'user': self._indexWidget(self.uiTab), 'decoration': rc.icon('pref-ui'), 'display': tr_("UI"), 'toolTip': my.tr("UI Theme"), }, { 'widget': self.i18nTab, 'user': self._indexWidget(self.i18nTab), 'display': tr_("i18n"), 'decoration': rc.icon('pref-i18n'), 'toolTip': tr_("International"), }, { 'widget': self.termTab, 'user': self._indexWidget(self.termTab), 'decoration': rc.icon('pref-share'), 'display': mytr_("Shared Dictionary"), 'toolTip': mytr_("Shared Dictionary"), }, { 'widget': self.internetTab, 'user': self._indexWidget(self.internetTab), 'decoration': rc.icon('pref-internet'), 'display': tr_("Internet"), 'toolTip': my.tr("Internet options"), }, { 'widget': self.featureTab, 'user': self._indexWidget(self.featureTab), 'decoration': rc.icon('pref-feature'), 'display': tr_("Features"), 'toolTip': my.tr("Application features"), }, ], }) self.controller.treeView().setHeaderHidden(True) self.controller.treeView().expandAll() left = QtWidgets.QWidget() layout = QtWidgets.QVBoxLayout() layout.addWidget(self.controller.treeView()) row = QtWidgets.QHBoxLayout() row.addWidget(self.controller.filterEdit()) row.addWidget(self.controller.countLabel()) layout.addLayout(row) left.setLayout(layout) q.addWidget(left) skqss.class_(self.controller.treeView(), 'texture') right = self.controller.widgetView() #right.setSizePolicy(QtWidgets.QSizePolicy.Expanding, # QtWidgets.QSizePolicy.Expanding) q.addWidget(right) self.controller.currentIndexChanged.connect(self._refreshCurrentWidget) w = self.controller.filterEdit() w.setToolTip("%s (%s, %s, Ctrl+F)" % (tr_("Search"), tr_("case-insensitive"), tr_("regular expression"))) shortcut('ctrl+f', w.setFocus, parent=q)
def _createUi(self, q): #hookPrefsButton = QtWidgets.QPushButton(my.tr("Edit /H Hook Code")) #skqss.class_(hookPrefsButton, 'btn btn-info') #hookPrefsButton.setToolTip(my.tr("Modify the game-specific ITH hook code") + " (Alt+H)") #hookPrefsButton.setStatusTip(hookPrefsButton.toolTip()) #hookPrefsButton.clicked.connect(self._showHookPrefs) helpButton = QtWidgets.QPushButton(tr_("Help")) helpButton.setToolTip(tr_("Help")) skqss.class_(helpButton, 'btn btn-success') helpButton.clicked.connect(lambda: self.helpDialog.show()) #wikiButton = QtWidgets.QPushButton(tr_("Wiki")) #wikiButton.setToolTip(tr_("Wiki")) #skqss.class_(wikiButton, 'btn btn-default') #import main #wikiButton.clicked.connect(lambda: main.manager().openWiki('VNR/Text Settings')) #cancelButton = QtWidgets.QPushButton(tr_("Cancel")) #cancelButton.clicked.connect(self.q.hide) threadArea = QtWidgets.QScrollArea() threadArea.setWidget(skwidgets.SkLayoutWidget(self.threadLayout)) threadArea.setWidgetResizable(True) threadGroup = QtWidgets.QGroupBox() threadGroup.setTitle(mytr_("Text threads")) threadGroup.setLayout(skwidgets.SkWidgetLayout(threadArea)) #threadGroup.setLayout(self.threadLayout) info = QtWidgets.QGroupBox("%s (%s)" % ( tr_("Information"), tr_("read-only"), )) infoLayout = QtWidgets.QVBoxLayout() row = QtWidgets.QHBoxLayout() row.addWidget(QtWidgets.QLabel(mytr_("Game engine") + ":")) row.addWidget(self.engineLabel) row.addStretch() infoLayout.addLayout(row) info.setLayout(infoLayout) option = QtWidgets.QGroupBox(tr_("Options")) optionLayout = QtWidgets.QVBoxLayout() row = QtWidgets.QHBoxLayout() row.addWidget(QtWidgets.QLabel(mytr_("Game language") + ":")) row.addWidget(self.languageEdit) row.addStretch() row.addWidget(QtWidgets.QLabel(tr_("Text encoding") + ":")) row.addWidget(self.encodingEdit) optionLayout.addLayout(row) option.setLayout(optionLayout) layout = QtWidgets.QVBoxLayout() row = QtWidgets.QHBoxLayout() if not READONLY: row.addWidget(self.saveButton) #row.addWidget(hookPrefsButton) row.addWidget(self.resetButton) #row.addWidget(wikiButton) if not READONLY: row.addWidget(helpButton) #row.addWidget(QtWidgets.QLabel( # " <= " + my.tr("click help if you have questions") #)) row.addStretch() layout.addLayout(row) col = QtWidgets.QVBoxLayout() col.addWidget(info) col.addWidget(option) row = QtWidgets.QHBoxLayout() row.addLayout(col) row.addStretch() layout.addLayout(row) layout.addWidget(threadGroup) msg = QtWidgets.QLabel( "%s: %s" % (tr_("Note"), my.tr("All settings are read-only."))) skqss.class_(msg, "text-error") layout.addWidget(msg) #buttons = QtWidgets.QHBoxLayout() #buttons.addStretch() #buttons.addWidget(cancelButton) #buttons.addWidget(self.saveButton) #layout.addLayout(buttons) #layout.addWidget(introLabel) #layout.setContentsMargins(18, 18, 18, 9) # left, top, right, bottom #self.q.setCentralWidget(skwidgets.SkLayoutWidget(layout)) q.setLayout(layout)