/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-09-30 10:21:43 UTC
  • Revision ID: jelmer@samba.org-20060930102143-c0ef64d6ca860c21
Merge some files from Olive and bzr-gtk.

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
18
19
 
19
20
try:
20
21
    import pygtk
28
29
import bzrlib.errors as errors
29
30
 
30
31
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
50
47
 
51
48
    def display(self):
52
49
        """ Display the Make directory dialog. """
61
58
        
62
59
        if dirname == "":
63
60
            error_dialog(_('No directory name given'),
64
 
                         _('Please specify a desired name for the new directory.'))
 
61
                                     _('Please specify a desired name for the new directory.'))
65
62
            return
66
63
        
67
64
        if checkbox.get_active():
68
65
            # Want to create a versioned directory
69
66
            try:
70
 
                os.mkdir(os.path.join(self.wt.basedir, self.wtpath, dirname))
 
67
                from bzrlib.workingtree import WorkingTree
 
68
    
 
69
                os.mkdir(os.path.join(wt.base, wtpath))
71
70
 
72
 
                self.wt.add([os.path.join(self.wtpath, dirname)])
 
71
                wt.add([wtpath])
73
72
            except OSError, e:
74
73
                if e.errno == 17:
75
74
                    error_dialog(_('Directory already exists'),
76
 
                                 _('Please specify another name to continue.'))
 
75
                                             _('Please specify another name to continue.'))
77
76
                else:
78
77
                    raise
79
78
            except errors.NotBranchError:
80
79
                warning_dialog(_('Directory is not in a branch'),
81
 
                               _('You can only create a non-versioned directory.'))
 
80
                                           _('You can only create a non-versioned directory.'))
82
81
        else:
83
82
            # Just a simple directory
84
83
            try:
85
 
                os.mkdir(os.path.join(self.wt.basedir, self.wtpath, dirname))
 
84
                os.mkdir(os.path.join(wt.base, wtpath))
86
85
            except OSError, e:
87
86
                if e.errno == 17:
88
87
                    error_dialog(_('Directory already exists'),
89
 
                                 _('Please specify another name to continue.'))
 
88
                                             _('Please specify another name to continue.'))
90
89
                    return
91
90
 
92
91
        self.close()
 
92
        self.comm.refresh_right()
93
93
    
94
94
    def close(self, widget=None):
95
95
        self.window.destroy()