#  qt_icon_browser/__main__.py
#
#  Copyright 2025 Leon Dionne <ldionne@dridesign.sh.cn>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#
"""
Displays all possible built-in (theme) icons.
"""
import logging
from os.path import join, dirname
from signal import signal, SIGINT, SIGTERM
from functools import partial
from PyQt5 import uic
from PyQt5.QtCore import		pyqtSignal, pyqtSlot, QSize
from PyQt5.QtGui import			QKeySequence, QIcon
from PyQt5.QtWidgets import 	QApplication, QMainWindow, QShortcut, QStyle, \
								QLayout, QVBoxLayout, QGridLayout, \
								QTabWidget, QFrame, QPushButton

__version__ = "1.0.1"


STANDARD_ACTION_ICONS= [
	('address-book-new', 'The icon used for the action to create a new address book.'),
	('application-exit', 'The icon used for exiting an application. Typically this is seen in the application\'s menus as File->Quit.'),
	('appointment-new', 'The icon used for the action to create a new appointment in a calendaring application.'),
	('call-start', 'The icon used for initiating or accepting a call. Should be similar to the standard cellular call pickup icon, a green handset with ear and mouth pieces facing upward.'),
	('call-stop', 'The icon used for stopping a current call. Should be similar to the standard cellular call hangup icon, a red handset with ear and mouth pieces facing downward.'),
	('contact-new', 'The icon used for the action to create a new contact in an address book application.'),
	('document-new', 'The icon used for the action to create a new document.'),
	('document-open', 'The icon used for the action to open a document.'),
	('document-open-recent', 'The icon used for the action to open a document that was recently opened.'),
	('document-page-setup', 'The icon for the page setup action of a document editor.'),
	('document-print', 'The icon for the print action of an application.'),
	('document-print-preview', 'The icon for the print preview action of an application.'),
	('document-properties', 'The icon for the action to view the properties of a document in an application.'),
	('document-revert', 'The icon for the action of reverting to a previous version of a document.'),
	('document-save', 'The icon for the save action. Should be an arrow pointing down and toward a hard disk.'),
	('document-save-as', 'The icon for the save as action.'),
	('document-send', 'The icon for the send action. Should be an arrow pointing up and away from a hard disk.'),
	('edit-clear', 'The icon for the clear action.'),
	('edit-copy', 'The icon for the copy action.'),
	('edit-cut', 'The icon for the cut action.'),
	('edit-delete', 'The icon for the delete action.'),
	('edit-find', 'The icon for the find action.'),
	('edit-find-replace', 'The icon for the find and replace action.'),
	('edit-paste', 'The icon for the paste action.'),
	('edit-redo', 'The icon for the redo action.'),
	('edit-select-all', 'The icon for the select all action.'),
	('edit-undo', 'The icon for the undo action.'),
	('find-location', 'The icon used for the action of finding the user\'s physical location'),
	('folder-new', 'The icon for creating a new folder.'),
	('format-indent-less', 'The icon for the decrease indent formatting action.'),
	('format-indent-more', 'The icon for the increase indent formatting action.'),
	('format-justify-center', 'The icon for the center justification formatting action.'),
	('format-justify-fill', 'The icon for the fill justification formatting action.'),
	('format-justify-left', 'The icon for the left justification formatting action.'),
	('format-justify-right', 'The icon for the right justification action.'),
	('format-text-direction-ltr', 'The icon for the left-to-right text formatting action.'),
	('format-text-direction-rtl', 'The icon for the right-to-left formatting action.'),
	('format-text-bold', 'The icon for the bold text formatting action.'),
	('format-text-italic', 'The icon for the italic text formatting action.'),
	('format-text-underline', 'The icon for the underlined text formatting action.'),
	('format-text-strikethrough', 'The icon for the strikethrough text formatting action.'),
	('go-bottom', 'The icon for the go to bottom of a list action.'),
	('go-down', 'The icon for the go down in a list action.'),
	('go-first', 'The icon for the go to the first item in a list action.'),
	('go-home', 'The icon for the go to home location action.'),
	('go-jump', 'The icon for the jump to action.'),
	('go-last', 'The icon for the go to the last item in a list action.'),
	('go-next', 'The icon for the go to the next item in a list action.'),
	('go-previous', 'The icon for the go to the previous item in a list action.'),
	('go-top', 'The icon for the go to the top of a list action.'),
	('go-up', 'The icon for the go up in a list action.'),
	('help-about', 'The icon for the About item in the Help menu.'),
	('help-contents', 'The icon for Contents item in the Help menu.'),
	('help-faq', 'The icon for the FAQ item in the Help menu.'),
	('insert-image', 'The icon for the insert image action of an application.'),
	('insert-link', 'The icon for the insert link action of an application.'),
	('insert-object', 'The icon for the insert object action of an application.'),
	('insert-text', 'The icon for the insert text action of an application.'),
	('list-add', 'The icon for the add to list action.'),
	('list-remove', 'The icon for the remove from list action.'),
	('mail-forward', 'The icon for the forward action of an electronic mail application.'),
	('mail-mark-important', 'The icon for the mark as important action of an electronic mail application.'),
	('mail-mark-junk', 'The icon for the mark as junk action of an electronic mail application.'),
	('mail-mark-notjunk', 'The icon for the mark as not junk action of an electronic mail application.'),
	('mail-mark-read', 'The icon for the mark as read action of an electronic mail application.'),
	('mail-mark-unread', 'The icon for the mark as unread action of an electronic mail application.'),
	('mail-message-new', 'The icon for the compose new mail action of an electronic mail application.'),
	('mail-reply-all', 'The icon for the reply to all action of an electronic mail application.'),
	('mail-reply-sender', 'The icon for the reply to sender action of an electronic mail application.'),
	('mail-send', 'The icon for the send action of an electronic mail application.'),
	('mail-send-receive', 'The icon for the send and receive action of an electronic mail application.'),
	('media-eject', 'The icon for the eject action of a media player or file manager.'),
	('media-playback-pause', 'The icon for the pause action of a media player.'),
	('media-playback-start', 'The icon for the start playback action of a media player.'),
	('media-playback-stop', 'The icon for the stop action of a media player.'),
	('media-record', 'The icon for the record action of a media application.'),
	('media-seek-backward', 'The icon for the seek backward action of a media player.'),
	('media-seek-forward', 'The icon for the seek forward action of a media player.'),
	('media-skip-backward', 'The icon for the skip backward action of a media player.'),
	('media-skip-forward', 'The icon for the skip forward action of a media player.'),
	('object-flip-horizontal', 'The icon for the action to flip an object horizontally.'),
	('object-flip-vertical', 'The icon for the action to flip an object vertically.'),
	('object-rotate-left', 'The icon for the rotate left action performed on an object.'),
	('object-rotate-right', 'The icon for the rotate rigt action performed on an object.'),
	('process-stop', 'The icon used for the “Stop” action in applications with actions that may take a while to process, such as web page loading in a browser.'),
	('system-lock-screen', 'The icon used for the “Lock Screen” item in the desktop\'s panel application.'),
	('system-log-out', 'The icon used for the “Log Out” item in the desktop\'s panel application.'),
	('system-run', 'The icon used for the “Run Application...” item in the desktop\'s panel application.'),
	('system-search', 'The icon used for the “Search” item in the desktop\'s panel application.'),
	('system-reboot', 'The icon used for the “Reboot” item in the desktop\'s panel application.'),
	('system-shutdown', 'The icon used for the “Shutdown” item in the desktop\'s panel application.'),
	('tools-check-spelling', 'The icon used for the “Check Spelling” item in the application\'s “Tools” menu.'),
	('view-fullscreen', 'The icon used for the “Fullscreen” item in the application\'s “View” menu.'),
	('view-refresh', 'The icon used for the “Refresh” item in the application\'s “View” menu.'),
	('view-restore', 'The icon used by an application for leaving the fullscreen view, and returning to a normal windowed view.'),
	('view-sort-ascending', 'The icon used for the “Sort Ascending” item in the application\'s “View” menu, or in a button for changing the sort method for a list.'),
	('view-sort-descending', 'The icon used for the “Sort Descending” item in the application\'s “View” menu, or in a button for changing the sort method for a list.'),
	('window-close', 'The icon used for the “Close Window” item in the application\'s “Windows” menu.'),
	('window-new', 'The icon used for the “New Window” item in the application\'s “Windows” menu.'),
	('zoom-fit-best', 'The icon used for the “Best Fit” item in the application\'s “View” menu.'),
	('zoom-in', 'The icon used for the “Zoom in” item in the application\'s “View” menu.'),
	('zoom-original', 'The icon used for the “Original Size” item in the application\'s “View” menu.'),
	('zoom-out', 'The icon used for the “Zoom Out” item in the application\'s “View” menu.')
]

