5 |
5 |
6 """ |
6 """ |
7 Module implementing a class to manage closed tabs. |
7 Module implementing a class to manage closed tabs. |
8 """ |
8 """ |
9 |
9 |
|
10 from dataclasses import dataclass, field |
|
11 |
10 from PyQt6.QtCore import QObject, QUrl, pyqtSignal |
12 from PyQt6.QtCore import QObject, QUrl, pyqtSignal |
11 |
13 |
12 |
14 |
|
15 @dataclass |
13 class ClosedTab: |
16 class ClosedTab: |
14 """ |
17 """ |
15 Class implementing a structure to store data about a closed tab. |
18 Class implementing a structure to store data about a closed tab. |
16 """ |
19 """ |
17 |
20 |
18 def __init__(self, url=None, title="", position=-1): |
21 url: QUrl = field(default_factory=QUrl) |
19 """ |
22 title: str = "" |
20 Constructor |
23 position: int = -1 |
21 |
|
22 @param url URL of the closed tab (QUrl) |
|
23 @param title title of the closed tab (string) |
|
24 @param position index of the closed tab (integer) |
|
25 """ |
|
26 self.url = QUrl() if url is None else QUrl(url) |
|
27 self.title = title |
|
28 self.position = position |
|
29 |
|
30 def __eq__(self, other): |
|
31 """ |
|
32 Special method implementing the equality operator. |
|
33 |
|
34 @param other reference to the object to compare against (ClosedTab) |
|
35 @return flag indicating equality of the tabs (boolean) |
|
36 """ |
|
37 return ( |
|
38 self.url == other.url |
|
39 and self.title == other.title |
|
40 and self.position == other.position |
|
41 ) |
|
42 |
24 |
43 |
25 |
44 class ClosedTabsManager(QObject): |
26 class ClosedTabsManager(QObject): |
45 """ |
27 """ |
46 Class implementing a manager for closed tabs. |
28 Class implementing a manager for closed tabs. |