eric6/Project/ProjectBaseBrowser.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8243
cc717c2ae956
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
66 self.specialMenuEntries = [] 66 self.specialMenuEntries = []
67 self.isTranslationsBrowser = False 67 self.isTranslationsBrowser = False
68 self.expandedNames = [] 68 self.expandedNames = []
69 69
70 self.SelectFlags = QItemSelectionModel.SelectionFlags( 70 self.SelectFlags = QItemSelectionModel.SelectionFlags(
71 QItemSelectionModel.Select | QItemSelectionModel.Rows) 71 QItemSelectionModel.SelectionFlag.Select |
72 QItemSelectionModel.SelectionFlag.Rows
73 )
72 self.DeselectFlags = QItemSelectionModel.SelectionFlags( 74 self.DeselectFlags = QItemSelectionModel.SelectionFlags(
73 QItemSelectionModel.Deselect | QItemSelectionModel.Rows) 75 QItemSelectionModel.SelectionFlag.Deselect |
76 QItemSelectionModel.SelectionFlag.Rows
77 )
74 78
75 self._activating = False 79 self._activating = False
76 80
77 self.setContextMenuPolicy(Qt.CustomContextMenu) 81 self.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
78 self.customContextMenuRequested.connect(self._contextMenuRequested) 82 self.customContextMenuRequested.connect(self._contextMenuRequested)
79 self.activated.connect(self._openItem) 83 self.activated.connect(self._openItem)
80 self._model.rowsInserted.connect(self.__modelRowsInserted) 84 self._model.rowsInserted.connect(self.__modelRowsInserted)
81 self._connectExpandedCollapsed() 85 self._connectExpandedCollapsed()
82 86
172 @param index index of item to be selected (QModelIndex) 176 @param index index of item to be selected (QModelIndex)
173 """ 177 """
174 if index.isValid(): 178 if index.isValid():
175 self.setCurrentIndex(index) 179 self.setCurrentIndex(index)
176 flags = QItemSelectionModel.SelectionFlags( 180 flags = QItemSelectionModel.SelectionFlags(
177 QItemSelectionModel.ClearAndSelect | QItemSelectionModel.Rows) 181 QItemSelectionModel.SelectionFlag.ClearAndSelect |
182 QItemSelectionModel.SelectionFlag.Rows
183 )
178 self.selectionModel().select(index, flags) 184 self.selectionModel().select(index, flags)
179 185
180 def _setItemSelected(self, index, selected): 186 def _setItemSelected(self, index, selected):
181 """ 187 """
182 Protected method to set the selection status of an item. 188 Protected method to set the selection status of an item.
223 def _projectOpened(self): 229 def _projectOpened(self):
224 """ 230 """
225 Protected slot to handle the projectOpened signal. 231 Protected slot to handle the projectOpened signal.
226 """ 232 """
227 self.layoutDisplay() 233 self.layoutDisplay()
228 self.sortByColumn(0, Qt.DescendingOrder) 234 self.sortByColumn(0, Qt.SortOrder.DescendingOrder)
229 self.sortByColumn(0, Qt.AscendingOrder) 235 self.sortByColumn(0, Qt.SortOrder.AscendingOrder)
230 self._initMenusAndVcs() 236 self._initMenusAndVcs()
231 237
232 def _initMenusAndVcs(self): 238 def _initMenusAndVcs(self):
233 """ 239 """
234 Protected slot to initialize the menus and the Vcs interface. 240 Protected slot to initialize the menus and the Vcs interface.
299 "ProjectBaseBrowser", 305 "ProjectBaseBrowser",
300 "Do you really want to delete these directories from" 306 "Do you really want to delete these directories from"
301 " the project?"), 307 " the project?"),
302 dirs) 308 dirs)
303 309
304 if dlg.exec() == QDialog.Accepted: 310 if dlg.exec() == QDialog.DialogCode.Accepted:
305 for dn in fullNames: 311 for dn in fullNames:
306 self.project.deleteDirectory(dn) 312 self.project.deleteDirectory(dn)
307 313
308 def _renameFile(self): 314 def _renameFile(self):
309 """ 315 """
340 sindex = self._model.itemIndexByName(newfn) 346 sindex = self._model.itemIndexByName(newfn)
341 if sindex.isValid(): 347 if sindex.isValid():
342 index = self.model().mapFromSource(sindex) 348 index = self.model().mapFromSource(sindex)
343 if index.isValid(): 349 if index.isValid():
344 self._selectSingleItem(index) 350 self._selectSingleItem(index)
345 self.scrollTo(index, QAbstractItemView.PositionAtTop) 351 self.scrollTo(index,
352 QAbstractItemView.ScrollHint.PositionAtTop)
346 353
347 def selectFileLine(self, fn, lineno): 354 def selectFileLine(self, fn, lineno):
348 """ 355 """
349 Public method to highlight a node given its filename. 356 Public method to highlight a node given its filename.
350 357

eric ide

mercurial