Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
total_control_app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Drechsler
total_control_app
Commits
703b32d7
Commit
703b32d7
authored
Oct 22, 2018
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now warnings appear in windows, and some other very minor changes
parent
670e11b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
8 deletions
+45
-8
messages.py
messages.py
+29
-0
myWidgets.py
myWidgets.py
+16
-8
No files found.
messages.py
0 → 100644
View file @
703b32d7
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 22 11:46:00 2018
@author: martindrech
"""
from
PyQt5.QtWidgets
import
QMessageBox
def
show_warning
(
text
,
details_text
=
''
):
msg
=
QMessageBox
()
msg
.
setIcon
(
QMessageBox
.
Warning
)
msg
.
setText
(
text
)
msg
.
setWindowTitle
(
"Oh dear"
)
if
details_text
:
msg
.
setDetailedText
(
details_text
)
msg
.
setStandardButtons
(
QMessageBox
.
Ok
)
msg
.
buttonClicked
.
connect
(
msgbtn
)
retval
=
msg
.
exec_
()
#print("value of pressed message box button:", retval)
def
msgbtn
(
i
):
print
(
"Button pressed is:"
,
i
.
text
())
\ No newline at end of file
myWidgets.py
View file @
703b32d7
...
...
@@ -12,7 +12,7 @@ from PyQt5.QtCore import QTimer
from
PyQt5.QtWidgets
import
(
QPushButton
,
QWidget
,
QVBoxLayout
,
QLCDNumber
,
QProgressBar
,
QLabel
)
import
telnetlib
import
os
from
messages
import
show_warning
#An example of a class
class
anal_control_signal
(
QWidget
):
...
...
@@ -38,7 +38,7 @@ class anal_control_signal(QWidget):
try
:
self
.
AO
=
daq_AO
(
self
.
ch
)
except
:
print
(
'Analog output
%
i not found. Daq might not be connected'
%
self
.
ch
)
show_warning
(
'Analog output
%
i not found. Daq might not be connected'
%
self
.
ch
)
...
...
@@ -109,7 +109,8 @@ class anal_control_signal(QWidget):
self
.
scanLabelValue
.
setText
(
"
%.2
f"
%
self
.
scan_step
+
' V'
)
except
ZeroDivisionError
:
self
.
doScanAction
()
print
(
'Oh dear, you might be trying to scan from 0 to 0. Plase never do that again. '
)
#print('Oh dear, you might be trying to scan from 0 to 0. Plase never do that again. ')
show_warning
(
'Oh dear, you might be trying to scan from 0 to 0. Plase never do that again.'
)
def
doScanAction
(
self
):
...
...
@@ -142,9 +143,10 @@ class anal_control_signal(QWidget):
if
self
.
scan_step
>
b
or
self
.
scan_step
<
a
:
print
(
'scan can not start outside scan range and scan start should be lower than scan stop'
)
details
=
'Remember remember the fifth of November.'
+
'
\n
'
+
'Also remember that scan starts from the value of the corresponding spin box'
show_warning
(
'Scan can not start outside scan range and scan start should be lower than scan stop'
,
details_text
=
details
)
elif
n
<
5
:
print
(
'
%
i steps are too few, you need at least 5 steps'
%
(
n
)
)
show_warning
(
'
%
i steps are too few, you need at least 5 steps'
%
(
n
)
)
pass
else
:
self
.
sb
.
setEnabled
(
False
)
...
...
@@ -171,7 +173,7 @@ class digital_control_signal(QWidget):
try
:
self
.
DO
=
daq_DO
(
self
.
ch
)
except
:
print
(
'Digital output
%
i not found. Daq might not be connected'
%
self
.
ch
)
show_warning
(
'Digital output
%
i not found. Daq might not be connected'
%
self
.
ch
)
self
.
cb
=
QtGui
.
QCheckBox
()
self
.
cb
.
stateChanged
.
connect
(
self
.
whenChangeDigital
)
...
...
@@ -210,9 +212,15 @@ class burleighWM(QWidget):
wavemeter_ok
=
False
try
:
tn
=
telnetlib
.
Telnet
(
host
=
"wannanosaurus"
,
port
=
1234
,
timeout
=
1
)
wavemeter_ok
=
True
except
:
print
(
'wannanosaurus not connected'
)
show_warning
(
'Wannanosaurus not connected'
)
if
tn
.
sock_avail
():
wavemeter_ok
=
True
else
:
show_warning
(
'Wannanosaurus seems connected but WM might be off.'
)
if
wavemeter_ok
:
tn
.
write
(
b
'++eos 1
\n
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment