src/eric7/Project/ProjectOthersBrowser.py

branch
eric7
changeset 10256
1b728f26d1ae
parent 10113
40eb9038d100
child 10398
ef1ea18994d5
equal deleted inserted replaced
10255:a25f95af0a51 10256:1b728f26d1ae
7 Module implementing a class used to display the parts of the project, that 7 Module implementing a class used to display the parts of the project, that
8 don't fit the other categories. 8 don't fit the other categories.
9 """ 9 """
10 10
11 import contextlib 11 import contextlib
12 import os
13 12
14 from PyQt6.QtCore import QModelIndex, QUrl, pyqtSignal 13 from PyQt6.QtCore import QModelIndex, QUrl, pyqtSignal
15 from PyQt6.QtGui import QDesktopServices 14 from PyQt6.QtGui import QDesktopServices
16 from PyQt6.QtWidgets import QDialog, QMenu 15 from PyQt6.QtWidgets import QDialog, QMenu
17 16
443 442
444 def __addOthersFiles(self): 443 def __addOthersFiles(self):
445 """ 444 """
446 Private method to add files to the project. 445 Private method to add files to the project.
447 """ 446 """
448 itm = self.model().item(self.currentIndex()) 447 self.project.addFiles("OTHERS", self.currentDirectory())
449 if isinstance(itm, ProjectBrowserFileItem):
450 dn = os.path.dirname(itm.fileName())
451 elif isinstance(
452 itm, (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
453 ):
454 dn = itm.dirName()
455 else:
456 dn = None
457 self.project.addFiles("OTHERS", dn)
458 448
459 def __addOthersDirectory(self): 449 def __addOthersDirectory(self):
460 """ 450 """
461 Private method to add files of a directory to the project. 451 Private method to add files of a directory to the project.
462 """ 452 """
463 itm = self.model().item(self.currentIndex()) 453 self.project.addDirectory("OTHERS", self.currentDirectory())
464 if isinstance(ProjectBrowserFileItem):
465 dn = os.path.dirname(itm.fileName())
466 elif isinstance(
467 itm, (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
468 ):
469 dn = itm.dirName()
470 else:
471 dn = None
472 self.project.addDirectory("OTHERS", dn)
473 454
474 def __removeItem(self): 455 def __removeItem(self):
475 """ 456 """
476 Private slot to remove the selected entry from the OTHERS project 457 Private slot to remove the selected entry from the OTHERS project
477 data area. 458 data area.

eric ide

mercurial