10 import os |
10 import os |
11 |
11 |
12 from PyQt6.QtCore import pyqtSlot |
12 from PyQt6.QtCore import pyqtSlot |
13 |
13 |
14 from EricWidgets.EricApplication import ericApp |
14 from EricWidgets.EricApplication import ericApp |
|
15 from EricWidgets.EricPathPicker import EricPathPickerModes |
15 |
16 |
16 from Preferences.ConfigurationPages.ConfigurationPageBase import ( |
17 from Preferences.ConfigurationPages.ConfigurationPageBase import ( |
17 ConfigurationPageBase |
18 ConfigurationPageBase |
18 ) |
19 ) |
19 from .Ui_MercurialPage import Ui_MercurialPage |
20 from .Ui_MercurialPage import Ui_MercurialPage |
37 self.setupUi(self) |
38 self.setupUi(self) |
38 self.setObjectName("MercurialPage") |
39 self.setObjectName("MercurialPage") |
39 |
40 |
40 self.__plugin = plugin |
41 self.__plugin = plugin |
41 |
42 |
|
43 self.hgPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) |
|
44 if Globals.isWindowsPlatform(): |
|
45 self.hgPicker.setFilters(self.tr( |
|
46 "Executable Files (*.exe);;" |
|
47 "All Files (*)" |
|
48 )) |
|
49 else: |
|
50 self.hgPicker.setFilters(self.tr("All Files (*)")) |
|
51 |
42 self.encodingComboBox.addItems(sorted(supportedCodecs)) |
52 self.encodingComboBox.addItems(sorted(supportedCodecs)) |
43 self.encodingModeComboBox.addItems(["strict", "ignore", "replace"]) |
53 self.encodingModeComboBox.addItems(["strict", "ignore", "replace"]) |
44 |
54 |
45 self.installButton.setEnabled(not self.__mercurialInstalled()) |
55 self.installButton.setEnabled(not self.__mercurialInstalled()) |
46 |
56 |
47 # set initial values |
57 # set initial values |
|
58 # executable override |
|
59 self.hgPicker.setText( |
|
60 self.__plugin.getPreferences("MercurialExecutablePath")) |
|
61 |
48 # global options |
62 # global options |
49 index = self.encodingComboBox.findText( |
63 index = self.encodingComboBox.findText( |
50 self.__plugin.getPreferences("Encoding")) |
64 self.__plugin.getPreferences("Encoding")) |
51 self.encodingComboBox.setCurrentIndex(index) |
65 self.encodingComboBox.setCurrentIndex(index) |
52 index = self.encodingModeComboBox.findText( |
66 index = self.encodingModeComboBox.findText( |
81 |
95 |
82 def save(self): |
96 def save(self): |
83 """ |
97 """ |
84 Public slot to save the Mercurial configuration. |
98 Public slot to save the Mercurial configuration. |
85 """ |
99 """ |
|
100 # executable override |
|
101 self.__plugin.setPreferences( |
|
102 "MercurialExecutablePath", self.hgPicker.text()) |
86 # global options |
103 # global options |
87 self.__plugin.setPreferences( |
104 self.__plugin.setPreferences( |
88 "Encoding", self.encodingComboBox.currentText()) |
105 "Encoding", self.encodingComboBox.currentText()) |
89 self.__plugin.setPreferences( |
106 self.__plugin.setPreferences( |
90 "EncodingMode", self.encodingModeComboBox.currentText()) |
107 "EncodingMode", self.encodingModeComboBox.currentText()) |