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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-13 14:08:06 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060813140806-3364d3e02a086d51
Modified OliveDialog class interface; huge cleanups.

2006-08-13  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive/frontend/gtk/branch.py: display number of revisions branched
    * olive/frontend/gtk/*: use new dialog interface with detailed descriptions
    * olive/frontend/gtk/dialog.py: modified according to GNOME HIG (primary
      and secondary text)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
2
 
 
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
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
31
31
 
32
32
import bzrlib
33
33
 
34
 
if bzrlib.version_info[1] < 9:
 
34
if bzrlib.version_info < (0, 9):
35
35
    # function deprecated after 0.9
36
36
    from bzrlib.delta import compare_trees
37
37
 
38
38
import bzrlib.errors as errors
39
39
from bzrlib.workingtree import WorkingTree
40
40
 
41
 
from dialog import OliveDialog
42
 
 
43
41
class OliveCommit:
44
42
    """ Display Commit dialog and perform the needed actions. """
45
 
    def __init__(self, gladefile, comm):
 
43
    def __init__(self, gladefile, comm, dialog):
46
44
        """ Initialize the Commit dialog. """
47
45
        self.gladefile = gladefile
48
46
        self.glade = gtk.glade.XML(self.gladefile, 'window_commit')
49
47
        
 
48
        # Communication object
50
49
        self.comm = comm
51
 
        
52
 
        self.dialog = OliveDialog(self.gladefile)
53
 
        
 
50
        # Dialog object
 
51
        self.dialog = dialog
 
52
        
 
53
        # Get the Commit dialog widget
 
54
        self.window = self.glade.get_widget('window_commit')
 
55
 
54
56
        # Check if current location is a branch
55
57
        try:
56
58
            (self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
70
72
        
71
73
        # Set the delta
72
74
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
73
 
        if bzrlib.version_info[1] < 9:
 
75
        if bzrlib.version_info < (0, 9):
74
76
            self.delta = compare_trees(self.old_tree, self.wt)
75
77
        else:
76
78
            self.delta = self.wt.changes_from(self.old_tree)
77
79
        
78
 
        # Get the Commit dialog widget
79
 
        self.window = self.glade.get_widget('window_commit')
80
 
        
81
80
        # Dictionary for signal_autoconnect
82
81
        dic = { "on_button_commit_commit_clicked": self.commit,
83
82
                "on_button_commit_cancel_clicked": self.close }
95
94
    def display(self):
96
95
        """ Display the Push dialog. """
97
96
        if self.notbranch:
98
 
            self.dialog.error_dialog('Directory is not a branch.')
 
97
            self.dialog.error_dialog('Directory is not a branch',
 
98
                                     'You can perform this action only in a branch.')
 
99
            self.close()
99
100
        else:
100
101
            from olive.backend.info import is_checkout
101
102
            if is_checkout(self.comm.get_path()):
169
170
                           local=self.checkbutton_local.get_active(),
170
171
                           specific_files=specific_files)
171
172
        except errors.NotBranchError:
172
 
            self.dialog.error_dialog('Directory is not a branch.')
 
173
            self.dialog.error_dialog('Directory is not a branch',
 
174
                                     'You can perform this action only in a branch.')
173
175
            self.comm.set_busy(self.window, False)
174
176
            return
175
177
        except errors.LocalRequiresBoundBranch:
176
 
            self.dialog.error_dialog('Local commit requires a bound branch.')
 
178
            self.dialog.error_dialog('Directory is not a checkout',
 
179
                                     'You can perform local commit only on checkouts.')
177
180
            self.comm.set_busy(self.window, False)
178
181
            return
179
182
        except errors.PointlessCommit:
180
 
            self.dialog.error_dialog('No changes to commit. Try force commit.')
 
183
            self.dialog.error_dialog('No changes to commit',
 
184
                                     'Try force commit if you want to commit anyway.')
181
185
            self.comm.set_busy(self.window, False)
182
186
            return
183
187
        except errors.ConflictsInTree:
184
 
            self.dialog.error_dialog('Conflicts in tree. Please resolve them first.')
 
188
            self.dialog.error_dialog('Conflicts in tree'
 
189
                                     'You need to resolve the conflicts before committing.')
185
190
            self.comm.set_busy(self.window, False)
186
191
            return
187
192
        except errors.StrictCommitFailed:
188
 
            self.dialog.error_dialog('Strict commit failed. There are unknown files.')
 
193
            self.dialog.error_dialog('Strict commit failed'
 
194
                                     'There are unknown files in the working tree.\nPlease add or delete them.')
189
195
            self.comm.set_busy(self.window, False)
190
196
            return
191
197
        except errors.BoundBranchOutOfDate, errmsg:
192
 
            self.dialog.error_dialog('Bound branch is out of date: %s' % errmsg)
 
198
            self.dialog.error_dialog('Bound branch is out of date',
 
199
                                     '%s' % errmsg)
193
200
            self.comm.set_busy(self.window, False)
194
201
            return
195
202
        except: