Plugins/VcsPlugins/vcsSubversion/SvnNewProjectOptionsDialog.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3366
6084bb3c3911
child 3656
441956d8fce5
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
21 from .Ui_SvnNewProjectOptionsDialog import Ui_SvnNewProjectOptionsDialog 21 from .Ui_SvnNewProjectOptionsDialog import Ui_SvnNewProjectOptionsDialog
22 from .Config import ConfigSvnProtocols 22 from .Config import ConfigSvnProtocols
23 23
24 import Utilities 24 import Utilities
25 import Preferences 25 import Preferences
26 import UI.PixmapCache
26 27
27 28
28 class SvnNewProjectOptionsDialog(QDialog, Ui_SvnNewProjectOptionsDialog): 29 class SvnNewProjectOptionsDialog(QDialog, Ui_SvnNewProjectOptionsDialog):
29 """ 30 """
30 Class implementing the Options Dialog for a new project from the 31 Class implementing the Options Dialog for a new project from the
38 @param parent parent widget (QWidget) 39 @param parent parent widget (QWidget)
39 """ 40 """
40 super(SvnNewProjectOptionsDialog, self).__init__(parent) 41 super(SvnNewProjectOptionsDialog, self).__init__(parent)
41 self.setupUi(self) 42 self.setupUi(self)
42 43
44 self.vcsUrlButton.setIcon(UI.PixmapCache.getIcon("open.png"))
45 self.projectDirButton.setIcon(UI.PixmapCache.getIcon("open.png"))
46
43 self.vcsDirectoryCompleter = E5DirCompleter(self.vcsUrlEdit) 47 self.vcsDirectoryCompleter = E5DirCompleter(self.vcsUrlEdit)
44 self.vcsProjectDirCompleter = E5DirCompleter(self.vcsProjectDirEdit) 48 self.vcsProjectDirCompleter = E5DirCompleter(self.vcsProjectDirEdit)
45 49
46 self.protocolCombo.addItems(ConfigSvnProtocols) 50 self.protocolCombo.addItems(ConfigSvnProtocols)
47 51
53 57
54 self.localPath = hd 58 self.localPath = hd
55 self.networkPath = "localhost/" 59 self.networkPath = "localhost/"
56 self.localProtocol = True 60 self.localProtocol = True
57 61
58 self.vcsProjectDirEdit.setText(Utilities.toNativeSeparators( 62 ipath = Preferences.getMultiProject("Workspace") or \
59 Preferences.getMultiProject("Workspace") or 63 Utilities.getHomeDir()
60 Utilities.getHomeDir())) 64 self.__initPaths = [
65 Utilities.fromNativeSeparators(ipath),
66 Utilities.fromNativeSeparators(ipath) + "/",
67 ]
68 self.vcsProjectDirEdit.setText(
69 Utilities.toNativeSeparators(self.__initPaths[0]))
70
71 self.resize(self.width(), self.minimumSizeHint().height())
72
73 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
74
75 msh = self.minimumSizeHint()
76 self.resize(max(self.width(), msh.width()), msh.height())
77
78 @pyqtSlot(str)
79 def on_vcsProjectDirEdit_textChanged(self, txt):
80 """
81 Private slot to handle a change of the project directory.
82
83 @param txt name of the project directory (string)
84 """
85 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
86 bool(txt) and
87 Utilities.fromNativeSeparators(txt) not in self.__initPaths)
61 88
62 @pyqtSlot() 89 @pyqtSlot()
63 def on_vcsUrlButton_clicked(self): 90 def on_vcsUrlButton_clicked(self):
64 """ 91 """
65 Private slot to display a selection dialog. 92 Private slot to display a selection dialog.
66 """ 93 """
67 if self.protocolCombo.currentText() == "file://": 94 if self.protocolCombo.currentText() == "file://":
68 directory = E5FileDialog.getExistingDirectory( 95 directory = E5FileDialog.getExistingDirectory(
69 self, 96 self,
70 self.trUtf8("Select Repository-Directory"), 97 self.tr("Select Repository-Directory"),
71 self.vcsUrlEdit.text(), 98 self.vcsUrlEdit.text(),
72 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) 99 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
73 100
74 if directory: 101 if directory:
75 self.vcsUrlEdit.setText( 102 self.vcsUrlEdit.setText(
93 """ 120 """
94 Private slot to display a directory selection dialog. 121 Private slot to display a directory selection dialog.
95 """ 122 """
96 directory = E5FileDialog.getExistingDirectory( 123 directory = E5FileDialog.getExistingDirectory(
97 self, 124 self,
98 self.trUtf8("Select Project Directory"), 125 self.tr("Select Project Directory"),
99 self.vcsProjectDirEdit.text(), 126 self.vcsProjectDirEdit.text(),
100 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) 127 E5FileDialog.Options(E5FileDialog.ShowDirsOnly))
101 128
102 if directory: 129 if directory:
103 self.vcsProjectDirEdit.setText( 130 self.vcsProjectDirEdit.setText(
122 @param protocol selected protocol (string) 149 @param protocol selected protocol (string)
123 """ 150 """
124 if protocol == "file://": 151 if protocol == "file://":
125 self.networkPath = self.vcsUrlEdit.text() 152 self.networkPath = self.vcsUrlEdit.text()
126 self.vcsUrlEdit.setText(self.localPath) 153 self.vcsUrlEdit.setText(self.localPath)
127 self.vcsUrlLabel.setText(self.trUtf8("Pat&h:")) 154 self.vcsUrlLabel.setText(self.tr("Pat&h:"))
128 self.localProtocol = True 155 self.localProtocol = True
129 else: 156 else:
130 if self.localProtocol: 157 if self.localProtocol:
131 self.localPath = self.vcsUrlEdit.text() 158 self.localPath = self.vcsUrlEdit.text()
132 self.vcsUrlEdit.setText(self.networkPath) 159 self.vcsUrlEdit.setText(self.networkPath)
133 self.vcsUrlLabel.setText(self.trUtf8("&URL:")) 160 self.vcsUrlLabel.setText(self.tr("&URL:"))
134 self.localProtocol = False 161 self.localProtocol = False
135 162
136 @pyqtSlot(str) 163 @pyqtSlot(str)
137 def on_vcsUrlEdit_textChanged(self, txt): 164 def on_vcsUrlEdit_textChanged(self, txt):
138 """ 165 """

eric ide

mercurial