Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
campagnola committed Sep 17, 2022
1 parent a33d08b commit 2d256f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
7 changes: 1 addition & 6 deletions neurodemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@


if __name__ == '__main__':
proc = None
# Enable running simulation in background process:
# import pyqtgraph.multiprocess as mp
# proc = mp.QtProcess(debug=False)

win = DemoWindow(proc)
win = DemoWindow(multiprocessing=False)
if (sys.flags.interactive != 1) or not hasattr(QtCore, "PYQT_VERSION"):
QtWidgets.QApplication.instance().exec()
13 changes: 10 additions & 3 deletions neurodemo/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ class IonClass:


class DemoWindow(QtWidgets.QWidget):
def __init__(self, proc=None):
def __init__(self, multiprocessing=False):
if multiprocessing:
# Enable running simulation in background process:
import pyqtgraph.multiprocess as mp
self.proc = mp.QtProcess(debug=False)
else:
self.proc = None

self.app = pg.mkQApp()
self.app.setStyle("fusion")
self.app.setStyleSheet("QLabel{font-size: 11pt;} QText{font-size: 11pt;} {QWidget{font-size: 8pt;}")
self.app.setStyleSheet("QTreeWidgetItem{font-size: 9pt;}") # QText{font-size: 11pt;} {QWidget{font-size: 8pt;}")

self.proc = proc
if self.proc is None:
print(sys.platform, "running without mp")
# do not use remote process:
Expand All @@ -65,7 +71,8 @@ def __init__(self, proc=None):
self.integrator = 'solve_ivp'
self.scrolling_plot_duration = 1.0 * NU.s
self.sim = self.ndemo.Sim(temp=6.3, dt=self.dt)
# self.sim._setProxyOptions(deferGetattr=True) # only if using remote process
if self.proc is not None:
self.sim._setProxyOptions(deferGetattr=True) # only if using remote process
self.neuron = self.ndemo.Section(name='soma')
self.sim.add(self.neuron)

Expand Down

0 comments on commit 2d256f7

Please sign in to comment.