[Libreoffice-commits] .: Branch 'feature/gsoc2011_wizards' - wizards/com

Xisco Fauli xfauli at kemper.freedesktop.org
Fri Jul 29 07:56:28 PDT 2011


 wizards/com/sun/star/wizards/agenda/TopicsControl.py    |    8 ---
 wizards/com/sun/star/wizards/ui/ControlScroller.py      |   15 ++---
 wizards/com/sun/star/wizards/ui/PeerConfig.py           |   42 ++++++++++++++++
 wizards/com/sun/star/wizards/ui/UnoDialog.py            |    8 +--
 wizards/com/sun/star/wizards/ui/event/CommonListener.py |   14 ++++-
 5 files changed, 68 insertions(+), 19 deletions(-)

New commits:
commit a1a7aab2e34f94198cebd9db2a475de200436115
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Fri Jul 29 16:53:09 2011 +0200

    Make agenda items editable

diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index 548968c..7a48802 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -1,12 +1,8 @@
-from ui.ControlScroller import ControlScroller
-from common.PropertyNames import PropertyNames
 from threading import RLock
+from CGTopic import CGTopic
+from ui.ControlScroller import *
 from AgendaWizardDialogConst import LAST_HID
 from common.Properties import Properties
-import traceback
-import inspect
-from common.HelpIds import HelpIds
-from CGTopic import CGTopic
 
 '''
 @author rpiterman
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.py b/wizards/com/sun/star/wizards/ui/ControlScroller.py
index 2a718c8..4a21193 100644
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.py
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.py
@@ -1,12 +1,13 @@
+import uno
+import traceback
 from common.Desktop import Desktop
 from common.PropertyNames import PropertyNames
 from common.HelpIds import HelpIds
-from com.sun.star.awt.ScrollBarOrientation import HORIZONTAL, VERTICAL
-import uno
 from common.Helper import Helper
-import traceback
 from ui.UnoDialog import UnoDialog
 
+from com.sun.star.awt.ScrollBarOrientation import HORIZONTAL, VERTICAL
+
 class ControlScroller(object):
 
     SORELFIRSTPOSY = 3
@@ -44,7 +45,7 @@ class ControlScroller(object):
                 PropertyNames.PROPERTY_POSITION_Y,
                 PropertyNames.PROPERTY_STEP,
                 PropertyNames.PROPERTY_WIDTH),
-            (uno.Any("short", "1"),self.iCompHeight, self.iCompPosX,
+            (1, self.iCompHeight, self.iCompPosX,
                 self.iCompPosY, ControlScroller.iStep, self.iCompWidth))
         self.oImgControl = ControlScroller.CurUnoDialog.xUnoDialog.getControl(
             "imgBackground" + self.sincSuffix)
@@ -72,10 +73,8 @@ class ControlScroller(object):
             ypos += self.linedistance
 
     def setComponentMouseTransparent(self):
-        pass
-        #COMMENTED
-        #ControlScroller.CurUnoDialog.getPeerConfiguration().
-        #setPeerProperties(self.oImgControl, ["MouseTransparent"], [True])
+        ControlScroller.CurUnoDialog.getPeerConfiguration().\
+            setPeerProperties(self.oImgControl, "MouseTransparent", True)
 
     def setScrollBarOrientationHorizontal(self):
         Helper.setUnoPropertyValue(self.xScrollBar, "Orientation",HORIZONTAL)
diff --git a/wizards/com/sun/star/wizards/ui/PeerConfig.py b/wizards/com/sun/star/wizards/ui/PeerConfig.py
new file mode 100644
index 0000000..9026deb
--- /dev/null
+++ b/wizards/com/sun/star/wizards/ui/PeerConfig.py
@@ -0,0 +1,42 @@
+from event.CommonListener import WindowListenerProcAdapter
+
+'''
+ at author rpiterman
+To change the template for this generated type comment go to
+Window>Preferences>Java>Code Generation>Code and Comments
+'''
+
+class PeerConfig(object):
+
+    def __init__(self, _oUnoDialog):
+        self.oUnoDialog = _oUnoDialog
+        self.oUnoDialog.xUnoDialog.addWindowListener(
+            WindowListenerProcAdapter(self.windowShown))
+        self.m_aPeerTasks = []
+
+    class PeerTask(object):
+
+        def __init__(self, _xControl,propNames_,propValues_):
+            self.propnames = propNames_
+            self.propvalues = propValues_
+            self.xControl = _xControl
+
+    def windowShown(self):
+        try:
+            for i in self.m_aPeerTasks:
+                xVclWindowPeer = i.xControl.Peer
+                xVclWindowPeer.setProperty(i.propnames, i.propvalues)
+
+        except Exception:
+            traceback.print_exc()
+
+    '''
+    @param oAPIControl an API control that the interface
+        XControl can be derived from
+    @param _propnames
+    @param _propvalues
+    '''
+
+    def setPeerProperties(self, _xControl, propnames, propvalues):
+        oPeerTask = self.PeerTask(_xControl, propnames, propvalues)
+        self.m_aPeerTasks.append(oPeerTask)
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index d9e320a..8568d88 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -1,11 +1,13 @@
 import uno
 import traceback
+import UIConsts
 from common.PropertyNames import PropertyNames
-from com.sun.star.awt import Rectangle
 from common.Helper import Helper
+from ui.PeerConfig import PeerConfig
+
+from com.sun.star.awt import Rectangle
 from com.sun.star.awt import Rectangle
 from com.sun.star.awt.PosSize import POS
-import UIConsts
 
 class UnoDialog(object):
 
@@ -40,7 +42,7 @@ class UnoDialog(object):
         return iKey
 
     def getPeerConfiguration(self):
-        if self.m_oPeerConfig == None:
+        if self.m_oPeerConfig is None:
             self.m_oPeerConfig = PeerConfig(self)
         return self.m_oPeerConfig
 
diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
index 1a1c02c..3745d6e 100644
--- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py
+++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py
@@ -74,13 +74,23 @@ class TextListenerProcAdapter( unohelper.Base, XTextListener ):
             apply( self.oProcToCall )
 
 from com.sun.star.frame import XTerminateListener
-class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener  ):
+class TerminateListenerProcAdapter( unohelper.Base, XTerminateListener ):
     def __init__( self, oProcToCall, tParams=() ):
         self.oProcToCall = oProcToCall # a python procedure
         self.tParams = tParams # a tuple
 
-    # oTextEvent is a com.sun.star.awt.TextEvent struct.
     def queryTermination(self, TerminateEvent):
         self.oProcToCall = getattr(self.oProcToCall,"queryTermination")
         if callable( self.oProcToCall ):
             apply( self.oProcToCall )
+
+from com.sun.star.awt import XWindowListener
+class WindowListenerProcAdapter( unohelper.Base, XWindowListener ):
+    def __init__( self, oProcToCall, tParams=() ):
+        self.oProcToCall = oProcToCall # a python procedure
+        self.tParams = tParams # a tuple
+
+    # oTextEvent is a com.sun.star.awt.TextEvent struct.
+    def windowShown(self, TerminateEvent):
+        if callable( self.oProcToCall ):
+            apply( self.oProcToCall )


More information about the Libreoffice-commits mailing list