STANDARD_APPLICATION_ICONS= [
	('accessories-calculator', 'The icon used for the desktop\'s calculator accessory program.'),
	('accessories-character-map', 'The icon used for the desktop\'s international and extended text character accessory program.'),
	('accessories-dictionary', 'The icon used for the desktop\'s dictionary accessory program.'),
	('accessories-screenshot-tool', 'The icon used for the desktop\'s screenshot taking program.'),
	('accessories-text-editor', 'The icon used for the desktop\'s text editing accessory program.'),
	('help-browser', 'The icon used for the desktop\'s help browsing application.'),
	('multimedia-volume-control', 'The icon used for the desktop\'s hardware volume control application.'),
	('preferences-desktop-accessibility', 'The icon used for the desktop\'s accessibility preferences.'),
	('preferences-desktop-font', 'The icon used for the desktop\'s font preferences.'),
	('preferences-desktop-keyboard', 'The icon used for the desktop\'s keyboard preferences.'),
	('preferences-desktop-locale', 'The icon used for the desktop\'s locale preferences.'),
	('preferences-desktop-multimedia', 'The icon used for the desktop\'s multimedia preferences.'),
	('preferences-desktop-screensaver', 'The icon used for the desktop\'s screen saving preferences.'),
	('preferences-desktop-theme', 'The icon used for the desktop\'s theme preferences.'),
	('preferences-desktop-wallpaper', 'The icon used for the desktop\'s wallpaper preferences.'),
	('system-file-manager', 'The icon used for the desktop\'s file management application.'),
	('system-software-install', 'The icon used for the desktop\'s software installer application.'),
	('system-software-update', 'The icon used for the desktop\'s software updating application.'),
	('utilities-system-monitor', 'The icon used for the desktop\'s system resource monitor application.'),
	('utilities-terminal', 'The icon used for the desktop\'s terminal emulation application.')
]

