Example #1
0
File: misc.py Project: erikos/sugar
def _downgrade_option_alert(bundle):
    alert = ConfirmationAlert()
    alert.props.title = _("Older Version Of %s Activity") % (bundle.get_name())
    alert.props.msg = _("Do you want to downgrade to version %s") % bundle.get_activity_version()
    alert.connect("response", _downgrade_alert_response_cb, bundle)
    journalwindow.get_journal_window().add_alert(alert)
    alert.show()
    def _new_game_alert(self, button):
        ''' We warn the user if the game is in progress before loading
        a new game. '''
        if self.collab.props.leader is not None and not self.collab.props.leader:
            # joiner cannot push buttons
            self._restoring = True
            self._no_action(button)
            self._restoring = False
            return

        if len(self._gnuchess.move_list) == 0:
            self._take_button_action(button)
            return

        self._restoring = True
        alert = ConfirmationAlert()
        alert.props.title = _('Game in progress.')
        alert.props.msg = _('Do you want to start a new game?')

        def _new_game_alert_response_cb(alert, response_id, self, button):
            if response_id is Gtk.ResponseType.OK:
                self._take_button_action(button)
            elif response_id is Gtk.ResponseType.CANCEL:
                self._no_action(button)
            self._restoring = False
            self.remove_alert(alert)

        alert.connect('response', _new_game_alert_response_cb, self, button)
        self.add_alert(alert)
        alert.show()
Example #3
0
File: misc.py Project: edudev/sugar
def _downgrade_option_alert(bundle, metadata):
    alert = ConfirmationAlert()
    alert.props.title = _('Older Version Of %s Activity') % (bundle.get_name())
    alert.props.msg = _('Do you want to downgrade to version %s') % \
        bundle.get_activity_version()
    alert.connect('response', _downgrade_alert_response_cb, metadata)
    journalwindow.get_journal_window().add_alert(alert)
    alert.show()
Example #4
0
def _downgrade_option_alert(bundle, metadata):
    alert = ConfirmationAlert()
    alert.props.title = _('Older Version Of %s Activity') % (bundle.get_name())
    alert.props.msg = _('Do you want to downgrade to version %s') % \
        bundle.get_activity_version()
    alert.connect('response', _downgrade_alert_response_cb, metadata)
    journalwindow.get_journal_window().add_alert(alert)
    alert.show()
Example #5
0
 def show_msg(self, text, title=""):
     """show_msg(text) shows text in a drop-down alert message.
     """
     alert = ConfirmationAlert()
     alert.props.title = title
     alert.props.msg = text
     alert.connect('response', self.alert_cb)
     self.add_alert(alert)
     alert.show()
Example #6
0
 def show_msg(self, text, title=""):
     """show_msg(text) shows text in a drop-down alert message.
     """
     alert = ConfirmationAlert()
     alert.props.title = title
     alert.props.msg = text
     alert.connect('response', self.alert_cb)
     self.add_alert(alert)
     alert.show()
Example #7
0
 def __bookmarker_toggled_cb(self, button):
     page = self._view.get_current_page()
     if self._bookmarker.props.active:
         self._bookmark_view.add_bookmark(page)
     else:
         alert = ConfirmationAlert()
         alert.props.title = _('Delete bookmark')
         alert.props.msg = _('All the information related '
                             'with this bookmark will be lost')
         self.add_alert(alert)
         alert.connect('response', self.__alert_response_cb, page)
         alert.show()
Example #8
0
    def _title_changed_event_cb(self, widget):
        old_title = self._metadata.get('title', None)
        new_title = self._title.get_text()
        if old_title != new_title:
            if new_title == '' or new_title.isspace():
                alert = ConfirmationAlert()
                alert.props.title = _('Empty title')
                alert.props.msg = _('The title is usually not left empty')
                alert.connect('response', self._title_alert_response_cb,
                              old_title,
                              self._metadata.get('title_set_by_user', 0))
                journalwindow.get_journal_window().add_alert(alert)
                alert.show()

            self._update_entry()
Example #9
0
    def _save_colors_cb(self, button=None):
        ''' Save the new XO colors. '''
        ''' We warn the user if they are going to save their selection '''
        alert = ConfirmationAlert()
        alert.props.title = _('Saving colors')
        alert.props.msg = _('Do you want to save these colors?')
	def _change_colors_alert_response_cb(alert, response_id, self):
		if response_id is Gtk.ResponseType.OK:
			_logger.debug('saving colors')
			self.remove_alert(alert)
			self._confirm_save()
		elif response_id is Gtk.ResponseType.CANCEL:
			_logger.debug('cancel save')
			self.remove_alert(alert)
	alert.connect('response', _change_colors_alert_response_cb, self)
	self.add_alert(alert)
	alert.show()
Example #10
0
    def __cell_title_edited_cb(self, cell, path, new_text):
        iterator = self._model.get_iter(path)
        old_text = self._model[iterator][ListModel.COLUMN_TITLE]

        if old_text != new_text and (new_text == '' or new_text.isspace()):
            alert = ConfirmationAlert()
            alert.props.title = _('Empty title')
            alert.props.msg = _('The title is usually not left empty')
            alert.connect('response', self._cell_title_alert_response_cb, path,
                          new_text)
            journalwindow.get_journal_window().add_alert(alert)
            alert.show()
            return

        if old_text != new_text:
            self._model[iterator][ListModel.COLUMN_TITLE] = new_text
            self.emit('title-edit-finished', new_text, path)
    def _save_colors_cb(self, button=None):
        ''' Save the new XO colors. '''
        ''' We warn the user if they are going to save their selection '''
        alert = ConfirmationAlert()
        alert.props.title = _('Saving colors')
        alert.props.msg = _('Do you want to save these colors?')

        def _change_colors_alert_response_cb(alert, response_id, self):
            if response_id is Gtk.ResponseType.OK:
                _logger.debug('saving colors')
                self.remove_alert(alert)
                self._confirm_save()
            elif response_id is Gtk.ResponseType.CANCEL:
                _logger.debug('cancel save')
                self.remove_alert(alert)

        alert.connect('response', _change_colors_alert_response_cb, self)
        self.add_alert(alert)
        alert.show()