Ejemplo n.º 1
0
      delete %(symbol)s;""" % self

class PointVector(Arg):
   arg_format = 'O'
   convert_from_PyObject = True
   c_type = 'PointVector*'
   delete_cpp = True

   def from_python(self):
      return """
      %(symbol)s = PointVector_from_python(%(pysymbol)s);
      if (%(symbol)s == NULL) return 0;
      """ % self

   def to_python(self):
      return """
      %(pysymbol)s = PointVector_to_python(%(symbol)s);
      delete %(symbol)s;
      """ % self

class ImageInfo(Arg):
   arg_format = "O";
   c_type = 'ImageInfo*'
   convert_from_PyObject = True

   def to_python(self):
      return "%(pysymbol)s = create_ImageInfoObject(%(symbol)s);""" % self

from gamera import args
args.mixin(locals(), "C++ Wrappers")
Ejemplo n.º 2
0
class PointVector(Arg):
    arg_format = 'O'
    convert_from_PyObject = True
    c_type = 'PointVector*'
    delete_cpp = True

    def from_python(self):
        return """
      %(symbol)s = PointVector_from_python(%(pysymbol)s);
      if (%(symbol)s == NULL) return 0;
      """ % self

    def to_python(self):
        return """
      %(pysymbol)s = PointVector_to_python(%(symbol)s);
      delete %(symbol)s;
      """ % self


class ImageInfo(Arg):
    arg_format = "O"
    c_type = 'ImageInfo*'
    convert_from_PyObject = True

    def to_python(self):
        return "%(pysymbol)s = create_ImageInfoObject(%(symbol)s);" "" % self


from gamera import args
args.mixin(locals(), "C++ Wrappers")
Ejemplo n.º 3
0
      return str(self.get())

class FloatPoint:
   def get_control(self, parent, locals=None):
      from gamera.core import FloatPoint
      default = FloatPoint(self.default)
      self.control = wx.BoxSizer(wx.HORIZONTAL)
      self.control.Add(wx.StaticText(parent, -1, "x:"))
      self.control_x = wx.TextCtrl(
         parent, -1, str(default.x),
         validator = _RealValidator(name=self.name))
      self.control.Add(self.control_x, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
      self.control.Add(wx.StaticText(parent, -1, "y:"))
      self.control_y = wx.TextCtrl(
         parent, -1, str(default.y),
         validator = _RealValidator(name=self.name))
      self.control.Add(self.control_y, 1, wx.EXPAND | wx.LEFT, 5)
      return self

   def get(self):
      from gamera.core import FloatPoint
      return FloatPoint(float(self.control_x.GetValue()),
                        float(self.control_y.GetValue()))

   def get_string(self):
      return str(self.get())


from gamera import args
args.mixin(locals(), "GUI")
Ejemplo n.º 4
0
class FloatPoint:
    def get_control(self, parent, locals=None):
        from gamera.core import FloatPoint
        default = FloatPoint(self.default)
        self.control = wx.BoxSizer(wx.HORIZONTAL)
        self.control.Add(wx.StaticText(parent, -1, "x:"))
        self.control_x = wx.TextCtrl(parent,
                                     -1,
                                     str(default.x),
                                     validator=_RealValidator(name=self.name))
        self.control.Add(self.control_x, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
        self.control.Add(wx.StaticText(parent, -1, "y:"))
        self.control_y = wx.TextCtrl(parent,
                                     -1,
                                     str(default.y),
                                     validator=_RealValidator(name=self.name))
        self.control.Add(self.control_y, 1, wx.EXPAND | wx.LEFT, 5)
        return self

    def get(self):
        from gamera.core import FloatPoint
        return FloatPoint(float(self.control_x.GetValue()),
                          float(self.control_y.GetValue()))

    def get_string(self):
        return str(self.get())


from gamera import args
args.mixin(locals(), "GUI")