/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 diff.py

  • Committer: Martin Pool
  • Date: 2010-05-27 03:07:30 UTC
  • mfrom: (688.1.5 201956-help)
  • Revision ID: mbp@canonical.com-20100527030730-os0opv1xroetccm9
Make find/goto more discoverable

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import os
18
18
import re
19
19
import sys
20
 
import inspect
21
20
try:
22
21
    from xml.etree.ElementTree import Element, SubElement, tostring
23
22
except ImportError:
41
40
    urlutils,
42
41
    workingtree,
43
42
)
44
 
from bzrlib.diff import show_diff_trees
 
43
from bzrlib.diff import show_diff_trees, internal_diff
45
44
from bzrlib.patches import parse_patches
46
45
from bzrlib.trace import warning
47
 
from bzrlib.plugins.gtk.dialog import (
48
 
    error_dialog,
49
 
    info_dialog,
50
 
    warning_dialog,
51
 
    )
52
 
from bzrlib.plugins.gtk.i18n import _i18n
 
46
from bzrlib.plugins.gtk import _i18n
53
47
from bzrlib.plugins.gtk.window import Window
 
48
from dialog import error_dialog, info_dialog, warning_dialog
54
49
 
55
50
 
56
51
def fallback_guess_language(slm, content_type):
109
104
        :param buf: a gtksourceview2.Buffer object.
110
105
        """
111
106
        GEDIT_SCHEME_PATH = '/apps/gedit-2/preferences/editor/colors/scheme'
112
 
        GEDIT_USER_STYLES_PATH = os.path.expanduser('~/.gnome2/gedit/styles')
113
107
 
114
108
        client = gconf.client_get_default()
115
109
        style_scheme_name = client.get_string(GEDIT_SCHEME_PATH)
116
110
        if style_scheme_name is not None:
117
 
            style_scheme_mgr = gtksourceview2.StyleSchemeManager()
118
 
            style_scheme_mgr.append_search_path(GEDIT_USER_STYLES_PATH)
119
 
            
120
 
            style_scheme = style_scheme_mgr.get_scheme(style_scheme_name)
121
 
            
122
 
            if style_scheme is not None:
123
 
                buf.set_style_scheme(style_scheme)
 
111
            style_scheme = gtksourceview2.StyleSchemeManager().get_scheme(style_scheme_name)
 
112
            
 
113
            buf.set_style_scheme(style_scheme)
124
114
 
125
115
    @classmethod
126
116
    def apply_colordiff_colors(klass, buf):
534
524
 
535
525
class DiffController(object):
536
526
 
537
 
    def __init__(self, path, patch, window=None, allow_dirty=False):
 
527
    def __init__(self, path, patch, window=None):
538
528
        self.path = path
539
529
        self.patch = patch
540
 
        self.allow_dirty = allow_dirty
541
530
        if window is None:
542
531
            window = DiffWindow(operations=self._provide_operations())
543
532
            self.initialize_window(window)
549
538
 
550
539
    def get_diff_sections(self):
551
540
        yield "Complete Diff", None, ''.join(self.patch)
552
 
        # allow_dirty was added to parse_patches in bzrlib 2.2b1
553
 
        if 'allow_dirty' in inspect.getargspec(parse_patches).args:
554
 
            patches = parse_patches(self.patch, allow_dirty=self.allow_dirty)
555
 
        else:
556
 
            patches = parse_patches(self.patch)
557
 
        for patch in patches:
 
541
        for patch in parse_patches(self.patch):
558
542
            oldname = patch.oldname.split('\t')[0]
559
543
            newname = patch.newname.split('\t')[0]
560
544
            yield oldname, newname, str(patch)