155 """ |
155 """ |
156 Private method to define the user interface actions. |
156 Private method to define the user interface actions. |
157 """ |
157 """ |
158 self.openUIAct = QAction( |
158 self.openUIAct = QAction( |
159 UI.PixmapCache.getIcon("openUI.png"), |
159 UI.PixmapCache.getIcon("openUI.png"), |
160 self.trUtf8('&Open UI Files...'), self) |
160 self.tr('&Open UI Files...'), self) |
161 self.openUIAct.setStatusTip(self.trUtf8('Open UI files for display')) |
161 self.openUIAct.setStatusTip(self.tr('Open UI files for display')) |
162 self.openUIAct.setWhatsThis(self.trUtf8( |
162 self.openUIAct.setWhatsThis(self.tr( |
163 """<b>Open UI Files</b>""" |
163 """<b>Open UI Files</b>""" |
164 """<p>This opens some UI files for display.</p>""" |
164 """<p>This opens some UI files for display.</p>""" |
165 )) |
165 )) |
166 self.openUIAct.triggered[()].connect(self.__openWidget) |
166 self.openUIAct.triggered[()].connect(self.__openWidget) |
167 |
167 |
168 self.openQMAct = QAction( |
168 self.openQMAct = QAction( |
169 UI.PixmapCache.getIcon("openQM.png"), |
169 UI.PixmapCache.getIcon("openQM.png"), |
170 self.trUtf8('Open &Translation Files...'), self) |
170 self.tr('Open &Translation Files...'), self) |
171 self.openQMAct.setStatusTip(self.trUtf8( |
171 self.openQMAct.setStatusTip(self.tr( |
172 'Open Translation files for display')) |
172 'Open Translation files for display')) |
173 self.openQMAct.setWhatsThis(self.trUtf8( |
173 self.openQMAct.setWhatsThis(self.tr( |
174 """<b>Open Translation Files</b>""" |
174 """<b>Open Translation Files</b>""" |
175 """<p>This opens some translation files for display.</p>""" |
175 """<p>This opens some translation files for display.</p>""" |
176 )) |
176 )) |
177 self.openQMAct.triggered[()].connect(self.__openTranslation) |
177 self.openQMAct.triggered[()].connect(self.__openTranslation) |
178 |
178 |
179 self.reloadAct = QAction( |
179 self.reloadAct = QAction( |
180 UI.PixmapCache.getIcon("reload.png"), |
180 UI.PixmapCache.getIcon("reload.png"), |
181 self.trUtf8('&Reload Translations'), self) |
181 self.tr('&Reload Translations'), self) |
182 self.reloadAct.setStatusTip(self.trUtf8( |
182 self.reloadAct.setStatusTip(self.tr( |
183 'Reload the loaded translations')) |
183 'Reload the loaded translations')) |
184 self.reloadAct.setWhatsThis(self.trUtf8( |
184 self.reloadAct.setWhatsThis(self.tr( |
185 """<b>Reload Translations</b>""" |
185 """<b>Reload Translations</b>""" |
186 """<p>This reloads the translations for the loaded""" |
186 """<p>This reloads the translations for the loaded""" |
187 """ languages.</p>""" |
187 """ languages.</p>""" |
188 )) |
188 )) |
189 self.reloadAct.triggered[()].connect(self.translations.reload) |
189 self.reloadAct.triggered[()].connect(self.translations.reload) |
190 |
190 |
191 self.exitAct = QAction( |
191 self.exitAct = QAction( |
192 UI.PixmapCache.getIcon("exit.png"), self.trUtf8('&Quit'), self) |
192 UI.PixmapCache.getIcon("exit.png"), self.tr('&Quit'), self) |
193 self.exitAct.setShortcut(QKeySequence( |
193 self.exitAct.setShortcut(QKeySequence( |
194 self.trUtf8("Ctrl+Q", "File|Quit"))) |
194 self.tr("Ctrl+Q", "File|Quit"))) |
195 self.exitAct.setStatusTip(self.trUtf8('Quit the application')) |
195 self.exitAct.setStatusTip(self.tr('Quit the application')) |
196 self.exitAct.setWhatsThis(self.trUtf8( |
196 self.exitAct.setWhatsThis(self.tr( |
197 """<b>Quit</b>""" |
197 """<b>Quit</b>""" |
198 """<p>Quit the application.</p>""" |
198 """<p>Quit the application.</p>""" |
199 )) |
199 )) |
200 self.exitAct.triggered[()].connect(qApp.closeAllWindows) |
200 self.exitAct.triggered[()].connect(qApp.closeAllWindows) |
201 |
201 |
202 self.whatsThisAct = QAction( |
202 self.whatsThisAct = QAction( |
203 UI.PixmapCache.getIcon("whatsThis.png"), |
203 UI.PixmapCache.getIcon("whatsThis.png"), |
204 self.trUtf8('&What\'s This?'), self) |
204 self.tr('&What\'s This?'), self) |
205 self.whatsThisAct.setShortcut(QKeySequence(self.trUtf8("Shift+F1"))) |
205 self.whatsThisAct.setShortcut(QKeySequence(self.tr("Shift+F1"))) |
206 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) |
206 self.whatsThisAct.setStatusTip(self.tr('Context sensitive help')) |
207 self.whatsThisAct.setWhatsThis(self.trUtf8( |
207 self.whatsThisAct.setWhatsThis(self.tr( |
208 """<b>Display context sensitive help</b>""" |
208 """<b>Display context sensitive help</b>""" |
209 """<p>In What's This? mode, the mouse cursor shows an arrow""" |
209 """<p>In What's This? mode, the mouse cursor shows an arrow""" |
210 """ with a question mark, and you can click on the interface""" |
210 """ with a question mark, and you can click on the interface""" |
211 """ elements to get a short description of what they do and""" |
211 """ elements to get a short description of what they do and""" |
212 """ how to use them. In dialogs, this feature can be accessed""" |
212 """ how to use them. In dialogs, this feature can be accessed""" |
213 """ using the context help button in the titlebar.</p>""" |
213 """ using the context help button in the titlebar.</p>""" |
214 )) |
214 )) |
215 self.whatsThisAct.triggered[()].connect(self.__whatsThis) |
215 self.whatsThisAct.triggered[()].connect(self.__whatsThis) |
216 |
216 |
217 self.aboutAct = QAction(self.trUtf8('&About'), self) |
217 self.aboutAct = QAction(self.tr('&About'), self) |
218 self.aboutAct.setStatusTip(self.trUtf8( |
218 self.aboutAct.setStatusTip(self.tr( |
219 'Display information about this software')) |
219 'Display information about this software')) |
220 self.aboutAct.setWhatsThis(self.trUtf8( |
220 self.aboutAct.setWhatsThis(self.tr( |
221 """<b>About</b>""" |
221 """<b>About</b>""" |
222 """<p>Display some information about this software.</p>""" |
222 """<p>Display some information about this software.</p>""" |
223 )) |
223 )) |
224 self.aboutAct.triggered[()].connect(self.__about) |
224 self.aboutAct.triggered[()].connect(self.__about) |
225 |
225 |
226 self.aboutQtAct = QAction(self.trUtf8('About &Qt'), self) |
226 self.aboutQtAct = QAction(self.tr('About &Qt'), self) |
227 self.aboutQtAct.setStatusTip( |
227 self.aboutQtAct.setStatusTip( |
228 self.trUtf8('Display information about the Qt toolkit')) |
228 self.tr('Display information about the Qt toolkit')) |
229 self.aboutQtAct.setWhatsThis(self.trUtf8( |
229 self.aboutQtAct.setWhatsThis(self.tr( |
230 """<b>About Qt</b>""" |
230 """<b>About Qt</b>""" |
231 """<p>Display some information about the Qt toolkit.</p>""" |
231 """<p>Display some information about the Qt toolkit.</p>""" |
232 )) |
232 )) |
233 self.aboutQtAct.triggered[()].connect(self.__aboutQt) |
233 self.aboutQtAct.triggered[()].connect(self.__aboutQt) |
234 |
234 |
235 self.tileAct = QAction(self.trUtf8('&Tile'), self) |
235 self.tileAct = QAction(self.tr('&Tile'), self) |
236 self.tileAct.setStatusTip(self.trUtf8('Tile the windows')) |
236 self.tileAct.setStatusTip(self.tr('Tile the windows')) |
237 self.tileAct.setWhatsThis(self.trUtf8( |
237 self.tileAct.setWhatsThis(self.tr( |
238 """<b>Tile the windows</b>""" |
238 """<b>Tile the windows</b>""" |
239 """<p>Rearrange and resize the windows so that they are""" |
239 """<p>Rearrange and resize the windows so that they are""" |
240 """ tiled.</p>""" |
240 """ tiled.</p>""" |
241 )) |
241 )) |
242 self.tileAct.triggered[()].connect(self.preview.tileSubWindows) |
242 self.tileAct.triggered[()].connect(self.preview.tileSubWindows) |
243 |
243 |
244 self.cascadeAct = QAction(self.trUtf8('&Cascade'), self) |
244 self.cascadeAct = QAction(self.tr('&Cascade'), self) |
245 self.cascadeAct.setStatusTip(self.trUtf8('Cascade the windows')) |
245 self.cascadeAct.setStatusTip(self.tr('Cascade the windows')) |
246 self.cascadeAct.setWhatsThis(self.trUtf8( |
246 self.cascadeAct.setWhatsThis(self.tr( |
247 """<b>Cascade the windows</b>""" |
247 """<b>Cascade the windows</b>""" |
248 """<p>Rearrange and resize the windows so that they are""" |
248 """<p>Rearrange and resize the windows so that they are""" |
249 """ cascaded.</p>""" |
249 """ cascaded.</p>""" |
250 )) |
250 )) |
251 self.cascadeAct.triggered[()].connect(self.preview.cascadeSubWindows) |
251 self.cascadeAct.triggered[()].connect(self.preview.cascadeSubWindows) |
252 |
252 |
253 self.closeAct = QAction( |
253 self.closeAct = QAction( |
254 UI.PixmapCache.getIcon("close.png"), self.trUtf8('&Close'), self) |
254 UI.PixmapCache.getIcon("close.png"), self.tr('&Close'), self) |
255 self.closeAct.setShortcut(QKeySequence(self.trUtf8( |
255 self.closeAct.setShortcut(QKeySequence(self.tr( |
256 "Ctrl+W", "File|Close"))) |
256 "Ctrl+W", "File|Close"))) |
257 self.closeAct.setStatusTip(self.trUtf8('Close the current window')) |
257 self.closeAct.setStatusTip(self.tr('Close the current window')) |
258 self.closeAct.setWhatsThis(self.trUtf8( |
258 self.closeAct.setWhatsThis(self.tr( |
259 """<b>Close Window</b>""" |
259 """<b>Close Window</b>""" |
260 """<p>Close the current window.</p>""" |
260 """<p>Close the current window.</p>""" |
261 )) |
261 )) |
262 self.closeAct.triggered[()].connect(self.preview.closeWidget) |
262 self.closeAct.triggered[()].connect(self.preview.closeWidget) |
263 |
263 |
264 self.closeAllAct = QAction(self.trUtf8('Clos&e All'), self) |
264 self.closeAllAct = QAction(self.tr('Clos&e All'), self) |
265 self.closeAllAct.setStatusTip(self.trUtf8('Close all windows')) |
265 self.closeAllAct.setStatusTip(self.tr('Close all windows')) |
266 self.closeAllAct.setWhatsThis(self.trUtf8( |
266 self.closeAllAct.setWhatsThis(self.tr( |
267 """<b>Close All Windows</b>""" |
267 """<b>Close All Windows</b>""" |
268 """<p>Close all windows.</p>""" |
268 """<p>Close all windows.</p>""" |
269 )) |
269 )) |
270 self.closeAllAct.triggered[()].connect(self.preview.closeAllWidgets) |
270 self.closeAllAct.triggered[()].connect(self.preview.closeAllWidgets) |
271 |
271 |
273 """ |
273 """ |
274 Private method to create the menus. |
274 Private method to create the menus. |
275 """ |
275 """ |
276 mb = self.menuBar() |
276 mb = self.menuBar() |
277 |
277 |
278 menu = mb.addMenu(self.trUtf8('&File')) |
278 menu = mb.addMenu(self.tr('&File')) |
279 menu.setTearOffEnabled(True) |
279 menu.setTearOffEnabled(True) |
280 menu.addAction(self.openUIAct) |
280 menu.addAction(self.openUIAct) |
281 menu.addAction(self.openQMAct) |
281 menu.addAction(self.openQMAct) |
282 menu.addAction(self.reloadAct) |
282 menu.addAction(self.reloadAct) |
283 menu.addSeparator() |
283 menu.addSeparator() |
284 menu.addAction(self.closeAct) |
284 menu.addAction(self.closeAct) |
285 menu.addAction(self.closeAllAct) |
285 menu.addAction(self.closeAllAct) |
286 menu.addSeparator() |
286 menu.addSeparator() |
287 menu.addAction(self.exitAct) |
287 menu.addAction(self.exitAct) |
288 |
288 |
289 self.windowMenu = mb.addMenu(self.trUtf8('&Window')) |
289 self.windowMenu = mb.addMenu(self.tr('&Window')) |
290 self.windowMenu.setTearOffEnabled(True) |
290 self.windowMenu.setTearOffEnabled(True) |
291 self.windowMenu.aboutToShow.connect(self.__showWindowMenu) |
291 self.windowMenu.aboutToShow.connect(self.__showWindowMenu) |
292 self.windowMenu.triggered.connect(self.preview.toggleSelectedWidget) |
292 self.windowMenu.triggered.connect(self.preview.toggleSelectedWidget) |
293 |
293 |
294 mb.addSeparator() |
294 mb.addSeparator() |
295 |
295 |
296 menu = mb.addMenu(self.trUtf8('&Help')) |
296 menu = mb.addMenu(self.tr('&Help')) |
297 menu.setTearOffEnabled(True) |
297 menu.setTearOffEnabled(True) |
298 menu.addAction(self.aboutAct) |
298 menu.addAction(self.aboutAct) |
299 menu.addAction(self.aboutQtAct) |
299 menu.addAction(self.aboutQtAct) |
300 menu.addSeparator() |
300 menu.addSeparator() |
301 menu.addAction(self.whatsThisAct) |
301 menu.addAction(self.whatsThisAct) |
302 |
302 |
303 def __initToolbars(self): |
303 def __initToolbars(self): |
304 """ |
304 """ |
305 Private method to create the toolbars. |
305 Private method to create the toolbars. |
306 """ |
306 """ |
307 filetb = self.addToolBar(self.trUtf8("File")) |
307 filetb = self.addToolBar(self.tr("File")) |
308 filetb.setIconSize(UI.Config.ToolBarIconSize) |
308 filetb.setIconSize(UI.Config.ToolBarIconSize) |
309 filetb.addAction(self.openUIAct) |
309 filetb.addAction(self.openUIAct) |
310 filetb.addAction(self.openQMAct) |
310 filetb.addAction(self.openQMAct) |
311 filetb.addAction(self.reloadAct) |
311 filetb.addAction(self.reloadAct) |
312 filetb.addSeparator() |
312 filetb.addSeparator() |
313 filetb.addAction(self.closeAct) |
313 filetb.addAction(self.closeAct) |
314 filetb.addSeparator() |
314 filetb.addSeparator() |
315 filetb.addAction(self.exitAct) |
315 filetb.addAction(self.exitAct) |
316 |
316 |
317 helptb = self.addToolBar(self.trUtf8("Help")) |
317 helptb = self.addToolBar(self.tr("Help")) |
318 helptb.setIconSize(UI.Config.ToolBarIconSize) |
318 helptb.setIconSize(UI.Config.ToolBarIconSize) |
319 helptb.addAction(self.whatsThisAct) |
319 helptb.addAction(self.whatsThisAct) |
320 |
320 |
321 def __whatsThis(self): |
321 def __whatsThis(self): |
322 """ |
322 """ |