diff options
author | Xisco Fauli <anistenis@gmail.com> | 2011-07-28 17:06:04 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-18 02:57:44 +0200 |
commit | 628e2b7834d7fdda54bee7d6600c8ceb404174b7 (patch) | |
tree | 35bcefad9e1c4c491a00028560b7d23519306726 /wizards/com | |
parent | 873b9a1a7775c43676b02126b0a566bccbb2f39a (diff) |
Load the proper template
Diffstat (limited to 'wizards/com')
5 files changed, 25 insertions, 47 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py index 735c95ceeb23..7199c11bfeb9 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py @@ -470,8 +470,7 @@ class AgendaTemplate(TextDocument): @synchronized(lock) def finish(self, topics): - #COMMENTED - #self.createMinutes(topics) + self.createMinutes(topics) self.deleteHiddenSections() AgendaTemplate.textSectionHandler.removeAllTextSections() @@ -508,9 +507,9 @@ class AgendaTemplate(TextDocument): # if the minutes section should be removed (the # user did not check "create minutes") if not AgendaTemplate.agenda.cp_IncludeMinutes \ - or topicsData.size() <= 1: + or len(topicsData) <= 1: try: - minutesAllSection = getSection(SECTION_MINUTES_ALL) + minutesAllSection = self.getSection(SECTION_MINUTES_ALL) minutesAllSection.Anchor.String = "" except Exception, ex: traceback.print_exc() @@ -518,18 +517,12 @@ class AgendaTemplate(TextDocument): # the user checked "create minutes" else: try: - topicStartTime = 0 - try: - topicStartTime = int(AgendaTemplate.agenda.cp_Time) - except Exception, ex: - pass + topicStartTime = int(AgendaTemplate.agenda.cp_Time) #first I replace the minutes titles... - AgendaTemplate.items = searchFillInItems() + AgendaTemplate.items = self.searchFillInItems() itemIndex = 0 - while itemIndex < self.items.size(): - item = (XTextRange) - self.items.get(itemIndex) - itemText = item.getString().trim().toLowerCase() + for item in self.items: + itemText = item.String.lstrip().lower() if itemText == FILLIN_MINUTES_TITLE: self.fillMinutesItem( item, AgendaTemplate.agenda.cp_Title, @@ -547,7 +540,6 @@ class AgendaTemplate(TextDocument): item, getTimeString(AgendaTemplate.agenda.cp_Time), self.resources.resPlaceHolderTime) - itemIndex += 1 self.items.clear() ''' now add minutes for each topic. @@ -556,14 +548,12 @@ class AgendaTemplate(TextDocument): topics data has *always* an empty topic at the end... ''' - for i in xrange(topicsData.size() - 1): - topic = topicsData.get(i) - AgendaTemplate.items = searchFillInItems() + for i in xrange(len(topicsData) - 1): + topic = topicsData[i] + AgendaTemplate.items = self.searchFillInItems() itemIndex = 0 - while itemIndex < self.items.size(): - item = (XTextRange) - self.items.get(itemIndex) - itemText = item.getString().trim().toLowerCase() + for item in self.items: + itemText = item.String.lstrip().lower() if itemText == FILLIN_MINUTE_NUM: fillMinutesItem(item, topic[0].Value, "") elif itemText == FILLIN_MINUTE_TOPIC: @@ -582,8 +572,7 @@ class AgendaTemplate(TextDocument): display any time here. ''' if topicTime == 0 or topicStartTime == 0: - time = (String) - topic[3].Value + time = topic[3].Value else: time = getTimeString(str(topicStartTime)) + " - " topicStartTime += topicTime * 1000 @@ -591,15 +580,13 @@ class AgendaTemplate(TextDocument): fillMinutesItem(item, time, "") - itemIndex += 1 AgendaTemplate.textSectionHandler.removeTextSectionbyName( SECTION_MINUTES) # after the last section we do not insert a one. - if i < topicsData.size() - 2: + if i < len(topicsData) - 2: AgendaTemplate.textSectionHandler.insertTextSection( SECTION_MINUTES, AgendaTemplate.template, False) - i += 1 except Exception, ex: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py index 2ad9cca1cd1a..6f3fe7a25c60 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py @@ -4,6 +4,7 @@ TXTTITLE_TEXT_CHANGED = "txtTitleTextChanged" TXTDATE_TEXT_CHANGED = "txtDateTextChanged" TXTTIME_TEXT_CHANGED = "txtTimeTextChanged" TXTLOCATION_TEXT_CHANGED = "txtLocationTextChanged" +CHKMINUTES_ITEM_CHANGED = "chkMinutesItemChanged" CHKUSEMEETINGTYPE_ITEM_CHANGED = "chkUseMeetingTypeItemChanged" CHKUSEREAD_ITEM_CHANGED = "chkUseReadItemChanged" CHKUSEBRING_ITEM_CHANGED = "chkUseBringItemChanged" diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py index d2614bec8729..bd6d176fd7ce 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py @@ -83,7 +83,6 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): # synchronize GUI and CGAgenda object. self.initConfiguration() - self.agendaTemplate.load(self.agendaTemplates[1][0], []) if self.myPathSelection.xSaveTextBox.Text.lower() == "": self.myPathSelection.initializePath() @@ -95,6 +94,8 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): # initialize roadmap self.insertRoadmap() + self.pageDesignChanged() + self.executeDialogFromComponent(self.agendaTemplate.xFrame) self.removeTerminateListener() self.closeDocument() @@ -139,8 +140,8 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): FileAccess.getParentDir(self.agenda.cp_TemplatePath)): try: self.agenda.cp_TemplatePath = FileAccess.connectURLs( - FileAccess.getOfficePath(xMSF, "Work", "", ""), - resources.initConfigurationresDefaultFilename) + FileAccess.getOfficePath2(self.xMSF, "Work", "", ""), + self.resources.resDefaultFilename) except Exception, ex: traceback.print_exc() @@ -282,6 +283,9 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): #checkbox listeners def chkUseMeetingTypeItemChanged(self): + AgendaTemplate.agenda.cp_IncludeMinutes = bool(self.chkMinutes.State) + + def chkUseMeetingTypeItemChanged(self): AgendaTemplate.redraw(FILLIN_MEETING_TYPE) def chkUseReadItemChanged(self): diff --git a/wizards/com/sun/star/wizards/text/TextDocument.py b/wizards/com/sun/star/wizards/text/TextDocument.py index ad83b4cbc1cc..cebb8d6c6ece 100644 --- a/wizards/com/sun/star/wizards/text/TextDocument.py +++ b/wizards/com/sun/star/wizards/text/TextDocument.py @@ -67,7 +67,8 @@ class TextDocument(object): TextDocument.xTextDocument = xMSF.createInstance( "com.sun.star.text.TextDocument") TextDocument.xTextDocument.initNew() - TextDocument.xTextDocument.setIdentifier(_moduleIdentifier.Identifier) + TextDocument.xTextDocument.setIdentifier( + _moduleIdentifier.Identifier) # load the document into a blank frame xDesktop = Desktop.getDesktop(xMSF) loadArgs = range(1) @@ -240,21 +241,6 @@ class TextDocument(object): traceback.print_exc() ''' - removes an arbitrary Object which supports the 'XTextContent' interface - @param oTextContent - @return - ''' - - def removeTextContent(self, oTextContent): - try: - self.xText.removeTextContent(oxTextContent) - print "remove" - return True - except NoSuchElementException, e: - traceback.print_exc() - return False - - ''' Apparently there is no other way to get the page count of a text document other than using a cursor and making it jump to the last page... diff --git a/wizards/com/sun/star/wizards/text/ViewHandler.py b/wizards/com/sun/star/wizards/text/ViewHandler.py index cf5401efb834..e86c128205c1 100644 --- a/wizards/com/sun/star/wizards/text/ViewHandler.py +++ b/wizards/com/sun/star/wizards/text/ViewHandler.py @@ -18,7 +18,7 @@ class ViewHandler(object): oPageStyle = oPageStyles.getByName("First Page") xAllTextTables = oTextTableHandler.xTextTablesSupplier.TextTables xTextTable = xAllTextTables.getByIndex(0) - xRange = xTextTable.getAnchor().getText() + xRange = xTextTable.Anchor.Text xPageCursor.gotoRange(xRange, False) if not com.sun.star.uno.AnyConverter.isVoid(XTextRange): xViewTextCursor.gotoRange(xHeaderRange, False) |