eric6/Tools/UIPreviewer.py

changeset 7771
787a6b3f8c9f
parent 7761
ed2c67d20328
child 7781
607a6098cb44
equal deleted inserted replaced
7770:49f3377aebf1 7771:787a6b3f8c9f
7 Module implementing the UI Previewer main window. 7 Module implementing the UI Previewer main window.
8 """ 8 """
9 9
10 10
11 from PyQt5.QtCore import QDir, QFileInfo, QEvent, QSize, Qt 11 from PyQt5.QtCore import QDir, QFileInfo, QEvent, QSize, Qt
12 from PyQt5.QtGui import QCursor, QKeySequence, QImageWriter, QPainter 12 from PyQt5.QtGui import QKeySequence, QImageWriter, QPainter
13 from PyQt5.QtWidgets import ( 13 from PyQt5.QtWidgets import (
14 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QDialog, 14 QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QDialog,
15 QScrollArea, QApplication, QStyleFactory, QFrame, QMainWindow, 15 QScrollArea, QApplication, QStyleFactory, QFrame, QMainWindow,
16 QComboBox, QVBoxLayout, QAction, QLabel 16 QComboBox, QVBoxLayout, QAction, QLabel
17 ) 17 )
20 20
21 21
22 from E5Gui import E5MessageBox, E5FileDialog 22 from E5Gui import E5MessageBox, E5FileDialog
23 from E5Gui.E5MainWindow import E5MainWindow 23 from E5Gui.E5MainWindow import E5MainWindow
24 from E5Gui.E5Application import e5App 24 from E5Gui.E5Application import e5App
25 from E5Gui.E5OverrideCursor import E5OverrideCursor
25 26
26 import Preferences 27 import Preferences
27 import UI.PixmapCache 28 import UI.PixmapCache
28 import UI.Config 29 import UI.Config
29 30
374 """ 375 """
375 Private slot to change the style of the show UI. 376 Private slot to change the style of the show UI.
376 377
377 @param sstyle name of the selected style (string) 378 @param sstyle name of the selected style (string)
378 """ 379 """
379 QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) 380 with E5OverrideCursor():
380 qstyle = QStyleFactory.create(sstyle) 381 qstyle = QStyleFactory.create(sstyle)
381 self.mainWidget.setStyle(qstyle) 382 self.mainWidget.setStyle(qstyle)
382 383
383 lst = self.mainWidget.findChildren(QWidget) 384 lst = self.mainWidget.findChildren(QWidget)
384 for obj in lst: 385 for obj in lst:
385 try: 386 try:
386 obj.setStyle(qstyle) 387 obj.setStyle(qstyle)
387 except AttributeError: 388 except AttributeError:
388 pass 389 pass
389 del lst 390 del lst
390 391
391 self.mainWidget.hide() 392 self.mainWidget.hide()
392 self.mainWidget.show() 393 self.mainWidget.show()
393 394
394 self.lastQStyle = qstyle 395 self.lastQStyle = qstyle
395 self.lastStyle = sstyle 396 self.lastStyle = sstyle
396 Preferences.Prefs.settings.setValue( 397 Preferences.Prefs.settings.setValue(
397 'UIPreviewer/style', self.styleCombo.currentIndex()) 398 'UIPreviewer/style', self.styleCombo.currentIndex())
398 QApplication.restoreOverrideCursor()
399 399
400 def __updateActions(self): 400 def __updateActions(self):
401 """ 401 """
402 Private slot to update the actions state. 402 Private slot to update the actions state.
403 """ 403 """

eric ide

mercurial