clean up
This commit is contained in:
@ -2,7 +2,6 @@ import numpy as np
|
||||
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QMainWindow, QSplitter
|
||||
from PyQt5.QtGui import QIcon
|
||||
|
||||
import assets
|
||||
from dictlist import DictList
|
||||
@ -14,10 +13,9 @@ X = np.arange(100) / 10
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
|
||||
def __init__(self, title="grum", *args, **kwargs):
|
||||
def __init__(self, *args, title="grum", **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.setWindowTitle(title)
|
||||
|
||||
self.setWindowIcon(assets.icon())
|
||||
|
||||
data = {
|
||||
|
18
mdi.py
18
mdi.py
@ -1,6 +1,6 @@
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtWidgets import QMdiArea, QMdiSubWindow, QAction
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QPainter, QColor
|
||||
from PyQt5.QtGui import QPainter
|
||||
from pyqtgraph import PlotWidget
|
||||
|
||||
import assets
|
||||
@ -11,15 +11,17 @@ class MDIArea(QMdiArea):
|
||||
|
||||
def __init__(self, bar, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.logo = assets.logo()
|
||||
self._add_menu(bar)
|
||||
|
||||
|
||||
def _add_menu(self, bar):
|
||||
menu = bar.addMenu("Windows")
|
||||
menu.addAction("Cascade")
|
||||
menu.addAction("Tiled")
|
||||
menu.addAction("Close All")
|
||||
menu.triggered[QAction].connect(self.on_menu_select)
|
||||
|
||||
self.logo = assets.logo()
|
||||
|
||||
|
||||
def on_menu_select(self, p):
|
||||
txt = p.text()
|
||||
@ -31,13 +33,16 @@ class MDIArea(QMdiArea):
|
||||
self.closeAllSubWindows()
|
||||
|
||||
|
||||
def paintEvent(self, event):
|
||||
# draw the watermark in the MDI area
|
||||
def paintEvent(self, _event):
|
||||
self._draw_watermark()
|
||||
|
||||
|
||||
def _draw_watermark(self):
|
||||
painter = QPainter()
|
||||
vport = self.viewport()
|
||||
painter.begin(vport)
|
||||
|
||||
rect = event.rect()
|
||||
rect = self.rect()
|
||||
painter.fillRect(rect, MDI_BKG)
|
||||
|
||||
margin = 20
|
||||
@ -61,7 +66,6 @@ class MDISubPlot(QMdiSubWindow):
|
||||
def __init__(self, title, data, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.setWindowTitle(title)
|
||||
|
||||
self.setWindowIcon(assets.char())
|
||||
|
||||
# without this, the SubWindow is not removed from the subWindowList
|
||||
|
Reference in New Issue
Block a user