Commit 3e4a785c authored by AJ Fite's avatar AJ Fite 🛫

Image views sorta work

parent 2dcce0b9
......@@ -34,6 +34,9 @@
<property name="windowTitle">
<string>Sudo Password</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
......@@ -82,6 +85,9 @@
</property>
</widget>
</widget>
<tabstops>
<tabstop>passLine</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
......
0.0.5-ALPHA5
\ No newline at end of file
0.1.0-ALPHA2
\ No newline at end of file
......@@ -8,7 +8,8 @@ import os
class AboutDialog(QDialog):
def __init__(self):
super().__init__(flags=Qt.WindowStaysOnTopHint)
version_file = open(pkg_resources.resource_filename(__name__, "VERSION"))
version_file = open(pkg_resources.resource_filename(__name__,
"VERSION"))
version = version_file.read().strip()
ui_file = pkg_resources.resource_filename(__name__, "AboutDialog.ui")
uic.loadUi(ui_file, self)
......
import os
from configparser import SafeConfigParser
from configparser import ConfigParser
from pathlib import Path
import pkg_resources
from PyQt5 import uic
......@@ -131,7 +131,7 @@ class Config:
parser.write(file)
def __init__(self):
parser = SafeConfigParser(allow_no_value=True)
parser = ConfigParser(allow_no_value=True)
if os.path.isfile(Config.config_name):
self.read_config(parser)
......@@ -144,7 +144,8 @@ class Config:
class ConfigEditor(QDialog):
def __init__(self):
super().__init__(flags=Qt.WindowStaysOnTopHint)
ui_file = pkg_resources.resource_filename(__name__, "SettingsDialog.ui")
ui_file = pkg_resources.resource_filename(__name__,
"SettingsDialog.ui")
uic.loadUi(ui_file, self)
self.show()
......@@ -181,7 +182,7 @@ class ConfigEditor(QDialog):
self.serialDisable.setChecked(not Config.dbg_no_serial)
def apply_settings(self):
parser = SafeConfigParser(allow_no_value=True)
parser = ConfigParser(allow_no_value=True)
# Set the settings
Config.lepton_grabber_working_dir = self.leptonWorkingDir.text()
......@@ -204,7 +205,7 @@ class ConfigEditor(QDialog):
Config.write_config(parser)
def apply_defaults(self):
parser = SafeConfigParser(allow_no_value=True)
parser = ConfigParser(allow_no_value=True)
Config.defaults()
self.update_configs()
......
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QGraphicsScene
from watchdog.events import PatternMatchingEventHandler
from datetime import date
from .config import Config
# Computes where the lepton grabber is currently dumping output
......@@ -8,30 +11,64 @@ class FileHandlerUtils:
def compute_current_data_dir():
today = date.today()
return "lepton-grabber/" + today.strftime("%y-%m-%d")
return Config.lepton_grabber_working_dir + "/" \
+ today.strftime("%y-%m-%d")
# TODO: This needs to be thread safe
# Good example:
# https://github.com/yesworkflow-org/yw-gui/blob/master/main_ui.py
class ImageHandler(PatternMatchingEventHandler):
patterns = ["*.png"]
main = None
# Holders for the images
pngN = None
pngNE = None
pngE = None
pngSE = None
pngS = None
pngSW = None
pngW = None
pngNW = None
pngCenter = None
def __init__(self, mainwindow):
super().__init__()
self.main = mainwindow
self.current = 0
self.sceneN = QGraphicsScene()
self.main.imgN.setScene(self.sceneN)
self.sceneNE = QGraphicsScene()
self.main.imgNE.setScene(self.sceneNE)
self.sceneE = QGraphicsScene()
self.main.imgE.setScene(self.sceneE)
self.sceneSE = QGraphicsScene()
self.main.imgSE.setScene(self.sceneSE)
self.sceneS = QGraphicsScene()
self.main.imgS.setScene(self.sceneS)
self.sceneSW = QGraphicsScene()
self.main.imgSW.setScene(self.sceneSW)
self.sceneW = QGraphicsScene()
self.main.imgW.setScene(self.sceneW)
self.sceneNW = QGraphicsScene()
self.main.imgNW.setScene(self.sceneNW)
self.sceneCenter = QGraphicsScene()
self.main.imgCenter.setScene(self.sceneCenter)
def on_created(self, event):
# TODO: Update image views
print("Update image")
pix = QPixmap(event.src_path)
if self.current == 0:
self.sceneN.addPixmap(pix)
elif self.current == 1:
self.sceneNE.addPixmap(pix)
elif self.current == 2:
self.sceneE.addPixmap(pix)
elif self.current == 3:
self.sceneSE.addPixmap(pix)
elif self.current == 4:
self.sceneS.addPixmap(pix)
elif self.current == 5:
self.sceneCenter.addPixmap(pix)
elif self.current == 6:
self.sceneSW.addPixmap(pix)
elif self.current == 7:
self.sceneW.addPixmap(pix)
elif self.current == 8:
self.sceneNW.addPixmap(pix)
self.current = (self.current + 1) % Config.dbg_lepton_set
class CSVHandler(PatternMatchingEventHandler):
......@@ -39,6 +76,7 @@ class CSVHandler(PatternMatchingEventHandler):
main = None
def __init__(self, mainwindow):
super().__init__()
self.main = mainwindow
def on_created(self, event):
......
......@@ -90,7 +90,7 @@ class MainWindow(QMainWindow):
self.imgW.setEnabled(status)
self.imgNW.setEnabled(status)
self.imgCenter.setEnabled(status)
self.actionSettings.setDisabled(status) # TODO: Test me
self.actionSettings.setDisabled(status)
# Triggered when the QProcess that runs the lepton-grabber runs
def process_started(self):
......@@ -188,7 +188,7 @@ class MainWindow(QMainWindow):
+ "\n")
.encode('utf-8'))
self.simfProcess.writeData("exit\n".encode('utf-8'))
# self.simfProcess.writeData("exit\n".encode('utf-8'))
# Fired when the stop capture button is hit
def stop_capture(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment