|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2004 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to preview the contents of an icon directory. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 import os.path |
|
13 |
|
14 from PyQt5.QtGui import QIcon |
|
15 from PyQt5.QtWidgets import QListWidgetItem, QDialog |
|
16 from PyQt5.QtCore import QDir |
|
17 |
|
18 from .Ui_IconsPreviewDialog import Ui_IconsPreviewDialog |
|
19 |
|
20 |
|
21 class IconsPreviewDialog(QDialog, Ui_IconsPreviewDialog): |
|
22 """ |
|
23 Class implementing a dialog to preview the contents of an icon directory. |
|
24 """ |
|
25 def __init__(self, parent, dirName): |
|
26 """ |
|
27 Constructor |
|
28 |
|
29 @param parent parent widget (QWidget) |
|
30 @param dirName name of directory to show (string) |
|
31 """ |
|
32 super(IconsPreviewDialog, self).__init__(parent) |
|
33 self.setupUi(self) |
|
34 |
|
35 directory = QDir(dirName) |
|
36 for icon in directory.entryList(["*.png"]): |
|
37 QListWidgetItem( |
|
38 QIcon(os.path.join(dirName, icon)), |
|
39 icon, self.iconView) |