Issue 111642 - pyuno: Python-implemented Interface attribute is not writeable
Summary: pyuno: Python-implemented Interface attribute is not writeable
Status: CLOSED DUPLICATE of issue 111641
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 3.2
Hardware: PC All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: joergbudi
QA Contact: issues@udk
URL: http://user.services.openoffice.org/e...
Keywords:
Depends on:
Blocks: 111641
  Show dependency tree
 
Reported: 2010-05-17 01:42 UTC by gurfle
Modified: 2010-05-17 11:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description gurfle 2010-05-17 01:42:30 UTC
Confirmed on Debian Linux 5.03 and Windows XP, so suspect it crosses all OS
platforms - URL is to a - so far inconclusive - OO Community Forum topic I
started on the issue that also lists the same code examples included below.

As illstrated in the OO Basic macro at the very bottom of this desciption,
assigning a value to a Python-implemeted readwrite attribute of a (UNOIDL)
user-defined Interface causes OO to freeze - soffice process must be killed
before any activity can be resumed.

This can be reproduced using the following example UNOIDL and python modules:

Contents of XTestOOPythonComp.idl (compiled .rdb file to be added as OO
Extension UNO RDB Type Library):

#ifndef __names_nick_openoffice_TestOOPythonComp_idl__
#define __names_nick_openoffice_TestOOPythonComp_idl__

module names { module nick { module openoffice { module TestOOPythonComp {

    interface XTestOOPythonComp
    {
       [attribute] double TestOOPyDouble;
       [attribute] long TestOOPyLong;
       [attribute] string TestOOPyString;

       double OOCompFunction( [in] double a, [in] double b  );

//  The following should not be necessary to properly implement the Interface
with the above attributes
/////////////
       double getTestOOPyDouble( );
       void setTestOOPyDouble( [in] double newTestOOPyDouble );

       long getTestOOPyLong( );
       void setTestOOPyLong( [in] long newTestOOPyLong );

       string getTestOOPyString( );
       void setTestOOPyString( [in] string newTestOOPyString );
/////////////

    };

    service STestOOPythonComp: XTestOOPythonComp;
}; }; }; };
#endif


Contents of TestOOPythonComp.py (to be added as OO Extension UNO Python Component):

import uno
import unohelper

from com.sun.star.lang import XServiceName
from com.sun.star.lang import XServiceInfo

from names.nick.openoffice.TestOOPythonComp import XTestOOPythonComp

class TestOOPythonComp(unohelper.Base, XServiceName, XServiceInfo,
XTestOOPythonComp):

  TestOOPyDouble=47.3
  TestOOPyLong=60000
  TestOOPyString="MyStr"

  ServiceName="STestOOPythonComp"
  ImplementationName="OTestOOPythonComp"

  def __init__(self,newctx=None):
    self.ctx=newctx

  def OOCompFunction(self,a,b):
    return a+b

  #  The following should not be necessary to properly implement the Interface
with the above attributes
  ############
  def getTestOOPyDouble(self):
    return self.TestOOPyDouble
  def setTestOOPyDouble(self,newTestOOPyDouble):
    self.TestOOPyDouble=newTestOOPyDouble

  def getTestOOPyLong(self):
    return self.TestOOPyLong
  def setTestOOPyLong(self,newTestOOPyLong):
    self.TestOOPyLong=newTestOOPyLong

  def getTestOOPyString(self):
    return self.TestOOPyString
  def setTestOOPyString(self,newTestOOPyString):
    self.TestOOPyString=newTestOOPyString
  ############

  def getServiceName(self):
    return self.ServiceName

  def getImplementationName(self):
    return self.ImplementationName

  def getSupportedServiceNames(self):
    return (self.ServiceName,)

g_ImplementationHelper = unohelper.ImplementationHelper()
g_ImplementationHelper.addImplementation(TestOOPythonComp,"names.nick.openoffice.TestOOPythonCompImpl",("com.sun.star.task.Job",),)

OO Basic Macro to test the issue (CAUTION:  As written, it WILL freeze soffice)

Option Explicit

Sub TestOOPythonComp
  Dim x as Object
  Dim y as Double
  x = createUnoService( "names.nick.openoffice.TestOOPythonCompImpl" )
  print x.TestOOPyDouble '  Displays value (47.3) without a problem
  y=23.7
  setTestOOPythonDouble(y) '  This works, as does "print getTestOOpythonDouble()"
  x.TestOOPyDouble=y '  CAUTION:  This causes OO to freeze:  Only killing the
soffice process frees OO up again
End Sub
Comment 1 Olaf Felka 2010-05-17 11:41:39 UTC
dupe

*** This issue has been marked as a duplicate of 111641 ***
Comment 2 Olaf Felka 2010-05-17 11:41:58 UTC
...