Package plugins :: Package misc :: Package about :: Module main

[hide private]
[frames] | no frames]

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

     1  #-*- coding: utf8 -*
     2  #
     3  # Max E. Kuznecov <syhpoon@syhpoon.name> 2008
     4  #
     5
     6  from libxyz.ui import lowui
     7  from libxyz import Version
     8
     9  import libxyz.ui as uilib
    10  import libxyz.const
    11
    12  from libxyz.core.plugins import BasePlugin
    13
    14 -class XYZPlugin(BasePlugin):
    15      "Plugin about"
    16
    17      NAME = u"about"
    18      AUTHOR = u"Max E. Kuznecov <syhpoon@syhpoon.name>"
    19      VERSION = u"0.1"
    20      BRIEF_DESCRIPTION = u"About plugin"
    21      FULL_DESCRIPTION = u""
    22      NAMESPACE = u"misc"
    23      MIN_XYZ_VERSION = None
    24      DOC = None
    25      HOMEPAGE = u"xyzcmd.syhpoon.name"
    26
    27 -    def __init__(self, xyz):
    28          super(XYZPlugin, self).__init__(xyz)
    29
    30          self.export(self.about)
    31
    32      #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    33
    34 -    def about(self):
    35          """
    36          Show About box
    37          """
    38
    39          _font6x6 = lowui.Thin6x6Font()
    40          _font3x3 = lowui.Thin3x3Font()
    41          _attr = self.xyz.skin.attr(uilib.Box.resolution, u"box")
    42
    43          _w = []
    44
    45          _w.append(lowui.Text((_attr, u"%s - Console file manager" %
    46                               libxyz.const.PROG), align=uilib.align.CENTER))
    47
    48          _w.append(lowui.Text((_attr, u"Version: %s" %
    49                                  Version.string_version),
    50                                align=uilib.align.CENTER))
    51          _w.append(lowui.Text((_attr, u"Homepage: %s" %
    52                                  libxyz.const.HOMEPAGE),
    53                                align=uilib.align.CENTER))
    54
    55          _box = lowui.AttrWrap(lowui.Filler(lowui.Pile(_w)), _attr)
    56
    57          _dim = self.xyz.screen.get_cols_rows()
    58          _width = int((_dim[0] / 100.0) * 70)
    59
    60          _box = lowui.Overlay(_box, self.xyz.top, uilib.align.CENTER, _width,
    61                               uilib.align.MIDDLE, len(_w) + 2)
    62
    63          self.xyz.screen.draw_screen(_dim, _box.render(_dim, True))
    64
    65          _input = None
    66
    67          while True:
    68              _input = self.xyz.input.get()
    69
    70              if _input:
    71                  break
    72