[ TAG 553 ][25.09.2022] -Erfolgreich -IAP-20220403-20220403-1150

Während der Einarbeitung ist mir heute ein Fehler im [SysFNC]-Modul aufgefallen. Der Fehler ist mir aufgefallen, als ich die Kindelemente des jeweiligen [FRM]-Objektes aufrufen wollte und nur das [FRM]-Element bekommen habe. Dies konnte nicht stimmen.

Der Fehler lag in der Zeile:
  • Falsch: [ lst.append(STLKEY_ELMT(stl_key=stl_key)) ]
  • Richtig: [ lst.append(STLKEY_ELMT( stl_key=k )) ]

def GET_CHLD_ELMTS(stl_key, userstl):
lst = []
lvl = GET_ELMT_LVL(stl_key=stl_key)
chld_lvl = lvl + 1
elmts = GET_ELMTS_FROM_LVL(userstl=userstl, lvl=chld_lvl, event_elmt=False)
print(f"GET_CHLD_ELMTS elmts: {elmts}")
for k in elmts:
if stl_key in k and stl_key != k:
print(f"k: {k}")
lst.append(STLKEY_ELMT(stl_key=k))
return lst

stlkey_elmt: FRM
GET_CHLD_ELMTS elmts: 
[
'WND00-GRP00-FRM00-LBL00', 
'WND00-GRP00-FRM00-ENT00', 
'WND00-GRP01-FRM00-LBL00', 
'WND00-GRP01-FRM00-ENT00', 
'WND00-GRP01-FRM01-LBL00', 
'WND00-GRP01-FRM01-ENT00', 
'WND00-GRP01-FRM02-LBL00', 
'WND00-GRP01-FRM02-ENT00', 
'WND00-GRP02-FRM00-LBL00', 
'WND00-GRP02-FRM00-LBL01', 
'WND00-GRP02-FRM00-ENT00', 
'WND00-GRP02-FRM01-LBL00', 
'WND00-GRP02-FRM01-LBL01', 
'WND00-GRP02-FRM01-ENT00', 
'WND00-GRP02-FRM02-LBL00', 
'WND00-GRP02-FRM02-LBL01', 
'WND00-GRP02-FRM02-ENT00', 
'WND00-GRP02-FRM03-LBL00', 
'WND00-GRP02-FRM03-LBL01', 
'WND00-GRP02-FRM03-ENT00', 
'WND00-GRP02-FRM04-LBL00', 
'WND00-GRP02-FRM04-LBL01', 
'WND00-GRP02-FRM04-ENT00', 
'WND00-GRP02-FRM05-LBL00', 
'WND00-GRP02-FRM05-LBL01', 
'WND00-GRP02-FRM05-ENT00', 
'WND00-GRP02-FRM06-LBL00', 
'WND00-GRP02-FRM06-LBL01', 
'WND00-GRP02-FRM06-ENT00', 
'WND00-GRP02-FRM07-LBL00', 
'WND00-GRP02-FRM07-LBL01', 
'WND00-GRP02-FRM07-ENT00', 
'WND00-GRP02-FRM08-LBL00', 
'WND00-GRP02-FRM08-LBL01'
]
k: WND00-GRP02-FRM07-LBL00
k: WND00-GRP02-FRM07-LBL01
k: WND00-GRP02-FRM07-ENT00
lvl: 2
stl_key: WND00-GRP02-FRM07
chld_elmts: ['LBL', 'LBL', 'ENT']
chld: 
[
'WND00-GRP02-FRM07-LBL00', 
'WND00-GRP02-FRM07-LBL01', 
'WND00-GRP02-FRM07-ENT00'
]


-----------------------------------------------------------------

Heute beginne ich die Arbeit am [ GET_MIN_WH(stl_key, chld_lvl, ref_user) ]. Folgende Attribute werden der Methode übergeben.

  • GET_MIN_WH(...)
    • stl_key
    • chld_lvl
    • ref_user
Aus den jeweiligen GUI-Modulen (z.B. BTN, ENT, LBL) muss die [DEFV_LIB] importiert werden. Die [DEFV_LIB] enthält die Mindestwerte, die für die jeweiligen GUI-Module definiert wurden. Diese Mindestwerte dürfen nicht unterschritten werden.

