24 class SvnOptionsDialog(QDialog, Ui_SvnOptionsDialog): |
24 class SvnOptionsDialog(QDialog, Ui_SvnOptionsDialog): |
25 """ |
25 """ |
26 Class implementing a dialog to enter options used to start a project in the |
26 Class implementing a dialog to enter options used to start a project in the |
27 repository. |
27 repository. |
28 """ |
28 """ |
|
29 |
29 def __init__(self, vcs, project, parent=None): |
30 def __init__(self, vcs, project, parent=None): |
30 """ |
31 """ |
31 Constructor |
32 Constructor |
32 |
33 |
33 @param vcs reference to the version control object |
34 @param vcs reference to the version control object |
34 @param project reference to the project object |
35 @param project reference to the project object |
35 @param parent parent widget (QWidget) |
36 @param parent parent widget (QWidget) |
36 """ |
37 """ |
37 super().__init__(parent) |
38 super().__init__(parent) |
38 self.setupUi(self) |
39 self.setupUi(self) |
39 |
40 |
40 self.vcsUrlPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
41 self.vcsUrlPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) |
41 |
42 |
42 self.project = project |
43 self.project = project |
43 |
44 |
44 self.protocolCombo.addItems(ConfigSvnProtocols) |
45 self.protocolCombo.addItems(ConfigSvnProtocols) |
45 |
46 |
46 hd = Utilities.toNativeSeparators(QDir.homePath()) |
47 hd = Utilities.toNativeSeparators(QDir.homePath()) |
47 hd = os.path.join(hd, 'subversionroot') |
48 hd = os.path.join(hd, "subversionroot") |
48 self.vcsUrlPicker.setText(hd) |
49 self.vcsUrlPicker.setText(hd) |
49 |
50 |
50 self.vcs = vcs |
51 self.vcs = vcs |
51 |
52 |
52 self.localPath = hd |
53 self.localPath = hd |
53 self.networkPath = "localhost/" |
54 self.networkPath = "localhost/" |
54 self.localProtocol = True |
55 self.localProtocol = True |
55 |
56 |
56 msh = self.minimumSizeHint() |
57 msh = self.minimumSizeHint() |
57 self.resize(max(self.width(), msh.width()), msh.height()) |
58 self.resize(max(self.width(), msh.width()), msh.height()) |
58 |
59 |
59 @pyqtSlot() |
60 @pyqtSlot() |
60 def on_vcsUrlPicker_pickerButtonClicked(self): |
61 def on_vcsUrlPicker_pickerButtonClicked(self): |
61 """ |
62 """ |
62 Private slot to display a repository browser dialog. |
63 Private slot to display a repository browser dialog. |
63 """ |
64 """ |
64 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog |
65 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog |
|
66 |
65 dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) |
67 dlg = SvnRepoBrowserDialog(self.vcs, mode="select", parent=self) |
66 dlg.start( |
68 dlg.start(self.protocolCombo.currentText() + self.vcsUrlPicker.text()) |
67 self.protocolCombo.currentText() + self.vcsUrlPicker.text()) |
|
68 if dlg.exec() == QDialog.DialogCode.Accepted: |
69 if dlg.exec() == QDialog.DialogCode.Accepted: |
69 url = dlg.getSelectedUrl() |
70 url = dlg.getSelectedUrl() |
70 if url: |
71 if url: |
71 protocol = url.split("://")[0] |
72 protocol = url.split("://")[0] |
72 path = url.split("://")[1] |
73 path = url.split("://")[1] |
73 self.protocolCombo.setCurrentIndex( |
74 self.protocolCombo.setCurrentIndex( |
74 self.protocolCombo.findText(protocol + "://")) |
75 self.protocolCombo.findText(protocol + "://") |
|
76 ) |
75 self.vcsUrlPicker.setText(path) |
77 self.vcsUrlPicker.setText(path) |
76 |
78 |
77 @pyqtSlot(int) |
79 @pyqtSlot(int) |
78 def on_protocolCombo_activated(self, index): |
80 def on_protocolCombo_activated(self, index): |
79 """ |
81 """ |
80 Private slot to switch the status of the directory selection button. |
82 Private slot to switch the status of the directory selection button. |
81 |
83 |
82 @param index index of the selected entry |
84 @param index index of the selected entry |
83 @type int |
85 @type int |
84 """ |
86 """ |
85 protocol = self.protocolCombo.itemText(index) |
87 protocol = self.protocolCombo.itemText(index) |
86 if protocol == "file://": |
88 if protocol == "file://": |
92 if self.localProtocol: |
94 if self.localProtocol: |
93 self.localPath = self.vcsUrlPicker.text() |
95 self.localPath = self.vcsUrlPicker.text() |
94 self.vcsUrlPicker.setText(self.networkPath) |
96 self.vcsUrlPicker.setText(self.networkPath) |
95 self.vcsUrlLabel.setText(self.tr("&URL:")) |
97 self.vcsUrlLabel.setText(self.tr("&URL:")) |
96 self.localProtocol = False |
98 self.localProtocol = False |
97 |
99 |
98 @pyqtSlot(str) |
100 @pyqtSlot(str) |
99 def on_vcsUrlPicker_textChanged(self, txt): |
101 def on_vcsUrlPicker_textChanged(self, txt): |
100 """ |
102 """ |
101 Private slot to handle changes of the URL. |
103 Private slot to handle changes of the URL. |
102 |
104 |
103 @param txt current text of the line edit (string) |
105 @param txt current text of the line edit (string) |
104 """ |
106 """ |
105 enable = "://" not in txt |
107 enable = "://" not in txt |
106 self.buttonBox.button( |
108 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
107 QDialogButtonBox.StandardButton.Ok).setEnabled(enable) |
109 |
108 |
|
109 def getData(self): |
110 def getData(self): |
110 """ |
111 """ |
111 Public slot to retrieve the data entered into the dialog. |
112 Public slot to retrieve the data entered into the dialog. |
112 |
113 |
113 @return a dictionary containing the data entered |
114 @return a dictionary containing the data entered |
114 """ |
115 """ |
115 scheme = self.protocolCombo.currentText() |
116 scheme = self.protocolCombo.currentText() |
116 url = self.vcsUrlPicker.text() |
117 url = self.vcsUrlPicker.text() |
117 vcsdatadict = { |
118 vcsdatadict = { |
118 "url": '{0}{1}'.format(scheme, url), |
119 "url": "{0}{1}".format(scheme, url), |
119 "message": self.vcsLogEdit.text(), |
120 "message": self.vcsLogEdit.text(), |
120 "standardLayout": self.layoutCheckBox.isChecked(), |
121 "standardLayout": self.layoutCheckBox.isChecked(), |
121 } |
122 } |
122 return vcsdatadict |
123 return vcsdatadict |