actionview.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. '''
  2. Goblinoid: Experience all of MediaGoblin on an Android Device
  3. Copyright (C) 2015 Dylan Jeffers
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. '''
  15. from __future__ import print_function
  16. from kivy.app import App
  17. from kivy.properties import ObjectProperty, StringProperty
  18. from kivy.lang import Builder
  19. from kivy.uix.screenmanager import ScreenManager, Screen, SlideTransition
  20. from kivy.uix.anchorlayout import AnchorLayout
  21. from kivy.uix.actionbar import ActionBar
  22. Builder.load_file('actionview.kv')
  23. class OptionsBar(AnchorLayout):
  24. pressed = StringProperty()
  25. def on_pressed(self, instance, value):
  26. pass
  27. class GoblinBar(ActionBar):
  28. pass
  29. class ActionLayout(Screen):
  30. asm = ObjectProperty(ScreenManager())
  31. options_bar = ObjectProperty()
  32. def __init__(self, **kwargs):
  33. super(ActionLayout, self).__init__(**kwargs)
  34. self.transition = SlideTransition(duration=.35)
  35. self.asm.transition = self.transition
  36. # note: currently using pump model, but will eventually have its
  37. # own model
  38. self.asm.pump_model = App.get_running_app().pump_model
  39. self.open_action_view('feed', False)
  40. def open_action_view(self, name, previous):
  41. print('got to open_view: {0}, {1}'.format(name, previous))
  42. if self.asm.has_screen(name):
  43. self.asm.remove_widget(self.asm.get_screen(name))
  44. # grabs screen from dictionary of screens
  45. screen = self.asm.pump_model.screen_dict[name](name=name)
  46. self.asm.add_widget(screen)
  47. if previous:
  48. self.transition.direction = 'right'
  49. else:
  50. self.transition.direction = 'left'
  51. self.asm.current = screen.name
  52. class SettingsScreen(Screen):
  53. pass