/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 olive/status.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-27 17:56:26 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927175626-4462e9dc20d422b1
Bunch of random cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
import sys
 
18
 
17
19
try:
18
20
    import pygtk
19
21
    pygtk.require("2.0")
20
22
except:
21
23
    pass
22
 
 
23
 
import gtk
24
 
import gtk.glade
25
 
 
26
 
from guifiles import GLADEFILENAME
27
 
 
 
24
try:
 
25
    import gtk
 
26
    import gtk.glade
 
27
    import gobject
 
28
    import pango
 
29
except:
 
30
    sys.exit(1)
 
31
 
 
32
import bzrlib
 
33
import bzrlib.errors as errors
 
34
 
 
35
from bzrlib.status import show_tree_status
 
36
from bzrlib.workingtree import WorkingTree
 
37
 
 
38
from dialog import OliveDialog
28
39
 
29
40
class OliveStatus:
30
41
    """ Display Status window and perform the needed actions. """
31
 
    def __init__(self, wt, wtpath):
 
42
    def __init__(self, gladefile, wt, wtpath):
32
43
        """ Initialize the Status window. """
33
 
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_status')
 
44
        self.gladefile = gladefile
 
45
        self.glade = gtk.glade.XML(self.gladefile, 'window_status')
34
46
        
35
47
        # Get the Status window widget
36
48
        self.window = self.glade.get_widget('window_status')
37
 
        
38
49
        self.wt = wt
39
50
        self.wtpath = wtpath
40
51
        
41
52
        # Check if current location is a branch
 
53
        try:
 
54
            branch = wt.branch
 
55
        except errors.NotBranchError:
 
56
            self.notbranch = True
 
57
            return
 
58
        except:
 
59
            raise
 
60
        
42
61
        file_id = self.wt.path2id(wtpath)
43
62
 
 
63
        self.notbranch = False
 
64
        if file_id is None:
 
65
            self.notbranch = True
 
66
            return
 
67
        
44
68
        # Set the old working tree
45
69
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
46
70
        
110
134
    
111
135
    def display(self):
112
136
        """ Display the Diff window. """
113
 
        self.window.show_all()
 
137
        if self.notbranch:
 
138
            error_dialog(_('Directory is not a branch'),
 
139
                                     _('You can perform this action only in a branch.'))
 
140
            self.close()
 
141
        else:
 
142
            self.window.show_all()
114
143
 
115
144
    def close(self, widget=None):
116
145
        self.window.destroy()