/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 initialize.py

  • Committer: Mikkel Kamstrup Erlandsen
  • Date: 2011-09-28 07:45:39 UTC
  • mto: This revision was merged to the branch mainline in revision 740.
  • Revision ID: mikkel.kamstrup@gmail.com-20110928074539-qxl1yn1bkjel6ir0
Add X-GNOME-Autostart-Delay=30 to bzr-notify.desktop

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
16
16
 
17
 
from gi.repository import GObject
18
 
from gi.repository import Gtk
 
17
try:
 
18
    import pygtk
 
19
    pygtk.require("2.0")
 
20
except:
 
21
    pass
 
22
 
 
23
import gtk
19
24
 
20
25
import os
21
26
 
30
35
from bzrlib.plugins.gtk.i18n import _i18n
31
36
 
32
37
 
33
 
class InitDialog(Gtk.Dialog):
 
38
class InitDialog(gtk.Dialog):
34
39
    """ Initialize dialog. """
35
40
 
36
41
    def __init__(self, path, parent=None):
37
42
        """ Initialize the Initialize dialog. """
38
 
        super(InitDialog, self).__init__(
39
 
            title="Initialize - Olive", parent=parent, flags=0,
40
 
            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
 
43
        gtk.Dialog.__init__(self, title="Initialize - Olive",
 
44
                                  parent=parent,
 
45
                                  flags=0,
 
46
                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
41
47
        
42
48
        # Get arguments
43
49
        self.path = path
44
50
        
45
51
        # Create the widgets
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()
 
52
        self._button_init = gtk.Button(_i18n("_Initialize"), use_underline=True)
 
53
        self._label_question = gtk.Label(_i18n("Which directory do you want to initialize?"))
 
54
        self._radio_current = gtk.RadioButton(None, _i18n("Current directory"))
 
55
        self._radio_custom = gtk.RadioButton(self._radio_current, _i18n("Create a new directory with the name:"))
 
56
        self._entry_custom = gtk.Entry()
 
57
        self._hbox_custom = gtk.HBox()
54
58
        
55
59
        # Set callbacks
56
60
        self._button_init.connect('clicked', self._on_init_clicked)
60
64
        self._entry_custom.set_sensitive(False)
61
65
        
62
66
        # Construct the dialog
63
 
        self.action_area.pack_end(self._button_init, False, False, 0)
64
 
        
65
 
        self._hbox_custom.pack_start(self._radio_custom, False, False, 0)
66
 
        self._hbox_custom.pack_start(self._entry_custom, True, True, 0)
67
 
        
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)
 
67
        self.action_area.pack_end(self._button_init)
 
68
        
 
69
        self._hbox_custom.pack_start(self._radio_custom, False, False)
 
70
        self._hbox_custom.pack_start(self._entry_custom, True, True)
 
71
        
 
72
        self.vbox.pack_start(self._label_question)
 
73
        self.vbox.pack_start(self._radio_current)
 
74
        self.vbox.pack_start(self._hbox_custom)
72
75
        
73
76
        # Display the dialog
74
 
        content_area.show_all()
 
77
        self.vbox.show_all()
75
78
    
76
79
    def _on_custom_toggled(self, widget):
77
80
        """ Occurs if the Custom radiobutton is toggled. """
117
120
                branch = existing_bzrdir.create_branch()
118
121
                existing_bzrdir.create_workingtree()
119
122
        
120
 
        self.response(Gtk.ResponseType.OK)
 
123
        self.response(gtk.RESPONSE_OK)