Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
## A PyGtk-based Python Trace Collector window## Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>#importpygtkpygtk.require("2.0")importgtkimportgobjectimportpangoimportthreadingimport Queue
import win32trace
-from hglib import toutf
+try:+from hggtk.hglib import toutf
+except ImportError:+ def toutf(s):+ return sclass TraceLog():
def __init__(self):
self.window=gtk.Window(gtk.WINDOW_TOPLEVEL)self.window.set_title("Python Trace Collector")# construct windowself.window.set_default_size(700,400)self.main_area=gtk.VBox()self.window.add(self.main_area)# mimic standard dialog widgetsself.action_area=gtk.HBox()self.main_area.pack_end(self.action_area,False,False,5)sep=gtk.HSeparator()self.main_area.pack_end(sep,False,False,0)self.vbox=gtk.VBox()self.main_area.pack_end(self.vbox)# add python trace ouput windowscrolledwindow=gtk.ScrolledWindow()scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)self.textview=gtk.TextView(buffer=None)self.textview.set_editable(False)self.textview.modify_font(pango.FontDescription("Monospace"))scrolledwindow.add(self.textview)self.textview.set_editable(False)self.textbuffer=self.textview.get_buffer()self.vbox.pack_start(scrolledwindow,True,True)self.vbox.show_all()# add buttonsself._button_quit=gtk.Button("Quit")self._button_quit.connect('clicked',self._on_ok_clicked)self.action_area.pack_end(self._button_quit,False,False,5)self._button_clear=gtk.Button("Clear")self._button_clear.connect('clicked',self._on_clear_clicked)self.action_area.pack_end(self._button_clear,False,False,5)# add assorted window event handlersself.window.connect('map_event',self._on_window_map_event)self.window.connect('delete_event',self._on_window_close_clicked)def_on_ok_clicked(self,button):self._stop_read_thread()gtk.main_quit()def_on_clear_clicked(self,button):self.write("",False)def_on_window_close_clicked(self,event,param):self._stop_read_thread()gtk.main_quit()def_on_window_map_event(self,event,param):self._begin_trace()def_begin_trace(self):self.queue=Queue.Queue()win32trace.InitRead()self.write("Collecting Python Trace Output...\n")gobject.timeout_add(10,self._process_queue)self._start_read_thread()def_start_read_thread(self):self._read_trace=Trueself.thread1=threading.Thread(target=self._do_read_trace)self.thread1.start()def_stop_read_thread(self):self._read_trace=False# wait for worker thread to to fix Unhandled exception in threadself.thread1.join()def_process_queue(self):""" Handle all the messages currently in the queue (if any). """whileself.queue.qsize():try:msg=self.queue.get(0)self.write(msg)exceptQueue.Empty:passreturnTruedef_do_read_trace(self):""" print buffer collected in win32trace """whileself._read_trace:msg=win32trace.read()ifmsg:self.queue.put(msg)defwrite(self,msg,append=True):msg=toutf(msg)ifappend:enditer=self.textbuffer.get_end_iter()self.textbuffer.insert(enditer,msg)else:self.textbuffer.set_text(msg)defmain(self):self.window.show_all()gtk.main()defrun():dlg=TraceLog()dlg.main()if__name__=="__main__":run()
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.