diff options
author | Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org> | 2012-12-17 22:26:40 (GMT) |
---|---|---|
committer | Ignacio Rodríguez <ignaciorodriguez@sugarlabs.org> | 2012-12-17 22:26:40 (GMT) |
commit | 54ae7773ec4c9daae6b89cf41a96f93f65c8d5b6 (patch) | |
tree | 52b58661f492cae6747b5d3d4cda39765e5ca1ac /AbacusActivity.py | |
parent | 9c3f4926d9075a3e4794be349ea008e1fc89c590 (diff) |
Work Finish.
Diffstat (limited to 'AbacusActivity.py')
-rw-r--r-- | AbacusActivity.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/AbacusActivity.py b/AbacusActivity.py index 181d825..ec1bece 100644 --- a/AbacusActivity.py +++ b/AbacusActivity.py @@ -331,23 +331,26 @@ class AbacusActivity(activity.Activity): self.alert = Alert() self.okicon = Icon(icon_name='dialog-ok') self.cancelicon = Icon(icon_name='dialog-cancel') - self.alert.add_button(Gtk.ResponseType.OK,_('Ok'),self.okicon) - self.alert.add_button(Gtk.ResponseType.CANCEL,_('Cancel'),self.cancelicon) + self.alert.add_button(Gtk.ResponseType.OK, _('Ok'), self.okicon) + self.alert.add_button(Gtk.ResponseType.CANCEL, _('Cancel'), self.cancelicon) + self.alert.props.msg = _('The current progress has delete') + self.alert.props.title = _('¿Sure?') + self.alert.connect('response', self._switch_modes, abacus) self.add_alert(self.alert) - # Give the alert time to load -# GObject.timeout_add(1000, self._switch_modes, abacus) - def _switch_modes(self, abacus, response=None): + def _switch_modes(self, widget, response, abacus): ''' Display the selected abacus ''' # Save current value value = int(float(self.abacus.mode.value())) - if abacus == 'custom': - self._custom_cb() - self.abacus.mode = self.abacus.custom - else: - self.abacus.select_abacus(abacus) - # Load saved value - if response == gtk.RESPONSE_OK: + # Remove alert + self.remove_alert(widget) + if response == Gtk.ResponseType.OK: + if abacus == 'custom': + self._custom_cb() + self.abacus.mode = self.abacus.custom + else: + self.abacus.select_abacus(abacus) + self._notify_new_abacus(NAMES[abacus]) self.abacus.mode.set_value_from_number(value) self.abacus.mode.label(self.abacus.generate_label()) |