/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

Merged with mainline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
gcommit           GTK+ commit dialog.
23
23
gconflicts        GTK+ conflicts. 
24
24
gdiff             Show differences in working tree in a GTK+ Window. 
 
25
ghandle-patch     Display and optionally merge a merge directive or patch.
25
26
ginit             Initialise a new branch.
26
27
gmissing          GTK+ missing revisions dialog. 
27
28
gpreferences      GTK+ preferences dialog. 
44
45
    version_string = '%d.%d.%d%s%d' % version_info
45
46
__version__ = version_string
46
47
 
47
 
required_bzrlib = (1, 0)
 
48
required_bzrlib = (1, 3)
48
49
 
49
50
def check_bzrlib_version(desired):
50
51
    """Check that bzrlib is compatible.
77
78
    branch,
78
79
    builtins,
79
80
    errors,
 
81
    merge_directive,
80
82
    workingtree,
81
83
    )
82
84
""")
304
306
 
305
307
        window = GAnnotateWindow(all, plain)
306
308
        window.connect("destroy", lambda w: gtk.main_quit())
307
 
        window.set_title(path + " - gannotate")
308
309
        config = GAnnotateConfig(window)
309
310
        window.show()
310
311
        br.lock_read()
672
673
register_command(cmd_test_gtk)
673
674
 
674
675
 
 
676
class cmd_ghandle_patch(GTKCommand):
 
677
    """Display a patch or merge directive, possibly merging.
 
678
 
 
679
    This is a helper, meant to be launched from other programs like browsers
 
680
    or email clients.  Since these programs often do not allow parameters to
 
681
    be provided, a "handle-patch" script is included.
 
682
    """
 
683
 
 
684
    takes_args = ['path']
 
685
 
 
686
    def run(self, path):
 
687
        try:
 
688
            from bzrlib.plugins.gtk.diff import (DiffWindow,
 
689
                                                 MergeDirectiveWindow)
 
690
            lines = open(path, 'rb').readlines()
 
691
            lines = [l.replace('\r\n', '\n') for l in lines]
 
692
            try:
 
693
                directive = merge_directive.MergeDirective.from_lines(lines)
 
694
            except errors.NotAMergeDirective:
 
695
                window = DiffWindow()
 
696
                window.set_diff_text(path, lines)
 
697
            else:
 
698
                window = MergeDirectiveWindow(directive, path)
 
699
                window.set_diff_text(path, directive.patch.splitlines(True))
 
700
            window.show()
 
701
            gtk = self.open_display()
 
702
            window.connect("destroy", gtk.main_quit)
 
703
        except Exception, e:
 
704
            from dialog import error_dialog
 
705
            error_dialog('Error', str(e))
 
706
            raise
 
707
        gtk.main()
 
708
 
 
709
 
 
710
register_command(cmd_ghandle_patch)
 
711
 
 
712
 
675
713
import gettext
676
714
gettext.install('olive-gtk')
677
715