def show_debug_window(self, b):
# window already exists and is hidden so just show it
if self.window is not None:
# "present" will show the window if it is hidden
# if not hidden it will raise it to the top
self.window.present()
return
# This is the first time the user has opened the engine debug
# window so need to create it.
self.builder = Gtk.Builder()
self.builder.set_translation_domain(gv.domain)
self.builder.add_from_file(self.glade_file)
self.builder.connect_signals(self)
self.window = self.builder.get_object("engine_debug_window")
self.tv = self.builder.get_object("engine_debug_textview")
self.tv.set_editable(False)
self.tb = self.tv.get_buffer()
self.tb.set_text(self.debug_text)
self.debug_text = ""
# used to type commands and send them to the engine
self.cmd_entry = self.builder.get_object("engine_debug_entry")
self.window.show_all()
# scroll to end
GObject.idle_add(self.scroll_to_end)
评论列表
文章目录