36 QLabel, |
36 QLabel, |
37 ) |
37 ) |
38 from PyQt6 import uic |
38 from PyQt6 import uic |
39 |
39 |
40 |
40 |
41 from EricWidgets import EricMessageBox, EricFileDialog |
41 from eric7.EricWidgets import EricMessageBox, EricFileDialog |
42 from EricWidgets.EricMainWindow import EricMainWindow |
42 from eric7.EricWidgets.EricMainWindow import EricMainWindow |
43 from EricWidgets.EricApplication import ericApp |
43 from eric7.EricWidgets.EricApplication import ericApp |
44 |
44 |
45 import UI.PixmapCache |
45 from eric7.EricGui import EricPixmapCache |
46 import UI.Config |
46 from eric7.UI import Config |
47 |
47 |
48 import Preferences |
48 from eric7 import Preferences |
49 |
49 |
50 |
50 |
51 noTranslationName = QCoreApplication.translate("TRPreviewer", "<No translation>") |
51 noTranslationName = QCoreApplication.translate("TRPreviewer", "<No translation>") |
52 |
52 |
53 |
53 |
76 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
76 self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) |
77 |
77 |
78 self.resize(QSize(800, 600).expandedTo(self.minimumSizeHint())) |
78 self.resize(QSize(800, 600).expandedTo(self.minimumSizeHint())) |
79 self.statusBar() |
79 self.statusBar() |
80 |
80 |
81 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
81 self.setWindowIcon(EricPixmapCache.getIcon("eric")) |
82 self.setWindowTitle(self.tr("Translations Previewer")) |
82 self.setWindowTitle(self.tr("Translations Previewer")) |
83 |
83 |
84 self.cw = QWidget(self) |
84 self.cw = QWidget(self) |
85 self.cw.setObjectName("qt_central_widget") |
85 self.cw.setObjectName("qt_central_widget") |
86 |
86 |
177 def __initActions(self): |
177 def __initActions(self): |
178 """ |
178 """ |
179 Private method to define the user interface actions. |
179 Private method to define the user interface actions. |
180 """ |
180 """ |
181 self.openUIAct = QAction( |
181 self.openUIAct = QAction( |
182 UI.PixmapCache.getIcon("openUI"), self.tr("&Open UI Files..."), self |
182 EricPixmapCache.getIcon("openUI"), self.tr("&Open UI Files..."), self |
183 ) |
183 ) |
184 self.openUIAct.setStatusTip(self.tr("Open UI files for display")) |
184 self.openUIAct.setStatusTip(self.tr("Open UI files for display")) |
185 self.openUIAct.setWhatsThis( |
185 self.openUIAct.setWhatsThis( |
186 self.tr( |
186 self.tr( |
187 """<b>Open UI Files</b>""" |
187 """<b>Open UI Files</b>""" |
189 ) |
189 ) |
190 ) |
190 ) |
191 self.openUIAct.triggered.connect(self.__openWidget) |
191 self.openUIAct.triggered.connect(self.__openWidget) |
192 |
192 |
193 self.openQMAct = QAction( |
193 self.openQMAct = QAction( |
194 UI.PixmapCache.getIcon("openQM"), |
194 EricPixmapCache.getIcon("openQM"), |
195 self.tr("Open &Translation Files..."), |
195 self.tr("Open &Translation Files..."), |
196 self, |
196 self, |
197 ) |
197 ) |
198 self.openQMAct.setStatusTip(self.tr("Open Translation files for display")) |
198 self.openQMAct.setStatusTip(self.tr("Open Translation files for display")) |
199 self.openQMAct.setWhatsThis( |
199 self.openQMAct.setWhatsThis( |
203 ) |
203 ) |
204 ) |
204 ) |
205 self.openQMAct.triggered.connect(self.__openTranslation) |
205 self.openQMAct.triggered.connect(self.__openTranslation) |
206 |
206 |
207 self.reloadAct = QAction( |
207 self.reloadAct = QAction( |
208 UI.PixmapCache.getIcon("reload"), self.tr("&Reload Translations"), self |
208 EricPixmapCache.getIcon("reload"), self.tr("&Reload Translations"), self |
209 ) |
209 ) |
210 self.reloadAct.setStatusTip(self.tr("Reload the loaded translations")) |
210 self.reloadAct.setStatusTip(self.tr("Reload the loaded translations")) |
211 self.reloadAct.setWhatsThis( |
211 self.reloadAct.setWhatsThis( |
212 self.tr( |
212 self.tr( |
213 """<b>Reload Translations</b>""" |
213 """<b>Reload Translations</b>""" |
215 """ languages.</p>""" |
215 """ languages.</p>""" |
216 ) |
216 ) |
217 ) |
217 ) |
218 self.reloadAct.triggered.connect(self.translations.reload) |
218 self.reloadAct.triggered.connect(self.translations.reload) |
219 |
219 |
220 self.exitAct = QAction(UI.PixmapCache.getIcon("exit"), self.tr("&Quit"), self) |
220 self.exitAct = QAction(EricPixmapCache.getIcon("exit"), self.tr("&Quit"), self) |
221 self.exitAct.setShortcut(QKeySequence(self.tr("Ctrl+Q", "File|Quit"))) |
221 self.exitAct.setShortcut(QKeySequence(self.tr("Ctrl+Q", "File|Quit"))) |
222 self.exitAct.setStatusTip(self.tr("Quit the application")) |
222 self.exitAct.setStatusTip(self.tr("Quit the application")) |
223 self.exitAct.setWhatsThis( |
223 self.exitAct.setWhatsThis( |
224 self.tr("""<b>Quit</b>""" """<p>Quit the application.</p>""") |
224 self.tr("""<b>Quit</b>""" """<p>Quit the application.</p>""") |
225 ) |
225 ) |
226 self.exitAct.triggered.connect(ericApp().closeAllWindows) |
226 self.exitAct.triggered.connect(ericApp().closeAllWindows) |
227 |
227 |
228 self.whatsThisAct = QAction( |
228 self.whatsThisAct = QAction( |
229 UI.PixmapCache.getIcon("whatsThis"), self.tr("&What's This?"), self |
229 EricPixmapCache.getIcon("whatsThis"), self.tr("&What's This?"), self |
230 ) |
230 ) |
231 self.whatsThisAct.setShortcut(QKeySequence(self.tr("Shift+F1"))) |
231 self.whatsThisAct.setShortcut(QKeySequence(self.tr("Shift+F1"))) |
232 self.whatsThisAct.setStatusTip(self.tr("Context sensitive help")) |
232 self.whatsThisAct.setStatusTip(self.tr("Context sensitive help")) |
233 self.whatsThisAct.setWhatsThis( |
233 self.whatsThisAct.setWhatsThis( |
234 self.tr( |
234 self.tr( |
285 ) |
285 ) |
286 ) |
286 ) |
287 self.cascadeAct.triggered.connect(self.preview.cascadeSubWindows) |
287 self.cascadeAct.triggered.connect(self.preview.cascadeSubWindows) |
288 |
288 |
289 self.closeAct = QAction( |
289 self.closeAct = QAction( |
290 UI.PixmapCache.getIcon("close"), self.tr("&Close"), self |
290 EricPixmapCache.getIcon("close"), self.tr("&Close"), self |
291 ) |
291 ) |
292 self.closeAct.setShortcut(QKeySequence(self.tr("Ctrl+W", "File|Close"))) |
292 self.closeAct.setShortcut(QKeySequence(self.tr("Ctrl+W", "File|Close"))) |
293 self.closeAct.setStatusTip(self.tr("Close the current window")) |
293 self.closeAct.setStatusTip(self.tr("Close the current window")) |
294 self.closeAct.setWhatsThis( |
294 self.closeAct.setWhatsThis( |
295 self.tr("""<b>Close Window</b>""" """<p>Close the current window.</p>""") |
295 self.tr("""<b>Close Window</b>""" """<p>Close the current window.</p>""") |
337 def __initToolbars(self): |
337 def __initToolbars(self): |
338 """ |
338 """ |
339 Private method to create the toolbars. |
339 Private method to create the toolbars. |
340 """ |
340 """ |
341 filetb = self.addToolBar(self.tr("File")) |
341 filetb = self.addToolBar(self.tr("File")) |
342 filetb.setIconSize(UI.Config.ToolBarIconSize) |
342 filetb.setIconSize(Config.ToolBarIconSize) |
343 filetb.addAction(self.openUIAct) |
343 filetb.addAction(self.openUIAct) |
344 filetb.addAction(self.openQMAct) |
344 filetb.addAction(self.openQMAct) |
345 filetb.addAction(self.reloadAct) |
345 filetb.addAction(self.reloadAct) |
346 filetb.addSeparator() |
346 filetb.addSeparator() |
347 filetb.addAction(self.closeAct) |
347 filetb.addAction(self.closeAct) |
348 filetb.addSeparator() |
348 filetb.addSeparator() |
349 filetb.addAction(self.exitAct) |
349 filetb.addAction(self.exitAct) |
350 |
350 |
351 helptb = self.addToolBar(self.tr("Help")) |
351 helptb = self.addToolBar(self.tr("Help")) |
352 helptb.setIconSize(UI.Config.ToolBarIconSize) |
352 helptb.setIconSize(Config.ToolBarIconSize) |
353 helptb.addAction(self.whatsThisAct) |
353 helptb.addAction(self.whatsThisAct) |
354 |
354 |
355 def __whatsThis(self): |
355 def __whatsThis(self): |
356 """ |
356 """ |
357 Private slot called in to enter Whats This mode. |
357 Private slot called in to enter Whats This mode. |