Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/atoidejouer/ui/screen/splash.py
blob: 77cacc772c27f12b11e1d98b29a1936e833cdd6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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, activity):
        # ..
        graphics.Scene.__init__(self)
        # ..
        # self.background_color = "#ffffff"
        # ..
        self.__current = 0
        # activity keep
        self.activity = activity
        # ..
        self._image = None
        # ..
        if self.activity 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 activity
        self.activity.set_canvas(self)