From bd9877c5455649bddf05d61ebfe64308e26d709f Mon Sep 17 00:00:00 2001 From: AhmetCanSolak Date: Mon, 18 Apr 2022 14:59:39 -0700 Subject: [PATCH 1/8] initial commit --- copylot/gui/_qt/dockables/live_control.py | 12 ++++++++---- copylot/gui/_qt/dockables/timelapse_control.py | 16 ++++++++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/copylot/gui/_qt/dockables/live_control.py b/copylot/gui/_qt/dockables/live_control.py index 098a06d0..855a6c96 100644 --- a/copylot/gui/_qt/dockables/live_control.py +++ b/copylot/gui/_qt/dockables/live_control.py @@ -30,16 +30,20 @@ def __init__(self, parent, threadpool): # view and channel combobox widgets and options self.view_combobox = QComboBox() - self.view_combobox.addItem("view 1") - self.view_combobox.addItem("view 2") + self.view_combobox.addItems([ + "view 1", + "view 2", + ]) self.view_combobox.setCurrentIndex(self.parent.defaults["live"]["view"]) self.layout.addWidget(self.view_combobox) self.view_combobox.activated.connect(self.launch_nidaq) self.laser_combobox = QComboBox() - self.laser_combobox.addItem("488") - self.laser_combobox.addItem("561") + self.laser_combobox.addItems([ + "488", + "561", + ]) self.laser_combobox.setCurrentIndex(self.parent.defaults["live"]["laser"]) self.layout.addWidget(self.laser_combobox) diff --git a/copylot/gui/_qt/dockables/timelapse_control.py b/copylot/gui/_qt/dockables/timelapse_control.py index 35c784d8..630e8e6a 100644 --- a/copylot/gui/_qt/dockables/timelapse_control.py +++ b/copylot/gui/_qt/dockables/timelapse_control.py @@ -36,17 +36,21 @@ def __init__(self, parent, threadpool): # view and channel combobox widgets and options self.view_combobox = QComboBox() - self.view_combobox.addItem("view 1") - self.view_combobox.addItem("view 2") - self.view_combobox.addItem("view 1 and 2") + self.view_combobox.addItems([ + "view 1", + "view 2", + "view 1 and 2" + ]) self.view_combobox.setCurrentIndex(self.parent.defaults["timelapse"]["view"]) self.layout.addWidget(self.view_combobox) self.laser_combobox = QComboBox() - self.laser_combobox.addItem("488") - self.laser_combobox.addItem("561") - self.laser_combobox.addItem("488 and 561") + self.laser_combobox.addItems([ + "488", + "561", + "488 and 561", + ]) self.laser_combobox.setCurrentIndex(self.parent.defaults["timelapse"]["laser"]) self.layout.addWidget(self.laser_combobox) From b9fa9ff40c00fd9504939bfaa56ed7dc62a3ce21 Mon Sep 17 00:00:00 2001 From: AhmetCanSolak Date: Mon, 18 Apr 2022 16:02:19 -0700 Subject: [PATCH 2/8] livetimelapse widget is created --- copylot/gui/_qt/dockables/live_timelapse.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 copylot/gui/_qt/dockables/live_timelapse.py diff --git a/copylot/gui/_qt/dockables/live_timelapse.py b/copylot/gui/_qt/dockables/live_timelapse.py new file mode 100644 index 00000000..2959bffe --- /dev/null +++ b/copylot/gui/_qt/dockables/live_timelapse.py @@ -0,0 +1,13 @@ +from PyQt5.QtWidgets import QWidget + + +class LiveTimelapseControlDockWidget(QWidget): + + def __init__(self, parent, threadpool): + super(QWidget, self).__init__(parent) + + self.parent = parent + self.threadpool = threadpool + + self.running = False + self.wait_before_shutdown = False From a6a58f8a9e7baacc3d9c151e138885cc5cabde78 Mon Sep 17 00:00:00 2001 From: AhmetCanSolak Date: Mon, 18 Apr 2022 16:10:05 -0700 Subject: [PATCH 3/8] added to gui --- copylot/gui/_qt/dockables/live_timelapse.py | 15 ++++++++++-- copylot/gui/gui.py | 26 ++++++--------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/copylot/gui/_qt/dockables/live_timelapse.py b/copylot/gui/_qt/dockables/live_timelapse.py index 2959bffe..2b0f8434 100644 --- a/copylot/gui/_qt/dockables/live_timelapse.py +++ b/copylot/gui/_qt/dockables/live_timelapse.py @@ -1,7 +1,8 @@ -from PyQt5.QtWidgets import QWidget +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton -class LiveTimelapseControlDockWidget(QWidget): +class LiveTimelapseDockWidget(QWidget): def __init__(self, parent, threadpool): super(QWidget, self).__init__(parent) @@ -11,3 +12,13 @@ def __init__(self, parent, threadpool): self.running = False self.wait_before_shutdown = False + + self.layout = QVBoxLayout() + self.layout.setAlignment(Qt.AlignTop) + + # add instance launching button + self.section_button = QPushButton("Live/Timelapse Button") + + self.layout.addWidget(self.section_button) + + self.setLayout(self.layout) diff --git a/copylot/gui/gui.py b/copylot/gui/gui.py index 08757024..7190d051 100644 --- a/copylot/gui/gui.py +++ b/copylot/gui/gui.py @@ -91,10 +91,8 @@ def __init__(self, *args, **kwargs): json.dump(self.defaults, outfile) # initialize docks - self.live_dock = QDockWidget(self) - self.live_dock.setTitleBarWidget(QLabel("Live Mode")) - self.timelapse_dock = QDockWidget(self) - self.timelapse_dock.setTitleBarWidget(QLabel("Timelapse Mode")) + self.livetimelapse_dock = QDockWidget(self) + self.livetimelapse_dock.setTitleBarWidget(QLabel("Live/Timelapse Mode")) self.water_dock = QDockWidget(self) self.water_dock.setTitleBarWidget(QLabel("Water Dispenser")) self.parameters_dock = QDockWidget(self) @@ -102,8 +100,7 @@ def __init__(self, *args, **kwargs): # set common configurations for docks self.dock_list = [ - self.live_dock, - self.timelapse_dock, + self.livetimelapse_dock, self.water_dock, self.parameters_dock, ] @@ -111,20 +108,12 @@ def __init__(self, *args, **kwargs): _apply_dock_config(dock) # initialize widgets and assign to their dock - self.live_dock.setWidget( + self.livetimelapse_dock.setWidget( DockPlaceholder( - self, self.live_dock, "live_control", [self, self.threadpool] + self, self.livetimelapse_dock, "live_timelapse", [self, self.threadpool] ) ) # self.addDockWidget(Qt.RightDockWidgetArea, self.live_dock) - # - # self.timelapse_widget = TimelapseControl(self, self.threadpool) - self.timelapse_dock.setWidget( - DockPlaceholder( - self, self.timelapse_dock, "timelapse_control", [self, self.threadpool] - ) - ) - # self.addDockWidget(Qt.RightDockWidgetArea, self.timelapse_dock) # self.water_widget = WaterDispenser(self, self.threadpool) self.water_dock.setWidget( @@ -142,9 +131,8 @@ def __init__(self, *args, **kwargs): self.addDockWidget(Qt.LeftDockWidgetArea, self.parameters_dock) # split horizontal and vertical space between docks - self.splitDockWidget(self.parameters_dock, self.live_dock, Qt.Horizontal) - self.splitDockWidget(self.live_dock, self.timelapse_dock, Qt.Vertical) - self.splitDockWidget(self.timelapse_dock, self.water_dock, Qt.Vertical) + self.splitDockWidget(self.parameters_dock, self.livetimelapse_dock, Qt.Horizontal) + self.splitDockWidget(self.livetimelapse_dock, self.water_dock, Qt.Vertical) # create status bar that is updated from live and timelapse control classes self.status_bar = QStatusBar() From 459f74978386d839ca3e53b7dd82a6f1e917e816 Mon Sep 17 00:00:00 2001 From: AhmetCanSolak Date: Mon, 18 Apr 2022 16:12:52 -0700 Subject: [PATCH 4/8] black fixes --- copylot/gui/_qt/dockables/live_control.py | 20 +++++++++++-------- copylot/gui/_qt/dockables/live_timelapse.py | 1 - .../gui/_qt/dockables/timelapse_control.py | 18 ++++++++--------- copylot/gui/gui.py | 4 +++- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/copylot/gui/_qt/dockables/live_control.py b/copylot/gui/_qt/dockables/live_control.py index 855a6c96..9b729491 100644 --- a/copylot/gui/_qt/dockables/live_control.py +++ b/copylot/gui/_qt/dockables/live_control.py @@ -30,20 +30,24 @@ def __init__(self, parent, threadpool): # view and channel combobox widgets and options self.view_combobox = QComboBox() - self.view_combobox.addItems([ - "view 1", - "view 2", - ]) + self.view_combobox.addItems( + [ + "view 1", + "view 2", + ] + ) self.view_combobox.setCurrentIndex(self.parent.defaults["live"]["view"]) self.layout.addWidget(self.view_combobox) self.view_combobox.activated.connect(self.launch_nidaq) self.laser_combobox = QComboBox() - self.laser_combobox.addItems([ - "488", - "561", - ]) + self.laser_combobox.addItems( + [ + "488", + "561", + ] + ) self.laser_combobox.setCurrentIndex(self.parent.defaults["live"]["laser"]) self.layout.addWidget(self.laser_combobox) diff --git a/copylot/gui/_qt/dockables/live_timelapse.py b/copylot/gui/_qt/dockables/live_timelapse.py index 2b0f8434..05ee9cff 100644 --- a/copylot/gui/_qt/dockables/live_timelapse.py +++ b/copylot/gui/_qt/dockables/live_timelapse.py @@ -3,7 +3,6 @@ class LiveTimelapseDockWidget(QWidget): - def __init__(self, parent, threadpool): super(QWidget, self).__init__(parent) diff --git a/copylot/gui/_qt/dockables/timelapse_control.py b/copylot/gui/_qt/dockables/timelapse_control.py index 630e8e6a..9d2e5053 100644 --- a/copylot/gui/_qt/dockables/timelapse_control.py +++ b/copylot/gui/_qt/dockables/timelapse_control.py @@ -36,21 +36,19 @@ def __init__(self, parent, threadpool): # view and channel combobox widgets and options self.view_combobox = QComboBox() - self.view_combobox.addItems([ - "view 1", - "view 2", - "view 1 and 2" - ]) + self.view_combobox.addItems(["view 1", "view 2", "view 1 and 2"]) self.view_combobox.setCurrentIndex(self.parent.defaults["timelapse"]["view"]) self.layout.addWidget(self.view_combobox) self.laser_combobox = QComboBox() - self.laser_combobox.addItems([ - "488", - "561", - "488 and 561", - ]) + self.laser_combobox.addItems( + [ + "488", + "561", + "488 and 561", + ] + ) self.laser_combobox.setCurrentIndex(self.parent.defaults["timelapse"]["laser"]) self.layout.addWidget(self.laser_combobox) diff --git a/copylot/gui/gui.py b/copylot/gui/gui.py index 7190d051..1a9b0137 100644 --- a/copylot/gui/gui.py +++ b/copylot/gui/gui.py @@ -131,7 +131,9 @@ def __init__(self, *args, **kwargs): self.addDockWidget(Qt.LeftDockWidgetArea, self.parameters_dock) # split horizontal and vertical space between docks - self.splitDockWidget(self.parameters_dock, self.livetimelapse_dock, Qt.Horizontal) + self.splitDockWidget( + self.parameters_dock, self.livetimelapse_dock, Qt.Horizontal + ) self.splitDockWidget(self.livetimelapse_dock, self.water_dock, Qt.Vertical) # create status bar that is updated from live and timelapse control classes From dcf8c66a067c92ead9d9601568e8941d0001f481 Mon Sep 17 00:00:00 2001 From: AhmetCanSolak Date: Tue, 19 Apr 2022 09:02:22 -0700 Subject: [PATCH 5/8] to keep changes --- copylot/gui/_qt/dockables/live_control.py | 14 ++------------ copylot/gui/_qt/dockables/timelapse_control.py | 8 +------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/copylot/gui/_qt/dockables/live_control.py b/copylot/gui/_qt/dockables/live_control.py index 9b729491..d93537fe 100644 --- a/copylot/gui/_qt/dockables/live_control.py +++ b/copylot/gui/_qt/dockables/live_control.py @@ -30,24 +30,14 @@ def __init__(self, parent, threadpool): # view and channel combobox widgets and options self.view_combobox = QComboBox() - self.view_combobox.addItems( - [ - "view 1", - "view 2", - ] - ) + self.view_combobox.addItems(["view 1", "view 2"]) self.view_combobox.setCurrentIndex(self.parent.defaults["live"]["view"]) self.layout.addWidget(self.view_combobox) self.view_combobox.activated.connect(self.launch_nidaq) self.laser_combobox = QComboBox() - self.laser_combobox.addItems( - [ - "488", - "561", - ] - ) + self.laser_combobox.addItems(["488", "561"]) self.laser_combobox.setCurrentIndex(self.parent.defaults["live"]["laser"]) self.layout.addWidget(self.laser_combobox) diff --git a/copylot/gui/_qt/dockables/timelapse_control.py b/copylot/gui/_qt/dockables/timelapse_control.py index 9d2e5053..3da29a55 100644 --- a/copylot/gui/_qt/dockables/timelapse_control.py +++ b/copylot/gui/_qt/dockables/timelapse_control.py @@ -42,13 +42,7 @@ def __init__(self, parent, threadpool): self.layout.addWidget(self.view_combobox) self.laser_combobox = QComboBox() - self.laser_combobox.addItems( - [ - "488", - "561", - "488 and 561", - ] - ) + self.laser_combobox.addItems(["488", "561", "488 and 561"]) self.laser_combobox.setCurrentIndex(self.parent.defaults["timelapse"]["laser"]) self.layout.addWidget(self.laser_combobox) From 9efb21ceed218cdbdf03d8993648850f06c922bf Mon Sep 17 00:00:00 2001 From: AhmetCanSolak Date: Tue, 3 May 2022 11:14:51 -0700 Subject: [PATCH 6/8] timelapse worker added --- copylot/gui/_qt/dockables/live_timelapse.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/copylot/gui/_qt/dockables/live_timelapse.py b/copylot/gui/_qt/dockables/live_timelapse.py index 05ee9cff..654f4ce5 100644 --- a/copylot/gui/_qt/dockables/live_timelapse.py +++ b/copylot/gui/_qt/dockables/live_timelapse.py @@ -1,6 +1,8 @@ from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton +from copylot.hardware.ni_daq.nidaq import NIDaq + class LiveTimelapseDockWidget(QWidget): def __init__(self, parent, threadpool): @@ -21,3 +23,15 @@ def __init__(self, parent, threadpool): self.layout.addWidget(self.section_button) self.setLayout(self.layout) + + def timelapse_worker_method(self): + view = self.view_combobox.currentIndex() + channel = ( + [int(self.laser_combobox.currentText())] + if self.laser_combobox.currentIndex() != 2 + else [488, 561] + ) + parameters = self.parent.parameters_widget.parameters + + daq_card = NIDaq(self, **parameters) + daq_card.acquire_stacks(channels=channel, view=view) From f4ef4e3c004a5b2ec6f7d7feee6732c588331599 Mon Sep 17 00:00:00 2001 From: AhmetCanSolak Date: Tue, 3 May 2022 11:16:12 -0700 Subject: [PATCH 7/8] live worker method added --- copylot/gui/_qt/dockables/live_timelapse.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/copylot/gui/_qt/dockables/live_timelapse.py b/copylot/gui/_qt/dockables/live_timelapse.py index 654f4ce5..a5acacc8 100644 --- a/copylot/gui/_qt/dockables/live_timelapse.py +++ b/copylot/gui/_qt/dockables/live_timelapse.py @@ -35,3 +35,12 @@ def timelapse_worker_method(self): daq_card = NIDaq(self, **parameters) daq_card.acquire_stacks(channels=channel, view=view) + + def live_worker_method(self): + view = self.combobox_view + channel = self.combobox_channel + parameters = self.parent.parameters_widget.parameters + + daq_card = NIDaq(self, **parameters) + daq_card.select_view(view) + daq_card.select_channel_remove_stripes(channel) From 0e40feb91c2a0768c782768141ed5412b1084b60 Mon Sep 17 00:00:00 2001 From: acs-ws Date: Thu, 12 May 2022 09:17:52 -0700 Subject: [PATCH 8/8] timelapse and live buttons separated --- copylot/gui/_qt/dockables/live_timelapse.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/copylot/gui/_qt/dockables/live_timelapse.py b/copylot/gui/_qt/dockables/live_timelapse.py index a5acacc8..fc81c57f 100644 --- a/copylot/gui/_qt/dockables/live_timelapse.py +++ b/copylot/gui/_qt/dockables/live_timelapse.py @@ -18,9 +18,11 @@ def __init__(self, parent, threadpool): self.layout.setAlignment(Qt.AlignTop) # add instance launching button - self.section_button = QPushButton("Live/Timelapse Button") + self.live_button = QPushButton("Live Button") + self.timelapse_button = QPushButton("Timelapse Button") - self.layout.addWidget(self.section_button) + self.layout.addWidget(self.live_button) + self.layout.addWidget(self.timelapse_button) self.setLayout(self.layout)