124 |
124 |
125 def __initActions(self): |
125 def __initActions(self): |
126 """ |
126 """ |
127 Private method to define the user interface actions. |
127 Private method to define the user interface actions. |
128 """ |
128 """ |
129 self.openAct = QAction(UI.PixmapCache.getIcon("openUI.png"), |
129 self.openAct = QAction( |
130 self.trUtf8('&Open File'), self) |
130 UI.PixmapCache.getIcon("openUI.png"), |
|
131 self.trUtf8('&Open File'), self) |
131 self.openAct.setShortcut( |
132 self.openAct.setShortcut( |
132 QKeySequence(self.trUtf8("Ctrl+O", "File|Open"))) |
133 QKeySequence(self.trUtf8("Ctrl+O", "File|Open"))) |
133 self.openAct.setStatusTip(self.trUtf8('Open a UI file for display')) |
134 self.openAct.setStatusTip(self.trUtf8('Open a UI file for display')) |
134 self.openAct.setWhatsThis(self.trUtf8( |
135 self.openAct.setWhatsThis(self.trUtf8( |
135 """<b>Open File</b>""" |
136 """<b>Open File</b>""" |
136 """<p>This opens a new UI file for display.</p>""" |
137 """<p>This opens a new UI file for display.</p>""" |
137 )) |
138 )) |
138 self.openAct.triggered[()].connect(self.__openFile) |
139 self.openAct.triggered[()].connect(self.__openFile) |
139 |
140 |
140 self.printAct = QAction(UI.PixmapCache.getIcon("print.png"), |
141 self.printAct = QAction( |
141 self.trUtf8('&Print'), self) |
142 UI.PixmapCache.getIcon("print.png"), |
|
143 self.trUtf8('&Print'), self) |
142 self.printAct.setShortcut( |
144 self.printAct.setShortcut( |
143 QKeySequence(self.trUtf8("Ctrl+P", "File|Print"))) |
145 QKeySequence(self.trUtf8("Ctrl+P", "File|Print"))) |
144 self.printAct.setStatusTip(self.trUtf8('Print a screen capture')) |
146 self.printAct.setStatusTip(self.trUtf8('Print a screen capture')) |
145 self.printAct.setWhatsThis(self.trUtf8( |
147 self.printAct.setWhatsThis(self.trUtf8( |
146 """<b>Print</b>""" |
148 """<b>Print</b>""" |
157 """<b>Print Preview</b>""" |
159 """<b>Print Preview</b>""" |
158 """<p>Print preview a screen capture.</p>""" |
160 """<p>Print preview a screen capture.</p>""" |
159 )) |
161 )) |
160 self.printPreviewAct.triggered[()].connect(self.__printPreviewImage) |
162 self.printPreviewAct.triggered[()].connect(self.__printPreviewImage) |
161 |
163 |
162 self.imageAct = QAction(UI.PixmapCache.getIcon("screenCapture.png"), |
164 self.imageAct = QAction( |
163 self.trUtf8('&Screen Capture'), self) |
165 UI.PixmapCache.getIcon("screenCapture.png"), |
|
166 self.trUtf8('&Screen Capture'), self) |
164 self.imageAct.setShortcut( |
167 self.imageAct.setShortcut( |
165 QKeySequence(self.trUtf8("Ctrl+S", "File|Screen Capture"))) |
168 QKeySequence(self.trUtf8("Ctrl+S", "File|Screen Capture"))) |
166 self.imageAct.setStatusTip(self.trUtf8( |
169 self.imageAct.setStatusTip(self.trUtf8( |
167 'Save a screen capture to an image file')) |
170 'Save a screen capture to an image file')) |
168 self.imageAct.setWhatsThis(self.trUtf8( |
171 self.imageAct.setWhatsThis(self.trUtf8( |
169 """<b>Screen Capture</b>""" |
172 """<b>Screen Capture</b>""" |
170 """<p>Save a screen capture to an image file.</p>""" |
173 """<p>Save a screen capture to an image file.</p>""" |
171 )) |
174 )) |
172 self.imageAct.triggered[()].connect(self.__saveImage) |
175 self.imageAct.triggered[()].connect(self.__saveImage) |
173 |
176 |
174 self.exitAct = QAction(UI.PixmapCache.getIcon("exit.png"), |
177 self.exitAct = QAction( |
175 self.trUtf8('&Quit'), self) |
178 UI.PixmapCache.getIcon("exit.png"), self.trUtf8('&Quit'), self) |
176 self.exitAct.setShortcut( |
179 self.exitAct.setShortcut( |
177 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit"))) |
180 QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit"))) |
178 self.exitAct.setStatusTip(self.trUtf8('Quit the application')) |
181 self.exitAct.setStatusTip(self.trUtf8('Quit the application')) |
179 self.exitAct.setWhatsThis(self.trUtf8( |
182 self.exitAct.setWhatsThis(self.trUtf8( |
180 """<b>Quit</b>""" |
183 """<b>Quit</b>""" |
181 """<p>Quit the application.</p>""" |
184 """<p>Quit the application.</p>""" |
182 )) |
185 )) |
183 self.exitAct.triggered[()].connect(qApp.closeAllWindows) |
186 self.exitAct.triggered[()].connect(qApp.closeAllWindows) |
184 |
187 |
185 self.copyAct = QAction(UI.PixmapCache.getIcon("editCopy.png"), |
188 self.copyAct = QAction( |
186 self.trUtf8('&Copy'), self) |
189 UI.PixmapCache.getIcon("editCopy.png"), self.trUtf8('&Copy'), self) |
187 self.copyAct.setShortcut( |
190 self.copyAct.setShortcut( |
188 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy"))) |
191 QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy"))) |
189 self.copyAct.setStatusTip( |
192 self.copyAct.setStatusTip( |
190 self.trUtf8('Copy screen capture to clipboard')) |
193 self.trUtf8('Copy screen capture to clipboard')) |
191 self.copyAct.setWhatsThis(self.trUtf8( |
194 self.copyAct.setWhatsThis(self.trUtf8( |
192 """<b>Copy</b>""" |
195 """<b>Copy</b>""" |
193 """<p>Copy screen capture to clipboard.</p>""" |
196 """<p>Copy screen capture to clipboard.</p>""" |
194 )) |
197 )) |
195 self.copyAct.triggered[()].connect(self.__copyImageToClipboard) |
198 self.copyAct.triggered[()].connect(self.__copyImageToClipboard) |
196 |
199 |
197 self.whatsThisAct = QAction(UI.PixmapCache.getIcon("whatsThis.png"), |
200 self.whatsThisAct = QAction( |
198 self.trUtf8('&What\'s This?'), self) |
201 UI.PixmapCache.getIcon("whatsThis.png"), |
|
202 self.trUtf8('&What\'s This?'), self) |
199 self.whatsThisAct.setShortcut(QKeySequence(self.trUtf8("Shift+F1"))) |
203 self.whatsThisAct.setShortcut(QKeySequence(self.trUtf8("Shift+F1"))) |
200 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) |
204 self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) |
201 self.whatsThisAct.setWhatsThis(self.trUtf8( |
205 self.whatsThisAct.setWhatsThis(self.trUtf8( |
202 """<b>Display context sensitive help</b>""" |
206 """<b>Display context sensitive help</b>""" |
203 """<p>In What's This? mode, the mouse cursor shows an arrow""" |
207 """<p>In What's This? mode, the mouse cursor shows an arrow""" |
378 self.mainWidget.hide() |
387 self.mainWidget.hide() |
379 self.mainWidget.show() |
388 self.mainWidget.show() |
380 |
389 |
381 self.lastQStyle = qstyle |
390 self.lastQStyle = qstyle |
382 self.lastStyle = sstyle |
391 self.lastStyle = sstyle |
383 Preferences.Prefs.settings.setValue('UIPreviewer/style', |
392 Preferences.Prefs.settings.setValue( |
384 self.styleCombo.currentIndex()) |
393 'UIPreviewer/style', self.styleCombo.currentIndex()) |
385 QApplication.restoreOverrideCursor() |
394 QApplication.restoreOverrideCursor() |
386 |
395 |
387 def __updateActions(self): |
396 def __updateActions(self): |
388 """ |
397 """ |
389 Private slot to update the actions state. |
398 Private slot to update the actions state. |
468 pix = self.mainWidget.grab() |
478 pix = self.mainWidget.grab() |
469 else: |
479 else: |
470 pix = QPixmap.grabWidget(self.mainWidget) |
480 pix = QPixmap.grabWidget(self.mainWidget) |
471 self.__updateChildren(self.lastStyle) |
481 self.__updateChildren(self.lastStyle) |
472 if not pix.save(fname, str(ext)): |
482 if not pix.save(fname, str(ext)): |
473 E5MessageBox.critical(self, |
483 E5MessageBox.critical( |
|
484 self, |
474 self.trUtf8("Save Image"), |
485 self.trUtf8("Save Image"), |
475 self.trUtf8( |
486 self.trUtf8( |
476 """<p>The file <b>{0}</b> could not be saved.</p>""") |
487 """<p>The file <b>{0}</b> could not be saved.</p>""") |
477 .format(fname)) |
488 .format(fname)) |
478 |
489 |
479 def __copyImageToClipboard(self): |
490 def __copyImageToClipboard(self): |
480 """ |
491 """ |
481 Private slot to handle the Copy Image menu action. |
492 Private slot to handle the Copy Image menu action. |
482 """ |
493 """ |
483 if self.mainWidget is None: |
494 if self.mainWidget is None: |
484 E5MessageBox.critical(self, |
495 E5MessageBox.critical( |
|
496 self, |
485 self.trUtf8("Save Image"), |
497 self.trUtf8("Save Image"), |
486 self.trUtf8("""There is no UI file loaded.""")) |
498 self.trUtf8("""There is no UI file loaded.""")) |
487 return |
499 return |
488 |
500 |
489 cb = QApplication.clipboard() |
501 cb = QApplication.clipboard() |