STANDARD_CATEGORY_ICONS= [
	('applications-accessories', 'The icon for the “Accessories” sub-menu of the Programs menu.'),
	('applications-development', 'The icon for the “Programming” sub-menu of the Programs menu.'),
	('applications-engineering', 'The icon for the “Engineering” sub-menu of the Programs menu.'),
	('applications-games', 'The icon for the “Games” sub-menu of the Programs menu.'),
	('applications-graphics', 'The icon for the “Graphics” sub-menu of the Programs menu.'),
	('applications-internet', 'The icon for the “Internet” sub-menu of the Programs menu.'),
	('applications-multimedia', 'The icon for the “Multimedia” sub-menu of the Programs menu.'),
	('applications-office', 'The icon for the “Office” sub-menu of the Programs menu.'),
	('applications-other', 'The icon for the “Other” sub-menu of the Programs menu.'),
	('applications-science', 'The icon for the “Science” sub-menu of the Programs menu.'),
	('applications-system', 'The icon for the “System Tools” sub-menu of the Programs menu.'),
	('applications-utilities', 'The icon for the “Utilities” sub-menu of the Programs menu.'),
	('preferences-desktop', 'The icon for the “Desktop Preferences” category.'),
	('preferences-desktop-peripherals', 'The icon for the “Peripherals” sub-category of the “Desktop Preferences” category.'),
	('preferences-desktop-personal', 'The icon for the “Personal” sub-category of the “Desktop Preferences” category.'),
	('preferences-other', 'The icon for the “Other” preferences category.'),
	('preferences-system', 'The icon for the “System Preferences” category.'),
	('preferences-system-network', 'The icon for the “Network” sub-category of the “System Preferences” category.'),
	('system-help', 'The icon for the “Help” system category.'),
]

STANDARD_DEVICE_ICONS= [
	('audio-card', 'The icon used for the audio rendering device.'),
	('audio-input-microphone', 'The icon used for the microphone audio input device.'),
	('battery', 'The icon used for the system battery device.'),
	('camera-photo', 'The icon used for a digital still camera devices.'),
	('camera-video', 'The fallback icon for video cameras.'),
	('camera-web', 'The fallback icon for web cameras.'),
	('computer', 'The icon used for the computing device as a whole.'),
	('drive-harddisk', 'The icon used for hard disk drives.'),
	('drive-optical', 'The icon used for optical media drives such as CD and DVD.'),
	('drive-removable-media', 'The icon used for removable media drives.'),
	('input-gaming', 'The icon used for the gaming input device.'),
	('input-keyboard', 'The icon used for the keyboard input device.'),
	('input-mouse', 'The icon used for the mousing input device.'),
	('input-tablet', 'The icon used for graphics tablet input devices.'),
	('media-flash', 'The fallback icon used for flash media, such as memory stick and SD.'),
	('media-floppy', 'The icon used for physical floppy disk media.'),
	('media-optical', 'The icon used for physical optical media such as CD and DVD.'),
	('media-tape', 'The icon used for generic physical tape media.'),
	('modem', 'The icon used for modem devices.'),
	('multimedia-player', 'The icon used for generic multimedia playing devices.'),
	('network-wired', 'The icon used for wired network connections.'),
	('network-wireless', 'The icon used for wireless network connections.'),
	('pda', 'This is the fallback icon for Personal Digial Assistant devices. Primary use of this icon is for PDA devices connected to the PC. Connection medium is not an important aspect of the icon. The metaphor for this fallback icon should be a generic PDA device icon.'),
	('phone', 'This is the default fallback for phone devices. Primary use of this icon group is for phone devices which support connectivity to the PC. These may be VoIP, cellular, or possibly landline phones. The metaphor for this fallback should be a generic mobile phone device.'),
	('printer', 'The icon used for a printer device.'),
	('scanner', 'The icon used for a scanner device.'),
	('video-display', 'The icon used for the monitor that video gets displayed to.'),
]

