Andreas Preikschat has proposed merging lp:~googol-hush/openlp/tweaks into lp:openlp.
Requested reviews: OpenLP Core (openlp-core) For more details, see: https://code.launchpad.net/~googol-hush/openlp/tweaks/+merge/57684 Hello, - added a sub menu to change the language for a SpellEdit (http://img829.imageshack.us/i/bildschirmfoto140420111.png/) The language chosen will not be saved. -- https://code.launchpad.net/~googol-hush/openlp/tweaks/+merge/57684 Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/tweaks into lp:openlp.
=== modified file 'openlp/core/lib/__init__.py' --- openlp/core/lib/__init__.py 2011-04-04 14:38:17 +0000 +++ openlp/core/lib/__init__.py 2011-04-14 13:58:24 +0000 @@ -274,8 +274,8 @@ from listwidgetwithdnd import ListWidgetWithDnD from displaytags import DisplayTags +from eventreceiver import Receiver from spelltextedit import SpellTextEdit -from eventreceiver import Receiver from imagemanager import ImageManager from settingsmanager import SettingsManager from plugin import PluginStatus, StringContent, Plugin === modified file 'openlp/core/lib/spelltextedit.py' --- openlp/core/lib/spelltextedit.py 2011-04-07 17:54:17 +0000 +++ openlp/core/lib/spelltextedit.py 2011-04-14 13:58:24 +0000 @@ -36,7 +36,9 @@ # http://john.nachtimwald.com/2009/08/22/qplaintextedit-with-in-line-spell-check from PyQt4 import QtCore, QtGui + from openlp.core.lib import translate, DisplayTags +from openlp.core.lib.ui import checkable_action log = logging.getLogger(__name__) @@ -80,6 +82,19 @@ if not cursor.hasSelection(): cursor.select(QtGui.QTextCursor.WordUnderCursor) self.setTextCursor(cursor) + # Add menu with available languages. + if ENCHANT_AVAILABLE: + lang_menu = QtGui.QMenu( + translate('OpenLP.SpellTextEdit', 'Language:')) + for lang in enchant.list_languages(): + action = checkable_action( + lang_menu, lang, lang == self.dictionary.tag) + action.setText(lang) + lang_menu.addAction(action) + popupMenu.insertSeparator(popupMenu.actions()[0]) + popupMenu.insertMenu(popupMenu.actions()[0], lang_menu) + QtCore.QObject.connect(lang_menu, + QtCore.SIGNAL(u'triggered(QAction*)'), self.setLanguage) # Check if the selected word is misspelled and offer spelling # suggestions if it is. if ENCHANT_AVAILABLE and self.textCursor().hasSelection(): @@ -93,19 +108,30 @@ spell_menu.addAction(action) # Only add the spelling suggests to the menu if there are # suggestions. - if len(spell_menu.actions()) != 0: - popupMenu.insertSeparator(popupMenu.actions()[0]) + if len(spell_menu.actions()): popupMenu.insertMenu(popupMenu.actions()[0], spell_menu) tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags')) for html in DisplayTags.get_html_tags(): - action = SpellAction( html[u'desc'], tagMenu) + action = SpellAction(html[u'desc'], tagMenu) action.correct.connect(self.htmlTag) tagMenu.addAction(action) popupMenu.insertSeparator(popupMenu.actions()[0]) popupMenu.insertMenu(popupMenu.actions()[0], tagMenu) popupMenu.exec_(event.globalPos()) + def setLanguage(self, action): + """ + Changes the language for this spelltextedit. + + ``action`` + The action. + """ + self.dictionary = enchant.Dict(action.text()) + self.highlighter.spellingDictionary = self.dictionary + self.highlighter.highlightBlock(self.toPlainText()) + self.highlighter.rehighlight() + def correctWord(self, word): """ Replaces the selected text with word.
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : [email protected] Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp

