src/eric7/EricGui/EricPixmapCache.py

Sat, 26 Apr 2025 12:34:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 26 Apr 2025 12:34:32 +0200
branch
eric7
changeset 11240
c48c615c04a3
parent 11090
f5f5f5803935
permissions
-rw-r--r--

MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
11090
f5f5f5803935 Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10689
diff changeset
3 # Copyright (c) 2004 - 2025 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a pixmap cache for icons.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
12 from PyQt6.QtCore import QSize, Qt
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
13 from PyQt6.QtGui import QIcon, QPainter, QPixmap
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
15
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
16 class EricPixmapCache:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 Class implementing a pixmap cache for icons.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
20
10671
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
21 SupportedExtensionsVector = [".svgz", ".svg"]
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
22 SupportedExtensionsPixel = [".png"]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
23
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 def __init__(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
28 self.EricPixmapCache = {}
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 self.searchPath = []
10671
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
30 self.__extensions = (
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
31 EricPixmapCache.SupportedExtensionsVector
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
32 + EricPixmapCache.SupportedExtensionsPixel
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
33 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
35 def getPixmap(self, key, size=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 Public method to retrieve a pixmap.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
39 @param key name of the wanted pixmap
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
40 @type str
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
41 @param size requested size (defaults to None)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
42 @type QSize (optional)
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
43 @return the requested pixmap
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
44 @rtype QPixmap
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 if key:
10689
3ede487187f2 Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10676
diff changeset
47 basename, _ext = os.path.splitext(key)
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
48 if size and not size.isEmpty():
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
49 key = "{0}_{1}_{2}".format(basename, size.width(), size.height())
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
50 else:
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
51 key = basename
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
52
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 try:
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
54 return self.EricPixmapCache[key]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 except KeyError:
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
56 pm = QPixmap()
10671
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
57 for extension in self.__extensions:
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
58 filename = basename + extension
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
59 if not os.path.isabs(filename):
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
60 for path in self.searchPath:
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
61 pm = QPixmap(path + "/" + filename)
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
62 if not pm.isNull():
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
63 break
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 else:
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
65 pm = QPixmap(filename)
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
66 if not pm.isNull():
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
67 if size and not size.isEmpty():
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
68 pm = pm.scaled(size)
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
69 break
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 else:
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
71 pm = QPixmap()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
72
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
73 self.EricPixmapCache[key] = pm
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
74 return self.EricPixmapCache[key]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 return QPixmap()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 def addSearchPath(self, path):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 Public method to add a path to the search path.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
81
7488
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
82 @param path path to add
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
83 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
85 if path not in self.searchPath:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.searchPath.append(path)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87
7488
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
88 def removeSearchPath(self, path):
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
89 """
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
90 Public method to remove a path from the search path.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91
7488
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
92 @param path path to remove
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
93 @type str
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
94 """
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
95 if path in self.searchPath:
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
96 self.searchPath.remove(path)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
10671
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
98 def setPreferVectorIcons(self, vectorFirst=True):
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
99 """
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
100 Public method to set the preference of vector based icons.
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
101
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
102 @param vectorFirst flag indicating the preference of vector icons
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
103 (defaults to True)
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
104 @type bool (optional)
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
105 """
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
106 self.__extensions = (
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
107 EricPixmapCache.SupportedExtensionsVector
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
108 + EricPixmapCache.SupportedExtensionsPixel
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
109 if vectorFirst
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
110 else EricPixmapCache.SupportedExtensionsPixel
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
111 + EricPixmapCache.SupportedExtensionsVector
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
112 )
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
113
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
115 pixCache = EricPixmapCache()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
117
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
118 def getPixmap(key, size=None, cache=pixCache):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 Module function to retrieve a pixmap.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
122 @param key name of the wanted pixmap
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
123 @type str
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
124 @param size requested size (defaults to None)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
125 @type QSize (optional)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
126 @param cache reference to the pixmap cache object (defaults to pixCache)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
127 @type EricPixmapCache (optional)
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
128 @return the requested pixmap
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
129 @rtype QPixmap
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 """
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
131 return cache.getPixmap(key, size=size)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
133
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
134 def getIcon(key, size=None, cache=pixCache):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 Module function to retrieve an icon.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
138 @param key name of the wanted pixmap
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
139 @type str
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
140 @param size requested size (defaults to None)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
141 @type QSize (optional)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
142 @param cache reference to the pixmap cache object (defaults to pixCache)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
143 @type EricPixmapCache (optional)
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
144 @return the requested icon
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
145 @rtype QIcon
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 """
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
147 return QIcon(cache.getPixmap(key, size=size))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
149
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
150 def getSymlinkIcon(key, size=None, cache=pixCache):
103
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
151 """
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
152 Module function to retrieve a symbolic link icon.
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
153
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
154 @param key name of the wanted pixmap
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
155 @type str
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
156 @param size requested size (defaults to None)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
157 @type QSize (optional)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
158 @param cache reference to the pixmap cache object (defaults to pixCache)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
159 @type EricPixmapCache (optional)
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
160 @return the requested icon
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
161 @rtype QIcon
103
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
162 """
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
163 pix1 = QPixmap(cache.getPixmap(key, size=size))
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7488
diff changeset
164 pix2 = cache.getPixmap("symlink")
103
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
165 painter = QPainter(pix1)
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
166 painter.drawPixmap(0, 10, pix2)
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
167 painter.end()
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
168 return QIcon(pix1)
59137afca666 Added code to indicate directories and files being symbolic links.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
169
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
170
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
171 def getCombinedIcon(keys, size=None, cache=pixCache):
3270
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
172 """
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
173 Module function to retrieve a symbolic link icon.
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
174
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
175 @param keys list of names of icons
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
176 @type list of str
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
177 @param size requested size of individual icons (defaults to None)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
178 @type QSize (optional)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
179 @param cache reference to the pixmap cache object (defaults to pixCache)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
180 @type EricPixmapCache (optional)
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
181 @return the requested icon
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
182 @rtype QIcon
3270
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
183 """
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
184 height = width = 0
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
185 pixmaps = []
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
186 for key in keys:
6756
7556c951dce8 PixmapCache: prepared the pixmap cache to be able to load SVG files. Order of precedence is .svgz, .svg and .png. The key is calculated from the basename and the size.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
187 pix = cache.getPixmap(key, size=size)
3270
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
188 if not pix.isNull():
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
189 height = max(height, pix.height())
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
190 width = max(width, pix.width())
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
191 pixmaps.append(pix)
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
192 if pixmaps:
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
193 pix = QPixmap(len(pixmaps) * width, height)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
194 pix.fill(Qt.GlobalColor.transparent)
3270
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
195 painter = QPainter(pix)
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
196 x = 0
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
197 for pixmap in pixmaps:
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
198 painter.drawPixmap(x, 0, pixmap.scaled(QSize(width, height)))
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
199 x += width
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
200 painter.end()
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
201 icon = QIcon(pix)
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
202 else:
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
203 icon = QIcon()
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
204 return icon
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
205
d8532d902e76 Extended Tabview and Listview to show an editor's state using two icons (modified, syntax error/warning).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
206
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
207 def addSearchPath(path, cache=pixCache):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 Module function to add a path to the search path.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210
7488
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
211 @param path path to add
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
212 @type str
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
213 @param cache reference to the pixmap cache object (defaults to pixCache)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
214 @type EricPixmapCache (optional)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 cache.addSearchPath(path)
7488
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
217
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
218
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
219 def removeSearchPath(path, cache=pixCache):
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
220 """
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
221 Public method to remove a path from the search path.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
222
7488
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
223 @param path path to remove
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
224 @type str
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
225 @param cache reference to the pixmap cache object (defaults to pixCache)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
226 @type EricPixmapCache (optional)
7488
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
227 """
36ec7469f492 PixmapCache: added a method to remove a path from the pixmap search path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
228 cache.removeSearchPath(path)
10671
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
229
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
230
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
231 def setPreferVectorIcons(vectorFirst=True, cache=pixCache):
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
232 """
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
233 Function to set the preference of vector based icons.
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
234
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
235 @param vectorFirst flag indicating the preference of vector icons
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
236 (defaults to True)
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
237 @type bool (optional)
10676
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
238 @param cache reference to the pixmap cache object (defaults to pixCache)
d1479a4f1426 Corrected some code formatting and style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10671
diff changeset
239 @type EricPixmapCache (optional)
10671
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
240 """
f2d75784e574 Corrected an issue related to icon handling (see new entry on Icons configuration page).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
241 cache.setPreferVectorIcons(vectorFirst)

eric ide

mercurial