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

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9473
3f23dbf37dbe
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class GitChangeRemoteUrlDialog(QDialog, Ui_GitChangeRemoteUrlDialog): 16 class GitChangeRemoteUrlDialog(QDialog, Ui_GitChangeRemoteUrlDialog):
17 """ 17 """
18 Class implementing a dialog to change the URL of a remote git repository. 18 Class implementing a dialog to change the URL of a remote git 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 self.__userInfo = url.userInfo() 36 self.__userInfo = url.userInfo()
36 37
37 self.nameEdit.setText(remoteName) 38 self.nameEdit.setText(remoteName)
38 self.urlEdit.setText( 39 self.urlEdit.setText(url.toString(QUrl.UrlFormattingOption.RemoveUserInfo))
39 url.toString(QUrl.UrlFormattingOption.RemoveUserInfo)) 40
40
41 self.__updateOK() 41 self.__updateOK()
42 42
43 self.newUrlEdit.setFocus(Qt.FocusReason.OtherFocusReason) 43 self.newUrlEdit.setFocus(Qt.FocusReason.OtherFocusReason)
44 44
45 msh = self.minimumSizeHint() 45 msh = self.minimumSizeHint()
46 self.resize(max(self.width(), msh.width()), msh.height()) 46 self.resize(max(self.width(), msh.width()), msh.height())
47 47
48 def __updateOK(self): 48 def __updateOK(self):
49 """ 49 """
50 Private method to update the status of the OK button. 50 Private method to update the status of the OK button.
51 """ 51 """
52 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( 52 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
53 bool(self.newUrlEdit.text()) 53 bool(self.newUrlEdit.text())
54 ) 54 )
55 55
56 @pyqtSlot(str) 56 @pyqtSlot(str)
57 def on_newUrlEdit_textChanged(self, txt): 57 def on_newUrlEdit_textChanged(self, txt):
58 """ 58 """
59 Private slot handling changes of the entered URL. 59 Private slot handling changes of the entered URL.
60 60
61 @param txt current text 61 @param txt current text
62 @type str 62 @type str
63 """ 63 """
64 self.__updateOK() 64 self.__updateOK()
65 65
66 def getData(self): 66 def getData(self):
67 """ 67 """
68 Public method to get the entered data. 68 Public method to get the entered data.
69 69
70 @return tuple with name and new URL of the remote repository 70 @return tuple with name and new URL of the remote repository
71 @rtype tuple of (str, str) 71 @rtype tuple of (str, str)
72 """ 72 """
73 url = QUrl.fromUserInput(self.newUrlEdit.text()) 73 url = QUrl.fromUserInput(self.newUrlEdit.text())
74 if self.__userInfo: 74 if self.__userInfo:
75 url.setUserInfo(self.__userInfo) 75 url.setUserInfo(self.__userInfo)
76 76
77 return self.nameEdit.text(), url.toString() 77 return self.nameEdit.text(), url.toString()

eric ide

mercurial