eric6/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/ProjectHelper.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 7971
ff2971513d6d
permissions
-rw-r--r--

Updated copyright for 2021.

3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2014 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the shelve extension project helper.
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
10 from PyQt5.QtWidgets import QMenu
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
12 from E5Gui.E5Action import E5Action
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
13 from E5Gui import E5MessageBox
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
15 from ..HgExtensionProjectHelper import HgExtensionProjectHelper
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 class ShelveProjectHelper(HgExtensionProjectHelper):
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
3309
b5f782f7d43b Corrected a typo in the Mercurial shelve extension interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3297
diff changeset
20 Class implementing the shelve extension project helper.
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 def __init__(self):
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 Constructor
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
3484
645c12de6b0c Merge with default branch.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3345
diff changeset
26 super(ShelveProjectHelper, self).__init__()
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 def initActions(self):
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Public method to generate the action objects.
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
32 self.hgShelveAct = E5Action(
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
33 self.tr('Shelve changes'),
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
34 self.tr('Shelve changes...'),
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
35 0, 0, self, 'mercurial_shelve')
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
36 self.hgShelveAct.setStatusTip(self.tr(
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
37 'Shelve all current changes of the project'
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
38 ))
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
39 self.hgShelveAct.setWhatsThis(self.tr(
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
40 """<b>Shelve changes</b>"""
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
41 """<p>This shelves all current changes of the project.</p>"""
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
42 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3309
diff changeset
43 self.hgShelveAct.triggered.connect(self.__hgShelve)
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
44 self.actions.append(self.hgShelveAct)
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
45
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
46 self.hgShelveBrowserAct = E5Action(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
47 self.tr('Show shelve browser'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
48 self.tr('Show shelve browser...'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
49 0, 0, self, 'mercurial_shelve_browser')
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
50 self.hgShelveBrowserAct.setStatusTip(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
51 'Show a dialog with all shelves'
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
52 ))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
53 self.hgShelveBrowserAct.setWhatsThis(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
54 """<b>Show shelve browser...</b>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
55 """<p>This shows a dialog listing all available shelves."""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
56 """ Actions on these shelves may be executed via the"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
57 """ context menu.</p>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
58 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3309
diff changeset
59 self.hgShelveBrowserAct.triggered.connect(
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
60 self.__hgShelveBrowser)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
61 self.actions.append(self.hgShelveBrowserAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
62
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
63 self.hgUnshelveAct = E5Action(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
64 self.tr('Restore shelved change'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
65 self.tr('Restore shelved change...'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
66 0, 0, self, 'mercurial_unshelve')
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
67 self.hgUnshelveAct.setStatusTip(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
68 'Restore a shelved change to the project directory'
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
69 ))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
70 self.hgUnshelveAct.setWhatsThis(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
71 """<b>Restore shelved change</b>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
72 """<p>This restore a shelved change to the project directory."""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
73 """</p>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
74 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3309
diff changeset
75 self.hgUnshelveAct.triggered.connect(self.__hgUnshelve)
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
76 self.actions.append(self.hgUnshelveAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
77
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
78 self.hgUnshelveAbortAct = E5Action(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
79 self.tr('Abort restore'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
80 self.tr('Abort restore...'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
81 0, 0, self, 'mercurial_unshelve_abort')
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
82 self.hgUnshelveAbortAct.setStatusTip(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
83 'Abort the restore operation in progress'
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
84 ))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
85 self.hgUnshelveAbortAct.setWhatsThis(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
86 """<b>Abort restore</b>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
87 """<p>This aborts the restore operation in progress and reverts"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
88 """ already applied changes.</p>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
89 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3309
diff changeset
90 self.hgUnshelveAbortAct.triggered.connect(self.__hgUnshelveAbort)
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
91 self.actions.append(self.hgUnshelveAbortAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
92
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
93 self.hgUnshelveContinueAct = E5Action(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
94 self.tr('Continue restore'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
95 self.tr('Continue restore...'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
96 0, 0, self, 'mercurial_unshelve_continue')
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
97 self.hgUnshelveContinueAct.setStatusTip(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
98 'Continue the restore operation in progress'
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
99 ))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
100 self.hgUnshelveContinueAct.setWhatsThis(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
101 """<b>Continue restore</b>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
102 """<p>This continues the restore operation in progress.</p>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
103 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3309
diff changeset
104 self.hgUnshelveContinueAct.triggered.connect(
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
105 self.__hgUnshelveContinue)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
106 self.actions.append(self.hgUnshelveContinueAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
107
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
108 self.hgShelveDeleteAct = E5Action(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
109 self.tr('Delete shelved changes'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
110 self.tr('Delete shelved changes...'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
111 0, 0, self, 'mercurial_shelve_delete')
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
112 self.hgShelveDeleteAct.setWhatsThis(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
113 """<b>Delete shelved changes...</b>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
114 """<p>This opens a dialog to select the shelved changes to"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
115 """ delete and deletes the selected ones.</p>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
116 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3309
diff changeset
117 self.hgShelveDeleteAct.triggered.connect(
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
118 self.__hgDeleteShelves)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
119 self.actions.append(self.hgShelveDeleteAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
120
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
121 self.hgShelveCleanupAct = E5Action(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
122 self.tr('Delete ALL shelved changes'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
123 self.tr('Delete ALL shelved changes'),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
124 0, 0, self, 'mercurial_shelve_cleanup')
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
125 self.hgShelveCleanupAct.setWhatsThis(self.tr(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
126 """<b>Delete ALL shelved changes</b>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
127 """<p>This deletes all shelved changes.</p>"""
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
128 ))
3345
071afe8be2a1 Changed signal/slot usage to not use constructs like 'triggered[()].connect(...)' anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3309
diff changeset
129 self.hgShelveCleanupAct.triggered.connect(
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
130 self.__hgCleanupShelves)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
131 self.actions.append(self.hgShelveCleanupAct)
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 def initMenu(self, mainMenu):
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 Public method to generate the extension menu.
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 @param mainMenu reference to the main menu (QMenu)
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 @return populated menu (QMenu)
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 menu = QMenu(self.menuTitle(), mainMenu)
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 menu.setTearOffEnabled(True)
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
143 menu.addAction(self.hgShelveAct)
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
144 menu.addSeparator()
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
145 menu.addAction(self.hgShelveBrowserAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
146 menu.addSeparator()
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
147 menu.addAction(self.hgUnshelveAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
148 menu.addAction(self.hgUnshelveContinueAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
149 menu.addAction(self.hgUnshelveAbortAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
150 menu.addSeparator()
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
151 menu.addAction(self.hgShelveDeleteAct)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
152 menu.addAction(self.hgShelveCleanupAct)
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
153
3290
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 return menu
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 def menuTitle(self):
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 Public method to get the menu title.
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 @return title of the menu (string)
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 """
dbb53746813f Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 return self.tr("Shelve")
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
163
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
164 def __reopenProject(self, shouldReopen, title):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
165 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
166 Private method to reopen the project if needed and wanted.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
167
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
168 @param shouldReopen flag indicating that the project should
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
169 be reopened (boolean)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
170 @param title title of the message box (string)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
171 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
172 if shouldReopen:
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
173 res = E5MessageBox.yesNo(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
174 None,
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
175 title,
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
176 self.tr("""The project should be reread. Do this now?"""),
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
177 yesDefault=True)
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
178 if res:
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
179 self.project.reopenProject()
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
180
3291
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
181 def __hgShelve(self):
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
182 """
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
183 Private slot used to shelve all current changes.
58e95eea9b6d Added the shelve function to the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3290
diff changeset
184 """
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
185 shouldReopen = self.vcs.getExtensionObject("shelve").hgShelve(
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
186 self.project.getProjectPath())
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
187 self.__reopenProject(shouldReopen, self.tr("Shelve"))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
188
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
189 def __hgShelveBrowser(self):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
190 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
191 Private slot to show the shelve browser dialog.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
192 """
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
193 self.vcs.getExtensionObject("shelve").hgShelveBrowser(
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
194 self.project.getProjectPath())
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
195
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
196 def __hgUnshelve(self):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
197 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
198 Private slot used to restore a shelved change.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
199 """
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
200 shouldReopen = self.vcs.getExtensionObject("shelve").hgUnshelve(
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
201 self.project.getProjectPath())
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
202 self.__reopenProject(shouldReopen, self.tr("Unshelve"))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
203
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
204 def __hgUnshelveAbort(self):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
205 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
206 Private slot used to abort an ongoing restore operation.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
207 """
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
208 shouldReopen = self.vcs.getExtensionObject("shelve").hgUnshelveAbort(
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
209 self.project.getProjectPath())
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
210 self.__reopenProject(shouldReopen, self.tr("Abort Unshelve"))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
211
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
212 def __hgUnshelveContinue(self):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
213 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
214 Private slot used to continue an ongoing restore operation.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
215 """
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
216 shouldReopen = (
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
217 self.vcs.getExtensionObject("shelve").hgUnshelveContinue(
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
218 self.project.getProjectPath())
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
219 )
3297
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
220 self.__reopenProject(shouldReopen, self.tr("Continue Unshelve"))
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
221
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
222 def __hgDeleteShelves(self):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
223 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
224 Private slot to delete selected shelves.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
225 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
226 self.vcs.getExtensionObject("shelve").hgDeleteShelves(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
227 self.project.getProjectPath())
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
228
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
229 def __hgCleanupShelves(self):
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
230 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
231 Private slot to delete all shelves.
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
232 """
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
233 self.vcs.getExtensionObject("shelve").hgCleanupShelves(
7b7e8124fb51 Continued implementing support for the Mercurial Shelve extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3291
diff changeset
234 self.project.getProjectPath())

eric ide

mercurial