Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.py

changeset 6707
30f0ac20df50
parent 6703
31b0306f0ecc
equal deleted inserted replaced
6703:31b0306f0ecc 6707:30f0ac20df50
76 76
77 @param txt current text of the combo box 77 @param txt current text of the combo box
78 @type str 78 @type str
79 """ 79 """
80 enable = False 80 enable = False
81 vcsUrlEnable = False
81 82
82 if txt: 83 if txt:
83 url = QUrl.fromUserInput(txt) 84 url = QUrl.fromUserInput(txt)
84 if url.isValid(): 85 if url.isValid():
85 if url.scheme() in ConfigGitSchemes: 86 if url.scheme() in ConfigGitSchemes:
86 enable = True 87 enable = True
88 vcsUrlEnable = url.scheme() == "file"
87 elif ':' in txt: 89 elif ':' in txt:
88 # assume scp like repository URL 90 # assume scp like repository URL
89 enable = True 91 enable = True
92 else:
93 vcsUrlEnable = True
90 94
91 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable) 95 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
92 96 self.submoduleUrlButton.setEnabled(vcsUrlEnable)
93 self.submoduleUrlButton.setEnabled(url.scheme() == "file" or
94 len(txt) == 0)
95 97
96 @pyqtSlot() 98 @pyqtSlot()
97 def on_submoduleUrlButton_clicked(self): 99 def on_submoduleUrlButton_clicked(self):
98 """ 100 """
99 Private slot to display a directory selection dialog. 101 Private slot to display a directory selection dialog.
143 indicating to enforce the operation 145 indicating to enforce the operation
144 @rtype tuple of (str, str, str, str, bool) 146 @rtype tuple of (str, str, str, str, bool)
145 """ 147 """
146 self.__saveHistory() 148 self.__saveHistory()
147 149
148 url = QUrl.fromUserInput(
149 self.submoduleUrlCombo.currentText().replace("\\", "/"))
150 path = self.submoduleDirEdit.text() 150 path = self.submoduleDirEdit.text()
151 if path: 151 if path:
152 path = self.__getRelativePath(path) 152 path = self.__getRelativePath(path)
153 153
154 try:
155 formattingOptions = QUrl.FormattingOptions(QUrl.None_)
156 except AttributeError:
157 # for PyQt < 5.6.0
158 formattingOptions = QUrl.FormattingOptions(0)
159 return ( 154 return (
160 url.toString(formattingOptions), 155 self.submoduleUrlCombo.currentText().replace("\\", "/"),
161 self.branchEdit.text(), 156 self.branchEdit.text(),
162 self.nameEdit.text(), 157 self.nameEdit.text(),
163 path, 158 path,
164 self.forceCheckBox.isChecked(), 159 self.forceCheckBox.isChecked(),
165 ) 160 )

eric ide

mercurial