This commit is contained in:
恍兮惚兮 2025-01-11 19:12:37 +08:00
parent 36517df494
commit 082fac5614
26 changed files with 71 additions and 142 deletions

View File

@ -52,7 +52,7 @@ class AttachProcessDialog(saveposwindow):
qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selectgame"]["icon"]) qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selectgame"]["icon"])
) )
w = QWidget() w = QWidget()
self.layout1 = QVBoxLayout() self.layout1 = QVBoxLayout(w)
self.label = LLabel( self.label = LLabel(
( (
"如果没看见想要附加的进程,可以尝试点击下方按钮后点击游戏窗口,或者尝试使用管理员权限运行本软件" "如果没看见想要附加的进程,可以尝试点击下方按钮后点击游戏窗口,或者尝试使用管理员权限运行本软件"
@ -105,7 +105,6 @@ class AttachProcessDialog(saveposwindow):
bottomlayout.addWidget(self.buttonBox) bottomlayout.addWidget(self.buttonBox)
self.layout1.addLayout(bottomlayout) self.layout1.addLayout(bottomlayout)
w.setLayout(self.layout1)
self.setCentralWidget(w) self.setCentralWidget(w)
self.buttonBox.accepted.connect(self.accept) self.buttonBox.accepted.connect(self.accept)

View File

@ -30,7 +30,8 @@ class dialog_memory(saveposwindow):
) )
self.setWindowTitle("备忘录") self.setWindowTitle("备忘录")
self.setWindowIcon(qtawesome.icon(globalconfig["toolbutton"]["buttons"]["memory"]["icon"])) self.setWindowIcon(qtawesome.icon(globalconfig["toolbutton"]["buttons"]["memory"]["icon"]))
formLayout = QVBoxLayout() # _w = QWidget()
formLayout = QVBoxLayout(_w) #
self.showtext = QTextEdit() self.showtext = QTextEdit()
self.rwpath = gobject.getuserconfigdir( self.rwpath = gobject.getuserconfigdir(
"memory/{}.html".format(gobject.baseobject.gameuid) "memory/{}.html".format(gobject.baseobject.gameuid)
@ -57,7 +58,5 @@ class dialog_memory(saveposwindow):
self.showtext.textChanged.connect(self.save) self.showtext.textChanged.connect(self.save)
x.addWidget(insertpicbtn) x.addWidget(insertpicbtn)
formLayout.addLayout(x) formLayout.addLayout(x)
_w = QWidget()
_w.setLayout(formLayout)
self.setCentralWidget(_w) self.setCentralWidget(_w)
self.show() self.show()

View File

@ -113,11 +113,9 @@ class TagWidget(QWidget):
def __init__(self, parent=None, exfoucus=True): def __init__(self, parent=None, exfoucus=True):
super().__init__(parent) super().__init__(parent)
tagitem.setstyles(self) tagitem.setstyles(self)
layout = QHBoxLayout() layout = QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
self.lineEdit = FocusCombo() self.lineEdit = FocusCombo()
if exfoucus: if exfoucus:
self.lineEdit.setLineEdit(FQLineEdit()) self.lineEdit.setLineEdit(FQLineEdit())
@ -656,7 +654,7 @@ class dialog_savedgame_new(QWidget):
self._parent = parent self._parent = parent
self.setstyle() self.setstyle()
gobject.global_dialog_savedgame_new = self gobject.global_dialog_savedgame_new = self
formLayout = QVBoxLayout() formLayout = QVBoxLayout(self)
layout = QHBoxLayout() layout = QHBoxLayout()
self.setAcceptDrops(True) self.setAcceptDrops(True)
layout.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 0)
@ -682,7 +680,6 @@ class dialog_savedgame_new(QWidget):
self.savebutton = [] self.savebutton = []
self.idxsave = [] self.idxsave = []
self.setLayout(formLayout)
self.activategamenum = 1 self.activategamenum = 1
self.itemfocuschanged(False, None) self.itemfocuschanged(False, None)
if globalconfig["hide_not_exists"]: if globalconfig["hide_not_exists"]:

View File

@ -99,12 +99,11 @@ class tagitem(QFrame):
border_color = "yellow" border_color = "yellow"
self.setObjectName(border_color) self.setObjectName(border_color)
tagLayout = QHBoxLayout() tagLayout = QHBoxLayout(self)
tagLayout.setContentsMargins(0, 0, 0, 0) tagLayout.setContentsMargins(0, 0, 0, 0)
tagLayout.setSpacing(0) tagLayout.setSpacing(0)
key = (tag, _type, refdata) key = (tag, _type, refdata)
self.setLayout(tagLayout)
lb = ClickableLabel() lb = ClickableLabel()
lb.setStyleSheet("background:transparent") lb.setStyleSheet("background:transparent")
lb.setText(tag) lb.setText(tag)

View File

@ -211,7 +211,6 @@ class dialog_setting_game_internal(QWidget):
vbox = QVBoxLayout(self) vbox = QVBoxLayout(self)
self.lauchpath = None self.lauchpath = None
formLayout = LFormLayout() formLayout = LFormLayout()
self.setLayout(vbox)
self.gameuid = gameuid self.gameuid = gameuid
formLayout.addRow( formLayout.addRow(
"路径", "路径",
@ -272,23 +271,20 @@ class dialog_setting_game_internal(QWidget):
def ___tabf(self, function, gameuid): def ___tabf(self, function, gameuid):
_w = QWidget() _w = QWidget()
formLayout = LFormLayout() formLayout = LFormLayout(_w)
_w.setLayout(formLayout)
do = functools.partial(function, formLayout, gameuid) do = functools.partial(function, formLayout, gameuid)
return _w, do return _w, do
def ___tabf2(self, function, gameuid): def ___tabf2(self, function, gameuid):
_w = QWidget() _w = QWidget()
formLayout = QVBoxLayout() formLayout = QVBoxLayout(_w)
_w.setLayout(formLayout)
do = functools.partial(function, formLayout, gameuid) do = functools.partial(function, formLayout, gameuid)
return _w, do return _w, do
def ___tabf3(self, function, gameuid): def ___tabf3(self, function, gameuid):
_w = QWidget() _w = QWidget()
formLayout = QVBoxLayout() formLayout = QVBoxLayout(_w)
formLayout.setContentsMargins(0, 0, 0, 0) formLayout.setContentsMargins(0, 0, 0, 0)
_w.setLayout(formLayout)
do = functools.partial(function, formLayout, gameuid) do = functools.partial(function, formLayout, gameuid)
return _w, do return _w, do
@ -453,8 +449,7 @@ class dialog_setting_game_internal(QWidget):
def starttab(self, formLayout: LFormLayout, gameuid): def starttab(self, formLayout: LFormLayout, gameuid):
box = QGroupBox() box = QGroupBox()
settinglayout = LFormLayout() settinglayout = LFormLayout(box)
box.setLayout(settinglayout)
def __(box, layout, config, uid): def __(box, layout, config, uid):
clearlayout(layout) clearlayout(layout)
@ -753,9 +748,8 @@ class dialog_setting_game_internal(QWidget):
) )
__extraw.setEnabled(not dic[key]) __extraw.setEnabled(not dic[key])
formLayout.addRow(__extraw) formLayout.addRow(__extraw)
formLayout2 = klass() formLayout2 = klass(__extraw)
formLayout2.setContentsMargins(0, 0, 0, 0) formLayout2.setContentsMargins(0, 0, 0, 0)
__extraw.setLayout(formLayout2)
return formLayout2 return formLayout2
def getttssetting(self, formLayout: LFormLayout, gameuid): def getttssetting(self, formLayout: LFormLayout, gameuid):
@ -1103,8 +1097,7 @@ class dialog_setting_game_internal(QWidget):
) )
box = LGroupBox() box = LGroupBox()
box.setTitle("额外的钩子") box.setTitle("额外的钩子")
settinglayout = LFormLayout() settinglayout = LFormLayout(box)
box.setLayout(settinglayout)
formLayout.addRow(box) formLayout.addRow(box)
settinglayout.addRow( settinglayout.addRow(
"Win32通用钩子", "Win32通用钩子",
@ -1131,8 +1124,7 @@ class dialog_setting_game_internal(QWidget):
), ),
) )
box = QGroupBox() box = QGroupBox()
settinglayout = LFormLayout() settinglayout = LFormLayout(box)
box.setLayout(settinglayout)
formLayout.addRow(box) formLayout.addRow(box)
for k in [ for k in [
"codepage_index", "codepage_index",
@ -1213,7 +1205,6 @@ class dialog_setting_game(QDialog):
_.methodtab.setCurrentIndex(setindexhook) _.methodtab.setCurrentIndex(setindexhook)
_.setMinimumWidth(600) _.setMinimumWidth(600)
l = QHBoxLayout(self) l = QHBoxLayout(self)
self.setLayout(l)
l.addWidget(_) l.addWidget(_)
l.setContentsMargins(0, 0, 0, 0) l.setContentsMargins(0, 0, 0, 0)
self.show() self.show()

View File

@ -93,7 +93,7 @@ class clickitem(QWidget):
super().__init__() super().__init__()
self.uid = uid self.uid = uid
self.lay = QHBoxLayout() self.lay = QHBoxLayout(self)
self.lay.setSpacing(0) self.lay.setSpacing(0)
lay1 = QHBoxLayout() lay1 = QHBoxLayout()
self.lay1 = lay1 self.lay1 = lay1
@ -125,7 +125,6 @@ class clickitem(QWidget):
self._2 = _ self._2 = _
_.setObjectName("savegame_textfont2") _.setObjectName("savegame_textfont2")
self.lay.addWidget(_) self.lay.addWidget(_)
self.setLayout(self.lay)
class fadeoutlabel(QLabel): class fadeoutlabel(QLabel):
@ -257,12 +256,11 @@ class previewimages(QWidget):
def __init__(self, p) -> None: def __init__(self, p) -> None:
super().__init__(p) super().__init__(p)
self.lay = QHBoxLayout() self.lay = QHBoxLayout(self)
self.lay.setContentsMargins(0, 0, 0, 0) self.lay.setContentsMargins(0, 0, 0, 0)
self.list = MyQListWidget(self) self.list = MyQListWidget(self)
self.list.currentRowChanged.connect(self._visidx) self.list.currentRowChanged.connect(self._visidx)
self.lay.addWidget(self.list) self.lay.addWidget(self.list)
self.setLayout(self.lay)
def tolastnext(self, dx): def tolastnext(self, dx):
if self.list.count() == 0: if self.list.count() == 0:
@ -362,11 +360,10 @@ class viewpixmap_x(QWidget):
self.commentedit = QPlainTextEdit(self) self.commentedit = QPlainTextEdit(self)
self.commentedit.textChanged.connect(self.changecommit) self.commentedit.textChanged.connect(self.changecommit)
self.centerwidget = QWidget(self) self.centerwidget = QWidget(self)
self.centerwidgetlayout = QVBoxLayout() self.centerwidgetlayout = QVBoxLayout(self.centerwidget)
audio = QHBoxLayout() audio = QHBoxLayout()
self.recordbtn = statusbutton(icons=["fa.microphone", "fa.stop"]) self.recordbtn = statusbutton(icons=["fa.microphone", "fa.stop"])
self.recordbtn.clicked.connect(self.startorendrecord) self.recordbtn.clicked.connect(self.startorendrecord)
self.centerwidget.setLayout(self.centerwidgetlayout)
self.centerwidgetlayout.addWidget(self.commentedit) self.centerwidgetlayout.addWidget(self.commentedit)
self.centerwidgetlayout.addLayout(audio) self.centerwidgetlayout.addLayout(audio)
audio.addWidget(self.recordbtn) audio.addWidget(self.recordbtn)
@ -530,7 +527,6 @@ class pixwrapper(QWidget):
self.setrank(rank) self.setrank(rank)
self.sethor(hor) self.sethor(hor)
self.pixview.tolastnext.connect(self.previewimages.tolastnext) self.pixview.tolastnext.connect(self.previewimages.tolastnext)
self.setLayout(self.vlayout)
self.previewimages.changepixmappath.connect(self.changepixmappath) self.previewimages.changepixmappath.connect(self.changepixmappath)
self.previewimages.removepath.connect(self.removepath) self.previewimages.removepath.connect(self.removepath)
self.k = None self.k = None
@ -833,9 +829,8 @@ class dialog_savedgame_v3(QWidget):
self.stack.bgclicked.connect(clickitem.clearfocus) self.stack.bgclicked.connect(clickitem.clearfocus)
self.setstyle() self.setstyle()
spl = QSplitter() spl = QSplitter()
_l = QHBoxLayout() _l = QHBoxLayout(self)
_l.addWidget(spl) _l.addWidget(spl)
self.setLayout(_l)
spl.addWidget(self.stack) spl.addWidget(self.stack)
self.righttop = makesubtab_lazy() self.righttop = makesubtab_lazy()
@ -846,9 +841,8 @@ class dialog_savedgame_v3(QWidget):
) )
) )
_w = QWidget() _w = QWidget()
rightlay = QVBoxLayout() rightlay = QVBoxLayout(_w)
rightlay.setContentsMargins(0, 0, 0, 0) rightlay.setContentsMargins(0, 0, 0, 0)
_w.setLayout(rightlay)
self.righttop.addTab(_w, "画廊") self.righttop.addTab(_w, "画廊")
spl.addWidget(self.righttop) spl.addWidget(self.righttop)

