Change ConfigDialog to modeless
This commit is contained in:
parent
02923f3a53
commit
7fe1e942f4
@ -1,5 +1,5 @@
|
|||||||
from syncplay.vendor.Qt import QtCore, QtWidgets, QtGui, __binding__, IsPySide, IsPySide2
|
from syncplay.vendor.Qt import QtCore, QtWidgets, QtGui, __binding__, IsPySide, IsPySide2
|
||||||
from syncplay.vendor.Qt.QtCore import Qt, QSettings, QCoreApplication, QSize, QPoint, QUrl, QLine
|
from syncplay.vendor.Qt.QtCore import Qt, QSettings, QCoreApplication, QSize, QPoint, QUrl, QLine, QEventLoop, Signal
|
||||||
from syncplay.vendor.Qt.QtWidgets import QApplication, QLineEdit, QLabel, QCheckBox, QButtonGroup, QRadioButton, QDoubleSpinBox, QPlainTextEdit
|
from syncplay.vendor.Qt.QtWidgets import QApplication, QLineEdit, QLabel, QCheckBox, QButtonGroup, QRadioButton, QDoubleSpinBox, QPlainTextEdit
|
||||||
from syncplay.vendor.Qt.QtGui import QCursor, QIcon, QImage, QDesktopServices
|
from syncplay.vendor.Qt.QtGui import QCursor, QIcon, QImage, QDesktopServices
|
||||||
if IsPySide2:
|
if IsPySide2:
|
||||||
@ -25,7 +25,10 @@ class GuiConfiguration:
|
|||||||
if QCoreApplication.instance() is None:
|
if QCoreApplication.instance() is None:
|
||||||
self.app = QtWidgets.QApplication(sys.argv)
|
self.app = QtWidgets.QApplication(sys.argv)
|
||||||
dialog = ConfigDialog(self.config, self._availablePlayerPaths, self.error, self.defaultConfig)
|
dialog = ConfigDialog(self.config, self._availablePlayerPaths, self.error, self.defaultConfig)
|
||||||
dialog.exec_()
|
configLoop = QEventLoop()
|
||||||
|
dialog.show()
|
||||||
|
dialog.closed.connect(configLoop.quit)
|
||||||
|
configLoop.exec_()
|
||||||
|
|
||||||
def setAvailablePaths(self, paths):
|
def setAvailablePaths(self, paths):
|
||||||
self._availablePlayerPaths = paths
|
self._availablePlayerPaths = paths
|
||||||
@ -74,6 +77,8 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
pressedclosebutton = True
|
pressedclosebutton = True
|
||||||
moreToggling = False
|
moreToggling = False
|
||||||
|
|
||||||
|
closed = Signal()
|
||||||
|
|
||||||
def automaticUpdatePromptCheck(self):
|
def automaticUpdatePromptCheck(self):
|
||||||
if self.automaticupdatesCheckbox.checkState() == Qt.PartiallyChecked:
|
if self.automaticupdatesCheckbox.checkState() == Qt.PartiallyChecked:
|
||||||
reply = QtWidgets.QMessageBox.question(self, "Syncplay",
|
reply = QtWidgets.QMessageBox.question(self, "Syncplay",
|
||||||
@ -421,11 +426,12 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
|
|
||||||
self.pressedclosebutton = False
|
self.pressedclosebutton = False
|
||||||
self.close()
|
self.close()
|
||||||
return
|
self.closed.emit()
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
if self.pressedclosebutton:
|
if self.pressedclosebutton:
|
||||||
super(ConfigDialog, self).closeEvent(event)
|
super(ConfigDialog, self).closeEvent(event)
|
||||||
|
self.closed.emit()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
@ -1189,6 +1195,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
self.config['resetConfig'] = True
|
self.config['resetConfig'] = True
|
||||||
self.pressedclosebutton = False
|
self.pressedclosebutton = False
|
||||||
self.close()
|
self.close()
|
||||||
|
self.closed.emit()
|
||||||
|
|
||||||
def showEvent(self, *args, **kwargs):
|
def showEvent(self, *args, **kwargs):
|
||||||
self.ensureTabListIsVisible()
|
self.ensureTabListIsVisible()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user