STANDARD_EMBLEM_ICONS= [
	('emblem-default', 'The icon used as an emblem to specify the default selection of a printer for example.'),
	('emblem-documents', 'The icon used as an emblem for the directory where a user\'s documents are stored.'),
	('emblem-downloads', 'The icon used as an emblem for the directory where a user\'s downloads from the internet are stored.'),
	('emblem-favorite', 'The icon used as an emblem for files and directories that the user marks as favorites.'),
	('emblem-important', 'The icon used as an emblem for files and directories that are marked as important by the user.'),
	('emblem-mail', 'The icon used as an emblem to specify the directory where the user\'s electronic mail is stored.'),
	('emblem-photos', 'The icon used as an emblem to specify the directory where the user stores photographs.'),
	('emblem-readonly', 'The icon used as an emblem for files and directories which can not be written to by the user.'),
	('emblem-shared', 'The icon used as an emblem for files and directories that are shared to other users.'),
	('emblem-symbolic-link', 'The icon used as an emblem for files and direcotires that are links to other files or directories on the filesystem.'),
	('emblem-synchronized', 'The icon used as an emblem for files or directories that are configured to be synchronized to another device.'),
	('emblem-system', 'The icon used as an emblem for directories that contain system libraries, settings, and data.'),
	('emblem-unreadable', 'The icon used as an emblem for files and directories that are inaccessible.'),
]

STANDARD_EMOTION_ICONS= [
	('face-angel', 'The icon used for the 0:-) emote.'),
	('face-angry', 'The icon used for the X-( emote.'),
	('face-cool', 'The icon used for the B-) emote.'),
	('face-crying', 'The icon used for the :\' ( emote.'),
	('face-devilish', 'The icon used for the >:-) emote.'),
	('face-embarrassed', 'The icon used for the :-[ emote.'),
	('face-kiss', 'The icon used for the :-* emote.'),
	('face-laugh', 'The icon used for the :-)) emote.'),
	('face-monkey', 'The icon used for the :-(|) emote.'),
	('face-plain', 'The icon used for the :-| emote.'),
	('face-raspberry', 'The icon used for the :-P emote.'),
	('face-sad', 'The icon used for the :-( emote.'),
	('face-sick', 'The icon used for the :-& emote.'),
	('face-smile', 'The icon used for the :-) emote.'),
	('face-smile-big', 'The icon used for the :-D emote.'),
	('face-smirk', 'The icon used for the :-! emote.'),
	('face-surprise', 'The icon used for the :-0 emote.'),
	('face-tired', 'The icon used for the |-) emote.'),
	('face-uncertain', 'The icon used for the :-/ emote.'),
	('face-wink', 'The icon used for the ;-) emote.'),
	('face-worried', 'The icon used for the :-S emote.')
]

STANDARD_MIME_TYPE_ICONS= [
	('application-x-executable', 'The icon used for executable file types.'),
	('audio-x-generic', 'The icon used for generic audio file types.'),
	('font-x-generic', 'The icon used for generic font file types.'),
	('image-x-generic', 'The icon used for generic image file types.'),
	('package-x-generic', 'The icon used for generic package file types.'),
	('text-html', 'The icon used for HTML text file types.'),
	('text-x-generic', 'The icon used for generic text file types.'),
	('text-x-generic-template', 'The icon used for generic text templates.'),
	('text-x-script', 'The icon used for script file types, such as shell scripts.'),
	('video-x-generic', 'The icon used for generic video file types.'),
	('x-office-address-book', 'The icon used for generic address book file types.'),
	('x-office-calendar', 'The icon used for generic calendar file types.'),
	('x-office-document', 'The icon used for generic document and letter file types.'),
	('x-office-presentation', 'The icon used for generic presentation file types.'),
	('x-office-spreadsheet', 'The icon used for generic spreadsheet file types.'),
]

STANDARD_PLACE_ICONS= [
	('folder', 'The standard folder icon used to represent directories on local filesystems, mail folders, and other hierarchical groups.'),
	('folder-remote', 'The icon used for normal directories on a remote filesystem.'),
	('network-server', 'The icon used for individual host machines under the “Network Servers” place in the file manager.'),
	('network-workgroup', 'The icon for the “Network Servers” place in the desktop\'s file manager, and workgroups within the network.'),
	('start-here', 'The icon used by the desktop\'s main menu for accessing places, applications, and other features.'),
	('user-bookmarks', 'The icon for the user\'s special “Bookmarks” place.'),
	('user-desktop', 'The icon for the special “Desktop” directory of the user.'),
	('user-home', 'The icon for the special “Home” directory of the user.'),
	('user-trash', 'The icon for the user\'s “Trash” place in the desktop\'s file manager.'),
]

