src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnRepoBrowserDialog.py

branch
eric7
changeset 10438
4cd7e5a8b3cf
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10437:2f70ca07f0af 10438:4cd7e5a8b3cf
36 def __init__(self, vcs, mode="browse", parent=None): 36 def __init__(self, vcs, mode="browse", parent=None):
37 """ 37 """
38 Constructor 38 Constructor
39 39
40 @param vcs reference to the vcs object 40 @param vcs reference to the vcs object
41 @param mode mode of the dialog (string, "browse" or "select") 41 @type Subversion
42 @param parent parent widget (QWidget) 42 @param mode mode of the dialog ("browse" or "select")
43 @type str
44 @param parent parent widget
45 @type QWidget
43 """ 46 """
44 super().__init__(parent) 47 super().__init__(parent)
45 self.setupUi(self) 48 self.setupUi(self)
46 SvnDialogMixin.__init__(self) 49 SvnDialogMixin.__init__(self)
47 self.setWindowFlags(Qt.WindowType.Window) 50 self.setWindowFlags(Qt.WindowType.Window)
94 self, parent, repopath, revision, author, size, date, nodekind, url 97 self, parent, repopath, revision, author, size, date, nodekind, url
95 ): 98 ):
96 """ 99 """
97 Private method to generate a tree item in the repository tree. 100 Private method to generate a tree item in the repository tree.
98 101
99 @param parent parent of the item to be created (QTreeWidget or 102 @param parent parent of the item to be created
100 QTreeWidgetItem) 103 @type QTreeWidget or QTreeWidgetItem
101 @param repopath path of the item (string) 104 @param repopath path of the item
102 @param revision revision info (string or pysvn.opt_revision_kind) 105 @type str
103 @param author author info (string) 106 @param revision revision info
104 @param size size info (integer) 107 @type str or pysvn.opt_revision_kind
105 @param date date info (integer) 108 @param author author info
106 @param nodekind node kind info (pysvn.node_kind) 109 @type str
107 @param url url of the entry (string) 110 @param size size info
108 @return reference to the generated item (QTreeWidgetItem) 111 @type int
112 @param date date info
113 @type int
114 @param nodekind node kind info
115 @type pysvn.node_kind
116 @param url url of the entry
117 @type str
118 @return reference to the generated item
119 @rtype QTreeWidgetItem
109 """ 120 """
110 path = url if repopath == "/" else url.split("/")[-1] 121 path = url if repopath == "/" else url.split("/")[-1]
111 122
112 rev = revision.number if revision else "" 123 rev = revision.number if revision else ""
113 dt = formatTime(date) if date else "" 124 dt = formatTime(date) if date else ""
141 152
142 def __listRepo(self, url, parent=None): 153 def __listRepo(self, url, parent=None):
143 """ 154 """
144 Private method to perform the svn list command. 155 Private method to perform the svn list command.
145 156
146 @param url the repository URL to browser (string) 157 @param url the repository URL to browser
158 @type str
147 @param parent reference to the item, the data should be appended to 159 @param parent reference to the item, the data should be appended to
148 (QTreeWidget or QTreeWidgetItem) 160 @type QTreeWidget or QTreeWidgetItem
149 """ 161 """
150 if parent is None: 162 if parent is None:
151 parent = self.repoTree 163 parent = self.repoTree
152 164
153 with EricOverrideCursor(): 165 with EricOverrideCursor():
210 222
211 def __normalizeUrl(self, url): 223 def __normalizeUrl(self, url):
212 """ 224 """
213 Private method to normalite the url. 225 Private method to normalite the url.
214 226
215 @param url the url to normalize (string) 227 @param url the url to normalize
216 @return normalized URL (string) 228 @type str
229 @return normalized URL
230 @rtype str
217 """ 231 """
218 if url.endswith("/"): 232 if url.endswith("/"):
219 return url[:-1] 233 return url[:-1]
220 return url 234 return url
221 235
222 def start(self, url): 236 def start(self, url):
223 """ 237 """
224 Public slot to start the svn info command. 238 Public slot to start the svn info command.
225 239
226 @param url the repository URL to browser (string) 240 @param url the repository URL to browser
241 @type str
227 """ 242 """
228 self.repoTree.clear() 243 self.repoTree.clear()
229 244
230 self.url = "" 245 self.url = ""
231 246
251 @pyqtSlot(QTreeWidgetItem) 266 @pyqtSlot(QTreeWidgetItem)
252 def on_repoTree_itemExpanded(self, item): 267 def on_repoTree_itemExpanded(self, item):
253 """ 268 """
254 Private slot called when an item is expanded. 269 Private slot called when an item is expanded.
255 270
256 @param item reference to the item to be expanded (QTreeWidgetItem) 271 @param item reference to the item to be expanded
272 @type QTreeWidgetItem
257 """ 273 """
258 if not self.__ignoreExpand: 274 if not self.__ignoreExpand:
259 url = item.data(0, self.__urlRole) 275 url = item.data(0, self.__urlRole)
260 self.__listRepo(url, item) 276 self.__listRepo(url, item)
261 277
262 @pyqtSlot(QTreeWidgetItem) 278 @pyqtSlot(QTreeWidgetItem)
263 def on_repoTree_itemCollapsed(self, item): 279 def on_repoTree_itemCollapsed(self, item):
264 """ 280 """
265 Private slot called when an item is collapsed. 281 Private slot called when an item is collapsed.
266 282
267 @param item reference to the item to be collapsed (QTreeWidgetItem) 283 @param item reference to the item to be collapsed
284 @type QTreeWidgetItem
268 """ 285 """
269 for child in item.takeChildren(): 286 for child in item.takeChildren():
270 del child 287 del child
271 288
272 @pyqtSlot() 289 @pyqtSlot()
279 296
280 def __showError(self, msg): 297 def __showError(self, msg):
281 """ 298 """
282 Private slot to show an error message. 299 Private slot to show an error message.
283 300
284 @param msg error message to show (string) 301 @param msg error message to show
302 @type str
285 """ 303 """
286 EricMessageBox.critical(self, self.tr("Subversion Error"), msg) 304 EricMessageBox.critical(self, self.tr("Subversion Error"), msg)
287 305
288 def accept(self): 306 def accept(self):
289 """ 307 """
296 314
297 def getSelectedUrl(self): 315 def getSelectedUrl(self):
298 """ 316 """
299 Public method to retrieve the selected repository URL. 317 Public method to retrieve the selected repository URL.
300 318
301 @return the selected repository URL (string) 319 @return the selected repository URL
320 @rtype str
302 """ 321 """
303 items = self.repoTree.selectedItems() 322 items = self.repoTree.selectedItems()
304 if len(items) == 1: 323 if len(items) == 1:
305 return items[0].data(0, self.__urlRole) 324 return items[0].data(0, self.__urlRole)
306 else: 325 else:

eric ide

mercurial