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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2007-02-16 17:17:28 UTC
  • mto: (157.1.9 trunk) (170.1.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 160.
  • Revision ID: szilveszter.farkas@gmail.com-20070216171728-i97utnlbukrkvzli
Updated genpot.sh. Regenerated POT file. Old Hungarian translation removed.

We have to encourage people to translate bzr-gtk/Olive through Rosetta. (The Olive product is already translatable, but bzr-gtk is still not.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
import os.path
28
28
 
29
 
from bzrlib import errors, osutils
30
 
from bzrlib.trace import mutter
 
29
import bzrlib.errors as errors
 
30
from bzrlib import osutils
31
31
 
32
32
from dialog import error_dialog, question_dialog
33
33
from errors import show_bzr_error
34
34
 
35
 
try:
36
 
    import dbus
37
 
    import dbus.glib
38
 
    have_dbus = True
39
 
except ImportError:
40
 
    have_dbus = False
41
 
 
42
35
class CommitDialog(gtk.Dialog):
43
36
    """ New implementation of the Commit dialog. """
44
37
    def __init__(self, wt, wtpath, notbranch, selected=None, parent=None):
86
79
        
87
80
        # Create the widgets
88
81
        self._button_commit = gtk.Button(_("Comm_it"), use_underline=True)
 
82
        if self._is_checkout:
 
83
            self._check_local = gtk.CheckButton(_("_Only commit locally"),
 
84
                                                use_underline=True)
 
85
        self._check_strict = gtk.CheckButton(_("_Allow unknown files"),
 
86
                                             use_underline=True)
89
87
        self._expander_files = gtk.Expander(_("File(s) to commit"))
90
88
        self._vpaned_main = gtk.VPaned()
91
89
        self._scrolledwindow_files = gtk.ScrolledWindow()
143
141
        self._vpaned_main.add2(self._vbox_message)
144
142
        
145
143
        self.vbox.pack_start(self._vpaned_main, True, True)
146
 
        if self._is_checkout: 
147
 
            self._check_local = gtk.CheckButton(_("_Only commit locally"),
148
 
                                                use_underline=True)
 
144
        if self._is_checkout:
149
145
            self.vbox.pack_start(self._check_local, False, False)
150
 
            if have_dbus:
151
 
                bus = dbus.SystemBus()
152
 
                proxy_obj = bus.get_object('org.freedesktop.NetworkManager', 
153
 
                              '/org/freedesktop/NetworkManager')
154
 
                dbus_iface = dbus.Interface(
155
 
                        proxy_obj, 'org.freedesktop.NetworkManager')
156
 
                try:
157
 
                    # 3 is the enum value for STATE_CONNECTED
158
 
                    self._check_local.set_active(dbus_iface.state() != 3)
159
 
                except dbus.DBusException, e:
160
 
                    # Silently drop errors. While DBus may be 
161
 
                    # available, NetworkManager doesn't necessarily have to be
162
 
                    mutter("unable to get networkmanager state: %r" % e)
163
 
                
 
146
        self.vbox.pack_start(self._check_strict, False, False)
 
147
        
164
148
        # Create the file list
165
149
        self._create_file_view()
166
150
        # Create the pending merges
223
207
            local = self._check_local.get_active()
224
208
        else:
225
209
            local = False
226
 
 
227
 
        if list(self.wt.unknowns()) != []:
228
 
            response = question_dialog(_("Commit with unknowns?"),
229
 
               _("Unknown files exist in the working tree. Commit anyway?"))
230
 
            if response == gtk.RESPONSE_NO:
231
 
                return
232
210
        
233
211
        try:
234
212
            self.wt.commit(message,
235
213
                       allow_pointless=False,
236
 
                       strict=False,
 
214
                       strict=self._check_strict.get_active(),
237
215
                       local=local,
238
216
                       specific_files=specific_files)
239
217
        except errors.PointlessCommit:
242
220
            if response == gtk.RESPONSE_YES:
243
221
                self.wt.commit(message,
244
222
                               allow_pointless=True,
245
 
                               strict=False,
 
223
                               strict=self._check_strict.get_active(),
246
224
                               local=local,
247
225
                               specific_files=specific_files)
248
226
        self.response(gtk.RESPONSE_OK)