Diese Methode muss überarbeitet werden bzw. fertig gestellt werden.

def GET_MIN_WH(stl_key, chld_lvl, ref_user):
print("GET_MIN_WH - Start")
print(f"chld_lvl: {chld_lvl}")

imp = __import__('GUIMODUL20220627.PAS_LIB.LVL3', fromlist=["LVL3"])

print(f"imp: {imp}")
print(f'{imp.__dict__["BTN"].DEFV_LIB}')
print(f"stlkey_elmt: {STLKEY_ELMT(stl_key=stl_key)}")

imp_elmt = {}
chld = GET_CHLD_STLKEYS(stl_key=stl_key, userstl=ref_user, event_elm=False)

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
lvl = GET_ELMT_LVL(stl_key=c)
if elmt not in imp_elmt:
tpl = {
f"{elmt}": {
f"{si_lvl}": lvl,
f"{si_defvlib}": None
}
}
imp_elmt.update(tpl)

for e in imp_elmt:
imp_e = imp_elmt[e]
elmt = e
lvl = imp_e[si_lvl]
l_ = f"LVL{lvl}"
i_ = f"GUIMODUL20220627.PAS_LIB.{l_}"
imp = __import__(i_, fromlist=[l_])
imp_e[si_defvlib] = imp.__dict__[elmt].DEFV_LIB

print(f"imp_elmt: {imp_elmt}")

print(f"lvl: {GET_ELMT_LVL(stl_key=stl_key)}")
print(f"stl_key: {stl_key}")
print(f"chld: {chld}")
print("GET_MIN_WH - Ende")

So sieht der Stand der Entwicklung zum [25.09.2022][1650].
def GET_MIN_WH(stl_key, ref_user):
imp_elmt = {}
wh = {f"{si_min_width}": 0, f"{si_min_height}": 0}
chld = GET_CHLD_STLKEYS(stl_key=stl_key, userstl=ref_user, event_elm=False)

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
lvl = GET_ELMT_LVL(stl_key=c)
if elmt not in imp_elmt:
tpl = {
f"{elmt}": {
f"{si_lvl}": lvl,
f"{si_defvlib}": None
}
}
imp_elmt.update(tpl)

for e in imp_elmt:
imp_e = imp_elmt[e]
elmt = e
lvl = imp_e[si_lvl]
l_ = f"LVL{lvl}"
i_ = f"GUIMODUL20220627.PAS_LIB.{l_}"
imp = __import__(i_, fromlist=[l_])
imp_e[si_defvlib] = imp.__dict__[elmt].DEFV_LIB

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
imp_e = imp_elmt[elmt]
defv_lib = imp_e[si_defvlib]
mw = defv_lib[si_min_width]
mh = defv_lib[si_min_height]
wh[si_min_height] += mh
wh[si_min_width] += mw

return wh


def GET_MIN_W(stl_key, ref_user):
imp_elmt = {}
mw = 0
chld = GET_CHLD_STLKEYS(stl_key=stl_key, userstl=ref_user, event_elm=False)

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
lvl = GET_ELMT_LVL(stl_key=c)
if elmt not in imp_elmt:
tpl = {
f"{elmt}": {
f"{si_lvl}": lvl,
f"{si_defvlib}": None
}
}
imp_elmt.update(tpl)

for e in imp_elmt:
imp_e = imp_elmt[e]
elmt = e
lvl = imp_e[si_lvl]
l_ = f"LVL{lvl}"
i_ = f"GUIMODUL20220627.PAS_LIB.{l_}"
imp = __import__(i_, fromlist=[l_])
imp_e[si_defvlib] = imp.__dict__[elmt].DEFV_LIB

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
imp_e = imp_elmt[elmt]
defv_lib = imp_e[si_defvlib]
mw += defv_lib[si_min_width]

return mw


def GET_MIN_H(stl_key, ref_user):
imp_elmt = {}
mh = 0
chld = GET_CHLD_STLKEYS(stl_key=stl_key, userstl=ref_user, event_elm=False)

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
lvl = GET_ELMT_LVL(stl_key=c)
if elmt not in imp_elmt:
tpl = {
f"{elmt}": {
f"{si_lvl}": lvl,
f"{si_defvlib}": None
}
}
imp_elmt.update(tpl)