STANDARD_STATUS_ICONS= [
	('appointment-missed', 'The icon used when an appointment was missed.'),
	('appointment-soon', 'The icon used when an appointment will occur soon.'),
	('audio-volume-high', 'The icon used to indicate high audio volume.'),
	('audio-volume-low', 'The icon used to indicate low audio volume.'),
	('audio-volume-medium', 'The icon used to indicate medium audio volume.'),
	('audio-volume-muted', 'The icon used to indicate the muted state for audio playback.'),
	('battery-caution', 'The icon used when the battery is below 40%.'),
	('battery-low', 'The icon used when the battery is below 20%.'),
	('dialog-error', 'The icon used when a dialog is opened to explain an error condition to the user.'),
	('dialog-information', 'The icon used when a dialog is opened to give information to the user that may be pertinent to the requested action.'),
	('dialog-password', 'The icon used when a dialog requesting the authentication credentials for a user is opened.'),
	('dialog-question', 'The icon used when a dialog is opened to ask a simple question of the user.'),
	('dialog-warning', 'The icon used when a dialog is opened to warn the user of impending issues with the requested action.'),
	('folder-drag-accept', 'The icon used for a folder while an object is being dragged onto it, that is of a type that the directory can contain.'),
	('folder-open', 'The icon used for folders, while their contents are being displayed within the same window. This icon would normally be shown in a tree or list view, next to the main view of a folder\'s contents.'),
	('folder-visiting', 'The icon used for folders, while their contents are being displayed in another window. This icon would typically be used when using multiple windows to navigate the hierarchy, such as in Nautilus\'s spatial mode.'),
	('image-loading', 'The icon used when another image is being loaded, such as thumnails for larger images in the file manager.'),
	('image-missing', 'The icon used when another image could not be loaded.'),
	('mail-attachment', 'The icon used for an electronic mail that contains attachments.'),
	('mail-unread', 'The icon used for an electronic mail that is unread.'),
	('mail-read', 'The icon used for an electronic mail that is read.'),
	('mail-replied', 'The icon used for an electronic mail that has been replied to.'),
	('mail-signed', 'The icon used for an electronic mail that contains a signature.'),
	('mail-signed-verified', 'The icon used for an electronic mail that contains a signature which has also been verified by the security system.'),
	('media-playlist-repeat', 'The icon for the repeat mode of a media player.'),
	('media-playlist-shuffle', 'The icon for the shuffle mode of a media player.'),
	('network-error', 'The icon used when an error occurs trying to intialize the network connection of the computing device. This icon should be two computers, one in the background, with the screens of both computers, colored black, and with the theme\'s style element for errors, overlayed on top of the icon.'),
	('network-idle', 'The icon used when no data is being transmitted or received, while the computing device is connected to a network. This icon should be two computers, one in the background, with the screens of both computers, colored black.'),
	('network-offline', 'The icon used when the computing device is disconnected from the network. This icon should be a computer in the background, with a screen colored black, and the theme\'s icon element to show that a device is not accessible, in the foreground.'),
	('network-receive', 'The icon used when data is being received, while the computing device is connected to a network. This icon should be two computers, one in the background, with its screen colored green, and the screen of the computer in the foreground, colored black.'),
	('network-transmit', 'The icon used when data is being transmitted, while the computing device is connected to a network. This icon should be two computers, one in the background, with its screen colored black, and the screen of the computer in the foreground, colored green.'),
	('network-transmit-receive', 'The icon used data is being both transmitted and received simultaneously, while the computing device is connected to a network. This icon should be two computers, one in the background, with the screens of both computers, colored green.'),
	('printer-error', 'The icon used when an error occurs while attempting to print. This icon should be the theme\'s printer device icon, with the theme\'s style element for errors, overlayed on top of the icon.'),
	('printer-printing', 'The icon used while a print job is successfully being spooled to a printing device. This icon should be the theme\'s printer device icon, with a document emerging from the printing device.'),
	('security-high', 'The icon used to indicate that the security level of a connection is known to be secure, using strong encryption and a valid certificate.'),
	('security-medium', 'The icon used to indicate that the security level of a connection is presumed to be secure, using strong encryption, and a certificate that could not be automatically verified, but which the user has chosen to trust.'),
	('security-low', 'The icon used to indicate that the security level of a connection is presumed to be insecure, either by using weak encryption, or by using a certificate that the could not be automatically verified, and which the user has not chosent to trust.'),
	('software-update-available', 'The icon used when an update is available for software installed on the computing device, through the system software update program.'),
	('software-update-urgent', 'The icon used when an urgent update is available through the system software update program.'),
	('sync-error', 'The icon used when an error occurs while attempting to synchronize data from the computing device, to another device.'),
	('sync-synchronizing', 'The icon used while data is successfully synchronizing to another device.'),
	('task-due', 'The icon used when a task is due soon.'),
	('task-past-due', 'The icon used when a task that was due, has been left incomplete.'),
	('user-available', 'The icon used when a user on a chat network is available to initiate a conversation with.'),
	('user-away', 'The icon used when a user on a chat network is away from their keyboard and the chat program.'),
	('user-idle', 'The icon used when a user on a chat network has not been an active participant in any chats on the network, for an extended period of time.'),
	('user-offline', 'The icon used when a user on a chat network is not available.'),
	('user-trash-full', 'The icon for the user\'s “Trash” in the desktop\'s file manager, when there are items in the “Trash” waiting for disposal or recovery.'),
	('weather-clear', 'The icon used while the weather for a region is “clear skies”.'),
	('weather-clear-night', 'The icon used while the weather for a region is “clear skies” during the night.'),
	('weather-few-clouds', 'The icon used while the weather for a region is “partly cloudy”.'),
	('weather-few-clouds-night', 'The icon used while the weather for a region is “partly cloudy” during the night.'),
	('weather-fog', 'The icon used while the weather for a region is “foggy”.'),
	('weather-overcast', 'The icon used while the weather for a region is “overcast”.'),
	('weather-severe-alert', 'The icon used while a sever weather alert is in effect for a region.'),
	('weather-showers', 'The icon used while rain showers are occurring in a region.'),
	('weather-showers-scattered', 'The icon used while scattered rain showers are occurring in a region.'),
	('weather-snow', 'The icon used while snow showers are occurring in a region.'),
	('weather-storm', 'The icon used while storms are occurring in a region.'),
]

