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