Example #1
0
 def previous_page_button(self, sender):
     m = self['label_current_page'].text
     if re.fullmatch(r'\d+', m):
         if 1 < int(m):
             self.url = add_querydict_to_url({'page': int(m) - 2}, self.url)
             self.refresh()
     else:
         a, b = re.fullmatch(r'(\d+)-(\d+)', m).groups()
         if 1 < int(a):
             self.url = add_querydict_to_url({'page': int(a) - 1}, self.url)
             self.refresh()
Example #2
0
 def next_page_button(self, sender):
     m = self['label_current_page'].text
     n = self['label_total_pages'].text
     if re.fullmatch(r'\d+', m):
         if int(m) < int(n):
             self.url = add_querydict_to_url({'page': int(m)}, self.url)
             self.refresh()
     else:
         a, b = re.fullmatch(r'(\d+)-(\d+)', m).groups()
         if int(b) < int(n):
             self.url = add_querydict_to_url({'page': int(b)}, self.url)
             self.refresh()
Example #3
0
 def jump_to_page_button(self, sender):
     n = self['label_total_pages'].text
     if n != '1':
         t = console.input_alert('输入页码(1-{})'.format(n))
         if re.fullmatch(r'\d+', t) and 1 <= int(t) <= int(n):
             self.url = add_querydict_to_url({'page': int(t) - 1}, self.url)
             self.refresh()
         else:
             console.hud_alert('输入不合法', 'error')