diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 0000000000000000000000000000000000000000..f8b4888565caadc7510be75682268d6c18edd6de --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": null +} \ No newline at end of file diff --git a/.vs/PythonSettings.json b/.vs/PythonSettings.json new file mode 100644 index 0000000000000000000000000000000000000000..a1f2feaab2a99773c9a1cfb0f9560bf7e6ff3194 --- /dev/null +++ b/.vs/PythonSettings.json @@ -0,0 +1,3 @@ +{ + "Interpreter": "CondaEnv|CondaEnv|MOKE" +} \ No newline at end of file diff --git a/.vs/minimoke/FileContentIndex/f2cf9168-173c-42cb-80b0-2b4d6f719958.vsidx b/.vs/minimoke/FileContentIndex/f2cf9168-173c-42cb-80b0-2b4d6f719958.vsidx new file mode 100644 index 0000000000000000000000000000000000000000..6b37813a4394972f4672c91b54b77b4ac2a73ca3 Binary files /dev/null and b/.vs/minimoke/FileContentIndex/f2cf9168-173c-42cb-80b0-2b4d6f719958.vsidx differ diff --git a/.vs/minimoke/FileContentIndex/read.lock b/.vs/minimoke/FileContentIndex/read.lock new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/.vs/minimoke/v17/.wsuo b/.vs/minimoke/v17/.wsuo new file mode 100644 index 0000000000000000000000000000000000000000..6d626d35fa84260bf0372c9b8134808da8b55788 Binary files /dev/null and b/.vs/minimoke/v17/.wsuo differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..20aa480bfe6f9b6d1c1dee8c5a3795c748502017 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/README.md b/README.md index a03d65b1367365a7cddd83342cbecb31e509573c..984b96b8e61bf0b19419adb56440a45a5d6a7d80 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ UI interface for the miniMOKE experimental setup. This project requires a conda or miniconda environment with python3.11 ```bash +pip install pythonnet pip install pymeasure pip install thorlabs-apt pip install nidaqmx diff --git a/example_C.txt b/example_C.txt deleted file mode 100644 index efe602275b06e00deff251fdfbef732842127186..0000000000000000000000000000000000000000 --- a/example_C.txt +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; - -namespace HU_CS_Single_Probe_Example -{ - public partial class Form1 : Form - { - MagnetPhysik.HallProbe myProbe; // requires reference to MagnetPhysik.Usb.dll - - public Form1() - { - InitializeComponent(); - } - - private void Form1_Load(object sender, EventArgs e) - { - myProbe = new MagnetPhysik.HallProbe(); - - if (MagnetPhysik.HallProbe.NumberOfProbes < 1) - { - MessageBox.Show(MagnetPhysik.HallProbe.ErrorMessage, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - - label1.Text = string.Concat("Probe No. ", myProbe.SerialNumber.ToString()); - - timer1.Interval = 500; - timer1.Enabled = true; - } - - private void timer1_Tick(object sender, EventArgs e) - { - textBox1.Text = myProbe.Tesla.ToString(); - } - } -} -; \ No newline at end of file diff --git a/hall_probe.py b/hall_probe.py index 5bfd4464d7cf228aaf1210abec42553a49620202..813b49fea30f98f4cfbcd3ccb687a0c2691b7aee 100644 --- a/hall_probe.py +++ b/hall_probe.py @@ -2,23 +2,24 @@ import ctypes import time import sys import clr +import platform -# Load the DLL -# asm = ctypes.cdll.LoadLibrary("C:\\Program Files (x86)\\Magnet-Physik\\USB Teslameter\\MagnetPhysik.Usb.dll") +print(platform.architecture()) -# clr.AddReference(r"C:/Program Files (x86)/Magnet-Physik/USB Teslameter/MagnetPhysik.Usb.dll") +# Load the DLL +sys.path.append(r"C:/Program Files (x86)/Magnet-Physik/USB Teslameter/") +clr.AddReference("MagnetPhysik.Usb") -ctypes.WinDLL(r"C:/Program Files (x86)/Magnet-Physik/USB Teslameter/MagnetPhysik.Usb.dll") +from MagnetPhysik import HallProbe # Instantiate Hally - without knowing the exact method to instantiate an object, I am assuming it's 'HallProbe' -# Hally = asm.HallProbe() +hally = HallProbe() -# print("Why\n") # # Get Tesla value -# tesla = Hally.Tesla +tesla = hally.Tesla # # Loop to print Tesla value every half a second -# for x in range(100): -# print(f"Field[T]: {str(Hally.Tesla())}") -# time.sleep(0.5) +for x in range(100): + print("Field[T]: ", hally.Tesla) + time.sleep(0.5) diff --git a/src/classes/status_bar.py b/src/classes/status_bar.py new file mode 100644 index 0000000000000000000000000000000000000000..d5062b1e7945d91b3ea0d405089a7bf919ffbaa4 --- /dev/null +++ b/src/classes/status_bar.py @@ -0,0 +1,11 @@ +import logging +from logging import _Level + +class StatusBarHandler(logging.Handler): + def __init__(self, status_bar, level: _Level = 0): + super().__init__(level) + self.status_bar = status_bar + + def emit(self, record) + message = self.format(record) + self.status_bar.show(message, 0) \ No newline at end of file diff --git a/src/classes/ui.py b/src/classes/ui.py index cdab31ecdaf4751fb0c47989dc0abc2c8ed9cdc0..9efaf7142b26948a801899fed96faf2ee2ae8ea9 100644 --- a/src/classes/ui.py +++ b/src/classes/ui.py @@ -30,6 +30,7 @@ import subprocess import pyqtgraph as pg +from PyQt5.QtWidgets import QStatusBar from pymeasure.display.browser import BrowserItem from pymeasure.display.manager import Manager, Experiment from pymeasure.display.Qt import QtCore, QtWidgets, QtGui @@ -210,6 +211,9 @@ class UIWindowBase(QtWidgets.QMainWindow): def _layout(self): self.main = QtWidgets.QWidget(self) + self.statusBar = QStatusBar() + self.setStatusBar(self.statusBar) + inputs_widget = QtWidgets.QWidget() inputs_vbox = QtWidgets.QVBoxLayout(inputs_widget)