Skip to content

Commit

Permalink
Icons
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd committed Feb 13, 2025
1 parent 5f130eb commit f03be60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions siracusa.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ def __init__(self, file_path: str, pos: QtCore.QPointF, width = item_width, heig
self.is_folder = os.path.isdir(file_path)

file_info = QtCore.QFileInfo(file_path)
self.icon = icon_provider.icon(file_info)
if self.is_folder:
self.icon = QtGui.QIcon.fromTheme("folder")
else:
self.icon = icon_provider.icon(file_info)
icon_size = QtCore.QSize(32, 32)
self.pixmap = self.icon.pixmap(icon_size)
if self.pixmap.width() < icon_size.width() or self.pixmap.height() < icon_size.height():
Expand Down Expand Up @@ -1380,7 +1383,7 @@ def handle_drive_removal(self, drive):

app = QtWidgets.QApplication(sys.argv)

app.setWindowIcon(app.style().standardIcon(QtWidgets.QStyle.StandardPixmap.SP_DirIcon))
app.setWindowIcon(QtGui.QIcon.fromTheme("folder"))

# Output not only to the console but also to the GUI
try:
Expand Down
3 changes: 0 additions & 3 deletions styling.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ def apply_styling(app):
if "bold_italic" in fonts:
bold_italic_font = QtGui.QFont(fonts["bold_italic"], 9, QtGui.QFont.Weight.Bold, True)

# Disallow icons in buttons and menus
app.setAttribute(QtCore.Qt.ApplicationAttribute.AA_DontShowIconsInMenus)

# Set highlight color for selected items to blue
palette = app.palette()
palette.setColor(QtGui.QPalette.ColorRole.Highlight, QtGui.QColor(64, 64, 255))
Expand Down
5 changes: 4 additions & 1 deletion window_start_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
from PyQt6 import QtWidgets, QtGui, QtCore
from pylnk3 import Lnk

from styling import setup_icon_theme
setup_icon_theme()
icon_provider = QtWidgets.QFileIconProvider()

def resolve_shortcut(lnk_path):
try:
lnk = Lnk(lnk_path)
Expand All @@ -25,7 +29,6 @@ def load_icon(path, fallback_path=None):
if fallback_path:
expanded_fallback = os.path.expandvars(fallback_path)
if os.path.exists(expanded_fallback):
icon_provider = QtWidgets.QFileIconProvider()
return icon_provider.icon(QtCore.QFileInfo(expanded_fallback))
return QtGui.QIcon.fromTheme("application-x-executable")

Expand Down

0 comments on commit f03be60

Please sign in to comment.