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

  • Committer: Jelmer Vernooij
  • Date: 2006-11-02 23:01:58 UTC
  • mto: (66.2.3 bzr-gtk)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: jelmer@samba.org-20061102230158-a3db0c4fdbd00640
Cherrypick Alexanders' fix for #68127.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
class CommitDialog:
36
36
    """ Display Commit dialog and perform the needed actions. """
37
 
    def __init__(self, wt, wtpath, standalone=False):
 
37
    def __init__(self, wt, wtpath, notbranch):
38
38
        """ Initialize the Commit dialog.
39
39
        :param  wt:         bzr working tree object
40
40
        :param  wtpath:     path to working tree root
41
 
        :param  standalone: when used in gcommit command as standalone window
42
 
                            this argument should be True
 
41
        :param  notbranch:  flag that path is not a brach
 
42
        :type   notbranch:  bool
43
43
        """
44
44
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_commit', 'olive-gtk')
45
45
        
46
46
        self.wt = wt
47
47
        self.wtpath = wtpath
48
 
 
49
 
        self.standalone = standalone
 
48
        self.notbranch = notbranch
50
49
 
51
50
        # Get some important widgets
52
51
        self.window = self.glade.get_widget('window_commit')
56
55
        self.pending_label = self.glade.get_widget('label_commit_pending')
57
56
        self.pending_view = self.glade.get_widget('treeview_commit_pending')
58
57
 
59
 
        file_id = self.wt.path2id(wtpath)
60
 
 
61
 
        self.notbranch = False
62
 
        if file_id is None:
63
 
            self.notbranch = True
 
58
        if wt is None or notbranch:
64
59
            return
65
60
        
66
61
        # Set the delta
74
69
        dic = { "on_button_commit_commit_clicked": self.commit,
75
70
                "on_button_commit_cancel_clicked": self.close }
76
71
 
77
 
        if self.standalone:
78
 
            dic["on_button_commit_cancel_clicked"] = self.quit
79
 
            self.window.connect("delete_event", gtk.main_quit)
80
 
        
81
72
        # Connect the signals to the handlers
82
73
        self.glade.signal_autoconnect(dic)
83
74
        
87
78
        self._create_pending_merges()
88
79
    
89
80
    def display(self):
90
 
        """ Display the Push dialog. """
 
81
        """ Display the Push dialog.
 
82
        @return:    True if dialog is shown.
 
83
        """
 
84
        if self.wt is None and not self.notbranch:
 
85
            error_dialog(_('Directory does not have a working tree'),
 
86
                         _('Operation aborted.'))
 
87
            self.close()
 
88
            return False
91
89
        if self.notbranch:
92
90
            error_dialog(_('Directory is not a branch'),
93
91
                         _('You can perform this action only in a branch.'))
94
92
            self.close()
 
93
            return False
95
94
        else:
96
95
            if self.wt.branch.get_bound_location() is not None:
97
96
                # we have a checkout, so the local commit checkbox must appear
106
105
            
107
106
            self.textview.modify_font(pango.FontDescription("Monospace"))
108
107
            self.window.show()
109
 
            
 
108
            return True
110
109
    
111
110
    def _create_file_view(self):
112
111
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,   # [0] checkbox
298
297
            error_dialog(_('Unknown error'), str(msg))
299
298
            return
300
299
 
301
 
        if not self.standalone:
302
 
            self.close()
303
 
        else:
304
 
            self.quit()
305
 
        
 
300
        self.close()
 
301
 
306
302
    def close(self, widget=None):
307
303
        self.window.destroy()
308
 
 
309
 
    def quit(self, widget=None):
310
 
        self.close(widget)
311
 
        gtk.main_quit()