View File

@ -34,10 +34,9 @@ class edittext(saveposwindow):
self.textOutput.setUndoRedoEnabled(True) self.textOutput.setUndoRedoEnabled(True)
self.textOutput.setReadOnly(False) self.textOutput.setReadOnly(False)
qv = QHBoxLayout()
w = QWidget() w = QWidget()
qv = QHBoxLayout(w)
self.setCentralWidget(w) self.setCentralWidget(w)
w.setLayout(qv)
bt1 = QPushButton( bt1 = QPushButton(
icon=qtawesome.icon("fa.rotate-right", color=globalconfig["buttoncolor"]) icon=qtawesome.icon("fa.rotate-right", color=globalconfig["buttoncolor"])
@ -147,10 +146,9 @@ class edittrans(LMainWindow):
self.setWindowIcon(qtawesome.icon("fa.edit")) self.setWindowIcon(qtawesome.icon("fa.edit"))
self.textOutput = ctrlenter(self) self.textOutput = ctrlenter(self)
qv = QHBoxLayout()
w = QWidget() w = QWidget()
qv = QHBoxLayout(w)
self.setCentralWidget(w) self.setCentralWidget(w)
w.setLayout(qv)
self.textOutput.enterpressed.connect(self.submitfunction) self.textOutput.enterpressed.connect(self.submitfunction)
submit = LPushButton("确定") submit = LPushButton("确定")
inter, vis = loadvalidtss() inter, vis = loadvalidtss()

View File

@ -471,8 +471,7 @@ class autoinitdialog(LDialog):
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint) super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
self.setWindowTitle(title) self.setWindowTitle(title)
self.resize(QSize(width, 10)) self.resize(QSize(width, 10))
formLayout = VisLFormLayout() formLayout = VisLFormLayout(self)
self.setLayout(formLayout)
regist = {} regist = {}
def save(callback=None): def save(callback=None):

View File

@ -47,7 +47,6 @@ def sqlite2json2(
dialog.setWindowTitle("导出翻译记录为json文件") dialog.setWindowTitle("导出翻译记录为json文件")
dialog.resize(QSize(800, 10)) dialog.resize(QSize(800, 10))
formLayout = LFormLayout(dialog) # 配置layout formLayout = LFormLayout(dialog) # 配置layout
dialog.setLayout(formLayout)
combo = SuperCombo() combo = SuperCombo()
combo.addItems([getannotatedapiname(_) for _ in _collect], _collect) combo.addItems([getannotatedapiname(_) for _ in _collect], _collect)

View File

@ -41,11 +41,10 @@ def getformlayoutw(w=None, cls=LFormLayout, hide=False):
_w = QWidget() _w = QWidget()
else: else:
_w = w _w = w
_l = cls() _l = cls(_w)
if hide: if hide:
_w.hide() _w.hide()
_l.setContentsMargins(0, 0, 0, 0) _l.setContentsMargins(0, 0, 0, 0)
_w.setLayout(_l)
return _w, _l return _w, _l
@ -209,10 +208,9 @@ class searchhookparam(LDialog):
windows.SWP_NOACTIVATE | windows.SWP_NOSIZE | windows.SWP_NOMOVE, windows.SWP_NOACTIVATE | windows.SWP_NOSIZE | windows.SWP_NOMOVE,
) )
self.setWindowTitle("搜索设置") self.setWindowTitle("搜索设置")
mainlayout = QVBoxLayout() mainlayout = QVBoxLayout(self)
checks = QButtonGroup_switch_widegt(self) checks = QButtonGroup_switch_widegt(self)
self.searchmethod = checks self.searchmethod = checks
self.setLayout(mainlayout)
layout1 = QHBoxLayout() layout1 = QHBoxLayout()
layout1.addWidget(LLabel("代码页")) layout1.addWidget(LLabel("代码页"))
@ -556,8 +554,7 @@ class hookselect(closeashidewindow):
self.setWindowIcon( self.setWindowIcon(
qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selecttext"]["icon"]) qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selecttext"]["icon"])
) )
self.hboxlayout = QHBoxLayout() self.hboxlayout = QHBoxLayout(self.widget)
self.widget.setLayout(self.hboxlayout)
self.vboxlayout = QVBoxLayout() self.vboxlayout = QVBoxLayout()
self.hboxlayout.addLayout(self.vboxlayout) self.hboxlayout.addLayout(self.vboxlayout)
self.ttCombomodelmodel = LStandardItemModel() self.ttCombomodelmodel = LStandardItemModel()

