Skip to content

Commit 1ae87b5

Browse files
committed
Merge branch 'dev'
2 parents 28cf5ea + 5b73b60 commit 1ae87b5

5 files changed

Lines changed: 83 additions & 6 deletions

File tree

config/gui_settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
event_history_len = 200 # Length of event history to plot (# events).
88
state_history_len = 100 # Length of state history to plot (# states).
99
analog_history_dur = 12 # Duration of analog signal history to plot (seconds).
10-
active_cerebros = ["1","23"]
1110

1211
ui_font_size = 11 # Font size of UI elements (button text, label text etc.).
1312
log_font_size = 9 # Font size of the data log.

gui/GUI_main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
import sys
3+
import ctypes
34
import traceback
5+
import logging
46

57
from serial.tools import list_ports
68
from pyqtgraph.Qt import QtGui, QtCore
@@ -13,6 +15,9 @@
1315
from gui.run_experiment_tab import Run_experiment_tab
1416
from gui.setups_tab import Setups_tab
1517

18+
if os.name == 'nt': # Needed on windows to get taskbar icon to display correctly.
19+
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(u'pyControl')
20+
1621
# --------------------------------------------------------------------------------
1722
# GUI_main
1823
# --------------------------------------------------------------------------------
@@ -179,7 +184,7 @@ def excepthook(self, ex_type, ex_value, ex_traceback):
179184
'''Called whenever an uncaught exception occurs.'''
180185
if hasattr(self.tab_widget.currentWidget(), 'excepthook'):
181186
self.tab_widget.currentWidget().excepthook(ex_type, ex_value, ex_traceback)
182-
traceback.print_exception(ex_type, ex_value, ex_traceback)
187+
logging.error(''.join(traceback.format_exception(ex_type, ex_value, ex_traceback)))
183188

184189
# --------------------------------------------------------------------------------
185190
# Launch GUI.
@@ -189,6 +194,7 @@ def launch_GUI():
189194
'''Launch the pyControl GUI.'''
190195
app = QtGui.QApplication(sys.argv)
191196
app.setStyle('Fusion')
197+
app.setWindowIcon(QtGui.QIcon("gui/icons/logo.svg"))
192198
font = QtGui.QFont()
193199
font.setPixelSize(ui_font_size)
194200
app.setFont(font)

gui/configure_experiment_tab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ def available_subjects(self, v_name, s_name=None):
597597

598598
def task_changed(self, task):
599599
'''Remove variables that are not defined in the new task.'''
600-
pattern = "[\n\r]v\.(?P<vname>\w+)\s*\="
600+
pattern = "[\n\r\.]v\.(?P<vname>\w+)\s*\="
601601
try:
602602
with open(os.path.join(dirs['tasks'], task+'.py'), "r") as file:
603603
file_content = file.read()

gui/icons/logo.svg

Lines changed: 68 additions & 0 deletions
Loading

pyControl_GUI.py renamed to pyControl_GUI.pyw

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
# Check that depndencies are installed then launch the pyControl GUI.
22

33
import sys
4-
import os
4+
import logging
5+
6+
# Setup error logging.
7+
logging.basicConfig(level=logging.ERROR,
8+
handlers=[logging.FileHandler('ErrorLog.txt', delay=True)],
9+
format='%(asctime)s %(message)s')
510

611
# Check dependencies are installed.
712
try:
813
import numpy
914
import serial
1015
import pyqtgraph
1116
except Exception as e:
12-
print('Unable to import dependencies:\n\n'+str(e))
13-
input('\nPress enter to close.')
17+
logging.error(' Unable to import dependencies:\n\n'+str(e)+'\n\n')
1418
sys.exit()
1519

1620
# Launch the GUI.

0 commit comments

Comments
 (0)