/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/push.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
32
32
import olive.backend.errors as errors
33
33
import olive.backend.info as info
34
34
 
35
 
from dialog import OliveDialog
36
 
 
37
35
class OlivePush:
38
36
    """ Display Push dialog and perform the needed actions. """
39
 
    def __init__(self, gladefile, comm):
 
37
    def __init__(self, gladefile, comm, dialog):
40
38
        """ Initialize the Push dialog. """
41
39
        self.gladefile = gladefile
42
40
        self.glade = gtk.glade.XML(self.gladefile, 'window_push')
43
41
        
 
42
        # Communication object
44
43
        self.comm = comm
45
 
        self.dialog = OliveDialog(self.gladefile)
 
44
        # Dialog object
 
45
        self.dialog = dialog
46
46
        
47
47
        self.window = self.glade.get_widget('window_push')
48
48
        
76
76
    def display(self):
77
77
        """ Display the Push dialog. """
78
78
        if self.notbranch:
79
 
            self.dialog.error_dialog('Directory is not a branch.')
 
79
            self.dialog.error_dialog('Directory is not a branch',
 
80
                                     'You can perform this action only in a branch.')
80
81
            self.close()
81
82
        else:
82
83
            self.window.show()
118
119
                revs = commit.push(self.comm.get_path(),
119
120
                                   overwrite=self.check_overwrite.get_active())
120
121
            except errors.NotBranchError:
121
 
                self.dialog.error_dialog('Directory is not a branch.')
 
122
                self.dialog.error_dialog('Directory is not a branch',
 
123
                                         'You can perform this action only in a branch.')
122
124
                return
123
125
            except errors.NoLocationKnown:
124
 
                self.dialog.error_dialog('No location known.')
 
126
                self.dialog.error_dialog('Push location is unknown',
 
127
                                         'Please specify a location manually.')
125
128
                return
126
129
            except errors.NonExistingParent, errmsg:
127
 
                self.dialog.error_dialog('Parent directory doesn\'t exist: %s', errmsg)
 
130
                self.dialog.error_dialog("Non existing parent directory",
 
131
                                         "The parent directory (%s)\ndoesn't exist." % errmsg)
128
132
                return
129
133
            except errors.DivergedBranchesError:
130
 
                self.dialog.error_dialog('Branches have been diverged.')
 
134
                self.dialog.error_dialog('Branches have been diverged',
 
135
                                         'You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.')
131
136
                return
132
137
            except:
133
138
                raise
134
139
        elif radio_specific.get_active():
135
140
            location = self.entry_location.get_text()
136
141
            if location == '':
137
 
                self.dialog.error_dialog('No location specified.')
 
142
                self.dialog.error_dialog('No location specified',
 
143
                                         'Please specify a location or use the default.')
138
144
                return
139
145
            
140
146
            try:
143
149
                                   self.check_overwrite.get_active(),
144
150
                                   self.check_create.get_active())
145
151
            except errors.NotBranchError:
146
 
                self.dialog.error_dialog('Directory is not a branch.')
 
152
                self.dialog.error_dialog('Directory is not a branch',
 
153
                                         'You can perform this action only in a branch.')
147
154
                self.comm.set_busy(self.window, False)
148
155
                return
149
156
            except errors.NonExistingParent, errmsg:
150
 
                self.dialog.error_dialog('Parent directory doesn\'t exist: %s', errmsg)
 
157
                self.dialog.error_dialog("Non existing parent directory",
 
158
                                         "The parent directory (%s)\ndoesn't exist." % errmsg)
151
159
                self.comm.set_busy(self.window, False)
152
160
                return
153
161
            except errors.DivergedBranchesError:
154
 
                self.dialog.error_dialog('Branches have been diverged.')
 
162
                self.dialog.error_dialog('Branches have been diverged',
 
163
                                         'You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.')
155
164
                self.comm.set_busy(self.window, False)
156
165
                return
157
166
            except errors.PathPrefixNotCreated:
158
 
                self.dialog.error_dialog('Path prefix couldn\'t be created.')
 
167
                self.dialog.error_dialog("Path prefix not created",
 
168
                                         "The path leading up to the specified location couldn't\nbe created.")
159
169
                self.comm.set_busy(self.window, False)
160
170
                return
161
171
            except:
165
175
            pass
166
176
        
167
177
        self.close()
168
 
        self.dialog.info_dialog('%d revision(s) pushed.' % revs)
 
178
        self.dialog.info_dialog('Push successful',
 
179
                                '%d revision(s) pushed.' % revs)
169
180
    
170
181
    def close(self, widget=None):
171
182
        self.window.destroy()