Fix #355 add python 2.4 support in systemtray too

This commit is contained in:
Andrew Resch 2008-07-18 02:15:01 +00:00
parent 65ccd2d7c1
commit 0add52506b

View File

@ -336,7 +336,11 @@ class SystemTray(component.Component):
self.build_tray_bwsetsubmenu() self.build_tray_bwsetsubmenu()
def unlock_tray(self, is_showing_dlg=[False]): def unlock_tray(self, is_showing_dlg=[False]):
import hashlib try:
from hashlib import sha1 as sha_hash
except ImportError:
from sha import new as sha_hash
log.debug("Show tray lock dialog") log.debug("Show tray lock dialog")
result = False result = False
@ -363,7 +367,7 @@ window, please enter your password"))
tray_lock.vbox.pack_start(entered_pass) tray_lock.vbox.pack_start(entered_pass)
tray_lock.show_all() tray_lock.show_all()
if tray_lock.run() == gtk.RESPONSE_ACCEPT: if tray_lock.run() == gtk.RESPONSE_ACCEPT:
if self.config["tray_password"] == hashlib.sha1(\ if self.config["tray_password"] == sha_hash(\
entered_pass.get_text()).hexdigest(): entered_pass.get_text()).hexdigest():
result = True result = True
tray_lock.destroy() tray_lock.destroy()