-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix searching text in our Web widgets #3266
Changes from 2 commits
e7101ce
3c238ef
96d7b6e
2f2cc21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,13 +65,24 @@ def find_text(self, text, changed=True, | |
forward=True, case=False, words=False, | ||
regexp=False): | ||
"""Find text""" | ||
findflag = QWebEnginePage.FindWrapsAroundDocument | ||
if not WEBENGINE: | ||
findflag = QWebEnginePage.FindWrapsAroundDocument | ||
else: | ||
findflag = None | ||
|
||
if not forward: | ||
findflag = findflag | QWebEnginePage.FindBackward | ||
if findflag: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok |
||
findflag = findflag | QWebEnginePage.FindBackward | ||
else: | ||
findflag = QWebEnginePage.FindBackward | ||
if case: | ||
findflag = findflag | QWebEnginePage.FindCaseSensitively | ||
return self.findText(text, findflag) | ||
|
||
|
||
if findflag is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
return self.findText(text, findflag) | ||
else: | ||
return self.findText(text) | ||
|
||
def get_selected_text(self): | ||
"""Return text selected by current text cursor""" | ||
return self.selectedText() | ||
|
@@ -290,20 +301,8 @@ def __init__(self, parent): | |
else: | ||
self._webview.linkClicked.connect(self.linkClicked) | ||
|
||
def set_font(self, font, fixed_font=None): | ||
self._webview.set_font(font, fixed_font=fixed_font) | ||
|
||
def setHtml(self, html_text, base_url): | ||
self._webview.setHtml(html_text, base_url) | ||
|
||
def url(self): | ||
return self._webview.url() | ||
|
||
def load(self, url): | ||
self._webview.load(url) | ||
|
||
def page(self): | ||
return self._webview.page() | ||
def __getattr__(self, name): | ||
return getattr(self._webview, name) | ||
|
||
|
||
def test(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a private variable is not good practice. Maybe just add a property to
self.webview
to access_webview
? This way no other code has to change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a change made by @goanpeca, so the real
webview
widget is saved in a private variable.I'll write a new method to access it :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I remember now!, but @Nodd is ok, just add a property :-p