Example #1
0
    def __init__(self):
        """Initialize the plugin

        This method should always be called by subclasses as it is required to
        set up logging etc

        """
        if not hasattr(self, "name"):
            self.name = self.__class__.__name__

        self.log = logger.getLogger(self.name)
        self.log.setLevel(self.logging_level)
Example #2
0
File: app.py Project: ByReaL/vb2py
The VB conversion is very preliminary!

So is the layout...

"""

import re     # For text processing
import os     # For file processing
import sys    # For getting Exec prefix
import getopt  # For command line arguments

from vb2py.config import VB2PYConfig
Config = VB2PYConfig()

from vb2py import logger   # For logging output and debugging
log = logger.getLogger("vb2Py")

from vb2py import vbparser

__app_name__ = "VB2Py"
__version__ = "0.2.2"

# Try to import ctypes module to read type libraries
try:
    import ctypes.com.tools.readtlb as readtlb
except ImportError:
    readtlb = None


class VB2PyError(Exception):
Example #3
0
from vb2py import vbparser
from vb2py.config import VB2PYConfig
Config = VB2PYConfig()

from vb2py import logger   # For logging output and debugging
log = logger.getLogger("PythonCardControls")

twips_per_pixel = 15

# << Events >>
# << EventSupport >>
class ControlEvent:
    """Represents a control event mapping from VB to PythonCard

    A control event (eg MouseClick) is defined in VB with a certain name
    and list of parameters. PythonCard has an analogus event with a
    different name and all the parameters are bound up in an event
    object.

    This class helps in the mapping of one to the other.

    """

    # << ControlEvent methods >> (1 of 2)
    def __init__(self, vbname, pyname, vbargs=None, pyargs=None):
        """Initialize the control event"""
        self.vbname = vbname
        self.pyname = pyname
        self.vbargs = vbargs or []
        self.pyargs = pyargs or []
    # << ControlEvent methods >> (2 of 2)
Example #4
0
"""Set up logging"""

from vb2py import vbclasses

from vb2py import logger   # For logging output and debugging
_vb_debug_log = logger.getLogger("vb2PyApp")

vbclasses.Debug._logger = _vb_debug_log
Example #5
0
import vb2py.vbparser
from vb2py.config import VB2PYConfig
Config = VB2PYConfig()

from vb2py import logger  # For logging output and debugging
log = logger.getLogger("PythonCardControls")

twips_per_pixel = 15


# << Events >>
# << EventSupport >>
class ControlEvent:
    """Represents a control event mapping from VB to PythonCard

    A control event (eg MouseClick) is defined in VB with a certain name
    and list of parameters. PythonCard has an analogus event with a
    different name and all the parameters are bound up in an event
    object.

    This class helps in the mapping of one to the other.

    """

    # << ControlEvent methods >> (1 of 2)
    def __init__(self, vbname, pyname, vbargs=None, pyargs=None):
        """Initialize the control event"""
        self.vbname = vbname
        self.pyname = pyname
        self.vbargs = vbargs or []
        self.pyargs = pyargs or []
Example #6
0
"""Base classes for all plug-ins"""

import os
import imp
import re

from vb2py.utils import modulePath
from vb2py.config import VB2PYConfig

Config = VB2PYConfig()

from vb2py import logger
log = logger.getLogger("PlugInLoader")


def loadAllPlugins():
    """Load all plug-ins from the plug-in directory and return a list of all
    the classes"""
    from vb2py import plugins
    mods = []
    for mod in plugins.mods:
        log.info("Checking '%s' for plugins" % mod)
        #
        filename = os.path.join(modulePath(), "plugins", "%s.py" % mod)
        f = open(filename, "r")
        try:
            try:
                m = imp.load_module(mod, f, filename, ('*.py', 'r', 1))
            finally:
                f.close()
        except Exception, err: