get_app_class = _null_get_app_class
-def _hildon_set_application_title(window, title):
- pass
+def _hildon_set_application_title(title):
+ gtk.set_application_name(title)
-def _null_set_application_title(window, title):
- window.set_title(title)
+def _null_set_application_title(title):
+ pass
if IS_HILDON_SUPPORTED:
self._storePath = storePath
self._cachePath = cachePath
- def get_surface_from_store(self, image):
- path = os.path.join(self._storePath, image)
+ def get_surface_from_store(self, imageName):
+ path = os.path.join(self._storePath, imageName)
image = cairo.ImageSurface.create_from_png(path)
return image
- def get_image_from_store(self, image):
- path = os.path.join(self._storePath, image)
+ def get_image_from_store(self, imageName):
+ path = os.path.join(self._storePath, imageName)
image = gtk.Image()
image.set_from_file(path)
return image
- def get_pixbuf_from_store(self, image):
- path = os.path.join(self._storePath, image)
+ def set_image_from_store(self, image, imageName):
+ path = os.path.join(self._storePath, imageName)
+ image.set_from_file(path)
+ return image
+
+ def get_pixbuf_from_store(self, imageName):
+ path = os.path.join(self._storePath, imageName)
return gtk.gdk.pixbuf_new_from_file(path)
- def get_pixbuf_animation_from_store(self, image):
- path = os.path.join(self._storePath, image)
+ def get_pixbuf_animation_from_store(self, imageName):
+ path = os.path.join(self._storePath, imageName)
return gtk.gdk.PixbufAnimation(path)
def run():
- if hildonize.IS_HILDON_SUPPORTED:
- gtk.set_application_name(constants.__pretty_app_name__)
+ hildonize.set_application_title(constants.__pretty_app_name__)
app = MormonChannelProgram()
if not PROFILE_STARTUP:
gtk.main()
backHeight - self._buttonImage.get_height() + 5,
)
cairoContext.paint()
+
+
+class StreamMiniPresenter(object):
+
+ def __init__(self, player, store):
+ self._store = store
+ self._player = player
+ self._player.connect("state-change", self._on_player_state_change)
+
+ self._button = gtk.Image()
+ if self._player.state == "play":
+ self._store.set_image_from_store(self._button, self._store.STORE_LOOKUP["play"])
+ else:
+ self._store.set_image_from_store(self._button, self._store.STORE_LOOKUP["pause"])
+
+ self._eventBox = gtk.EventBox()
+ self._eventBox.add(self._button)
+ self._eventBox.connect("button_release_event", self._on_button_release)
+
+ @property
+ def toplevel(self):
+ return self._eventBox
+
+ @misc_utils.log_exception(_moduleLogger)
+ def _on_player_state_change(self, player, newState):
+ if self._player.state == "play":
+ self._store.set_image_from_store(self._button, self._store.STORE_LOOKUP["play"])
+ else:
+ self._store.set_image_from_store(self._button, self._store.STORE_LOOKUP["pause"])
+
+ @misc_utils.log_exception(_moduleLogger)
+ def _on_button_release(self, widget, event):
+ if self._player.state == "play":
+ self._player.pause()
+ else:
+ self._player.play()
import constants
import hildonize
-import gtk_toolbox
import util.misc as misc_utils
import banners
import playcontrol
+import presenter
_moduleLogger = logging.getLogger(__name__)
self._window.add(self._layout)
self._window = hildonize.hildonize_window(self, self._window)
- hildonize.set_application_title(self._window, "%s" % constants.__pretty_app_name__)
self._window.set_icon(self._store.get_pixbuf_from_store(self._store.STORE_LOOKUP["icon"]))
self._window.connect("key-press-event", self._on_key_press)
self._window.connect("window-state-event", self._on_window_state_change)
self._layout.pack_start(self._buttonLayout, True, True)
self._layout.pack_start(self._playcontrol.toplevel, False, True)
+ self._window.set_title(constants.__pretty_app_name__)
self._window.show_all()
self._errorBanner.toplevel.hide()
self._playcontrol.toplevel.hide()
headerPath = self._store.STORE_LOOKUP["radio_header"]
self._header = self._store.get_image_from_store(headerPath)
- self._radioLayout = gtk.VBox(True, 5)
- self._radioLayout.set_property("border-width", 5)
+ self._treeView = gtk.TreeView()
+
+ self._presenter = presenter.StreamMiniPresenter(self._player, self._store)
+
+ self._radioLayout = gtk.VBox(False)
self._radioLayout.pack_start(self._header, False, False)
+ self._radioLayout.pack_start(self._treeView, True, True)
+ self._radioLayout.pack_start(self._presenter.toplevel, False, True)
self._layout.pack_start(self._loadingBanner.toplevel, False, False)
self._layout.pack_start(self._radioLayout, True, True)
+ self._window.set_title("Radio")
self._window.show_all()
self._errorBanner.toplevel.hide()
self._loadingBanner.toplevel.hide()