Qt-Advanced-Docking-System/demo/status_dialog.py
Nate Skulic 55ef6ef863
Improve Python Support (#567)
- Reduce requirements for the python build.
- Fix version number.
- Generate type hints for *.pyi files.
- Make functional for sip-build
- Reduced the unnecessary depth of the package.

NOTE: This is a breaking change for python users, where, `from PyQtAds import QtAds` is changed to `import PyQtAds as QtAds`( or simply `import PyQtAds`)
2023-10-05 07:23:54 +02:00

39 lines
1.6 KiB
Python

import os
import sys
from PyQt5 import uic
import PyQtAds as QtAds
UI_FILE = os.path.join(os.path.dirname(__file__), 'StatusDialog.ui')
StatusDialogUI, StatusDialogBase = uic.loadUiType(UI_FILE)
class CStatusDialog(StatusDialogUI, StatusDialogBase):
def __init__(self, dock_manager: QtAds.CDockManager, parent=None):
super().__init__(parent)
self.setupUi(self)
self.dock_manager = dock_manager
self.dock_widgets = self.dock_manager.dockWidgetsMap()
for key, widget in self.dock_widgets.items():
self.dockWidgetsComboBox.addItem(key, widget)
def on_dockWidgetsComboBox_currentIndexChanged(self, index: int):
if not isinstance(index, int):
return
if index < 0:
return
dock_widget = self.dockWidgetsComboBox.currentData()
self.isClosedCheckBox.setChecked(dock_widget.isClosed())
self.isFloatingCheckBox.setChecked(dock_widget.isFloating())
self.tabbedCheckBox.setChecked(dock_widget.isTabbed())
self.isCurrentTabCheckBox.setChecked(dock_widget.isCurrentTab())
self.closableCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetClosable)
self.movableCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetMovable)
self.floatableCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetFloatable)
self.deleteOnCloseCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.DockWidgetDeleteOnClose)
self.customCloseHandlingCheckBox.setChecked(dock_widget.features() & QtAds.CDockWidget.CustomCloseHandling)