37 |
37 |
38 IsGlobalRole = Qt.ItemDataRole.UserRole + 1 |
38 IsGlobalRole = Qt.ItemDataRole.UserRole + 1 |
39 IsCondaRole = Qt.ItemDataRole.UserRole + 2 |
39 IsCondaRole = Qt.ItemDataRole.UserRole + 2 |
40 IsRemoteRole = Qt.ItemDataRole.UserRole + 3 |
40 IsRemoteRole = Qt.ItemDataRole.UserRole + 3 |
41 ExecPathRole = Qt.ItemDataRole.UserRole + 4 |
41 ExecPathRole = Qt.ItemDataRole.UserRole + 4 |
|
42 DescriptionRole = Qt.ItemDataRole.UserRole + 5 |
42 |
43 |
43 def __init__(self, manager, parent=None): |
44 def __init__(self, manager, parent=None): |
44 """ |
45 """ |
45 Constructor |
46 Constructor |
46 |
47 |
196 selectedItem.text(2), |
199 selectedItem.text(2), |
197 selectedItem.data(0, VirtualenvManagerWidget.IsGlobalRole), |
200 selectedItem.data(0, VirtualenvManagerWidget.IsGlobalRole), |
198 selectedItem.data(0, VirtualenvManagerWidget.IsCondaRole), |
201 selectedItem.data(0, VirtualenvManagerWidget.IsCondaRole), |
199 selectedItem.data(0, VirtualenvManagerWidget.IsRemoteRole), |
202 selectedItem.data(0, VirtualenvManagerWidget.IsRemoteRole), |
200 selectedItem.data(0, VirtualenvManagerWidget.ExecPathRole), |
203 selectedItem.data(0, VirtualenvManagerWidget.ExecPathRole), |
|
204 selectedItem.data(0, VirtualenvManagerWidget.DescriptionRole), |
201 baseDir=self.envBaseDirectoryPicker.text(), |
205 baseDir=self.envBaseDirectoryPicker.text(), |
202 ) |
206 ) |
203 if dlg.exec() == QDialog.DialogCode.Accepted: |
207 if dlg.exec() == QDialog.DialogCode.Accepted: |
204 ( |
208 ( |
205 venvName, |
209 venvName, |
295 def on_venvList_itemSelectionChanged(self): |
302 def on_venvList_itemSelectionChanged(self): |
296 """ |
303 """ |
297 Private slot handling a change of the selected items. |
304 Private slot handling a change of the selected items. |
298 """ |
305 """ |
299 self.__updateButtons() |
306 self.__updateButtons() |
|
307 |
|
308 selectedItems = self.venvList.selectedItems() |
|
309 if len(selectedItems) == 1: |
|
310 self.descriptionEdit.setPlainText( |
|
311 selectedItems[0].data(0, VirtualenvManagerWidget.DescriptionRole) |
|
312 ) |
|
313 else: |
|
314 self.descriptionEdit.clear() |
300 |
315 |
301 @pyqtSlot() |
316 @pyqtSlot() |
302 def __refresh(self): |
317 def __refresh(self): |
303 """ |
318 """ |
304 Private slot to refresh the list of shown items. |
319 Private slot to refresh the list of shown items. |
352 itm.setData( |
367 itm.setData( |
353 0, |
368 0, |
354 VirtualenvManagerWidget.ExecPathRole, |
369 VirtualenvManagerWidget.ExecPathRole, |
355 environments[venvName]["exec_path"], |
370 environments[venvName]["exec_path"], |
356 ) |
371 ) |
|
372 itm.setData( |
|
373 0, |
|
374 VirtualenvManagerWidget.DescriptionRole, |
|
375 environments[venvName]["description"], |
|
376 ) |
357 |
377 |
358 # show remote environments with underlined font |
378 # show remote environments with underlined font |
359 if environments[venvName]["is_remote"]: |
379 if environments[venvName]["is_remote"]: |
360 font = itm.font(0) |
380 font = itm.font(0) |
361 font.setUnderline(True) |
381 font.setUnderline(True) |