/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
2
#
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
7
#
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
12
#
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
try:
18
    import pygtk
19
    pygtk.require("2.0")
20
except:
21
    pass
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
22
0.13.11 by Jelmer Vernooij
Bunch of small fixes, cleanups and simplifications.
23
import gtk
24
import gtk.glade
25
import gobject
26
import pango
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
27
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
28
import bzrlib.errors as errors
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
29
from bzrlib import osutils
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
30
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
31
from dialog import error_dialog
93.1.12 by Alexander Belchenko
Names XML files with GUI resources obtained via olive/guifiles.py
32
from guifiles import GLADEFILENAME
93.1.6 by Alexander Belchenko
detecting name of glade file doing in separate module (olive.gladefile)
33
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
34
89 by Jelmer Vernooij
Rename OliveBranch -> BranchDialog.
35
class CommitDialog:
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
36
    """ Display Commit dialog and perform the needed actions. """
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
37
    def __init__(self, wt, wtpath, standalone=False):
38
        """ Initialize the Commit dialog.
39
        @param  wt:         bzr working tree object
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
43
        """
93.1.6 by Alexander Belchenko
detecting name of glade file doing in separate module (olive.gladefile)
44
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_commit', 'olive-gtk')
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
45
        
0.13.1 by Jelmer Vernooij
Remove communicator use from Commit.
46
        self.wt = wt
47
        self.wtpath = wtpath
48
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
49
        self.standalone = standalone
50
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
51
        # Get some important widgets
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
52
        self.window = self.glade.get_widget('window_commit')
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
53
        self.checkbutton_local = self.glade.get_widget('checkbutton_commit_local')
54
        self.textview = self.glade.get_widget('textview_commit')
55
        self.file_view = self.glade.get_widget('treeview_commit_select')
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
56
        self.pending_label = self.glade.get_widget('label_commit_pending')
57
        self.pending_view = self.glade.get_widget('treeview_commit_pending')
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
58
0.13.1 by Jelmer Vernooij
Remove communicator use from Commit.
59
        file_id = self.wt.path2id(wtpath)
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
60
61
        self.notbranch = False
62
        if file_id is None:
63
            self.notbranch = True
64
            return
65
        
66
        # Set the delta
67
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
0.13.6 by Jelmer Vernooij
Don't pass along dialog context everywhere.
68
        self.delta = self.wt.changes_from(self.old_tree)
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
69
        
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
70
        # Get pending merges
71
        self.pending = self._pending_merges(self.wt)
72
        
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
73
        # Dictionary for signal_autoconnect
74
        dic = { "on_button_commit_commit_clicked": self.commit,
75
                "on_button_commit_cancel_clicked": self.close }
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
76
77
        if self.standalone:
78
            dic["on_button_commit_cancel_clicked"] = self.quit
93.1.11 by Alexander Belchenko
Another fix for closing gcommit dialog: when user press [x] in title mainloop also should be quit
79
            self.window.connect("delete_event", gtk.main_quit)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
80
        
81
        # Connect the signals to the handlers
82
        self.glade.signal_autoconnect(dic)
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
83
        
84
        # Create the file list
85
        self._create_file_view()
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
86
        # Create the pending merges
87
        self._create_pending_merges()
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
88
    
89
    def display(self):
90
        """ Display the Push dialog. """
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
91
        if self.notbranch:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
92
            error_dialog(_('Directory is not a branch'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
93
                         _('You can perform this action only in a branch.'))
0.8.46 by Szilveszter Farkas (Phanatic)
Modified OliveDialog class interface; huge cleanups.
94
            self.close()
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
95
        else:
0.13.1 by Jelmer Vernooij
Remove communicator use from Commit.
96
            if self.wt.branch.get_bound_location() is not None:
0.8.23 by Szilveszter Farkas (Phanatic)
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update
97
                # we have a checkout, so the local commit checkbox must appear
98
                self.checkbutton_local.show()
99
            
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
100
            if self.pending:
101
                # There are pending merges, file selection not supported
102
                self.file_view.set_sensitive(False)
103
            else:
104
                # No pending merges
105
                self.pending_view.set_sensitive(False)
106
            
0.8.26 by Szilveszter Farkas (Phanatic)
Implemented Diff window; added menu.py (was missing from last commit)
107
            self.textview.modify_font(pango.FontDescription("Monospace"))
0.8.23 by Szilveszter Farkas (Phanatic)
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update
108
            self.window.show()
109
            
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
110
    
111
    def _create_file_view(self):
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
112
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,
113
                                        gobject.TYPE_STRING,
114
                                        gobject.TYPE_STRING)
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
115
        self.file_view.set_model(self.file_store)