View File

@ -27,10 +27,9 @@ class TabWidget(QWidget):
def __init__(self, parent=None): def __init__(self, parent=None):
super(TabWidget, self).__init__(parent) super(TabWidget, self).__init__(parent)
layout = QHBoxLayout() layout = QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0) layout.setSpacing(0)
self.setLayout(layout)
self.splitter = QSplitter() self.splitter = QSplitter()
layout.addWidget(self.splitter) layout.addWidget(self.splitter)
self.list_widget = LListWidget(self) self.list_widget = LListWidget(self)

View File

@ -27,8 +27,7 @@ class dialog_selecticon(LDialog):
) as ff: ) as ff:
js = json.load(ff) js = json.load(ff)
layout = QGridLayout() layout = QGridLayout(self)
self.setLayout(layout)
for i, name in enumerate(js): for i, name in enumerate(js):
layout.addWidget( layout.addWidget(
getIconButton( getIconButton(

View File

@ -81,14 +81,13 @@ class extrahtml(saveposwindow):
self.btn_apply = LPushButton("测试") self.btn_apply = LPushButton("测试")
self.btn_apply.clicked.connect(self.applyhtml) self.btn_apply.clicked.connect(self.applyhtml)
self.vistext = QPlainTextEdit() self.vistext = QPlainTextEdit()
lay = QVBoxLayout() w = QWidget()
lay = QVBoxLayout(w)
hl = QHBoxLayout() hl = QHBoxLayout()
hl.addWidget(self.btn_save) hl.addWidget(self.btn_save)
hl.addWidget(self.btn_apply) hl.addWidget(self.btn_apply)
lay.addWidget(self.vistext) lay.addWidget(self.vistext)
lay.addLayout(hl) lay.addLayout(hl)
w = QWidget()
w.setLayout(lay)
self.setCentralWidget(w) self.setCentralWidget(w)
self.tryload() self.tryload()
self.show() self.show()
@ -233,8 +232,7 @@ def creategoodfontwid(self):
self.goodfontsettingsWidget.setStyleSheet( self.goodfontsettingsWidget.setStyleSheet(
"QGroupBox{ margin-top:0px;} QGroupBox:title {margin-top: 0px;}" "QGroupBox{ margin-top:0px;} QGroupBox:title {margin-top: 0px;}"
) )
self.goodfontsettingsformlayout = LFormLayout() self.goodfontsettingsformlayout = LFormLayout(self.goodfontsettingsWidget)
self.goodfontsettingsWidget.setLayout(self.goodfontsettingsformlayout)
resetgroudswitchcallback(self, globalconfig["rendertext_using"]) resetgroudswitchcallback(self, globalconfig["rendertext_using"])
return self.goodfontsettingsWidget return self.goodfontsettingsWidget

View File

@ -48,9 +48,8 @@ def createhorizontal_slider(self):
functools.partial(changeHorizontal, self) functools.partial(changeHorizontal, self)
) )
w = QWidget() w = QWidget()
hb = QHBoxLayout() hb = QHBoxLayout(w)
hb.setContentsMargins(0, 0, 0, 0) hb.setContentsMargins(0, 0, 0, 0)
w.setLayout(hb)
self.horizontal_slider_label = QLabel() self.horizontal_slider_label = QLabel()
self.horizontal_slider_label.setText("{}%".format(globalconfig["transparent"])) self.horizontal_slider_label.setText("{}%".format(globalconfig["transparent"]))

View File

@ -242,7 +242,6 @@ def selectgameuid(self):
dialog.setWindowTitle("选择游戏") dialog.setWindowTitle("选择游戏")
dialog.resize(QSize(800, 10)) dialog.resize(QSize(800, 10))
formLayout = LFormLayout(dialog) formLayout = LFormLayout(dialog)
dialog.setLayout(formLayout)
_internal = [] _internal = []
_vis = [] _vis = []
for gameuid in savehook_new_list: for gameuid in savehook_new_list:

View File

@ -88,8 +88,7 @@ class triggereditor(LDialog):
table.customContextMenuRequested.connect(self.showmenu) table.customContextMenuRequested.connect(self.showmenu)
self.hctable = table self.hctable = table
self.internalrealname = [] self.internalrealname = []
formLayout = QVBoxLayout() formLayout = QVBoxLayout(self)
self.setLayout(formLayout)
formLayout.addWidget(self.hctable) formLayout.addWidget(self.hctable)
self.vkeys = list(vkcode_map.keys()) self.vkeys = list(vkcode_map.keys())
for row, k in enumerate(self.list): # 2 for row, k in enumerate(self.list): # 2
@ -282,8 +281,7 @@ def _ocrparam(self):
self._ocrparam.setStyleSheet( self._ocrparam.setStyleSheet(
"QGroupBox{ margin-top:0px;} QGroupBox:title {margin-top: 0px;}" "QGroupBox{ margin-top:0px;} QGroupBox:title {margin-top: 0px;}"
) )
self._ocrparaml = LFormLayout() self._ocrparaml = LFormLayout(self._ocrparam)
self._ocrparam.setLayout(self._ocrparaml)
_ocrparam_create(self, globalconfig["ocr_auto_method"]) _ocrparam_create(self, globalconfig["ocr_auto_method"])
return self._ocrparam return self._ocrparam
@ -334,10 +332,9 @@ class showocrimage(saveposwindow):
self.setWindowTitle("查看") self.setWindowTitle("查看")
self.originlabel = pixmapviewer() self.originlabel = pixmapviewer()
qw = QWidget() qw = QWidget()
self.layout1 = QVBoxLayout() self.layout1 = QVBoxLayout(qw)
self.setAcceptDrops(True) self.setAcceptDrops(True)
self.setCentralWidget(qw) self.setCentralWidget(qw)
qw.setLayout(self.layout1)
icon = getIconButton(callback=self.openff, icon="fa.folder-open") icon = getIconButton(callback=self.openff, icon="fa.folder-open")
button = getIconButton(callback=self.retest, icon="fa.rotate-right") button = getIconButton(callback=self.retest, icon="fa.rotate-right")
hb = QHBoxLayout() hb = QHBoxLayout()

View File

@ -314,10 +314,9 @@ def btndeccallback(self, countnum, btnplus):
def createmanybtn(self, countnum, btnplus): def createmanybtn(self, countnum, btnplus):
hbox = QHBoxLayout()
hbox.setContentsMargins(0, 0, 0, 0)
w = Shit() w = Shit()
w.setLayout(hbox) hbox = QHBoxLayout(w)
hbox.setContentsMargins(0, 0, 0, 0)
btn = QPushButton(self) btn = QPushButton(self)
btn.setIcon(qtawesome.icon("fa.plus")) btn.setIcon(qtawesome.icon("fa.plus"))

View File

@ -36,7 +36,8 @@ def delaysetcomparetext(self, s, x):
def getcomparelayout(self): def getcomparelayout(self):
layout = QHBoxLayout() w = QWidget()
layout = QHBoxLayout(w)
fromtext = QPlainTextEdit() fromtext = QPlainTextEdit()
totext = QPlainTextEdit() totext = QPlainTextEdit()
solvebutton = getIconButton( solvebutton = getIconButton(
@ -47,8 +48,6 @@ def getcomparelayout(self):
layout.addWidget(fromtext) layout.addWidget(fromtext)
layout.addWidget(solvebutton) layout.addWidget(solvebutton)
layout.addWidget(totext) layout.addWidget(totext)
w = QWidget()
w.setLayout(layout)
self.__fromtext = fromtext self.__fromtext = fromtext
self.__totext = totext self.__totext = totext
try: try:

View File

@ -118,11 +118,10 @@ class AnkiWindow(QWidget):
tabadd_lazy(self.tabs, "设置", self.creatsetdtab) tabadd_lazy(self.tabs, "设置", self.creatsetdtab)
tabadd_lazy(self.tabs, "模板", self.creattemplatetab) tabadd_lazy(self.tabs, "模板", self.creattemplatetab)
l = QHBoxLayout() l = QHBoxLayout(self)
l.setContentsMargins(0, 0, 0, 0) l.setContentsMargins(0, 0, 0, 0)
l.setSpacing(0) l.setSpacing(0)
l.addWidget(self.tabs) l.addWidget(self.tabs)
self.setLayout(l)
self.refreshhtml.connect(self.refreshhtmlfunction) self.refreshhtml.connect(self.refreshhtmlfunction)
self.tabs.currentChanged.connect(self.ifshowrefresh) self.tabs.currentChanged.connect(self.ifshowrefresh)
@ -325,10 +324,9 @@ class AnkiWindow(QWidget):
) as ff: ) as ff:
ff.write(model_css) ff.write(model_css)
def creatsetdtab(self, baselay): def creatsetdtab(self, baselay: QVBoxLayout):
layout = VisLFormLayout()
wid = QWidget() wid = QWidget()
wid.setLayout(layout) layout = VisLFormLayout(wid)
baselay.addWidget(wid) baselay.addWidget(wid)
layout.addRow( layout.addRow(
"端口号", getspinbox(0, 65536, globalconfig["ankiconnect"], "port") "端口号", getspinbox(0, 65536, globalconfig["ankiconnect"], "port")
@ -460,9 +458,8 @@ class AnkiWindow(QWidget):
def createaddtab(self): def createaddtab(self):
self.recorders = {} self.recorders = {}
layout = QVBoxLayout()
wid = QWidget() wid = QWidget()
wid.setLayout(layout) layout = QVBoxLayout(wid)
soundbutton = QPushButton(qtawesome.icon("fa.music"), "") soundbutton = QPushButton(qtawesome.icon("fa.music"), "")
soundbutton.clicked.connect(self.langdu) soundbutton.clicked.connect(self.langdu)
@ -1015,8 +1012,7 @@ class showdiction(QWidget):
self.tree.setUniformRowHeights(True) self.tree.setUniformRowHeights(True)
self.tree.setHeaderHidden(True) self.tree.setHeaderHidden(True)
self.tree.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers) self.tree.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
__lay = QVBoxLayout() __lay = QVBoxLayout(self)
self.setLayout(__lay)
__lay.setSpacing(0) __lay.setSpacing(0)
__lay.setContentsMargins(0, 0, 0, 0) __lay.setContentsMargins(0, 0, 0, 0)
__lay.addLayout(wordfilter) __lay.addLayout(wordfilter)
@ -1066,10 +1062,6 @@ class showdiction(QWidget):
class showwordfastwebview(auto_select_webview): class showwordfastwebview(auto_select_webview):
def __init__(self, parent, dyna=False):
super().__init__(parent, dyna)
def _createwebview(self): def _createwebview(self):
web = super()._createwebview() web = super()._createwebview()
if isinstance(web, WebivewWidget): if isinstance(web, WebivewWidget):
@ -1147,6 +1139,7 @@ class searchwordW(closeashidewindow):
self.hasclicked = True self.hasclicked = True
def tabclicked(self, idx): def tabclicked(self, idx):
self.tab.setCurrentIndex(idx)
self.hasclicked = True self.hasclicked = True
try: try:
html = self.cache_results[self.tabks[idx]] html = self.cache_results[self.tabks[idx]]
@ -1189,8 +1182,7 @@ class searchwordW(closeashidewindow):
self.thisps = {} self.thisps = {}
self.hasclicked = False self.hasclicked = False
ww = QWidget(self) ww = QWidget(self)
self.vboxlayout = QVBoxLayout() self.vboxlayout = QVBoxLayout(ww)
ww.setLayout(self.vboxlayout)
self.searchlayout = QHBoxLayout() self.searchlayout = QHBoxLayout()
self.vboxlayout.addLayout(self.searchlayout) self.vboxlayout.addLayout(self.searchlayout)
self.searchtext = FQLineEdit() self.searchtext = FQLineEdit()
@ -1285,14 +1277,12 @@ class searchwordW(closeashidewindow):
self.cache_results = {} self.cache_results = {}
self.spliter = QSplitter() self.spliter = QSplitter()
w = QWidget()
tablayout = QVBoxLayout() tablayout = QVBoxLayout(w)
tablayout.setContentsMargins(0, 0, 0, 0) tablayout.setContentsMargins(0, 0, 0, 0)
tablayout.setSpacing(0) tablayout.setSpacing(0)
tablayout.addWidget(self.tab) tablayout.addWidget(self.tab)
tablayout.addWidget(self.textOutput) tablayout.addWidget(self.textOutput)
w = QWidget()
w.setLayout(tablayout)
self.vboxlayout.addWidget(self.spliter) self.vboxlayout.addWidget(self.spliter)
self.isfirstshowanki = True self.isfirstshowanki = True
self.isfirstshowdictwidget = True self.isfirstshowdictwidget = True

View File

@ -489,9 +489,8 @@ class shownumQPushButton(QPushButton):
class shrinkableitem(QWidget): class shrinkableitem(QWidget):
def __init__(self, p, shrinker: shownumQPushButton, opened): def __init__(self, p, shrinker: shownumQPushButton, opened):
super().__init__(p) super().__init__(p)
self.lay = QVBoxLayout() self.lay = QVBoxLayout(self)
# self.setSizePolicy(QSizePolicy.Policy.Expanding,QSizePolicy.Policy.Fixed) # self.setSizePolicy(QSizePolicy.Policy.Expanding,QSizePolicy.Policy.Fixed)
self.setLayout(self.lay)
self.lay.setContentsMargins(0, 0, 0, 0) self.lay.setContentsMargins(0, 0, 0, 0)
self.lay.setSpacing(0) self.lay.setSpacing(0)
self.btn = shrinker self.btn = shrinker
@ -587,18 +586,16 @@ class stackedlist(ScrollArea):
internal = QWidget() internal = QWidget()
internal.setObjectName("shit") internal.setObjectName("shit")
self.setWidget(internal) self.setWidget(internal)
self.lay = QVBoxLayout() self.setWidgetResizable(True)
self.lay = QVBoxLayout(internal)
self.lay.setAlignment(Qt.AlignmentFlag.AlignTop) self.lay.setAlignment(Qt.AlignmentFlag.AlignTop)
self.lay.setSpacing(0) self.lay.setSpacing(0)
self.lay.setContentsMargins(0, 0, 0, 0) self.lay.setContentsMargins(0, 0, 0, 0)
internal.setLayout(self.lay)
self.widgets = [] self.widgets = []
self.fakegeos = [] self.fakegeos = []
self._spacing = 6 self._spacing = 6
self._margin = self._spacing # 9 self._margin = self._spacing # 9
self.lock = threading.Lock() self.lock = threading.Lock()
self.setWidgetResizable(True)
self.setWidget(internal)
self.internal = internal self.internal = internal
self.scrolled.connect(lambda _: self.doshowlazywidget(True, _)) self.scrolled.connect(lambda _: self.doshowlazywidget(True, _))
self.saveregion = QRect() self.saveregion = QRect()

View File

@ -97,21 +97,20 @@ class ButtonBar(QFrame):
def __init__(self, *argc): def __init__(self, *argc):
super().__init__(*argc) super().__init__(*argc)
def __(p=None): def __(p=None, pp=None):
_ = QHBoxLayout() _ = QHBoxLayout(pp)
_.setContentsMargins(0, 0, 0, 0) _.setContentsMargins(0, 0, 0, 0)
_.setSpacing(0) _.setSpacing(0)
if p is not None: if p is not None:
p.addLayout(_) p.addLayout(_)
return _ return _
self.threelayout = __() self.threelayout = __(pp=self)
self._left = __(self.threelayout) self._left = __(self.threelayout)
self.threelayout.addStretch() self.threelayout.addStretch()
self._center = __(self.threelayout) self._center = __(self.threelayout)
self.threelayout.addStretch() self.threelayout.addStretch()
self._right = __(self.threelayout) self._right = __(self.threelayout)
self.setLayout(self.threelayout)
self.cntbtn = 0 self.cntbtn = 0
self.buttons = {} self.buttons = {}
self.stylebuttons = {} self.stylebuttons = {}
@ -893,8 +892,7 @@ class TranslatorWindow(resizableframeless):
_self.setWindowTitle("打开链接") _self.setWindowTitle("打开链接")
l = QLabel(makehtml(_link, show=_link)) l = QLabel(makehtml(_link, show=_link))
l.setOpenExternalLinks(True) l.setOpenExternalLinks(True)
la = QHBoxLayout() la = QHBoxLayout(_self)
_self.setLayout(la)
la.addWidget(l) la.addWidget(l)
_self.exec() _self.exec()

View File

@ -253,8 +253,7 @@ class TableViewW(QTableView):
if w is None: if w is None:
return return
__w = QWidget() __w = QWidget()
__l = QHBoxLayout() __l = QHBoxLayout(__w)
__w.setLayout(__l)
__l.setContentsMargins(0, 0, 0, 0) __l.setContentsMargins(0, 0, 0, 0)
__l.addWidget(w) __l.addWidget(w)
super().setIndexWidget(index, __w) super().setIndexWidget(index, __w)
@ -1067,7 +1066,8 @@ def selectcolor(
def getboxlayout( def getboxlayout(
widgets, lc=QHBoxLayout, margin0=False, makewidget=False, delay=False, both=False widgets, lc=QHBoxLayout, margin0=False, makewidget=False, delay=False, both=False
): ):
cp_layout = lc() w = QWidget() if makewidget else None
cp_layout = lc(w)
def __do(cp_layout, widgets): def __do(cp_layout, widgets):
for w in widgets: for w in widgets:
@ -1085,9 +1085,6 @@ def getboxlayout(
cp_layout.setContentsMargins(0, 0, 0, 0) cp_layout.setContentsMargins(0, 0, 0, 0)
if not delay: if not delay:
_do() _do()
if makewidget:
w = QWidget()
w.setLayout(cp_layout)
if delay: if delay:
return w, _do return w, _do
if both: if both:
@ -1563,9 +1560,8 @@ class auto_select_webview(QWidget):
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding) self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
self.internal = None self.internal = None
self.saveurl = None self.saveurl = None
layout = QHBoxLayout() layout = QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
self.internalsavedzoom = 1 self.internalsavedzoom = 1
self._maybecreate_internal() self._maybecreate_internal()
if dyna: if dyna:
@ -1671,9 +1667,8 @@ class threebuttons(QWidget):
def __init__(self, texts=None): def __init__(self, texts=None):
super().__init__() super().__init__()
layout = QHBoxLayout() layout = QHBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0) layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
if len(texts) >= 1: if len(texts) >= 1:
button = LPushButton(self) button = LPushButton(self)
button.setText(texts[0]) button.setText(texts[0])
@ -1704,8 +1699,7 @@ class threebuttons(QWidget):
def tabadd_lazy(tab, title, getrealwidgetfunction): def tabadd_lazy(tab, title, getrealwidgetfunction):
q = QWidget() q = QWidget()
v = QVBoxLayout() v = QVBoxLayout(q)
q.setLayout(v)
v.setContentsMargins(0, 0, 0, 0) v.setContentsMargins(0, 0, 0, 0)
q.lazyfunction = functools.partial(getrealwidgetfunction, v) q.lazyfunction = functools.partial(getrealwidgetfunction, v)
tab.addTab(q, title) tab.addTab(q, title)
@ -1774,14 +1768,12 @@ def makegroupingrid(args):
group.setObjectName("notitle") group.setObjectName("notitle")
if _type == "grid": if _type == "grid":
grid = QGridLayout() grid = QGridLayout(group)
group.setLayout(grid)
automakegrid(grid, lis) automakegrid(grid, lis)
if internallayoutname: if internallayoutname:
setattr(parent, internallayoutname, grid) setattr(parent, internallayoutname, grid)
elif _type == "form": elif _type == "form":
lay = LFormLayout() lay = LFormLayout(group)
group.setLayout(lay)
makeforms(lay, lis) makeforms(lay, lis)
if internallayoutname: if internallayoutname:
setattr(parent, internallayoutname, lay) setattr(parent, internallayoutname, lay)
@ -1861,9 +1853,8 @@ def makegrid(grid=None, save=False, savelist=None, savelay=None, delay=False):
pass pass
gridlayoutwidget = gridwidget() gridlayoutwidget = gridwidget()
gridlay = QGridLayout() gridlay = QGridLayout(gridlayoutwidget)
gridlay.setAlignment(Qt.AlignmentFlag.AlignTop) gridlay.setAlignment(Qt.AlignmentFlag.AlignTop)
gridlayoutwidget.setLayout(gridlay)
gridlayoutwidget.setStyleSheet("gridwidget{background-color:transparent;}") gridlayoutwidget.setStyleSheet("gridwidget{background-color:transparent;}")
def do(gridlay, grid, save, savelist, savelay): def do(gridlay, grid, save, savelist, savelay):
@ -2021,8 +2012,7 @@ class listediter(LDialog):
table.customContextMenuRequested.connect(self.showmenu) table.customContextMenuRequested.connect(self.showmenu)
self.hctable = table self.hctable = table
self.internalrealname = [] self.internalrealname = []
formLayout = QVBoxLayout() formLayout = QVBoxLayout(self)
self.setLayout(formLayout)
formLayout.addWidget(self.hctable) formLayout.addWidget(self.hctable)
for row, k in enumerate(lst): # 2 for row, k in enumerate(lst): # 2
try: try:
@ -2191,10 +2181,9 @@ class listediterline(QWidget):
self.edit = ClickableLine() self.edit = ClickableLine()
self.reflist = reflist self.reflist = reflist
self.setText("|".join(reflist)) self.setText("|".join(reflist))
hbox = QHBoxLayout() hbox = QHBoxLayout(self)
hbox.setContentsMargins(0, 0, 0, 0) hbox.setContentsMargins(0, 0, 0, 0)
hbox.addWidget(self.edit) hbox.addWidget(self.edit)
self.setLayout(hbox)
callback = functools.partial( callback = functools.partial(
listediter, listediter,
self, self,
@ -2640,7 +2629,6 @@ class CollapsibleBox(QGroupBox):
lay = QVBoxLayout(self) lay = QVBoxLayout(self)
if margin0: if margin0:
lay.setContentsMargins(0, 0, 0, 0) lay.setContentsMargins(0, 0, 0, 0)
self.setLayout(lay)
self.func = delayloadfunction self.func = delayloadfunction
self.toggle(False) self.toggle(False)
@ -2712,8 +2700,7 @@ class editswitchTextBrowser(QWidget):
) )
stack.addWidget(self.browser) stack.addWidget(self.browser)
stack.addWidget(self.edit) stack.addWidget(self.edit)
l = QHBoxLayout() l = QHBoxLayout(self)
self.setLayout(l)
l.setContentsMargins(0, 0, 0, 0) l.setContentsMargins(0, 0, 0, 0)
l.addWidget(stack) l.addWidget(stack)
self.switch = statusbutton( self.switch = statusbutton(

View File

@ -235,10 +235,9 @@ class bgmsettings(QFormLayout):
self.lbinfo = QLabel() self.lbinfo = QLabel()
s.textChanged.connect(self.checkvalid) s.textChanged.connect(self.checkvalid)
s.setText(_ref.config["access-token"]) s.setText(_ref.config["access-token"])
fl2 = QFormLayout()
fl2.setContentsMargins(0, 0, 0, 0)
ww = QWidget() ww = QWidget()
ww.setLayout(fl2) fl2 = QFormLayout(ww)
fl2.setContentsMargins(0, 0, 0, 0)
ww.hide() ww.hide()
self.fl2 = ww self.fl2 = ww
self.showhide.connect(self.fl2.setVisible) self.showhide.connect(self.fl2.setVisible)

View File

@ -292,10 +292,9 @@ class vndbsettings(QFormLayout):
self.lbinfo = QLabel() self.lbinfo = QLabel()
s.textChanged.connect(self.checkvalid) s.textChanged.connect(self.checkvalid)
s.setText(_ref.config["Token"]) s.setText(_ref.config["Token"])
fl2 = QFormLayout()
fl2.setContentsMargins(0, 0, 0, 0)
ww = QWidget() ww = QWidget()
ww.setLayout(fl2) fl2 = QFormLayout(ww)
fl2.setContentsMargins(0, 0, 0, 0)
ww.hide() ww.hide()
self.fl2 = ww self.fl2 = ww
self.showhide.connect(self.fl2.setVisible) self.showhide.connect(self.fl2.setVisible)

View File

@ -143,9 +143,8 @@ def doinstall(self, allsupports: list, parent, callback):
def question(): def question():
dialog = QWidget() dialog = QWidget()
formLayout = LFormLayout() formLayout = LFormLayout(dialog)
formLayout.setContentsMargins(0, 0, 0, 0) formLayout.setContentsMargins(0, 0, 0, 0)
dialog.setLayout(formLayout)
supportlang = LLabel() supportlang = LLabel()
supportlang.setWordWrap(True) supportlang.setWordWrap(True)
formLayout.addRow("当前支持的语言", supportlang) formLayout.addRow("当前支持的语言", supportlang)

View File

@ -67,9 +67,8 @@ def installx(combo: _SuperCombo, btninstall, supportlang):
def question(): def question():
dialog = QWidget() dialog = QWidget()
formLayout = LFormLayout() formLayout = LFormLayout(dialog)
formLayout.setContentsMargins(0, 0, 0, 0) formLayout.setContentsMargins(0, 0, 0, 0)
dialog.setLayout(formLayout)
supportlang = QLabel() supportlang = QLabel()
supportlang.setText(", ".join([_[1] for _ in winrtutils.getlanguagelist()])) supportlang.setText(", ".join([_[1] for _ in winrtutils.getlanguagelist()]))
supportlang.setWordWrap(True) supportlang.setWordWrap(True)