2n2u

Untitled

Apr 10th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.56 KB | None | 0 0
  1. class ShowLicense(MDLabel):
  2.     def __init__(self, **kwargs):
  3.         super(ShowLicense, self).__init__(**kwargs)
  4.         self.id = 'license'
  5.         self.font_style = 'Body1'
  6.         self.theme_text_color = 'Secondary'
  7.         self.text = license
  8.         self.text_size = (self.width, None)
  9.         self.size_hint_y = None
  10.         self.valign = 'top'
  11.         self.halign = 'left'
  12.         self.height = self.texture_size[1]
  13.  
  14.  
  15. class DotsMenu(MDDropdownMenu):
  16.     def __init__(self, **kwargs):
  17.         super(DotsMenu, self).__init__(**kwargs)
  18.         Clock.schedule_once(self.my_init)
  19.  
  20.     def my_init(self, dt):
  21.         self.items = [
  22.             {'viewclass': 'MDFlatButton',
  23.              'text': 'Legal'},
  24.             {'viewclass': 'MDFlatButton',
  25.              'text': 'Licenses',
  26.              'on_release': lambda: self.show_licenses_dialog()},
  27.             {'viewclass': 'MDFlatButton',
  28.              'text': 'Settings',
  29.              'on_release': lambda: app.open_settings()}
  30.         ]
  31.         self.hor_growth = 'left'
  32.         self.ver_growth = 'down'
  33.         self.width_mult = 3
  34.  
  35.     def show_licenses_dialog(self):
  36.         content = ScrollView(id='test')
  37.         content.add_widget(ShowLicense())
  38.  
  39.         #content.bind(size=content.setter('text_size'))
  40.         self.dialog = MDDialog(title="License Information",
  41.                                theme_text_color='Custom',
  42.                                content=content,
  43.                                size_hint=(.8, .8),
  44.                                auto_dismiss=True)
  45.         self.dialog.open()
Advertisement
Add Comment
Please, Sign In to add comment