src/eric7/WebBrowser/SpeedDial/PageThumbnailer.py

branch
eric7
changeset 10436
f6881d10e995
parent 9653
e67609152c5e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10435:c712d09cc839 10436:f6881d10e995
24 24
25 def __init__(self, parent=None): 25 def __init__(self, parent=None):
26 """ 26 """
27 Constructor 27 Constructor
28 28
29 @param parent reference to the parent object (QObject) 29 @param parent reference to the parent object
30 @type QObject
30 """ 31 """
31 super().__init__(parent) 32 super().__init__(parent)
32 33
33 self.__size = QSize(231, 130) 34 self.__size = QSize(231, 130)
34 self.__loadTitle = False 35 self.__loadTitle = False
42 43
43 def setSize(self, size): 44 def setSize(self, size):
44 """ 45 """
45 Public method to set the size of the image. 46 Public method to set the size of the image.
46 47
47 @param size size of the image (QSize) 48 @param size size of the image
49 @type QSize
48 """ 50 """
49 if size.isValid(): 51 if size.isValid():
50 self.__size = QSize(size) 52 self.__size = QSize(size)
51 53
52 def setUrl(self, url): 54 def setUrl(self, url):
53 """ 55 """
54 Public method to set the URL of the site to be thumbnailed. 56 Public method to set the URL of the site to be thumbnailed.
55 57
56 @param url URL of the web site (QUrl) 58 @param url URL of the web site
59 @type QUrl
57 """ 60 """
58 if url.isValid(): 61 if url.isValid():
59 self.__url = QUrl(url) 62 self.__url = QUrl(url)
60 63
61 def url(self): 64 def url(self):
62 """ 65 """
63 Public method to get the URL of the thumbnail. 66 Public method to get the URL of the thumbnail.
64 67
65 @return URL of the thumbnail (QUrl) 68 @return URL of the thumbnail
69 @rtype QUrl
66 """ 70 """
67 return QUrl(self.__url) 71 return QUrl(self.__url)
68 72
69 def loadTitle(self): 73 def loadTitle(self):
70 """ 74 """
71 Public method to check, if the title is loaded from the web site. 75 Public method to check, if the title is loaded from the web site.
72 76
73 @return flag indicating, that the title is loaded (boolean) 77 @return flag indicating, that the title is loaded
78 @rtype bool
74 """ 79 """
75 return self.__loadTitle 80 return self.__loadTitle
76 81
77 def setLoadTitle(self, load): 82 def setLoadTitle(self, load):
78 """ 83 """
79 Public method to set a flag indicating to load the title from 84 Public method to set a flag indicating to load the title from
80 the web site. 85 the web site.
81 86
82 @param load flag indicating to load the title (boolean) 87 @param load flag indicating to load the title
88 @type bool
83 """ 89 """
84 self.__loadTitle = load 90 self.__loadTitle = load
85 91
86 def title(self): 92 def title(self):
87 """ 93 """
88 Public method to get the title of the thumbnail. 94 Public method to get the title of the thumbnail.
89 95
90 @return title of the thumbnail (string) 96 @return title of the thumbnail
97 @rtype str
91 """ 98 """
92 title = self.__title if self.__title else self.__url.host() 99 title = self.__title if self.__title else self.__url.host()
93 if not title: 100 if not title:
94 title = self.__url.toString() 101 title = self.__url.toString()
95 return title 102 return title
104 def __createThumbnail(self, status): 111 def __createThumbnail(self, status):
105 """ 112 """
106 Private slot creating the thumbnail of the web site. 113 Private slot creating the thumbnail of the web site.
107 114
108 @param status flag indicating a successful load of the web site 115 @param status flag indicating a successful load of the web site
109 (boolean) 116 @type bool
110 """ 117 """
111 if not status: 118 if not status:
112 self.thumbnailCreated.emit(QPixmap()) 119 self.thumbnailCreated.emit(QPixmap())
113 return 120 return
114 121

eric ide

mercurial