[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 4 commits - wizards/com wizards/source

Xisco Fauli anistenis at gmail.com
Tue Nov 19 03:10:45 PST 2013


 wizards/com/sun/star/wizards/agenda/AgendaDocument.py              |   33 ++--------
 wizards/com/sun/star/wizards/document/OfficeDocument.py            |    2 
 wizards/com/sun/star/wizards/letter/LetterWizardDialog.py          |   32 +++------
 wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py |    3 
 wizards/com/sun/star/wizards/ui/event/DataAware.py                 |   16 +++-
 wizards/com/sun/star/wizards/ui/event/UnoDataAware.py              |   21 ++++--
 wizards/source/formwizard/dbwizres.src                             |    5 -
 7 files changed, 48 insertions(+), 64 deletions(-)

New commits:
commit ebfc786cc673fe2624a4710ecab838dc2f84a252
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Mon Nov 18 23:57:47 2013 +0100

    fdo#68788: Don't use systemPathToFileUrl here
    
    it works on Linux but not on Windows.
    
    Change-Id: Ia9af362c09d46c678fa4ebe8cf4922dae3dddccf
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.py b/wizards/com/sun/star/wizards/document/OfficeDocument.py
index eb6fb0a..35d3183 100644
--- a/wizards/com/sun/star/wizards/document/OfficeDocument.py
+++ b/wizards/com/sun/star/wizards/document/OfficeDocument.py
@@ -105,7 +105,7 @@ class OfficeDocument(object):
         xComponent = None
         try:
             xComponent = frame.loadComponentFromURL(
-                systemPathToFileUrl(sURL), "_self", 0, tuple(loadValues))
+                sURL, "_self", 0, tuple(loadValues))
 
         except Exception:
             traceback.print_exc()
commit e0d9d5bb52ff1f2fc3efcc204ccb0e1c524182ed
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun Nov 17 19:17:12 2013 +0100

    fdo#69025 Remove unused text
    
    Change-Id: I9fc60d52e1bc4b38b79e3e29ed1b04b3e8a777a1
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
index e73142a..3176abd 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialog.py
@@ -580,7 +580,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 22),
                 self.resources.reschkUseLogo_value,
-                "chkUseLogo", 97, 54, 0, 3, 22, 212), self)
+                "chkUseLogo", 97, 34, 0, 3, 22, 212), self)
         self.chkUseAddressReceiver = self.insertCheckBox(
             "chkUseAddressReceiver",
             LetterWizardDialogConst.CHKUSEADDRESSRECEIVER_ITEM_CHANGED,
@@ -596,7 +596,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 23),
                 self.resources.reschkUseAddressReceiver_value,
-                "chkUseAddressReceiver", 97, 69, 0, 3, 23, 212), self)
+                "chkUseAddressReceiver", 97, 49, 0, 3, 23, 212), self)
         self.chkUseSigns = self.insertCheckBox(
             "chkUseSigns",
             LetterWizardDialogConst.CHKUSESIGNS_ITEM_CHANGED,
@@ -612,7 +612,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 24),
                 self.resources.reschkUseSigns_value,
-                "chkUseSigns", 97, 82, 0, 3, 24, 212), self)
+                "chkUseSigns", 97, 62, 0, 3, 24, 212), self)
         self.chkUseSubject = self.insertCheckBox(
             "chkUseSubject",
             LetterWizardDialogConst.CHKUSESUBJECT_ITEM_CHANGED,
@@ -628,7 +628,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 25),
                 self.resources.reschkUseSubject_value,
-                "chkUseSubject", 97, 98, 0, 3, 25, 212), self)
+                "chkUseSubject", 97, 78, 0, 3, 25, 212), self)
         self.chkUseSalutation = self.insertCheckBox(
             "chkUseSalutation",
             LetterWizardDialogConst.CHKUSESALUTATION_ITEM_CHANGED,
@@ -644,7 +644,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 26),
                 self.resources.reschkUseSalutation_value,
