19 from .Ui_HgAddSubrepositoryDialog import Ui_HgAddSubrepositoryDialog |
19 from .Ui_HgAddSubrepositoryDialog import Ui_HgAddSubrepositoryDialog |
20 |
20 |
21 |
21 |
22 class HgAddSubrepositoryDialog(QDialog, Ui_HgAddSubrepositoryDialog): |
22 class HgAddSubrepositoryDialog(QDialog, Ui_HgAddSubrepositoryDialog): |
23 """ |
23 """ |
24 Class implementing a dialog to add a subrepository. |
24 Class implementing a dialog to add a sub-repository. |
25 """ |
25 """ |
26 def __init__(self, projectPath, parent=None): |
26 def __init__(self, projectPath, parent=None): |
27 """ |
27 """ |
28 Constructor |
28 Constructor |
29 |
29 |
77 """ |
77 """ |
78 Private slot to handle the path selection via a directory selection dialog. |
78 Private slot to handle the path selection via a directory selection dialog. |
79 """ |
79 """ |
80 path = E5FileDialog.getExistingDirectory( |
80 path = E5FileDialog.getExistingDirectory( |
81 self, |
81 self, |
82 self.trUtf8("Add Subrepository"), |
82 self.trUtf8("Add Sub-repository"), |
83 os.path.join(self.__projectPath, self.pathEdit.text()), |
83 os.path.join(self.__projectPath, self.pathEdit.text()), |
84 E5FileDialog.Options(E5FileDialog.Option(0))) |
84 E5FileDialog.Options(E5FileDialog.Option(0))) |
85 |
85 |
86 if path: |
86 if path: |
87 if path.startswith(self.__projectPath): |
87 if path.startswith(self.__projectPath): |
88 path = path.replace(self.__projectPath, "")[1:] |
88 path = path.replace(self.__projectPath, "")[1:] |
89 self.pathEdit.setText(Utilities.toNativeSeparators(path)) |
89 self.pathEdit.setText(Utilities.toNativeSeparators(path)) |
90 else: |
90 else: |
91 E5MessageBox.critical(self, |
91 E5MessageBox.critical(self, |
92 self.trUtf8("Add Subrepository"), |
92 self.trUtf8("Add Sub-repository"), |
93 self.trUtf8("""The subrepository path must be inside the project.""")) |
93 self.trUtf8("""The sub-repository path must be inside""" |
|
94 """ the project.""")) |
94 return |
95 return |
95 |
96 |
96 def getData(self): |
97 def getData(self): |
97 """ |
98 """ |
98 Public method to get the data. |
99 Public method to get the data. |
99 |
100 |
100 @return tuple containing the relative path within the project, the subrepository |
101 @return tuple containing the relative path within the project, the sub-repository |
101 type and the subrepository URL (string, string, string) |
102 type and the sub-repository URL (string, string, string) |
102 """ |
103 """ |
103 return ( |
104 return ( |
104 self.pathEdit.text(), |
105 self.pathEdit.text(), |
105 self.typeCombo.itemData(self.typeCombo.currentIndex()), |
106 self.typeCombo.itemData(self.typeCombo.currentIndex()), |
106 self.urlEdit.text() |
107 self.urlEdit.text() |