t:plugin_skeleton_py@
from olexFunctions import OlexFunctions
OV = OlexFunctions()

import os
import htmlTools
import olex
import olx
import gui

import time
debug = bool(OV.GetParam("olex2.debug", False))


instance_path = OV.DataDir()

try:
  from_outside = False
  p_path = os.path.dirname(os.path.abspath(__file__))
except:
  from_outside = True
  p_path = os.path.dirname(os.path.abspath("__file__"))

l = open(os.sep.join([p_path, 'def.txt'])).readlines()
d = {}
for line in l:
  line = line.strip()
  if not line or line.startswith("#"):
    continue
  d[line.split("=")[0].strip()] = line.split("=")[1].strip()

p_name = d['p_name']
p_htm = d['p_htm']
p_img = eval(d['p_img'])
p_scope = d['p_scope']

OV.SetVar('%(name)s_plugin_path', p_path)

from PluginTools import PluginTools as PT

class %(name)s(PT):

  def __init__(self):
    super(%(name)s, self).__init__()
    self.p_name = p_name
    self.p_path = p_path
    self.p_scope = p_scope
    self.p_htm = p_htm
    self.p_img = p_img
    self.deal_with_phil(operation='read')
    self.print_version_date()
    if not from_outside:
      self.setup_gui()
    OV.registerFunction(self.print_formula,True,"%(name)s")
    # END Generated =======================================

  def print_formula(self):
    formula = {}
    for element in str(olx.xf.GetFormula('list')).split(','):
      element_type, n = element.split(':')
      print "%%s: %%s" %%(element_type, n)
      formula.setdefault(element_type, float(n))

%(name)s_instance = %(name)s()
print "OK."
@

t:plugin_skeleton_phil@
%(name_lower)s{
  gui{
    location = 'tools'
      .type = str
      .help = The tab item where the %(name)s GUI shall appear.
    before = 'images'
      .type = str
      .help = The tool before which the %(name)s GUI shall appear.
    }
}
@

t:plugin_skeleton_html{
<!-- #include tool-top gui/blocks/tool-top.htm;image=#image;onclick=#onclick;1; -->
<!-- #include tool-row-help gui/blocks/tool-row-help.htm;name=%(name)s_1; help_ext=%(name)s_1;1; -->
  <td ALIGN='left' width='100%%'>
    <b>Welcome to your new Plugin: %(name)s</b>
  </td>
<!-- #include row_table_off gui/blocks/row_table_off.htm;1; -->

<!-- #include tool-row-help gui/blocks/tool-row-help.htm;name=%(name)s_2; help_ext=%(name)s_2;1; -->
  <td ALIGN='left' width='100%%'>
    <b><a href="spy.%(name)s.print_formula()">RUN</a>
  </td>
<!-- #include row_table_off gui/blocks/row_table_off.htm;1; -->

<!-- #include h3-%(name)s-extras $GetVar(%(name)s_plugin_path)\h3-%(name)s-extras.htm;gui\blocks\tool-h3-off.htm;image=h3-%(name)s_extras;onclick=;colspan=1;2; -->

<!-- #include tool-footer gui/blocks/tool-footer.htm;colspan=2;1; -->
}


t:plugin_h3_extras{
<!-- #include tool-h3 gui\blocks\tool-h3.htm;image=#image;colspan=1;1; -->
<!-- #include tool-row-help gui/blocks/tool-row-help.htm;name=h3-%(name)s_1; help_ext=%(name)s_1;1; -->


    $+
    html.Snippet(GetVar(default_link),
    "value=Reload Plugin",
    "onclick=py.run %(plugin_base)s/plugin-%(name)s/%(name)s.py",
    )$-

    $+
    html.Snippet(GetVar(default_link),
    "value=Settings",
    "onclick=spy.EditParams(%(name_lower)s)",
    )$-

    $+
    html.Snippet(GetVar(default_link),
    "value=Open Folder",
    "onclick=shell %(plugin_base)s/plugin-%(name)s",
    )$-



<!-- #include row_table_off gui\blocks\row_table_off.htm;1; -->
}


t:plugin_skeleton_def{
  p_name = %(name)s
  p_htm = %(name)s
  p_img = [("%(name)s",'h1'), ("%(name)s-Extras",'h3')]
  p_scope = %(name_lower)s
}