def update(self, render=None): Active.update(self) Widget.update(self, render)
def update(self, render=None): Active.update(self) currentHowActiveMouse = None if self.isActive and self.isSelect: done = False for widgetList in self._widget: for child in widgetList: if isinstance(child, Active) and child.isSelect and child is not self._currentSelect: self._currentSelect = child done = True break if done: break if not self._currentSelect: done = False for widgetList in self._widget: for child in widgetList: if isinstance(child, Active): self._currentSelect = child done = True break if done: break self._deselectOtherWidget() if self.event and self._currentSelect: currentHowActiveMouse = self._currentSelect.howActiveMouse if not self._currentSelect.howSelect(): self._currentSelect.howActiveMouse=[None] posCurrentSelect = self.getWidgetPosition(self._currentSelect) caseCurrentSelect = self.getWidgetCase(self._currentSelect) if not self.changeLeft in self._currentSelect.howActiveKeyboard and\ self.event.getOnePressedKeys(self.changeLeft): done = False for x in range(posCurrentSelect.x-1, -1, -1): for y in range(posCurrentSelect.y, len(self._widget[x])): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for y in range(0, posCurrentSelect.y): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break if not done: for x in range(len(self._widget)-1, posCurrentSelect.x, -1): for y in range(posCurrentSelect.y, len(self._widget[x])): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for y in range(0, posCurrentSelect.y): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break elif not self.changeRight in self._currentSelect.howActiveKeyboard and\ self.event.getOnePressedKeys(self.changeRight): done = False y = posCurrentSelect.y for x in range(posCurrentSelect.x + caseCurrentSelect.x, \ len(self._widget)): for y in range(posCurrentSelect.y, len(self._widget[x])): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for y in range(0, posCurrentSelect.y): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break if not done: for x in range(0, posCurrentSelect.x): for y in range(posCurrentSelect.y, len(self._widget[x])): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for y in range(0, posCurrentSelect.y): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break elif not self.changeTop in self._currentSelect.howActiveKeyboard and \ self.event.getOnePressedKeys(self.changeTop): done = False for y in range(posCurrentSelect.y-1, -1, -1): for x in range(posCurrentSelect.x, len(self._widget)): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for x in range(0, posCurrentSelect.x): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break if not done: for y in range(len(self._widget[0])-1, posCurrentSelect.y, -1): for x in range(posCurrentSelect.x, len(self._widget)): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for x in range(0, posCurrentSelect.x): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break elif not self.changeBottom in self._currentSelect.howActiveKeyboard and\ self.event.getOnePressedKeys(self.changeBottom): done = False x = posCurrentSelect.x for y in range(posCurrentSelect.y + caseCurrentSelect.y, \ len(self._widget[0])): for x in range(posCurrentSelect.x, len(self._widget)): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for x in range(0, posCurrentSelect.x): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break if not done: for y in range(0, posCurrentSelect.y): for x in range(posCurrentSelect.x, len(self._widget)): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break for x in range(0, posCurrentSelect.x): child = self.__getitem__(sf.Vector2(x, y)) if isinstance(child, Active) and child is not self._currentSelect: done = True self._currentSelect = child break if done: break self._deselectOtherWidget() else: if self._currentSelect: self._currentSelect.permanentSelection=False self._currentSelect.deselectIt() Layout.update(self, render) if self._currentSelect: self._currentSelect.howActiveMouse = currentHowActiveMouse