/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: Mateusz Korniak
  • Date: 2007-07-21 13:16:33 UTC
  • mto: This revision was merged to the branch mainline in revision 248.
  • Revision ID: matkor@laptop-hp-20070721131633-t40kxs20j1q2fvvc
Context menu "Remove and delete added"
Acts like "Remove" but also deletes file locally.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
gbranch           GTK+ branching. 
21
21
gcheckout         GTK+ checkout. 
22
22
gcommit           GTK+ commit dialog 
23
 
gconflicts        GTK+ conflicts. 
 
23
gconflicts        GTK+ push. 
24
24
gdiff             Show differences in working tree in a GTK+ Window. 
25
25
ginit             Initialise a new branch.
26
26
gmissing          GTK+ missing revisions dialog. 
33
33
 
34
34
import bzrlib
35
35
 
36
 
__version__ = '0.91.0'
 
36
__version__ = '0.19.0'
37
37
version_info = tuple(int(n) for n in __version__.split('.'))
38
38
 
39
39
 
57
57
        from warnings import warn as warning
58
58
    if bzrlib_version < desired:
59
59
        from bzrlib.errors import BzrError
60
 
        warning('Installed Bazaar version %s is too old to be used with bzr-gtk'
 
60
        warning('Installed bzr version %s is too old to be used with bzr-gtk'
61
61
                ' %s.' % (bzrlib.__version__, __version__))
62
 
        raise BzrError('Version mismatch: %r' % (version_info,) )
 
62
        raise BzrError('Version mismatch: %r' % version_info)
63
63
    else:
64
64
        warning('bzr-gtk is not up to date with installed bzr version %s.'
65
65
                ' \nThere should be a newer version available, e.g. %i.%i.' 
66
66
                % (bzrlib.__version__, bzrlib_version[0], bzrlib_version[1]))
67
67
 
68
68
 
69
 
check_bzrlib_version(version_info[:2])
 
69
## check_bzrlib_version(version_info[:2]) REMOVE
70
70
 
71
71
from bzrlib.trace import warning
72
72
if __name__ != 'bzrlib.plugins.gtk':
76
76
lazy_import(globals(), """
77
77
from bzrlib import (
78
78
    branch,
79
 
    builtins,
80
79
    errors,
81
80
    workingtree,
82
81
    )
104
103
    bzrlib.ui.ui_factory = GtkUIFactory()
105
104
 
106
105
 
107
 
def data_path():
108
 
    return os.path.dirname(__file__)
109
 
 
110
 
 
111
106
class GTKCommand(Command):
112
107
    """Abstract class providing GTK specific run commands."""
113
108
 
384
379
 
385
380
 
386
381
class cmd_gconflicts(GTKCommand):
387
 
    """ GTK+ conflicts.
 
382
    """ GTK+ push.
388
383
    
389
 
    Select files from the list of conflicts and run an external utility to
390
 
    resolve them.
391
384
    """
392
385
    def run(self):
393
386
        (wt, path) = workingtree.WorkingTree.open_containing('.')
496
489
        from notify import NotifyPopupMenu
497
490
        gtk = self.open_display()
498
491
        menu = NotifyPopupMenu()
499
 
        icon = gtk.status_icon_new_from_file(os.path.join(data_path(), "bzr-icon-64.png"))
 
492
        icon = gtk.status_icon_new_from_file("bzr-icon-64.png")
500
493
        icon.connect('popup-menu', menu.display)
501
494
 
502
495
        import cgi
559
552
register_command(cmd_commit_notify)
560
553
 
561
554
 
562
 
class cmd_gselftest(GTKCommand):
563
 
    """Version of selftest that displays a notification at the end"""
564
 
 
565
 
    takes_args = builtins.cmd_selftest.takes_args
566
 
    takes_options = builtins.cmd_selftest.takes_options
567
 
    _see_also = ['selftest']
568
 
 
569
 
    def run(self, *args, **kwargs):
570
 
        import cgi
571
 
        import sys
572
 
        default_encoding = sys.getdefaultencoding()
573
 
        # prevent gtk from blowing up later
574
 
        gtk = import_pygtk()
575
 
        # prevent gtk from messing with default encoding
576
 
        import pynotify
577
 
        if sys.getdefaultencoding() != default_encoding:
578
 
            reload(sys)
579
 
            sys.setdefaultencoding(default_encoding)
580
 
        result = builtins.cmd_selftest().run(*args, **kwargs)
581
 
        if result == 0:
582
 
            summary = 'Success'
583
 
            body = 'Selftest succeeded in "%s"' % os.getcwd()
584
 
        if result == 1:
585
 
            summary = 'Failure'
586
 
            body = 'Selftest failed in "%s"' % os.getcwd()
587
 
        pynotify.init("bzr gselftest")
588
 
        note = pynotify.Notification(cgi.escape(summary), cgi.escape(body))
589
 
        note.set_timeout(pynotify.EXPIRES_NEVER)
590
 
        note.show()
591
 
 
592
 
 
593
 
register_command(cmd_gselftest)
594
 
 
595
 
 
596
555
import gettext
597
556
gettext.install('olive-gtk')
598
557