Plugins/VcsPlugins/vcsGit/GitAddRemoteDialog.py

changeset 6324
b11c36cba2a1
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
--- a/Plugins/VcsPlugins/vcsGit/GitAddRemoteDialog.py	Sun Jun 03 11:30:57 2018 +0200
+++ b/Plugins/VcsPlugins/vcsGit/GitAddRemoteDialog.py	Sun Jun 03 14:03:19 2018 +0200
@@ -9,7 +9,7 @@
 
 from __future__ import unicode_literals
 
-from PyQt5.QtCore import pyqtSlot
+from PyQt5.QtCore import pyqtSlot, QUrl
 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
 
 from .Ui_GitAddRemoteDialog import Ui_GitAddRemoteDialog
@@ -23,12 +23,16 @@
         """
         Constructor
         
-        @param parent reference to the parent widget (QWidget)
+        @param parent reference to the parent widget
+        @type QWidget
         """
         super(GitAddRemoteDialog, self).__init__(parent)
         self.setupUi(self)
         
         self.__updateOK()
+        
+        msh = self.minimumSizeHint()
+        self.resize(max(self.width(), msh.width()), msh.height())
     
     def __updateOK(self):
         """
@@ -43,7 +47,8 @@
         """
         Private slot handling changes of the entered name.
         
-        @param txt current text (string)
+        @param txt current text
+        @type str
         """
         self.__updateOK()
     
@@ -52,15 +57,34 @@
         """
         Private slot handling changes of the entered URL.
         
-        @param txt current text (string)
+        @param txt current text
+        @type str
         """
         self.__updateOK()
     
+    @pyqtSlot(str)
+    def on_userEdit_textChanged(self, txt):
+        """
+        Private slot handling changes of the entered user name.
+        
+        @param txt current text
+        @type str
+        """
+        self.passwordEdit.setEnabled(bool(txt))
+    
     def getData(self):
         """
         Public method to get the entered data.
         
-        @return tuple with the name (string) and URL (string) of
-            the remote repository
+        @return tuple with name and URL of the remote repository
+        @rtype tuple of (str, str)
         """
-        return self.nameEdit.text(), self.urlEdit.text()
+        url = QUrl.fromUserInput(self.urlEdit.text())
+        userName = self.userEdit.text()
+        if userName:
+            url.setUserName(userName)
+            password = self.passwordEdit.text()
+            if password:
+                url.setPassword(password)
+        
+        return self.nameEdit.text(), url.toString()

eric ide

mercurial