Package plugins :: Package misc :: Package hello :: Module main |
[hide private]
[frames] | no frames]

# Source Code for Module plugins.misc.hello.main

     1  #-*- coding: utf8 -*
     2  #
     3  # Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
     4  #
     5
     6  from libxyz.core.plugins import BasePlugin
     7  from libxyz.ui import MessageBox
     8  from libxyz.version import Version
     9
    10 -class XYZPlugin(BasePlugin):
    11      """
    12      Example plugin
    13      """
    14
    15      # Plugin name
    16      NAME = u"hello"
    17
    18      # AUTHOR: Author name
    19      AUTHOR = u"Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name>"
    20
    21      # VERSION: Plugin version
    22      VERSION = u"0.1"
    23
    24      # Brief one line description
    25      BRIEF_DESCRIPTION = u"Simple hello plugin"
    26
    27      # Full plugin description
    28      FULL_DESCRIPTION = u"""\
    29  Hello plugin is an example of XYZCommander plugin.
    30  It shows main aspects of plugin creation.
    31  Functionality is limited to single method: say_hello
    32  which shows greeting message box.\
    33  """
    34
    35      # NAMESPACE: Plugin namespace. For detailed information about
    36      #            namespaces see Plugins chapter of XYZCommander user manual.
    37      #            Full namespace path to method is:
    38      #            xyz:plugins:misc:hello:SayHello
    39
    40      NAMESPACE = "misc"
    41
    42 -    def __init__(self, xyz):
    43          super(XYZPlugin, self).__init__(xyz)
    44
    45          self.export(self.say_hello)
    46
    47      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    48
    49 -    def prepare(self):
    50          pass
    51
    52      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    53
    54 -    def finalize(self):
    55          pass
    56
    57      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    58
    59 -    def say_hello(self):
    60          """
    61          Shows simple greeting dialog
    62          """
    63
    64          _msg = self.FULL_DESCRIPTION
    65          _dim = self.xyz.screen.get_cols_rows()
    66          _title = u"XYZCommander version %s" % Version.version
    67
    68          _box = MessageBox(self.xyz, self.xyz.top, _msg, _title)
    69
    70          return _box.show()
    71