~fluendo-elisa/moovida/elisa-pancake

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/poblesec/widgets/player/button.py

  • Committer: pancake
  • Date: 2009-03-27 12:16:38 UTC
  • mfrom: (1115.2.37 elisa)
  • Revision ID: pancake@flubox-20090327121638-2da0c1a0zu3byufd
* Merge against the head

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
     - STATE_NORMAL
34
34
     - STATE_SELECTED
35
 
     - STATE_ACTIVE
 
35
     - STATE_PRESSED
36
36
 
37
37
    Button is by default in STATE_NORMAL. When hovering it it goes to
38
 
    STATE_SELECTED. When pressed it then goes to STATE_ACTIVE.
 
38
    STATE_SELECTED. When pressed it then goes to STATE_PRESSED.
39
39
 
40
40
    @ivar sticky: if True the button will stay in STATE_SELECTED state after the
41
41
                  mouse stopped hovering it, otherwise it will go to STATE_NORMAL
74
74
        self._backgrounds = {}
75
75
        self._add_background(STATE_NORMAL)
76
76
        self._add_background(STATE_SELECTED)
77
 
        self._add_background(STATE_ACTIVE)
 
77
        self._add_background(STATE_PRESSED)
78
78
 
79
79
        # dictionary of glyph images
80
80
        # key:   state
82
82
        self._glyphs = {}
83
83
        self._add_glyph(STATE_NORMAL)
84
84
        self._add_glyph(STATE_SELECTED)
85
 
        self._add_glyph(STATE_ACTIVE)
 
85
        self._add_glyph(STATE_PRESSED)
86
86
 
87
87
        # sticky mode: the button will stay selected when the mouse stops
88
88
        # hovering it
144
144
        @type normal:    str
145
145
        @param selected: image resource to be used for STATE_SELECTED state
146
146
        @type selected:  str
147
 
        @param active:   image resource to be used for STATE_ACTIVE state
 
147
        @param active:   image resource to be used for STATE_PRESSED state
148
148
        @type active:    str
149
149
        """
150
150
        theme = Theme.get_default()
156
156
        self._glyphs[STATE_SELECTED].set_from_file(selected_path)
157
157
 
158
158
        active_path = theme.get_resource(active)
159
 
        self._glyphs[STATE_ACTIVE].set_from_file(active_path)
 
159
        self._glyphs[STATE_PRESSED].set_from_file(active_path)
160
160
 
161
161
    def set_backgrounds(self, normal, selected, active):
162
162
        """
167
167
        @type normal:    str
168
168
        @param selected: image resource to be used for STATE_SELECTED state
169
169
        @type selected:  str
170
 
        @param active:   image resource to be used for STATE_ACTIVE state
 
170
        @param active:   image resource to be used for STATE_PRESSED state
171
171
        @type active:    str
172
172
        """
173
173
        theme = Theme.get_default()
179
179
        self._backgrounds[STATE_SELECTED].set_from_file(selected_path)
180
180
 
181
181
        active_path = theme.get_resource(active)
182
 
        self._backgrounds[STATE_ACTIVE].set_from_file(active_path)
 
182
        self._backgrounds[STATE_PRESSED].set_from_file(active_path)
183
183
 
184
184
    def do_state_changed(self, previous_state):
185
185
        # the state is changed once before the widget is fully initialised
197
197
 
198
198
    def do_pressed(self, x, y, z, button, time, pressure):
199
199
        self._pre_pressed_state = self.state
200
 
        self.state = STATE_ACTIVE
 
200
        self.state = STATE_PRESSED
201
201
        return True
202
202
 
203
203
    def do_clicked(self, x, y, z, button, time, pressure):