-                "chkUseSalutation", 97, 113, 0, 3, 26, 66), self)
+                "chkUseSalutation", 97, 93, 0, 3, 26, 66), self)
         self.lstSalutation = self.insertComboBox(
             "lstSalutation",
             LetterWizardDialogConst.LSTSALUTATION_ACTION_PERFORMED,
@@ -660,7 +660,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_TABINDEX,
                 PropertyNames.PROPERTY_WIDTH),
             (True, 12, HelpIds.getHelpIdString(HID + 27),
-                "lstSalutation", 210, 110, 3, 27, 74), self)
+                "lstSalutation", 210, 90, 3, 27, 74), self)
         self.chkUseBendMarks = self.insertCheckBox(
             "chkUseBendMarks",
             LetterWizardDialogConst.CHKUSEBENDMARKS_ITEM_CHANGED,
@@ -676,7 +676,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 28),
                 self.resources.reschkUseBendMarks_value,
-                "chkUseBendMarks", 97, 127, 0, 3, 28, 212), self)
+                "chkUseBendMarks", 97, 107, 0, 3, 28, 212), self)
         self.chkUseGreeting = self.insertCheckBox(
             "chkUseGreeting",
             LetterWizardDialogConst.CHKUSEGREETING_ITEM_CHANGED,
@@ -692,7 +692,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 29),
                 self.resources.reschkUseGreeting_value,
-                "chkUseGreeting", 97, 142, 0, 3, 29, 66), self)
+                "chkUseGreeting", 97, 122, 0, 3, 29, 66), self)
         self.lstGreeting = self.insertComboBox(
             "lstGreeting",
             LetterWizardDialogConst.LSTGREETING_ACTION_PERFORMED,
@@ -708,7 +708,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_TABINDEX,
                 PropertyNames.PROPERTY_WIDTH),
             (True, 12, HelpIds.getHelpIdString(HID + 30),
-                "lstGreeting", 210, 141, 3, 30, 74), self)
+                "lstGreeting", 210, 121, 3, 30, 74), self)
         self.chkUseFooter = self.insertCheckBox(
             "chkUseFooter",
             LetterWizardDialogConst.CHKUSEFOOTER_ITEM_CHANGED,
@@ -724,19 +724,7 @@ class LetterWizardDialog(WizardDialog):
                 PropertyNames.PROPERTY_WIDTH),
             (8, HelpIds.getHelpIdString(HID + 31),
                 self.resources.reschkUseFooter_value,
-                "chkUseFooter", 97, 158, 0, 3, 31, 212), self)
-        self.insertLabel("lblLetterNorm",
-            (PropertyNames.PROPERTY_HEIGHT,
-                PropertyNames.PROPERTY_LABEL,
-                PropertyNames.PROPERTY_MULTILINE,
-                PropertyNames.PROPERTY_NAME,
-                PropertyNames.PROPERTY_POSITION_X,
-                PropertyNames.PROPERTY_POSITION_Y,
-                PropertyNames.PROPERTY_STEP,
-                PropertyNames.PROPERTY_TABINDEX,
-                PropertyNames.PROPERTY_WIDTH),
-            (16, self.resources.reslblLetterNorm_value, True,
-                "lblLetterNorm", 97, 28, 3, 50, 109))
+                "chkUseFooter", 97, 138, 0, 3, 31, 212), self)
         self.insertLabel("lblTitle3",
             (
             "FontDescriptor", PropertyNames.PROPERTY_HEIGHT,
diff --git a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
index b884246..a59ba71 100644
--- a/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py
@@ -154,9 +154,6 @@ class LetterWizardDialogResources(Resource):
         self.reslblFooterHeight_value = \
             self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 40)
-        self.reslblLetterNorm_value = \
-            self.getResText(
-                LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 41)
         self.reslblSenderAddress_value = \
             self.getResText(
                 LetterWizardDialogResources.RID_LETTERWIZARDDIALOG_START + 42)
diff --git a/wizards/source/formwizard/dbwizres.src b/wizards/source/formwizard/dbwizres.src
index be86337..c68036c 100644
--- a/wizards/source/formwizard/dbwizres.src
+++ b/wizards/source/formwizard/dbwizres.src
@@ -2066,11 +2066,6 @@ String RID_LETTERWIZARDDIALOG_START + 40
     Text [ en-US] = "Height:";
 };
 
