-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ZITOUNI Clement
committed
Apr 20, 2023
1 parent
ebd141e
commit ede7392
Showing
7 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,3 @@ category=Plugins | |
icon=icon.png | ||
experimental=False | ||
deprecated=False | ||
keep_dialog_on_top=True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
import os | ||
from qgis.PyQt import uic | ||
from qgis.PyQt import QtWidgets | ||
from qgis.PyQt.QtCore import QObject, QEvent, Qt | ||
from qgis.gui import QgisInterface | ||
|
||
FORM_CLASS, _ = uic.loadUiType(os.path.join( | ||
os.path.dirname(__file__), 'simple_ban_dialog_base.ui')) | ||
|
||
class StayOnTopEventFilter(QObject): | ||
def __init__(self, dialog, qgis_main_window): | ||
super(StayOnTopEventFilter, self).__init__() | ||
self.dialog = dialog | ||
self.qgis_main_window = qgis_main_window | ||
|
||
def eventFilter(self, watched, event): | ||
if watched == self.qgis_main_window and event.type() == QEvent.WindowActivate: | ||
if self.dialog.isVisible() and not self.dialog.isActiveWindow(): | ||
self.dialog.raise_() | ||
return super(StayOnTopEventFilter, self).eventFilter(watched, event) | ||
|
||
class SimbleBanDialog(QtWidgets.QDialog, FORM_CLASS): | ||
def __init__(self, parent=None): | ||
def __init__(self, iface: QgisInterface, parent=None): | ||
super(SimbleBanDialog, self).__init__(parent) | ||
self.setupUi(self) | ||
self.setupUi(self) | ||
self.iface = iface | ||
self.event_filter = StayOnTopEventFilter(self, iface.mainWindow()) | ||
self.iface.mainWindow().installEventFilter(self.event_filter) | ||
|