Plugins/VcsPlugins/vcsMercurial/HgAddSubrepositoryDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3366
6084bb3c3911
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
15 from PyQt4.QtGui import QDialog, QDialogButtonBox 15 from PyQt4.QtGui import QDialog, QDialogButtonBox
16 16
17 from E5Gui import E5FileDialog, E5MessageBox 17 from E5Gui import E5FileDialog, E5MessageBox
18 18
19 import Utilities 19 import Utilities
20 import UI.PixmapCache
20 21
21 from .Ui_HgAddSubrepositoryDialog import Ui_HgAddSubrepositoryDialog 22 from .Ui_HgAddSubrepositoryDialog import Ui_HgAddSubrepositoryDialog
22 23
23 24
24 class HgAddSubrepositoryDialog(QDialog, Ui_HgAddSubrepositoryDialog): 25 class HgAddSubrepositoryDialog(QDialog, Ui_HgAddSubrepositoryDialog):
33 @param parent reference to the parent widget (QWidget) 34 @param parent reference to the parent widget (QWidget)
34 """ 35 """
35 super(HgAddSubrepositoryDialog, self).__init__(parent) 36 super(HgAddSubrepositoryDialog, self).__init__(parent)
36 self.setupUi(self) 37 self.setupUi(self)
37 38
39 self.pathButton.setIcon(UI.PixmapCache.getIcon("open.png"))
40
38 self.__ok = self.buttonBox.button(QDialogButtonBox.Ok) 41 self.__ok = self.buttonBox.button(QDialogButtonBox.Ok)
39 self.__ok.setEnabled(False) 42 self.__ok.setEnabled(False)
40 43
41 self.__projectPath = projectPath 44 self.__projectPath = projectPath
42 45
43 self.typeCombo.addItem("Mercurial", "hg") 46 self.typeCombo.addItem("Mercurial", "hg")
44 self.typeCombo.addItem("GIT", "git") 47 self.typeCombo.addItem("GIT", "git")
45 self.typeCombo.addItem("Subversion", "svn") 48 self.typeCombo.addItem("Subversion", "svn")
49
50 msh = self.minimumSizeHint()
51 self.resize(max(self.width(), msh.width()), msh.height())
46 52
47 def __updateOk(self): 53 def __updateOk(self):
48 """ 54 """
49 Private slot to update the state of the OK button. 55 Private slot to update the state of the OK button.
50 """ 56 """
81 Private slot to handle the path selection via a directory selection 87 Private slot to handle the path selection via a directory selection
82 dialog. 88 dialog.
83 """ 89 """
84 path = E5FileDialog.getExistingDirectory( 90 path = E5FileDialog.getExistingDirectory(
85 self, 91 self,
86 self.trUtf8("Add Sub-repository"), 92 self.tr("Add Sub-repository"),
87 os.path.join(self.__projectPath, self.pathEdit.text()), 93 os.path.join(self.__projectPath, self.pathEdit.text()),
88 E5FileDialog.Options(E5FileDialog.Option(0))) 94 E5FileDialog.Options(E5FileDialog.Option(0)))
89 95
90 if path: 96 if path:
91 path = Utilities.toNativeSeparators(path) 97 path = Utilities.toNativeSeparators(path)
93 path = path.replace(self.__projectPath, "")[1:] 99 path = path.replace(self.__projectPath, "")[1:]
94 self.pathEdit.setText(path) 100 self.pathEdit.setText(path)
95 else: 101 else:
96 E5MessageBox.critical( 102 E5MessageBox.critical(
97 self, 103 self,
98 self.trUtf8("Add Sub-repository"), 104 self.tr("Add Sub-repository"),
99 self.trUtf8("""The sub-repository path must be inside""" 105 self.tr("""The sub-repository path must be inside"""
100 """ the project.""")) 106 """ the project."""))
101 return 107 return
102 108
103 def getData(self): 109 def getData(self):
104 """ 110 """
105 Public method to get the data. 111 Public method to get the data.

eric ide

mercurial