Skip to content

Remote devel #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cd6afc8
created dialogs.py added browsing remote filesystem
paskino Nov 11, 2021
2f963db
reset the remote settings checkbox
paskino Nov 11, 2021
4e9d200
allows copy from the remote to local
paskino Nov 30, 2021
cf3fb23
update progress dialog
paskino Nov 30, 2021
61b3c08
revert tempfile.tempdir change
paskino Nov 30, 2021
cd35b9c
added remote workdir selection
paskino Nov 30, 2021
e6c47e7
work in progress to push dvc config to remote
paskino Nov 30, 2021
effa417
about ok
paskino Dec 1, 2021
a2f563e
up to zip dvc config and transfer to remote
paskino Dec 1, 2021
7fc1624
up to unzip on remote
paskino Dec 3, 2021
6dc4823
first working run on the remote
paskino Dec 3, 2021
654e111
fix indent
paskino Dec 3, 2021
a5dde6c
some updates
paskino Dec 3, 2021
8272d53
retrieves the results from remote
paskino Dec 10, 2021
d14e18e
graph window partially populated
paskino Dec 11, 2021
566fef6
Merge remote-tracking branch 'origin' into remote_devel
paskino Dec 13, 2021
ac2124c
added comments on remote transfer of files
paskino Dec 15, 2021
5bdd97d
Merge remote-tracking branch 'origin' into remote_devel
paskino Dec 15, 2021
e1fd2b6
fix check for local run
paskino Dec 15, 2021
43d680e
Fixes error in displaying DVC results (#78)
lauramurgatroyd Dec 15, 2021
a77789f
Merge branch 'remote_devel' of github.com:TomographicImaging/iDVC int…
paskino Dec 15, 2021
0807b92
make local dvc analysis work again
paskino Dec 15, 2021
d5b62ba
Merge remote-tracking branch 'origin' into remote_devel
paskino Jan 26, 2022
42a1fa2
Merge branch 'master' into remote_devel
paskino May 19, 2022
3fa4ec3
Merge remote-tracking branch 'origin' into remote_devel
paskino May 20, 2022
ce11634
Merge branch 'master' into remote_devel
paskino Sep 27, 2022
3544e94
Merge branch 'master' into remote_devel
paskino Nov 25, 2022
645fafe
Merge branch 'master' into remote_devel
paskino Mar 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ requirements:
- matplotlib
- openmp # [osx]
- qdarkstyle
- brem
- vtk=8.1.2

about:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def version2pep440(version):
setup(
name = "idvc",
description = 'CCPi DVC Configurator',
version = dversion,
packages = {'idvc'},
version = dversion,
packages = {'idvc'},
package_dir = {'idvc': os.path.join('src','idvc')},
package_data = {'idvc':['DVCIconSquare.png']},
# metadata for upload to PyPI
Expand Down
211 changes: 211 additions & 0 deletions src/idvc/dialogs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtWidgets import QCheckBox, QLabel, QDoubleSpinBox, QFrame, QVBoxLayout,\
QDialogButtonBox, QPushButton, QDialog, QLineEdit
from PySide2.QtCore import Qt
import vtk
from brem.ui import RemoteServerSettingDialog, RemoteFileDialog
from eqt.ui import UIFormFactory

import os, posixpath

class SettingsWindow(QDialog):

def __init__(self, parent):
super(SettingsWindow, self).__init__(parent)

self.parent = parent

self.setWindowTitle("Settings")

self.dark_checkbox = QCheckBox("Dark Mode")

self.copy_files_checkbox = QCheckBox("Allow a copy of the image files to be stored. ")
self.vis_size_label = QLabel("Maximum downsampled image size (GB): ")
self.vis_size_entry = QDoubleSpinBox()

self.vis_size_entry.setMaximum(64.0)
self.vis_size_entry.setMinimum(0.01)
self.vis_size_entry.setSingleStep(0.01)

if self.parent.settings.value("vis_size") is not None:
self.vis_size_entry.setValue(float(self.parent.settings.value("vis_size")))

else:
self.vis_size_entry.setValue(1.0)


if self.parent.settings.value("dark_mode") is not None:
if self.parent.settings.value("dark_mode") == "true":
self.dark_checkbox.setChecked(True)
else:
self.dark_checkbox.setChecked(False)
else:
self.dark_checkbox.setChecked(True)

separator = QFrame()
separator.setFrameShape(QFrame.HLine)
separator.setFrameShadow(QFrame.Raised)
self.adv_settings_label = QLabel("Advanced")


self.gpu_label = QLabel("Please set the size of your GPU memory.")
self.gpu_size_label = QLabel("GPU Memory (GB): ")
self.gpu_size_entry = QDoubleSpinBox()


if self.parent.settings.value("gpu_size") is not None:
self.gpu_size_entry.setValue(float(self.parent.settings.value("gpu_size")))

else:
self.gpu_size_entry.setValue(1.0)

self.gpu_size_entry.setMaximum(64.0)
self.gpu_size_entry.setMinimum(0.00)
self.gpu_size_entry.setSingleStep(0.01)
self.gpu_checkbox = QCheckBox("Use GPU for volume render. (Recommended) ")
self.gpu_checkbox.setChecked(True) #gpu is default
if self.parent.settings.value("volume_mapper") == "cpu":
self.gpu_checkbox.setChecked(False)

if hasattr(self.parent, 'copy_files'):
self.copy_files_checkbox.setChecked(self.parent.copy_files)

self.layout = QVBoxLayout(self)
self.layout.addWidget(self.dark_checkbox)
self.layout.addWidget(self.copy_files_checkbox)
self.layout.addWidget(self.vis_size_label)
self.layout.addWidget(self.vis_size_entry)
self.layout.addWidget(separator)
self.layout.addWidget(self.adv_settings_label)
self.layout.addWidget(self.gpu_checkbox)
self.layout.addWidget(self.gpu_label)
self.layout.addWidget(self.gpu_size_label)
self.layout.addWidget(self.gpu_size_entry)

# configure remote server settings
remote_separator = QFrame()
remote_separator.setFrameShape(QFrame.HLine)
remote_separator.setFrameShadow(QFrame.Raised)
fw = UIFormFactory.getQWidget(parent=self)

self.remote_button_entry = QPushButton(self)
self.remote_button_entry.setText("Open Preferences")
self.remote_button_entry.clicked.connect(self.openConfigRemote)
fw.addWidget(self.remote_button_entry, 'Configure remote settings', 'remote_preferences')
cb = QCheckBox(self)
cb.setChecked(self.parent.connection_details is not None)
fw.addWidget(cb, 'Connect to remote server', 'connect_to_remote')
select_remote_workdir = QPushButton(self)
select_remote_workdir.setText('Browse')
select_remote_workdir.clicked.connect(self.browseRemote)
fw.addWidget(select_remote_workdir, 'Select remote workdir', 'select_remote_workdir')
remote_workdir = QLineEdit(self)
fw.addWidget(remote_workdir, 'Remote workdir', 'remote_workdir')

self.fw = fw
for k,v in fw.widgets.items():
print ("fw", k)
# add to layout
self.layout.addWidget(remote_separator)
self.layout.addWidget(fw)

self.buttons = QDialogButtonBox(
QDialogButtonBox.Save | QDialogButtonBox.Cancel,
Qt.Horizontal, self)
self.layout.addWidget(self.buttons)
self.buttons.accepted.connect(self.accept)
self.buttons.rejected.connect(self.quit)

def accept(self):
#self.parent.settings.setValue("settings_chosen", 1)
if self.dark_checkbox.isChecked():
self.parent.settings.setValue("dark_mode", True)
else:
self.parent.settings.setValue("dark_mode", False)
self.parent.SetAppStyle()

if self.copy_files_checkbox.isChecked():
self.parent.copy_files = 1 # save for this session
self.parent.settings.setValue("copy_files", 1) #save for next time we open app
else:
self.parent.copy_files = 0
self.parent.settings.setValue("copy_files", 0)

if self.gpu_checkbox.isChecked():
self.parent.settings.setValue("volume_mapper", "gpu")
self.parent.vis_widget_3D.volume_mapper = vtk.vtkSmartVolumeMapper()
else:
self.parent.settings.setValue("volume_mapper", "cpu")

self.parent.settings.setValue("gpu_size", float(self.gpu_size_entry.value()))
self.parent.settings.setValue("vis_size", float(self.vis_size_entry.value()))

if self.parent.settings.value("first_app_load") != "False":
self.parent.CreateSessionSelector("new window")
self.parent.settings.setValue("first_app_load", "False")

# if remote is checked
statusBar = self.parent.statusBar()
if self.fw.widgets['connect_to_remote_field'].isChecked():
self.parent.connection_details = self.connection_details
statusBar.showMessage("Connected to {}@{}:{}".format(
self.connection_details['username'],
self.connection_details['server_name'],
self.connection_details['server_port'])
)
else:
statusBar.clearMessage()
self.parent.connection_details = None
self.close()


#print(self.parent.settings.value("copy_files"))
def quit(self):
if self.parent.settings.value("first_app_load") != "False":
self.parent.CreateSessionSelector("new window")
self.parent.settings.setValue("first_app_load", "False")
self.close()

def openConfigRemote(self):

dialog = RemoteServerSettingDialog(self,port=None,
host=None,
username=None,
private_key=None)
dialog.Ok.clicked.connect(lambda: self.getConnectionDetails(dialog))
dialog.exec()

def getConnectionDetails(self, dialog):
for k,v in dialog.connection_details.items():
print (k,v)
self.connection_details = dialog.connection_details


def browseRemote(self):
# start the RemoteFileBrowser
logfile = os.path.join(os.getcwd(), '..','..',"RemoteFileDialog.log")
# logfile = None
dialog = RemoteFileDialog(self, logfile=logfile, port=self.connection_details['server_port'],
host=self.connection_details['server_name'],
username=self.connection_details['username'],
private_key=self.connection_details['private_key'],
remote_os=self.connection_details['remote_os'])
dialog.Ok.clicked.connect(
lambda: self.getSelectedRemoteWorkdir(dialog)
)
if hasattr(self, 'files_to_get'):
try:
dialog.widgets['lineEdit'].setText(self.files_to_get[0][0])
except:
pass
dialog.exec()


def getSelectedRemoteWorkdir(self, dialog):
if hasattr(dialog, 'selected'):
print (type(dialog.selected))
for el in dialog.selected:
print ("Return from dialogue", el)
self.files_to_get = list (dialog.selected)
remote_workdir = posixpath.join(self.files_to_get[0][0], self.files_to_get[0][1])
self.fw.widgets['remote_workdir_field'].setText(remote_workdir)
Loading