/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 olive/mkdir.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-09-30 13:04:15 UTC
  • mto: (0.14.3 main)
  • mto: This revision was merged to the branch mainline in revision 86.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060930130415-aba4100709e11f0a
Loads of fixes. Pyflakes cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
import bzrlib.errors as errors
29
29
 
30
 
from bzrlib.plugins.gtk import _i18n
31
 
from bzrlib.plugins.gtk.dialog import error_dialog, warning_dialog
32
 
from guifiles import GLADEFILENAME
33
 
 
34
 
from bzrlib.plugins.gtk.errors import show_bzr_error
35
 
 
 
30
from olive import gladefile
 
31
from dialog import error_dialog, warning_dialog
36
32
 
37
33
class OliveMkdir:
38
34
    """ Display the Make directory dialog and perform the needed actions. """
39
35
    def __init__(self, wt, wtpath):
40
36
        """ Initialize the Make directory dialog. """
41
 
        self.glade = gtk.glade.XML(GLADEFILENAME, 'window_mkdir', 'olive-gtk')
 
37
        self.glade = gtk.glade.XML(gladefile, 'window_mkdir', 'olive-gtk')
42
38
        
43
39
        self.window = self.glade.get_widget('window_mkdir')
44
40
        
56
52
        """ Display the Make directory dialog. """
57
53
        self.window.show_all()
58
54
 
59
 
    @show_bzr_error
60
55
    def mkdir(self, widget):
61
56
        # Get the widgets
62
57
        entry = self.glade.get_widget('entry_mkdir')
65
60
        dirname = entry.get_text()
66
61
        
67
62
        if dirname == "":
68
 
            error_dialog(_i18n('No directory name given'),
69
 
                         _i18n('Please specify a desired name for the new directory.'))
 
63
            error_dialog(_('No directory name given'),
 
64
                         _('Please specify a desired name for the new directory.'))
70
65
            return
71
66
        
72
67
        if checkbox.get_active():
77
72
                self.wt.add([os.path.join(self.wtpath, dirname)])
78
73
            except OSError, e:
79
74
                if e.errno == 17:
80
 
                    error_dialog(_i18n('Directory already exists'),
81
 
                                 _i18n('Please specify another name to continue.'))
 
75
                    error_dialog(_('Directory already exists'),
 
76
                                 _('Please specify another name to continue.'))
82
77
                else:
83
78
                    raise
 
79
            except errors.NotBranchError:
 
80
                warning_dialog(_('Directory is not in a branch'),
 
81
                               _('You can only create a non-versioned directory.'))
84
82
        else:
85
83
            # Just a simple directory
86
84
            try:
87
85
                os.mkdir(os.path.join(self.wt.basedir, self.wtpath, dirname))
88
86
            except OSError, e:
89
87
                if e.errno == 17:
90
 
                    error_dialog(_i18n('Directory already exists'),
91
 
                                 _i18n('Please specify another name to continue.'))
 
88
                    error_dialog(_('Directory already exists'),
 
89
                                 _('Please specify another name to continue.'))
92
90
                    return
93
91
 
94
92
        self.close()