comparison cagou/core/xmlui.py @ 312:772c170b47a9

Python3 port: /!\ Cagou now runs with Python 3.6+ Port has been done in the same way as for backend (check backend commit b2d067339de3 message for details).
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:14:22 +0200
parents b2727877bad4
children 7a171d11eab6
comparison
equal deleted inserted replaced
311:a0d978d3ce84 312:772c170b47a9
314 if self.collide_point(*touch.pos): 314 if self.collide_point(*touch.pos):
315 parent = self.parent 315 parent = self.parent
316 while parent is not None and not isinstance(parent, AdvancedListContainer): 316 while parent is not None and not isinstance(parent, AdvancedListContainer):
317 parent = parent.parent 317 parent = parent.parent
318 if parent is None: 318 if parent is None:
319 log.error(u"Can't find parent AdvancedListContainer") 319 log.error("Can't find parent AdvancedListContainer")
320 else: 320 else:
321 if parent.selectable: 321 if parent.selectable:
322 self.selected = parent._xmluiToggleSelected(self) 322 self.selected = parent._xmluiToggleSelected(self)
323 323
324 return super(AdvancedListRow, self).on_touch_down(touch) 324 return super(AdvancedListRow, self).on_touch_down(touch)
351 else: 351 else:
352 return False 352 return False
353 353
354 def _xmluiAppend(self, widget): 354 def _xmluiAppend(self, widget):
355 if self._current_row is None: 355 if self._current_row is None:
356 log.error(u"No row set, ignoring append") 356 log.error("No row set, ignoring append")
357 return 357 return
358 self._current_row.add_widget(widget) 358 self._current_row.add_widget(widget)
359 359
360 def _xmluiAddRow(self, idx): 360 def _xmluiAddRow(self, idx):
361 self._current_row = AdvancedListRow() 361 self._current_row = AdvancedListRow()
587 if self.type == 'form': 587 if self.type == 'form':
588 submit_btn = SubmitButton() 588 submit_btn = SubmitButton()
589 submit_btn.bind(on_press=self.onFormSubmitted) 589 submit_btn.bind(on_press=self.onFormSubmitted)
590 self.layout.add_widget(submit_btn) 590 self.layout.add_widget(submit_btn)
591 if not 'NO_CANCEL' in self.flags: 591 if not 'NO_CANCEL' in self.flags:
592 cancel_btn = CancelButton(text=_(u"Cancel")) 592 cancel_btn = CancelButton(text=_("Cancel"))
593 cancel_btn.bind(on_press=self.onFormCancelled) 593 cancel_btn.bind(on_press=self.onFormCancelled)
594 self.layout.add_widget(cancel_btn) 594 self.layout.add_widget(cancel_btn)
595 elif self.type == 'param': 595 elif self.type == 'param':
596 self.save_btn = SaveButton(text=_(u"Save"), disabled=True) 596 self.save_btn = SaveButton(text=_("Save"), disabled=True)
597 self.save_btn.bind(on_press=self._saveButtonCb) 597 self.save_btn.bind(on_press=self._saveButtonCb)
598 self.layout.add_widget(self.save_btn) 598 self.layout.add_widget(self.save_btn)
599 elif self.type == 'window': 599 elif self.type == 'window':
600 cancel_btn = CancelButton(text=_(u"Cancel")) 600 cancel_btn = CancelButton(text=_("Cancel"))
601 cancel_btn.bind( 601 cancel_btn.bind(
602 on_press=partial(self._xmluiClose, reason=C.XMLUI_DATA_CANCELLED)) 602 on_press=partial(self._xmluiClose, reason=C.XMLUI_DATA_CANCELLED))
603 self.layout.add_widget(cancel_btn) 603 self.layout.add_widget(cancel_btn)
604 604
605 def onHeight(self, __, height): 605 def onHeight(self, __, height):