5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to browse the change lists. |
7 Module implementing a dialog to browse the change lists. |
8 """ |
8 """ |
9 |
9 |
10 |
|
11 import os |
10 import os |
12 |
11 |
13 import pysvn |
12 import pysvn |
14 |
13 |
15 from PyQt5.QtCore import pyqtSlot, Qt, QMutexLocker |
14 from PyQt5.QtCore import pyqtSlot, Qt, QMutexLocker |
16 from PyQt5.QtGui import QCursor |
15 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QListWidgetItem |
17 from PyQt5.QtWidgets import ( |
16 |
18 QDialog, QDialogButtonBox, QListWidgetItem, QApplication |
17 from E5Gui.E5OverrideCursor import E5OverrideCursor |
19 ) |
|
20 |
18 |
21 from .SvnDialogMixin import SvnDialogMixin |
19 from .SvnDialogMixin import SvnDialogMixin |
22 |
20 |
23 from .Ui_SvnChangeListsDialog import Ui_SvnChangeListsDialog |
21 from .Ui_SvnChangeListsDialog import Ui_SvnChangeListsDialog |
24 |
22 |
76 self.cancelled = False |
74 self.cancelled = False |
77 |
75 |
78 self.filesLabel.setText( |
76 self.filesLabel.setText( |
79 self.tr("Files (relative to {0}):").format(path)) |
77 self.tr("Files (relative to {0}):").format(path)) |
80 |
78 |
81 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) |
79 with E5OverrideCursor(): |
82 QApplication.processEvents() |
80 locker = QMutexLocker(self.vcs.vcsExecutionMutex) |
83 |
81 try: |
84 locker = QMutexLocker(self.vcs.vcsExecutionMutex) |
82 entries = self.client.get_changelist( |
85 try: |
83 path, depth=pysvn.depth.infinity) |
86 entries = self.client.get_changelist( |
84 for entry in entries: |
87 path, depth=pysvn.depth.infinity) |
85 file = entry[0] |
88 for entry in entries: |
86 changelist = entry[1] |
89 file = entry[0] |
87 if changelist not in self.changeListsDict: |
90 changelist = entry[1] |
88 self.changeListsDict[changelist] = [] |
91 if changelist not in self.changeListsDict: |
89 filename = file.replace(path + os.sep, "") |
92 self.changeListsDict[changelist] = [] |
90 if filename not in self.changeListsDict[changelist]: |
93 filename = file.replace(path + os.sep, "") |
91 self.changeListsDict[changelist].append(filename) |
94 if filename not in self.changeListsDict[changelist]: |
92 except pysvn.ClientError as e: |
95 self.changeListsDict[changelist].append(filename) |
93 locker.unlock() |
96 except pysvn.ClientError as e: |
94 self.__showError(e.args[0]) |
97 locker.unlock() |
|
98 self.__showError(e.args[0]) |
|
99 self.__finish() |
95 self.__finish() |
100 |
96 |
101 def __finish(self): |
97 def __finish(self): |
102 """ |
98 """ |
103 Private slot called when the user pressed the button. |
99 Private slot called when the user pressed the button. |
104 """ |
100 """ |
105 self.changeLists.addItems(sorted(self.changeListsDict.keys())) |
101 self.changeLists.addItems(sorted(self.changeListsDict.keys())) |
106 QApplication.restoreOverrideCursor() |
|
107 |
102 |
108 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
103 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
109 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
104 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
110 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
105 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
111 |
106 |