/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-29 09:31:57 UTC
  • mfrom: (0.12.2 olive)
  • mto: (0.14.3 main)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060929093157-da322bf8ce59c456
Merge from Jelmer Vernooij's integration branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    pygtk.require("2.0")
23
23
except:
24
24
    pass
25
 
try:
26
 
    import gtk
27
 
    import gtk.glade
28
 
except:
29
 
    sys.exit(1)
 
25
 
 
26
import gtk
 
27
import gtk.glade
30
28
 
31
29
import bzrlib.errors as errors
32
30
 
 
31
from olive import gladefile
 
32
 
33
33
class OliveMkdir:
34
34
    """ Display the Make directory dialog and perform the needed actions. """
35
 
    def __init__(self, gladefile, comm, dialog):
 
35
    def __init__(self, wt, wtpath):
36
36
        """ Initialize the Make directory dialog. """
37
 
        self.gladefile = gladefile
38
 
        self.glade = gtk.glade.XML(self.gladefile, 'window_mkdir', 'olive-gtk')
39
 
        
40
 
        # Communication object
41
 
        self.comm = comm
42
 
        # Dialog object
43
 
        self.dialog = dialog
 
37
        self.glade = gtk.glade.XML(gladefile, 'window_mkdir', 'olive-gtk')
44
38
        
45
39
        self.window = self.glade.get_widget('window_mkdir')
46
40
        
63
57
        dirname = entry.get_text()
64
58
        
65
59
        if dirname == "":
66
 
            self.dialog.error_dialog(_('No directory name given'),
 
60
            error_dialog(_('No directory name given'),
67
61
                                     _('Please specify a desired name for the new directory.'))
68
62
            return
69
63
        
70
 
        newdir = self.comm.get_path() + '/' + dirname
71
 
        
72
64
        if checkbox.get_active():
73
65
            # Want to create a versioned directory
74
66
            try:
75
67
                from bzrlib.workingtree import WorkingTree
76
68
    
77
 
                os.mkdir(newdir)
 
69
                os.mkdir(os.path.join(wt.base, wtpath))
78
70
 
79
 
                wt, dd = WorkingTree.open_containing(newdir)
80
 
                wt.add([dd])
 
71
                wt.add([wtpath])
81
72
            except OSError, e:
82
73
                if e.errno == 17:
83
 
                    self.dialog.error_dialog(_('Directory already exists'),
 
74
                    error_dialog(_('Directory already exists'),
84
75
                                             _('Please specify another name to continue.'))
85
76
                else:
86
77
                    raise
87
78
            except errors.NotBranchError:
88
 
                self.dialog.warning_dialog(_('Directory is not in a branch'),
 
79
                warning_dialog(_('Directory is not in a branch'),
89
80
                                           _('You can only create a non-versioned directory.'))
90
81
        else:
91
82
            # Just a simple directory
92
83
            try:
93
 
                os.mkdir(newdir)
 
84
                os.mkdir(os.path.join(wt.base, wtpath))
94
85
            except OSError, e:
95
86
                if e.errno == 17:
96
 
                    self.dialog.error_dialog(_('Directory already exists'),
 
87
                    error_dialog(_('Directory already exists'),
97
88
                                             _('Please specify another name to continue.'))
98
89
                    return
99
90