Skip to content

Commit

Permalink
Sub-classed PymeadDialog instead of QDialog for AirfoilStatistics, op…
Browse files Browse the repository at this point in the history
…timized some imports
  • Loading branch information
mlau154 committed Feb 13, 2024
1 parent 3165338 commit 4b73993
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
14 changes: 8 additions & 6 deletions pymead/analysis/single_element_inviscid.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import numpy as np
from numpy import zeros, pi, arctan2, sin, cos, sqrt, log, matmul, NaN, dot
from numpy.linalg import inv
import matplotlib.pyplot as plt
import pandas as pd
from pymead import DATA_DIR
import os
import time

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from numba import jit
from numpy import zeros, pi, arctan2, sin, cos, sqrt, log, dot
from numpy.linalg import inv

from pymead import DATA_DIR


@jit(nopython=True, cache=True)
Expand Down
15 changes: 6 additions & 9 deletions pymead/gui/airfoil_statistics.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pandas as pd
from PyQt5.QtWidgets import QTextEdit, QDialog, QVBoxLayout
from PyQt5.QtWidgets import QTextEdit

from pymead.core.geometry_collection import GeometryCollection
from pymead.gui.input_dialog import PymeadDialog


class AirfoilStatistics:
Expand Down Expand Up @@ -42,12 +43,8 @@ def generate_text_edit_widget(self, parent, **html_kwargs):
return text_edit


class AirfoilStatisticsDialog(QDialog):
def __init__(self, parent, airfoil_stats: AirfoilStatistics):
super().__init__(parent=parent)
self.setWindowTitle("Airfoil Statistics")
self.setFont(self.parent().font())

layout = QVBoxLayout(self)
class AirfoilStatisticsDialog(PymeadDialog):
def __init__(self, parent, airfoil_stats: AirfoilStatistics, theme: dict):
self.stats_widget = airfoil_stats.generate_text_edit_widget(parent=parent, float_format="{:.8f}".format)
layout.addWidget(self.stats_widget)
super().__init__(parent=parent, window_title="Airfoil Statistics", widget=self.stats_widget,
theme=theme)
3 changes: 2 additions & 1 deletion pymead/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,8 @@ def output_link_text(self, text: str, link: str, line_break: bool = False):

def display_airfoil_statistics(self):
airfoil_stats = AirfoilStatistics(geo_col=self.geo_col)
dialog = AirfoilStatisticsDialog(parent=self, airfoil_stats=airfoil_stats)
dialog = AirfoilStatisticsDialog(parent=self, airfoil_stats=airfoil_stats,
theme=self.themes[self.current_theme])
dialog.exec()

def single_airfoil_inviscid_analysis(self, plot_cp: bool):
Expand Down

0 comments on commit 4b73993

Please sign in to comment.