~ubuntu-branches/debian/sid/tortoisehg/sid

« back to all changes in this revision

Viewing changes to tortoisehg/hgqt/wctxactions.py

  • Committer: Package Import Robot
  • Author(s): Ludovico Cavedon
  • Date: 2012-02-20 22:03:12 UTC
  • mfrom: (1.2.8)
  • Revision ID: package-import@ubuntu.com-20120220220312-11yhqpn8suxvwyg4
Tags: 2.3-1
* Imported Upstream version 2.3 (Closes: #660387, #658140).
* Update dependency on Merurual (2.1, 2.2).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
class WctxActions(QObject):
19
19
    'container class for working context actions'
20
20
 
21
 
    def __init__(self, repo, parent):
 
21
    def __init__(self, repo, parent, checkable=True):
22
22
        super(WctxActions, self).__init__(parent)
23
23
 
24
24
        self.menu = QMenu(parent)
41
41
        make(_('Copy patch'), copyPatch, frozenset('MAR!'), 'copy-patch')
42
42
        make(_('Edit'), edit, frozenset('MACI?'), 'edit-file', 'SHIFT+CTRL+E')
43
43
        make(_('Open'), openfile, frozenset('MACI?'), '', 'SHIFT+CTRL+O')
44
 
        make(_('Copy path'), copyPath, frozenset('MARC?!I'), '')
 
44
        allactions.append(None)
 
45
        make(_('Open subrepository'), opensubrepo, frozenset('S'),
 
46
            'thg-repository-open', 'ALT+CTRL+O')
 
47
        make(_('Explore subrepository'), explore, frozenset('S'),
 
48
            'system-file-manager', 'ALT+CTRL+E')
 
49
        make(_('Open terminal in subrepository'), terminal, frozenset('S'),
 
50
            'utilities-terminal', 'ALT+CTRL+T')
 
51
        allactions.append(None)
 
52
        make(_('Copy path'), copyPath, frozenset('MARC?!IS'), '')
45
53
        make(_('View missing'), viewmissing, frozenset('R!'))
46
54
        allactions.append(None)
47
55
        make(_('&Revert...'), revert, frozenset('MAR!'), 'hg-revert')
64
72
        allactions.append(None)
65
73
        make(_('Mark unresolved'), unmark, frozenset('r'))
66
74
        make(_('Mark resolved'), mark, frozenset('u'))
 
75
        if checkable:
 
76
            allactions.append(None)
 
77
            make(_('Check'), check, frozenset('MARC?!IS'), '')
 
78
            make(_('Uncheck'), uncheck, frozenset('MARC?!IS'), '')
67
79
        self.allactions = allactions
68
80
 
69
81
    def updateActionSensitivity(self, selrows):
159
171
                notify = func(parent, hu, repo, files)
160
172
                o, e = hu.getdata()
161
173
                if e:
162
 
                    QMessageBox.warning(parent, name + _(' errors'), e)
 
174
                    QMessageBox.warning(parent, name + _(' errors'),
 
175
                        hglib.tounicode(e))
163
176
                elif o:
164
 
                    QMessageBox.information(parent, name + _(' output'), o)
 
177
                    QMessageBox.information(parent, name + _(' output'),
 
178
                        hglib.tounicode(o))
165
179
                elif notify:
166
180
                    wfiles = [repo.wjoin(x) for x in files]
167
181
                    shlib.shell_notify(wfiles)
203
217
    clip = QApplication.clipboard()
204
218
    absfiles = [hglib.fromunicode(QDir.toNativeSeparators(repo.wjoin(fname)))
205
219
         for fname in files]
206
 
    clip.setText(os.linesep.join(absfiles))
 
220
    clip.setText(hglib.tounicode(os.linesep.join(absfiles)))
207
221
 
208
222
def vdiff(parent, ui, repo, files):
209
223
    dlg = visdiff.visualdiff(ui, repo, files, {})
216
230
def openfile(parent, ui, repo, files):
217
231
    qtlib.openfiles(repo, files, parent)
218
232
 
 
233
def opensubrepo(parent, ui, repo, files):
 
234
    for filename in files:
 
235
        path = os.path.join(repo.root, files[0])
 
236
        if os.path.isdir(path):
 
237
            parent.linkActivated.emit(u'subrepo:'+hglib.tounicode(path))
 
238
        else:
 
239
            QMessageBox.warning(self,
 
240
                _("Cannot open subrepository"),
 
241
                _("The selected subrepository does not exist on the working directory"))
 
242
 
 
243
def explore(parent, ui, repo, files):
 
244
    qtlib.openfiles(repo, files, parent)
 
245
 
 
246
def terminal(parent, ui, repo, files):
 
247
    for filename in files:
 
248
        root = repo.wjoin(filename)
 
249
        if os.path.isdir(root):
 
250
            qtlib.openshell(root, filename)
 
251
 
219
252
def viewmissing(parent, ui, repo, files):
220
253
    base, _ = visdiff.snapshot(repo, files, repo['.'])
221
254
    edit(parent, ui, repo, [os.path.join(base, f) for f in files])
385
418
    paths = [repo.wjoin(f) for f in files]
386
419
    commands.resolve(repo.ui, repo, *paths, **opts)
387
420
    return True
 
421
 
 
422
def check(parent, ui, repo, files):
 
423
    parent.tv.model().check(files)
 
424
    return True
 
425
 
 
426
def uncheck(parent, ui, repo, files):
 
427
    parent.tv.model().check(files, False)
 
428
    return True