/usr/share/pyshared/gluon/messageboxhandler.py is in python-gluon 2.12.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import logging
import os
try:
import Tkinter
except:
Tkinter = None
class MessageBoxHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
if Tkinter:
msg = self.format(record)
root = Tkinter.Tk()
root.wm_title("web2py logger message")
text = Tkinter.Text()
text["height"] = 12
text.insert(0.1, msg)
text.pack()
button = Tkinter.Button(root, text="OK", command=root.destroy)
button.pack()
root.mainloop()
class NotifySendHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
if Tkinter:
msg = self.format(record)
os.system("notify-send '%s'" % msg)
|