-String RID_LETTERWIZARDDIALOG_START + 41
-{
-    Text [ en-US] = "Use a typical letter format for this country:";
-};
-
 String RID_LETTERWIZARDDIALOG_START + 42
 {
     Text [ en-US] = "Sender's address";
commit 7f56bba23cf3af956ea65910959c32dcb454929c
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun Sep 8 19:56:06 2013 +0200

    pywizards: Fix date and time fields
    
    Change-Id: I7be16558bab7c4dde2d326808b9fb115a6878894
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
index 2a74597..a8dcece 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
@@ -22,7 +22,7 @@ from ..text.TextDocument import TextDocument
 from ..text.TextSectionHandler import TextSectionHandler
 from ..common.FileAccess import FileAccess
 
-from datetime import date as dateTimeObject
+from datetime import datetime
 
 from com.sun.star.text.PlaceholderType import TEXT
 from com.sun.star.i18n.NumberFormatIndex import TIME_HHMM, DATE_SYSTEM_LONG
@@ -142,7 +142,7 @@ class AgendaDocument(TextDocument):
         except Exception:
             traceback.print_exc()
         self.xTextDocument.unlockControllers()
-
+        
     '''
     checks the data model if the
     item corresponding to the given string should be shown
@@ -367,8 +367,7 @@ class AgendaDocument(TextDocument):
                     self.getDateString(self.agenda.cp_Date)
                 self.teDate.write(self.trDate)
             elif controlName == "txtTime":
-                self.teTime.placeHolderText = \
-                    self.getTimeString(self.agenda.cp_Time)
+                self.teTime.placeHolderText = self.agenda.cp_Time
                 self.teTime.write(self.trTime)
             elif controlName == "cbLocation":
                 self.teLocation.placeHolderText = self.agenda.cp_Location
@@ -378,25 +377,12 @@ class AgendaDocument(TextDocument):
         except Exception:
             traceback.print_exc()
 
-    def getDateString(self, d):
-        if not d:
+    def getDateString(self, date):
+        if not date:
             return ""
-        date = int(d)
-        year = int(date / 10000)
-        month = int((date % 10000) / 100)
-        day = int(date % 100)
-        dateObject = dateTimeObject(year, month, day)
+        dateObject = datetime.strptime(date, '%d/%m/%y').date()
         return self.dateUtils.format(self.dateFormat, dateObject)
 
-    def getTimeString(self, s):
-        if s is None or s == "":
-            return ""
-        time = int(s)
-        t = ((time / float(1000000)) / float(24)) \
-            + ((time % 1000000) / float(1000000)) / float(35)
-        return self.formatter.convertNumberToString(
-            self.timeFormat, t)
-
     def finish(self, topics):
         self.createMinutes(topics)
         self.deleteHiddenSections()
@@ -468,8 +454,7 @@ class AgendaDocument(TextDocument):
                             self.resources.resPlaceHolderDate)
                     elif itemText == \
                             self.templateConsts.FILLIN_MINUTES_TIME:
-                        self.fillMinutesItem(
-                            item, getTimeString(self.agenda.cp_Time),
+                        self.fillMinutesItem( item, self.agenda.cp_Time,
                             self.resources.resPlaceHolderTime)
 
                 self.items.clear()
@@ -510,9 +495,9 @@ class AgendaDocument(TextDocument):
                             if topicTime == 0 or topicStartTime == 0:
                                 time = topic[3].Value
                             else:
-                                time = getTimeString(str(topicStartTime)) + " - "
+                                time = str(topicStartTime) + " - "
                                 topicStartTime += topicTime * 1000
-                                time += getTimeString(str(topicStartTime))
+                                time += str(topicStartTime)
 
                             fillMinutesItem(item, time, "")
 
diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index 9628f0c..0fae91a 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -20,6 +20,10 @@ import uno
 from abc import ABCMeta, abstractmethod
 from ...common.PropertyNames import PropertyNames
 
+from com.sun.star.util import Date
+from com.sun.star.util import Time
+from datetime import datetime
+
 '''
 @author rpiterman
 DataAware objects are used to live-synchronize UI and DataModel/DataObject.
@@ -118,9 +122,12 @@ class DataAware(object):
                 data = uno.invoke(self._dataObject, "get" + self._field, ())
             ui = self.getFromUI()
             if data is not ui:
-                #if isinstance(ui,tuple):
-                    #Selected Element listbox
-                #    ui = ui[0]
+                if isinstance(ui,Date):
+                    d = datetime(ui.Year, ui.Month, ui.Day)
+                    ui = d.strftime('%d/%m/%y')
+                elif isinstance(ui,Time):
+                    t = datetime(1, 1, 1, ui.Hours, ui.Minutes)
+                    ui = t.strftime('%H:%M')
                 if useUno:
                     uno.invoke(self._dataObject, "set" + self._field, (ui,))
                 else:
diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
index ea728b9..1ed80a1 100644
--- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py
@@ -17,7 +17,9 @@
 #
 import uno
 from .CommonListener import ItemListenerProcAdapter, TextListenerProcAdapter
-from .DataAware import DataAware, PropertyNames
+from .DataAware import DataAware, PropertyNames, datetime, Date, Time
+
+from com.sun.star.script import CannotConvertException
 
 '''
 @author rpiterman
@@ -47,14 +49,21 @@ class UnoDataAware(DataAware):
 
     def setToUI(self, value):
         if (isinstance(value, list)):
-            length = len(value)
             value = tuple(value)
         elif self.isShort:
             value = uno.Any("[]short", (value,))
-        if (hasattr(self.unoModel, self.unoPropName)):
-            setattr(self.unoModel, self.unoPropName, value)
-        else:
-            uno.invoke(self.unoModel, "set" + self.unoPropName, (value,))
+        if value:
+            if(hasattr(self.unoModel, self.unoPropName)):
+                if self.unoPropName == "Date":
+                    d = datetime.strptime(value, '%d/%m/%y')
+                    value = Date(d.day, d.month, d.year)
+                elif self.unoPropName == "Time":
+                    t = datetime.strptime(value, '%H:%M')
+                    value = Time(0, 0, t.minute, t.hour, False)
+                
+                setattr(self.unoModel, self.unoPropName, value)
+            else:
+                uno.invoke(self.unoModel, "set" + self.unoPropName, (value,))
 
     # Try to get from an arbitrary object a boolean value.
     # Null returns Boolean.FALSE;
commit 6533f579d363fbd7ef7d3b2d6aae8762031f766f
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Tue Sep 10 21:09:09 2013 +0200

    pywizards: fix the switch between elements in the listboxs
    
    Change-Id: I4603232d158ad3adb60697dbf1425eb5dfe5d71f
    Signed-off-by: Andras Timar <andras.timar at collabora.com>

diff --git a/wizards/com/sun/star/wizards/ui/event/DataAware.py b/wizards/com/sun/star/wizards/ui/event/DataAware.py
index 5c8c5aa..9628f0c 100644
--- a/wizards/com/sun/star/wizards/ui/event/DataAware.py
+++ b/wizards/com/sun/star/wizards/ui/event/DataAware.py
@@ -124,6 +124,9 @@ class DataAware(object):
                 if useUno:
                     uno.invoke(self._dataObject, "set" + self._field, (ui,))
                 else:
+                    if isinstance(ui,tuple):
+                        #Listbox Element
+                        ui = ui[0]
                     setattr(self._dataObject, self._field, ui)
             self.enableControls(ui)
         except Exception:


More information about the Libreoffice-commits mailing list