9 """ |
9 """ |
10 |
10 |
11 from PyQt6.QtCore import QUrl, pyqtSlot |
11 from PyQt6.QtCore import QUrl, pyqtSlot |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
12 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
13 |
13 |
14 from eric7 import Preferences, Utilities |
14 from eric7 import Preferences |
15 from eric7.EricGui import EricPixmapCache |
15 from eric7.EricGui import EricPixmapCache |
16 from eric7.EricWidgets import EricFileDialog |
16 from eric7.EricWidgets import EricFileDialog |
17 from eric7.EricWidgets.EricCompleters import EricDirCompleter |
17 from eric7.EricWidgets.EricCompleters import EricDirCompleter |
|
18 from eric7.SystemUtilities import FileSystemUtilities, OSUtilities |
18 |
19 |
19 from .Config import ConfigGitSchemes |
20 from .Config import ConfigGitSchemes |
20 from .Ui_GitNewProjectOptionsDialog import Ui_GitNewProjectOptionsDialog |
21 from .Ui_GitNewProjectOptionsDialog import Ui_GitNewProjectOptionsDialog |
21 |
22 |
22 |
23 |
47 self.vcsUrlCombo.setEditText("") |
48 self.vcsUrlCombo.setEditText("") |
48 |
49 |
49 self.vcsDirectoryCompleter = EricDirCompleter(self.vcsUrlCombo) |
50 self.vcsDirectoryCompleter = EricDirCompleter(self.vcsUrlCombo) |
50 self.vcsProjectDirCompleter = EricDirCompleter(self.vcsProjectDirEdit) |
51 self.vcsProjectDirCompleter = EricDirCompleter(self.vcsProjectDirEdit) |
51 |
52 |
52 ipath = Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() |
53 ipath = Preferences.getMultiProject("Workspace") or OSUtilities.getHomeDir() |
53 self.__initPaths = [ |
54 self.__initPaths = [ |
54 Utilities.fromNativeSeparators(ipath), |
55 FileSystemUtilities.fromNativeSeparators(ipath), |
55 Utilities.fromNativeSeparators(ipath) + "/", |
56 FileSystemUtilities.fromNativeSeparators(ipath) + "/", |
56 ] |
57 ] |
57 self.vcsProjectDirEdit.setText( |
58 self.vcsProjectDirEdit.setText( |
58 Utilities.toNativeSeparators(self.__initPaths[0]) |
59 FileSystemUtilities.toNativeSeparators(self.__initPaths[0]) |
59 ) |
60 ) |
60 |
61 |
61 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
62 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
62 |
63 |
63 msh = self.minimumSizeHint() |
64 msh = self.minimumSizeHint() |
69 Private slot to handle a change of the project directory. |
70 Private slot to handle a change of the project directory. |
70 |
71 |
71 @param txt name of the project directory (string) |
72 @param txt name of the project directory (string) |
72 """ |
73 """ |
73 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
74 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( |
74 bool(txt) and Utilities.fromNativeSeparators(txt) not in self.__initPaths |
75 bool(txt) |
|
76 and FileSystemUtilities.fromNativeSeparators(txt) not in self.__initPaths |
75 ) |
77 ) |
76 |
78 |
77 @pyqtSlot() |
79 @pyqtSlot() |
78 def on_vcsUrlButton_clicked(self): |
80 def on_vcsUrlButton_clicked(self): |
79 """ |
81 """ |
85 self.vcsUrlCombo.currentText(), |
87 self.vcsUrlCombo.currentText(), |
86 EricFileDialog.ShowDirsOnly, |
88 EricFileDialog.ShowDirsOnly, |
87 ) |
89 ) |
88 |
90 |
89 if directory: |
91 if directory: |
90 self.vcsUrlCombo.setEditText(Utilities.toNativeSeparators(directory)) |
92 self.vcsUrlCombo.setEditText( |
|
93 FileSystemUtilities.toNativeSeparators(directory) |
|
94 ) |
91 |
95 |
92 @pyqtSlot() |
96 @pyqtSlot() |
93 def on_projectDirButton_clicked(self): |
97 def on_projectDirButton_clicked(self): |
94 """ |
98 """ |
95 Private slot to display a directory selection dialog. |
99 Private slot to display a directory selection dialog. |
100 self.vcsProjectDirEdit.text(), |
104 self.vcsProjectDirEdit.text(), |
101 EricFileDialog.ShowDirsOnly, |
105 EricFileDialog.ShowDirsOnly, |
102 ) |
106 ) |
103 |
107 |
104 if directory: |
108 if directory: |
105 self.vcsProjectDirEdit.setText(Utilities.toNativeSeparators(directory)) |
109 self.vcsProjectDirEdit.setText( |
|
110 FileSystemUtilities.toNativeSeparators(directory) |
|
111 ) |
106 |
112 |
107 @pyqtSlot(str) |
113 @pyqtSlot(str) |
108 def on_vcsUrlCombo_editTextChanged(self, txt): |
114 def on_vcsUrlCombo_editTextChanged(self, txt): |
109 """ |
115 """ |
110 Private slot to handle changes of the URL. |
116 Private slot to handle changes of the URL. |