/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Robert Collins
  • Date: 2007-07-05 05:01:53 UTC
  • mto: This revision was merged to the branch mainline in revision 216.
  • Revision ID: robertc@robertcollins.net-20070705050153-o5j4t7fkxe66fbht
Add inspect window to bzr commity-notify.

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
            wt.unlock()
212
212
 
213
213
 
 
214
def start_viz_window(branch, revision, limit=None):
 
215
    """Start viz on branch with revision revision.
 
216
    
 
217
    :return: The viz window object.
 
218
    """
 
219
    from viz.branchwin import BranchWindow
 
220
    branch.lock_read()
 
221
    pp = BranchWindow()
 
222
    pp.set_branch(branch, revision, limit)
 
223
    # cleanup locks when the window is closed
 
224
    pp.connect("destroy", lambda w: branch.unlock())
 
225
    return pp
 
226
 
 
227
 
214
228
class cmd_visualise(Command):
215
229
    """Graphically visualise this branch.
216
230
 
231
245
        set_ui_factory()
232
246
        (br, path) = branch.Branch.open_containing(location)
233
247
        br.lock_read()
234
 
        br.repository.lock_read()
235
248
        try:
236
249
            if revision is None:
237
250
                revid = br.last_revision()
240
253
            else:
241
254
                (revno, revid) = revision[0].in_history(br)
242
255
 
243
 
            from viz.branchwin import BranchWindow
244
256
            import gtk
245
 
                
246
 
            pp = BranchWindow()
247
 
            pp.set_branch(br, revid, limit)
 
257
            pp = start_viz_window(br, revid, limit)
248
258
            pp.connect("destroy", lambda w: gtk.main_quit())
249
259
            pp.show()
250
260
            gtk.main()
251
261
        finally:
252
 
            br.repository.unlock()
253
262
            br.unlock()
254
263
 
255
264
 
515
524
                body += revision.message
516
525
                body = cgi.escape(body)
517
526
                nw = pynotify.Notification(summary, body)
 
527
                def start_viz(notification=None, action=None, data=None):
 
528
                    """Start the viz program."""
 
529
                    pp = start_viz_window(branch, revision_id)
 
530
                    pp.show()
 
531
                nw.add_action("clicked", "Inspect", start_viz, None)
518
532
                nw.set_timeout(5000)
519
533
                nw.show()
520
534
            except Exception, e: