130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
-
-
-
-
+
+
+
+
-
+
-
+
-
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
|
nY1 = 5
nY2 = nY1 + 225
nWidth = self.xDialog.Width - 20
nHeight = 10
# List
self._addWidget("list_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = self.dUI.get("list_section", "#err"), FontDescriptor = xFDTitle)
self._addWidget('count_button', 'Button', nX, nY1+12, 70, 11, Label = self.dUI.get('count_button', "#err"))
self._addWidget('count2_button', 'Button', nX+75, nY1+12, 70, 11, Label = self.dUI.get('count2_button', "#err"))
self._addWidget('unknown_button', 'Button', nX+150, nY1+12, 70, 11, Label = self.dUI.get('unknown_button', "#err"))
self._addWidget("list_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = ui.get("list_section"), FontDescriptor = xFDTitle)
self._addWidget('count_button', 'Button', nX, nY1+12, 70, 11, Label = ui.get('count_button'))
self._addWidget('count2_button', 'Button', nX+75, nY1+12, 70, 11, Label = ui.get('count2_button'))
self._addWidget('unknown_button', 'Button', nX+150, nY1+12, 70, 11, Label = ui.get('unknown_button'))
self.xGridModel = self._addGrid("list_grid", nX, nY1+25, nWidth, 181, \
[ {"Title": self.dUI.get("words", "#err"), "ColumnWidth": 175}, {"Title": "Occurrences", "ColumnWidth": 45} ], \
[ {"Title": ui.get("words"), "ColumnWidth": 175}, {"Title": "Occurrences", "ColumnWidth": 45} ], \
SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI") \
)
self._addWidget('num_of_entries', 'FixedText', nX, nY1+210, 30, nHeight, Label = self.dUI.get('num_of_entries', "#err"), Align = 2)
self._addWidget('num_of_entries', 'FixedText', nX, nY1+210, 30, nHeight, Label = ui.get('num_of_entries'), Align = 2)
self.xNumWord = self._addWidget('num_of_entries_res', 'FixedText', nX+35, nY1+210, 25, nHeight, Label = "—")
self._addWidget('tot_of_entries', 'FixedText', nX+60, nY1+210, 30, nHeight, Label = self.dUI.get('tot_of_entries', "#err"), Align = 2)
self._addWidget('tot_of_entries', 'FixedText', nX+60, nY1+210, 30, nHeight, Label = ui.get('tot_of_entries'), Align = 2)
self.xTotWord = self._addWidget('tot_of_entries_res', 'FixedText', nX+95, nY1+210, 30, nHeight, Label = "—")
self.xSearch = self._addWidget('search_button', 'Button', nX+145, nY1+210, 30, nHeight, Label = ">>>", HelpText=self.dUI.get('goto', "#err"), Enabled = False)
self.xExport = self._addWidget('export_button', 'Button', nX+180, nY1+210, 40, nHeight, Label = self.dUI.get('export', "#err"), Enabled = False)
self.xSearch = self._addWidget('search_button', 'Button', nX+145, nY1+210, 30, nHeight, Label = ">>>", HelpText=ui.get('goto'), Enabled = False)
self.xExport = self._addWidget('export_button', 'Button', nX+180, nY1+210, 40, nHeight, Label = ui.get('export'), Enabled = False)
# Tag
# Note: the only way to group RadioButtons is to create them successively
self._addWidget("charstyle_section", 'FixedLine', nX, nY2, 200, nHeight, Label = self.dUI.get("charstyle_section", "#err"), FontDescriptor = xFDTitle)
self.xAccent = self._addWidget('emphasis', 'RadioButton', nX, nY2+12, 55, nHeight, Label = self.dUI.get('emphasis', "#err"))
self.xStrongAccent = self._addWidget('strong_emphasis', 'RadioButton', nX+60, nY2+12, 70, nHeight, Label = self.dUI.get('strong_emphasis', "#err"))
self.xNoAccent = self._addWidget('nostyle', 'RadioButton', nX+140, nY2+12, 45, nHeight, Label = self.dUI.get('nostyle', "#err"))
self._addWidget("charstyle_section", 'FixedLine', nX, nY2, 200, nHeight, Label = ui.get("charstyle_section"), FontDescriptor = xFDTitle)
self.xAccent = self._addWidget('emphasis', 'RadioButton', nX, nY2+12, 55, nHeight, Label = ui.get('emphasis'))
self.xStrongAccent = self._addWidget('strong_emphasis', 'RadioButton', nX+60, nY2+12, 70, nHeight, Label = ui.get('strong_emphasis'))
self.xNoAccent = self._addWidget('nostyle', 'RadioButton', nX+140, nY2+12, 45, nHeight, Label = ui.get('nostyle'))
self.xTag = self._addWidget('tag_button', 'Button', self.xDialog.Width-40, nY2+10, 30, 11, Label = self.dUI.get('tag_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500, Enabled=False)
self.xTag = self._addWidget('tag_button', 'Button', self.xDialog.Width-40, nY2+10, 30, 11, Label = ui.get('tag_button'), FontDescriptor = xFDTitle, TextColor = 0x005500, Enabled=False)
# Progress bar
self.xProgressBar = self._addWidget('progress_bar', 'ProgressBar', nX, self.xDialog.Height-25, 160, 14)
self.xProgressBar.ProgressValueMin = 0
self.xProgressBar.ProgressValueMax = 1 # to calculate later
# Close
self._addWidget('close_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000)
self._addWidget('close_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = ui.get('close_button'), FontDescriptor = xFDTitle, TextColor = 0x550000)
# container
self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
self.xContainer.setModel(self.xDialog)
self.xGridControl = self.xContainer.getControl('list_grid')
self.xContainer.getControl('count_button').addActionListener(self)
self.xContainer.getControl('count_button').setActionCommand('Count')
|