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
 
 
17
from gi.repository import GObject
 
 
18
from gi.repository import Gtk
 
27
 
from dialog import error_dialog
 
28
 
from errors import show_bzr_error
 
30
 
from bzrlib import bzrdir
 
31
 
from bzrlib import transport
 
32
 
import bzrlib.errors as errors
 
33
 
from bzrlib.plugins.gtk import _i18n
 
35
 
class InitDialog(gtk.Dialog):
 
 
28
from bzrlib.plugins.gtk.dialog import error_dialog
 
 
29
from bzrlib.plugins.gtk.errors import show_bzr_error
 
 
30
from bzrlib.plugins.gtk.i18n import _i18n
 
 
33
class InitDialog(Gtk.Dialog):
 
36
34
    """ Initialize dialog. """
 
37
36
    def __init__(self, path, parent=None):
 
38
37
        """ Initialize the Initialize dialog. """
 
39
 
        gtk.Dialog.__init__(self, title="Initialize - Olive",
 
42
 
                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
 
 
38
        super(InitDialog, self).__init__(
 
 
39
            title="Initialize - Olive", parent=parent, flags=0,
 
 
40
            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
 
47
45
        # Create the widgets
 
48
 
        self._button_init = gtk.Button(_i18n("_Initialize"), use_underline=True)
 
49
 
        self._label_question = gtk.Label(_i18n("Which directory do you want to initialize?"))
 
50
 
        self._radio_current = gtk.RadioButton(None, _i18n("Current directory"))
 
51
 
        self._radio_custom = gtk.RadioButton(self._radio_current, _i18n("Create a new directory with the name:"))
 
52
 
        self._entry_custom = gtk.Entry()
 
53
 
        self._hbox_custom = gtk.HBox()
 
 
46
        self._button_init = Gtk.Button(_i18n("_Initialize"), use_underline=True)
 
 
47
        self._label_question = Gtk.Label(label=_i18n("Which directory do you want to initialize?"))
 
 
48
        self._radio_current = Gtk.RadioButton.new_with_label(
 
 
49
            None, _i18n("Current directory"))
 
 
50
        self._radio_custom = Gtk.RadioButton.new_with_label_from_widget(
 
 
51
            self._radio_current, _i18n("Create a new directory with the name:"))
 
 
52
        self._entry_custom = Gtk.Entry()
 
 
53
        self._hbox_custom = Gtk.HBox()
 
56
56
        self._button_init.connect('clicked', self._on_init_clicked)
 
 
60
60
        self._entry_custom.set_sensitive(False)
 
62
62
        # Construct the dialog
 
63
 
        self.action_area.pack_end(self._button_init)
 
65
 
        self._hbox_custom.pack_start(self._radio_custom, False, False)
 
66
 
        self._hbox_custom.pack_start(self._entry_custom, True, True)
 
68
 
        self.vbox.pack_start(self._label_question)
 
69
 
        self.vbox.pack_start(self._radio_current)
 
70
 
        self.vbox.pack_start(self._hbox_custom)
 
 
63
        self.action_area.pack_end(self._button_init, False, False, 0)
 
 
65
        self._hbox_custom.pack_start(self._radio_custom, False, False, 0)
 
 
66
        self._hbox_custom.pack_start(self._entry_custom, True, True, 0)
 
 
68
        content_area = self.get_content_area()
 
 
69
        content_area.pack_start(self._label_question, True, True, 0)
 
 
70
        content_area.pack_start(self._radio_current, True, True, 0)
 
 
71
        content_area.pack_start(self._hbox_custom, True, True, 0)
 
72
73
        # Display the dialog
 
 
74
        content_area.show_all()
 
75
76
    def _on_custom_toggled(self, widget):
 
76
77
        """ Occurs if the Custom radiobutton is toggled. """