few bugfixes
This commit is contained in:
parent
80577dcfc7
commit
f935da8296
42
QtPyLoT.py
42
QtPyLoT.py
@ -91,6 +91,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.project = None
|
self.project = None
|
||||||
self.array_map = None
|
self.array_map = None
|
||||||
self._metadata = None
|
self._metadata = None
|
||||||
|
self._eventChanged = False
|
||||||
|
|
||||||
self.poS_id = None
|
self.poS_id = None
|
||||||
self.ae_id = None
|
self.ae_id = None
|
||||||
@ -170,7 +171,7 @@ class MainWindow(QMainWindow):
|
|||||||
self._event_layout.addWidget(self.eventBox)
|
self._event_layout.addWidget(self.eventBox)
|
||||||
self._event_layout.setStretch(1,1) #set stretch of item 1 to 1
|
self._event_layout.setStretch(1,1) #set stretch of item 1 to 1
|
||||||
self._main_layout.addLayout(self._event_layout)
|
self._main_layout.addLayout(self._event_layout)
|
||||||
self.eventBox.activated.connect(self.refreshTabs)
|
self.eventBox.activated.connect(self.refreshEvents)
|
||||||
|
|
||||||
# add tabs
|
# add tabs
|
||||||
self.tabs = QTabWidget()
|
self.tabs = QTabWidget()
|
||||||
@ -185,7 +186,6 @@ class MainWindow(QMainWindow):
|
|||||||
self.tabs.addTab(self.dataPlot, 'Waveform Plot')
|
self.tabs.addTab(self.dataPlot, 'Waveform Plot')
|
||||||
self.init_array_tab()
|
self.init_array_tab()
|
||||||
|
|
||||||
|
|
||||||
quitIcon = self.style().standardIcon(QStyle.SP_MediaStop)
|
quitIcon = self.style().standardIcon(QStyle.SP_MediaStop)
|
||||||
saveIcon = self.style().standardIcon(QStyle.SP_DriveHDIcon)
|
saveIcon = self.style().standardIcon(QStyle.SP_DriveHDIcon)
|
||||||
openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon)
|
openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon)
|
||||||
@ -265,11 +265,11 @@ class MainWindow(QMainWindow):
|
|||||||
"Load location information on "
|
"Load location information on "
|
||||||
"the displayed event.")
|
"the displayed event.")
|
||||||
self.loadpilotevent = self.createAction(self, "Load PILOT &event ...",
|
self.loadpilotevent = self.createAction(self, "Load PILOT &event ...",
|
||||||
self.load_pilotevent, "Ctrl+E",
|
self.load_pilotevent, "Ctrl+E",
|
||||||
loadpiloticon,
|
loadpiloticon,
|
||||||
"Load PILOT event from information "
|
"Load PILOT event from information "
|
||||||
"MatLab binary collections (created"
|
"MatLab binary collections (created"
|
||||||
" in former MatLab based version).")
|
" in former MatLab based version).")
|
||||||
self.loadpilotevent.setEnabled(False)
|
self.loadpilotevent.setEnabled(False)
|
||||||
|
|
||||||
self.saveEventAction = self.createAction(self, "&Save event ...",
|
self.saveEventAction = self.createAction(self, "&Save event ...",
|
||||||
@ -604,7 +604,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.eventBox.setCurrentIndex(0)
|
self.eventBox.setCurrentIndex(0)
|
||||||
else:
|
else:
|
||||||
self.eventBox.setCurrentIndex(nitems)
|
self.eventBox.setCurrentIndex(nitems)
|
||||||
self.refreshTabs()
|
self.refreshEvents()
|
||||||
|
|
||||||
def fill_eventbox(self, eventlist):
|
def fill_eventbox(self, eventlist):
|
||||||
model = self.eventBox.model()
|
model = self.eventBox.model()
|
||||||
@ -782,11 +782,17 @@ class MainWindow(QMainWindow):
|
|||||||
return self.saveData()
|
return self.saveData()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def refreshEvents(self):
|
||||||
|
self._eventChanged = True
|
||||||
|
self.refreshTabs()
|
||||||
|
|
||||||
def refreshTabs(self):
|
def refreshTabs(self):
|
||||||
if self.tabs.currentIndex() == 0:
|
if self.tabs.currentIndex() == 0:
|
||||||
if hasattr(self.project, 'eventlist'):
|
if hasattr(self.project, 'eventlist'):
|
||||||
if len(self.project.eventlist) > 0:
|
if len(self.project.eventlist) > 0:
|
||||||
self.loadWaveformDataThread()
|
if self._eventChanged:
|
||||||
|
self.loadWaveformDataThread()
|
||||||
|
self._eventChanged = False
|
||||||
if self.tabs.currentIndex() == 1:
|
if self.tabs.currentIndex() == 1:
|
||||||
self.refresh_array_map()
|
self.refresh_array_map()
|
||||||
|
|
||||||
@ -1197,15 +1203,15 @@ class MainWindow(QMainWindow):
|
|||||||
widget.setLayout(grid_layout)
|
widget.setLayout(grid_layout)
|
||||||
self.tabs.addTab(widget, 'Array Maps')
|
self.tabs.addTab(widget, 'Array Maps')
|
||||||
|
|
||||||
def init_array_map(self):
|
def init_array_map(self, index=1):
|
||||||
if not self.array_map:
|
if not self.array_map:
|
||||||
self.get_metadata()
|
self.get_metadata()
|
||||||
if not self.metadata:
|
if not self.metadata:
|
||||||
return
|
return
|
||||||
self.array_map = map_projection(self)
|
|
||||||
self.tabs.removeTab(1)
|
self.tabs.removeTab(1)
|
||||||
|
self.array_map = map_projection(self)
|
||||||
self.tabs.addTab(self.array_map, 'Array Map')
|
self.tabs.addTab(self.array_map, 'Array Map')
|
||||||
self.tabs.setCurrentIndex(1)
|
self.tabs.setCurrentIndex(index)
|
||||||
|
|
||||||
def refresh_array_map(self):
|
def refresh_array_map(self):
|
||||||
if not self.array_map:
|
if not self.array_map:
|
||||||
@ -1220,6 +1226,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def set_metadata(self):
|
def set_metadata(self):
|
||||||
self.metadata = self.rm_thread.data
|
self.metadata = self.rm_thread.data
|
||||||
|
self.project.metadata = self.rm_thread.data
|
||||||
self.init_array_map()
|
self.init_array_map()
|
||||||
|
|
||||||
def get_metadata(self):
|
def get_metadata(self):
|
||||||
@ -1240,6 +1247,10 @@ class MainWindow(QMainWindow):
|
|||||||
self.read_metadata_thread(fninv)
|
self.read_metadata_thread(fninv)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if hasattr(self.project, 'metadata'):
|
||||||
|
self.metadata = self.project.metadata
|
||||||
|
return True
|
||||||
|
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
fninv = settings.value("inventoryFile", None)
|
fninv = settings.value("inventoryFile", None)
|
||||||
|
|
||||||
@ -1368,10 +1379,15 @@ class MainWindow(QMainWindow):
|
|||||||
if fnm[0]:
|
if fnm[0]:
|
||||||
self.project = Project.load(fnm[0])
|
self.project = Project.load(fnm[0])
|
||||||
self.init_events(new=True)
|
self.init_events(new=True)
|
||||||
|
if hasattr(self.project, 'metadata'):
|
||||||
|
self.init_array_map(index=0)
|
||||||
|
|
||||||
def saveProject(self):
|
def saveProject(self):
|
||||||
if self.project:
|
if self.project:
|
||||||
self.project.save()
|
if not self.project.location:
|
||||||
|
self.createNewProject(exists=True)
|
||||||
|
else:
|
||||||
|
self.project.save()
|
||||||
if not self.project.dirty:
|
if not self.project.dirty:
|
||||||
qmb = QMessageBox(icon=QMessageBox.Information, text='Saved back project to file:\n{}'.format(self.project.location))
|
qmb = QMessageBox(icon=QMessageBox.Information, text='Saved back project to file:\n{}'.format(self.project.location))
|
||||||
qmb.exec_()
|
qmb.exec_()
|
||||||
|
@ -1 +1 @@
|
|||||||
fd70-dirty
|
8057-dirty
|
||||||
|
Loading…
Reference in New Issue
Block a user