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

pywizards: remove unused code

Change-Id: I174ec6a1d307486d38ba4b98a5a158259c57151d
üst d9809c68
...@@ -13,6 +13,6 @@ To call a wizard remotely you need to: ...@@ -13,6 +13,6 @@ To call a wizard remotely you need to:
soffice --"accept=socket,host=localhost,port=2002;urp;" soffice --"accept=socket,host=localhost,port=2002;urp;"
-> Launch the wizard from wizards parent folder: -> Launch the wizard from wizards parent folder:
python python3.3
from wizards.[Wizard's folder].CallWizard import CallWizard from wizards.[Wizard's folder].CallWizard import CallWizard
CallWizard.callRemote() CallWizard.callRemote()
...@@ -41,11 +41,10 @@ from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO ...@@ -41,11 +41,10 @@ from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO
class AgendaWizardDialogImpl(AgendaWizardDialog): class AgendaWizardDialogImpl(AgendaWizardDialog):
pageDesign = None
def __init__(self, xmsf): def __init__(self, xmsf):
super(AgendaWizardDialogImpl, self).__init__(xmsf) super(AgendaWizardDialogImpl, self).__init__(xmsf)
self.filenameChanged = False self.filenameChanged = False
self.pageDesign = -1
def enterStep(self, OldStep, NewStep): def enterStep(self, OldStep, NewStep):
pass pass
...@@ -141,6 +140,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): ...@@ -141,6 +140,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
tuple(self.agendaTemplates[0]) tuple(self.agendaTemplates[0])
UnoDataAware.attachListBox( UnoDataAware.attachListBox(
self.agenda, "cp_AgendaType", self.listPageDesign, True).updateUI() self.agenda, "cp_AgendaType", self.listPageDesign, True).updateUI()
self.pageDesign = self.agenda.cp_AgendaType
UnoDataAware.attachCheckBox( UnoDataAware.attachCheckBox(
self.agenda, "cp_IncludeMinutes", self.chkMinutes, True).updateUI() self.agenda, "cp_IncludeMinutes", self.chkMinutes, True).updateUI()
UnoDataAware.attachEditControl( UnoDataAware.attachEditControl(
...@@ -187,7 +187,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): ...@@ -187,7 +187,7 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
RadioDataAware.attachRadioButtons( RadioDataAware.attachRadioButtons(
self.agenda, "cp_ProceedMethod", self.agenda, "cp_ProceedMethod",
(self.optCreateAgenda, self.optMakeChanges), True).updateUI() (self.optCreateAgenda, self.optMakeChanges), True).updateUI()
def insertRoadmap(self): def insertRoadmap(self):
self.addRoadmap() self.addRoadmap()
...@@ -223,8 +223,8 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): ...@@ -223,8 +223,8 @@ class AgendaWizardDialogImpl(AgendaWizardDialog):
try: try:
SelectedItemPos = self.listPageDesign.SelectedItemPos SelectedItemPos = self.listPageDesign.SelectedItemPos
#avoid to load the same item again #avoid to load the same item again
if AgendaWizardDialogImpl.pageDesign is not SelectedItemPos: if self.pageDesign is not SelectedItemPos:
AgendaWizardDialogImpl.pageDesign = SelectedItemPos self.pageDesign = SelectedItemPos
self.myAgendaDoc.load( self.myAgendaDoc.load(
self.agendaTemplates[1][SelectedItemPos]) self.agendaTemplates[1][SelectedItemPos])
self.drawConstants() self.drawConstants()
......
...@@ -44,11 +44,6 @@ class Desktop(object): ...@@ -44,11 +44,6 @@ class Desktop(object):
xDesktop = self.getDesktop(xMSF) xDesktop = self.getDesktop(xMSF)
return xDesktop.getActiveFrame() return xDesktop.getActiveFrame()
@classmethod
def getActiveComponent(self, _xMSF):
xFrame = self.getActiveFrame(_xMSF)
return xFrame.getController().getModel()
@classmethod @classmethod
def getDispatcher(self, xMSF, xFrame, _stargetframe, oURL): def getDispatcher(self, xMSF, xFrame, _stargetframe, oURL):
try: try:
......
...@@ -50,12 +50,10 @@ class Resource(object): ...@@ -50,12 +50,10 @@ class Resource(object):
def getResArray(self, nID, iCount): def getResArray(self, nID, iCount):
try: try:
ResArray = list(range(iCount)) resArray = []
i = 0 for i in range(iCount):
while i < iCount: resArray.append(self.getResText(nID + i))
ResArray[i] = getResText(nID + i) return resArray
i += 1
return ResArray
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
raise ValueError("Resource with ID not" + str(nID) + " not found") raise ValueError("Resource with ID not" + str(nID) + " not found")
......
...@@ -48,11 +48,8 @@ class FaxWizardDialogImpl(FaxWizardDialog): ...@@ -48,11 +48,8 @@ class FaxWizardDialogImpl(FaxWizardDialog):
def enterStep(self, nOldStep, nNewStep): def enterStep(self, nOldStep, nNewStep):
pass pass
RM_TYPESTYLE = 1
RM_ELEMENTS = 2
RM_SENDERRECEIVER = 3 RM_SENDERRECEIVER = 3
RM_FOOTER = 4 RM_FOOTER = 4
RM_FINALSETTINGS = 5
def __init__(self, xmsf): def __init__(self, xmsf):
super(FaxWizardDialogImpl, self).__init__(xmsf) super(FaxWizardDialogImpl, self).__init__(xmsf)
......
...@@ -43,10 +43,8 @@ class LetterWizardDialogImpl(LetterWizardDialog): ...@@ -43,10 +43,8 @@ class LetterWizardDialogImpl(LetterWizardDialog):
RM_TYPESTYLE = 1 RM_TYPESTYLE = 1
RM_BUSINESSPAPER = 2 RM_BUSINESSPAPER = 2
RM_ELEMENTS = 3
RM_SENDERRECEIVER = 4 RM_SENDERRECEIVER = 4
RM_FOOTER = 5 RM_FOOTER = 5
RM_FINALSETTINGS = 6
def enterStep(self, OldStep, NewStep): def enterStep(self, OldStep, NewStep):
pass pass
......
# #
#
# This file is part of the LibreOffice project. # This file is part of the LibreOffice project.
# #
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
...@@ -321,10 +322,7 @@ class UnoDialog(object): ...@@ -321,10 +322,7 @@ class UnoDialog(object):
return "SelectedItems" return "SelectedItems"
else: else:
return "" return ""
def addResourceHandler(self, _Unit, _Module):
self.m_oResource = Resource(self.xMSF, _Unit, _Module)
def isHighContrastModeActivated(self): def isHighContrastModeActivated(self):
if (self.xVclWindowPeer is not None): if (self.xVclWindowPeer is not None):
if (self.BisHighContrastModeActivated is None): if (self.BisHighContrastModeActivated is None):
......
...@@ -26,6 +26,7 @@ from ..common.HelpIds import HelpIds ...@@ -26,6 +26,7 @@ from ..common.HelpIds import HelpIds
from com.sun.star.lang import NoSuchMethodException from com.sun.star.lang import NoSuchMethodException
from com.sun.star.frame import TerminationVetoException from com.sun.star.frame import TerminationVetoException
from com.sun.star.awt.PushButtonType import HELP, STANDARD from com.sun.star.awt.PushButtonType import HELP, STANDARD
from com.sun.star.awt.FontWeight import BOLD
class WizardDialog(UnoDialog2): class WizardDialog(UnoDialog2):
...@@ -53,12 +54,12 @@ class WizardDialog(UnoDialog2): ...@@ -53,12 +54,12 @@ class WizardDialog(UnoDialog2):
def __init__(self, xMSF, hid_): def __init__(self, xMSF, hid_):
super(WizardDialog,self).__init__(xMSF) super(WizardDialog,self).__init__(xMSF)
self.__hid = hid_ self.__hid = hid_
self.__iButtonWidth = 50 self.iButtonWidth = 50
self.nNewStep = 1 self.nNewStep = 1
self.nOldStep = 1 self.nOldStep = 1
self.nMaxStep = 1 self.nMaxStep = 1
self.__bTerminateListenermustberemoved = True self.bTerminateListenermustberemoved = True
self.__oWizardResource = Resource(xMSF, "dbw") self.oWizardResource = Resource(xMSF, "dbw")
self.oRoadmap = None self.oRoadmap = None
self.terminateListener = None self.terminateListener = None
...@@ -138,16 +139,12 @@ class WizardDialog(UnoDialog2): ...@@ -138,16 +139,12 @@ class WizardDialog(UnoDialog2):
ItemListenerProcAdapter(method)) ItemListenerProcAdapter(method))
self.oRoadmap.Text = \ self.oRoadmap.Text = \
self.__oWizardResource.getResText(UIConsts.RID_COMMON + 16) self.oWizardResource.getResText(UIConsts.RID_COMMON + 16)
except NoSuchMethodException: except NoSuchMethodException:
Resource.showCommonResourceError(xMSF) Resource.showCommonResourceError(xMSF)
except Exception: except Exception:
traceback.print_exc() traceback.print_exc()
def setRMItemLabels(self, _oResource, StartResID):
self.sRMItemLabels = _oResource.getResArray(
StartResID, self.nMaxStep)
def insertRoadmapItem(self, Index, _bEnabled, _sLabel, _CurItemID): def insertRoadmapItem(self, Index, _bEnabled, _sLabel, _CurItemID):
try: try:
if isinstance(_sLabel, int): if isinstance(_sLabel, int):
...@@ -211,17 +208,17 @@ class WizardDialog(UnoDialog2): ...@@ -211,17 +208,17 @@ class WizardDialog(UnoDialog2):
def drawNaviBar(self): def drawNaviBar(self):
try: try:
curtabindex = UIConsts.SOFIRSTWIZARDNAVITABINDEX curtabindex = UIConsts.SOFIRSTWIZARDNAVITABINDEX
iButtonWidth = self.__iButtonWidth iButtonWidth = self.iButtonWidth
iButtonHeight = 14 iButtonHeight = 14
iCurStep = 0 iCurStep = 0
iDialogHeight = self.xDialogModel.Height iDialogHeight = self.xDialogModel.Height
iDialogWidth = self.xDialogModel.Width iDialogWidth = self.xDialogModel.Width
iHelpPosX = 8 iHelpPosX = 8
iBtnPosY = iDialogHeight - iButtonHeight - 6 iBtnPosY = iDialogHeight - iButtonHeight - 6
iCancelPosX = iDialogWidth - self.__iButtonWidth - 6 iCancelPosX = iDialogWidth - self.iButtonWidth - 6
iFinishPosX = iCancelPosX - 6 - self.__iButtonWidth iFinishPosX = iCancelPosX - 6 - self.iButtonWidth
iNextPosX = iFinishPosX - 6 - self.__iButtonWidth iNextPosX = iFinishPosX - 6 - self.iButtonWidth
iBackPosX = iNextPosX - 3 - self.__iButtonWidth iBackPosX = iNextPosX - 3 - self.iButtonWidth
self.insertControlModel( self.insertControlModel(
"com.sun.star.awt.UnoControlFixedLineModel", "com.sun.star.awt.UnoControlFixedLineModel",
"lnNaviSep", "lnNaviSep",
...@@ -264,26 +261,26 @@ class WizardDialog(UnoDialog2): ...@@ -264,26 +261,26 @@ class WizardDialog(UnoDialog2):
PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TABINDEX,
PropertyNames.PROPERTY_WIDTH), PropertyNames.PROPERTY_WIDTH),
(True, iButtonHeight, (True, iButtonHeight,
self.__oWizardResource.getResText(UIConsts.RID_COMMON + 15), self.oWizardResource.getResText(UIConsts.RID_COMMON + 15),
iHelpPosX, iBtnPosY, iHelpPosX, iBtnPosY,
uno.Any("short",HELP), iCurStep, uno.Any("short",HELP), iCurStep,
uno.Any("short",(curtabindex + 1)), iButtonWidth), self) uno.Any("short",(curtabindex + 1)), iButtonWidth), self)
self.insertButton("btnWizardBack", self.insertButton("btnWizardBack",
WizardDialog.__BACK_ACTION_PERFORMED, propNames, WizardDialog.__BACK_ACTION_PERFORMED, propNames,
(False, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 2), (False, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 2),
self.__oWizardResource.getResText(UIConsts.RID_COMMON + 13), self.oWizardResource.getResText(UIConsts.RID_COMMON + 13),
iBackPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, iBackPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep,
uno.Any("short",(curtabindex + 1)), iButtonWidth), self) uno.Any("short",(curtabindex + 1)), iButtonWidth), self)
self.insertButton("btnWizardNext", self.insertButton("btnWizardNext",
WizardDialog.__NEXT_ACTION_PERFORMED, propNames, WizardDialog.__NEXT_ACTION_PERFORMED, propNames,
(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 3), (True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 3),
self.__oWizardResource.getResText(UIConsts.RID_COMMON + 14), self.oWizardResource.getResText(UIConsts.RID_COMMON + 14),
iNextPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, iNextPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep,
uno.Any("short",(curtabindex + 1)), iButtonWidth), self) uno.Any("short",(curtabindex + 1)), iButtonWidth), self)
self.insertButton("btnWizardFinish", self.insertButton("btnWizardFinish",
WizardDialog.__FINISH_ACTION_PERFORMED, propNames, WizardDialog.__FINISH_ACTION_PERFORMED, propNames,
(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 4), (True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 4),
self.__oWizardResource.getResText(UIConsts.RID_COMMON + 12), self.oWizardResource.getResText(UIConsts.RID_COMMON + 12),
iFinishPosX, iBtnPosY, uno.Any("short",STANDARD), iFinishPosX, iBtnPosY, uno.Any("short",STANDARD),
iCurStep, iCurStep,
uno.Any("short",(curtabindex + 1)), uno.Any("short",(curtabindex + 1)),
...@@ -291,7 +288,7 @@ class WizardDialog(UnoDialog2): ...@@ -291,7 +288,7 @@ class WizardDialog(UnoDialog2):
self.insertButton("btnWizardCancel", self.insertButton("btnWizardCancel",
WizardDialog.__CANCEL_ACTION_PERFORMED, propNames, WizardDialog.__CANCEL_ACTION_PERFORMED, propNames,
(True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 5), (True, iButtonHeight, HelpIds.getHelpIdString(self.__hid + 5),
self.__oWizardResource.getResText(UIConsts.RID_COMMON + 11), self.oWizardResource.getResText(UIConsts.RID_COMMON + 11),
iCancelPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep, iCancelPosX, iBtnPosY, uno.Any("short",STANDARD), iCurStep,
uno.Any("short",(curtabindex + 1)), uno.Any("short",(curtabindex + 1)),
iButtonWidth), self) iButtonWidth), self)
...@@ -418,18 +415,14 @@ class WizardDialog(UnoDialog2): ...@@ -418,18 +415,14 @@ class WizardDialog(UnoDialog2):
self.nNewStep = _nNewstep self.nNewStep = _nNewstep
changeToStep(self.nNewStep) changeToStep(self.nNewStep)
def setRightPaneHeaders(self, _oResource, StartResID, _nMaxStep):
self.sRightPaneHeaders = _oResource.getResArray(StartResID, _nMaxStep)
setRightPaneHeaders(self.sRightPaneHeaders)
def setRightPaneHeaders(self, _sRightPaneHeaders): def setRightPaneHeaders(self, _sRightPaneHeaders):
self.nMaxStep = _sRightPaneHeaders.length self.nMaxStep = len(_sRightPaneHeaders)
self.sRightPaneHeaders = _sRightPaneHeaders self.sRightPaneHeaders = _sRightPaneHeaders
oFontDesc = FontDescriptor.FontDescriptor() oFontDesc = uno.createUnoStruct('com.sun.star.awt.FontDescriptor')
oFontDesc.Weight = com.sun.star.awt.FontWeight.BOLD oFontDesc.Weight = BOLD
i = 0 for i in range(self.nMaxStep):
while i < self.sRightPaneHeaders.length: self.insertLabel("lblQueryTitle" + str(i),
insertLabel("lblQueryTitle" + String.valueOf(i),("FontDescriptor", ("FontDescriptor",
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HEIGHT,
PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_LABEL,
PropertyNames.PROPERTY_MULTILINE, PropertyNames.PROPERTY_MULTILINE,
...@@ -438,18 +431,17 @@ class WizardDialog(UnoDialog2): ...@@ -438,18 +431,17 @@ class WizardDialog(UnoDialog2):
PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_STEP,
PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_TABINDEX,
PropertyNames.PROPERTY_WIDTH),( PropertyNames.PROPERTY_WIDTH),(
oFontDesc, 16, self.sRightPaneHeaders(i), oFontDesc, 16, _sRightPaneHeaders[i],
True, 91, 8, i + 1, 12, 212)) True, 91, 8, i + 1, 12, 212))
i += 1
def cancelWizard(self): def cancelWizard(self):
#can be overwritten by extending class #can be overwritten by extending class
self.xUnoDialog.endExecute() self.xUnoDialog.endExecute()
def removeTerminateListener(self): def removeTerminateListener(self):
if self.__bTerminateListenermustberemoved: if self.bTerminateListenermustberemoved:
Desktop.getDesktop(self.xMSF).removeTerminateListener(self.terminateListener) Desktop.getDesktop(self.xMSF).removeTerminateListener(self.terminateListener)
self.__bTerminateListenermustberemoved = False self.bTerminateListenermustberemoved = False
''' '''
called by the cancel button and called by the cancel button and
......
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