def __init__ (self):

        print("python gtype obj klass %s address %x"%(str(self.__class__),hash(GObject.type_class_peek(self))))

        #pdb.set_trace()

        super(GncPluginPythonExample,self).__init__()
        #GncPluginPython.__init__(self)

        print("python gtype obj klass %s address %x"%(str(self.__class__),hash(GObject.type_class_peek(self))))

        #pdb.set_trace()


        # following the C code we set the parent GncPlugin class variables
        # in the subclass

        # dont quite see why these are class variables - this just follows the
        # C code currently

        GncPluginPythonExample.actions_name = "GncPluginPythonExampleActions"


        GncPluginPythonExample.plugin_actions = [ \
               ("exampleAction", None, N_("Example Description..."), None,
                N_("example tooltip"),
                self.cmd_test,
               ),
               ]

        GncPluginPythonExample.plugin_toggle_actions = []

        GncPluginPythonExample.plugin_important_actions = []

        GncPluginPythonExample.ui_filename = None

        GncPluginPythonExample.ui_xml_str = """
<ui>
  <menubar>
    <menu name="Tools" action="ToolsAction">
      <placeholder name="ToolsPlaceholder">
        <menuitem name="example" action="exampleAction"/>
     </placeholder>
    </menu>
  </menubar>
</ui>
"""


        #pdb.set_trace()

        #print("before access class", file=sys.stderr)

        #priv = girepo.access_class_data(self)

        #print("after access class", file=sys.stderr)

        #GncPluginPythonExample.class_init()

        self.class_init()
Example #2
0
 def __init__ (cls, name, bases, attrs):
     print("GncPluginPageMeta init called:",str(cls),name,str(bases),str(attrs))
     # NOTA BENE - for GType subclassing the class structure address returned at this point
     # is STILL the parent GType class structure!!
     # we need the cls variable AFTER the super call!!
     # so this is how to get the address of the class structure!!
     print("python meta gtype klass %s address %x"%(str(cls),hash(GObject.type_class_peek(cls))))
     super(GncPluginPageMeta, cls).__init__(name, bases, attrs)
     print("python meta gtype klass %s address %x"%(str(cls),hash(GObject.type_class_peek(cls))))
Example #3
0
    def set_klass_pointer (self, gtype):
        # so this is how to get the address of the class structure!!
        self.klass_ptr = hash(GObject.type_class_peek(gtype))
        print("python gtype klass %s address %x"%(str(gtype),hash(GObject.type_class_peek(gtype))))

        if self.offset_adjust_hack != 0:
            if self.offset != self.check_adjust_hack:
                raise ValueError("Field offset is wrong - possible bad version of GType %s - may need to regenerate gir files"%self.field_name)

        self.value_pointer = self.klass_ptr + self.offset_adjust_hack + self.offset
        print("python value address %x"%self.value_pointer)
Example #4
0
 def __init__ (cls, name, bases, attrs):
     print("GncPluginSubClassMeta init called:",str(cls),name,str(bases),str(attrs))
     # NOTA BENE - for GType subclassing the class structure address returned at this point
     # is STILL the parent GType class structure!!
     # we need the cls variable AFTER the super call!!
     # so this is how to get the address of the class structure!!
     print("python sub gtype klass %s address %x"%(str(cls),hash(GObject.type_class_peek(cls))))
     super(GncPluginSubClassMeta, cls).__init__(name, bases, attrs)
     print("python sub gtype klass %s address %x"%(str(cls),hash(GObject.type_class_peek(cls))))
     #pdb.set_trace()
     # we have deleted plugin_name from attrs above!!
     cls.plugin_name.set_klass_pointer(cls)
     plugin_name = cls.plugin_name.field_value
     cls.plugin_name.set_value(plugin_name)
Example #5
0
def access_class_data (gtype):

    # so this is how to get the address of the class structure!!
    # note gtype is a GObject type - NOT the GObjectClass type!!
    klass_ptr = hash(GObject.type_class_peek(gtype))

    return klass_ptr
def gst_register_plugin(klass, name):
    element_class = GObject.type_class_peek(klass.__gtype__)
    element_class.__class__ = Gst.ElementClass
    element_class.set_metadata(*klass.__gstdetails__)
    for pad_template in klass.__gsttemplates__:
        element_class.add_pad_template(pad_template)
    klass.register(None, name, Gst.Rank.NONE, klass.__gtype__)
Example #7
0
 def __init__ (cls, name, bases, attrs):
     print("GncPluginTryMeta init called:",str(cls),name,str(bases),str(attrs))
     print("python meta gtype klass %s address %x"%(str(cls),hash(GObject.type_class_peek(cls))))
     super(GncPluginTryMeta, cls).__init__(name, bases, attrs)
     print("python meta gtype klass %s address %x"%(str(cls),hash(GObject.type_class_peek(cls))))
Example #8
0
def get_element_class(klass):
    element_class = GObject.type_class_peek(klass.__gtype__)
    element_class.__class__ = Gst.ElementClass
    return element_class
Example #9
0
 def __init__ (self):
     print("python gobject","%x"%hash(self))
     print("python gtype obj klass %s address %x"%(str(self.__class__),hash(GObject.type_class_peek(self))))
     super(GncPluginPythonTest,self).__init__()
     print("python gtype obj klass %s address %x"%(str(self.__class__),hash(GObject.type_class_peek(self))))
Example #10
0
def get_element_class(klass):
    element_class = GObject.type_class_peek(klass.__gtype__)
    element_class.__class__ = Gst.ElementClass
    return element_class