79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
self.xGraphspellSugg = self._addWidget('activate_spell_sugg', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = dUI.get('activate_spell_sugg', "#err"))
self._addWidget('activate_spell_sugg_descr', 'FixedText', nX, nY2+25, nWidth, nHeight*4, Label = dUI.get('activate_spell_sugg_descr', "#err"), MultiLine = True)
# Personal dictionary section
self._addWidget("personal_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = dUI.get("personal_section", "#err"), FontDescriptor = xFDTitle)
self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = dUI.get('activate_personal', "#err"))
self._addWidget('activate_personnal_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*3, Label = dUI.get('activate_personal_descr', "#err"), MultiLine = True)
self._addWidget('import_personal', 'FixedText', nX, nY3+55, nWidth-60, nHeight, Label = dUI.get('import_personal', "#err"), FontDescriptor = xFDSubTitle)
self.xMsg = self._addWidget('msg', 'FixedText', nX, nY3+65, nWidth-50, nHeight, Label = "[néant]")
self._addWidget('import_button', 'Button', self.xDialog.Width-50, nY3+65, 40, 10, Label = dUI.get('import_button', "#err"), TextColor = 0x005500)
self._addWidget('create_dictionary', 'FixedText', nX, nY3+75, nWidth, nHeight*2, Label = dUI.get('create_dictionary', "#err"), MultiLine = True)
# Button
self._addWidget('apply_button', 'Button', self.xDialog.Width-120, self.xDialog.Height-25, 50, 14, Label = dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500)
self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = dUI.get('cancel_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000)
self._loadOptions()
# container
self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
self.xContainer.setModel(self.xDialog)
self.xContainer.getControl('apply_button').addActionListener(self)
self.xContainer.getControl('apply_button').setActionCommand('Apply')
self.xContainer.getControl('import_button').addActionListener(self)
self.xContainer.getControl('import_button').setActionCommand('Import')
self.xContainer.getControl('cancel_button').addActionListener(self)
self.xContainer.getControl('cancel_button').setActionCommand('Cancel')
self.xContainer.setVisible(False)
toolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
self.xContainer.createPeer(toolkit, None)
self.xContainer.execute()
# XActionListener
def actionPerformed (self, xActionEvent):
try:
if xActionEvent.ActionCommand == 'Apply':
xChild = self.xSettingNode.getByName("o_fr")
xChild.setPropertyValue("use_graphspell", self.xGraphspell.State)
xChild.setPropertyValue("use_graphspell_sugg", self.xGraphspellSugg.State)
#xChild.setPropertyValue("extended_dic", self.xExtendedDic.State)
xChild.setPropertyValue("use_personal_dic", self.xPersonalDic.State)
self.xSettingNode.commitChanges()
elif xActionEvent.ActionCommand == "Import":
xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.SystemFilePicker', self.ctx)
xFilePicker.appendFilter("Supported files", "*.json; *.bdic")
#xFilePicker.setDisplayDirectory("")
#xFilePicker.setMultiSelectionMode(True)
nResult = xFilePicker.execute()
if nResult == 1:
pass
#lFile = xFilePicker.getSelectedFiles()
#lFile = xFilePicker.getFiles()
else:
pass
self.xContainer.endExecute()
except:
traceback.print_exc()
# XJobExecutor
|
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
self.xGraphspellSugg = self._addWidget('activate_spell_sugg', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = dUI.get('activate_spell_sugg', "#err"))
self._addWidget('activate_spell_sugg_descr', 'FixedText', nX, nY2+25, nWidth, nHeight*4, Label = dUI.get('activate_spell_sugg_descr', "#err"), MultiLine = True)
# Personal dictionary section
self._addWidget("personal_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = dUI.get("personal_section", "#err"), FontDescriptor = xFDTitle)
self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = dUI.get('activate_personal', "#err"))
self._addWidget('activate_personnal_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*3, Label = dUI.get('activate_personal_descr', "#err"), MultiLine = True)
# Button
self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-25, 50, 14, Label = dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500)
self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = dUI.get('cancel_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000)
self._loadOptions()
# container
self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
self.xContainer.setModel(self.xDialog)
self.xContainer.getControl('apply_button').addActionListener(self)
self.xContainer.getControl('apply_button').setActionCommand('Apply')
self.xContainer.getControl('cancel_button').addActionListener(self)
self.xContainer.getControl('cancel_button').setActionCommand('Cancel')
self.xContainer.setVisible(False)
toolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
self.xContainer.createPeer(toolkit, None)
self.xContainer.execute()
# XActionListener
def actionPerformed (self, xActionEvent):
try:
if xActionEvent.ActionCommand == 'Apply':
xChild = self.xSettingNode.getByName("o_fr")
xChild.setPropertyValue("use_graphspell", self.xGraphspell.State)
xChild.setPropertyValue("use_graphspell_sugg", self.xGraphspellSugg.State)
#xChild.setPropertyValue("extended_dic", self.xExtendedDic.State)
xChild.setPropertyValue("use_personal_dic", self.xPersonalDic.State)
self.xSettingNode.commitChanges()
else:
pass
self.xContainer.endExecute()
except:
traceback.print_exc()
# XJobExecutor
|