diff options
author | Xisco Fauli <anistenis@gmail.com> | 2011-07-26 13:26:03 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-08-18 02:57:43 +0200 |
commit | 316490a12920855fd89465a0c185cfba5c8a5301 (patch) | |
tree | 322ff0d41678e72a836ed586837687d207ee598e /wizards/com | |
parent | f601dd95dcab2314977c2c756823f56d01ad93ce (diff) |
Add checkbox listener
Diffstat (limited to 'wizards/com')
6 files changed, 132 insertions, 91 deletions
diff --git a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py index a0f7ff7b3a25..e810c6c47970 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaTemplate.py @@ -1,13 +1,13 @@ -from text.TextDocument import * import uno from TemplateConsts import * +from threading import RLock +from text.TextDocument import * from common.FileAccess import FileAccess -from common.Helper import Helper -from com.sun.star.i18n.NumberFormatIndex import TIME_HHMM, DATE_SYSTEM_LONG from text.TextSectionHandler import TextSectionHandler -from com.sun.star.text.PlaceholderType import TEXT from TopicsControl import TopicsControl -from threading import RLock + +from com.sun.star.text.PlaceholderType import TEXT +from com.sun.star.i18n.NumberFormatIndex import TIME_HHMM, DATE_SYSTEM_LONG def synchronized(lock): ''' Synchronization decorator. ''' @@ -145,15 +145,18 @@ class AgendaTemplate(TextDocument): @param itemName ''' + @classmethod @synchronized(lock) def redraw(self, itemName): + AgendaTemplate.xTextDocument.lockControllers() try: # get the table in which the item is... - itemsTable = AgendaTemplate.itemsMap.get(itemName) + itemsTable = AgendaTemplate.itemsMap[itemName] # rewrite the table. itemsTable.write(None) except Exception, e: traceback.print_exc() + AgendaTemplate.xTextDocument.unlockControllers() '''update the documents title property to the given title @param newTitle title. diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py index 3e3c30f523a2..6d19ebb48a0b 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialog.py @@ -1,7 +1,8 @@ from ui.WizardDialog import * -from com.sun.star.awt.FontUnderline import SINGLE from AgendaWizardDialogConst import * -from AgendaWizardDialogResources import * +from AgendaWizardDialogResources import AgendaWizardDialogResources + +from com.sun.star.awt.FontUnderline import SINGLE class AgendaWizardDialog(WizardDialog): @@ -179,19 +180,19 @@ class AgendaWizardDialog(WizardDialog): (self.fontDescriptor4, 16, self.resources.reslblTitle3_value, True, 91, 8, 3, 300,212)) self.chkMeetingTitle = self.insertCheckBox("chkMeetingTitle", - None, self.PROPS_CHECK, + CHKUSEMEETINGTYPE_ITEM_CHANGED, self.PROPS_CHECK, (8, CHKMEETINGTITLE_HID, self.resources.reschkMeetingTitle_value, 97, 32, 1, 3, 301, 69), self) self.chkRead = self.insertCheckBox("chkRead", - None, self.PROPS_CHECK, + CHKUSEREAD_ITEM_CHANGED, self.PROPS_CHECK, (8, CHKREAD_HID, self.resources.reschkRead_value, 97, 46, 0, 3, 302, 162), self) self.chkBring = self.insertCheckBox("chkBring", - None, self.PROPS_CHECK, + CHKUSEBRING_ITEM_CHANGED, self.PROPS_CHECK, (8, CHKBRING_HID, self.resources.reschkBring_value, 97, 60, 0, 3, 303, 162), self) self.chkNotes = self.insertCheckBox("chkNotes", - None, self.PROPS_CHECK, + CHKUSENOTES_ITEM_CHANGED, self.PROPS_CHECK, (8, CHKNOTES_HID, self.resources.reschkNotes_value, 97, 74, 1, 3, 304, 160), self) self.insertImage("imgHelp3", self.PROPS_IMAGE, (0, 10, @@ -204,33 +205,39 @@ class AgendaWizardDialog(WizardDialog): self.insertLabel("lblTitle5", self.PROPS_LABEL_B, (self.fontDescriptor4, 16, self.resources.reslblTitle5_value, True, 91, 8, 4, 400, 212)) - self.chkConvenedBy = self.insertCheckBox("chkConvenedBy", None, - self.PROPS_CHECK, (8, CHKCONVENEDBY_HID, - self.resources.reschkConvenedBy_value, 97, 32, 1, 4, 401, 150), self) - self.chkPresiding = self.insertCheckBox("chkPresiding", None, - self.PROPS_CHECK, (8, CHKPRESIDING_HID, - self.resources.reschkPresiding_value, 97, 46, 0, 4, 402, 150), self) - self.chkNoteTaker = self.insertCheckBox("chkNoteTaker", None, - self.PROPS_CHECK, (8, CHKNOTETAKER_HID, - self.resources.reschkNoteTaker_value, 97, 60, 0, 4, 403, 150), self) - self.chkTimekeeper = self.insertCheckBox("chkTimekeeper", None, - self.PROPS_CHECK, (8, CHKTIMEKEEPER_HID, - self.resources.reschkTimekeeper_value, 97, 74, 0, 4, 404, 150), self) - self.chkAttendees = self.insertCheckBox("chkAttendees", None, - self.PROPS_CHECK, (8, CHKATTENDEES_HID, - self.resources.reschkAttendees_value, 97, 88, 1, 4, 405, 150), self) - self.chkObservers = self.insertCheckBox("chkObservers", None, - self.PROPS_CHECK, (8, CHKOBSERVERS_HID, - self.resources.reschkObservers_value, 97, 102, 0, 4, 406, 150), self) - self.chkResourcePersons = self.insertCheckBox("chkResourcePersons", None, - self.PROPS_CHECK, (8, CHKRESOURCEPERSONS_HID, - self.resources.reschkResourcePersons_value, 97, 116, 0, - 4, 407, 150), self) + self.chkConvenedBy = self.insertCheckBox("chkConvenedBy", + CHKUSECALLEDBYNAME_ITEM_CHANGED, self.PROPS_CHECK, + (8, CHKCONVENEDBY_HID, self.resources.reschkConvenedBy_value, + 97, 32, 1, 4, 401, 150), self) + self.chkPresiding = self.insertCheckBox("chkPresiding", + CHKUSEFACILITATOR_ITEM_CHANGED, self.PROPS_CHECK, + (8, CHKPRESIDING_HID, self.resources.reschkPresiding_value, + 97, 46, 0, 4, 402, 150), self) + self.chkNoteTaker = self.insertCheckBox("chkNoteTaker", + CHKUSENOTETAKER_ITEM_CHANGED, self.PROPS_CHECK, + (8, CHKNOTETAKER_HID, self.resources.reschkNoteTaker_value, + 97, 60, 0, 4, 403, 150), self) + self.chkTimekeeper = self.insertCheckBox("chkTimekeeper", + CHKUSETIMEKEEPER_ITEM_CHANGED, self.PROPS_CHECK, + (8, CHKTIMEKEEPER_HID, self.resources.reschkTimekeeper_value, + 97, 74, 0, 4, 404, 150), self) + self.chkAttendees = self.insertCheckBox("chkAttendees", + CHKUSEATTENDEES_ITEM_CHANGED, self.PROPS_CHECK, + (8, CHKATTENDEES_HID, self.resources.reschkAttendees_value, + 97, 88, 1, 4, 405, 150), self) + self.chkObservers = self.insertCheckBox("chkObservers", + CHKUSEOBSERVERS_ITEM_CHANGED, self.PROPS_CHECK, + (8, CHKOBSERVERS_HID, self.resources.reschkObservers_value, + 97, 102, 0, 4, 406, 150), self) + self.chkResourcePersons = self.insertCheckBox("chkResourcePersons", + CHKUSERESOURCEPERSONS_ITEM_CHANGED, self.PROPS_CHECK, + (8, CHKRESOURCEPERSONS_HID, self.resources.reschkResourcePersons_value, + 97, 116, 0, 4, 407, 150), self) self.insertImage("imgHelp4", self.PROPS_IMAGE, (0, 10, self.IMGHELP1_HID, INFO_IMAGE_URL, 92, 145, False, 4, 408, 10)) self.insertLabel("lblHelp4", self.PROPS_TEXTAREA, - (39, self.resources.reslblHelp4_value, True,104, 145, 4, 409, 199)) + (39, self.resources.reslblHelp4_value, True, 104, 145, 4, 409, 199)) def buildStep5(self): self.insertLabel("lblTitle4", self.PROPS_LABEL_B, diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py index 3c373623364f..c97501cbb944 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogConst.py @@ -1,14 +1,23 @@ from common.HelpIds import HelpIds -CHKCHECKBOX_ITEM_CHANGED = "checkBoxItemChanged" -TXTTEXTFIELD_TEXT_CHANGED = "" -LISTPAGEDESIGN_ACTION_PERFORMED = "pageDesignChanged" -TXTTEMPLATENAME_TEXT_CHANGED = "templateTitleChanged" +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" +BTNINSERT_ACTION_PERFORMED = "insertRow" +BTNREMOVE_ACTION_PERFORMED = "removeRow" +BTNUP_ACTION_PERFORMED = "rowUp" +BTNDOWN_ACTION_PERFORMED = "rowDown" INFO_IMAGE_URL = "private:resource/dbu/image/19205" diff --git a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py index 1bfa95d769c1..0cedfb02aaee 100644 --- a/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py +++ b/wizards/com/sun/star/wizards/agenda/AgendaWizardDialogImpl.py @@ -1,18 +1,15 @@ from AgendaWizardDialog import * -from common.Configuration import * -from CGAgenda import CGAgenda from AgendaTemplate import * -from common.NoValidPathException import * -from common.FileAccess import * -from ui.PathSelection import * -from ui.event.UnoDataAware import * -from ui.event.RadioDataAware import * -from TemplateConsts import * +from CGAgenda import CGAgenda +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 com.sun.star.view.DocumentZoomType import OPTIMAL from com.sun.star.awt.VclWindowPeerAttribute import YES_NO, DEF_NO from com.sun.star.awt.VclWindowPeerAttribute import OK -from common.NoValidPathException import * class AgendaWizardDialogImpl(AgendaWizardDialog): @@ -160,57 +157,54 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): self.setControlProperty( "listPageDesign", "StringItemList", tuple(self.agendaTemplates[0])) self.checkSavePath() - UnoDataAware.attachListBox( self.agenda, "cp_AgendaType", self.listPageDesign, True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_IncludeMinutes", self.chkMinutes, True) + self.agenda, "cp_IncludeMinutes", self.chkMinutes, True).updateUI() UnoDataAware.attachEditControl( - self.agenda, "cp_Title", self.txtTitle, True) + self.agenda, "cp_Title", self.txtTitle, True).updateUI() UnoDataAware.attachDateControl( - self.agenda, "cp_Date", self.txtDate, True) + self.agenda, "cp_Date", self.txtDate, True).updateUI() UnoDataAware.attachTimeControl( - self.agenda, "cp_Time", self.txtTime, True) + self.agenda, "cp_Time", self.txtTime, True).updateUI() UnoDataAware.attachEditControl( - self.agenda, "cp_Location", self.cbLocation, True) + self.agenda, "cp_Location", self.cbLocation, True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowMeetingType", self.chkMeetingTitle, True, - FILLIN_MEETING_TYPE) + self.agenda, "cp_ShowMeetingType", self.chkMeetingTitle, + True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowRead", self.chkRead, True, - FILLIN_READ) + self.agenda, "cp_ShowRead", self.chkRead, True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowBring", self.chkBring, True, - FILLIN_BRING) + self.agenda, "cp_ShowBring", self.chkBring, True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowNotes", self.chkNotes, True, - FILLIN_NOTES) + self.agenda, "cp_ShowNotes", self.chkNotes, True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowCalledBy", self.chkConvenedBy, True, - FILLIN_CALLED_BY) + self.agenda, "cp_ShowCalledBy", self.chkConvenedBy, + True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowFacilitator", self.chkPresiding, True, - FILLIN_FACILITATOR) + self.agenda, "cp_ShowFacilitator", self.chkPresiding, + True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowNotetaker", self.chkNoteTaker, True, - FILLIN_NOTETAKER) + self.agenda, "cp_ShowNotetaker", self.chkNoteTaker, + True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowTimekeeper", self.chkTimekeeper, True, - FILLIN_TIMEKEEPER) + self.agenda, "cp_ShowTimekeeper", self.chkTimekeeper, + True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowAttendees", self.chkAttendees, True, - FILLIN_PARTICIPANTS) + self.agenda, "cp_ShowAttendees", self.chkAttendees, + True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowObservers", self.chkObservers, True, - FILLIN_OBSERVERS) + self.agenda, "cp_ShowObservers", self.chkObservers, + True).updateUI() UnoDataAware.attachCheckBox( - self.agenda, "cp_ShowResourcePersons",self.chkResourcePersons, True, - FILLIN_RESOURCE_PERSONS) + self.agenda, "cp_ShowResourcePersons",self.chkResourcePersons, + True).updateUI() UnoDataAware.attachEditControl( - self.agenda, "cp_TemplateName", self.txtTemplateName, True) + self.agenda, "cp_TemplateName", self.txtTemplateName, + True).updateUI() RadioDataAware.attachRadioButtons( self.agenda, "cp_ProceedMethod", - (self.optCreateAgenda, self.optMakeChanges), True) + (self.optCreateAgenda, self.optMakeChanges), True).updateUI() def saveConfiguration(self): self.topicsControl.saveTopics(self.agenda) @@ -273,13 +267,39 @@ class AgendaWizardDialogImpl(AgendaWizardDialog): title = Helper.getUnoPropertyValue(getModel(txtTemplateName), "Text") self.agendaTemplate.setTemplateTitle(title) - def checkBoxItemChanged(self): - try: - AgendaTemplate.xTextDocument.lockControllers() - AgendaTemplate.redraw(FILLIN_READ) - AgendaTemplate.xTextDocument.unlockControllers() - except Exception: - traceback.print_exc() + #checkbox listeners + def chkUseMeetingTypeItemChanged(self): + AgendaTemplate.redraw(FILLIN_MEETING_TYPE) + + def chkUseReadItemChanged(self): + AgendaTemplate.redraw(FILLIN_READ) + + def chkUseBringItemChanged(self): + AgendaTemplate.redraw(FILLIN_BRING) + + def chkUseNotesItemChanged(self): + AgendaTemplate.redraw(FILLIN_NOTES) + + def chkUseCalledByItemChanged(self): + AgendaTemplate.redraw(FILLIN_CALLED_BY) + + def chkUseFacilitatorItemChanged(self): + AgendaTemplate.redraw(FILLIN_FACILITATOR) + + def chkUseNoteTakerItemChanged(self): + AgendaTemplate.redraw(FILLIN_NOTETAKER) + + def chkUseTimeKeeperItemChanged(self): + AgendaTemplate.redraw(FILLIN_TIMEKEEPER) + + def chkUseAttendeesItemChanged(self): + AgendaTemplate.redraw(FILLIN_PARTICIPANTS) + + def chkUseObserversItemChanged(self): + AgendaTemplate.redraw(FILLIN_OBSERVERS) + + def chkUseResourcePersonsItemChanged(self): + AgendaTemplate.redraw(FILLIN_RESOURCE_PERSONS) ''' convenience method. diff --git a/wizards/com/sun/star/wizards/ui/event/CommonListener.py b/wizards/com/sun/star/wizards/ui/event/CommonListener.py index 3bd4862402ec..1a1c02cce091 100644 --- a/wizards/com/sun/star/wizards/ui/event/CommonListener.py +++ b/wizards/com/sun/star/wizards/ui/event/CommonListener.py @@ -61,6 +61,7 @@ class ItemListenerProcAdapter( unohelper.Base, XItemListener ): except: apply( self.oProcToCall, (oItemEvent,) + self.tParams ) + from com.sun.star.awt import XTextListener class TextListenerProcAdapter( unohelper.Base, XTextListener ): def __init__( self, oProcToCall, tParams=() ): diff --git a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py index d1738ecbf8e6..ba1e6e92a924 100644 --- a/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py +++ b/wizards/com/sun/star/wizards/ui/event/UnoDataAware.py @@ -58,10 +58,11 @@ class UnoDataAware(DataAware): data, prop, unoControl, "Value", field, float(0)) @classmethod - def attachCheckBox(self, data, prop, checkBox, field, listener=None): + def attachCheckBox( + self, data, prop, checkBox, field): uda = UnoDataAware(data, prop, checkBox, PropertyNames.PROPERTY_STATE) method = getattr(uda,"updateData") - checkBox.addItemListener(ItemListenerProcAdapter(method, listener)) + checkBox.addItemListener(ItemListenerProcAdapter(method)) return uda def attachLabel(self, data, prop, label, field): |