21 from .Ui_HgNewProjectOptionsDialog import Ui_HgNewProjectOptionsDialog |
21 from .Ui_HgNewProjectOptionsDialog import Ui_HgNewProjectOptionsDialog |
22 from .Config import ConfigHgProtocols |
22 from .Config import ConfigHgProtocols |
23 |
23 |
24 import Utilities |
24 import Utilities |
25 import Preferences |
25 import Preferences |
|
26 import UI.PixmapCache |
26 |
27 |
27 |
28 |
28 class HgNewProjectOptionsDialog(QDialog, Ui_HgNewProjectOptionsDialog): |
29 class HgNewProjectOptionsDialog(QDialog, Ui_HgNewProjectOptionsDialog): |
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(HgNewProjectOptionsDialog, self).__init__(parent) |
41 super(HgNewProjectOptionsDialog, self).__init__(parent) |
41 self.setupUi(self) |
42 self.setupUi(self) |
42 |
43 |
|
44 self.projectDirButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
|
45 self.vcsUrlButton.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(ConfigHgProtocols) |
50 self.protocolCombo.addItems(ConfigHgProtocols) |
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 |
|
62 ipath = Preferences.getMultiProject("Workspace") or \ |
|
63 Utilities.getHomeDir() |
|
64 self.__initPaths = [ |
|
65 Utilities.fromNativeSeparators(ipath), |
|
66 Utilities.fromNativeSeparators(ipath) + "/", |
|
67 ] |
58 self.vcsProjectDirEdit.setText( |
68 self.vcsProjectDirEdit.setText( |
59 Utilities.toNativeSeparators( |
69 Utilities.toNativeSeparators(self.__initPaths[0])) |
60 Preferences.getMultiProject("Workspace") or |
70 |
61 Utilities.getHomeDir())) |
71 self.lfNoteLabel.setVisible(self.vcs.isExtensionActive("largefiles")) |
|
72 self.largeCheckBox.setVisible(self.vcs.isExtensionActive("largefiles")) |
|
73 |
|
74 self.resize(self.width(), self.minimumSizeHint().height()) |
|
75 |
|
76 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
|
77 |
|
78 msh = self.minimumSizeHint() |
|
79 self.resize(max(self.width(), msh.width()), msh.height()) |
|
80 |
|
81 @pyqtSlot(str) |
|
82 def on_vcsProjectDirEdit_textChanged(self, txt): |
|
83 """ |
|
84 Private slot to handle a change of the project directory. |
|
85 |
|
86 @param txt name of the project directory (string) |
|
87 """ |
|
88 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
|
89 bool(txt) and |
|
90 Utilities.fromNativeSeparators(txt) not in self.__initPaths) |
62 |
91 |
63 @pyqtSlot() |
92 @pyqtSlot() |
64 def on_vcsUrlButton_clicked(self): |
93 def on_vcsUrlButton_clicked(self): |
65 """ |
94 """ |
66 Private slot to display a selection dialog. |
95 Private slot to display a selection dialog. |
67 """ |
96 """ |
68 if self.protocolCombo.currentText() == "file://": |
97 if self.protocolCombo.currentText() == "file://": |
69 directory = E5FileDialog.getExistingDirectory( |
98 directory = E5FileDialog.getExistingDirectory( |
70 self, |
99 self, |
71 self.trUtf8("Select Repository-Directory"), |
100 self.tr("Select Repository-Directory"), |
72 self.vcsUrlEdit.text(), |
101 self.vcsUrlEdit.text(), |
73 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
102 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
74 |
103 |
75 if directory: |
104 if directory: |
76 self.vcsUrlEdit.setText( |
105 self.vcsUrlEdit.setText( |
81 """ |
110 """ |
82 Private slot to display a directory selection dialog. |
111 Private slot to display a directory selection dialog. |
83 """ |
112 """ |
84 directory = E5FileDialog.getExistingDirectory( |
113 directory = E5FileDialog.getExistingDirectory( |
85 self, |
114 self, |
86 self.trUtf8("Select Project Directory"), |
115 self.tr("Select Project Directory"), |
87 self.vcsProjectDirEdit.text(), |
116 self.vcsProjectDirEdit.text(), |
88 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
117 E5FileDialog.Options(E5FileDialog.ShowDirsOnly)) |
89 |
118 |
90 if directory: |
119 if directory: |
91 self.vcsProjectDirEdit.setText( |
120 self.vcsProjectDirEdit.setText( |
131 if scheme == "file://" and url[0] not in ["\\", "/"]: |
160 if scheme == "file://" and url[0] not in ["\\", "/"]: |
132 url = "/{0}".format(url) |
161 url = "/{0}".format(url) |
133 vcsdatadict = { |
162 vcsdatadict = { |
134 "url": '{0}{1}'.format(scheme, url), |
163 "url": '{0}{1}'.format(scheme, url), |
135 "revision": self.vcsRevisionEdit.text(), |
164 "revision": self.vcsRevisionEdit.text(), |
|
165 "largefiles": self.largeCheckBox.isChecked(), |
136 } |
166 } |
137 return (self.vcsProjectDirEdit.text(), vcsdatadict) |
167 return (self.vcsProjectDirEdit.text(), vcsdatadict) |