Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 302810 Details for
Bug 442958
add preupgrade notification
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
check for preupgrades
pirut-preupgrade.patch (text/plain), 3.95 KB, created by
Colin Walters
on 2008-04-17 21:01:34 UTC
(
hide
)
Description:
check for preupgrades
Filename:
MIME Type:
Creator:
Colin Walters
Created:
2008-04-17 21:01:34 UTC
Size:
3.95 KB
patch
obsolete
>--- pirut-1.3.30/puplet.py 2008-02-04 15:26:45.000000000 -0500 >+++ pirut-1.3.30.hacked/puplet.py 2008-04-17 16:54:36.000000000 -0400 >@@ -34,10 +34,14 @@ > import dbus > import dbus.glib > >+import preupgrade >+ > from pirut import * > > GLADE_FILE = "puplet.glade" > >+MAJOR_UPGRADE_REMINDER_TIME_SECS = 2*7*24*60*60 # Once per two weeks >+SEEN_MAJOR_UPGRADE_TIME_KEY = "/apps/puplet/seen_major_upgrade_time" > ALWAYS_SHOW_KEY = "/apps/puplet/always_show" > LAST_UPDATE_CHECK_KEY = "/apps/puplet/last_update_check" > NUM_CHECK_FAILS_KEY = "/apps/puplet/num_check_failures" >@@ -59,6 +63,7 @@ > self.pupletMenu = self.menuxml.get_widget("pupletPopupMenu") > > self.trayicon = gtk.status_icon_new_from_file("/usr/share/pirut/pixmaps/puplet-updated.png") >+ self.preupgrade_trayicon = None > self._oldpix = None > self._oldtip = None > self._setUpdatedPixbuf() >@@ -78,6 +83,8 @@ > self.bus = dbus.SystemBus() > self.updatesObject = None > >+ gobject.timeout_add(5 * 1000, self._checkPreupgrade) >+ > if not pynotify.init("puplet"): > print >> sys.stderr, "Error: unable to initialize pynotify" > self.notify = None >@@ -172,6 +179,61 @@ > self.pupletMenu.popup(None, None, menu_pos, button, time) > self.pupletMenu.show() > >+ def _launchPreupgrade(self, *args, **kwargs): >+ print >>sys.stderr, "Launching preupgrade!" >+ subprocess.Popen(['preupgrade']) >+ >+ def _showPreupgradeNotify(self, upgrade_ver): >+ title = _("New release available") >+ text = _("A major upgrade is now available: %s") % (upgrade_ver,) >+ self.preupgrade_trayicon.set_tooltip(_("New release available")) >+ urgency = pynotify.URGENCY_NORMAL >+ notify = pynotify.Notification(title, text) >+ notify.add_action("preupgrade", _("Start upgrade..."), >+ self._launchPreupgrade) >+ notify.attach_to_status_icon(self.preupgrade_trayicon) >+ notify.set_urgency(pynotify.URGENCY_NORMAL) >+ notify.set_timeout(0) >+ notify.show() >+ >+ def _showPreupgradeTrayIcon(self): >+ if self.preupgrade_trayicon is not None: >+ return >+ self.preupgrade_trayicon = gtk.status_icon_new_from_stock(gtk.STOCK_REFRESH) >+ self.preupgrade_trayicon.set_visible(True) >+ self.preupgrade_trayicon.connect("popup_menu", self._preupgradeTrayClicked) >+ self.preupgrade_trayicon.connect("activate", self._preupgradeTrayClicked) >+ >+ def _preupgradeTrayClicked(self, *args): >+ def menu_pos(menu): >+ return gtk.status_icon_position_menu(menu, self.preupgrade_trayicon) >+ menu = gtk.Menu() >+ upgrade = gtk.MenuItem(_('Upgrade')) >+ upgrade.connect('activate', self._launchPreupgrade) >+ menu.append(upgrade) >+ menu.show_all() >+ menu.popup(None, None, menu_pos, 0, gtk.get_current_event_time()) >+ >+ def _checkPreupgrade(self): >+ try: >+ preup = preupgrade.PreUpgrade() >+ kwargs = {} >+ if '--eat-my-computer' in sys.argv: >+ kwargs['stable'] = False >+ upgrade_ver = preup.upgrade_available(**kwargs) >+ print >>sys.stderr, "Preupgrade version: %r" % (upgrade_ver,) >+ if not upgrade_ver: >+ return >+ curtime = time.time() >+ major_time = self.client.get_int(SEEN_MAJOR_UPGRADE_TIME_KEY) >+ if major_time == -1 or (curtime - major_time > MAJOR_UPGRADE_REMINDER_TIME_SECS): >+ self._showPreupgradeTrayIcon() >+ self.client.set_int(SEEN_MAJOR_UPGRADE_TIME_KEY, int(curtime)) >+ # Do this in an idle so notification daemon can find our icon >+ gobject.timeout_add(3000, self._showPreupgradeNotify, upgrade_ver) >+ except preupgrade.PUError, e: >+ return >+ > def _refreshInfo(self, *args): > self._setDownloadingPixbuf() > self.trayicon.set_tooltip(_("Retrieving update information"))
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 442958
: 302810