Commit 9831a526 authored by sumpfralle's avatar sumpfralle

fixed log message dialog for messages containing "<>" characters

fixed potentially NotImplemented Queue function for MacOS


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@986 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent a5107bd1
...@@ -116,6 +116,10 @@ class GTKHandler(logging.Handler): ...@@ -116,6 +116,10 @@ class GTKHandler(logging.Handler):
except (UnicodeDecodeError, LookupError): except (UnicodeDecodeError, LookupError):
# remove all critical characters # remove all critical characters
message = re.sub("[^\w\s]", "", raw_message) message = re.sub("[^\w\s]", "", raw_message)
# Replace all "<>" characters (invalid for markup styles) with html
# entities.
message = re.sub("<", "&lt;", message)
message = re.sub(">", "&gt;", message)
import gtk import gtk
if record.levelno <= 20: if record.levelno <= 20:
message_type = gtk.MESSAGE_INFO message_type = gtk.MESSAGE_INFO
......
...@@ -131,8 +131,12 @@ def get_task_statistics(): ...@@ -131,8 +131,12 @@ def get_task_statistics():
global __manager global __manager
result = {} result = {}
if not __manager is None: if not __manager is None:
result["tasks"] = __manager.tasks().qsize() try:
result["results"] = __manager.results().qsize() result["tasks"] = __manager.tasks().qsize()
result["results"] = __manager.results().qsize()
except NotImplementedError:
# this can happen on MacOS (see multiprocessing doc)
pass
result["pending"] = __manager.pending_tasks().length() result["pending"] = __manager.pending_tasks().length()
result["cache"] = __manager.cache().length() result["cache"] = __manager.cache().length()
return result return result
...@@ -595,7 +599,12 @@ def run_in_parallel_remote(func, args_list, unordered=False, ...@@ -595,7 +599,12 @@ def run_in_parallel_remote(func, args_list, unordered=False,
def _cleanup_job(job_id, tasks_queue, pending_tasks, finished_jobs): def _cleanup_job(job_id, tasks_queue, pending_tasks, finished_jobs):
# flush the task queue # flush the task queue
queue_len = tasks_queue.qsize() try:
queue_len = tasks_queue.qsize()
except NotImplementedError:
# this can happen on MacOS (according to the multiprocessing doc)
# -> no cleanup of old processes
queue_len = 0
# remove all remaining tasks with the current job id # remove all remaining tasks with the current job id
removed_job_counter = 0 removed_job_counter = 0
for index in range(queue_len): for index in range(queue_len):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment