/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: Jelmer Vernooij
  • Date: 2006-10-01 01:56:17 UTC
  • mfrom: (0.8.98 merge)
  • Revision ID: jelmer@samba.org-20061001015617-9827cc403415cbf0
[merge] more changes from Szilveszter

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
18
 
import sys
19
18
 
20
19
try:
21
20
    import pygtk
29
28
import bzrlib.errors as errors
30
29
 
31
30
from olive import gladefile
 
31
from dialog import error_dialog, warning_dialog
32
32
 
33
33
class OliveMkdir:
34
34
    """ Display the Make directory dialog and perform the needed actions. """
44
44
        
45
45
        # Connect the signals to the handlers
46
46
        self.glade.signal_autoconnect(dic)
 
47
        
 
48
        self.wt = wt
 
49
        self.wtpath = wtpath
47
50
 
48
51
    def display(self):
49
52
        """ Display the Make directory dialog. """
58
61
        
59
62
        if dirname == "":
60
63
            error_dialog(_('No directory name given'),
61
 
                                     _('Please specify a desired name for the new directory.'))
 
64
                         _('Please specify a desired name for the new directory.'))
62
65
            return
63
66
        
64
67
        if checkbox.get_active():
65
68
            # Want to create a versioned directory
66
69
            try:
67
 
                from bzrlib.workingtree import WorkingTree
68
 
    
69
 
                os.mkdir(os.path.join(wt.base, wtpath))
 
70
                os.mkdir(os.path.join(self.wt.basedir, self.wtpath, dirname))
70
71
 
71
 
                wt.add([wtpath])
 
72
                self.wt.add([os.path.join(self.wtpath, dirname)])
72
73
            except OSError, e:
73
74
                if e.errno == 17:
74
75
                    error_dialog(_('Directory already exists'),
75
 
                                             _('Please specify another name to continue.'))
 
76
                                 _('Please specify another name to continue.'))
76
77
                else:
77
78
                    raise
78
79
            except errors.NotBranchError:
79
80
                warning_dialog(_('Directory is not in a branch'),
80
 
                                           _('You can only create a non-versioned directory.'))
 
81
                               _('You can only create a non-versioned directory.'))
81
82
        else:
82
83
            # Just a simple directory
83
84
            try:
84
 
                os.mkdir(os.path.join(wt.base, wtpath))
 
85
                os.mkdir(os.path.join(self.wt.basedir, self.wtpath, dirname))
85
86
            except OSError, e:
86
87
                if e.errno == 17:
87
88
                    error_dialog(_('Directory already exists'),
88
 
                                             _('Please specify another name to continue.'))
 
89
                                 _('Please specify another name to continue.'))
89
90
                    return
90
91
 
91
92
        self.close()
92
 
        self.comm.refresh_right()
93
93
    
94
94
    def close(self, widget=None):
95
95
        self.window.destroy()