fixed tkMessageBox problem, thanks Bruno
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.4.1-alpha.2+timestamp.2013.01.21.08.35.19
|
Version 2.4.1-alpha.2+timestamp.2013.01.21.08.39.03
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tkMessageBox
|
import Tkinter
|
||||||
except:
|
except:
|
||||||
tkMessageBox = None
|
Tkinter = None
|
||||||
|
|
||||||
|
|
||||||
class MessageBoxHandler(logging.Handler):
|
class MessageBoxHandler(logging.Handler):
|
||||||
@@ -11,6 +12,24 @@ class MessageBoxHandler(logging.Handler):
|
|||||||
logging.Handler.__init__(self)
|
logging.Handler.__init__(self)
|
||||||
|
|
||||||
def emit(self, record):
|
def emit(self, record):
|
||||||
if tkMessageBox:
|
if Tkinter:
|
||||||
msg = self.format(record)
|
msg = self.format(record)
|
||||||
tkMessageBox.showinfo('info1', msg)
|
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)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ keys=root,rocket,markdown,web2py,rewrite,cron,app,welcome
|
|||||||
keys=consoleHandler,messageBoxHandler,rotatingFileHandler
|
keys=consoleHandler,messageBoxHandler,rotatingFileHandler
|
||||||
#keys=consoleHandler,rotatingFileHandler
|
#keys=consoleHandler,rotatingFileHandler
|
||||||
#keys=osxSysLogHandler
|
#keys=osxSysLogHandler
|
||||||
|
#keys=notifySendHandler
|
||||||
|
|
||||||
[formatters]
|
[formatters]
|
||||||
keys=simpleFormatter
|
keys=simpleFormatter
|
||||||
@@ -105,6 +106,12 @@ level=ERROR
|
|||||||
formatter=simpleFormatter
|
formatter=simpleFormatter
|
||||||
args=()
|
args=()
|
||||||
|
|
||||||
|
[handler_notifySendHandler]
|
||||||
|
class=gluon.messageboxhandler.NotifySendHandler
|
||||||
|
level=ERROR
|
||||||
|
formatter=simpleFormatter
|
||||||
|
args=()
|
||||||
|
|
||||||
# Rotating file handler
|
# Rotating file handler
|
||||||
# mkdir logs in the web2py base directory if not already present
|
# mkdir logs in the web2py base directory if not already present
|
||||||
# args: (filename[, mode[, maxBytes[, backupCount[, encoding[, delay]]]]])
|
# args: (filename[, mode[, maxBytes[, backupCount[, encoding[, delay]]]]])
|
||||||
|
|||||||
Reference in New Issue
Block a user