WebBrowser/UserAgent/UserAgentModel.py

Tue, 29 Mar 2016 10:32:22 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 29 Mar 2016 10:32:22 +0200
branch
QtWebEngine
changeset 4906
939ff20f712d
parent 4631
Helpviewer/UserAgent/UserAgentModel.py@5c1a96925da4
child 5389
9b1c800daff3
permissions
-rw-r--r--

Continued porting the web browser.

- added the user agents manager

1596
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
4631
5c1a96925da4 Updated copyright for 2016.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
3 # Copyright (c) 2012 - 2016 Detlev Offenbach <detlev@die-offenbachs.de>
1596
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a model for user agent management.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
12 from PyQt5.QtCore import Qt, QModelIndex, QAbstractTableModel
1596
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 class UserAgentModel(QAbstractTableModel):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 Class implementing a model for user agent management.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 def __init__(self, manager, parent=None):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Constructor
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 @param manager reference to the user agent manager (UserAgentManager)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param parent reference to the parent object (QObject)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
26 super(UserAgentModel, self).__init__(parent)
1596
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 self.__manager = manager
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 self.__manager.changed.connect(self.__userAgentsChanged)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 self.__headers = [
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
32 self.tr("Host"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
33 self.tr("User Agent String"),
1596
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 ]
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 def __userAgentsChanged(self):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 Private slot handling a change of the registered user agent strings.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
40 self.beginResetModel()
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
41 self.endResetModel()
1596
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 def removeRows(self, row, count, parent=QModelIndex()):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 Public method to remove entries from the model.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @param row start row (integer)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 @param count number of rows to remove (integer)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @param parent parent index (QModelIndex)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 @return flag indicating success (boolean)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 if parent.isValid():
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 return False
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 if count <= 0:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 return False
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 lastRow = row + count - 1
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.beginRemoveRows(parent, row, lastRow)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 hostsList = self.__manager.allHostNames()
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 for index in range(row, lastRow + 1):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.__manager.removeUserAgent(hostsList[index])
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 return True
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 def rowCount(self, parent=QModelIndex()):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 Public method to get the number of rows of the model.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 @param parent parent index (QModelIndex)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @return number of rows (integer)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 if parent.isValid():
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 return 0
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 else:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 return self.__manager.hostsCount()
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 def columnCount(self, parent=QModelIndex()):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 Public method to get the number of columns of the model.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 @param parent parent index (QModelIndex)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 @return number of columns (integer)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 return len(self.__headers)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 def data(self, index, role):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 Public method to get data from the model.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 @param index index to get data for (QModelIndex)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 @param role role of the data to retrieve (integer)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 @return requested data
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 if index.row() >= self.__manager.hostsCount() or index.row() < 0:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 return None
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 host = self.__manager.allHostNames()[index.row()]
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 userAgent = self.__manager.userAgent(host)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 if userAgent is None:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 return None
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 if role == Qt.DisplayRole:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 if index.column() == 0:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 return host
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 elif index.column() == 1:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 return userAgent
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 return None
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 def headerData(self, section, orientation, role=Qt.DisplayRole):
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 Public method to get the header data.
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 @param section section number (integer)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 @param orientation header orientation (Qt.Orientation)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 @param role data role (integer)
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 @return header data
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 """
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 if orientation == Qt.Horizontal and role == Qt.DisplayRole:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 try:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 return self.__headers[section]
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 except IndexError:
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 pass
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128
8d59e4f3c828 Extended the User Agent handling to be able to set the string on a host basis (next to the global user agent string).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 return None

eric ide

mercurial