[26336] in Source-Commits
/svn/athena r25525 - in trunk/athena/bin/bugme: . debian
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue May 29 21:20:11 2012
Date: Tue, 29 May 2012 21:20:09 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201205300120.q4U1K9Ng011980@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: jdreed
Date: 2012-05-29 21:20:09 -0400 (Tue, 29 May 2012)
New Revision: 25525
Modified:
trunk/athena/bin/bugme/bugme
trunk/athena/bin/bugme/debian/changelog
Log:
In bugme:
* Add a feature which forces a logout after a 1.5x the "allowed"
duration (Trac: #830 and #831). Patch from Luke Faraone.
* Allow speciyfing Glade file on command line for debugging
* Minor UI tweaks
Modified: trunk/athena/bin/bugme/bugme
===================================================================
--- trunk/athena/bin/bugme/bugme 2012-05-30 00:27:58 UTC (rev 25524)
+++ trunk/athena/bin/bugme/bugme 2012-05-30 01:20:09 UTC (rev 25525)
@@ -8,8 +8,6 @@
import sys
from optparse import OptionParser
-gladeFile = "/usr/share/bugme/bugme.glade"
-
class BugMe:
def __init__(self):
# Time limit in seconds (600)
@@ -20,15 +18,18 @@
self.warnInterval = 60
# How often to warn after time has expired (secs)
self.annoyInterval = 30
+ # Hard time limit; user will be killed after this time
+ self.killTime = self.timeLimit * 1.5
if options.debugMode:
self.timeLimit = 120
self.firstWarn = 90
self.warnInterval = 30
self.annoyInterval = 10
+ self.killTime = 180
# (foreground, background)
self.colors = ('black', 'white')
try:
- self.xml = gtk.glade.XML(gladeFile)
+ self.xml = gtk.glade.XML(options.gladeFile)
except:
print "Failed to create GladeXML object."
# Kill the child
@@ -73,6 +74,11 @@
self.nextWarn = now + self.warnInterval
self.nag(((self.timeLimit - elapsed) / 60,
(self.timeLimit - elapsed) % 60))
+ if options.killMode and elapsed >= self.killTime:
+ # The user has outstayed their welcome, nuke their session
+ print "Quitting."
+ sys.exit(0)
+
# It's a little odd to put this here, but it doesn't work in
# __init__; see comments in Trac #386
self.timerWindow.set_keep_above(True)
@@ -80,7 +86,10 @@
def nag(self, remainingTime):
if self.timeExpired:
- self.nagLabel.set_markup("<span font_desc=\"20\">Please log out immediately.</span>")
+ msg="Please log out immediately."
+ if options.killMode:
+ msg += "\n\nYour session will be terminated in %d seconds." % (self.killTime - (int(time.time()) - self.startTime))
+ self.nagLabel.set_markup("<span font_desc=\"20\">"+msg+"</span>")
else:
seconds = "%d second%s" % (remainingTime[1],
remainingTime[1] != 1 and 's' or '')
@@ -92,7 +101,7 @@
remaining = minutes
else:
remaining = "%s, %s" % (minutes, seconds)
- self.nagLabel.set_markup("<span font_desc=\"20\">You have %s remaining\nin your login session.</span>" % (remaining))
+ self.nagLabel.set_markup("<span font_desc=\"20\">You have %s remaining\nin this session.</span>" % (remaining))
self.nagDialog.show()
@@ -106,17 +115,23 @@
if __name__ == '__main__':
- if not os.access(gladeFile, os.R_OK):
- print 'error: Unable to read glade file "' + gladeFile + '"'
- sys.exit(255)
-
parser = OptionParser(usage="%prog [--debug] progname [args]",
version="%prog 0.1")
parser.disable_interspersed_args()
parser.add_option("--debug",
action="store_true", dest="debugMode", default=False,
help="Enable debug mode (time limit of 2 minutes)")
+ parser.add_option("--fatal",
+ action="store_true", dest="killMode", default=False,
+ help="Kill the user session after 1.5 times the time limit.")
+ parser.add_option("--glade", action="store", type="string",
+ dest="gladeFile",
+ default="/usr/share/bugme/bugme.glade",
+ help="Specify an alternate Glade file for debugging")
(options, args) = parser.parse_args()
+ if not os.access(options.gladeFile, os.R_OK):
+ print 'error: Unable to read glade file "' + gladeFile + '"'
+ sys.exit(255)
if len(args) < 1:
parser.error("'progname' is required")
pid = os.fork()
Modified: trunk/athena/bin/bugme/debian/changelog
===================================================================
--- trunk/athena/bin/bugme/debian/changelog 2012-05-30 00:27:58 UTC (rev 25524)
+++ trunk/athena/bin/bugme/debian/changelog 2012-05-30 01:20:09 UTC (rev 25525)
@@ -1,10 +1,17 @@
debathena-bugme (10.0.4-0debathena1) unstable; urgency=low
+ [ Geoffrey Thomas ]
* Set always-on-top window manager hint (Trac: #386). Patch from Luke
Faraone.
- -- Geoffrey Thomas <geofft@mit.edu> Fri, 06 Jan 2012 15:37:46 -0500
+ [ Jonathan Reed ]
+ * Add a feature which forces a logout after a 1.5x the "allowed"
+ duration (Trac: #830 and #831). Patch from Luke Faraone.
+ * Allow speciyfing Glade file on command line for debugging
+ * Minor UI tweaks
+ -- Jonathan Reed <jdreed@mit.edu> Tue, 29 May 2012 21:20:01 -0400
+
debathena-bugme (10.0.3-0debathena1) unstable; urgency=low
* Don't run dpkg-query (Trac: #778)