Beispiel #1
0
# URL: http://www.smc.org.in

from common import *
from utils import silpalogger
import os
from dictdlib import DictDB
from jsonrpc import *
from wiktionary import get_def

try:
    from modules.render import render
except:
    silpalogger.exception("Failed to import render module")

# Have the render instance initiated only once
renderer = render.getInstance()

# One image for No image found
no_meaning_found = renderer.render_text("No meanings found",
                                        "png",
                                        0,
                                        0,
                                        "Red",
                                        font_size=10)


class Dictionary(SilpaModule):
    def __init__(self):
        self.template = os.path.join(os.path.dirname(__file__),
                                     'dictionary.html')
        self.response = SilpaResponse(self.template)
Beispiel #2
0
# URL: http://www.smc.org.in


from common import *
import os
from dictdlib import DictDB
from jsonrpc import *
from wiktionary import get_def

try:
    from modules.render import render
except:
    silpalogger.exception("Failed to import render module")

# Have the render instance initiated only once
renderer = render.getInstance()

# One image for No image found
no_meaning_found = renderer.render_text("No meanings found", "png", 0, 0, \
        "Red", font_size=10)


class Dictionary(SilpaModule):

    def __init__(self):
        self.template = os.path.join(os.path.dirname(__file__), 'dictionary.html')
        self.response = SilpaResponse(self.template)
        self.imageyn = None
        self.text = None
        self.dictionaryname = None
        self.fontsize = 16
Beispiel #3
0
 def getdef_image(self, word, dictionary, file_type="png", width=0, height=0, color="Black", fontsize=10):
     return render.getInstance().render_text(
         self.getdef(word, dictionary), file_type, width, height, color, fontsize
     )