Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.py

changeset 1906
8487f9c2533b
parent 1905
7ad9161c5293
child 1910
96641d9a10a2
equal deleted inserted replaced
1905:7ad9161c5293 1906:8487f9c2533b
2 2
3 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> 3 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de>
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a dialog to add a subrepository. 7 Module implementing a dialog to add a sub-repository.
8 """ 8 """
9 9
10 import os 10 import os
11 11
12 from PyQt4.QtCore import pyqtSlot 12 from PyQt4.QtCore import pyqtSlot
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()

eric ide

mercurial