src/eric7/Project/Project.py

branch
server
changeset 10631
00f5aae565a3
parent 10610
bb0149571d94
child 10632
1109854f15f9
equal deleted inserted replaced
10630:552a790fd9bc 10631:00f5aae565a3
1143 self.pfile = fn 1143 self.pfile = fn
1144 self.ppath = self.__remotefsInterface.dirname(fn) 1144 self.ppath = self.__remotefsInterface.dirname(fn)
1145 self.name = self.__remotefsInterface.splitext( 1145 self.name = self.__remotefsInterface.splitext(
1146 self.__remotefsInterface.basename(fn) 1146 self.__remotefsInterface.basename(fn)
1147 )[0] 1147 )[0]
1148 # TODO: read in a file system cache of ppath
1149 self.__remotefsInterface.populateFsCache(self.ppath)
1148 else: 1150 else:
1149 self.pfile = os.path.abspath(fn) 1151 self.pfile = os.path.abspath(fn)
1150 self.ppath = os.path.abspath(os.path.dirname(fn)) 1152 self.ppath = os.path.abspath(os.path.dirname(fn))
1151 self.name = os.path.splitext(os.path.basename(fn))[0] 1153 self.name = os.path.splitext(os.path.basename(fn))[0]
1152 1154
1183 # get the names of subdirectories the files are stored in 1185 # get the names of subdirectories the files are stored in
1184 for fileCategory in [c for c in self.getFileCategories() if c != "OTHERS"]: 1186 for fileCategory in [c for c in self.getFileCategories() if c != "OTHERS"]:
1185 for fn in self.__pdata[fileCategory]: 1187 for fn in self.__pdata[fileCategory]:
1186 dn = ( 1188 dn = (
1187 self.__remotefsInterface.dirname(fn) 1189 self.__remotefsInterface.dirname(fn)
1188 if FileSystemUtilities.isRemoteFileName(fn) 1190 if FileSystemUtilities.isRemoteFileName(self.ppath)
1189 else os.path.dirname(fn) 1191 else os.path.dirname(fn)
1190 ) 1192 )
1191 if dn and dn not in self.subdirs: 1193 if dn and dn not in self.subdirs:
1192 self.subdirs.append(dn) 1194 self.subdirs.append(dn)
1193 1195
1649 """ 1651 """
1650 Private slot to display the debugger properties dialog. 1652 Private slot to display the debugger properties dialog.
1651 """ 1653 """
1652 from .DebuggerPropertiesDialog import DebuggerPropertiesDialog 1654 from .DebuggerPropertiesDialog import DebuggerPropertiesDialog
1653 1655
1654 dlg = DebuggerPropertiesDialog(self) 1656 dlg = DebuggerPropertiesDialog(
1657 self, isRemote=FileSystemUtilities.isRemoteFileName(self.ppath)
1658 )
1655 if dlg.exec() == QDialog.DialogCode.Accepted: 1659 if dlg.exec() == QDialog.DialogCode.Accepted:
1656 dlg.storeData() 1660 dlg.storeData()
1657 1661
1658 def getDebugProperty(self, key): 1662 def getDebugProperty(self, key):
1659 """ 1663 """
1662 @param key key of the property 1666 @param key key of the property
1663 @type str 1667 @type str
1664 @return value of the property 1668 @return value of the property
1665 @rtype Any 1669 @rtype Any
1666 """ 1670 """
1667 if key == "INTERPRETER": 1671 if (
1672 key == "INTERPRETER"
1673 and not FileSystemUtilities.isRemoteFileName(self.ppath)
1674 ):
1668 return ( 1675 return (
1669 ericApp() 1676 ericApp()
1670 .getObject("VirtualEnvManager") 1677 .getObject("VirtualEnvManager")
1671 .getVirtualenvInterpreter(self.debugProperties["VIRTUALENV"]) 1678 .getVirtualenvInterpreter(self.debugProperties["VIRTUALENV"])
1672 ) 1679 )
2366 2373
2367 fn = self.getRelativePath(oldfn) 2374 fn = self.getRelativePath(oldfn)
2368 isSourceFile = fn in self.__pdata["SOURCES"] 2375 isSourceFile = fn in self.__pdata["SOURCES"]
2369 2376
2370 if newfn is None: 2377 if newfn is None:
2371 newfn = EricFileDialog.getSaveFileName( 2378 if isRemote:
2372 None, 2379 newfn = EricServerFileDialog.getSaveFileName(
2373 self.tr("Rename file"), 2380 None,
2374 oldfn, 2381 self.tr("Rename File"),
2375 "", 2382 oldfn,
2376 EricFileDialog.DontConfirmOverwrite, 2383 "",
2377 ) 2384 )
2385 else:
2386 newfn = EricFileDialog.getSaveFileName(
2387 None,
2388 self.tr("Rename File"),
2389 oldfn,
2390 "",
2391 options=EricFileDialog.DontConfirmOverwrite,
2392 )
2393 if newfn:
2394 newfn = FileSystemUtilities.toNativeSeparators(newfn)
2395
2378 if not newfn: 2396 if not newfn:
2379 return False 2397 return False
2380 newfn = FileSystemUtilities.toNativeSeparators(newfn)
2381 2398
2382 if (not isRemote and os.path.exists(newfn)) or ( 2399 if (not isRemote and os.path.exists(newfn)) or (
2383 isRemote and self.__remotefsInterface.exists(newfn) 2400 isRemote and self.__remotefsInterface.exists(newfn)
2384 ): 2401 ):
2385 res = EricMessageBox.yesNo( 2402 res = EricMessageBox.yesNo(
2394 if not res: 2411 if not res:
2395 return False 2412 return False
2396 2413
2397 try: 2414 try:
2398 if isRemote: 2415 if isRemote:
2399 self.__remotefsInterface.rename(oldfn, newfn) 2416 self.__remotefsInterface.replace(oldfn, newfn)
2400 else: 2417 else:
2401 os.rename(oldfn, newfn) 2418 os.rename(oldfn, newfn)
2402 except OSError as msg: 2419 except OSError as msg:
2403 EricMessageBox.critical( 2420 EricMessageBox.critical(
2404 self.ui, 2421 self.ui,
4009 if not noSave: 4026 if not noSave:
4010 self.writeTasks() 4027 self.writeTasks()
4011 self.ui.taskViewer.clearProjectTasks() 4028 self.ui.taskViewer.clearProjectTasks()
4012 self.ui.taskViewer.setProjectOpen(False) 4029 self.ui.taskViewer.setProjectOpen(False)
4013 4030
4031 # TODO: clear the file system cache for ppath if remote project
4032 if FileSystemUtilities.isRemoteFileName(self.ppath):
4033 self.__remotefsInterface.removeFromFsCache(self.ppath)
4034
4014 # now shutdown the vcs interface 4035 # now shutdown the vcs interface
4015 if not FileSystemUtilities.isRemoteFileName(self.ppath) and self.vcs: 4036 if not FileSystemUtilities.isRemoteFileName(self.ppath) and self.vcs:
4016 self.vcs.vcsShutdown() 4037 self.vcs.vcsShutdown()
4017 self.vcs.deleteLater() 4038 self.vcs.deleteLater()
4018 self.vcs = None 4039 self.vcs = None
6436 from eric7 import VCS 6457 from eric7 import VCS
6437 6458
6438 vcs = None 6459 vcs = None
6439 forProject = True 6460 forProject = True
6440 override = False 6461 override = False
6462
6463 if FileSystemUtilities.isRemoteFileName(self.ppath):
6464 return None
6441 6465
6442 if vcsSystem is None: 6466 if vcsSystem is None:
6443 if self.__pdata["VCS"] and self.__pdata["VCS"] != "None": 6467 if self.__pdata["VCS"] and self.__pdata["VCS"] != "None":
6444 vcsSystem = self.__pdata["VCS"] 6468 vcsSystem = self.__pdata["VCS"]
6445 else: 6469 else:
7900 self.saveasRemoteAct.setEnabled( 7924 self.saveasRemoteAct.setEnabled(
7901 connected 7925 connected
7902 and self.opened 7926 and self.opened
7903 and FileSystemUtilities.isRemoteFileName(self.pfile) 7927 and FileSystemUtilities.isRemoteFileName(self.pfile)
7904 ) 7928 )
7929 if not connected and FileSystemUtilities.isRemoteFileName(self.ppath):
7930 self.closeProject(noSave=True)
7905 7931
7906 @pyqtSlot() 7932 @pyqtSlot()
7907 def __openRemoteProject(self): 7933 def __openRemoteProject(self):
7908 """ 7934 """
7909 Private slot to open a project of an 'eric-ide' server. 7935 Private slot to open a project of an 'eric-ide' server.
7928 self.parent(), 7954 self.parent(),
7929 self.tr("Save Remote Project"), 7955 self.tr("Save Remote Project"),
7930 defaultPath, 7956 defaultPath,
7931 self.tr("Project Files (*.epj)"), 7957 self.tr("Project Files (*.epj)"),
7932 defaultFilter, 7958 defaultFilter,
7933 EricFileDialog.DontConfirmOverwrite,
7934 ) 7959 )
7935 7960
7936 if fn: 7961 if fn:
7937 fname, ext = self.__remotefsInterface.splitext(fn) 7962 fname, ext = self.__remotefsInterface.splitext(fn)
7938 if not ext: 7963 if not ext:

eric ide

mercurial