1563 @param updateModel flag indicating an update of the model is |
1563 @param updateModel flag indicating an update of the model is |
1564 requested (boolean) |
1564 requested (boolean) |
1565 """ |
1565 """ |
1566 dirty = False |
1566 dirty = False |
1567 |
1567 |
1568 if os.path.isabs(fn): |
1568 # make it relative to the project root, if it starts with that path |
1569 # make it relative to the project root, if it starts with that path |
1569 # assume relative paths are relative to the project root |
1570 newfn = self.getRelativePath(fn) |
1570 newfn = self.getRelativePath(fn) if os.path.isabs(fn) else fn |
1571 else: |
|
1572 # assume relative paths are relative to the project root |
|
1573 newfn = fn |
|
1574 newdir = os.path.dirname(newfn) |
1571 newdir = os.path.dirname(newfn) |
1575 |
1572 |
1576 if isSourceFile: |
1573 if isSourceFile: |
1577 filetype = "SOURCES" |
1574 filetype = "SOURCES" |
1578 else: |
1575 else: |
2216 dn = self.getRelativePath(dn) |
2213 dn = self.getRelativePath(dn) |
2217 for entry in self.pdata["OTHERS"][:]: |
2214 for entry in self.pdata["OTHERS"][:]: |
2218 if entry.startswith(dn): |
2215 if entry.startswith(dn): |
2219 self.pdata["OTHERS"].remove(entry) |
2216 self.pdata["OTHERS"].remove(entry) |
2220 dirty = True |
2217 dirty = True |
2221 if not dn.endswith(os.sep): |
2218 dn2 = dn if dn.endswith(os.sep) else dn + os.sep |
2222 dn2 = dn + os.sep |
|
2223 else: |
|
2224 dn2 = dn |
|
2225 for key in ["SOURCES", "FORMS", "INTERFACES", "PROTOCOLS", "RESOURCES", |
2219 for key in ["SOURCES", "FORMS", "INTERFACES", "PROTOCOLS", "RESOURCES", |
2226 "TRANSLATIONS", ]: |
2220 "TRANSLATIONS", ]: |
2227 for entry in self.pdata[key][:]: |
2221 for entry in self.pdata[key][:]: |
2228 if entry.startswith(dn2): |
2222 if entry.startswith(dn2): |
2229 self.pdata[key].remove(entry) |
2223 self.pdata[key].remove(entry) |
4559 self.__loadRecent() |
4553 self.__loadRecent() |
4560 |
4554 |
4561 self.recentMenu.clear() |
4555 self.recentMenu.clear() |
4562 |
4556 |
4563 for idx, rp in enumerate(self.recent, start=1): |
4557 for idx, rp in enumerate(self.recent, start=1): |
4564 if idx < 10: |
4558 formatStr = '&{0:d}. {1}' if idx < 10 else '{0:d}. {1}' |
4565 formatStr = '&{0:d}. {1}' |
|
4566 else: |
|
4567 formatStr = '{0:d}. {1}' |
|
4568 act = self.recentMenu.addAction( |
4559 act = self.recentMenu.addAction( |
4569 formatStr.format( |
4560 formatStr.format( |
4570 idx, |
4561 idx, |
4571 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
4562 Utilities.compactPath(rp, self.ui.maxMenuFilePathLen))) |
4572 act.setData(rp) |
4563 act.setData(rp) |
4684 continue |
4675 continue |
4685 |
4676 |
4686 # set fn to project relative name |
4677 # set fn to project relative name |
4687 # then reset ns to fully qualified name for insertion, |
4678 # then reset ns to fully qualified name for insertion, |
4688 # possibly. |
4679 # possibly. |
4689 if directory == "": |
4680 fn = os.path.join(directory, ns) if directory else ns |
4690 fn = ns |
|
4691 else: |
|
4692 fn = os.path.join(directory, ns) |
|
4693 ns = os.path.abspath(os.path.join(curpath, ns)) |
4681 ns = os.path.abspath(os.path.join(curpath, ns)) |
4694 |
4682 |
4695 # do not bother with dirs here... |
4683 # do not bother with dirs here... |
4696 if os.path.isdir(ns): |
4684 if os.path.isdir(ns): |
4697 if recursiveSearch: |
4685 if recursiveSearch: |
5325 " ", |
5313 " ", |
5326 ] |
5314 ] |
5327 |
5315 |
5328 # write the file |
5316 # write the file |
5329 try: |
5317 try: |
5330 if self.pdata["EOL"] == 0: |
5318 newline = None if self.pdata["EOL"] == 0 else self.getEolString() |
5331 newline = None |
|
5332 else: |
|
5333 newline = self.getEolString() |
|
5334 with open(pkglist, "w", encoding="utf-8", |
5319 with open(pkglist, "w", encoding="utf-8", |
5335 newline=newline) as pkglistFile: |
5320 newline=newline) as pkglistFile: |
5336 pkglistFile.write("\n".join(header) + "\n") |
5321 pkglistFile.write("\n".join(header) + "\n") |
5337 pkglistFile.write( |
5322 pkglistFile.write( |
5338 "\n".join([Utilities.fromNativeSeparators(f) |
5323 "\n".join([Utilities.fromNativeSeparators(f) |