10 |
10 |
11 |
11 |
12 import os |
12 import os |
13 |
13 |
14 from PyQt5.QtCore import QTimer, QProcess, QRegExp, Qt, pyqtSlot |
14 from PyQt5.QtCore import QTimer, QProcess, QRegExp, Qt, pyqtSlot |
15 from PyQt5.QtWidgets import QWidget, QHeaderView, QLineEdit, QApplication, \ |
15 from PyQt5.QtWidgets import ( |
16 QMenu, QDialogButtonBox, QTreeWidgetItem |
16 QWidget, QHeaderView, QLineEdit, QApplication, QMenu, QDialogButtonBox, |
|
17 QTreeWidgetItem |
|
18 ) |
17 |
19 |
18 from E5Gui.E5Application import e5App |
20 from E5Gui.E5Application import e5App |
19 from E5Gui import E5MessageBox |
21 from E5Gui import E5MessageBox |
20 |
22 |
21 from .Ui_SvnStatusDialog import Ui_SvnStatusDialog |
23 from .Ui_SvnStatusDialog import Ui_SvnStatusDialog |
49 self.__lockinfoColumn = 7 |
51 self.__lockinfoColumn = 7 |
50 self.__upToDateColumn = 8 |
52 self.__upToDateColumn = 8 |
51 self.__pathColumn = 12 |
53 self.__pathColumn = 12 |
52 self.__lastColumn = self.statusList.columnCount() |
54 self.__lastColumn = self.statusList.columnCount() |
53 |
55 |
54 self.refreshButton = \ |
56 self.refreshButton = self.buttonBox.addButton( |
55 self.buttonBox.addButton(self.tr("Refresh"), |
57 self.tr("Refresh"), QDialogButtonBox.ActionRole) |
56 QDialogButtonBox.ActionRole) |
|
57 self.refreshButton.setToolTip( |
58 self.refreshButton.setToolTip( |
58 self.tr("Press to refresh the status display")) |
59 self.tr("Press to refresh the status display")) |
59 self.refreshButton.setEnabled(False) |
60 self.refreshButton.setEnabled(False) |
60 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
61 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
61 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
62 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
196 } |
197 } |
197 |
198 |
198 self.rx_status = QRegExp( |
199 self.rx_status = QRegExp( |
199 '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*') |
200 '(.{8,9})\\s+([0-9-]+)\\s+([0-9?]+)\\s+(\\S+)\\s+(.+)\\s*') |
200 # flags (8 or 9 anything), revision, changed rev, author, path |
201 # flags (8 or 9 anything), revision, changed rev, author, path |
201 self.rx_status2 = \ |
202 self.rx_status2 = QRegExp('(.{8,9})\\s+(.+)\\s*') |
202 QRegExp('(.{8,9})\\s+(.+)\\s*') |
|
203 # flags (8 or 9 anything), path |
203 # flags (8 or 9 anything), path |
204 self.rx_changelist = \ |
204 self.rx_changelist = QRegExp('--- \\S+ .([\\w\\s]+).:\\s+') |
205 QRegExp('--- \\S+ .([\\w\\s]+).:\\s+') |
|
206 # three dashes, Changelist (translated), quote, |
205 # three dashes, Changelist (translated), quote, |
207 # changelist name, quote, : |
206 # changelist name, quote, : |
208 |
207 |
209 self.__nonverbose = True |
208 self.__nonverbose = True |
210 |
209 |
238 @param revision revision string (string) |
237 @param revision revision string (string) |
239 @param change revision of last change (string) |
238 @param change revision of last change (string) |
240 @param author author of the last change (string) |
239 @param author author of the last change (string) |
241 @param path path of the file or directory (string) |
240 @param path path of the file or directory (string) |
242 """ |
241 """ |
243 if self.__nonverbose and \ |
242 if ( |
244 status == " " and \ |
243 self.__nonverbose and |
245 propStatus == " " and \ |
244 status == " " and |
246 locked == " " and \ |
245 propStatus == " " and |
247 history == " " and \ |
246 locked == " " and |
248 switched == " " and \ |
247 history == " " and |
249 lockinfo == " " and \ |
248 switched == " " and |
250 uptodate == " " and \ |
249 lockinfo == " " and |
251 self.currentChangelist == "": |
250 uptodate == " " and |
|
251 self.currentChangelist == "" |
|
252 ): |
252 return |
253 return |
253 |
254 |
254 if revision == "": |
255 if revision == "": |
255 rev = "" |
256 rev = "" |
256 else: |
257 else: |
299 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
300 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
300 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
301 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
301 else: |
302 else: |
302 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) |
303 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) |
303 |
304 |
304 self.hidePropertyStatusColumn = self.hidePropertyStatusColumn and \ |
305 self.hidePropertyStatusColumn = ( |
|
306 self.hidePropertyStatusColumn and |
305 propStatus == " " |
307 propStatus == " " |
306 self.hideLockColumns = self.hideLockColumns and \ |
308 ) |
307 locked == " " and lockinfo == " " |
309 self.hideLockColumns = ( |
|
310 self.hideLockColumns and |
|
311 locked == " " and |
|
312 lockinfo == " " |
|
313 ) |
308 self.hideUpToDateColumn = self.hideUpToDateColumn and uptodate == " " |
314 self.hideUpToDateColumn = self.hideUpToDateColumn and uptodate == " " |
309 self.hideHistoryColumn = self.hideHistoryColumn and history == " " |
315 self.hideHistoryColumn = self.hideHistoryColumn and history == " " |
310 self.hideSwitchedColumn = self.hideSwitchedColumn and switched == " " |
316 self.hideSwitchedColumn = self.hideSwitchedColumn and switched == " " |
311 |
317 |
312 if statusText not in self.__statusFilters: |
318 if statusText not in self.__statusFilters: |
316 """ |
322 """ |
317 Protected slot implementing a close event handler. |
323 Protected slot implementing a close event handler. |
318 |
324 |
319 @param e close event (QCloseEvent) |
325 @param e close event (QCloseEvent) |
320 """ |
326 """ |
321 if self.process is not None and \ |
327 if ( |
322 self.process.state() != QProcess.NotRunning: |
328 self.process is not None and |
|
329 self.process.state() != QProcess.NotRunning |
|
330 ): |
323 self.process.terminate() |
331 self.process.terminate() |
324 QTimer.singleShot(2000, self.process.kill) |
332 QTimer.singleShot(2000, self.process.kill) |
325 self.process.waitForFinished(3000) |
333 self.process.waitForFinished(3000) |
326 |
334 |
327 e.accept() |
335 e.accept() |
364 |
372 |
365 args = [] |
373 args = [] |
366 args.append('status') |
374 args.append('status') |
367 self.vcs.addArguments(args, self.vcs.options['global']) |
375 self.vcs.addArguments(args, self.vcs.options['global']) |
368 self.vcs.addArguments(args, self.vcs.options['status']) |
376 self.vcs.addArguments(args, self.vcs.options['status']) |
369 if '--verbose' not in self.vcs.options['global'] and \ |
377 if ( |
370 '--verbose' not in self.vcs.options['status']: |
378 '--verbose' not in self.vcs.options['global'] and |
|
379 '--verbose' not in self.vcs.options['status'] |
|
380 ): |
371 args.append('--verbose') |
381 args.append('--verbose') |
372 self.__nonverbose = True |
382 self.__nonverbose = True |
373 else: |
383 else: |
374 self.__nonverbose = False |
384 self.__nonverbose = False |
375 if '--show-updates' in self.vcs.options['status'] or \ |
385 if ( |
376 '-u' in self.vcs.options['status']: |
386 '--show-updates' in self.vcs.options['status'] or |
|
387 '-u' in self.vcs.options['status'] |
|
388 ): |
377 self.activateWindow() |
389 self.activateWindow() |
378 self.raise_() |
390 self.raise_() |
379 if isinstance(fn, list): |
391 if isinstance(fn, list): |
380 self.dname, fnames = self.vcs.splitPathList(fn) |
392 self.dname, fnames = self.vcs.splitPathList(fn) |
381 self.vcs.addArguments(args, fnames) |
393 self.vcs.addArguments(args, fnames) |
411 def __finish(self): |
423 def __finish(self): |
412 """ |
424 """ |
413 Private slot called when the process finished or the user pressed |
425 Private slot called when the process finished or the user pressed |
414 the button. |
426 the button. |
415 """ |
427 """ |
416 if self.process is not None and \ |
428 if ( |
417 self.process.state() != QProcess.NotRunning: |
429 self.process is not None and |
|
430 self.process.state() != QProcess.NotRunning |
|
431 ): |
418 self.process.terminate() |
432 self.process.terminate() |
419 QTimer.singleShot(2000, self.process.kill) |
433 QTimer.singleShot(2000, self.process.kill) |
420 self.process.waitForFinished(3000) |
434 self.process.waitForFinished(3000) |
421 |
435 |
422 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
436 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
971 |
985 |
972 @return list of all items with a modified status |
986 @return list of all items with a modified status |
973 """ |
987 """ |
974 modifiedItems = [] |
988 modifiedItems = [] |
975 for itm in self.statusList.selectedItems(): |
989 for itm in self.statusList.selectedItems(): |
976 if itm.text(self.__statusColumn) in self.modifiedIndicators or \ |
990 if ( |
977 itm.text(self.__propStatusColumn) in self.modifiedIndicators: |
991 itm.text(self.__statusColumn) in self.modifiedIndicators or |
|
992 itm.text(self.__propStatusColumn) in self.modifiedIndicators |
|
993 ): |
978 modifiedItems.append(itm) |
994 modifiedItems.append(itm) |
979 return modifiedItems |
995 return modifiedItems |
980 |
996 |
981 def __getUnversionedItems(self): |
997 def __getUnversionedItems(self): |
982 """ |
998 """ |