1
# Copyright (C) 2007 by Szilveszter Farkas (Phanatic) <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.
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.
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
25
from errors import show_bzr_error
27
class InitDialog(gtk.Dialog):
28
""" Initialize dialog. """
29
def __init__(self, path, parent=None):
30
""" Initialize the Initialize dialog. """
31
gtk.Dialog.__init__(self, title="Initialize - Olive",
34
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
40
self._button_init = gtk.Button(_("_Initialize"), use_underline=True)
41
self._label_question = gtk.Label(_("Which directory do you want to initialize?"))
42
self._radio_current = gtk.RadioButton(None, _("Current directory"))
43
self._radio_custom = gtk.RadioButton(self._radio_current, _("Create a new directory with the name:"))
44
self._entry_custom = gtk.Entry()
45
self._hbox_custom = gtk.HBox()
48
self._button_init.connect('clicked', self._on_init_clicked)
49
self._radio_custom.connect('toggled', self._on_custom_toggled)
52
self._entry_custom.set_sensitive(False)
54
# Construct the dialog
55
self.action_area.pack_end(self._button_init)
57
self._hbox_custom.pack_start(self._radio_custom, False, False)
58
self._hbox_custom.pack_start(self._entry_custom, True, True)
60
self.vbox.pack_start(self._label_question)
61
self.vbox.pack_start(self._radio_current)
62
self.vbox.pack_start(self._hbox_custom)
67
def _on_custom_toggled(self, widget):
68
""" Occurs if the Custom radiobutton is toggled. """
69
if self._radio_custom.get_active() == True:
70
self._entry_custom.set_sensitive(True)
71
self._entry_custom.grab_focus()
73
self._entry_custom.set_sensitive(False)
75
def _on_init_clicked(self, widget):
76
self.response(gtk.RESPONSE_OK)