This commit is contained in:
恍兮惚兮 2024-07-30 14:54:34 +08:00
parent e92d79e5b6
commit 23474a9348
2 changed files with 23 additions and 24 deletions

View File

@ -272,19 +272,22 @@ def setTab_update(self, basel):
grid2 = [ grid2 = [
[ [
"自动更新", "自动更新",
D_getsimpleswitch( (
globalconfig, "autoupdate", callback=versionchecktask.put D_getsimpleswitch(
globalconfig, "autoupdate", callback=versionchecktask.put
),
0,
), ),
], ],
[ [
"当前版本", "当前版本",
versionstring, versionstring,
], "",
[
"最新版本", "最新版本",
functools.partial(createversionlabel, self), functools.partial(createversionlabel, self),
"",
], ],
[functools.partial(createdownloadprogress, self)], [(functools.partial(createdownloadprogress, self), 0)],
] ]
shuominggrid = [ shuominggrid = [
@ -329,8 +332,8 @@ def setTab_update(self, basel):
[ [
( (
dict( dict(
Stretch=False,
grid=grid2, grid=grid2,
type="grid",
), ),
0, 0,
"group", "group",

View File

@ -1382,8 +1382,7 @@ def tabadd_lazy(tab, title, getrealwidgetfunction):
tab.addTab(q, title) tab.addTab(q, title)
def makeforms(lay: LFormLayout, lis, args): def makeforms(lay: LFormLayout, lis):
Stretch = args.get("Stretch", True)
for line in lis: for line in lis:
if len(line) == 0: if len(line) == 0:
lay.addRow(QLabel()) lay.addRow(QLabel())
@ -1395,17 +1394,17 @@ def makeforms(lay: LFormLayout, lis, args):
if isinstance(wid, (tuple, list)): if isinstance(wid, (tuple, list)):
hb = QHBoxLayout() hb = QHBoxLayout()
hb.setContentsMargins(0, 0, 0, 0) hb.setContentsMargins(0, 0, 0, 0)
if Stretch:
needstretch = False needstretch = False
for w in wid: for w in wid:
if callable(w): if callable(w):
w = w() w = w()
if w.sizePolicy().horizontalPolicy() == QSizePolicy.Policy.Fixed: if w.sizePolicy().horizontalPolicy() == QSizePolicy.Policy.Fixed:
needstretch = True needstretch = True
hb.addWidget(w) hb.addWidget(w)
if needstretch: if needstretch:
hb.insertStretch(0) hb.insertStretch(0)
hb.addStretch() hb.addStretch()
wid = hb wid = hb
else: else:
if callable(wid): if callable(wid):
@ -1413,10 +1412,7 @@ def makeforms(lay: LFormLayout, lis, args):
elif isinstance(wid, str): elif isinstance(wid, str):
wid = QLabel(wid) wid = QLabel(wid)
wid.setOpenExternalLinks(True) wid.setOpenExternalLinks(True)
if ( if wid.sizePolicy().horizontalPolicy() == QSizePolicy.Policy.Fixed:
Stretch
and wid.sizePolicy().horizontalPolicy() == QSizePolicy.Policy.Fixed
):
hb = QHBoxLayout() hb = QHBoxLayout()
hb.setContentsMargins(0, 0, 0, 0) hb.setContentsMargins(0, 0, 0, 0)
hb.addStretch() hb.addStretch()
@ -1460,7 +1456,7 @@ def makegroupingrid(args):
elif _type == "form": elif _type == "form":
lay = LFormLayout() lay = LFormLayout()
group.setLayout(lay) group.setLayout(lay)
makeforms(lay, lis, args) makeforms(lay, lis)
if internallayoutname: if internallayoutname:
setattr(parent, internallayoutname, lay) setattr(parent, internallayoutname, lay)
return group return group