QT_STANDARD_PIXMAPS = [
	('QStyle.SP_TitleBarMinButton', QStyle.SP_TitleBarMinButton, 'Minimize button on title bars (e.g., in QMdiSubWindow).'),
	('QStyle.SP_TitleBarMenuButton', QStyle.SP_TitleBarMenuButton, 'Menu button on a title bar.'),
	('QStyle.SP_TitleBarMaxButton', QStyle.SP_TitleBarMaxButton, 'Maximize button on title bars.'),
	('QStyle.SP_TitleBarCloseButton', QStyle.SP_TitleBarCloseButton, 'Close button on title bars.'),
	('QStyle.SP_TitleBarNormalButton', QStyle.SP_TitleBarNormalButton, 'Normal (restore) button on title bars.'),
	('QStyle.SP_TitleBarShadeButton', QStyle.SP_TitleBarShadeButton, 'Shade button on title bars.'),
	('QStyle.SP_TitleBarUnshadeButton', QStyle.SP_TitleBarUnshadeButton, 'Unshade button on title bars.'),
	('QStyle.SP_TitleBarContextHelpButton', QStyle.SP_TitleBarContextHelpButton, 'The Context help button on title bars.'),
	('QStyle.SP_MessageBoxInformation', QStyle.SP_MessageBoxInformation, 'The "information" icon.'),
	('QStyle.SP_MessageBoxWarning', QStyle.SP_MessageBoxWarning, 'The "warning" icon.'),
	('QStyle.SP_MessageBoxCritical', QStyle.SP_MessageBoxCritical, 'The "critical" icon.'),
	('QStyle.SP_MessageBoxQuestion', QStyle.SP_MessageBoxQuestion, 'The "question" icon.'),
	('QStyle.SP_DesktopIcon', QStyle.SP_DesktopIcon, 'The "desktop" icon.'),
	('QStyle.SP_TrashIcon', QStyle.SP_TrashIcon, 'The "trash" icon.'),
	('QStyle.SP_ComputerIcon', QStyle.SP_ComputerIcon, 'The "My computer" icon.'),
	('QStyle.SP_DriveFDIcon', QStyle.SP_DriveFDIcon, 'The floppy icon.'),
	('QStyle.SP_DriveHDIcon', QStyle.SP_DriveHDIcon, 'The harddrive icon.'),
	('QStyle.SP_DriveCDIcon', QStyle.SP_DriveCDIcon, 'The CD icon.'),
	('QStyle.SP_DriveDVDIcon', QStyle.SP_DriveDVDIcon, 'The DVD icon.'),
	('QStyle.SP_DriveNetIcon', QStyle.SP_DriveNetIcon, 'The network icon.'),
	('QStyle.SP_DirHomeIcon', QStyle.SP_DirHomeIcon, 'The home directory icon.'),
	('QStyle.SP_DirOpenIcon', QStyle.SP_DirOpenIcon, 'The open directory icon.'),
	('QStyle.SP_DirClosedIcon', QStyle.SP_DirClosedIcon, 'The closed directory icon.'),
	('QStyle.SP_DirIcon', QStyle.SP_DirIcon, 'The directory icon.'),
	('QStyle.SP_DirLinkIcon', QStyle.SP_DirLinkIcon, 'The link to directory icon.'),
	('QStyle.SP_DirLinkOpenIcon', QStyle.SP_DirLinkOpenIcon, 'The link to open directory icon.'),
	('QStyle.SP_FileIcon', QStyle.SP_FileIcon, 'The file icon.'),
	('QStyle.SP_FileLinkIcon', QStyle.SP_FileLinkIcon, 'The link to file icon.'),
	('QStyle.SP_FileDialogStart', QStyle.SP_FileDialogStart, 'The "start" icon in a file dialog.'),
	('QStyle.SP_FileDialogEnd', QStyle.SP_FileDialogEnd, 'The "end" icon in a file dialog.'),
	('QStyle.SP_FileDialogToParent', QStyle.SP_FileDialogToParent, 'The "parent directory" icon in a file dialog.'),
	('QStyle.SP_FileDialogNewFolder', QStyle.SP_FileDialogNewFolder, 'The "create new folder" icon in a file dialog.'),
	('QStyle.SP_FileDialogDetailedView', QStyle.SP_FileDialogDetailedView, 'The detailed view icon in a file dialog.'),
	('QStyle.SP_FileDialogInfoView', QStyle.SP_FileDialogInfoView, 'The file info icon in a file dialog.'),
	('QStyle.SP_FileDialogContentsView', QStyle.SP_FileDialogContentsView, 'The contents view icon in a file dialog.'),
	('QStyle.SP_FileDialogListView', QStyle.SP_FileDialogListView, 'The list view icon in a file dialog.'),
	('QStyle.SP_FileDialogBack', QStyle.SP_FileDialogBack, 'The back arrow in a file dialog.'),
	('QStyle.SP_DockWidgetCloseButton', QStyle.SP_DockWidgetCloseButton, 'Close button on dock windows (see also QDockWidget).'),
	('QStyle.SP_ToolBarHorizontalExtensionButton', QStyle.SP_ToolBarHorizontalExtensionButton, 'Extension button for horizontal toolbars.'),
	('QStyle.SP_ToolBarVerticalExtensionButton', QStyle.SP_ToolBarVerticalExtensionButton, 'Extension button for vertical toolbars.'),
	('QStyle.SP_DialogOkButton', QStyle.SP_DialogOkButton, 'Icon for a standard OK button in a QDialogButtonBox.'),
	('QStyle.SP_DialogCancelButton', QStyle.SP_DialogCancelButton, 'Icon for a standard Cancel button in a QDialogButtonBox.'),
	('QStyle.SP_DialogHelpButton', QStyle.SP_DialogHelpButton, 'Icon for a standard Help button in a QDialogButtonBox.'),
	('QStyle.SP_DialogOpenButton', QStyle.SP_DialogOpenButton, 'Icon for a standard Open button in a QDialogButtonBox.'),
	('QStyle.SP_DialogSaveButton', QStyle.SP_DialogSaveButton, 'Icon for a standard Save button in a QDialogButtonBox.'),
	('QStyle.SP_DialogCloseButton', QStyle.SP_DialogCloseButton, 'Icon for a standard Close button in a QDialogButtonBox.'),
	('QStyle.SP_DialogApplyButton', QStyle.SP_DialogApplyButton, 'Icon for a standard Apply button in a QDialogButtonBox.'),
	('QStyle.SP_DialogResetButton', QStyle.SP_DialogResetButton, 'Icon for a standard Reset button in a QDialogButtonBox.'),
	('QStyle.SP_DialogDiscardButton', QStyle.SP_DialogDiscardButton, 'Icon for a standard Discard button in a QDialogButtonBox.'),
	('QStyle.SP_DialogYesButton', QStyle.SP_DialogYesButton, 'Icon for a standard Yes button in a QDialogButtonBox.'),
	('QStyle.SP_DialogNoButton', QStyle.SP_DialogNoButton, 'Icon for a standard No button in a QDialogButtonBox.'),
	('QStyle.SP_ArrowUp', QStyle.SP_ArrowUp, 'Icon arrow pointing up.'),
	('QStyle.SP_ArrowDown', QStyle.SP_ArrowDown, 'Icon arrow pointing down.'),
	('QStyle.SP_ArrowLeft', QStyle.SP_ArrowLeft, 'Icon arrow pointing left.'),
	('QStyle.SP_ArrowRight', QStyle.SP_ArrowRight, 'Icon arrow pointing right.'),
	('QStyle.SP_ArrowBack', QStyle.SP_ArrowBack, 'Equivalent to SP_ArrowLeft when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowRight.'),
	('QStyle.SP_ArrowForward', QStyle.SP_ArrowForward, 'Equivalent to SP_ArrowRight when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowLeft.'),
	('QStyle.SP_CommandLink', QStyle.SP_CommandLink, 'Icon used to indicate a Vista style command link glyph.'),
	('QStyle.SP_VistaShield', QStyle.SP_VistaShield, 'Icon used to indicate UAC prompts on Windows Vista. This will return a null pixmap or icon on all other platforms.'),
	('QStyle.SP_BrowserReload', QStyle.SP_BrowserReload, 'Icon indicating that the current page should be reloaded.'),
	('QStyle.SP_BrowserStop', QStyle.SP_BrowserStop, 'Icon indicating that the page loading should stop.'),
	('QStyle.SP_MediaPlay', QStyle.SP_MediaPlay, 'Icon indicating that media should begin playback.'),
	('QStyle.SP_MediaStop', QStyle.SP_MediaStop, 'Icon indicating that media should stop playback.'),
	('QStyle.SP_MediaPause', QStyle.SP_MediaPause, 'Icon indicating that media should pause playback.'),
	('QStyle.SP_MediaSkipForward', QStyle.SP_MediaSkipForward, 'Icon indicating that media should skip forward.'),
	('QStyle.SP_MediaSkipBackward', QStyle.SP_MediaSkipBackward, 'Icon indicating that media should skip backward.'),
	('QStyle.SP_MediaSeekForward', QStyle.SP_MediaSeekForward, 'Icon indicating that media should seek forward.'),
	('QStyle.SP_MediaSeekBackward', QStyle.SP_MediaSeekBackward, 'Icon indicating that media should seek backward.'),
	('QStyle.SP_MediaVolume', QStyle.SP_MediaVolume, 'Icon indicating a volume control.'),
	('QStyle.SP_MediaVolumeMuted', QStyle.SP_MediaVolumeMuted, 'Icon indicating a muted volume control.')
]

