src/eric7/WebBrowser/SpeedDial/SpeedDial.py

branch
eric7
changeset 9482
a2bc06a54d9d
parent 9473
3f23dbf37dbe
child 9573
9960d19d66b5
equal deleted inserted replaced
9481:0b936ff1bbb9 9482:a2bc06a54d9d
22 from eric7 import Utilities 22 from eric7 import Utilities
23 from eric7.EricWidgets import EricMessageBox 23 from eric7.EricWidgets import EricMessageBox
24 from eric7.Utilities.AutoSaver import AutoSaver 24 from eric7.Utilities.AutoSaver import AutoSaver
25 25
26 from ..Tools.WebBrowserTools import pixmapFileToDataUrl 26 from ..Tools.WebBrowserTools import pixmapFileToDataUrl
27 from .Page import Page
27 28
28 29
29 class SpeedDial(QObject): 30 class SpeedDial(QObject):
30 """ 31 """
31 Class implementing the speed dial. 32 Class implementing the speed dial.
70 @param url URL of the page (QUrl) 71 @param url URL of the page (QUrl)
71 @param title title of the page (string) 72 @param title title of the page (string)
72 """ 73 """
73 if url.isEmpty(): 74 if url.isEmpty():
74 return 75 return
75
76 from .Page import Page
77 76
78 page = Page(self.__escapeUrl(url.toString()), self.__escapeTitle(title)) 77 page = Page(self.__escapeUrl(url.toString()), self.__escapeTitle(title))
79 self.__webPages.append(page) 78 self.__webPages.append(page)
80 self.__regenerateScript = True 79 self.__regenerateScript = True
81 80
174 173
175 def __load(self): 174 def __load(self):
176 """ 175 """
177 Private method to load the speed dial configuration. 176 Private method to load the speed dial configuration.
178 """ 177 """
178 from .SpeedDialReader import SpeedDialReader
179
179 allPages, pagesPerRow, speedDialSize = [], 0, 0 180 allPages, pagesPerRow, speedDialSize = [], 0, 0
180 181
181 speedDialFile = self.getFileName() 182 speedDialFile = self.getFileName()
182 if os.path.exists(speedDialFile): 183 if os.path.exists(speedDialFile):
183 from .SpeedDialReader import SpeedDialReader
184
185 reader = SpeedDialReader() 184 reader = SpeedDialReader()
186 allPages, pagesPerRow, speedDialSize = reader.read(speedDialFile) 185 allPages, pagesPerRow, speedDialSize = reader.read(speedDialFile)
187 186
188 self.__pagesPerRow = pagesPerRow if pagesPerRow else 4 187 self.__pagesPerRow = pagesPerRow if pagesPerRow else 4
189 self.__speedDialSize = speedDialSize if speedDialSize else 231 188 self.__speedDialSize = speedDialSize if speedDialSize else 231
265 264
266 for page in self.__webPages: 265 for page in self.__webPages:
267 if page.url == urlString: 266 if page.url == urlString:
268 return page 267 return page
269 268
270 from .Page import Page
271
272 return Page() 269 return Page()
273 270
274 def urlForShortcut(self, key): 271 def urlForShortcut(self, key):
275 """ 272 """
276 Public method to get the URL for the given shortcut key. 273 Public method to get the URL for the given shortcut key.
294 return 291 return
295 292
296 entries = allPages.split('";') 293 entries = allPages.split('";')
297 self.__webPages = [] 294 self.__webPages = []
298 self.__regenerateScript = True 295 self.__regenerateScript = True
299
300 from .Page import Page
301 296
302 for entry in entries: 297 for entry in entries:
303 if not entry: 298 if not entry:
304 continue 299 continue
305 300
327 322
328 @param url URL of the thumbnail (string) 323 @param url URL of the thumbnail (string)
329 @param loadTitle flag indicating to get the title for the thumbnail 324 @param loadTitle flag indicating to get the title for the thumbnail
330 from the site (boolean) 325 from the site (boolean)
331 """ 326 """
327 from .PageThumbnailer import PageThumbnailer
328
332 if not url: 329 if not url:
333 return 330 return
334
335 from .PageThumbnailer import PageThumbnailer
336 331
337 thumbnailer = PageThumbnailer(self) 332 thumbnailer = PageThumbnailer(self)
338 thumbnailer.setUrl(QUrl.fromEncoded(url.encode("utf-8"))) 333 thumbnailer.setUrl(QUrl.fromEncoded(url.encode("utf-8")))
339 thumbnailer.setLoadTitle(loadTitle) 334 thumbnailer.setLoadTitle(loadTitle)
340 thumbnailer.thumbnailCreated.connect( 335 thumbnailer.thumbnailCreated.connect(

eric ide

mercurial