[Libreoffice-commits] core.git: 2 commits - wizards/com

Xisco Fauli anistenis at gmail.com
Tue Feb 5 13:57:13 PST 2013


 wizards/com/sun/star/wizards/agenda/TopicsControl.py |   39 +++++++------------
 wizards/com/sun/star/wizards/ui/ControlScroller.py   |   32 ++++++++-------
 wizards/com/sun/star/wizards/ui/UnoDialog.py         |    4 -
 3 files changed, 33 insertions(+), 42 deletions(-)

New commits:
commit 949facecdc0a1aed8f16c4c1e67e94e2e7f0c2e9
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Tue Feb 5 22:54:33 2013 +0100

    pyagenda: Update topics's gui when launching the wizard
    
    Change-Id: Ifb38b49fb62d5fc85bcc6dfa7729bb87d3c7f8e0

diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index f25fb4d..f579838 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -103,7 +103,10 @@ class TopicsControl(ControlScroller):
             super(TopicsControl, self).__init__(
                 dialog, xmsf, 5, 92, 38, 212, 5, 18, HID + 32)
             self.dialog = dialog
+            #fill preview's table
             self.initializeScrollFields(agenda)
+            #fill gui's table
+            self.fillupControls(True)
             self.nscrollvalue = 0
             self.lastFocusRow = 0
             self.lastFocusControl = None
@@ -314,9 +317,6 @@ class TopicsControl(ControlScroller):
     Implementation of ControlScroller
     This is a UI method which inserts a new row to the control.
     It uses the child-class ControlRow. (see below).
-    @param _index
-    @param npos
-    @see ControlRow
     '''
 
     def insertControlGroup(self, _index, npos):
diff --git a/wizards/com/sun/star/wizards/ui/ControlScroller.py b/wizards/com/sun/star/wizards/ui/ControlScroller.py
index 8afaff9..2f6d4a4 100644
--- a/wizards/com/sun/star/wizards/ui/ControlScroller.py
+++ b/wizards/com/sun/star/wizards/ui/ControlScroller.py
@@ -33,6 +33,7 @@ class ControlScroller(object):
             _iCompWidth, _nblockincrement, _nlinedistance, _firsthelpindex):
         self.xMSF = _xMSF
         self.scrollfields = []
+        self.ControlGroupVector = []
         ControlScroller.nblockincrement = _nblockincrement
         self.CurUnoDialog = _CurUnoDialog
         self.iStep = _iStep
@@ -50,7 +51,7 @@ class ControlScroller(object):
         self.sincSuffix = Desktop.getIncrementSuffix(
             self.CurUnoDialog.xDialogModel, "imgBackground")
 
-        ControlScroller.xScrollBar = self.CurUnoDialog.insertScrollBar(
+        self.xScrollBar = self.CurUnoDialog.insertScrollBar(
             "TitleScrollBar" + self.sincSuffix,
             ("Border", PropertyNames.PROPERTY_ENABLED,
                 PropertyNames.PROPERTY_HEIGHT,
@@ -65,13 +66,12 @@ class ControlScroller(object):
                     ControlScroller.iScrollBarWidth - 1,
                 self.iCompPosY + 1, self.iStep,
                 ControlScroller.iScrollBarWidth), 0, self)
-        ControlScroller.nscrollvalue = 0
-        ControlScroller.ControlGroupVector = []
+        self.nscrollvalue = 0
         ypos = self.iStartPosY + ControlScroller.SORELFIRSTPOSY
         for i in range(ControlScroller.nblockincrement):
             self.insertControlGroup(i, ypos)
             ypos += self.linedistance
-
+            
     def fillupControls(self, binitialize):
         for i in range(ControlScroller.nblockincrement):
             if i < self.ncurfieldcount:
@@ -79,21 +79,23 @@ class ControlScroller(object):
 
         if binitialize:
             self.CurUnoDialog.repaintDialogStep()
+            
 
     def fillupControl(self, guiRow):
         nameProps = self.scrollfields[guiRow]
-        valueProps = self.scrollfields[guiRow + ControlScroller.nscrollvalue]
+        valueProps = self.scrollfields[guiRow + self.nscrollvalue]
         for index, item in enumerate(nameProps):
             if self.CurUnoDialog.xDialogModel.hasByName(item.Name):
                 self.setControlData(item.Name, valueProps[index].Value)
             else:
                 raise AttributeError("No such control !")
+        self.ControlGroupVector[guiRow].setEnabled(True)
 
     def setScrollValue(self, _nscrollvalue, _ntotfieldcount=None):
         if _ntotfieldcount is not None:
             self.setTotalFieldCount(_ntotfieldcount)
         if _nscrollvalue >= 0:
-            ControlScroller.xScrollBar.Model.ScrollValue = _nscrollvalue
+            self.xScrollBar.Model.ScrollValue = _nscrollvalue
             self.scrollControls()
 
     def setCurFieldCount(self):
@@ -106,11 +108,11 @@ class ControlScroller(object):
         self.ntotfieldcount = _ntotfieldcount
         self.setCurFieldCount()
         if self.ntotfieldcount > ControlScroller.nblockincrement:
-            ControlScroller.xScrollBar.Model.Enabled = True
-            ControlScroller.xScrollBar.Model.ScrollValueMax = \
+            self.xScrollBar.Model.Enabled = True
+            self.xScrollBar.Model.ScrollValueMax = \
                 self.ntotfieldcount - ControlScroller.nblockincrement
         else:
-            ControlScroller.xScrollBar.Model.Enabled = False
+            self.xScrollBar.Model.Enabled = False
 
     def toggleComponent(self, _bdoenable):
         bdoenable = _bdoenable and \
@@ -132,11 +134,11 @@ class ControlScroller(object):
 
     def scrollControls(self):
         try:
-            ControlScroller.nscrollvalue = \
-                int(ControlScroller.xScrollBar.Model.ScrollValue)
-            if ControlScroller.nscrollvalue + ControlScroller.nblockincrement \
+            self.nscrollvalue = \
+                int(self.xScrollBar.Model.ScrollValue)
+            if self.nscrollvalue + ControlScroller.nblockincrement \
                     >= self.ntotfieldcount:
-                ControlScroller.nscrollvalue = \
+                self.nscrollvalue = \
                     self.ntotfieldcount - ControlScroller.nblockincrement
             self.fillupControls(False)
         except Exception:
@@ -152,8 +154,8 @@ class ControlScroller(object):
     '''
 
     def fieldInfo(self, guiRow, column):
