29
30
import bzrlib.errors as errors
31
from bzrlib.plugins.gtk import _i18n
32
from bzrlib.plugins.gtk.dialog import error_dialog
33
from guifiles import GLADEFILENAME
32
from olive import gladefile
33
from dialog import error_dialog
37
36
""" Display the Add file(s) dialog and perform the needed actions. """
38
37
def __init__(self, wt, wtpath, selected=[]):
39
38
""" Initialize the Add file(s) dialog. """
40
self.glade = gtk.glade.XML(GLADEFILENAME, 'window_add', 'olive-gtk')
39
self.glade = gtk.glade.XML(gladefile, 'window_add', 'olive-gtk')
42
41
self.window = self.glade.get_widget('window_add')
65
64
filename = self.selected
67
66
if filename is None:
68
error_dialog(_i18n('No file was selected'),
69
_i18n('Please select a file from the list,\nor choose the other option.'))
67
error_dialog(_('No file was selected'),
68
_('Please select a file from the list,\nor choose the other option.'))
72
fullpath = self.wt.abspath(os.path.join(self.wtpath, filename))
72
fullpath = self.wt.abspath(filename)
74
fullpath = self.wt.abspath(self.wtpath + os.sep + filename)
75
77
bzrlib.add.smart_add([fullpath])
76
78
except errors.NotBranchError:
77
error_dialog(_i18n('Directory is not a branch'),
78
_i18n('You can perform this action only in a branch.'))
79
error_dialog(_('Directory is not a branch'),
80
_('You can perform this action only in a branch.'))
80
82
elif radio_unknown.get_active():
81
83
# Add unknown files recursively
82
fullpath = self.wt.abspath(self.wtpath)
85
bzrlib.add.smart_add([fullpath], True)
85
bzrlib.add.smart_add([self.wtpath], True)
86
86
except errors.NotBranchError:
87
error_dialog(_i18n('Directory is not a branch'),
88
_i18n('You can perform this action only in a branch.'))
87
error_dialog(_('Directory is not a branch'),
88
_('You can perform this action only in a branch.'))