-
Notifications
You must be signed in to change notification settings - Fork 2
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
Enhancement one #45
Enhancement one #45
Changes from all commits
9f8d153
1b0f0c9
1641d7a
dca9c81
777e6af
3997f9b
0288b44
fe4b622
5e93c07
5f5ab43
0f15cfd
fb462eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,17 @@ | |
QVBoxLayout, | ||
QWidget, | ||
QPushButton, | ||
QFileDialog | ||
QFileDialog, | ||
QDialog, | ||
QTextEdit | ||
) | ||
from PyQt5.QtCore import pyqtSignal | ||
from PyQt5.QtCore import pyqtSignal, Qt | ||
from lightsheet.state import State | ||
from pathlib import Path | ||
from datetime import datetime | ||
import markdown | ||
|
||
DEFAULT_SETTIGNS_PATH = "C:/Users/portugueslab/lightsheet_settings" | ||
DEFAULT_SETTINGS_PATH = "C:/Users/portugueslab/lightsheet_settings" | ||
|
||
|
||
class SavingSettingsWidget(QWidget): | ||
|
@@ -21,18 +24,28 @@ def __init__(self, st: State): | |
self.setLayout(QVBoxLayout()) | ||
self.btn_load = QPushButton("Load settings") | ||
self.btn_save = QPushButton("Save settings") | ||
self.btn_instructions = QPushButton("User guide") | ||
f = open(r"../lightsheet_procedure.md") | ||
self.html_markdown = markdown.markdown(f.read()) | ||
self.instructions = QTextEdit(self.html_markdown) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure this is not editable, so people don't get the mistaken impression that they can update the instructions from the GUI :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed |
||
self.instructions.setReadOnly(True) | ||
self.popup_window = QDialog(None, Qt.WindowSystemMenuHint | Qt.WindowTitleHint | Qt.WindowCloseButtonHint) | ||
self.layout().addWidget(self.btn_load) | ||
self.layout().addWidget(self.btn_save) | ||
self.layout().addWidget(self.btn_instructions) | ||
self.popup_window.setLayout(QVBoxLayout()) | ||
self.popup_window.layout().addWidget(self.instructions) | ||
self.btn_load.clicked.connect(self.load) | ||
self.btn_save.clicked.connect(self.save) | ||
self.btn_instructions.clicked.connect(self.popup_window.show) | ||
|
||
def load(self): | ||
file, _ = QFileDialog.getOpenFileName(None, "Open settings file", DEFAULT_SETTIGNS_PATH, "*.json") | ||
file, _ = QFileDialog.getOpenFileName(None, "Open settings file", DEFAULT_SETTINGS_PATH, "*.json") | ||
if Path(file).is_file(): | ||
self.state.restore_tree(file) | ||
self.sig_params_loaded.emit() | ||
|
||
def save(self): | ||
pth = Path(DEFAULT_SETTIGNS_PATH) | ||
pth = Path(DEFAULT_SETTINGS_PATH) | ||
filename = datetime.now().strftime("%y%m%d %H%M%S.json") | ||
self.state.save_tree(pth/filename) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ pyvisa==1.10.1 | |
pyzmq==18.1.0 | ||
QDarkStyle==2.7 | ||
yagmail==0.11.224 | ||
markdown==3.2.2 | ||
click |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is all just a variable rename, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes just some code refactoring to make it less confusing