Kaydet (Commit) ec20c94a authored tarafından Xisco Fauli's avatar Xisco Fauli

pyagenda: now it's possible to call the wizard remotely

Change-Id: I25c49f58e580a0d08a2b0d0fce9d76e372c69d19
üst 02dd4619
......@@ -16,12 +16,13 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
import uno
from TemplateConsts import *
from .TemplateConsts import *
from threading import RLock
from wizards.text.TextDocument import *
from wizards.common.FileAccess import FileAccess
from wizards.text.TextSectionHandler import TextSectionHandler
from TopicsControl import TopicsControl
from ..text.TextDocument import *
from ..common.FileAccess import FileAccess
from ..text.TextSectionHandler import TextSectionHandler
from .TopicsControl import TopicsControl
from datetime import date as dateTimeObject
from com.sun.star.text.PlaceholderType import TEXT
......
......@@ -17,64 +17,62 @@
#
from wizards.common.HelpIds import HelpIds
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"
CHKUSENOTES_ITEM_CHANGED = "chkUseNotesItemChanged"
CHKUSECALLEDBYNAME_ITEM_CHANGED = "chkUseCalledByItemChanged"
CHKUSEFACILITATOR_ITEM_CHANGED = "chkUseFacilitatorItemChanged"
CHKUSENOTETAKER_ITEM_CHANGED = "chkUseNoteTakerItemChanged"
CHKUSETIMEKEEPER_ITEM_CHANGED = "chkUseTimeKeeperItemChanged"
CHKUSEATTENDEES_ITEM_CHANGED = "chkUseAttendeesItemChanged"
CHKUSEOBSERVERS_ITEM_CHANGED = "chkUseObserversItemChanged"
CHKUSERESOURCEPERSONS_ITEM_CHANGED = "chkUseResourcePersonsItemChanged"
LISTPAGEDESIGN_ACTION_PERFORMED = "pageDesignChanged"
TXTTEMPLATENAME_TEXT_CHANGED = "templateTitleChanged"
BTNTEMPLATEPATH_ACTION_PERFORMED = "saveAs"
BTNINSERT_ACTION_PERFORMED = "insertRow"
BTNREMOVE_ACTION_PERFORMED = "removeRow"
BTNUP_ACTION_PERFORMED = "rowUp"
BTNDOWN_ACTION_PERFORMED = "rowDown"
INFO_IMAGE_URL = "private:resource/dbu/image/19205"
HID = 41051
LISTPAGEDESIGN_HID = HelpIds.getHelpIdString(HID + 6)
CHKMINUTES_HID = HelpIds.getHelpIdString(HID + 7)
TXTTIME_HID = HelpIds.getHelpIdString(HID + 8)
TXTDATE_HID = HelpIds.getHelpIdString(HID + 9)
TXTTITLE_HID = HelpIds.getHelpIdString(HID + 10)
CBLOCATION_HID = HelpIds.getHelpIdString(HID + 11)
class AgendaWizardDialogConst:
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"
CHKUSENOTES_ITEM_CHANGED = "chkUseNotesItemChanged"
CHKUSECALLEDBYNAME_ITEM_CHANGED = "chkUseCalledByItemChanged"
CHKUSEFACILITATOR_ITEM_CHANGED = "chkUseFacilitatorItemChanged"
CHKUSENOTETAKER_ITEM_CHANGED = "chkUseNoteTakerItemChanged"
CHKUSETIMEKEEPER_ITEM_CHANGED = "chkUseTimeKeeperItemChanged"
CHKUSEATTENDEES_ITEM_CHANGED = "chkUseAttendeesItemChanged"
CHKUSEOBSERVERS_ITEM_CHANGED = "chkUseObserversItemChanged"
CHKUSERESOURCEPERSONS_ITEM_CHANGED = "chkUseResourcePersonsItemChanged"
LISTPAGEDESIGN_ACTION_PERFORMED = "pageDesignChanged"
TXTTEMPLATENAME_TEXT_CHANGED = "templateTitleChanged"
BTNTEMPLATEPATH_ACTION_PERFORMED = "saveAs"
BTNINSERT_ACTION_PERFORMED = "insertRow"
BTNREMOVE_ACTION_PERFORMED = "removeRow"
BTNUP_ACTION_PERFORMED = "rowUp"
BTNDOWN_ACTION_PERFORMED = "rowDown"
CHKMEETINGTITLE_HID = HelpIds.getHelpIdString(HID + 12)
CHKREAD_HID = HelpIds.getHelpIdString(HID + 13)
CHKBRING_HID = HelpIds.getHelpIdString(HID + 14)
CHKNOTES_HID = HelpIds.getHelpIdString(HID + 15)
LISTPAGEDESIGN_HID = HelpIds.getHelpIdString(HID + 6)
CHKMINUTES_HID = HelpIds.getHelpIdString(HID + 7)
TXTTIME_HID = HelpIds.getHelpIdString(HID + 8)
TXTDATE_HID = HelpIds.getHelpIdString(HID + 9)
TXTTITLE_HID = HelpIds.getHelpIdString(HID + 10)
CBLOCATION_HID = HelpIds.getHelpIdString(HID + 11)
CHKCONVENEDBY_HID = HelpIds.getHelpIdString(HID + 16)
CHKPRESIDING_HID = HelpIds.getHelpIdString(HID + 17)
CHKNOTETAKER_HID = HelpIds.getHelpIdString(HID + 18)
CHKTIMEKEEPER_HID = HelpIds.getHelpIdString(HID + 19)
CHKATTENDEES_HID = HelpIds.getHelpIdString(HID + 20)
CHKOBSERVERS_HID = HelpIds.getHelpIdString(HID + 21)
CHKRESOURCEPERSONS_HID = HelpIds.getHelpIdString(HID + 22)
CHKMEETINGTITLE_HID = HelpIds.getHelpIdString(HID + 12)
CHKREAD_HID = HelpIds.getHelpIdString(HID + 13)
CHKBRING_HID = HelpIds.getHelpIdString(HID + 14)
CHKNOTES_HID = HelpIds.getHelpIdString(HID + 15)
TXTTEMPLATENAME_HID = HelpIds.getHelpIdString(HID + 23)
TXTTEMPLATEPATH_HID = HelpIds.getHelpIdString(HID + 24)
BTNTEMPLATEPATH_HID = HelpIds.getHelpIdString(HID + 25)
CHKCONVENEDBY_HID = HelpIds.getHelpIdString(HID + 16)
CHKPRESIDING_HID = HelpIds.getHelpIdString(HID + 17)
CHKNOTETAKER_HID = HelpIds.getHelpIdString(HID + 18)
CHKTIMEKEEPER_HID = HelpIds.getHelpIdString(HID + 19)
CHKATTENDEES_HID = HelpIds.getHelpIdString(HID + 20)
CHKOBSERVERS_HID = HelpIds.getHelpIdString(HID + 21)
CHKRESOURCEPERSONS_HID = HelpIds.getHelpIdString(HID + 22)
OPTCREATEAGENDA_HID = HelpIds.getHelpIdString(HID + 26)
OPTMAKECHANGES_HID = HelpIds.getHelpIdString(HID + 27)
TXTTEMPLATENAME_HID = HelpIds.getHelpIdString(HID + 23)
TXTTEMPLATEPATH_HID = HelpIds.getHelpIdString(HID + 24)
BTNTEMPLATEPATH_HID = HelpIds.getHelpIdString(HID + 25)
BTNINSERT_HID = HelpIds.getHelpIdString(HID + 28)
BTNREMOVE_HID = HelpIds.getHelpIdString(HID + 29)
BTNUP_HID = HelpIds.getHelpIdString(HID + 30)
BTNDOWN_HID = HelpIds.getHelpIdString(HID + 31)
OPTCREATEAGENDA_HID = HelpIds.getHelpIdString(HID + 26)
OPTMAKECHANGES_HID = HelpIds.getHelpIdString(HID + 27)
LAST_HID = HID + 32
BTNINSERT_HID = HelpIds.getHelpIdString(HID + 28)
BTNREMOVE_HID = HelpIds.getHelpIdString(HID + 29)
BTNUP_HID = HelpIds.getHelpIdString(HID + 30)
BTNDOWN_HID = HelpIds.getHelpIdString(HID + 31)
......@@ -15,14 +15,19 @@
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
from AgendaWizardDialog import *
from AgendaTemplate import *
import traceback
from .AgendaWizardDialog import AgendaWizardDialog
from .AgendaWizardDialogConst import HID
from .AgendaTemplate import AgendaTemplate, TopicsControl, FileAccess
from CGAgenda import CGAgenda
from wizards.ui.PathSelection import PathSelection
from wizards.ui.event.UnoDataAware import UnoDataAware
from wizards.ui.event.RadioDataAware import RadioDataAware
from wizards.common.NoValidPathException import NoValidPathException
from wizards.common.SystemDialog import SystemDialog
from ..ui.PathSelection import PathSelection
from ..ui.event.UnoDataAware import UnoDataAware
from ..ui.event.RadioDataAware import RadioDataAware
from ..common.NoValidPathException import NoValidPathException
from ..common.SystemDialog import SystemDialog
from ..common.Desktop import Desktop
from ..common.HelpIds import HelpIds
from ..common.Configuration import Configuration
from com.sun.star.view.DocumentZoomType import OPTIMAL
from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO
......@@ -43,31 +48,20 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
def leaveStep(self, OldStep, NewStep):
pass
'''
used in developement to start the wizard
'''
@classmethod
def main(self, args):
ConnectStr = \
"uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
def main(self):
#Call the wizard remotely(see README)
try:
ConnectStr = \
"uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
xLocMSF = Desktop.connect(ConnectStr)
wizard = AgendaWizardDialogImpl(xLocMSF)
wizard.startWizard()
except Exception, exception:
traceback.print_exc()
'''
read the configuration data, open the specified template,
initialize the template controller (AgendaTemplate) and
set the status of the displayed template to the one
read from the configuration.
build the dialog.
Synchronize the dialog to the same status (read from
the configuration).
show the dialog.
'''
lw = AgendaWizardDialogImpl(xLocMSF)
lw.startWizard()
except Exception as e:
print ("Wizard failure exception " + str(type(e)) +
" message " + str(e) + " args " + str(e.args) +
traceback.format_exc())
def startWizard(self):
self.running = True
......@@ -134,8 +128,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
self.myPathSelection.sDefaultDirectory = self.sUserTemplatePath
self.myPathSelection.sDefaultName = "myAgendaTemplate.ott"
self.myPathSelection.sDefaultFilter = "writer8_template"
self.myPathSelection.addSelectionListener(
self.myPathSelectionListener())
self.myPathSelection.addSelectionListener(self)
def initializePaths(self):
try:
......@@ -173,7 +166,8 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
self.agenda.readConfiguration(root, "cp_")
self.setControlProperty(
"listPageDesign", "StringItemList", tuple(self.agendaTemplates[0]))
"listPageDesign", "StringItemList",
tuple(self.agendaTemplates.keys()))
self.checkSavePath()
UnoDataAware.attachListBox(
self.agenda, "cp_AgendaType", self.listPageDesign, True).updateUI()
......@@ -271,7 +265,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
if AgendaWizardDialogImpl.pageDesign is not SelectedItemPos:
AgendaWizardDialogImpl.pageDesign = SelectedItemPos
self.agendaTemplate.load(
self.agendaTemplates[1][SelectedItemPos],
self.agendaTemplates.values()[SelectedItemPos],
self.topicsControl.scrollfields)
except Exception:
traceback.print_exc()
......@@ -422,7 +416,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
if fileAccess.exists(self.sPath, True):
answer = SystemDialog.showMessageBox(
self.xMSF, "MessBox", YES_NO + DEF_NO,
self.resources.resFileExists,
self.resources.resOverwriteWarning,
self.xUnoDialog.Peer)
if answer == 3:
# user said: no, do not overwrite
......
......@@ -166,5 +166,5 @@ class AgendaWizardDialogResources(Resource):
self.resButtonDown = self.getResText(
AgendaWizardDialogResources.RID_AGENDAWIZARDDIALOG_START + 71)
self.resFileExists = self.getResText(
self.resOverwriteWarning = self.getResText(
AgendaWizardDialogResources.RID_COMMON_START + 19)
......@@ -16,11 +16,12 @@
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
from threading import RLock
from CGTopic import CGTopic
from wizards.ui.ControlScroller import *
from AgendaWizardDialogConst import LAST_HID
from wizards.common.Properties import Properties
from wizards.ui.event.CommonListener import FocusListenerProcAdapter, KeyListenerProcAdapter
from .CGTopic import CGTopic
from ..ui.ControlScroller import *
from .AgendaWizardDialogConst import HID
from ..common.Properties import Properties
from ..ui.event.CommonListener import FocusListenerProcAdapter, \
KeyListenerProcAdapter
from com.sun.star.awt.Key import DOWN, UP, TAB
from com.sun.star.awt.KeyModifier import SHIFT, MOD1
......@@ -115,7 +116,7 @@ class TopicsControl(ControlScroller):
def __init__(self, dialog, xmsf, agenda):
try:
super(TopicsControl, self).__init__(
dialog, xmsf, 5, 92, 38, 212, 5, 18, LAST_HID)
dialog, xmsf, 5, 92, 38, 212, 5, 18, HID + 32)
self.initializeScrollFields(agenda)
# set some focus listeners for TAB scroll down and up...
# prepare scroll down on tab press...
......
......@@ -307,7 +307,7 @@ class FileAccess(object):
return False
@classmethod
def getFolderTitles(self, xMSF, FilterName, FolderName, resDict):
def getFolderTitles(self, xMSF, FilterName, FolderName, resDict=None):
#Returns and ordered dict containing the template's name and path
LocLayoutFiles = {}
......@@ -326,11 +326,14 @@ class FileAccess(object):
fileName = self.getFilename(i)
if FilterName is None or fileName.startswith(FilterName):
xDocInterface.loadFromMedium(i, tuple())
if xDocInterface.Title in resDict:
# localise string at runtime
title = resDict[xDocInterface.Title]
else:
if resDict is None:
title = xDocInterface.Title
else:
if xDocInterface.Title in resDict:
# localise string at runtime
title = resDict[xDocInterface.Title]
else:
title = xDocInterface.Title
LocLayoutFiles[title] = i
except Exception, exception:
......
......@@ -20,7 +20,8 @@ from .UIConsts import UIConsts
from ..common.Desktop import Desktop
from ..common.PropertyNames import PropertyNames
from .event.CommonListener import ItemListenerProcAdapter, \
ActionListenerProcAdapter, TextListenerProcAdapter
ActionListenerProcAdapter, TextListenerProcAdapter, \
AdjustmentListenerProcAdapter
'''
This class contains convenience methods for inserting components to a dialog.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment