Changeset 1146:6b16627388a5
- Timestamp:
- 04/29/08 12:21:58 (2 months ago)
- Author:
- Ronny Pfannschmidt <Ronny.Pfannschmidt@…>
- Message:
-
removed unused features from actions
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1140
|
r1146
|
|
| 132 | 132 | act = atype(name=name, label=label, tooltip=tooltip, stock_id=stock_id) |
| 133 | 133 | self._actions.add_action(act) |
| 134 | | if callback is None: |
| 135 | | callback = getattr(self, 'act_%s' % name, None) |
| 136 | 134 | if callback is not None: |
| 137 | 135 | act.connect('activate', callback) |
| 138 | | |
| 139 | | if accel == 'NOACCEL': |
| 140 | | warnings.warn('the accel `NOACCEL` is deprecated, use None', |
| 141 | | DeprecationWarning, 2) |
| 142 | | |
| 143 | | if accel != 'NOACCEL' and accel is not None: |
| | 136 | |
| | 137 | if accel is not None: |
| 144 | 138 | self._create_key_option(act, name, label, tooltip, accel) |
| 145 | 139 | |
-
|
r108
|
r1146
|
|
| 10 | 10 | |
| 11 | 11 | def create_actions(self): |
| 12 | | self.create_action('banana', TYPE_NORMAL, 'do a banana', 'bananatt', gtk.STOCK_OPEN) |
| 13 | | self.create_action('banana2', TYPE_NORMAL, 'do a banana', 'bananatt', gtk.STOCK_OPEN, |
| | 12 | self.create_action('banana', TYPE_NORMAL, 'do a banana', 'bananatt', gtk.STOCK_OPEN, |
| 14 | 13 | self.my_handler) |
| 15 | | |
| 16 | | def act_banana(self, action): |
| 17 | | self.svc.banana = True |
| 18 | 14 | |
| 19 | 15 | def my_handler(self, action): |
| … |
… |
|
| 41 | 37 | |
| 42 | 38 | def test_label(self): |
| 43 | | self.assertEqual(self._acts.get_action('banana').get_property('label'), 'do a banana') |
| | 39 | self.assertEqual(self._act.get_property('label'), 'do a banana') |
| 44 | 40 | |
| 45 | 41 | def test_tt(self): |
| 46 | | self.assertEqual(self._acts.get_action('banana').get_property('tooltip'), 'bananatt') |
| | 42 | self.assertEqual(self._act.get_property('tooltip'), 'bananatt') |
| 47 | 43 | |
| 48 | 44 | def test_sid(self): |
| 49 | | self.assertEqual(self._acts.get_action('banana').get_property('stock_id'), gtk.STOCK_OPEN) |
| | 45 | self.assertEqual(self._act.get_property('stock_id'), gtk.STOCK_OPEN) |
| 50 | 46 | |
| 51 | 47 | def test_action_callback(self): |
| 52 | 48 | self.assertEqual(self.banana, False) |
| 53 | | self._acts._actions.get_action('banana2').activate() |
| | 49 | self._act.activate() |
| 54 | 50 | refresh_gui() |
| 55 | 51 | self.assertEqual(self.banana, True) |