summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2013-02-13 20:16:30 +0100
committerXisco Fauli <anistenis@gmail.com>2013-02-14 00:55:16 +0100
commitd984860ea022c4e2256947d745b29458ae5e591c (patch)
treec8af132ca05847b50c1da37e6dd880141f8eccf5 /wizards
parent9e1f5d5bf1bcc8a7ccfd48a6731ed5763bc0b4dc (diff)
pyagenda: localise template at runtime
Change-Id: I80060f2c0a9ee014546632962e196b730a9e5c78
Diffstat (limited to 'wizards')
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaDocument.py6
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py70
-rw-r--r--wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py33
-rw-r--r--wizards/com/sun/star/wizards/agenda/TopicsControl.py6
4 files changed, 79 insertions, 36 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
index 07b3f35f7117..0da7fccef525 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py
@@ -86,7 +86,7 @@ class AgendaDocument(TextDocument):
self.itemsMap = {}
self.allItems = []
- def load(self, templateURL, topics):
+ def load(self, templateURL):
#Each template is duplicated. aw-XXX.ott is the template itself
#and XXX.ott is a section link.
self.template = self.calcTemplateName(templateURL)
@@ -94,7 +94,7 @@ class AgendaDocument(TextDocument):
self.xFrame.ComponentWindow.Enable = False
self.xTextDocument.lockControllers()
self.initialize()
- self.initializeData(topics)
+ self.initializeData()
self.xTextDocument.unlockControllers()
'''
@@ -114,7 +114,7 @@ class AgendaDocument(TextDocument):
supplies this information.
'''
- def initializeData(self, topicsData):
+ def initializeData(self):
for i in self.itemsTables:
try:
i.write()
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
index 72f3b753d33a..4dea434da517 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py
@@ -19,7 +19,7 @@ import traceback
import os.path
from .AgendaWizardDialog import AgendaWizardDialog, uno
from .AgendaWizardDialogConst import HID
-from .AgendaDocument import AgendaDocument
+from .AgendaDocument import AgendaDocument, TextElement
from .TemplateConsts import TemplateConsts
from .TopicsControl import TopicsControl
from .CGAgenda import CGAgenda
@@ -84,13 +84,14 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
self.initializePaths()
# initialize the agenda template
- self.agendaTemplate = AgendaDocument(
+ self.myAgendaDoc = AgendaDocument(
self.xMSF, self.agenda, self.resources,
self.templateConsts, self)
self.initializeTemplates()
- self.agendaTemplate.load(
- self.agendaTemplates[1][self.agenda.cp_AgendaType], [])
+ self.myAgendaDoc.load(
+ self.agendaTemplates[1][self.agenda.cp_AgendaType])
+ self.drawConstants()
# build the dialog.
self.drawNaviBar()
@@ -114,13 +115,13 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
self.myPathSelection.initializePath()
# create the peer
- xContainerWindow = self.agendaTemplate.xFrame.ContainerWindow
+ xContainerWindow = self.myAgendaDoc.xFrame.ContainerWindow
self.createWindowPeer(xContainerWindow)
# initialize roadmap
self.insertRoadmap()
- self.executeDialogFromComponent(self.agendaTemplate.xFrame)
+ self.executeDialogFromComponent(self.myAgendaDoc.xFrame)
self.removeTerminateListener()
self.closeDocument()
self.running = False
@@ -236,61 +237,61 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
#avoid to load the same item again
if AgendaWizardDialogImpl.pageDesign is not SelectedItemPos:
AgendaWizardDialogImpl.pageDesign = SelectedItemPos
- self.agendaTemplate.load(
- self.agendaTemplates[1][SelectedItemPos],
- self.topicsControl.scrollfields)
+ self.myAgendaDoc.load(
+ self.agendaTemplates[1][SelectedItemPos])
+ self.drawConstants()
except Exception:
traceback.print_exc()
#textFields listeners
def txtTitleTextChanged(self):
- self.agendaTemplate.redrawTitle("txtTitle")
+ self.myAgendaDoc.redrawTitle("txtTitle")
def txtDateTextChanged(self):
- self.agendaTemplate.redrawTitle("txtDate")
+ self.myAgendaDoc.redrawTitle("txtDate")
def txtTimeTextChanged(self):
- self.agendaTemplate.redrawTitle("txtTime")
+ self.myAgendaDoc.redrawTitle("txtTime")
def txtLocationTextChanged(self):
- self.agendaTemplate.redrawTitle("cbLocation")
+ self.myAgendaDoc.redrawTitle("cbLocation")
#checkbox listeners
def chkUseMeetingTypeItemChanged(self):
- self.agendaTemplate.agenda.cp_IncludeMinutes = bool(self.chkMinutes.State)
+ self.myAgendaDoc.agenda.cp_IncludeMinutes = bool(self.chkMinutes.State)
def chkUseMeetingTypeItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_MEETING_TYPE)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_MEETING_TYPE)
def chkUseReadItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_READ)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_READ)
def chkUseBringItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_BRING)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_BRING)
def chkUseNotesItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_NOTES)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_NOTES)
def chkUseCalledByItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_CALLED_BY)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_CALLED_BY)
def chkUseFacilitatorItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_FACILITATOR)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_FACILITATOR)
def chkUseNoteTakerItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_NOTETAKER)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_NOTETAKER)
def chkUseTimeKeeperItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_TIMEKEEPER)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_TIMEKEEPER)
def chkUseAttendeesItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_PARTICIPANTS)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_PARTICIPANTS)
def chkUseObserversItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_OBSERVERS)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_OBSERVERS)
def chkUseResourcePersonsItemChanged(self):
- self.agendaTemplate.redraw(self.templateConsts.FILLIN_RESOURCE_PERSONS)
+ self.myAgendaDoc.redraw(self.templateConsts.FILLIN_RESOURCE_PERSONS)
def insertRow(self):
self.topicsControl.insertRow()
@@ -332,13 +333,13 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
endWizard = False
return False
- xDocProps = self.agendaTemplate.xTextDocument.DocumentProperties
+ xDocProps = self.myAgendaDoc.xTextDocument.DocumentProperties
xDocProps.Title = self.txtTemplateName.Text
- self.agendaTemplate.setWizardTemplateDocInfo( \
+ self.myAgendaDoc.setWizardTemplateDocInfo( \
self.resources.resAgendaWizardDialog_title,
self.resources.resTemplateDescription)
bSaveSuccess = OfficeDocument.store(
- self.xMSF, self.agendaTemplate.xTextDocument, self.sPath,
+ self.xMSF, self.myAgendaDoc.xTextDocument, self.sPath,
"writer8_template")
if bSaveSuccess:
@@ -349,7 +350,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
self.agenda.writeConfiguration(root, "cp_")
root.commitChanges()
- self.agendaTemplate.finish(self.topicsControl.scrollfields)
+ self.myAgendaDoc.finish(self.topicsControl.scrollfields)
loadValues = list(range(2))
loadValues[0] = uno.createUnoStruct( \
@@ -385,10 +386,19 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
def closeDocument(self):
try:
- xCloseable = self.agendaTemplate.xFrame.close(False)
+ xCloseable = self.myAgendaDoc.xFrame.close(False)
except CloseVetoException:
traceback.print_exc()
+ def drawConstants(self):
+ '''Localise the template'''
+ constRangeList = self.myAgendaDoc.searchFillInItems(1)
+
+ for i in constRangeList:
+ text = i.String.lower()
+ aux = TextElement(i, self.resources.dictConstants[text])
+ aux.write()
+
def validatePath(self):
if self.myPathSelection.usedPathPicker:
self.filenameChanged = True
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
index a88b7f4c2ca6..ddcbcc00ac3d 100644
--- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
+++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py
@@ -171,6 +171,39 @@ class AgendaWizardDialogResources(Resource):
self.resButtonDown = self.getResText(
AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 71)
+ #Create a dictionary for localised string in the template
+ self.dictConstants = {
+ "#datetitle#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 72),
+ "#timetitle#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 73),
+ "#locationtitle#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 74),
+ "#topics#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 75),
+ "#num.#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 76),
+ "#topicheader#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 77),
+ "#responsibleheader#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 78),
+ "#timeheader#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 79),
+ "#additional-information#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 80),
+ "#minutes-for#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 81),
+ "#discussion#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 82),
+ "#conclusion#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 83),
+ "#to-do#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 84),
+ "#responsible-party#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 85),
+ "#deadline#" : self.getResText(
+ AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 86)}
+
#Common Resources
self.resOverwriteWarning = self.getResText(
AgendaWizardDialogResources.RID_COMMON_START + 19)
diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
index 2fc619aa8c35..9b3dc7da35b9 100644
--- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py
+++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py
@@ -686,7 +686,7 @@ class TopicsControl(ControlScroller):
data = self.scrollfields[row]
try:
for i in range(len(data)):
- self.CurUnoDialog.agendaTemplate.topics.writeCell(
+ self.CurUnoDialog.myAgendaDoc.topics.writeCell(
row, i, data)
except Exception:
traceback.print_exc()
@@ -702,7 +702,7 @@ class TopicsControl(ControlScroller):
def updateDocumentCell(self, row, column, data):
try:
- self.CurUnoDialog.agendaTemplate.topics.writeCell(
+ self.CurUnoDialog.myAgendaDoc.topics.writeCell(
row, column, data)
except Exception:
traceback.print_exc()
@@ -715,7 +715,7 @@ class TopicsControl(ControlScroller):
def reduceDocumentToTopics(self):
try:
- self.CurUnoDialog.agendaTemplate.topics.reduceDocumentTo(
+ self.CurUnoDialog.myAgendaDoc.topics.reduceDocumentTo(
len(self.scrollfields) - 1)
except Exception:
traceback.print_exc()