From 30a8d019417f59ce825ccdf44b16e0a51bdda3f2 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 17 Jun 2019 18:25:15 +0200 Subject: Nuke Jones --- src/ui.py | 8 +++----- src/ui_widgets.py | 39 +++++---------------------------------- 2 files changed, 8 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/ui.py b/src/ui.py index 60f2fac..22ae436 100644 --- a/src/ui.py +++ b/src/ui.py @@ -69,8 +69,7 @@ def update(): row.stokes[4].setText("%g°" % (ellipse.alpha * 180 / np.pi)) row.stokes[5].setText("%g°" % (ellipse.theta * 180 / np.pi)) - GUI.widok.intensity = I - GUI.widok.repaint() + GUI.poincare.repaint() #if GUI.auto_optimize.isChecked(): # optimize() @@ -144,9 +143,8 @@ class MainWindow(QMainWindow): rhs = QVBoxLayout() split.addWidget(LayoutWrapper(rhs)) - Widocques.image = QImage("jones.jpg") - GUI.widok = Widocques() - rhs.addWidget(GUI.widok) + GUI.poincare = PoincareWidget() + rhs.addWidget(GUI.poincare) GUI.table.populate(system) update() diff --git a/src/ui_widgets.py b/src/ui_widgets.py index 07b0369..291324f 100644 --- a/src/ui_widgets.py +++ b/src/ui_widgets.py @@ -227,41 +227,12 @@ class AngleSlider(QHBoxLayout): -class Widocques(QWidget): - image = None - - def __init__(self): +class PoincareWidget(QWidget): + def __init__(self,): QWidget.__init__(self) - self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) - self.intensity = 1 - - def minimumSizeHint(self): - return QSize(100, 100) + self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, \ + QSizePolicy.Expanding)) def paintEvent(self, event): - P = QPainter(self) - - w, h = self.frameSize().width(), self.frameSize().height() + pass - ar = Widocques.image.width() \ - / Widocques.image.height() - - if w / h > ar: - # pad left/right - w2 = h * ar - pad = (w - w2) / 2 - rect = QRect(pad, 0, w2, h) - else: - # pad top/bottom - h2 = w / ar - pad = (h - h2) / 2 - rect = QRect(0, pad, w, h2) - - w2 = rect.width() - h2 = rect.height() - rect2 = QRect(rect.left() + 0.1 * w2, rect.top() + 0.1 * h2, \ - w2 * 0.8, h2 * 0.8) - - P.fillRect(QRect(0, 0, w, h), Qt.black) - P.drawImage(rect2, Widocques.image) - P.fillRect(rect2, QColor(0, 0, 0, 255 * (1 - self.intensity))) -- cgit