12 try: |
12 try: |
13 str = unicode |
13 str = unicode |
14 except NameError: |
14 except NameError: |
15 pass |
15 pass |
16 |
16 |
17 from PyQt5.QtCore import QTimer, QProcess, QProcessEnvironment, QRegExp, Qt |
17 from PyQt5.QtCore import pyqtSlot, QTimer, QProcess, QProcessEnvironment, \ |
|
18 QRegExp, Qt |
18 from PyQt5.QtWidgets import QWidget, QHeaderView, QDialogButtonBox, \ |
19 from PyQt5.QtWidgets import QWidget, QHeaderView, QDialogButtonBox, \ |
19 QTreeWidgetItem |
20 QTreeWidgetItem |
20 |
21 |
21 from E5Gui import E5MessageBox |
22 from E5Gui import E5MessageBox |
22 |
23 |
28 class SvnPropListDialog(QWidget, Ui_SvnPropListDialog): |
29 class SvnPropListDialog(QWidget, Ui_SvnPropListDialog): |
29 """ |
30 """ |
30 Class implementing a dialog to show the output of the svn proplist command |
31 Class implementing a dialog to show the output of the svn proplist command |
31 process. |
32 process. |
32 """ |
33 """ |
|
34 # TODO: add refresh button |
33 def __init__(self, vcs, parent=None): |
35 def __init__(self, vcs, parent=None): |
34 """ |
36 """ |
35 Constructor |
37 Constructor |
36 |
38 |
37 @param vcs reference to the vcs object |
39 @param vcs reference to the vcs object |
38 @param parent parent widget (QWidget) |
40 @param parent parent widget (QWidget) |
39 """ |
41 """ |
40 super(SvnPropListDialog, self).__init__(parent) |
42 super(SvnPropListDialog, self).__init__(parent) |
41 self.setupUi(self) |
43 self.setupUi(self) |
42 |
44 |
|
45 self.refreshButton = \ |
|
46 self.buttonBox.addButton(self.tr("Refresh"), |
|
47 QDialogButtonBox.ActionRole) |
|
48 self.refreshButton.setToolTip( |
|
49 self.tr("Press to refresh the properties display")) |
|
50 self.refreshButton.setEnabled(False) |
43 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
51 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
44 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
52 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
45 |
53 |
46 self.process = QProcess() |
54 self.process = QProcess() |
47 env = QProcessEnvironment.systemEnvironment() |
55 env = QProcessEnvironment.systemEnvironment() |
56 self.process.readyReadStandardOutput.connect(self.__readStdout) |
64 self.process.readyReadStandardOutput.connect(self.__readStdout) |
57 self.process.readyReadStandardError.connect(self.__readStderr) |
65 self.process.readyReadStandardError.connect(self.__readStderr) |
58 |
66 |
59 self.rx_path = QRegExp(r"Properties on '([^']+)':\s*") |
67 self.rx_path = QRegExp(r"Properties on '([^']+)':\s*") |
60 self.rx_prop = QRegExp(r" (.*) *: *(.*)[\r\n]") |
68 self.rx_prop = QRegExp(r" (.*) *: *(.*)[\r\n]") |
61 self.lastPath = None |
|
62 self.lastProp = None |
|
63 self.propBuffer = "" |
|
64 |
69 |
65 def __resort(self): |
70 def __resort(self): |
66 """ |
71 """ |
67 Private method to resort the tree. |
72 Private method to resort the tree. |
68 """ |
73 """ |
107 |
112 |
108 @param fn filename(s) (string or list of string) |
113 @param fn filename(s) (string or list of string) |
109 @param recursive flag indicating a recursive list is requested |
114 @param recursive flag indicating a recursive list is requested |
110 """ |
115 """ |
111 self.errorGroup.hide() |
116 self.errorGroup.hide() |
|
117 |
|
118 self.propsList.clear() |
|
119 self.lastPath = None |
|
120 self.lastProp = None |
|
121 self.propBuffer = "" |
|
122 |
|
123 self.__args = fn |
|
124 self.__recursive = recursive |
|
125 |
|
126 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
|
127 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
|
128 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
|
129 self.refreshButton.setEnabled(False) |
112 |
130 |
113 self.process.kill() |
131 self.process.kill() |
114 |
132 |
115 args = [] |
133 args = [] |
116 args.append('proplist') |
134 args.append('proplist') |
151 |
169 |
152 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
170 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
153 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
171 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
154 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
172 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
155 |
173 |
156 self.process = None |
174 self.refreshButton.setEnabled(True) |
|
175 |
157 if self.lastProp: |
176 if self.lastProp: |
158 self.__generateItem(self.lastPath, self.lastProp, self.propBuffer) |
177 self.__generateItem(self.lastPath, self.lastProp, self.propBuffer) |
159 |
178 |
160 self.__resort() |
179 self.__resort() |
161 self.__resizeColumns() |
180 self.__resizeColumns() |
168 """ |
187 """ |
169 if button == self.buttonBox.button(QDialogButtonBox.Close): |
188 if button == self.buttonBox.button(QDialogButtonBox.Close): |
170 self.close() |
189 self.close() |
171 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
190 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
172 self.__finish() |
191 self.__finish() |
|
192 elif button == self.refreshButton: |
|
193 self.on_refreshButton_clicked() |
|
194 |
|
195 @pyqtSlot() |
|
196 def on_refreshButton_clicked(self): |
|
197 """ |
|
198 Private slot to refresh the status display. |
|
199 """ |
|
200 self.start(self.__args, recursive=self.__recursive) |
173 |
201 |
174 def __procFinished(self, exitCode, exitStatus): |
202 def __procFinished(self, exitCode, exitStatus): |
175 """ |
203 """ |
176 Private slot connected to the finished signal. |
204 Private slot connected to the finished signal. |
177 |
205 |