try:
	QT_STANDARD_PIXMAPS.extend([
		('QStyle.SP_LineEditClearButton', QStyle.SP_LineEditClearButton, 'Icon for a standard clear button in a QLineEdit. This enum value was added in Qt 5.2.')
	])
except AttributeError:
	pass

try:
	QT_STANDARD_PIXMAPS.extend([
		('QStyle.SP_DialogYesToAllButton', QStyle.SP_DialogYesToAllButton, 'Icon for a standard YesToAll button in a QDialogButtonBox. This enum value was added in Qt 5.14.'),
		('QStyle.SP_DialogNoToAllButton', QStyle.SP_DialogNoToAllButton, 'Icon for a standard NoToAll button in a QDialogButtonBox. This enum value was added in Qt 5.14.'),
		('QStyle.SP_DialogSaveAllButton', QStyle.SP_DialogSaveAllButton, 'Icon for a standard SaveAll button in a QDialogButtonBox. This enum value was added in Qt 5.14.'),
		('QStyle.SP_DialogAbortButton', QStyle.SP_DialogAbortButton, 'Icon for a standard Abort button in a QDialogButtonBox. This enum value was added in Qt 5.14.'),
		('QStyle.SP_DialogRetryButton', QStyle.SP_DialogRetryButton, 'Icon for a standard Retry button in a QDialogButtonBox. This enum value was added in Qt 5.14.'),
		('QStyle.SP_DialogIgnoreButton', QStyle.SP_DialogIgnoreButton, 'Icon for a standard Ignore button in a QDialogButtonBox. This enum value was added in Qt 5.14.'),
		('QStyle.SP_RestoreDefaultsButton', QStyle.SP_RestoreDefaultsButton, 'Icon for a standard RestoreDefaults button in a QDialogButtonBox. This enum value was added in Qt 5.14.'),
	])
