Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. class LoadDialog(FloatLayout):
  2. load = ObjectProperty(None)
  3. cancel = ObjectProperty(None)
  4.  
  5. <LoadDialog>:
  6. BoxLayout:
  7. size: root.size
  8. pos: root.pos
  9. orientation: "vertical"
  10. FileChooserListView:
  11. id: filechooser
  12.  
  13. BoxLayout:
  14. size_hint_y: None
  15. height: 30
  16. Button:
  17. text: "Cancel"
  18. on_release: root.cancel()
  19.  
  20. Button:
  21. text: "Load"
  22. on_release: root.load(filechooser.path, filechooser.selection)
  23.  
  24. def show_load(self):
  25. content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
  26. self._popup = Popup(title="Load file", content=content,
  27. size_hint=(0.9, 0.9))
  28. self._popup.open()
  29.  
  30. def load(self, path, filename):
  31. wimg = os.path.join(path, filename[0])
  32. self.image_source = wimg
  33. self.dismiss_popup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement