Helpviewer/WebPlugins/ClickToFlash/ClickToFlash.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3484
645c12de6b0c
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
71 71
72 iconName = plugin.getIconName(mimeType) 72 iconName = plugin.getIconName(mimeType)
73 if iconName: 73 if iconName:
74 self.loadFlashButton.setIcon(UI.PixmapCache.getIcon(iconName)) 74 self.loadFlashButton.setIcon(UI.PixmapCache.getIcon(iconName))
75 else: 75 else:
76 self.loadFlashButton.setText(self.trUtf8("Load")) 76 self.loadFlashButton.setText(self.tr("Load"))
77 77
78 @pyqtSlot() 78 @pyqtSlot()
79 def on_loadFlashButton_clicked(self): 79 def on_loadFlashButton_clicked(self):
80 """ 80 """
81 Private slot handling the flash activation. 81 Private slot handling the flash activation.
85 def __showContextMenu(self): 85 def __showContextMenu(self):
86 """ 86 """
87 Private slot to show the context menu. 87 Private slot to show the context menu.
88 """ 88 """
89 menu = QMenu() 89 menu = QMenu()
90 act = menu.addAction(self.trUtf8("Object blocked by ClickToFlash")) 90 act = menu.addAction(self.tr("Object blocked by ClickToFlash"))
91 font = act.font() 91 font = act.font()
92 font.setBold(True) 92 font.setBold(True)
93 act.setFont(font) 93 act.setFont(font)
94 menu.addAction( 94 menu.addAction(
95 self.trUtf8("Show information about object"), self.__showInfo) 95 self.tr("Show information about object"), self.__showInfo)
96 menu.addSeparator() 96 menu.addSeparator()
97 menu.addAction(self.trUtf8("Load"), self.__load) 97 menu.addAction(self.tr("Load"), self.__load)
98 menu.addAction(self.trUtf8("Delete object"), self.__hideAdBlocked) 98 menu.addAction(self.tr("Delete object"), self.__hideAdBlocked)
99 menu.addSeparator() 99 menu.addSeparator()
100 host = self.__url.host() 100 host = self.__url.host()
101 add = menu.addAction( 101 add = menu.addAction(
102 self.trUtf8("Add '{0}' to Whitelist").format(host), 102 self.tr("Add '{0}' to Whitelist").format(host),
103 self.__addToWhitelist) 103 self.__addToWhitelist)
104 remove = menu.addAction( 104 remove = menu.addAction(
105 self.trUtf8("Remove '{0}' from Whitelist").format(host), 105 self.tr("Remove '{0}' from Whitelist").format(host),
106 self.__removeFromWhitelist) 106 self.__removeFromWhitelist)
107 onWhitelist = self.__plugin.onWhitelist(host) 107 onWhitelist = self.__plugin.onWhitelist(host)
108 add.setEnabled(not onWhitelist) 108 add.setEnabled(not onWhitelist)
109 remove.setEnabled(onWhitelist) 109 remove.setEnabled(onWhitelist)
110 menu.addSeparator() 110 menu.addSeparator()
111 menu.addAction(self.trUtf8("Configure Whitelist"), self.__configure) 111 menu.addAction(self.tr("Configure Whitelist"), self.__configure)
112 menu.actions()[0].setEnabled(False) 112 menu.actions()[0].setEnabled(False)
113 113
114 menu.exec_(QCursor.pos()) 114 menu.exec_(QCursor.pos())
115 115
116 def swapping(self): 116 def swapping(self):
254 def __showInfo(self): 254 def __showInfo(self):
255 """ 255 """
256 Private slot to show information about the blocked object. 256 Private slot to show information about the blocked object.
257 """ 257 """
258 dlg = QDialog() 258 dlg = QDialog()
259 dlg.setWindowTitle(self.trUtf8("Flash Object")) 259 dlg.setWindowTitle(self.tr("Flash Object"))
260 dlg.setSizeGripEnabled(True) 260 dlg.setSizeGripEnabled(True)
261 layout = QFormLayout(dlg) 261 layout = QFormLayout(dlg)
262 layout.addRow(QLabel(self.trUtf8("<b>Attribute Name</b>")), 262 layout.addRow(QLabel(self.tr("<b>Attribute Name</b>")),
263 QLabel(self.trUtf8("<b>Value</b>"))) 263 QLabel(self.tr("<b>Value</b>")))
264 264
265 index = 0 265 index = 0
266 for name in self.__argumentNames: 266 for name in self.__argumentNames:
267 nameLabel = QLabel(self.__elide(name, length=30)) 267 nameLabel = QLabel(self.__elide(name, length=30))
268 value = self.__argumentValues[index] 268 value = self.__argumentValues[index]
272 layout.addRow(nameLabel, valueLabel) 272 layout.addRow(nameLabel, valueLabel)
273 273
274 index += 1 274 index += 1
275 275
276 if index == 0: 276 if index == 0:
277 layout.addRow(QLabel(self.trUtf8("No information available."))) 277 layout.addRow(QLabel(self.tr("No information available.")))
278 278
279 dlg.setMaximumHeight(500) 279 dlg.setMaximumHeight(500)
280 dlg.setMaximumWidth(500) 280 dlg.setMaximumWidth(500)
281 dlg.exec_() 281 dlg.exec_()
282 282

eric ide

mercurial