src/eric7/Project/SpellingPropertiesDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
18 18
19 class SpellingPropertiesDialog(QDialog, Ui_SpellingPropertiesDialog): 19 class SpellingPropertiesDialog(QDialog, Ui_SpellingPropertiesDialog):
20 """ 20 """
21 Class implementing the Spelling Properties dialog. 21 Class implementing the Spelling Properties dialog.
22 """ 22 """
23
23 def __init__(self, project, new, parent): 24 def __init__(self, project, new, parent):
24 """ 25 """
25 Constructor 26 Constructor
26 27
27 @param project reference to the project object 28 @param project reference to the project object
28 @param new flag indicating the generation of a new project 29 @param new flag indicating the generation of a new project
29 @param parent parent widget of this dialog (QWidget) 30 @param parent parent widget of this dialog (QWidget)
30 """ 31 """
31 super().__init__(parent) 32 super().__init__(parent)
32 self.setupUi(self) 33 self.setupUi(self)
33 34
34 self.pwlPicker.setMode(EricPathPickerModes.SAVE_FILE_MODE) 35 self.pwlPicker.setMode(EricPathPickerModes.SAVE_FILE_MODE)
35 self.pwlPicker.setDefaultDirectory(project.ppath) 36 self.pwlPicker.setDefaultDirectory(project.ppath)
36 self.pwlPicker.setFilters(self.tr( 37 self.pwlPicker.setFilters(self.tr("Dictionary File (*.dic);;All Files (*)"))
37 "Dictionary File (*.dic);;All Files (*)")) 38
38
39 self.pelPicker.setMode(EricPathPickerModes.SAVE_FILE_MODE) 39 self.pelPicker.setMode(EricPathPickerModes.SAVE_FILE_MODE)
40 self.pelPicker.setDefaultDirectory(project.ppath) 40 self.pelPicker.setDefaultDirectory(project.ppath)
41 self.pelPicker.setFilters(self.tr( 41 self.pelPicker.setFilters(self.tr("Dictionary File (*.dic);;All Files (*)"))
42 "Dictionary File (*.dic);;All Files (*)")) 42
43
44 self.project = project 43 self.project = project
45 self.parent = parent 44 self.parent = parent
46 45
47 from QScintilla.SpellChecker import SpellChecker 46 from QScintilla.SpellChecker import SpellChecker
47
48 self.spellingComboBox.addItem(self.tr("<default>")) 48 self.spellingComboBox.addItem(self.tr("<default>"))
49 self.spellingComboBox.addItems( 49 self.spellingComboBox.addItems(sorted(SpellChecker.getAvailableLanguages()))
50 sorted(SpellChecker.getAvailableLanguages())) 50
51
52 if not new: 51 if not new:
53 self.initDialog() 52 self.initDialog()
54 53
55 msh = self.minimumSizeHint() 54 msh = self.minimumSizeHint()
56 self.resize(max(self.width(), msh.width()), msh.height()) 55 self.resize(max(self.width(), msh.width()), msh.height())
57 56
58 def initDialog(self): 57 def initDialog(self):
59 """ 58 """
60 Public method to initialize the dialogs data. 59 Public method to initialize the dialogs data.
61 """ 60 """
62 index = self.spellingComboBox.findText( 61 index = self.spellingComboBox.findText(self.project.pdata["SPELLLANGUAGE"])
63 self.project.pdata["SPELLLANGUAGE"])
64 if index == -1: 62 if index == -1:
65 index = 0 63 index = 0
66 self.spellingComboBox.setCurrentIndex(index) 64 self.spellingComboBox.setCurrentIndex(index)
67 if self.project.pdata["SPELLWORDS"]: 65 if self.project.pdata["SPELLWORDS"]:
68 self.pwlPicker.setText(self.project.pdata["SPELLWORDS"]) 66 self.pwlPicker.setText(self.project.pdata["SPELLWORDS"])
69 if self.project.pdata["SPELLEXCLUDES"]: 67 if self.project.pdata["SPELLEXCLUDES"]:
70 self.pelPicker.setText(self.project.pdata["SPELLEXCLUDES"]) 68 self.pelPicker.setText(self.project.pdata["SPELLEXCLUDES"])
71 69
72 def storeData(self): 70 def storeData(self):
73 """ 71 """
74 Public method to store the entered/modified data. 72 Public method to store the entered/modified data.
75 """ 73 """
76 if self.spellingComboBox.currentIndex() == 0: 74 if self.spellingComboBox.currentIndex() == 0:
77 self.project.pdata["SPELLLANGUAGE"] = ( 75 self.project.pdata["SPELLLANGUAGE"] = Preferences.getEditor(
78 Preferences.getEditor("SpellCheckingDefaultLanguage") 76 "SpellCheckingDefaultLanguage"
79 ) 77 )
80 else: 78 else:
81 self.project.pdata["SPELLLANGUAGE"] = ( 79 self.project.pdata["SPELLLANGUAGE"] = self.spellingComboBox.currentText()
82 self.spellingComboBox.currentText()
83 )
84 self.project.pdata["SPELLWORDS"] = self.project.getRelativePath( 80 self.project.pdata["SPELLWORDS"] = self.project.getRelativePath(
85 self.pwlPicker.text()) 81 self.pwlPicker.text()
82 )
86 self.project.pdata["SPELLEXCLUDES"] = self.project.getRelativePath( 83 self.project.pdata["SPELLEXCLUDES"] = self.project.getRelativePath(
87 self.pelPicker.text()) 84 self.pelPicker.text()
85 )

eric ide

mercurial