src/eric7/Plugins/VcsPlugins/vcsGit/GitRemoteCredentialsDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class GitRemoteCredentialsDialog(QDialog, Ui_GitRemoteCredentialsDialog): 16 class GitRemoteCredentialsDialog(QDialog, Ui_GitRemoteCredentialsDialog):
17 """ 17 """
18 Class implementing a dialog to enter the data of a remote repository. 18 Class implementing a dialog to enter the data of a remote repository.
19 """ 19 """
20
20 def __init__(self, remoteName, remoteUrl, parent=None): 21 def __init__(self, remoteName, remoteUrl, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param remoteName name of the remote repository 25 @param remoteName name of the remote repository
25 @type str 26 @type str
26 @param remoteUrl URL of the remote repository 27 @param remoteUrl URL of the remote repository
27 @type str 28 @type str
28 @param parent reference to the parent widget 29 @param parent reference to the parent widget
29 @type QWidget 30 @type QWidget
30 """ 31 """
31 super().__init__(parent) 32 super().__init__(parent)
32 self.setupUi(self) 33 self.setupUi(self)
33 34
34 url = QUrl(remoteUrl) 35 url = QUrl(remoteUrl)
35 36
36 self.nameEdit.setText(remoteName) 37 self.nameEdit.setText(remoteName)
37 self.urlEdit.setText( 38 self.urlEdit.setText(url.toString(QUrl.UrlFormattingOption.RemoveUserInfo))
38 url.toString(QUrl.UrlFormattingOption.RemoveUserInfo))
39 self.userEdit.setText(url.userName()) 39 self.userEdit.setText(url.userName())
40 self.passwordEdit.setText(url.password()) 40 self.passwordEdit.setText(url.password())
41 41
42 self.userEdit.setFocus(Qt.FocusReason.OtherFocusReason) 42 self.userEdit.setFocus(Qt.FocusReason.OtherFocusReason)
43 43
44 msh = self.minimumSizeHint() 44 msh = self.minimumSizeHint()
45 self.resize(max(self.width(), msh.width()), msh.height()) 45 self.resize(max(self.width(), msh.width()), msh.height())
46 46
47 @pyqtSlot(str) 47 @pyqtSlot(str)
48 def on_userEdit_textChanged(self, txt): 48 def on_userEdit_textChanged(self, txt):
49 """ 49 """
50 Private slot handling changes of the entered user name. 50 Private slot handling changes of the entered user name.
51 51
52 @param txt current text 52 @param txt current text
53 @type str 53 @type str
54 """ 54 """
55 self.passwordEdit.setEnabled(bool(txt)) 55 self.passwordEdit.setEnabled(bool(txt))
56 56
57 def getData(self): 57 def getData(self):
58 """ 58 """
59 Public method to get the entered data. 59 Public method to get the entered data.
60 60
61 @return tuple with name and URL of the remote repository 61 @return tuple with name and URL of the remote repository
62 @rtype tuple of (str, str) 62 @rtype tuple of (str, str)
63 """ 63 """
64 url = QUrl.fromUserInput(self.urlEdit.text()) 64 url = QUrl.fromUserInput(self.urlEdit.text())
65 userName = self.userEdit.text() 65 userName = self.userEdit.text()
66 if userName: 66 if userName:
67 url.setUserName(userName) 67 url.setUserName(userName)
68 password = self.passwordEdit.text() 68 password = self.passwordEdit.text()
69 if password: 69 if password:
70 url.setPassword(password) 70 url.setPassword(password)
71 71
72 return self.nameEdit.text(), url.toString() 72 return self.nameEdit.text(), url.toString()

eric ide

mercurial