for e in imp_elmt:
imp_e = imp_elmt[e]
elmt = e
lvl = imp_e[si_lvl]
l_ = f"LVL{lvl}"
i_ = f"GUIMODUL20220627.PAS_LIB.{l_}"
imp = __import__(i_, fromlist=[l_])
imp_e[si_defvlib] = imp.__dict__[elmt].DEFV_LIB

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
imp_e = imp_elmt[elmt]
defv_lib = imp_e[si_defvlib]
mh += defv_lib[si_min_height]

return mh

Das ist ihre Anwendung:
wh = GET_MIN_WH(stl_key=stl_key, ref_user=ref_user)
mw = GET_MIN_W(stl_key=stl_key, ref_user=ref_user)
mh = GET_MIN_H(stl_key=stl_key, ref_user=ref_user)

print(f"wh: {wh}")
print(f"mw: {mw}")
print(f"mh: {mh}")

Bei den GUI-Elementen der LVL2-Objekte muss man auch die Ausrichtung des Kindelemente berücksichtigen. Diese sind standardmäßig vertikal ausgerichtet.

Bisher habe ich bei den oben aufgelisteten Methoden die Ausrichtung nicht berücksichtigt. Die Ausrichtung beeinflusst jedoch die Struktur der letzten Schleife.
  • Zu diesem Zeitpunkt [25.09.2022][1712] werden die Werte der jeweiligen Dimensionen ganz einfach zusammen gezählt.
  • Wenn die Ausrichtung mit berücksichtigt werden muss, dann ändern sich die Umstände.
  • Horizontale-Ausrichtung
    • Mindesthöhe: Wird von den höchsten Elementen bestimmt
    • Mindestbreite: Summe aller Breiten
  • Vertikale-Ausrichtung
    • Mindesthöhe: Summe aller Höhen
    • Mindestbreite: Wird von den breitesten Elementen bestimmt
Dazu müssten sechs Methoden aktualisiert werden.
  • COUNT_CHLD_MWMH()
  • COUNT_CHLD_MWIDTH()
  • COUNT_CHLD_MHEIGHT()
  • GET_MIN_WH()
  • GET_MIN_W()
  • GET_MIN_H()

def COUNT_CHLD_MWMH(chld_elmts, ref_user, alg=None):
r_ = {
f"{si_width}": 0,
f"{si_height}": 0
}
for stl_key in chld_elmts:
userstl = ref_user[stl_key]
chldmw = userstl[si_chldmw]
chldmh = userstl[si_chldmh]

if alg is si_algH:
r_[si_width] += chldmw
if chldmh >= r_[si_height]:
r_[si_height] = chldmh
if alg is si_algV:
if chldmw >= r_[si_width]:
r_[si_width] = chldmw
r_[si_height] += chldmh
if alg is None:
r_[si_width] += chldmw
r_[si_height] += chldmh
return r_


def COUNT_CHLD_MWIDTH(chld_elmts, ref_user, alg=None):
mw_ = 0
for stl_key in chld_elmts:
userstl = ref_user[stl_key]
if alg is si_algH:
mw_ += userstl[si_chldmw]
if alg is si_algV:
if userstl[si_chldmw] >= mw_:
mw_ = userstl[si_chldmw]
if alg is None:
mw_ += userstl[si_chldmw]
return mw_


def COUNT_CHLD_MHEIGHT(chld_elmts, ref_user, alg=None):
mh_ = 0
for stl_key in chld_elmts:
userstl = ref_user[stl_key]
if alg is si_algH:
if userstl[si_chldmh] >= mh_:
mh_ = userstl[si_chldmh]
if alg is si_algV:
mh_ += userstl[si_chldmh]
if alg is None:
mh_ += userstl[si_chldmh]
return mh_


