v0.11: fix infobar flag, hamburger click-outside via polling timer
This commit is contained in:
+22
-2
@@ -403,6 +403,11 @@ class BookmarkPanel(QWidget):
|
|||||||
""")
|
""")
|
||||||
QApplication.instance().installEventFilter(self)
|
QApplication.instance().installEventFilter(self)
|
||||||
|
|
||||||
|
# Timer: hide panel when user clicks anywhere outside it
|
||||||
|
# (clicks on Chromium never reach Qt's eventFilter)
|
||||||
|
self._click_guard = QTimer()
|
||||||
|
self._click_guard.timeout.connect(self._check_outside_click)
|
||||||
|
|
||||||
def rebuild(self, items):
|
def rebuild(self, items):
|
||||||
# Remove old layout
|
# Remove old layout
|
||||||
old = self.layout()
|
old = self.layout()
|
||||||
@@ -479,6 +484,23 @@ class BookmarkPanel(QWidget):
|
|||||||
self.hide()
|
self.hide()
|
||||||
self.overlay.open_manager()
|
self.overlay.open_manager()
|
||||||
|
|
||||||
|
def setVisible(self, visible):
|
||||||
|
super().setVisible(visible)
|
||||||
|
if visible:
|
||||||
|
self._click_guard.start(100)
|
||||||
|
else:
|
||||||
|
self._click_guard.stop()
|
||||||
|
|
||||||
|
def _check_outside_click(self):
|
||||||
|
"""Hide panel when a click lands outside it — even on the Chromium window."""
|
||||||
|
from PyQt5.QtGui import QCursor
|
||||||
|
if not self.isVisible():
|
||||||
|
self._click_guard.stop()
|
||||||
|
return
|
||||||
|
if QApplication.mouseButtons() & Qt.LeftButton:
|
||||||
|
if not self.geometry().contains(QCursor.pos()):
|
||||||
|
self.hide()
|
||||||
|
|
||||||
def eventFilter(self, obj, event):
|
def eventFilter(self, obj, event):
|
||||||
from PyQt5.QtCore import QEvent
|
from PyQt5.QtCore import QEvent
|
||||||
if event.type() == QEvent.MouseButtonPress and self.isVisible():
|
if event.type() == QEvent.MouseButtonPress and self.isVisible():
|
||||||
@@ -692,10 +714,8 @@ def launch_chrome():
|
|||||||
"chromium",
|
"chromium",
|
||||||
"--no-first-run",
|
"--no-first-run",
|
||||||
"--no-default-browser-check",
|
"--no-default-browser-check",
|
||||||
"--disable-translate",
|
|
||||||
"--disable-restore-session-state",
|
"--disable-restore-session-state",
|
||||||
"--disable-default-browser-check",
|
"--disable-default-browser-check",
|
||||||
"--no-first-run",
|
|
||||||
"--disable-features=TranslateUI,OptimizationHints,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationGuideModelDownloading",
|
"--disable-features=TranslateUI,OptimizationHints,OptimizationHintsFetching,OptimizationTargetPrediction,OptimizationGuideModelDownloading",
|
||||||
"--disable-component-update",
|
"--disable-component-update",
|
||||||
"--disable-background-networking",
|
"--disable-background-networking",
|
||||||
|
|||||||
Reference in New Issue
Block a user