mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2026-03-06 09:27:33 +01:00
Avance
This commit is contained in:
37
srcantiguo/controller/messages.py
Normal file
37
srcantiguo/controller/messages.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import widgetUtils
|
||||
import output
|
||||
import config
|
||||
from extra import SpellChecker
|
||||
from extra.translator import TranslatorController
|
||||
|
||||
class basicMessage(object):
|
||||
def translate(self, event=None):
|
||||
t = TranslatorController(self.message.text.GetValue())
|
||||
if t.response == False:
|
||||
return
|
||||
msg = t.translate()
|
||||
self.message.text.ChangeValue(msg)
|
||||
self.message.text.SetInsertionPoint(len(self.message.text.GetValue()))
|
||||
self.text_processor()
|
||||
self.message.text.SetFocus()
|
||||
output.speak(_(u"Translated"))
|
||||
|
||||
def text_processor(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def spellcheck(self, event=None):
|
||||
text = self.message.text.GetValue()
|
||||
checker = SpellChecker.spellchecker.spellChecker(text, "")
|
||||
if hasattr(checker, "fixed_text"):
|
||||
self.message.text.ChangeValue(checker.fixed_text)
|
||||
self.text_processor()
|
||||
self.message.text.SetFocus()
|
||||
|
||||
def remove_attachment(self, *args, **kwargs):
|
||||
attachment = self.message.attachments.GetFocusedItem()
|
||||
if attachment > -1 and len(self.attachments) > attachment:
|
||||
self.attachments.pop(attachment)
|
||||
self.message.remove_item(list_type="attachment")
|
||||
self.text_processor()
|
||||
self.message.text.SetFocus()
|
||||
Reference in New Issue
Block a user