def GET_MIN_WH(stl_key, ref_user, alg=None):
imp_elmt = {}
wh = {f"{si_min_width}": 0, f"{si_min_height}": 0}
chld = GET_CHLD_STLKEYS(stl_key=stl_key, userstl=ref_user, event_elm=False)

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
lvl = GET_ELMT_LVL(stl_key=c)
if elmt not in imp_elmt:
tpl = {
f"{elmt}": {
f"{si_lvl}": lvl,
f"{si_defvlib}": None
}
}
imp_elmt.update(tpl)

for e in imp_elmt:
imp_e = imp_elmt[e]
elmt = e
lvl = imp_e[si_lvl]
l_ = f"LVL{lvl}"
i_ = f"GUIMODUL20220627.PAS_LIB.{l_}"
imp = __import__(i_, fromlist=[l_])
imp_e[si_defvlib] = imp.__dict__[elmt].DEFV_LIB

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
imp_e = imp_elmt[elmt]
defv_lib = imp_e[si_defvlib]
mw = defv_lib[si_min_width]
mh = defv_lib[si_min_height]

if alg is si_algH:
if defv_lib[si_min_height] >= wh[si_min_height]:
wh[si_min_height] = defv_lib[si_min_height]
wh[si_min_width] += defv_lib[si_min_width]
if alg is si_algV:
wh[si_min_height] += defv_lib[si_min_height]
if defv_lib[si_min_width] >= wh[si_min_width]:
wh[si_min_width] = defv_lib[si_min_width]
if alg is None:
wh[si_min_height] += mh
wh[si_min_width] += mw

return wh


def GET_MIN_W(stl_key, ref_user, alg=None):
imp_elmt = {}
mw = 0
chld = GET_CHLD_STLKEYS(stl_key=stl_key, userstl=ref_user, event_elm=False)

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
lvl = GET_ELMT_LVL(stl_key=c)
if elmt not in imp_elmt:
tpl = {
f"{elmt}": {
f"{si_lvl}": lvl,
f"{si_defvlib}": None
}
}
imp_elmt.update(tpl)

for e in imp_elmt:
imp_e = imp_elmt[e]
elmt = e
lvl = imp_e[si_lvl]
l_ = f"LVL{lvl}"
i_ = f"GUIMODUL20220627.PAS_LIB.{l_}"
imp = __import__(i_, fromlist=[l_])
imp_e[si_defvlib] = imp.__dict__[elmt].DEFV_LIB

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
imp_e = imp_elmt[elmt]
defv_lib = imp_e[si_defvlib]
if alg is si_algH:
mw += defv_lib[si_min_width]
if alg is si_algV:
if defv_lib[si_min_width] >= mw:
mw = defv_lib[si_min_width]
if alg is None:
mw += defv_lib[si_min_width]

return mw


def GET_MIN_H(stl_key, ref_user, alg=None):
imp_elmt = {}
mh = 0
chld = GET_CHLD_STLKEYS(stl_key=stl_key, userstl=ref_user, event_elm=False)

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
lvl = GET_ELMT_LVL(stl_key=c)
if elmt not in imp_elmt:
tpl = {
f"{elmt}": {
f"{si_lvl}": lvl,
f"{si_defvlib}": None
}
}
imp_elmt.update(tpl)

for e in imp_elmt:
imp_e = imp_elmt[e]
elmt = e
lvl = imp_e[si_lvl]
l_ = f"LVL{lvl}"
i_ = f"GUIMODUL20220627.PAS_LIB.{l_}"
imp = __import__(i_, fromlist=[l_])
imp_e[si_defvlib] = imp.__dict__[elmt].DEFV_LIB

for c in chld:
elmt = STLKEY_ELMT(stl_key=c)
imp_e = imp_elmt[elmt]
defv_lib = imp_e[si_defvlib]
if alg is si_algH:
if defv_lib[si_min_height] >= mh:
mh = defv_lib[si_min_height]
if alg is si_algV:
mh += defv_lib[si_min_height]
if alg is None:
mh += defv_lib[si_min_height]

return mh




 




Kommentare

Beliebte Posts aus diesem Blog

[ TAG 38 ][29.05.2021] - Erfolgreich - Freelancer-Portale

[ TAG 747 ][07.04.2023] -Erfolgreich -BNKTRS -Google Code -Objekt und Methodenliste

[ TAG 52 ][12.06.2021] - Erfolgreich - IAP-20210601-20210609-2325