diff options
author | Florent Pigout <florent.pigout@gmail.com> | 2011-11-07 17:00:38 (GMT) |
---|---|---|
committer | Florent Pigout <florent.pigout@gmail.com> | 2011-11-07 17:00:38 (GMT) |
commit | bd433404502c16294240108bc8e3875cd51d458d (patch) | |
tree | 74b52b94793c664897c13fcc48b6e0973e4352aa /atoidejouer/ui/screen/splash.py | |
parent | 10b8c497e502ff1d346b8235eeee1207ad78b329 (diff) |
do some refactoring `screens` -> `screen`
Diffstat (limited to 'atoidejouer/ui/screen/splash.py')
-rw-r--r-- | atoidejouer/ui/screen/splash.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/atoidejouer/ui/screen/splash.py b/atoidejouer/ui/screen/splash.py new file mode 100644 index 0000000..a822b74 --- /dev/null +++ b/atoidejouer/ui/screen/splash.py @@ -0,0 +1,72 @@ +# python import +import logging +# .. +from functools import partial +# .. +from gettext import gettext as _ + +# gtk import +import gtk + +# graphics import +from lib import graphics + +# atoidejouer import +from atoidejouer.tools import image, storage + +# get application logger +logger = logging.getLogger('atoidejouer') + + +class Splash(graphics.Scene): + + def __init__(self, toolbar): + # .. + graphics.Scene.__init__(self) + # .. + # self.background_color = "#ffffff" + # .. + self.__current = 0 + # toolbar keep + self.toolbar = toolbar + # .. + self._image = None + # .. + if self.toolbar is None: + self._screen_height = None + self._screen_width = None + else: + # keep some info + self._screen_height = gtk.gdk.screen_height() + self._screen_width = gtk.gdk.screen_width() + # .. + self._show() + + def _update_x_y(self, path): + # get file size + _c, _w, _h = image.get_image_info(path) + # update x + _x = ((self._screen_width - _w) / 2) + # update y + _y = ((self._screen_height - _h - 88) / 2) + # return it + return _x, _y + + def _get_image(self): + # get path + _path = storage.get_image_path('splash', dir_='data') + # .. + _x, _y = self._update_x_y(_path) + # image + return graphics.Image(_path, x=_x, y=_y, draggable=False) + + def _show(self): + # .. + self._image = self._get_image() + # do add + self.add_child(self._image) + # show + self.show() + # update toolbar + self.toolbar.activity.set_canvas(self) + |