Ejemplo n.º 1
0
import sys
from PythonCard import event, registry, widget


class VBImageList(VBWidget):
    __metaclass__ = VBWrapped

    _translations = {
        "ListImages": "items",
    }

    _name_to_method_translations = {
        "ListCount": ("getNumber", None),
        "ListIndex": ("getSelectionIndex", None),
    }

    _indexed_translations = {}

    _method_translations = {}

    _proxy_for = statictext.StaticText  # Not a PythonCard object at all but this at least works!

    # << VBImageList methods >>
    pass
    # -- end -- << VBImageList methods >>


log.debug("Registering VBImageList as '%s'" %
          sys.modules[__name__].VBImageList)
Register(VBImageList)
Ejemplo n.º 2
0
        """
        return len(self.items)

    # << VBComboBox methods >> (3 of 4)
    def getSelectionIndex(self):
        """Get the index of the currently selected item

        This doesn't appear to be in the PythonCard control

        """
        try:
            return self.items.index(self.selection)
        except ValueError:
            return -1

    # << VBComboBox methods >> (4 of 4)
    def delete(self, position):
        """Remove the specified item from the Combo

        This doesn't appear to be in the PythonCard control

        """
        del (self.items[position])  # TODO - this doesn't actually work

    # -- end -- << VBComboBox methods >>


log.debug("Registering VBComboBox as '%s'" % sys.modules[__name__].VBComboBox)
Register(VBComboBox)
Ejemplo n.º 3
0
import vb2py.logger
log = vb2py.logger.getLogger("VBTextArea")

from PythonCard.components import textarea
import wx
import sys
from PythonCard import event, registry, widget


class VBTextArea(VBWidget):
    __metaclass__ = VBWrapped

    _translations = {
        "Text": "text",
        "Enabled": "enabled",
        "Visible": "visible",
    }

    _indexed_translations = {
        "Left": ("position", 0),
        "Top": ("position", 1),
        "Width": ("size", 0),
        "Height": ("size", 1),
    }

    _proxy_for = textarea.TextArea


log.debug("Registering VBTextArea as '%s'" % sys.modules[__name__].VBTextArea)
Register(VBTextArea)
Ejemplo n.º 4
0
    Stretch = 0

    # << VBBitmapCanvas Methods >>
    def _setPicture(self, bitmap):
        """Setting the picture property"""
        if self.Stretch:
            try:
                bitmap.setSize(self.size)
            except NotImplementedError:
                log.error(
                    "PythonCard bitmap resize not implemented, Stretch mode will not work"
                )
        else:
            self.size = bitmap.getSize()
        self.drawBitmap(bitmap)
        self.__dict__["_bitmap"] = bitmap

    def _getPicture(self):
        """Get the bitmap property"""
        return self._bitmap

    Picture = property(fget=_getPicture, fset=_setPicture)
    # -- end -- << VBBitmapCanvas Methods >>


VBBitmapCanvas._setters["Picture"] = VBBitmapCanvas._setPicture

log.debug("Registering VBBitmapCanvas as '%s'" %
          sys.modules[__name__].VBBitmapCanvas)
Register(VBBitmapCanvas)
Ejemplo n.º 5
0
log = vb2py.logger.getLogger("VBButton")

from PythonCard.components import button
import wx
import sys
from PythonCard import event, registry, widget


class VBButton(VBWidget):
    __metaclass__ = VBWrapped

    _translations = {
        "Text": "text",
        "Enabled": "enabled",
        "Visible": "visible",
    }

    _indexed_translations = {
        "Left": ("position", 0),
        "Top": ("position", 1),
        "Width": ("size", 0),
        "Height": ("size", 1),
    }

    _proxy_for = button.Button


log.debug("Registering VBButton as '%s'" % sys.modules[__name__].VBButton)
Register(VBButton)
Ejemplo n.º 6
0
        "Top": ("position", 1),
        "Width": ("size", 0),
        "Height": ("size", 1),
    }

    _method_translations = {
        "Clear": "clear",
        "RemoveItem": "delete",
    }

    _proxy_for = list.List

    # << VBList methods >>
    def AddItem(self, item, position=None):
        """Add an item to the list

        We cannot just map this to a PythonCard control event because it only has
        an 'append' and an 'insertItems' method, which isn't exactly the same

        """
        if position is None:
            self.append(item)
        else:
            self.insertItems([item], position)

    # -- end -- << VBList methods >>


log.debug("Registering VBList as '%s'" % sys.modules[__name__].VBList)
Register(VBList)
Ejemplo n.º 7
0
log = vb2py.logger.getLogger("VBTimer")

from PythonCard.components import statictext
import wx
import sys
from PythonCard import event, registry, widget


class VBTimer(VBWidget):
    __metaclass__ = VBWrapped

    _name_to_method_translations = {
        "Enabled": ("_getEnabled", "_setEnabled"),
    }

    def _setEnabled(self, value):
        """Setting enabled state"""
        # Call the event handler
        getattr(self.GetGrandParent(), "%s_Timer" % self.name)()

    def _getEnabled(self):
        """Getting enabled state"""
        print "Inside getenabled"
        return True

    _proxy_for = statictext.StaticText


log.debug("Registering VBTimer as '%s'" % sys.modules[__name__].VBTimer)
Register(VBTimer)
Ejemplo n.º 8
0
from PythonCard.components import checkbox
import wx
import sys
from PythonCard import event, registry, widget


class VBCheckBox(VBWidget):
    __metaclass__ = VBWrapped

    _translations = {
        "Text": "text",
        "Enabled": "enabled",
        "Visible": "visible",
        "Value": "checked",
        "Caption": "label",
    }

    _indexed_translations = {
        "Left": ("position", 0),
        "Top": ("position", 1),
        "Width": ("size", 0),
        "Height": ("size", 1),
    }

    _proxy_for = checkbox.CheckBox


log.debug("Registering VBCheckBox as '%s'" % sys.modules[__name__].VBCheckBox)
Register(VBCheckBox)
Ejemplo n.º 9
0
log = vb2py.logger.getLogger("VBTextField")

from PythonCard.components import textfield
from wxPython import wx
import sys
from PythonCard import event, registry, widget


class VBTextField(VBWidget):
    __metaclass__ = VBWrapped

    _translations = {
        "Text": "text",
        "Enabled": "enabled",
        "Visible": "visible",
    }

    _indexed_translations = {
        "Left": ("position", 0),
        "Top": ("position", 1),
        "Width": ("size", 0),
        "Height": ("size", 1),
    }

    _proxy_for = textfield.TextField


log.debug("Registering VBTextField as '%s'" %
          sys.modules[__name__].VBTextField)
Register(VBTextField)
Ejemplo n.º 10
0
            Text="",
            Image=None,
            SelectedImage=None):
        """Add a node to the tree"""
        if Relative is None:
            id = self._nodes["<vbtreeroot>"]
        elif Relationship == vb2py.custom.comctllib.tvwChild:
            id = self._nodes[Relative]
        else:
            raise NotImplementedError(
                "Tree Add not implemented for relationships other than tvwChild"
            )
        #
        self._nodes[Key] = self._parent.AppendItem(id, Text)
        self._parent.SetPyData(self._nodes[Key], Key)
        self._parent.SetItemHasChildren(id, True)

    # << class TreeNodeCollection methods >> (5 of 5)
    def __iter__(self):
        """Return an iterator over the nodes"""
        for node in self._nodes.values():
            yield vb2py.custom.comctllib.Node(node, self._parent)

    # -- end -- << class TreeNodeCollection methods >>


# -- end -- << Classes >>

log.debug("Registering VBTreeView as '%s'" % sys.modules[__name__].VBTreeView)
Register(VBTreeView)
Ejemplo n.º 11
0
from PythonCard.components import statictext
from wxPython import wx
import sys
from PythonCard import event, registry, widget


class VBStaticText(VBWidget): 
    __metaclass__ = VBWrapped 

    _translations = { 
            "Caption" : "text", 
            "Enabled" : "enabled", 
            "Visible" : "visible", 
        } 

    _indexed_translations = { 
            "Left" : ("position", 0), 
            "Top" : ("position", 1), 
            "Width" : ("size", 0), 
            "Height" : ("size", 1), 
        } 

    _proxy_for = statictext.StaticText




log.debug("Registering VBStaticText as '%s'" % sys.modules[__name__].VBStaticText)
Register(VBStaticText)