-        if guiRow + ControlScroller.nscrollvalue < len(self.scrollfields):
-            valueProp = (self.scrollfields[guiRow + ControlScroller.nscrollvalue])[column]
+        if guiRow + self.nscrollvalue < len(self.scrollfields):
+            valueProp = (self.scrollfields[guiRow + self.nscrollvalue])[column]
             nameProp = (self.scrollfields[guiRow])[column]
             if self.CurUnoDialog.xDialogModel.hasByName(nameProp.Name):
                 valueProp.Value = self.getControlData(nameProp.Name)
commit 57954fdd9d0a4a363ab28142dcd9b103acfc5aa3
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Tue Feb 5 21:15:53 2013 +0100

    pyagenda: remove setEnabled method
    
    Change-Id: I174be35302361bfa9985ad77a3c6496d858da472

diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index e06e13b..f25fb4d 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -214,23 +214,17 @@ class TopicsControl(ControlScroller):
     '''
 
     def enableButtons(self):
-        UnoDialog.setEnabled(
-            self.CurUnoDialog.btnInsert,
-            self.lastFocusRow < len(self.scrollfields))
-        UnoDialog.setEnabled(
-            self.CurUnoDialog.btnRemove,
-            self.lastFocusRow < len(self.scrollfields) - 1)
+        self.CurUnoDialog.btnInsert.Model.Enabled = \
+            self.lastFocusRow < len(self.scrollfields)
+        self.CurUnoDialog.btnRemove.Model.Enabled = \
+            self.lastFocusRow < len(self.scrollfields) - 1
         if self.lastFocusControl is not None:
-            UnoDialog.setEnabled(
-                self.CurUnoDialog.btnUp, self.lastFocusRow > 0)
-            UnoDialog.setEnabled(
-                self.CurUnoDialog.btnDown,
-                self.lastFocusRow < len(self.scrollfields) - 1)
+            self.CurUnoDialog.btnUp.Model.Enabled = self.lastFocusRow > 0
+            self.CurUnoDialog.btnDown.Model.Enabled = \
+                self.lastFocusRow < len(self.scrollfields) - 1
         else:
-            UnoDialog.setEnabled(
-                self.CurUnoDialog.btnUp, False)
-            UnoDialog.setEnabled(
-                self.CurUnoDialog.btnDown, False)
+            self.CurUnoDialog.btnUp.Model.Enabled = False
+            self.CurUnoDialog.btnDown.Model.Enabled =  False
 
     '''
     Removes the current row.
@@ -723,7 +717,6 @@ class TopicsControl(ControlScroller):
             traceback.print_exc()
 
 '''
- at author rp143992
 A class represting a single GUI row.
 Note that the instance methods of this class
 are being called and handle controls of
@@ -821,10 +814,10 @@ class ControlRow(object):
     '''
 
     def setEnabled(self, enabled):
-        self.dialog.setEnabled(self.label, enabled)
-        self.dialog.setEnabled(self.textbox, enabled)
-        self.dialog.setEnabled(self.combobox, enabled)
-        self.dialog.setEnabled(self.timebox, enabled)
+        self.label.Model.Enabled = enabled
+        self.textbox.Model.Enabled = enabled
+        self.combobox.Model.Enabled = enabled
+        self.timebox.Model.Enabled = enabled
 
     '''
     Impelementation of XKeyListener.
diff --git a/wizards/com/sun/star/wizards/ui/UnoDialog.py b/wizards/com/sun/star/wizards/ui/UnoDialog.py
index ca93e72..f2b36a1 100644
--- a/wizards/com/sun/star/wizards/ui/UnoDialog.py
+++ b/wizards/com/sun/star/wizards/ui/UnoDialog.py
@@ -258,10 +258,6 @@ class UnoDialog(object):
                 xListBox.selectItemPos((short)(SelPos - 1), True)
 
     @classmethod
-    def setEnabled(self, control, enabled):
-        control.Model.Enabled = enabled
-
-    @classmethod
     def getDisplayProperty(self, xServiceInfo):
         if xServiceInfo.supportsService(
                 "com.sun.star.awt.UnoControlFixedTextModel"):


More information about the Libreoffice-commits mailing list