eric7/Tools/TRPreviewer.py

branch
eric7
changeset 9152
8a68afaf1ba2
parent 8881
54e42bc2437a
equal deleted inserted replaced
9151:8c5296fe3056 9152:8a68afaf1ba2
6 """ 6 """
7 Module implementing the TR Previewer main window. 7 Module implementing the TR Previewer main window.
8 """ 8 """
9 9
10 import os 10 import os
11 import pathlib
11 import contextlib 12 import contextlib
12 13
13 from PyQt6.QtCore import ( 14 from PyQt6.QtCore import (
14 QDir, QTimer, QFileInfo, pyqtSignal, QEvent, QSize, QTranslator, QObject, 15 QDir, QTimer, pyqtSignal, QEvent, QSize, QTranslator, QObject, Qt,
15 Qt, QCoreApplication 16 QCoreApplication
16 ) 17 )
17 from PyQt6.QtGui import QKeySequence, QAction 18 from PyQt6.QtGui import QKeySequence, QAction
18 from PyQt6.QtWidgets import ( 19 from PyQt6.QtWidgets import (
19 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QMdiArea, 20 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QMdiArea,
20 QApplication, QComboBox, QVBoxLayout, QLabel 21 QApplication, QComboBox, QVBoxLayout, QLabel
136 super().show() 137 super().show()
137 if self.filesToLoad: 138 if self.filesToLoad:
138 filenames, self.filesToLoad = (self.filesToLoad[:], []) 139 filenames, self.filesToLoad = (self.filesToLoad[:], [])
139 first = True 140 first = True
140 for fn in filenames: 141 for fn in filenames:
141 fi = QFileInfo(fn) 142 fpath = pathlib.Path(fn)
142 if fi.suffix().lower() == 'ui': 143 if fpath.suffix.lower() == '.ui':
143 self.preview.loadWidget(fn) 144 self.preview.loadWidget(fn)
144 elif fi.suffix().lower() == 'qm': 145 elif fpath.suffix.lower() == '.qm':
145 self.translations.add(fn, first) 146 self.translations.add(fn, first)
146 first = False 147 first = False
147 148
148 self.__updateActions() 149 self.__updateActions()
149 150

eric ide

mercurial