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

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class GitAddRemoteDialog(QDialog, Ui_GitAddRemoteDialog): 16 class GitAddRemoteDialog(QDialog, Ui_GitAddRemoteDialog):
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, parent=None): 21 def __init__(self, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param parent reference to the parent widget 25 @param parent reference to the parent widget
25 @type QWidget 26 @type QWidget
26 """ 27 """
27 super().__init__(parent) 28 super().__init__(parent)
28 self.setupUi(self) 29 self.setupUi(self)
29 30
30 self.__updateOK() 31 self.__updateOK()
31 32
32 msh = self.minimumSizeHint() 33 msh = self.minimumSizeHint()
33 self.resize(max(self.width(), msh.width()), msh.height()) 34 self.resize(max(self.width(), msh.width()), msh.height())
34 35
35 def __updateOK(self): 36 def __updateOK(self):
36 """ 37 """
37 Private method to update the status of the OK button. 38 Private method to update the status of the OK button.
38 """ 39 """
39 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( 40 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
40 self.nameEdit.text() != "" and 41 self.nameEdit.text() != "" and self.urlEdit.text() != ""
41 self.urlEdit.text() != "") 42 )
42 43
43 @pyqtSlot(str) 44 @pyqtSlot(str)
44 def on_nameEdit_textChanged(self, txt): 45 def on_nameEdit_textChanged(self, txt):
45 """ 46 """
46 Private slot handling changes of the entered name. 47 Private slot handling changes of the entered name.
47 48
48 @param txt current text 49 @param txt current text
49 @type str 50 @type str
50 """ 51 """
51 self.__updateOK() 52 self.__updateOK()
52 53
53 @pyqtSlot(str) 54 @pyqtSlot(str)
54 def on_urlEdit_textChanged(self, txt): 55 def on_urlEdit_textChanged(self, txt):
55 """ 56 """
56 Private slot handling changes of the entered URL. 57 Private slot handling changes of the entered URL.
57 58
58 @param txt current text 59 @param txt current text
59 @type str 60 @type str
60 """ 61 """
61 self.__updateOK() 62 self.__updateOK()
62 63
63 @pyqtSlot(str) 64 @pyqtSlot(str)
64 def on_userEdit_textChanged(self, txt): 65 def on_userEdit_textChanged(self, txt):
65 """ 66 """
66 Private slot handling changes of the entered user name. 67 Private slot handling changes of the entered user name.
67 68
68 @param txt current text 69 @param txt current text
69 @type str 70 @type str
70 """ 71 """
71 self.passwordEdit.setEnabled(bool(txt)) 72 self.passwordEdit.setEnabled(bool(txt))
72 73
73 def getData(self): 74 def getData(self):
74 """ 75 """
75 Public method to get the entered data. 76 Public method to get the entered data.
76 77
77 @return tuple with name and URL of the remote repository 78 @return tuple with name and URL of the remote repository
78 @rtype tuple of (str, str) 79 @rtype tuple of (str, str)
79 """ 80 """
80 url = QUrl.fromUserInput(self.urlEdit.text()) 81 url = QUrl.fromUserInput(self.urlEdit.text())
81 userName = self.userEdit.text() 82 userName = self.userEdit.text()
82 if userName: 83 if userName:
83 url.setUserName(userName) 84 url.setUserName(userName)
84 password = self.passwordEdit.text() 85 password = self.passwordEdit.text()
85 if password: 86 if password:
86 url.setPassword(password) 87 url.setPassword(password)
87 88
88 return self.nameEdit.text(), url.toString() 89 return self.nameEdit.text(), url.toString()

eric ide

mercurial