~mblayman/entertainer/clean-up-1.0

« back to all changes in this revision

Viewing changes to src/frontend/gui/widgets/menu.py

  • Committer: Paul Hummer
  • Date: 2008-06-21 06:10:59 UTC
  • mto: This revision was merged to the branch mainline in revision 256.
  • Revision ID: paul@ubuntu.com-20080621061059-a55dg8p5hlr0k1jr
Moves many files and directories

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2009 Entertainer Developers - See COPYING - GPLv2
2
1
'''Menu has a list of menuitems and it allows user to select one of them'''
3
2
 
 
3
__licence__ = "GPLv2"
 
4
__copyright__ = "2007, Lauri Taimila"
 
5
__author__ = "Lauri Taimila <lauri@taimila.com>"
 
6
 
4
7
import clutter
 
8
from frontend.gui.widgets.arrow_texture import ArrowTexture
5
9
 
6
10
class Menu(clutter.Group):
7
11
    """
60
64
            self.__item_width = menuitem.get_width()
61
65
            self.__item_height = menuitem.get_height()
62
66
 
 
67
        menuitem.show()
63
68
        menuitem.set_position(0, len(self.__items) * menuitem.get_height())
64
69
        self.__items.append(menuitem)
65
70
        clutter.Group.add(self, menuitem)
113
118
            bg.set_position(0, index * self.__item_height)
114
119
            bg.set_opacity(128)
115
120
            bg.set_name("background")
 
121
            bg.show()
116
122
            clutter.Group.add(self, bg)
117
123
            for item in self.__items:
118
124
                clutter.Group.lower(self, bg, item)
124
130
        @param selector: Selector texture (Clutter.Actor)
125
131
        """
126
132
        selector.set_position(0, 0)
127
 
        x_scale = self.__item_width / float(selector.get_width())
 
133
        selector.set_size(self.get_width(), self.__item_height)
 
134
        height = selector.get_height()
 
135
        x_scale = self.get_width() / float(selector.get_width())
128
136
        y_scale = self.__item_height / float(selector.get_height())
129
 
        selector.set_size(self.__item_width, self.__item_height)
130
137
        selector.set_scale(x_scale, y_scale)
131
138
        selector.set_name("selector")
132
139
        self.__selector = selector
188
195
        """
189
196
        # Set current menuitem
190
197
        self.__items[self.__current].set_active(False)
 
198
        #FIXME: What if there is not that many?
191
199
        self.__current = self.__current + 8
192
200
        self.__items[self.__current].set_active(True)
193
201
 
216
224
                          self.__item_height * self.__page_zize)
217
225
            self.set_height(self.__item_height * self.__page_zize)
218
226
 
219
 
    def get_current_position(self):
 
227
    def get_current_postition(self):
220
228
        """
221
229
        Get current position of the list. This position is under selector.
222
230
        """
249
257
        @return name as String
250
258
        """
251
259
        return self.__name
252