def can_close(self): if self._force_close: return True elif downloadmanager.can_quit(): return True else: alert = Alert() alert.props.title = ngettext('Download in progress', 'Downloads in progress', downloadmanager.num_downloads()) message = ngettext('Stopping now will erase your download', 'Stopping now will erase your downloads', downloadmanager.num_downloads()) alert.props.msg = message cancel_icon = Icon(icon_name='dialog-cancel') cancel_label = ngettext('Continue download', 'Continue downloads', downloadmanager.num_downloads()) alert.add_button(Gtk.ResponseType.CANCEL, cancel_label, cancel_icon) stop_icon = Icon(icon_name='dialog-ok') alert.add_button(Gtk.ResponseType.OK, _('Stop'), stop_icon) stop_icon.show() self.add_alert(alert) alert.connect('response', self.__inprogress_response_cb) alert.show() self.present() return False
def __download_running_cb(self): progress = downloadmanager.overall_downloads_progress() self._download_icon.update(progress) if downloadmanager.num_downloads() > 0: self._download_icon.props.tooltip = \ _('{}% Downloaded').format(int(progress*100)) return True else: self._download_running_hid = None self._download_icon.props.tooltip = _('No Downloads Running') return False
def __download_running_cb(self): progress = downloadmanager.overall_downloads_progress() self._download_icon.update(progress) if downloadmanager.num_downloads() > 0: self._download_icon.props.tooltip = \ _('{}% Downloaded').format(int(progress*100)) self._download_icon.props.xo_color = XoColor(None) return True else: GLib.source_remove(self._download_running_hid) self._download_running_hid = None self._download_icon.props.tooltip = _('No Downloads Running') self._download_icon.props.xo_color = XoColor('insensitive') return False
def __download_running_cb(self): print('__DLR') progress = downloadmanager.overall_downloads_progress() self._download_icon.update(progress) if downloadmanager.num_downloads() > 0: self._download_icon.props.tooltip = \ _('{}% Downloaded').format(int(progress*100)) self._download_icon.props.xo_color = XoColor(None) return True else: GLib.source_remove(self._download_running_hid) self._download_running_hid = None self._download_icon.props.tooltip = _('No Downloads Running') self._download_icon.props.xo_color = XoColor('insensitive') return False