Exemple #1
0
 def Config(self):
     self.Frame.SetStretchMaxWidth()
     self.Frame.SetStretchMaxHeight()
     self.Frame.Lay = gi.LayoutGrid
     self.Frame.Stripes = gi.RowStripes
     self.Frame.SetPropInt("columns", 2)
     updt = self.Frame.UpdateStart()
     self.Frame.SetFullReRender()
     self.Frame.DeleteChildren(True)
     flds = self.Class.__dict__
     self.Views = {}
     self.Widgets = {}
     for nm, val in flds.items():
         tags = self.FieldTags(nm)
         if HasTagValue(tags, "view",
                        "-") or nm == "Tags" or nm.startswith("ClassView"):
             continue
         lbl = gi.Label(self.Frame.AddNewChild(gi.KiT_Label(), "lbl_" + nm))
         lbl.SetText(nm)
         dsc = self.FieldTagVal(nm, "desc")
         if dsc != "":
             lbl.Tooltip = dsc
         if isinstance(val, go.GoClass):
             fnm = self.Name + ":" + nm
             vv = giv.ToValueView(val, tags)
             giv.SetSoloValueIface(vv, val)
             vw = self.Frame.AddNewChild(vv.WidgetType(), fnm)
             vv.ConfigWidget(vw)
             self.Views[nm] = vv
             self.Widgets[nm] = vw
             # todo: vv.ViewSig.Connect?
         else:
             vw = PyObjView(val, nm, self.Frame, self.Name, tags)
             self.Widgets[nm] = vw
     self.Frame.UpdateEnd(updt)
Exemple #2
0
 def Config(self):
     self.Lay = gi.Layout()
     self.Lay.InitName(self.Lay, self.Name)
     self.Lay.Lay = gi.LayoutHoriz
     self.Lay.SetStretchMaxWidth()
     updt = self.Lay.UpdateStart()
     flds = self.Class.__dict__
     self.Views = {}
     self.Widgets = {}
     for nm, val in flds.items():
         tags = self.FieldTags(nm)
         if HasTagValue(tags, "view",
                        "-") or nm == "Tags" or nm.startswith("ClassView"):
             continue
         lbl = gi.Label(self.Lay.AddNewChild(gi.KiT_Label(), "lbl_" + nm))
         lbl.Redrawable = True
         lbl.SetProp("horizontal-align", "left")
         lbl.SetText(nm)
         dsc = self.FieldTagVal(nm, "desc")
         if dsc != "":
             lbl.Tooltip = dsc
         if isinstance(val, go.GoClass):
             fnm = self.Name + ":" + nm
             vv = giv.ToValueView(val, tags)
             giv.SetSoloValueIface(vv, val)
             vw = self.Lay.AddNewChild(vv.WidgetType(), fnm)
             vv.ConfigWidget(vw)
             self.Views[nm] = vv
             self.Widgets[nm] = vw
             # todo: vv.ViewSig.Connect?
         else:
             vw = PyObjView(val, nm, self.Lay, self.Name, tags)
             self.Widgets[nm] = vw
     self.Lay.UpdateEnd(updt)
Exemple #3
0
 def Update(self):
     updt = self.Frame.UpdateStart()
     flds = self.Class.__dict__
     for nm, val in flds.items():
         if nm in self.Views:
             vv = self.Views[nm]
             giv.SetSoloValueIface(
                 vv, val)  # always update in case it might have changed
             vv.UpdateWidget()
         elif nm in self.Widgets:
             vw = self.Widgets[nm]
             PyObjUpdtView(val, vw, nm)
     self.Frame.UpdateEnd(updt)