Hi folks,
when I am updating TextView form the thread
then without any newline character all works fine,
But when I would like to insert a new line character
it failed with:
**
Gtk:ERROR:gtktextview.c:3810:gtk_text_view_validate_onscreen: assertion
failed: (priv->onscreen_validated)
I not that something is wrong but I could not image what?
Class looks like:
...
import section
...
GLib.threads_init()
class RunLoggingHandler(logging.Handler):
def __init__(self, textbuffer):
logging.Handler.__init__(self)
self.textbuffer = textbuffer
def utf8conv(self,x):
try:
return unicode(x,'utf8')
except:
return x
def emit(self, record):
it = self.textbuffer.get_end_iter()
#self.textbuffer.place_cursor(it)
self.textbuffer.insert_at_cursor(record.getMessage()+'\n')
class runWindow(object):
def __init__(self, parent, finalWindow, builder, assistant):
self.parent = parent
self.finalWindow = finalWindow
self.runWindow = builder.get_object("runWindow")
self.textViewLog = builder.get_object("textViewLog")
self.cancelBtn = builder.get_object("cancelRunBtn")
self.textbuffer = self.textViewLog.get_buffer()
self.textViewLog.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
self.assistant = assistant
self.tlh = RunLoggingHandler(self.textbuffer)
logger.addHandler(self.tlh)
FORMAT = "%(levelname)s %(message)s"
self.tlh.setFormatter(logging.Formatter(FORMAT))
logger.setLevel(logging.INFO)
def open_window(self, widget, data=None):
dirname, projectname = self.parent.pathWindow.get_data()
self.runWindow.show_all()
def visibility_event(self, widget, data=None):
logger_gui.info("ListView Visibility event")
self.cancelBtn.set_sensitive(False)
thread = threading.Thread(target=self.devassistant_start)
thread.start()
if not thread.is_alive():
self.cancelBtn.set_sensitive(True)
def devassistant_start(self):
logger_gui.info("Thread run")
path =
self.assistant.get_selected_subassistant_path(**self.parent.kwargs)
pr = path_runner.PathRunner(path, self.parent.kwargs)
try:
pr.run()
except exceptions.ExecutionException as ex:
pass
--
Best regards / S pozdravem
Petr Hracek
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/