def __init__(self, q): self.imageEnabled = True self.clear() self._createUi(q) self.contentEdit.setFocus() skwidgets.shortcut('ctrl+s', self._save, parent=q)
def _createUi(self, q): grid = QtWidgets.QGridLayout() grid.setHorizontalSpacing(0) grid.setVerticalSpacing(0) # These keys must be consistent with pyhk KEYBOARD = ( ('Esc', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12'), #'Escape' ('`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 'Back'), ('Cap', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '[', ']', '\\'), (None, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', "'"), # 'Enter', (None, 'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '/'), #('Up', 'Down', 'Left', 'Right'), ) r = 0 for keys in KEYBOARD: for col,key in enumerate(keys): if key: btn = self.createKeyButton(key) grid.addWidget(btn, r, col) r += 1 WIDE_COL = 2 KEYBOARD2 = ( ('Shift', 'Ctrl', 'Alt'), # 'Space' ('Insert', 'Delete', 'Home', 'End', 'PageUp', 'PageDown'), #('mouse left', 'mouse middle', 'mouse right'), ) for keys in KEYBOARD2: for i,key in enumerate(keys): col = i * WIDE_COL if key: btn = self.createKeyButton(key) grid.addWidget(btn, r, col, 1, WIDE_COL) r += 1 layout = QtWidgets.QVBoxLayout() layout.addLayout(grid) row = QtWidgets.QHBoxLayout() row.addStretch() row.addWidget(self.delButton) row.addWidget(self.cancelButton) row.addWidget(self.saveButton) layout.addLayout(row) #buttonBox = QtWidgets.QDialogButtonBox() #buttonBox.addButton(self.delButton, buttonBox.ResetRole) #buttonBox.addButton(self.cancelButton, buttonBox.RejectRole) #buttonBox.addButton(self.saveButton, buttonBox.AcceptRole) #layout.addWidget(buttonBox) q.setLayout(layout) shortcut('ctrl+s', self.save, parent=q)
def __init__(self, q): self.clear() self._locked = False self._gameBean = GameCoffeeBean(parent=q) self._viewBean = SkWebViewBean(self.webView) self._createUi(q) shortcut('alt+e', self._edit, parent=q)
def __init__(self, q): self.imageEnabled = True self.postId = 0 # long self.userName = '' # unicode #self.userName = '' # unicode self.postLanguage = '' self.postContent = '' self.imageId = 0 self.imageTitle = '' self.imagePath = '' self._createUi(q) self.contentEdit.setFocus() skwidgets.shortcut('ctrl+s', self._save, parent=q)
def _createShortcuts(self): from functools import partial import main root = self.rootObject() sig = root.ignoresFocusChanged # Must be consistent with kagami/appmenu.qml b = root.property('ignoresFocus') m = main.manager() s = shortcut('alt+q', m.confirmQuit, parent=self) s.setEnabled(not b) sig.connect(partial((lambda s, v: s.setEnabled(not v)), s))
def __init__(self, q): self.imageEnabled = True self.topicId = 0 # long self.subjectId = 0 # long self.subjectType = 'subject' # str self.topicType = 'review' # str self.userName = '' # unicode self.topicLanguage = '' self.topicTitle = '' self.topicContent = '' self.scores = {} # {str key:int value} self.imageId = 0 self.imageTitle = '' self.imagePath = '' self._createUi(q) self.contentEdit.setFocus() skwidgets.shortcut('ctrl+s', self._save, parent=q)
def __init__(self, parent=None): super(ChooseMeansPage, self).__init__(parent) self.setTitle(my.tr("Select how to find the game")) introLabel = QtWidgets.QLabel(my.tr("How would you like to select the game?")) introLabel.setWordWrap(True) self._windowButton = QtWidgets.QRadioButton(my.tr("Select the window of the running game") + " (%s)" % tr_("recommended")) self._windowButton.setToolTip("Alt+1") self._windowButton.clicked.connect(self.completeChanged) self._processButton = QtWidgets.QRadioButton(my.tr("Select the process of the running game")) self._processButton.setToolTip("Alt+2") self._processButton.clicked.connect(self.completeChanged) self._fileButton = QtWidgets.QRadioButton(my.tr("Select the game executable file on the hard drive")) self._fileButton.setToolTip("Alt+3") self._fileButton.clicked.connect(self.completeChanged) skwidgets.shortcut("alt+1", self._windowButton.click) skwidgets.shortcut("alt+2", self._processButton.click) skwidgets.shortcut("alt+3", self._fileButton.click) infoLabel = QtWidgets.QLabel("\n" + my.tr( "By the way, you can also drag the game's exe/lnk to the SpringBoard, which is equivalent to #3 (select by file)." )) infoLabel.setWordWrap(True) layout = QtWidgets.QVBoxLayout() layout.addWidget(introLabel) if not features.WINE: layout.addWidget(self._windowButton) layout.addWidget(self._processButton) layout.addWidget(self._fileButton) layout.addWidget(infoLabel) self.setLayout(layout)
def _createShortcuts(self, q): shortcut(QtGui.QKeySequence.AddTab, self.newTabAfterCurrentWithBlankPage, parent=q) shortcut('ctrl+w', self.closeCurrentTab, parent=q) shortcut('ctrl+shift+t', self.undoCloseTab, parent=q) for k in 'ctrl+l', 'alt+d': shortcut(k, self.addressEdit.focus, parent=q) for k in 'ctrl+{', 'ctrl+shift+tab': shortcut(k, self.previousTab, parent=q) for k in 'ctrl+}', 'ctrl+tab': shortcut(k, self.nextTab, parent=q) for i in range(1, 10): shortcut('ctrl+%i' % i, partial(self.focusTab, i - 1), parent=q)
def createShortcuts(self): q = self.q import main m = main.manager() # Must be consistent with springboard/appmenu.qml shortcut('alt+q', m.confirmQuit, parent=q) shortcut('alt+r', m.confirmRestart, parent=q) shortcut('alt+u', m.confirmUpdateGameDatabase, parent=q) shortcut('alt+o', m.showPreferences, parent=q) # Does not work on windows?! shortcut('alt+s', m.openRunningGame, parent=q) shortcut('alt+n', m.showGameWizard, parent=q) shortcut('alt+f', m.showGameBoard, 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 __init__(self, q, readonly=False): self._createUi(q, readonly=readonly) shortcut('alt+s', self._save, parent=q) shortcut('alt+o', self._browse, parent=q) shortcut('alt+e', self.searchEdit.setFocus, parent=q) shortcut('alt+f', self.filterEdit.setFocus, parent=q) shortcut('alt+1', self.trailersButton.click, parent=q) shortcut('alt+2', self.scapeButton.click, parent=q) shortcut('alt+3', self.holysealButton.click, parent=q) shortcut('alt+4', self.freemButton.click, parent=q) shortcut('alt+5', self.getchuButton.click, parent=q) shortcut('alt+6', self.melonButton.click, parent=q) shortcut('alt+7', self.gyuttoButton.click, parent=q) shortcut('alt+8', self.digiketButton.click, parent=q) shortcut('alt+9', self.dmmButton.click, parent=q) shortcut('alt+0', self.dlsiteButton.click, 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) 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)