116
        crt = gtk.CellRendererToggle()
117
        crt.set_property("activatable", True)
118
        crt.connect("toggled", self._toggle_commit, self.file_store)
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
119
        self.file_view.append_column(gtk.TreeViewColumn(_('Commit'),
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
120
                                     crt, active=0))
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
121
        self.file_view.append_column(gtk.TreeViewColumn(_('Path'),
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
122
                                     gtk.CellRendererText(), text=1))
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
123
        self.file_view.append_column(gtk.TreeViewColumn(_('Type'),
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
124
                                     gtk.CellRendererText(), text=2))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
125
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
126
        for path, id, kind in self.delta.added:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
127
            marker = osutils.kind_marker(kind)
128
            self.file_store.append([ True, path+marker, _('added') ])
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
129
130
        for path, id, kind in self.delta.removed:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
131
            marker = osutils.kind_marker(kind)
132
            self.file_store.append([ True, path+marker, _('removed') ])
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
133
134
        for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
135
            marker = osutils.kind_marker(kind)
136
            self.file_store.append([ True,
137
                                     oldpath+marker + '  =>  ' + newpath+marker,
138
                                     _('renamed') ])
0.8.55 by Szilveszter Farkas (Phanatic)
Gettext support added.
139
140
        for path, id, kind, text_modified, meta_modified in self.delta.modified:
93.1.10 by Alexander Belchenko
- Show file kind marker with path (i.e. directory path ends with '/')
141
            marker = osutils.kind_marker(kind)
142
            self.file_store.append([ True, path+marker, _('modified') ])
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
143
    
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
144
    def _create_pending_merges(self):
145
        liststore = gtk.ListStore(gobject.TYPE_STRING,
146
                                  gobject.TYPE_STRING,
147
                                  gobject.TYPE_STRING)
148
        self.pending_view.set_model(liststore)
149
        
150
        self.pending_view.append_column(gtk.TreeViewColumn(_('Date'),
151
                                        gtk.CellRendererText(), text=0))
152
        self.pending_view.append_column(gtk.TreeViewColumn(_('Committer'),
153
                                        gtk.CellRendererText(), text=1))
154
        self.pending_view.append_column(gtk.TreeViewColumn(_('Summary'),
155
                                        gtk.CellRendererText(), text=2))
156
        
157
        if not self.pending:
158
            return
159
        
160
        for item in self.pending:
161
            liststore.append([ item['date'],
162
                               item['committer'],
163
                               item['summary'] ])
164
    
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
165
    def _get_specific_files(self):
166
        ret = []
167
        it = self.file_store.get_iter_first()
168
        while it:
169
            if self.file_store.get_value(it, 0):
0.8.21 by Szilveszter Farkas (Phanatic)
2006-07-25 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
170
                ret.append(self.file_store.get_value(it, 1))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
171
            it = self.file_store.iter_next(it)
172
173
        return ret
174
    
175
    def _toggle_commit(self, cell, path, model):
176
        model[path][0] = not model[path][0]
177
        return
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
178
    
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
179
    def _pending_merges(self, wt):
180
        """ Return a list of pending merges or None if there are none of them. """
181
        parents = wt.get_parent_ids()
182
        if len(parents) < 2:
183
            return None
184
        
185
        import re
186
        from bzrlib.osutils import format_date
187
        
188
        pending = parents[1:]
189
        branch = wt.branch
190
        last_revision = parents[0]
191
        
192
        if last_revision is not None:
193
            try:
194
                ignore = set(branch.repository.get_ancestry(last_revision))
195
            except errors.NoSuchRevision:
196
                # the last revision is a ghost : assume everything is new 
197
                # except for it
198
                ignore = set([None, last_revision])
199
        else:
200
            ignore = set([None])
201
        
202
        pm = []
203
        for merge in pending:
204
            ignore.add(merge)
205
            try:
206
                m_revision = branch.repository.get_revision(merge)
207
                
208
                rev = {}
209
                rev['committer'] = re.sub('<.*@.*>', '', m_revision.committer).strip(' ')
210
                rev['summary'] = m_revision.get_summary()
211
                rev['date'] = format_date(m_revision.timestamp,
212
                                          m_revision.timezone or 0, 
213
                                          'original', date_fmt="%Y-%m-%d",
214
                                          show_offset=False)
215
                
216
                pm.append(rev)
217
                
218
                inner_merges = branch.repository.get_ancestry(merge)
219
                assert inner_merges[0] is None
