40 @param parent parent widget (QWidget) |
40 @param parent parent widget (QWidget) |
41 """ |
41 """ |
42 super(SvnRepoBrowserDialog, self).__init__(parent) |
42 super(SvnRepoBrowserDialog, self).__init__(parent) |
43 self.setupUi(self) |
43 self.setupUi(self) |
44 SvnDialogMixin.__init__(self) |
44 SvnDialogMixin.__init__(self) |
45 self.setWindowFlags(Qt.Window) |
45 self.setWindowFlags(Qt.WindowType.Window) |
46 |
46 |
47 self.repoTree.headerItem().setText(self.repoTree.columnCount(), "") |
47 self.repoTree.headerItem().setText(self.repoTree.columnCount(), "") |
48 self.repoTree.header().setSortIndicator(0, Qt.AscendingOrder) |
48 self.repoTree.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
49 |
49 |
50 self.vcs = vcs |
50 self.vcs = vcs |
51 self.mode = mode |
51 self.mode = mode |
52 |
52 |
53 if self.mode == "select": |
53 if self.mode == "select": |
54 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
54 self.buttonBox.button( |
55 self.buttonBox.button(QDialogButtonBox.Close).hide() |
55 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
56 else: |
56 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).hide() |
57 self.buttonBox.button(QDialogButtonBox.Ok).hide() |
57 else: |
58 self.buttonBox.button(QDialogButtonBox.Cancel).hide() |
58 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).hide() |
|
59 self.buttonBox.button( |
|
60 QDialogButtonBox.StandardButton.Cancel).hide() |
59 |
61 |
60 self.__dirIcon = UI.PixmapCache.getIcon("dirClosed") |
62 self.__dirIcon = UI.PixmapCache.getIcon("dirClosed") |
61 self.__fileIcon = UI.PixmapCache.getIcon("fileMisc") |
63 self.__fileIcon = UI.PixmapCache.getIcon("fileMisc") |
62 |
64 |
63 self.__urlRole = Qt.UserRole |
65 self.__urlRole = Qt.ItemDataRole.UserRole |
64 self.__ignoreExpand = False |
66 self.__ignoreExpand = False |
65 |
67 |
66 self.client = self.vcs.getClient() |
68 self.client = self.vcs.getClient() |
67 self.client.callback_cancel = self._clientCancelCallback |
69 self.client.callback_cancel = self._clientCancelCallback |
68 self.client.callback_get_login = self._clientLoginCallback |
70 self.client.callback_get_login = self._clientLoginCallback |
83 |
85 |
84 def __resizeColumns(self): |
86 def __resizeColumns(self): |
85 """ |
87 """ |
86 Private method to resize the tree columns. |
88 Private method to resize the tree columns. |
87 """ |
89 """ |
88 self.repoTree.header().resizeSections(QHeaderView.ResizeToContents) |
90 self.repoTree.header().resizeSections( |
|
91 QHeaderView.ResizeMode.ResizeToContents) |
89 self.repoTree.header().setStretchLastSection(True) |
92 self.repoTree.header().setStretchLastSection(True) |
90 |
93 |
91 def __generateItem(self, parent, repopath, revision, author, size, date, |
94 def __generateItem(self, parent, repopath, revision, author, size, date, |
92 nodekind, url): |
95 nodekind, url): |
93 """ |
96 """ |
119 dt = formatTime(date) |
122 dt = formatTime(date) |
120 if author is None: |
123 if author is None: |
121 author = "" |
124 author = "" |
122 |
125 |
123 itm = QTreeWidgetItem(parent) |
126 itm = QTreeWidgetItem(parent) |
124 itm.setData(0, Qt.DisplayRole, path) |
127 itm.setData(0, Qt.ItemDataRole.DisplayRole, path) |
125 itm.setData(1, Qt.DisplayRole, rev) |
128 itm.setData(1, Qt.ItemDataRole.DisplayRole, rev) |
126 itm.setData(2, Qt.DisplayRole, author) |
129 itm.setData(2, Qt.ItemDataRole.DisplayRole, author) |
127 itm.setData(3, Qt.DisplayRole, size) |
130 itm.setData(3, Qt.ItemDataRole.DisplayRole, size) |
128 itm.setData(4, Qt.DisplayRole, dt) |
131 itm.setData(4, Qt.ItemDataRole.DisplayRole, dt) |
129 |
132 |
130 if nodekind == pysvn.node_kind.dir: |
133 if nodekind == pysvn.node_kind.dir: |
131 itm.setIcon(0, self.__dirIcon) |
134 itm.setIcon(0, self.__dirIcon) |
132 itm.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator) |
135 itm.setChildIndicatorPolicy( |
|
136 QTreeWidgetItem.ChildIndicatorPolicy.ShowIndicator) |
133 elif nodekind == pysvn.node_kind.file: |
137 elif nodekind == pysvn.node_kind.file: |
134 itm.setIcon(0, self.__fileIcon) |
138 itm.setIcon(0, self.__fileIcon) |
135 |
139 |
136 itm.setData(0, self.__urlRole, url) |
140 itm.setData(0, self.__urlRole, url) |
137 |
141 |
138 itm.setTextAlignment(0, Qt.AlignLeft) |
142 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignLeft) |
139 itm.setTextAlignment(1, Qt.AlignRight) |
143 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignRight) |
140 itm.setTextAlignment(2, Qt.AlignLeft) |
144 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) |
141 itm.setTextAlignment(3, Qt.AlignRight) |
145 itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight) |
142 itm.setTextAlignment(4, Qt.AlignLeft) |
146 itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft) |
143 |
147 |
144 return itm |
148 return itm |
145 |
149 |
146 def __listRepo(self, url, parent=None): |
150 def __listRepo(self, url, parent=None): |
147 """ |
151 """ |
228 |
232 |
229 url = self.__normalizeUrl(url) |
233 url = self.__normalizeUrl(url) |
230 if self.urlCombo.findText(url) == -1: |
234 if self.urlCombo.findText(url) == -1: |
231 self.urlCombo.addItem(url) |
235 self.urlCombo.addItem(url) |
232 |
236 |
233 @pyqtSlot(str) |
237 @pyqtSlot(int) |
234 def on_urlCombo_currentIndexChanged(self, text): |
238 def on_urlCombo_currentIndexChanged(self, index): |
235 """ |
239 """ |
236 Private slot called, when a new repository URL is entered or selected. |
240 Private slot called, when a new repository URL is entered or selected. |
237 |
241 |
238 @param text the text of the current item (string) |
242 @param index of the current item |
239 """ |
243 @type int |
|
244 """ |
|
245 text = self.urlCombo.itemText(index) |
240 url = self.__normalizeUrl(text) |
246 url = self.__normalizeUrl(text) |
241 if url != self.url: |
247 if url != self.url: |
242 self.url = url |
248 self.url = url |
243 self.repoTree.clear() |
249 self.repoTree.clear() |
244 self.__listRepo(url) |
250 self.__listRepo(url) |
268 def on_repoTree_itemSelectionChanged(self): |
274 def on_repoTree_itemSelectionChanged(self): |
269 """ |
275 """ |
270 Private slot called when the selection changes. |
276 Private slot called when the selection changes. |
271 """ |
277 """ |
272 if self.mode == "select": |
278 if self.mode == "select": |
273 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True) |
279 self.buttonBox.button( |
|
280 QDialogButtonBox.StandardButton.Ok).setEnabled(True) |
274 |
281 |
275 def __showError(self, msg): |
282 def __showError(self, msg): |
276 """ |
283 """ |
277 Private slot to show an error message. |
284 Private slot to show an error message. |
278 |
285 |