Beispiel #1
0
 def AutoSetData(self):
     ok = True
     for field in self.Widget.INTERNAL:
         if isinstance(field, BaseField):
             v = field.Validate(UI.Do(self.AutoGet[field.key]))
             if v is None:
                 ok = False
                 self.Widget[field.key] = None
             else:
                 self.Widget[field.key] = v
     return ok
Beispiel #2
0
 def OnMouse(self, evt):
     super().OnMouse(evt)
     evtType = evt.GetEventType()
     if evtType == wx.wxEVT_LEFT_DOWN:
         self.SetCursor(self.Item.__RES__["CURSOR"])
     elif evtType == wx.wxEVT_LEFT_UP:
         UI.Do(self.todo)
         if self.pointing:
             self.pointing.Play("LEAVE")
         self.todo = None
         self.pointing = None
         self.SetCursor(self.R["CURSOR_NORMAL"])
     elif evtType == wx.wxEVT_MOTION and self.leftDown:
         pos = self.ClientToScreen(evt.GetPosition())
         if self.Main.Groups[self.group]["PANEL"].GetScreenRect().Contains(
                 pos):
             if self.Main.Groups[
                     self.group]["DEL"].GetScreenRect().Contains(pos):
                 self.todo = (wx.CallAfter, self.Main.DelItem, self, True)
                 pointing = self.Main.Groups[self.group]["DEL"]
             else:
                 W, H = self.Main.Groups[self.group]["PANEL"].GetSize()
                 C, R = W // 108, H // 36
                 x, y = self.Main.Groups[
                     self.group]["PANEL"].ScreenToClient(pos)
                 c, r = max(min(x // 108, C), 0), max(min(y // 36, R), 0)
                 index = r * C + c
                 if index != self.currentIndex:
                     self.GetParent().GetSizer().Detach(self)
                     self.Main.AddItem(self, max(0, index), True)
                 self.todo = None
                 pointing = self.Main.Groups[self.group]["TITLE"]
         elif self.Main.Groups[
                 self.group]["TITLE"].GetScreenRect().Contains(pos):
             self.todo = None
             pointing = self.Main.Groups[self.group]["TITLE"]
         else:
             for group in self.Main.Groups:
                 if group != self.group:
                     if self.Main.Groups[group]["TITLE"].GetScreenRect(
                     ).Contains(pos):
                         self.todo = None
                         pointing = self.Main.Groups[group]["TITLE"]
                         self.ChangeGroup(group)
                         break
                     if self.Main.Groups[group]["PANEL"].GetScreenRect(
                     ).Contains(pos):
                         self.todo = None
                         pointing = self.Main.Groups[group]["TITLE"]
                         self.ChangeGroup(group)
                         break
             else:
                 if self.Main["NEW"].GetScreenRect().Contains(pos):
                     self.todo = self.ChangeGroup
                     pointing = self.Main["NEW"]
                 else:
                     self.todo = None
                     pointing = None
         if pointing != self.pointing:
             if pointing:
                 pointing.Play("ENTER")
             if self.pointing:
                 self.pointing.Play("LEAVE")
             self.pointing = pointing