Commit 8d9f4bce authored by sumpfralle's avatar sumpfralle

use Pango markup for GTK error log handler

added a link to the wiki (SupportedFormats) for DXF import errors


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@914 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 5940f06e
...@@ -1873,8 +1873,6 @@ class ProjectGui: ...@@ -1873,8 +1873,6 @@ class ProjectGui:
def add_log_message(self, title, message, record=None): def add_log_message(self, title, message, record=None):
timestamp = datetime.datetime.fromtimestamp( timestamp = datetime.datetime.fromtimestamp(
record.created).strftime("%H:%M") record.created).strftime("%H:%M")
# use only the first line (linebreak don't look pretty there)
message = message.split(os.linesep, 1)[0]
try: try:
message = message.encode("utf-8") message = message.encode("utf-8")
except UnicodeDecodeError: except UnicodeDecodeError:
......
...@@ -301,6 +301,8 @@ def import_model(filename, program_locations=None, unit=None, callback=None): ...@@ -301,6 +301,8 @@ def import_model(filename, program_locations=None, unit=None, callback=None):
% (len(lines), len(model.get_polygons()))) % (len(lines), len(model.get_polygons())))
return model return model
else: else:
log.error("DXFImporter: No supported elements found in DXF file!") link = "http://sourceforge.net/apps/mediawiki/pycam/index.php?title=SupportedFormats"
log.error('DXFImporter: No supported elements found in DXF file!\n' \
+ '<a href="%s">Read PyCAM\'s modelling hints.</a>' % link)
return None return None
...@@ -125,7 +125,8 @@ class GTKHandler(logging.Handler): ...@@ -125,7 +125,8 @@ class GTKHandler(logging.Handler):
message_type = gtk.MESSAGE_ERROR message_type = gtk.MESSAGE_ERROR
message_title = "Error" message_title = "Error"
window = gtk.MessageDialog(self.parent_window, type=message_type, window = gtk.MessageDialog(self.parent_window, type=message_type,
buttons=gtk.BUTTONS_OK, message_format=str(message)) buttons=gtk.BUTTONS_OK)
window.set_markup(str(message))
try: try:
message_title = message_title.encode("utf-8") message_title = message_title.encode("utf-8")
except UnicodeDecodeError: except UnicodeDecodeError:
......
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