web.pluginmanager.plugins.action

Package web :: Package pluginmanager :: Package plugins :: Module action |
[hide private]
[frames] | no frames]

# Source Code for Module web.pluginmanager.plugins.action

     1  '''
     2  Action base module
     3  '''
     4
     5  import web
     6  import config
     7
     8  DEFAULT_LANG = config.langs[0]
     9
    10 -class Action:
    11 -    def __init__(self, plugin):
    12          self.owner = plugin
    13          self.name = "unnamed"
    14          self.human_name = "unnamed"
    15          self.description = "undescripted"
    16          self.appear_in_main_panel = False
    17          # TODO plugin manager should copy owner static dir to /static
    18
    19 -    def get_image(self, size):
    20          # FIXME check if image exists
    21          return '%s/%s/%s_%s.png' % (config.static, self.owner.name,
    22                  size, self.name)
    23
    24 -    def get_small_image(self):
    25          return self.get_image('small')
    26
    27 -    def get_big_image(self):
    28          return self.get_image('big')
    29
    30 -    def get_human_name(self, lang=DEFAULT_LANG):
    31          try:
    32              lang = web.ctx.session.lang
    33          except:
    34              pass
    35
    36          # TODO return the correct language
    37          return self.human_name
    38
    39
    40 -    def get_description(self, lang=DEFAULT_LANG):
    41          try:
    42              lang = web.ctx.session.lang
    43          except:
    44              pass
    45
    46          # TODO return the correct language
    47          return self.description
    48
    49 -    def get_url(self):
    50          return '/plugin/%s/action/%s' % (self.owner.name, self.name)
    51