220
                inner_merges.pop(0)
221
                inner_merges.reverse()
222
                for mmerge in inner_merges:
223
                    if mmerge in ignore:
224
                        continue
225
                    mm_revision = branch.repository.get_revision(mmerge)
226
                    
227
                    rev = {}
228
                    rev['committer'] = re.sub('<.*@.*>', '', mm_revision.committer).strip(' ')
229
                    rev['summary'] = mm_revision.get_summary()
230
                    rev['date'] = format_date(mm_revision.timestamp,
231
                                              mm_revision.timezone or 0, 
232
                                              'original', date_fmt="%Y-%m-%d",
233
                                              show_offset=False)
234
                
235
                    pm.append(rev)
236
                    
237
                    ignore.add(mmerge)
238
            except errors.NoSuchRevision:
239
                print "DEBUG: NoSuchRevision:", merge
240
        
241
        return pm
242
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
243
    def commit(self, widget):
0.8.26 by Szilveszter Farkas (Phanatic)
Implemented Diff window; added menu.py (was missing from last commit)
244
        textbuffer = self.textview.get_buffer()
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
245
        start, end = textbuffer.get_bounds()
93.1.9 by Alexander Belchenko
Fix bug 67927 (non-ascii commit message saved as utf-8 string)
246
        message = textbuffer.get_text(start, end).decode('utf-8')
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
247
        
248
        checkbutton_strict = self.glade.get_widget('checkbutton_commit_strict')
249
        checkbutton_force = self.glade.get_widget('checkbutton_commit_force')
250
        
95 by Szilveszter Farkas (Phanatic)
Added pending merges to Commit dialog. Fixed bug #66091.
251
        if not self.pending:
252
            specific_files = self._get_specific_files()
253
        else:
254
            specific_files = None
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
255
        
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
256
        try:
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
257
            self.wt.commit(message, 
258
                           allow_pointless=checkbutton_force.get_active(),
259
                           strict=checkbutton_strict.get_active(),
0.8.23 by Szilveszter Farkas (Phanatic)
Visual feedback when Olive is busy; follow bzr API changes; commit dialog update
260
                           local=self.checkbutton_local.get_active(),
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
261
                           specific_files=specific_files)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
262
        except errors.NotBranchError:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
263
            error_dialog(_('Directory is not a branch'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
264
                         _('You can perform this action only in a branch.'))
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
265
            return
266
        except errors.LocalRequiresBoundBranch:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
267
            error_dialog(_('Directory is not a checkout'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
268
                         _('You can perform local commit only on checkouts.'))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
269
            return
270
        except errors.PointlessCommit:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
271
            error_dialog(_('No changes to commit'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
272
                         _('Try force commit if you want to commit anyway.'))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
273
            return
274
        except errors.ConflictsInTree:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
275
            error_dialog(_('Conflicts in tree'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
276
                         _('You need to resolve the conflicts before committing.'))
0.8.20 by Szilveszter Farkas (Phanatic)
2006-07-24 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
277
            return
278
        except errors.StrictCommitFailed:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
279
            error_dialog(_('Strict commit failed'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
280
                         _('There are unknown files in the working tree.\nPlease add or delete them.'))
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
281
            return
282
        except errors.BoundBranchOutOfDate, errmsg:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
283
            error_dialog(_('Bound branch is out of date'),
0.8.98 by Szilveszter Farkas (Phanatic)
Loads of fixes. Pyflakes cleanup.
284
                         _('%s') % errmsg)
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
285
            return
0.13.2 by Jelmer Vernooij
Handle unknown errors in commit.
286
        except errors.BzrError, msg:
0.13.4 by Jelmer Vernooij
Handle non-bzr unknown errors as well.
287
            error_dialog(_('Unknown bzr error'), str(msg))
288
            return
289
        except Exception, msg:
0.13.3 by Jelmer Vernooij
Start removing dialog context (it's not required).
290
            error_dialog(_('Unknown error'), str(msg))
0.13.2 by Jelmer Vernooij
Handle unknown errors in commit.
291
            return
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
292
293
        if not self.standalone:
294
            self.close()
295
        else:
296
            self.quit()
0.8.19 by Szilveszter Farkas (Phanatic)
2006-07-21 Szilveszter Farkas <Szilveszter.Farkas@gmail.com>
297
        
298
    def close(self, widget=None):
299
        self.window.destroy()
93.1.7 by Alexander Belchenko
Fix gcommit bug 66937 (bzr still running after cancel/commit clicked)
300
301
    def quit(self, widget=None):
302
        self.close(widget)
303
        gtk.main_quit()