~beuno/ninja-ide/bzr-integration

« back to all changes in this revision

Viewing changes to bzr_integration/bzr_integration.py

  • Committer: Martin Albisetti
  • Date: 2011-11-20 21:05:29 UTC
  • Revision ID: martin.albisetti@canonical.com-20111120210529-qmrnmy9aftfdi53c
Load the all the branch info, bail if not a branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# *-* coding: UTF-8 *-*
2
2
 
3
3
from ninja_ide.core import plugin
 
4
from bzrlib.bzrdir import BzrDir
 
5
from bzrlib import errors
4
6
 
5
7
 
6
8
class bzr_integration(plugin.Plugin):
11
13
        self.menuApp_s = self.locator.get_service('menuApp')
12
14
        self.misc_s = self.locator.get_service('misc')
13
15
        self.explorer_s = self.locator.get_service('explorer')
14
 
        self.editor_s.editorKeyPressEvent.connect(self.bzr_status)
 
16
        try:
 
17
            (self.workingtree,
 
18
             self.branch,
 
19
             self.repo,
 
20
             self.path) = BzrDir.open_containing_tree_branch_or_repository(
 
21
                 self.explorer_s.get_actual_project())
 
22
        except errors.NotBranchError:
 
23
            # Not versioned with bzr
 
24
            pass
15
25
 
16
26
    def bzr_status(self):
17
27
        """"""
18
 
        self.editor_s.insert_text('Hi!')
 
28
        pass
19
29
 
20
30
    def finish(self):
21
31
        #Shutdown your plugin