/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/backend/fileops.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-08-02 20:35:25 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060802203525-9cb57147463c2672
Implemented context menu for the file list.

2006-08-02  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * cmenu.ui: context menu UIManager description added
    * setup.py: install cmenu.ui to the appropriate place
    * olive/frontend/gtk/menu.py: implement the context menus
    * olive/frontend/gtk/__init__.py: added button_press_event for file list
    * olive/frontend/gtk/handler.py: handling that even (show popup menu)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
2
2
# Some parts of the code are:
3
3
# Copyright (C) 2005, 2006 by Canonical Ltd
4
 
#
 
4
 
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
7
7
# the Free Software Foundation; either version 2 of the License, or
8
8
# (at your option) any later version.
9
 
#
 
9
 
10
10
# This program is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
# GNU General Public License for more details.
14
 
#
 
14
 
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
22
 
23
23
from errors import (DirectoryAlreadyExists, MissingArgumentError,
24
24
                    MultipleMoveError, NoFilesSpecified, NoMatchingFiles,
25
 
                    NonExistingSource, NotBranchError, NotSameBranchError,
26
 
                    NotVersionedError, PermissionDenied)
 
25
                    NonExistingSource, NotBranchError, NotVersionedError)
27
26
 
28
27
def add(file_list, recursive=False):
29
28
    """ Add listed files to the branch. 
62
61
        if e.errno == 17:
63
62
            raise DirectoryAlreadyExists(directory)
64
63
    else:
65
 
        try:
66
 
            wt, dd = WorkingTree.open_containing(directory)
67
 
        except errors.NotBranchError:
68
 
            raise NotBranchError
69
 
        else:
70
 
            wt.add([dd])
 
64
        wt, dd = WorkingTree.open_containing(directory)
 
65
        wt.add([dd])
71
66
 
72
67
def move(names_list):
73
68
    """ Move or rename given files.
78
73
    
79
74
    if len(names_list) < 2:
80
75
        raise MissingArgumentError
81
 
    
82
 
    try:
83
 
        tree, rel_names = tree_files(names_list)
84
 
    except errors.NotBranchError:
85
 
        raise NotBranchError
86
 
    except errors.BzrCommandError:
87
 
        # not the same branch presumably
88
 
        raise NotSameBranchError
 
76
    tree, rel_names = tree_files(names_list)
89
77
        
90
78
    if os.path.isdir(names_list[-1]):
91
79
        # move into existing directory
103
91
    
104
92
    :param new: if True, the 'added' files will be removed
105
93
    """
106
 
    import bzrlib
107
94
    from bzrlib.builtins import tree_files
108
95
    
109
96
    try:
118
105
            raise NoFilesSpecified
119
106
    else:
120
107
        from bzrlib.delta import compare_trees
121
 
        if (bzrlib.version_info[0] == 0) and (bzrlib.version_info[1] < 9):
122
 
            added = [compare_trees(tree.basis_tree(), tree,
123
 
                                   specific_files=file_list).added]
124
 
        else:
125
 
            added = [tree.changes_from(tree.basis_tree(),
126
 
                                       specific_files=file_list).added]
 
108
        added = [compare_trees(tree.basis_tree(), tree,
 
109
                               specific_files=file_list).added]
127
110
        file_list = sorted([f[0] for f in added[0]], reverse=True)
128
111
        if len(file_list) == 0:
129
112
            raise NoMatchingFiles
160
143
        tree1 = WorkingTree.open_containing(filename)[0]
161
144
    except errors.NotBranchError:
162
145
        return 'unknown'
163
 
    except errors.PermissionDenied:
164
 
        raise PermissionDenied(filename)
165
146
    
166
147
    branch = tree1.branch
167
148
    tree2 = tree1.branch.repository.revision_tree(branch.last_revision())