src/eric7/Project/ProjectBrowserModel.py

branch
server
changeset 10596
ea35c92a3c7c
parent 10517
aecd5a8c958c
child 10597
fbe93720ee9f
equal deleted inserted replaced
10594:6156d9675f62 10596:ea35c92a3c7c
136 class ProjectBrowserDirectoryItem(BrowserDirectoryItem, ProjectBrowserItemMixin): 136 class ProjectBrowserDirectoryItem(BrowserDirectoryItem, ProjectBrowserItemMixin):
137 """ 137 """
138 Class implementing the data structure for project browser directory items. 138 Class implementing the data structure for project browser directory items.
139 """ 139 """
140 140
141 def __init__(self, parent, dinfo, projectType, full=True, bold=False): 141 def __init__(self, parent, dinfo, projectType, full=True, bold=False, fsInterface=None):
142 """ 142 """
143 Constructor 143 Constructor
144 144
145 @param parent parent item 145 @param parent parent item
146 @type BrowserItem 146 @type BrowserItem
150 @type str 150 @type str
151 @param full flag indicating full pathname should be displayed 151 @param full flag indicating full pathname should be displayed
152 @type bool 152 @type bool
153 @param bold flag indicating a highlighted font 153 @param bold flag indicating a highlighted font
154 @type bool 154 @type bool
155 """ 155 @param fsInterface reference to the 'eric-ide' server file system interface
156 BrowserDirectoryItem.__init__(self, parent, dinfo, full) 156 (defaults to None)
157 @type EricServerFileSystemInterface (optional)
158 """
159 BrowserDirectoryItem.__init__(self, parent, dinfo, full, fsInterface)
157 ProjectBrowserItemMixin.__init__(self, projectType, bold) 160 ProjectBrowserItemMixin.__init__(self, projectType, bold)
158 161
159 self.type_ = BrowserItemType.PbDirectory 162 self.type_ = BrowserItemType.PbDirectory
160 163
161 164
163 """ 166 """
164 Class implementing the data structure for project browser file items. 167 Class implementing the data structure for project browser file items.
165 """ 168 """
166 169
167 def __init__( 170 def __init__(
168 self, parent, finfo, projectType, full=True, bold=False, sourceLanguage="" 171 self, parent, finfo, projectType, full=True, bold=False, sourceLanguage="", fsInterface=None
169 ): 172 ):
170 """ 173 """
171 Constructor 174 Constructor
172 175
173 @param parent parent item 176 @param parent parent item
180 @type bool 183 @type bool
181 @param bold flag indicating a highlighted font 184 @param bold flag indicating a highlighted font
182 @type bool 185 @type bool
183 @param sourceLanguage source code language of the project 186 @param sourceLanguage source code language of the project
184 @type str 187 @type str
185 """ 188 @param fsInterface reference to the 'eric-ide' server file system interface
186 BrowserFileItem.__init__(self, parent, finfo, full, sourceLanguage) 189 (defaults to None)
190 @type EricServerFileSystemInterface (optional)
191 """
192 BrowserFileItem.__init__(self, parent, finfo, full, sourceLanguage, fsInterface)
187 ProjectBrowserItemMixin.__init__(self, projectType, bold) 193 ProjectBrowserItemMixin.__init__(self, projectType, bold)
188 194
189 self.type_ = BrowserItemType.PbFile 195 self.type_ = BrowserItemType.PbFile
190 196
191 197
196 @signal vcsStateChanged(str) emitted after the VCS state has changed 202 @signal vcsStateChanged(str) emitted after the VCS state has changed
197 """ 203 """
198 204
199 vcsStateChanged = pyqtSignal(str) 205 vcsStateChanged = pyqtSignal(str)
200 206
201 def __init__(self, parent): 207 def __init__(self, parent, fsInterface=None):
202 """ 208 """
203 Constructor 209 Constructor
204 210
205 @param parent reference to parent object 211 @param parent reference to parent object
206 @type Project.Project 212 @type Project.Project
213 @param fsInterface reference to the 'eric-ide' server interface object
214 (defaults to None)
215 @type EricServerFileSystemInterface (optional)
207 """ 216 """
208 super().__init__(parent, nopopulate=True) 217 super().__init__(parent, nopopulate=True)
209 218
210 rootData = self.tr("Name") 219 rootData = self.tr("Name")
211 self.rootItem = BrowserItem(None, rootData) 220 self.rootItem = BrowserItem(None, rootData)
212 self.rootItem.itemData.append(self.tr("VCS Status")) 221 self.rootItem.itemData.append(self.tr("VCS Status"))
213 222
214 self.progDir = None 223 self.progDir = None
215 self.project = parent 224 self.project = parent
216 self.__projectBrowser = None 225 self.__projectBrowser = None
226
227 self.__remotefsInterface = fsInterface
217 228
218 self.watchedItems = {} 229 self.watchedItems = {}
219 self.__watcherActive = True 230 self.__watcherActive = True
220 self.watcher = QFileSystemWatcher(self) 231 self.watcher = QFileSystemWatcher(self)
221 self.watcher.directoryChanged.connect(self.directoryChanged) 232 self.watcher.directoryChanged.connect(self.directoryChanged)
416 sourceLanguage = ( 427 sourceLanguage = (
417 self.project.getProjectLanguage() if fileCategory == "SOURCES" else "" 428 self.project.getProjectLanguage() if fileCategory == "SOURCES" else ""
418 ) 429 )
419 430
420 for fn in self.project.getProjectData(dataKey=fileCategory): 431 for fn in self.project.getProjectData(dataKey=fileCategory):
421 fname = os.path.join(self.project.ppath, fn) 432 fname = (
433 self.__remotefsInterface.join(self.project.ppath, fn)
434 if FileSystemUtilities.isRemoteFileName(self.project.ppath)
435 else os.path.join(self.project.ppath, fn)
436 )
437 isdir = (
438 self.__remotefsInterface.isdir(fname)
439 if FileSystemUtilities.isRemoteFileName(fname)
440 else os.path.isdir(fname)
441 )
422 parentItem, dt = self.findParentItemByName( 442 parentItem, dt = self.findParentItemByName(
423 self.__projectBrowser.getProjectBrowserFilter(fileCategory), fn 443 self.__projectBrowser.getProjectBrowserFilter(fileCategory), fn
424 ) 444 )
425 itm = ( 445 itm = (
426 ProjectBrowserDirectoryItem( 446 ProjectBrowserDirectoryItem(
427 parentItem, 447 parentItem,
428 fname, 448 fname,
429 self.__projectBrowser.getProjectBrowserFilter(fileCategory), 449 self.__projectBrowser.getProjectBrowserFilter(fileCategory),
430 False, 450 False,
431 bold, 451 bold,
452 fsInterface=self.__remotefsInterface,
432 ) 453 )
433 if os.path.isdir(fname) 454 if isdir
434 else ProjectBrowserFileItem( 455 else ProjectBrowserFileItem(
435 parentItem, 456 parentItem,
436 fname, 457 fname,
437 self.__projectBrowser.getProjectBrowserFilter(fileCategory), 458 self.__projectBrowser.getProjectBrowserFilter(fileCategory),
438 False, 459 False,
439 bold, 460 bold,
440 sourceLanguage=sourceLanguage, 461 sourceLanguage=sourceLanguage,
462 fsInterface=self.__remotefsInterface,
441 ) 463 )
442 ) 464 )
443 self._addItem(itm, parentItem) 465 self._addItem(itm, parentItem)
444 if self.project.vcs is not None: 466 if self.project.vcs is not None:
445 if ( 467 if (

eric ide

mercurial