Added all the file loaders.

pull/1/head
Ivan Olexyn 6 years ago
parent 722da695a3
commit 9e20b7c5d2

@ -1,5 +1,5 @@
from PyQt5.QtWidgets import QPlainTextEdit, QHBoxLayout, QWidget, QGridLayout, QLabel, QPushButton, QTableWidget, QTableWidgetItem
from tools import Tools
class OneDimView(QWidget):
@ -28,10 +28,10 @@ class OneDimView(QWidget):
# but to create the correct visual effect it must span also over the invisible spacder column,
# Thus from (3,1) to (3,3).
self.grid.addWidget(QLabel(), 10,10)
self.load_data_button = QPushButton()
self.load_data_button.setText("Load Data File")
self.load_data_button.setMaximumWidth(200)
self.grid.addWidget(self.load_data_button, 0, 0)
self.loadDataButton = QPushButton()
self.loadDataButton.setText("Load Data File")
self.loadDataButton.setMaximumWidth(200)
self.grid.addWidget(self.loadDataButton, 0, 0)
self.one_d_text = OneDText()
@ -55,6 +55,8 @@ class OneDimView(QWidget):
self.grid.addWidget(self.buttons32,3,2)
def set_widget_actions(self):
self.dataFile = self.loadDataButton.clicked.connect(lambda: Tools().open_file(self))
pass

@ -4,7 +4,7 @@
from PyQt5.QtWidgets import QPlainTextEdit, QVBoxLayout, QHBoxLayout, QWidget, QGridLayout, QLabel, QPushButton, QTableWidget, QTableWidgetItem
from PyQt5.QtGui import QPixmap
from tools import Tools
class PrepareView(QWidget):
@ -16,7 +16,6 @@ class PrepareView(QWidget):
self.setLayout(self.grid)
self.define_widgets()
self.showView('none')
self.set_widget_actions()
@ -84,6 +83,9 @@ class PrepareView(QWidget):
def set_widget_actions(self):
self.crystalFile = self.loadCrystalFileButton.clicked.connect(lambda: Tools().open_file(self))
self.instrumentFile = self.loadInstrumentFileButton.clicked.connect(lambda: Tools().open_file(self))
self.sectorNucButton.clicked.connect(lambda: self.showView('nuc'))
self.sectorMagButton.clicked.connect(lambda: self.showView('mag'))
pass
@ -144,9 +146,9 @@ class Buttons00(QWidget):
grid = QGridLayout()
self.setLayout(grid)
c.loadcrystalButton = QPushButton()
c.loadcrystalButton.setText("Load Crystal File")
grid.addWidget(c.loadcrystalButton, 0, 0)
c.loadCrystalFileButton = QPushButton()
c.loadCrystalFileButton.setText("Load Crystal File")
grid.addWidget(c.loadCrystalFileButton, 0, 0)
c.loadInstrumentFileButton = QPushButton()
c.loadInstrumentFileButton.setText('Load Instrument File')

@ -0,0 +1,24 @@
import sys
from PyQt5.QtWidgets import QFileDialog
class Tools():
def __init__(self):
pass
def open_file(self, container):
''' Corresponds to 1.2
TODO Right now this is just copy&pasted. Clean this up.'''
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(container,"QFileDialog.getOpenFileName()", "","All Files (*);;Python Files (*.py)", options=options)
if fileName:
return fileName
pass

@ -1,6 +1,6 @@
from PyQt5.QtWidgets import QWidget, QGridLayout, QComboBox, QLabel, QPushButton, QAction, QHBoxLayout, QTabWidget, QTableWidget, QPlainTextEdit
from tools import Tools
class TwoDimView(QWidget):
@ -38,10 +38,10 @@ class TwoDimView(QWidget):
# but to create the correct visual effect it must span also over the invisible spacder column,
# Thus from (3,1) to (3,3).
self.grid.addWidget(QLabel(), 10,10)
self.load_data_button = QPushButton()
self.load_data_button.setText("Load Data File")
self.load_data_button.setMaximumWidth(200)
self.grid.addWidget(self.load_data_button, 1, 0)
self.loadDataButton = QPushButton()
self.loadDataButton.setText("Load Data File")
self.loadDataButton.setMaximumWidth(200)
self.grid.addWidget(self.loadDataButton, 1, 0)
self.one_d_text = OneDText()
@ -66,6 +66,8 @@ class TwoDimView(QWidget):
def set_widget_actions(self):
self.dataFile = self.loadDataButton.clicked.connect(lambda: Tools().open_file(self))
pass

@ -70,7 +70,6 @@ class Zebra(QMainWindow):
self.oneDMenuEntry = QAction('1D Mode')
self.oneDMenuEntry.triggered.connect(lambda: self.showView('1D'))
self.modeMenu.addAction(self.oneDMenuEntry)
self.twoDMenuEntry = QAction('2D Mode')
self.twoDMenuEntry.triggered.connect(lambda: self.showView('2D'))
self.modeMenu.addAction(self.twoDMenuEntry)

Loading…
Cancel
Save