src/eric7/EricWidgets/EricPathPicker.py

branch
eric7
changeset 10936
083ae2a3cd3b
parent 10704
27d21e5163b8
child 10938
2a7e115e2198
equal deleted inserted replaced
10935:680150fd2b8c 10936:083ae2a3cd3b
20 QToolButton, 20 QToolButton,
21 QWidget, 21 QWidget,
22 ) 22 )
23 23
24 from eric7.EricGui import EricPixmapCache 24 from eric7.EricGui import EricPixmapCache
25 from eric7.RemoteServerInterface import EricServerFileDialog 25
26 from eric7.SystemUtilities import FileSystemUtilities 26 try:
27 # These are only available if used with eric-ide
28 # (https://eric-ide.python-projects.org)
29 from eric7.RemoteServerInterface import EricServerFileDialog
30 from eric7.SystemUtilities import FileSystemUtilities
31 HAS_REMOTE_SERVER_SUPPORT = True
32 except ImportError:
33 HAS_REMOTE_SERVER_SUPPORT = False
27 34
28 from . import EricFileDialog 35 from . import EricFileDialog
29 from .EricApplication import ericApp 36 from .EricApplication import ericApp
30 from .EricCompleters import EricDirCompleter, EricFileCompleter 37 from .EricCompleters import EricDirCompleter, EricFileCompleter
31 38
196 Public method to set the remote mode of the path picker. 203 Public method to set the remote mode of the path picker.
197 204
198 @param remote flag indicating the remote mode 205 @param remote flag indicating the remote mode
199 @type bool 206 @type bool
200 """ 207 """
201 self.__remote = remote 208 self.__remote = remote and HAS_REMOTE_SERVER_SUPPORT
202 if remote: 209 if self.__remote:
203 self.__remotefsInterface = ( 210 self.__remotefsInterface = (
204 ericApp().getObject("EricServer").getServiceInterface("FileSystem") 211 ericApp().getObject("EricServer").getServiceInterface("FileSystem")
205 ) 212 )
206 else: 213 else:
207 self.__remotefsInterface = None 214 self.__remotefsInterface = None
908 915
909 @return list of remembered paths 916 @return list of remembered paths
910 @rtype list of str 917 @rtype list of str
911 """ 918 """
912 paths = [] 919 paths = []
913 for index in range(self._editor.count()): 920 if HAS_REMOTE_SERVER_SUPPORT:
914 paths.append( 921 for index in range(self._editor.count()):
915 FileSystemUtilities.remoteFileName(self._editor.itemText(index)) 922 paths.append(
916 ) 923 FileSystemUtilities.remoteFileName(self._editor.itemText(index))
924 )
917 return paths 925 return paths

eric ide

mercurial