mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
.
This commit is contained in:
parent
7f9b4c657e
commit
1294f4fee5
@ -3,7 +3,7 @@ import functools
|
||||
from myutils.utils import checkencoding
|
||||
from myutils.config import globalconfig, _TR, _TRL
|
||||
from myutils.wrapper import Singleton
|
||||
from gui.usefulwidget import getspinbox, threebuttons, getlineedit
|
||||
from gui.usefulwidget import getspinbox, threebuttons, getlineedit, FocusCombo
|
||||
|
||||
nowsuppertcodes = _TRL(
|
||||
[
|
||||
@ -62,7 +62,7 @@ class codeacceptdialog(QDialog):
|
||||
itemsaver = QStandardItem()
|
||||
self.model.setItem(row, 0, itemsaver)
|
||||
index = self.model.index(row, 0)
|
||||
codecombox = QComboBox()
|
||||
codecombox = FocusCombo()
|
||||
codecombox.addItems((nowsuppertcodes))
|
||||
codecombox.setCurrentIndex(idx)
|
||||
self.table.setIndexWidget(index, codecombox)
|
||||
@ -109,7 +109,7 @@ class codeacceptdialog(QDialog):
|
||||
def clicked1(self):
|
||||
itemsaver = QStandardItem()
|
||||
self.model.insertRow(0, [itemsaver])
|
||||
codecombox = QComboBox()
|
||||
codecombox = FocusCombo()
|
||||
codecombox.addItems((nowsuppertcodes))
|
||||
self._setcode_i(codecombox, itemsaver)
|
||||
codecombox.currentIndexChanged.connect(
|
||||
|
@ -40,6 +40,7 @@ from gui.specialwidget import (
|
||||
)
|
||||
from gui.usefulwidget import (
|
||||
yuitsu_switch,
|
||||
FocusCombo,
|
||||
saveposwindow,
|
||||
getsimplepatheditor,
|
||||
getboxlayout,
|
||||
@ -322,7 +323,7 @@ class TagWidget(QWidget):
|
||||
|
||||
self.setLayout(layout)
|
||||
|
||||
self.lineEdit = QComboBox()
|
||||
self.lineEdit = FocusCombo()
|
||||
self.lineEdit.setLineEdit(QLineEdit())
|
||||
|
||||
self.lineEdit.lineEdit().returnPressed.connect(
|
||||
|
@ -12,7 +12,8 @@ from gui.usefulwidget import (
|
||||
listediterline,
|
||||
getsimplepatheditor,
|
||||
FocusSpin,
|
||||
FocusDoubleSpin
|
||||
FocusDoubleSpin,
|
||||
FocusCombo
|
||||
)
|
||||
|
||||
|
||||
@ -228,7 +229,7 @@ class autoinitdialog(QDialog):
|
||||
lineW = QHBoxLayout()
|
||||
lineW.addWidget(e)
|
||||
elif line["type"] == "combo":
|
||||
lineW = QComboBox()
|
||||
lineW = FocusCombo()
|
||||
if "list_function" in line:
|
||||
try:
|
||||
func = getattr(
|
||||
|
@ -3,7 +3,7 @@ import sqlite3, os, json, functools
|
||||
from traceback import print_exc
|
||||
from myutils.config import globalconfig, _TR
|
||||
from myutils.utils import autosql
|
||||
from gui.usefulwidget import getQMessageBox
|
||||
from gui.usefulwidget import getQMessageBox, FocusCombo
|
||||
|
||||
|
||||
def sqlite2json2(self, sqlitefile, targetjson=None, existsmerge=False):
|
||||
@ -47,7 +47,7 @@ def sqlite2json2(self, sqlitefile, targetjson=None, existsmerge=False):
|
||||
formLayout = QFormLayout(dialog) # 配置layout
|
||||
dialog.setLayout(formLayout)
|
||||
|
||||
combo = QComboBox()
|
||||
combo = FocusCombo()
|
||||
combo.addItems([globalconfig["fanyi"][_]["name"] for _ in collect])
|
||||
|
||||
formLayout.addRow(_TR("首选翻译"), combo)
|
||||
|
@ -13,7 +13,8 @@ from gui.usefulwidget import (
|
||||
getsimplecombobox,
|
||||
getsimpleswitch,
|
||||
textbrowappendandmovetoend,
|
||||
FocusSpin
|
||||
FocusSpin,
|
||||
FocusCombo
|
||||
)
|
||||
|
||||
|
||||
@ -263,7 +264,7 @@ class searchhookparam(QDialog):
|
||||
if len(_list) == 0:
|
||||
regwid = addwid = line
|
||||
else:
|
||||
combo = QComboBox()
|
||||
combo = FocusCombo()
|
||||
combo.addItems(_list)
|
||||
|
||||
combo.setLineEdit(line)
|
||||
|
@ -25,6 +25,7 @@ from gui.usefulwidget import (
|
||||
D_getsimpleswitch,
|
||||
makesubtab_lazy,
|
||||
makescrollgrid,
|
||||
FocusCombo
|
||||
)
|
||||
|
||||
|
||||
@ -211,7 +212,7 @@ def getunknowgameexe(self):
|
||||
formLayout = QFormLayout(dialog)
|
||||
dialog.setLayout(formLayout)
|
||||
|
||||
combo = QComboBox()
|
||||
combo = FocusCombo()
|
||||
combo.addItems([savehook_new_data[_]["title"] for _ in savehook_new_list])
|
||||
|
||||
formLayout.addRow(_TR("选择游戏"), combo)
|
||||
|
@ -9,6 +9,7 @@ from gui.usefulwidget import (
|
||||
makescrollgrid,
|
||||
D_getcolorbutton,
|
||||
yuitsu_switch,
|
||||
FocusCombo,
|
||||
D_getsimpleswitch,
|
||||
)
|
||||
|
||||
@ -34,7 +35,7 @@ def changevoice(self, text):
|
||||
|
||||
def createvoicecombo(self):
|
||||
|
||||
self.voicecombo = QComboBox()
|
||||
self.voicecombo = FocusCombo()
|
||||
self.voicecombo.currentTextChanged.connect(lambda x: changevoice(self, x))
|
||||
try:
|
||||
vl, idx = self.voicecombo_cache
|
||||
|
@ -12,6 +12,19 @@ from myutils.config import _TR, globalconfig
|
||||
from myutils.wrapper import Singleton, Singleton_close
|
||||
|
||||
|
||||
class FocusCombo(QComboBox):
|
||||
def __init__(self, parent: QWidget = None) -> None:
|
||||
super().__init__(parent)
|
||||
self.setFocusPolicy(Qt.FocusPolicy.StrongFocus)
|
||||
|
||||
def wheelEvent(self, e: QWheelEvent) -> None:
|
||||
|
||||
if not self.hasFocus():
|
||||
e.ignore()
|
||||
return
|
||||
else:
|
||||
return super().wheelEvent(e)
|
||||
|
||||
class FocusSpin(QSpinBox):
|
||||
def __init__(self, parent: QWidget = None) -> None:
|
||||
super().__init__(parent)
|
||||
@ -412,7 +425,7 @@ def comboboxcallbackwrap(internallist, d, k, call, _):
|
||||
|
||||
|
||||
def getsimplecombobox(lst, d, k, callback=None, fixedsize=False, internallist=None):
|
||||
s = QComboBox()
|
||||
s = FocusCombo()
|
||||
s.addItems(lst)
|
||||
|
||||
if internallist:
|
||||
|
Loading…
x
Reference in New Issue
Block a user