Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
MDANSE
Commits
c990b09b
Commit
c990b09b
authored
Nov 18, 2016
by
eric pellegrini
Browse files
implemented a write method so as ConsoleHandler behaves as a file-like object
parent
1b436c73
Changes
1
Hide whitespace changes
Inline
Side-by-side
MDANSE/GUI/Handlers/ConsoleHandler.py
View file @
c990b09b
...
...
@@ -82,6 +82,10 @@ class ConsoleHandler(IHandler, logging.Handler):
@type record: logging.LogRecord
"""
record
.
msg
=
record
.
msg
.
strip
()
if
not
record
.
msg
:
return
self
.
style
.
SetTextColour
(
ConsoleHandler
.
COLORS
.
get
(
record
.
levelname
,
wx
.
BLACK
))
# Set the the created text attribute as the default style for the text ctrl.
...
...
@@ -91,5 +95,11 @@ class ConsoleHandler(IHandler, logging.Handler):
self
.
_window
.
AppendText
(
self
.
format
(
record
))
self
.
_window
.
AppendText
(
"
\n
"
)
def
write
(
self
,
message
):
record
=
logging
.
LogRecord
(
"console"
,
logging
.
INFO
,
None
,
None
,
message
,
None
,
None
,
None
)
self
.
emit
(
record
)
REGISTRY
[
"console"
]
=
ConsoleHandler
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment