wizards/Pyuno_commonwizards.mk | 1 wizards/com/sun/star/wizards/agenda/AgendaDocument.py | 26 - wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py | 47 +-- wizards/com/sun/star/wizards/agenda/CGAgenda.py | 45 +- wizards/com/sun/star/wizards/agenda/CGTopic.py | 29 - wizards/com/sun/star/wizards/agenda/TopicsControl.py | 14 wizards/com/sun/star/wizards/common/ConfigGroup.py | 8 wizards/com/sun/star/wizards/common/ConfigNode.py | 30 - wizards/com/sun/star/wizards/common/ConfigSet.py | 151 ---------- wizards/com/sun/star/wizards/text/TextSectionHandler.py | 2 10 files changed, 92 insertions(+), 261 deletions(-)
New commits: commit 0e5f695a8e0e50889d74b266f96c88aabd590c65 Author: Xisco Fauli <aniste...@gmail.com> Date: Sun Feb 3 00:41:45 2013 +0100 pyagenda: load the proper data for each topic Change-Id: Ia7d8d65a868b86c81feb489328cbcb6bbd4f75f6 diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.py b/wizards/com/sun/star/wizards/agenda/CGAgenda.py index a50dbd9..335f6ed 100644 --- a/wizards/com/sun/star/wizards/agenda/CGAgenda.py +++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.py @@ -17,7 +17,6 @@ # from ..common.ConfigGroup import ConfigGroup from ..common.ConfigSet import ConfigSet -from .CGTopic import CGTopic class CGAgenda(ConfigGroup): @@ -43,4 +42,4 @@ class CGAgenda(ConfigGroup): self.cp_TemplatePath = str() self.cp_ProceedMethod = int() - self.cp_Topics = ConfigSet(CGTopic()) + self.cp_Topics = ConfigSet() diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py index ba7ea69..e69ed13 100644 --- a/wizards/com/sun/star/wizards/common/ConfigSet.py +++ b/wizards/com/sun/star/wizards/common/ConfigSet.py @@ -16,9 +16,9 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import traceback -import inspect from .ConfigGroup import ConfigGroup from .Configuration import Configuration +from ..agenda.CGTopic import CGTopic class ConfigSet(ConfigGroup): ''' @@ -30,13 +30,9 @@ class ConfigSet(ConfigGroup): to avoid this "deletion" of nulls. ''' - def __init__(self, topic): - self.topic = topic + def __init__(self): self.childrenList = [] - def add(self, name, o): - self.childrenList.append(o) - def writeConfiguration(self, configView, param): names = self.childrenMap.keys() if isinstance(self.childClass, ConfigNode): @@ -68,8 +64,9 @@ class ConfigSet(ConfigGroup): if names: for i in names: try: - self.topic.readConfiguration( + topic = CGTopic() + topic.readConfiguration( configurationView.getByName(i), param) - self.add(i, self.topic) + self.childrenList.append(topic) except Exception: traceback.print_exc() commit ae4d40f3f0e13c3720667a6c6a143480d0136c52 Author: Xisco Fauli <aniste...@gmail.com> Date: Sat Feb 2 22:49:18 2013 +0100 pyagenda: i have to redo this class so this method is unused now Change-Id: Ief3461be5eeb6b952b76eeacf2778cb5beef6826 diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py index aa02c6a..ba7ea69 100644 --- a/wizards/com/sun/star/wizards/common/ConfigSet.py +++ b/wizards/com/sun/star/wizards/common/ConfigSet.py @@ -32,30 +32,7 @@ class ConfigSet(ConfigGroup): def __init__(self, topic): self.topic = topic - self.childrenMap = {} self.childrenList = [] - self.noNulls = False - - def add2(self, name, o): - self.childrenMap[name] = o - if isinstance(name, int): - i = name - self.childrenList.insert(i, o) - else: - try: - i = o.cp_Index - oldSize = self.getSize() - if oldSize <= i: - newSize = i - oldSize - self.childrenList += [None] * newSize - self.noNulls = True - else: - self.noNulls = False - self.childrenList.insert(i, o); - if oldSize > i: - oldSize = i - except Exception: - self.childrenList.append(o) def add(self, name, o): self.childrenList.append(o) commit acee06b28e2991cf4b3a8935b9a754902367fa1c Author: Xisco Fauli <aniste...@gmail.com> Date: Sat Feb 2 22:47:51 2013 +0100 pyagenda: remove ConfigNode from makefile Change-Id: Icacd1addd9e43fb891b0d5cb3c20741380afbd51 diff --git a/wizards/Pyuno_commonwizards.mk b/wizards/Pyuno_commonwizards.mk index 0391df1d..143b913 100644 --- a/wizards/Pyuno_commonwizards.mk +++ b/wizards/Pyuno_commonwizards.mk @@ -35,7 +35,6 @@ $(eval $(call gb_Pyuno_add_files,wizards,\ common/FileAccess.py \ common/Properties.py \ common/Resource.py \ - common/ConfigNode.py \ common/DebugHelper.py \ common/NoValidPathException.py \ common/PropertyNames.py \ commit 57f01781c62d741e603d90010ea74c121131c9fd Author: Xisco Fauli <aniste...@gmail.com> Date: Sat Feb 2 22:46:11 2013 +0100 pyagenda: some duck typing here Change-Id: I6761962178473828039317a6826beaa242954c69 diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py b/wizards/com/sun/star/wizards/common/ConfigGroup.py index 225b2fc..bda4f96 100644 --- a/wizards/com/sun/star/wizards/common/ConfigGroup.py +++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py @@ -16,10 +16,9 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import inspect -from .ConfigNode import ConfigNode from .Configuration import Configuration -class ConfigGroup(ConfigNode): +class ConfigGroup(object): def writeConfiguration(self, configurationView, param): for name,data in inspect.getmembers(self): @@ -29,7 +28,7 @@ class ConfigGroup(ConfigNode): def writeField(self, field, configView, prefix): propertyName = field[len(prefix):] child = getattr(self, field) - if isinstance(child, ConfigNode): + if isinstance(child, ConfigGroup): child.writeConfiguration(configView.getByName(propertyName), prefix) else: @@ -43,7 +42,7 @@ class ConfigGroup(ConfigNode): def readField(self, field, configView, prefix): propertyName = field[len(prefix):] child = getattr(self, field) - if isinstance(child, ConfigNode): + if isinstance(child, ConfigGroup): child.readConfiguration(configView.getByName(propertyName), prefix) else: diff --git a/wizards/com/sun/star/wizards/common/ConfigNode.py b/wizards/com/sun/star/wizards/common/ConfigNode.py deleted file mode 100644 index efaeedb..0000000 --- a/wizards/com/sun/star/wizards/common/ConfigNode.py +++ /dev/null @@ -1,27 +0,0 @@ -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# -# This file incorporates work covered by the following license notice: -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed -# with this work for additional information regarding copyright -# ownership. The ASF licenses this file to you under the Apache -# License, Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.apache.org/licenses/LICENSE-2.0 . -# -from abc import ABCMeta, abstractmethod - -class ConfigNode(object): - @abstractmethod - def readConfiguration(self, configurationView, param): - pass - - @abstractmethod - def writeConfiguration(self, configurationView, param): - pass diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py index 0675e8d..aa02c6a 100644 --- a/wizards/com/sun/star/wizards/common/ConfigSet.py +++ b/wizards/com/sun/star/wizards/common/ConfigSet.py @@ -17,10 +17,10 @@ # import traceback import inspect -from .ConfigNode import ConfigNode +from .ConfigGroup import ConfigGroup from .Configuration import Configuration -class ConfigSet(ConfigNode): +class ConfigSet(ConfigGroup): ''' After reading the configuration set items, the ConfigSet checks this field. commit 98185094cf975dcc3fe4e6c234bea9b46b4e9482 Author: Xisco Fauli <aniste...@gmail.com> Date: Sat Feb 2 22:36:03 2013 +0100 pyagenda: load previous topics configuration when launching the wizard Change-Id: I771c3a86d00c55e82a96286fec0484283d28ff4c diff --git a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py index b3d8806..25ecf04 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaDocument.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaDocument.py @@ -836,13 +836,14 @@ class Topics(object): except Exception: traceback.print_exc() - '''@param topic the topic number to write - @param data the data of the topic. - @return the number of rows that have been added - to the table. 0 or a negative number: no rows added. + '''rewrites a single cell containing. + This is used in order to refresh the topic/responsible/duration data + in the preview document, in response to a change in the gui (by the user) + Since the structure of the topics table is flexible, + The Topics object, which analyzed the structure of the topics table appon + initialization, refreshes the approperiate cell. ''' - - def write(self, row, column, data): + def writeCell(self, row, column, data): # if the whole row should be written... if self.writtenTopics < row: self.writtenTopics += 1 @@ -863,21 +864,10 @@ class Topics(object): # move the cursor to the needed cell... cursor.goRight(column, False) - self.writeCell(cursor, column, data) - - '''rewrites a single cell containing. - This is used in order to refresh the topic/responsible/duration data - in the preview document, in response to a change in the gui (by the user) - Since the structure of the topics table is flexible, - The Topics object, which analyzed the structure of the topics table appon - initialization, refreshes the approperiate cell. - ''' - - def writeCell(self, cursor, column, data): xc = Topics.table.getCellByName(cursor.RangeName) # and write it ! te = TextElement(xc, data[column].Value) - te.write() + te.write() '''removes obsolete rows, reducing the topics table to the given number of topics. diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py index e40442b..1cf8489 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py @@ -72,13 +72,24 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): #Number of steps on WizardDialog self.nMaxStep = 6 - # initialize the agenda template self.agenda = CGAgenda() - + + # read configuration data before we initialize the topics + root = Configuration.getConfigurationRoot( + self.xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", + False) + self.agenda.readConfiguration(root, "cp_") + self.templateConsts = TemplateConsts + + # initialize the agenda template self.agendaTemplate = AgendaDocument( self.xMSF, self.agenda, self.resources, self.templateConsts, self) + self.initializeTemplates() + + self.agendaTemplate.load( + self.agendaTemplates[1][self.agenda.cp_AgendaType], []) # build the dialog. self.drawNaviBar() @@ -96,8 +107,6 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): #special Control for setting the save Path: self.insertPathSelectionControl() - self.initializeTemplates() - # synchronize GUI and CGAgenda object. self.initConfiguration() @@ -111,8 +120,6 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): # initialize roadmap self.insertRoadmap() - self.pageDesignChanged() - self.executeDialogFromComponent(self.agendaTemplate.xFrame) self.removeTerminateListener() self.closeDocument() @@ -150,11 +157,6 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): ''' def initConfiguration(self): - # read configuration data. - root = Configuration.getConfigurationRoot( - self.xMSF, "/org.openoffice.Office.Writer/Wizards/Agenda", False) - self.agenda.readConfiguration(root, "cp_") - self.xDialogModel.listPageDesign.StringItemList = \ tuple(self.agendaTemplates[0]) UnoDataAware.attachListBox( diff --git a/wizards/com/sun/star/wizards/agenda/CGAgenda.py b/wizards/com/sun/star/wizards/agenda/CGAgenda.py index 32d033e..a50dbd9 100644 --- a/wizards/com/sun/star/wizards/agenda/CGAgenda.py +++ b/wizards/com/sun/star/wizards/agenda/CGAgenda.py @@ -20,25 +20,27 @@ from ..common.ConfigSet import ConfigSet from .CGTopic import CGTopic class CGAgenda(ConfigGroup): - cp_AgendaType = int() - cp_IncludeMinutes = bool() - cp_Title = "" - cp_Date = str() - cp_Time = str() - cp_Location = "" - cp_ShowMeetingType = bool() - cp_ShowRead = bool() - cp_ShowBring = bool() - cp_ShowNotes = bool() - cp_ShowCalledBy = bool() - cp_ShowFacilitator = bool() - cp_ShowNotetaker = bool() - cp_ShowTimekeeper = bool() - cp_ShowAttendees = bool() - cp_ShowObservers = bool() - cp_ShowResourcePersons = bool() - cp_TemplateName = str() - cp_TemplatePath = str() - cp_ProceedMethod = int() - cp_Topics = ConfigSet(CGTopic()) + def __init__(self): + self.cp_AgendaType = int() + self.cp_IncludeMinutes = bool() + self.cp_Title = "" + self.cp_Date = str() + self.cp_Time = str() + self.cp_Location = "" + self.cp_ShowMeetingType = bool() + self.cp_ShowRead = bool() + self.cp_ShowBring = bool() + self.cp_ShowNotes = bool() + self.cp_ShowCalledBy = bool() + self.cp_ShowFacilitator = bool() + self.cp_ShowNotetaker = bool() + self.cp_ShowTimekeeper = bool() + self.cp_ShowAttendees = bool() + self.cp_ShowObservers = bool() + self.cp_ShowResourcePersons = bool() + self.cp_TemplateName = str() + self.cp_TemplatePath = str() + self.cp_ProceedMethod = int() + + self.cp_Topics = ConfigSet(CGTopic()) diff --git a/wizards/com/sun/star/wizards/agenda/CGTopic.py b/wizards/com/sun/star/wizards/agenda/CGTopic.py index 50ebc4d..240ad0e 100644 --- a/wizards/com/sun/star/wizards/agenda/CGTopic.py +++ b/wizards/com/sun/star/wizards/agenda/CGTopic.py @@ -27,11 +27,6 @@ and vice versa (setDataToRow method - used when loading the last session...) class CGTopic(ConfigGroup): - cp_Index = int() - cp_Topic = str() - cp_Responsible = str() - cp_Time = str() - ''' create a new CGTopic object with data from the given row. the row object is a PropertyValue array, as used @@ -41,12 +36,16 @@ class CGTopic(ConfigGroup): def __init__(self, row=None): if row is None: - return - num = row[0].Value - CGTopic.cp_Index = int(row[0].Value[:-1]) - CGTopic.cp_Topic = row[1].Value - CGTopic.cp_Responsible = row[2].Value - CGTopic.cp_Time = row[3].Value + self.cp_Index = int() + self.cp_Topic = str() + self.cp_Responsible = str() + self.cp_Time = str() + else: + num = row[0].Value + self.cp_Index = int(row[0].Value[:-1]) + self.cp_Topic = row[1].Value + self.cp_Responsible = row[2].Value + self.cp_Time = row[3].Value ''' copies the data in this CGTopic object @@ -56,7 +55,7 @@ class CGTopic(ConfigGroup): ''' def setDataToRow(self, row): - row[0].Value = "" + str(CGTopic.cp_Index) + "." - row[1].Value = CGTopic.cp_Topic - row[2].Value = CGTopic.cp_Responsible - row[3].Value = CGTopic.cp_Time + row[0].Value = "" + str(self.cp_Index) + "." + row[1].Value = self.cp_Topic + row[2].Value = self.cp_Responsible + row[3].Value = self.cp_Time diff --git a/wizards/com/sun/star/wizards/agenda/TopicsControl.py b/wizards/com/sun/star/wizards/agenda/TopicsControl.py index af962b8..8116b43 100644 --- a/wizards/com/sun/star/wizards/agenda/TopicsControl.py +++ b/wizards/com/sun/star/wizards/agenda/TopicsControl.py @@ -105,6 +105,7 @@ class TopicsControl(ControlScroller): try: super(TopicsControl, self).__init__( dialog, xmsf, 5, 92, 38, 212, 5, 18, HID + 32) + self.dialog = dialog self.initializeScrollFields(agenda) # set some focus listeners for TAB scroll down and up... # prepare scroll down on tab press... @@ -127,9 +128,9 @@ class TopicsControl(ControlScroller): def initializeScrollFields(self, agenda): # create a row for each topic with the given values.... - for i in range(agenda.cp_Topics.getSize()): + for i in range(len(agenda.cp_Topics.childrenList)): row = self.newRow(i) - agenda.cp_Topics.getElementAt(i).setDataToRow(row) + agenda.cp_Topics.childrenList[i].setDataToRow(row) # a parent class method self.registerControlGroup(row, i) self.updateDocumentRow(i) @@ -313,7 +314,7 @@ class TopicsControl(ControlScroller): @classmethod def newRow(self, i): - pv = [None] * 4 + pv = list(range(4)) pv[0] = Properties.createProperty( TopicsControl.LABEL + str(i), "" + str(i + 1) + ".") pv[1] = Properties.createProperty(TopicsControl.TOPIC + str(i), "") @@ -699,8 +700,9 @@ class TopicsControl(ControlScroller): if data is None: data = ControlScroller.scrollfields[row] try: - ControlScroller.CurUnoDialog.agendaTemplate.topics.write( - row, data) + for i in range(len(data)): + ControlScroller.CurUnoDialog.agendaTemplate.topics.writeCell( + row, i, data) except Exception: traceback.print_exc() @@ -716,7 +718,7 @@ class TopicsControl(ControlScroller): @classmethod def updateDocumentCell(self, row, column, data): try: - ControlScroller.CurUnoDialog.agendaTemplate.topics.write( + ControlScroller.CurUnoDialog.agendaTemplate.topics.writeCell( row, column, data) except Exception: traceback.print_exc() diff --git a/wizards/com/sun/star/wizards/common/ConfigGroup.py b/wizards/com/sun/star/wizards/common/ConfigGroup.py index ae15e85..225b2fc 100644 --- a/wizards/com/sun/star/wizards/common/ConfigGroup.py +++ b/wizards/com/sun/star/wizards/common/ConfigGroup.py @@ -44,7 +44,6 @@ class ConfigGroup(ConfigNode): propertyName = field[len(prefix):] child = getattr(self, field) if isinstance(child, ConfigNode): - child.root = self.root child.readConfiguration(configView.getByName(propertyName), prefix) else: diff --git a/wizards/com/sun/star/wizards/common/ConfigNode.py b/wizards/com/sun/star/wizards/common/ConfigNode.py index c2cd231..efaeedb 100644 --- a/wizards/com/sun/star/wizards/common/ConfigNode.py +++ b/wizards/com/sun/star/wizards/common/ConfigNode.py @@ -18,9 +18,6 @@ from abc import ABCMeta, abstractmethod class ConfigNode(object): - - root = None - @abstractmethod def readConfiguration(self, configurationView, param): pass diff --git a/wizards/com/sun/star/wizards/common/ConfigSet.py b/wizards/com/sun/star/wizards/common/ConfigSet.py index f9b3856..0675e8d 100644 --- a/wizards/com/sun/star/wizards/common/ConfigSet.py +++ b/wizards/com/sun/star/wizards/common/ConfigSet.py @@ -16,6 +16,7 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import traceback +import inspect from .ConfigNode import ConfigNode from .Configuration import Configuration @@ -29,13 +30,13 @@ class ConfigSet(ConfigNode): to avoid this "deletion" of nulls. ''' - def __init__(self, childType): - self.childClass = childType + def __init__(self, topic): + self.topic = topic self.childrenMap = {} self.childrenList = [] self.noNulls = False - def add(self, name, o): + def add2(self, name, o): self.childrenMap[name] = o if isinstance(name, int): i = name @@ -56,6 +57,9 @@ class ConfigSet(ConfigNode): except Exception: self.childrenList.append(o) + def add(self, name, o): + self.childrenList.append(o) + def writeConfiguration(self, configView, param): names = self.childrenMap.keys() if isinstance(self.childClass, ConfigNode): @@ -80,122 +84,15 @@ class ConfigSet(ConfigNode): raise AttributeError ( "Unable to write primitive sets to configuration (not implemented)") + def readConfiguration(self, configurationView, param): + #each iteration represents a Topic row names = configurationView.ElementNames - if isinstance(self.childClass, ConfigNode): - if names: - for i in names: - try: - child = type(self.childClass)() - child.root = self.root - child.readConfiguration( - configurationView.getByName(i), param) - self.add(i, child) - except Exception: - traceback.print_exc() - #remove any nulls from the list - if self.noNulls: - i = 0 - while i < len(self.childrenList): - if self.childrenList[i] is None: - del self.childrenList[i] - i -= 1 - i += 1 - - else: + if names: for i in names: try: - child = configurationView.getByName(i) - self.add(i, child) + self.topic.readConfiguration( + configurationView.getByName(i), param) + self.add(i, self.topic) except Exception: traceback.print_exc() - - def remove(self, obj): - key = getKey(obj) - self.childrenMap.remove(key) - i = self.childrenList.indexOf(obj) - self.childrenList.remove(obj) - fireListDataListenerIntervalRemoved(i, i) - - def remove(self, i): - o = getElementAt(i) - remove(o) - - def clear(self): - self.childrenMap.clear() - del self.childrenList[:] - - def createDOM(self, parent): - items = items() - i = 0 - while i < items.length: - item = items[i] - if item.instanceof.XMLProvider: - item.createDOM(parent) - - i += 1 - return parent - - def getKey(self, _object): - for k,v in self.childrenMap.items(): - if v == _object: - return k - - return None - - def getElementAt(self, i): - return self.childrenList[i] - - def getElement(self, o): - return self.childrenMap[o] - - def getSize(self): - return len(self.childrenList) - - def getIndexOf(self, item): - return self.childrenList.index(item) - - ''' - Set members might include a property - which orders them. - This method reindexes the given member to be - the index number 0 - Do not forget to call commit() after calling this method. - @param confView - @param memebrName - ''' - - def reindexSet(self, confView, memberName, indexPropertyName): - ''' - First I read all memebrs of the set, - except the one that should be number 0 - to a vector, ordered by there index property - ''' - names = Configuration.getChildrenNames(confView) - v = Vector.Vector_unknown(names.length) - member = None - index = 0 - i = 0 - while i < names.length: - if not names[i].equals(memberName): - member = Configuration.getConfigurationNode(names[i], confView) - index = Configuration.getInt(indexPropertyName, member) - while index >= v.size(): - v.add(None) - v.setElementAt(member, index) - ''' - Now I reindex them - ''' - - i += 1 - index = 1 - i = 0 - while i < v.size(): - member = v.get(i) - if member is not None: - Configuration.set((index + 1), indexPropertyName, member) - - i += 1 - - def sort(self, comparator): - self.childrenList.sort(comparator) commit 270a8259bf86ea5a338f57abd02d747756c0c43a Author: Xisco Fauli <aniste...@gmail.com> Date: Fri Feb 1 18:48:08 2013 +0100 pyagenda: Fix finish action Change-Id: I89b2b8b8a3f5988d6a53fe2a743fbf191e04ff58 diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py index 5d641c6..e40442b 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py @@ -16,6 +16,7 @@ # the License at http://www.apache.org/licenses/LICENSE-2.0 . # import traceback +import os.path from .AgendaWizardDialog import AgendaWizardDialog, uno from .AgendaWizardDialogConst import HID from .AgendaDocument import AgendaDocument @@ -330,24 +331,22 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): try: fileAccess = FileAccess(self.xMSF) self.sPath = self.myPathSelection.getSelectedPath() - if not self.sPath: + if not self.sPath or not os.path.exists(self.sPath): self.myPathSelection.triggerPathPicker() self.sPath = self.myPathSelection.getSelectedPath() - self.sPath = fileAccess.getURL(self.sPath) #first, if the filename was not changed, thus #it is coming from a saved session, check if the # file exists and warn the user. if not self.filenameChanged: - if fileAccess.exists(self.sPath, True): - answer = SystemDialog.showMessageBox( - self.xMSF, "MessBox", YES_NO + DEF_NO, - self.resources.resOverwriteWarning, - self.xUnoDialog.Peer) - if answer == 3: - # user said: no, do not overwrite - endWizard = False - return False + answer = SystemDialog.showMessageBox( + self.xMSF, "MessBox", YES_NO + DEF_NO, + self.resources.resOverwriteWarning, + self.xUnoDialog.Peer) + if answer == 3: + # user said: no, do not overwrite + endWizard = False + return False xDocProps = self.agendaTemplate.xTextDocument.DocumentProperties xDocProps.Title = self.txtTemplateName.Text @@ -363,7 +362,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): self.agendaTemplate.finish(self.topicsControl.scrollfields) - loadValues = range(2) + loadValues = list(range(2)) loadValues[0] = uno.createUnoStruct( \ 'com.sun.star.beans.PropertyValue') loadValues[0].Name = "AsTemplate" diff --git a/wizards/com/sun/star/wizards/text/TextSectionHandler.py b/wizards/com/sun/star/wizards/text/TextSectionHandler.py index 8896539..c9ec437 100644 --- a/wizards/com/sun/star/wizards/text/TextSectionHandler.py +++ b/wizards/com/sun/star/wizards/text/TextSectionHandler.py @@ -74,7 +74,7 @@ class TextSectionHandler(object): try: TextSectionCount = self.xTextDocument.TextSections.Count xAllTextSections = self.xTextDocument.TextSections - for i in xrange(TextSectionCount - 1, -1, -1): + for i in range(TextSectionCount - 1, -1, -1): xTextContentTextSection = xAllTextSections.getByIndex(i) self.xText.removeTextContent(xTextContentTextSection) except Exception: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits