Skip to content

Commit 804a0a1

Browse files
committed
Fix PyCharm warnings in qt.py and update tested configurat. in gtk3.py
1 parent f1cec3f commit 804a0a1

File tree

3 files changed

+38
-14
lines changed

3 files changed

+38
-14
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ or other kind of internet bots.
3838

3939
## Install
4040

41-
You can install with pip. On Linux pip 8.1+ is required. You can
41+
You can install [pypi/cefpython3](https://pypi.python.org/pypi/cefpython3)
42+
package using pip tool. On Linux pip 8.1+ is required. You can
4243
also download packages for offline installation available on the
43-
[GitHub Releases](../../releases) pages.
44+
[GitHub Releases](../../releases) pages. Command to install with pip:
4445

4546
```
4647
pip install cefpython3==57.0

examples/gtk3.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# Example of embedding CEF Python browser using PyGObject/PyGI (GTK 3).
22
#
3-
# Mac note: This example crashes on Mac with error message:
4-
# > _createMenuRef called with existing principal MenuRef..
5-
# Reported as Issue #310.
6-
#
7-
# Linux note: This example is currently broken in v54+ on Linux (Issue #261).
8-
# It works fine with cefpython v53.
9-
#
103
# Tested configurations:
11-
# - GTK 3.18 on Windows
12-
# - GTK 3.10 on Linux
13-
# - CEF Python v53.1+
4+
# - GTK 3.18 on Windows (cefpython v53.1+)
5+
# - GTK 3.10 on Linux (works with cefpython v53.1 and v57.0+)
6+
#
7+
# Mac crash: This example crashes on Mac with error message:
8+
# > _createMenuRef called with existing principal MenuRef..
9+
# Reported as Issue #310.
10+
1411

1512
from cefpython3 import cefpython as cef
1613
import ctypes

examples/qt.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,29 @@
2424
PYQT5 = False
2525
PYSIDE = False
2626

27-
# PyQt imports
2827
if "pyqt4" in sys.argv:
2928
PYQT4 = True
29+
# noinspection PyUnresolvedReferences
3030
from PyQt4.QtGui import *
31+
# noinspection PyUnresolvedReferences
3132
from PyQt4.QtCore import *
3233
elif "pyqt5" in sys.argv:
3334
PYQT5 = True
35+
# noinspection PyUnresolvedReferences
3436
from PyQt5.QtGui import *
37+
# noinspection PyUnresolvedReferences
3538
from PyQt5.QtCore import *
39+
# noinspection PyUnresolvedReferences
3640
from PyQt5.QtWidgets import *
37-
# PySide imports
3841
elif "pyside" in sys.argv:
3942
PYSIDE = True
43+
# noinspection PyUnresolvedReferences
4044
import PySide
45+
# noinspection PyUnresolvedReferences
4146
from PySide import QtCore
47+
# noinspection PyUnresolvedReferences
4248
from PySide.QtGui import *
49+
# noinspection PyUnresolvedReferences
4350
from PySide.QtCore import *
4451
else:
4552
print("USAGE:")
@@ -63,6 +70,7 @@
6370
# OS differences
6471
CefWidgetParent = QWidget
6572
if LINUX and (PYQT4 or PYSIDE):
73+
# noinspection PyUnresolvedReferences
6674
CefWidgetParent = QX11EmbedContainer
6775

6876

@@ -98,6 +106,7 @@ def check_versions():
98106

99107
class MainWindow(QMainWindow):
100108
def __init__(self):
109+
# noinspection PyArgumentList
101110
super(MainWindow, self).__init__(None)
102111
self.cef_widget = None
103112
self.navigation_bar = None
@@ -115,12 +124,15 @@ def setupLayout(self):
115124
self.cef_widget = CefWidget(self)
116125
self.navigation_bar = NavigationBar(self.cef_widget)
117126
layout = QGridLayout()
127+
# noinspection PyArgumentList
118128
layout.addWidget(self.navigation_bar, 0, 0)
129+
# noinspection PyArgumentList
119130
layout.addWidget(self.cef_widget, 1, 0)
120131
layout.setContentsMargins(0, 0, 0, 0)
121132
layout.setSpacing(0)
122133
layout.setRowStretch(0, 0)
123134
layout.setRowStretch(1, 1)
135+
# noinspection PyArgumentList
124136
frame = QFrame()
125137
frame.setLayout(layout)
126138
self.setCentralWidget(frame)
@@ -140,8 +152,10 @@ def setupLayout(self):
140152
# a hidden window, embed CEF browser in it and then
141153
# create a container for that hidden window and replace
142154
# cef widget in the layout with the container.
155+
# noinspection PyUnresolvedReferences, PyArgumentList
143156
self.container = QWidget.createWindowContainer(
144157
self.cef_widget.hidden_window, parent=self)
158+
# noinspection PyArgumentList
145159
layout.addWidget(self.container, 1, 0)
146160

147161
def closeEvent(self, event):
@@ -158,6 +172,7 @@ def clear_browser_references(self):
158172

159173
class CefWidget(CefWidgetParent):
160174
def __init__(self, parent=None):
175+
# noinspection PyArgumentList
161176
super(CefWidget, self).__init__(parent)
162177
self.parent = parent
163178
self.browser = None
@@ -180,6 +195,7 @@ def focusOutEvent(self, event):
180195

181196
def embedBrowser(self):
182197
if PYQT5 and LINUX:
198+
# noinspection PyUnresolvedReferences
183199
self.hidden_window = QWindow()
184200
window_info = cef.WindowInfo()
185201
rect = [0, 0, self.width(), self.height()]
@@ -246,6 +262,7 @@ def __init__(self, args):
246262

247263
def createTimer(self):
248264
timer = QTimer()
265+
# noinspection PyUnresolvedReferences
249266
timer.timeout.connect(self.onTimer)
250267
timer.start(10)
251268
return timer
@@ -301,6 +318,7 @@ def OnGotFocus(self, browser, **_):
301318

302319
class NavigationBar(QFrame):
303320
def __init__(self, cef_widget):
321+
# noinspection PyArgumentList
304322
super(NavigationBar, self).__init__()
305323
self.cef_widget = cef_widget
306324

@@ -311,22 +329,30 @@ def __init__(self, cef_widget):
311329

312330
# Back button
313331
self.back = self.createButton("back")
332+
# noinspection PyUnresolvedReferences
314333
self.back.clicked.connect(self.onBack)
334+
# noinspection PyArgumentList
315335
layout.addWidget(self.back, 0, 0)
316336

317337
# Forward button
318338
self.forward = self.createButton("forward")
339+
# noinspection PyUnresolvedReferences
319340
self.forward.clicked.connect(self.onForward)
341+
# noinspection PyArgumentList
320342
layout.addWidget(self.forward, 0, 1)
321343

322344
# Reload button
323345
self.reload = self.createButton("reload")
346+
# noinspection PyUnresolvedReferences
324347
self.reload.clicked.connect(self.onReload)
348+
# noinspection PyArgumentList
325349
layout.addWidget(self.reload, 0, 2)
326350

327351
# Url input
328352
self.url = QLineEdit("")
353+
# noinspection PyUnresolvedReferences
329354
self.url.returnPressed.connect(self.onGoUrl)
355+
# noinspection PyArgumentList
330356
layout.addWidget(self.url, 0, 3)
331357

332358
# Layout

0 commit comments

Comments
 (0)