Plugins/VcsPlugins/vcsGit/GitAddRemoteDialog.py

changeset 6324
b11c36cba2a1
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
equal deleted inserted replaced
6323:610b676336be 6324:b11c36cba2a1
7 Module implementing a dialog to enter the data of a remote repository. 7 Module implementing a dialog to enter the data of a remote repository.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt5.QtCore import pyqtSlot 12 from PyQt5.QtCore import pyqtSlot, QUrl
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox 13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
14 14
15 from .Ui_GitAddRemoteDialog import Ui_GitAddRemoteDialog 15 from .Ui_GitAddRemoteDialog import Ui_GitAddRemoteDialog
16 16
17 17
21 """ 21 """
22 def __init__(self, parent=None): 22 def __init__(self, parent=None):
23 """ 23 """
24 Constructor 24 Constructor
25 25
26 @param parent reference to the parent widget (QWidget) 26 @param parent reference to the parent widget
27 @type QWidget
27 """ 28 """
28 super(GitAddRemoteDialog, self).__init__(parent) 29 super(GitAddRemoteDialog, self).__init__(parent)
29 self.setupUi(self) 30 self.setupUi(self)
30 31
31 self.__updateOK() 32 self.__updateOK()
33
34 msh = self.minimumSizeHint()
35 self.resize(max(self.width(), msh.width()), msh.height())
32 36
33 def __updateOK(self): 37 def __updateOK(self):
34 """ 38 """
35 Private method to update the status of the OK button. 39 Private method to update the status of the OK button.
36 """ 40 """
41 @pyqtSlot(str) 45 @pyqtSlot(str)
42 def on_nameEdit_textChanged(self, txt): 46 def on_nameEdit_textChanged(self, txt):
43 """ 47 """
44 Private slot handling changes of the entered name. 48 Private slot handling changes of the entered name.
45 49
46 @param txt current text (string) 50 @param txt current text
51 @type str
47 """ 52 """
48 self.__updateOK() 53 self.__updateOK()
49 54
50 @pyqtSlot(str) 55 @pyqtSlot(str)
51 def on_urlEdit_textChanged(self, txt): 56 def on_urlEdit_textChanged(self, txt):
52 """ 57 """
53 Private slot handling changes of the entered URL. 58 Private slot handling changes of the entered URL.
54 59
55 @param txt current text (string) 60 @param txt current text
61 @type str
56 """ 62 """
57 self.__updateOK() 63 self.__updateOK()
64
65 @pyqtSlot(str)
66 def on_userEdit_textChanged(self, txt):
67 """
68 Private slot handling changes of the entered user name.
69
70 @param txt current text
71 @type str
72 """
73 self.passwordEdit.setEnabled(bool(txt))
58 74
59 def getData(self): 75 def getData(self):
60 """ 76 """
61 Public method to get the entered data. 77 Public method to get the entered data.
62 78
63 @return tuple with the name (string) and URL (string) of 79 @return tuple with name and URL of the remote repository
64 the remote repository 80 @rtype tuple of (str, str)
65 """ 81 """
66 return self.nameEdit.text(), self.urlEdit.text() 82 url = QUrl.fromUserInput(self.urlEdit.text())
83 userName = self.userEdit.text()
84 if userName:
85 url.setUserName(userName)
86 password = self.passwordEdit.text()
87 if password:
88 url.setPassword(password)
89
90 return self.nameEdit.text(), url.toString()

eric ide

mercurial