src/eric7/RemoteServerInterface/EricServerProfilesDialog.py

branch
eric7
changeset 11033
6b197c3389f7
parent 10597
fbe93720ee9f
child 11090
f5f5f5803935
equal deleted inserted replaced
11032:84a66daa5e34 11033:6b197c3389f7
21 class EricServerProfilesDialog(QDialog, Ui_EricServerProfilesDialog): 21 class EricServerProfilesDialog(QDialog, Ui_EricServerProfilesDialog):
22 """ 22 """
23 Class implementing a dialog to manage server connection profiles. 23 Class implementing a dialog to manage server connection profiles.
24 """ 24 """
25 25
26 def __init__(self, profiles, parent=None): 26 def __init__(self, connectionProfiles, parent=None):
27 """ 27 """
28 Constructor 28 Constructor
29 29
30 @param profiles dictionary containing the server connection profiles 30 @param connectionProfiles dictionary containing the server connection profiles
31 @type dict 31 @type dict
32 @param parent reference to the parent widget (defaults to None) 32 @param parent reference to the parent widget (defaults to None)
33 @type QWidget (optional) 33 @type QWidget (optional)
34 """ 34 """
35 super().__init__(parent) 35 super().__init__(parent)
36 self.setupUi(self) 36 self.setupUi(self)
37 37
38 self.__profiles = copy.deepcopy(profiles) 38 self.__connectionProfiles = copy.deepcopy(connectionProfiles)
39 # adapt connection profiles generated by eric-ide < 24.12
40 for (
41 connectionProfile,
42 connectionProfileData,
43 ) in self.__connectionProfiles.items():
44 if len(connectionProfileData) < 4:
45 self.__connectionProfiles[connectionProfile].append("")
46
39 self.__populateProfilesList() 47 self.__populateProfilesList()
40 48
41 self.on_connectionsList_itemSelectionChanged() 49 self.on_connectionsList_itemSelectionChanged()
42 50
43 def __populateProfilesList(self): 51 def __populateProfilesList(self):
44 """ 52 """
45 Private method to (re-) populate the list of server connection profiles. 53 Private method to (re-) populate the list of server connection profiles.
46 """ 54 """
47 self.connectionsList.clear() 55 self.connectionsList.clear()
48 56
49 for profile in self.__profiles: 57 for connectionProfile in self.__connectionProfiles:
50 itm = QListWidgetItem(profile, self.connectionsList) 58 itm = QListWidgetItem(connectionProfile, self.connectionsList)
51 itm.setData(Qt.ItemDataRole.UserRole, self.__profiles[profile]) 59 itm.setData(
60 Qt.ItemDataRole.UserRole, self.__connectionProfiles[connectionProfile]
61 )
52 62
53 def __getProfilesList(self): 63 def __getProfilesList(self):
54 """ 64 """
55 Private method to get the list of defined profile names. 65 Private method to get the list of defined profile names.
56 66
143 """ 153 """
144 profiles = {} 154 profiles = {}
145 155
146 for row in range(self.connectionsList.count()): 156 for row in range(self.connectionsList.count()):
147 itm = self.connectionsList.item(row) 157 itm = self.connectionsList.item(row)
148 profiles[itm.text()] = itm.data(Qt.ItemDataRole.UserRole) 158 profileData = itm.data(Qt.ItemDataRole.UserRole)
159 if not profileData[3]:
160 # make it backward compatible (eric-ide < 24.12)
161 profileData = profileData[:3]
162 profiles[itm.text()] = profileData
149 163
150 return profiles 164 return profiles

eric ide

mercurial