except AttributeError:
	pass

DIR = [
	('Action', STANDARD_ACTION_ICONS),
	('Application', STANDARD_APPLICATION_ICONS),
	('Category', STANDARD_CATEGORY_ICONS),
	('Device', STANDARD_DEVICE_ICONS),
	('Emblem', STANDARD_EMBLEM_ICONS),
	('Emotion', STANDARD_EMOTION_ICONS),
	('MIME Type', STANDARD_MIME_TYPE_ICONS),
	('Place', STANDARD_PLACE_ICONS),
	('Status', STANDARD_STATUS_ICONS)
]


ICON_SIZE = 48


def copy_code(code):
	QApplication.instance().clipboard().setText(code)


class _PreviewFrame(QFrame):

	def __init__(self, parent, elems):
		super().__init__(parent)
		self.buttons = []
		self.create_buttons(elems)
		self.grid = QGridLayout()
		lo = QVBoxLayout()
		lo.addLayout(self.grid)
		lo.addStretch(10)
		self.setLayout(lo)


	def resizeEvent(self, event):
		cell_width = ICON_SIZE + 16
		columns = event.size().width() // cell_width
		while self.grid.count():
			self.grid.takeAt(self.grid.count() - 1)
		col = 0
		row = 0
		for btn in self.buttons:
			self.grid.addWidget(btn, row, col)
			col += 1
			if col == columns:
				col = 0
				row += 1


class IconFrame(_PreviewFrame):

	def create_buttons(self, elems):
		for icon in elems:
			btn = QPushButton('', self)
			btn.setIcon(QIcon.fromTheme(icon[0]))
			btn.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
			btn.setToolTip(f'{icon[0]}: {icon[1]}')
			btn.clicked.connect(partial(copy_code, f'QIcon.fromTheme("{icon[0]}")'))
			self.buttons.append(btn)


class PixmapFrame(_PreviewFrame):

	def create_buttons(self, elems):
		for pixmap in elems:
			btn = QPushButton('', self)
			btn.setIcon(QApplication.style().standardIcon(pixmap[1]))
			btn.setIconSize(QSize(ICON_SIZE, ICON_SIZE))
			btn.setToolTip(f'{pixmap[0]}: {pixmap[2]}')
			btn.clicked.connect(partial(copy_code, f'QApplication.style().standardIcon({pixmap[0]})'))
			self.buttons.append(btn)


class MainWindow(QMainWindow):

	def __init__(self):
		super().__init__()
		self.quit_shortcut = QShortcut(QKeySequence('Ctrl+Q'), self)
		self.quit_shortcut.activated.connect(self.close)
		signal(SIGINT, self.system_signal)
		signal(SIGTERM, self.system_signal)
		self.tabs = QTabWidget(self)
		self.setFixedWidth(640)
		self.tabs.setFixedWidth(640)
		self.setCentralWidget(self.tabs)
		for label, icons in DIR:
			self.tabs.addTab(IconFrame(self.tabs, icons), label)
		self.tabs.addTab(PixmapFrame(self.tabs, QT_STANDARD_PIXMAPS), 'Pixmaps')
		#self.layout().setSizeConstraint(QLayout.SetMinimumSize)

	# -----------------------------------------------------------------
	# Signal handler

	def system_signal(self, *_):
		self.close()


def main():
	app = QApplication([])
	window = MainWindow()
	window.show()
	app.exec()


if __name__ == "__main__":
	main()

#  end qt_icon_browser/__main__.py
