def alert(self, title=None, text=None, delay=5):
     alert = NotifyAlert(delay)
     alert.props.title = title
     alert.props.msg = text
     self.add_alert(alert)
     alert.connect('response', self._alert_ok)
     alert.show()
Example #2
0
 def _alert(self, title, text=None, timeout=5):
     alert = NotifyAlert(timeout=timeout)
     alert.props.title = title
     alert.props.msg = text
     self.add_alert(alert)
     alert.connect('response', self._alert_cancel_cb)
     alert.show()
Example #3
0
    def _download(self, widget, row, col):
        global match_dict
        model = widget.get_model()
        name = str(model[row][1]).replace("<b>", "").replace("</b>", "")
        _logger.debug(_("Started download of activity: %s") % name)
        self._alert = NotifyAlert()
        self._alert.props.msg = _("The activity %s begins to download") % name
        self._alert.props.title = _("Download begins")
        self._activity.add_alert(self._alert)
        self._alert.connect('response',
                            lambda x, i: self._activity.remove_alert(x))
        # add to download
        self.download_list.add_download(name)
        self.download_list.di[self.download_list.pos] = name
        activity_id = -1
        for n in match_dict:
            if match_dict[n] == name:
                activity_id = n
                break
        row = self.download_list.pos

        def launch():
            utils.download_activity(int(activity_id), row,
                                    self.download_list.set_download_progress)

        if not (activity_id) == -1:
            t = threading.Timer(0, launch)
            t.start()
        self.download_list.pos = self.download_list.pos + 1
        return True
Example #4
0
 def _alert(self, title, text=None):
     from sugar.graphics.alert import NotifyAlert
     alert = NotifyAlert(timeout=5)
     alert.props.title = title
     alert.props.msg = text
     self.add_alert(alert)
     alert.connect('response', self._alert_cancel_cb)
     alert.show()
Example #5
0
 def alert(self, title, text=None):
     """ Alert popup
     """
     alert = NotifyAlert(timeout=10)
     alert.props.title = title
     alert.props.msg = text
     self._activity.add_alert(alert)
     alert.connect('response', self.alert_cancel_cb)
     alert.show()
    def notify_alert(self, title, msg):
        """Raise standard notify alert"""
        alert = NotifyAlert(title=title, msg=msg)

        def response(alert, response_id, self):
            self.remove_alert(alert)

        alert.connect('response', response, self)
        alert.show_all()
        self.add_alert(alert)
Example #7
0
    def _load_button_cb(self, widget):

        chooser = ObjectChooser(parent=self)
        result = chooser.run()
        if result == gtk.RESPONSE_ACCEPT:
            try:
                jobject = chooser.get_selected_object()
                _file_path = str(jobject.get_file_path())
                self.read_file(_file_path)
                alerta = NotifyAlert(10)
                alerta.props.title = _('Good!')
                alerta.props.msg = _('Book loaded')
                alerta.connect('response', lambda w, i: self.remove_alert(w))
                self.add_alert(alerta)
            except IOError:
                alerta = NotifyAlert(10)
                alerta.props.title = 'Error'
                alerta.props.msg = _('Error in load book')
                alerta.connect('response', lambda w, i: self.remove_alert(w))
                self.add_alert(alerta)
        else:
            return
Example #8
0
 def alert(self, title, text=None):
     '''Show an alert above the activity.'''
     try:
         alert = NotifyAlert(timeout=10)
     except NameError:
         logging.warning(
             'sugar.graphics.alert.NotifyAlert not present for %r, %r',
             title, text)
         return
     alert.props.title = title
     alert.props.msg = text
     self.add_alert(alert)
     alert.connect('response', self.__alert_cancel_cb)
     alert.show()