eric6/Plugins/VcsPlugins/vcsSubversion/SvnPropListDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
36 """ 36 """
37 super(SvnPropListDialog, self).__init__(parent) 37 super(SvnPropListDialog, self).__init__(parent)
38 self.setupUi(self) 38 self.setupUi(self)
39 39
40 self.refreshButton = self.buttonBox.addButton( 40 self.refreshButton = self.buttonBox.addButton(
41 self.tr("Refresh"), QDialogButtonBox.ActionRole) 41 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole)
42 self.refreshButton.setToolTip( 42 self.refreshButton.setToolTip(
43 self.tr("Press to refresh the properties display")) 43 self.tr("Press to refresh the properties display"))
44 self.refreshButton.setEnabled(False) 44 self.refreshButton.setEnabled(False)
45 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 45 self.buttonBox.button(
46 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 46 QDialogButtonBox.StandardButton.Close).setEnabled(False)
47 self.buttonBox.button(
48 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
47 49
48 self.process = QProcess() 50 self.process = QProcess()
49 env = QProcessEnvironment.systemEnvironment() 51 env = QProcessEnvironment.systemEnvironment()
50 env.insert("LANG", "C") 52 env.insert("LANG", "C")
51 self.process.setProcessEnvironment(env) 53 self.process.setProcessEnvironment(env)
52 self.vcs = vcs 54 self.vcs = vcs
53 55
54 self.propsList.headerItem().setText(self.propsList.columnCount(), "") 56 self.propsList.headerItem().setText(self.propsList.columnCount(), "")
55 self.propsList.header().setSortIndicator(0, Qt.AscendingOrder) 57 self.propsList.header().setSortIndicator(
58 0, Qt.SortOrder.AscendingOrder)
56 59
57 self.process.finished.connect(self.__procFinished) 60 self.process.finished.connect(self.__procFinished)
58 self.process.readyReadStandardOutput.connect(self.__readStdout) 61 self.process.readyReadStandardOutput.connect(self.__readStdout)
59 self.process.readyReadStandardError.connect(self.__readStderr) 62 self.process.readyReadStandardError.connect(self.__readStderr)
60 63
71 74
72 def __resizeColumns(self): 75 def __resizeColumns(self):
73 """ 76 """
74 Private method to resize the list columns. 77 Private method to resize the list columns.
75 """ 78 """
76 self.propsList.header().resizeSections(QHeaderView.ResizeToContents) 79 self.propsList.header().resizeSections(
80 QHeaderView.ResizeMode.ResizeToContents)
77 self.propsList.header().setStretchLastSection(True) 81 self.propsList.header().setStretchLastSection(True)
78 82
79 def __generateItem(self, path, propName, propValue): 83 def __generateItem(self, path, propName, propValue):
80 """ 84 """
81 Private method to generate a properties item in the properties list. 85 Private method to generate a properties item in the properties list.
92 96
93 @param e close event (QCloseEvent) 97 @param e close event (QCloseEvent)
94 """ 98 """
95 if ( 99 if (
96 self.process is not None and 100 self.process is not None and
97 self.process.state() != QProcess.NotRunning 101 self.process.state() != QProcess.ProcessState.NotRunning
98 ): 102 ):
99 self.process.terminate() 103 self.process.terminate()
100 QTimer.singleShot(2000, self.process.kill) 104 QTimer.singleShot(2000, self.process.kill)
101 self.process.waitForFinished(3000) 105 self.process.waitForFinished(3000)
102 106
117 self.propBuffer = "" 121 self.propBuffer = ""
118 122
119 self.__args = fn 123 self.__args = fn
120 self.__recursive = recursive 124 self.__recursive = recursive
121 125
122 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 126 self.buttonBox.button(
123 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 127 QDialogButtonBox.StandardButton.Close).setEnabled(False)
124 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 128 self.buttonBox.button(
129 QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
130 self.buttonBox.button(
131 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
125 self.refreshButton.setEnabled(False) 132 self.refreshButton.setEnabled(False)
126 133
127 self.process.kill() 134 self.process.kill()
128 135
129 args = [] 136 args = []
157 Private slot called when the process finished or the user pressed the 164 Private slot called when the process finished or the user pressed the
158 button. 165 button.
159 """ 166 """
160 if ( 167 if (
161 self.process is not None and 168 self.process is not None and
162 self.process.state() != QProcess.NotRunning 169 self.process.state() != QProcess.ProcessState.NotRunning
163 ): 170 ):
164 self.process.terminate() 171 self.process.terminate()
165 QTimer.singleShot(2000, self.process.kill) 172 QTimer.singleShot(2000, self.process.kill)
166 self.process.waitForFinished(3000) 173 self.process.waitForFinished(3000)
167 174
168 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 175 self.buttonBox.button(
169 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 176 QDialogButtonBox.StandardButton.Close).setEnabled(True)
170 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 177 self.buttonBox.button(
178 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
179 self.buttonBox.button(
180 QDialogButtonBox.StandardButton.Close).setDefault(True)
171 181
172 self.refreshButton.setEnabled(True) 182 self.refreshButton.setEnabled(True)
173 183
174 if self.lastProp: 184 if self.lastProp:
175 self.__generateItem(self.lastPath, self.lastProp, self.propBuffer) 185 self.__generateItem(self.lastPath, self.lastProp, self.propBuffer)
181 """ 191 """
182 Private slot called by a button of the button box clicked. 192 Private slot called by a button of the button box clicked.
183 193
184 @param button button that was clicked (QAbstractButton) 194 @param button button that was clicked (QAbstractButton)
185 """ 195 """
186 if button == self.buttonBox.button(QDialogButtonBox.Close): 196 if button == self.buttonBox.button(
197 QDialogButtonBox.StandardButton.Close
198 ):
187 self.close() 199 self.close()
188 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 200 elif button == self.buttonBox.button(
201 QDialogButtonBox.StandardButton.Cancel
202 ):
189 self.__finish() 203 self.__finish()
190 elif button == self.refreshButton: 204 elif button == self.refreshButton:
191 self.on_refreshButton_clicked() 205 self.on_refreshButton_clicked()
192 206
193 @pyqtSlot() 207 @pyqtSlot()
214 Private slot to handle the readyReadStandardOutput signal. 228 Private slot to handle the readyReadStandardOutput signal.
215 229
216 It reads the output of the process, formats it and inserts it into 230 It reads the output of the process, formats it and inserts it into
217 the contents pane. 231 the contents pane.
218 """ 232 """
219 self.process.setReadChannel(QProcess.StandardOutput) 233 self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
220 234
221 while self.process.canReadLine(): 235 while self.process.canReadLine():
222 s = str(self.process.readLine(), 236 s = str(self.process.readLine(),
223 Preferences.getSystem("IOEncoding"), 237 Preferences.getSystem("IOEncoding"),
224 'replace') 238 'replace')

eric ide

mercurial