Skip to content

Commit

Permalink
Merge pull request #38 from amandashack/thread_fixes
Browse files Browse the repository at this point in the history
Version 2, changes to threading, image feed, and GUI style
  • Loading branch information
ZLLentz authored Jun 23, 2023
2 parents 4d39b2d + 6c41b6f commit a2c389f
Show file tree
Hide file tree
Showing 37 changed files with 4,028 additions and 1,422 deletions.
530 changes: 386 additions & 144 deletions jet_tracking/context.py

Large diffs are not rendered by default.

1,880 changes: 1,338 additions & 542 deletions jet_tracking/datastream.py

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions jet_tracking/gui/views/jetImageView.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ def __init__(self, context, signals):
self.context = context
self.camera = ""
self.mainLayout = QHBoxLayout()
self.createImageWidget()
self.createEditorWidget()
self.imageWidget = None
self.editorWidget = None
self.create_image_widget()
self.create_editor_widget()
self.mainLayout.addWidget(self.imageWidget, 75)
self.mainLayout.addWidget(self.editorWidget, 25)
self.setLayout(self.mainLayout)
Expand All @@ -25,8 +27,8 @@ def __init__(self, context, signals):
def make_connections(self):
pass

def createImageWidget(self):
def create_image_widget(self):
self.imageWidget = JetImageWidget(self.context, self.signals)

def createEditorWidget(self):
def create_editor_widget(self):
self.editorWidget = EditorWidget(self.context, self.signals)
46 changes: 35 additions & 11 deletions jet_tracking/gui/views/jetTrackerView.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,53 @@


class JetTrackerView(QWidget):

"""This class represents the view widget for the jet tracking functionality within the main window."""
def __init__(self, context, signals, parent=None):
"""
Constructor method for the JetTrackerView class.
Parameters
----------
context: the context object
signals: the signals object
parent: option parent widget
The __init__ method performs the following actions:
Calls the parent class constructor.
Initializes the signals, context, and parent attributes.
Initializes the graphWidget, controlsDock, controlsWidget, and mainLayout attributes.
Calls the create_graph_widget method to create and assign the GraphsWidget instance to the graphWidget attribute.
Calls the create_dock_widgets method to create and assign the QDockWidget instance to the controlsDock attribute, and the ControlsWidget instance to the controlsWidget attribute.
Adds the controlsDock and graphWidget to the mainLayout.
Sets the layout of the widget using the setLayout method.
"""
super(JetTrackerView, self).__init__(parent)
self.signals = signals
self.context = context
self.parent = parent
self.graphWidget = None
self.controlsDock = None
self.controlsWidget = None
self.mainLayout = QHBoxLayout()
self.createGraphWidget()
self.createDockWidgets()
self.mainLayout.addWidget(self.controlsDock)
self.mainLayout.addWidget(self.graphWidget)
# self.parent.resizeDocks([self.controlsDock], [45], Qt.Horizontal)
print(self.parent)
self.create_graph_widget()
self.create_dock_widgets()
self.mainLayout.addWidget(self.controlsDock, 30)
self.mainLayout.addWidget(self.graphWidget, 70)
self.setLayout(self.mainLayout)

def createGraphWidget(self):
def create_graph_widget(self):
"""Creates an instance of the GraphsWidget class and assigns it to the graphWidget attribute.
The GraphsWidget represents the graphical visualization of the jet tracking data."""
self.graphWidget = GraphsWidget(context=self.context,
signals=self.signals)
self.graphWidget.setSizePolicy(QSizePolicy.Preferred,
QSizePolicy.Preferred)

def createDockWidgets(self):
def create_dock_widgets(self):
"""Creates an instance of the QDockWidget class and assigns it to the controlsDock attribute.
The QDockWidget provides a dockable container for the ControlsWidget, which represents the user
interface controls related to the jet tracking functionality."""
self.parent.setDockNestingEnabled(True)
self.controlsDock = QDockWidget("Controls", self)
self.controlsDock.setAllowedAreas(Qt.RightDockWidgetArea
Expand All @@ -41,5 +66,4 @@ def createDockWidgets(self):
self.controlsWidget = ControlsWidget(self.context, self.signals)
self.controlsDock.setWidget(self.controlsWidget)
self.controlsDock.setSizePolicy(QSizePolicy.Preferred,
QSizePolicy.Preferred)
# self.mainLayout.addWidget(self.controlsDock)
QSizePolicy.Preferred)
7 changes: 4 additions & 3 deletions jet_tracking/gui/views/simultationView.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ def __init__(self, context, signals, parent=None):
self.context = context
self.parent = parent
self.mainLayout = QHBoxLayout()
self.createEditorWidget()
self.simControlWidget = None
self.create_editor_widget()
self.mainLayout.addWidget(self.simControlWidget)
self.setLayout(self.mainLayout)

def createEditorWidget(self):
self.simControlWidget = SimWidget(self.context, self.signals)
def create_editor_widget(self):
self.simControlWidget = SimWidget(self.context, self.signals)
52 changes: 15 additions & 37 deletions jet_tracking/gui/widgets/basicWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,11 @@
from PyQt5.QtCore import (QAbstractAnimation, QParallelAnimationGroup,
QPropertyAnimation, QRect, Qt, pyqtSignal)
from PyQt5.QtGui import QBrush, QColor, QDoubleValidator, QPainter, QPalette
from PyQt5.QtWidgets import (QComboBox, QFrame, QGraphicsScene, QGraphicsView,
QLabel, QLineEdit, QMessageBox, QPushButton,
from PyQt5.QtWidgets import (QFrame, QLabel, QLineEdit, QMessageBox,
QScrollArea, QSizePolicy, QToolButton,
QVBoxLayout, QWidget)


class GraphicsView(QGraphicsView):
def __init__(self, parent=None):
super(GraphicsView, self).__init__(parent)
self.setMouseTracking(True)


class GraphicsScene(QGraphicsScene):
def __init__(self, parent=None):
super(GraphicsScene, self).__init__(parent)


class ComboBox(QComboBox):
def __init__(self, parent=None):
super(ComboBox, self).__init__(parent)


class PushButton(QPushButton):
def __init__(self, parent=None):
super(PushButton, self).__init__(parent)


class LineEdit(QLineEdit):
checkVal = pyqtSignal(float)

Expand Down Expand Up @@ -74,20 +52,20 @@ def __init__(self, title="", parent=None):
self.toggle_button = QToolButton(
text=title, checkable=True, checked=False
)
self.toggle_button.setStyleSheet("QToolButton {border: none;\
border: 1px solid #FF17365D;\
border-top-left-radius: 15px;\
border-top-right-radius: 15px;\
background-color: #FF17365D;\
padding: 5px 0px;\
color: rgb(255, 255, 255);\
max-height: 30px;\
font-size: 14px;\
}\
QToolButton:hover {\
background-color: lightgreen;\
color: black;\
}")
# self.toggle_button.setStyleSheet("QToolButton {border: none;\
# border: 1px solid #FF17365D;\
# border-top-left-radius: 15px;\
# border-top-right-radius: 15px;\
# background-color: #FF17365D;\
# padding: 5px 0px;\
# color: rgb(255, 255, 255);\
# max-height: 30px;\
# font-size: 14px;\
# }\
# QToolButton:hover {\
# background-color: lightgreen;\
# color: black;\
# }")
self.toggle_button.setToolButtonStyle(
Qt.ToolButtonTextBesideIcon
)
Expand Down
Loading

0 comments on commit a2c389f

Please sign in to comment.