Compare commits
No commits in common. "9036a9054e8bdf56e3a620edd56c1b3f28618dbc" and "7c926327dd69eea77b329c653765195a507dce4f" have entirely different histories.
9036a9054e
...
7c926327dd
8
PyLoT.py
8
PyLoT.py
@ -86,7 +86,7 @@ from pylot.core.io.location import create_creation_info, create_event
|
|||||||
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \
|
||||||
PylotCanvas, WaveformWidgetPG, PropertiesDlg, HelpForm, createAction, PickDlg, \
|
PylotCanvas, WaveformWidgetPG, PropertiesDlg, HelpForm, createAction, PickDlg, \
|
||||||
ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, CanvasWidget, AutoPickWidget, \
|
ComparisonWidget, TuneAutopicker, PylotParaBox, AutoPickDlg, CanvasWidget, AutoPickWidget, \
|
||||||
CompareEventsWidget, ProgressBarWidget, AddMetadataWidget, SingleTextLineDialog, LogWidget
|
CompareEventsWidget, ProgressBarWidget, AddMetadataWidget, SingleTextLineDialog
|
||||||
from pylot.core.util.array_map import Array_map
|
from pylot.core.util.array_map import Array_map
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
from pylot.core.util.structure import DATASTRUCTURE
|
||||||
from pylot.core.util.thread import Thread, Worker
|
from pylot.core.util.thread import Thread, Worker
|
||||||
@ -731,11 +731,6 @@ class MainWindow(QMainWindow):
|
|||||||
_widget.setLayout(self._main_layout)
|
_widget.setLayout(self._main_layout)
|
||||||
_widget.showFullScreen()
|
_widget.showFullScreen()
|
||||||
|
|
||||||
self.logwidget = LogWidget(parent=None)
|
|
||||||
self.logwidget.show()
|
|
||||||
sys.stdout = self.logwidget.stdout
|
|
||||||
sys.stderr = self.logwidget.stderr
|
|
||||||
|
|
||||||
self.setCentralWidget(_widget)
|
self.setCentralWidget(_widget)
|
||||||
|
|
||||||
def init_wfWidget(self):
|
def init_wfWidget(self):
|
||||||
@ -783,6 +778,7 @@ class MainWindow(QMainWindow):
|
|||||||
if event.key() == QtCore.Qt.Key.Key_R:
|
if event.key() == QtCore.Qt.Key.Key_R:
|
||||||
self.reset_gain()
|
self.reset_gain()
|
||||||
|
|
||||||
|
|
||||||
def keyReleaseEvent(self, event):
|
def keyReleaseEvent(self, event):
|
||||||
if event.key() == QtCore.Qt.Key.Key_Control:
|
if event.key() == QtCore.Qt.Key.Key_Control:
|
||||||
self._ctrl = False
|
self._ctrl = False
|
||||||
|
@ -147,11 +147,10 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
|
|
||||||
self.bot_row = QtWidgets.QHBoxLayout()
|
self.bot_row = QtWidgets.QHBoxLayout()
|
||||||
self.main_box.addLayout(self.bot_row, 0.3)
|
self.main_box.addLayout(self.bot_row, 0.3)
|
||||||
self.bot_row.addWidget(QtWidgets.QLabel(''), 5)
|
self.bot_row.addWidget(self.map_reset_button)
|
||||||
self.bot_row.addWidget(self.map_reset_button, 2)
|
self.bot_row.addWidget(self.go2eq_button)
|
||||||
self.bot_row.addWidget(self.go2eq_button, 2)
|
self.bot_row.addWidget(self.save_map_button)
|
||||||
self.bot_row.addWidget(self.save_map_button, 2)
|
self.bot_row.addWidget(self.status_label)
|
||||||
self.bot_row.addWidget(self.status_label, 5)
|
|
||||||
|
|
||||||
def init_colormap(self):
|
def init_colormap(self):
|
||||||
self.init_lat_lon_dimensions()
|
self.init_lat_lon_dimensions()
|
||||||
@ -215,7 +214,6 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
self.refresh_button.clicked.connect(self._refresh_drawings)
|
self.refresh_button.clicked.connect(self._refresh_drawings)
|
||||||
self.map_reset_button.clicked.connect(self.org_map_view)
|
self.map_reset_button.clicked.connect(self.org_map_view)
|
||||||
self.go2eq_button.clicked.connect(self.go2eq)
|
self.go2eq_button.clicked.connect(self.go2eq)
|
||||||
self.save_map_button.clicked.connect(self.saveFigure)
|
|
||||||
|
|
||||||
self.plotWidget.mpl_connect('motion_notify_event', self.mouse_moved)
|
self.plotWidget.mpl_connect('motion_notify_event', self.mouse_moved)
|
||||||
self.plotWidget.mpl_connect('scroll_event', self.mouse_scroll)
|
self.plotWidget.mpl_connect('scroll_event', self.mouse_scroll)
|
||||||
@ -228,7 +226,7 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
return
|
return
|
||||||
lat = event.ydata
|
lat = event.ydata
|
||||||
lon = event.xdata
|
lon = event.xdata
|
||||||
self.status_label.setText('Latitude: {:3.5f}, Longitude: {:3.5f}'.format(lat, lon))
|
self.status_label.setText('Latitude: {}, Longitude: {}'.format(lat, lon))
|
||||||
|
|
||||||
def mouse_scroll(self, event):
|
def mouse_scroll(self, event):
|
||||||
if not event.inaxes == self.canvas.axes:
|
if not event.inaxes == self.canvas.axes:
|
||||||
@ -674,16 +672,6 @@ class Array_map(QtWidgets.QWidget):
|
|||||||
annotation.remove()
|
annotation.remove()
|
||||||
self.annotations = []
|
self.annotations = []
|
||||||
|
|
||||||
def saveFigure(self):
|
|
||||||
if self.canvas.fig:
|
|
||||||
fd = QtWidgets.QFileDialog()
|
|
||||||
fname, filter = fd.getSaveFileName(self.parent(), filter='Images (*.png *.svg *.jpg)')
|
|
||||||
if not fname:
|
|
||||||
return
|
|
||||||
if not any([fname.endswith(item) for item in ['.png', '.svg', '.jpg']]):
|
|
||||||
fname += '.png'
|
|
||||||
self.canvas.fig.savefig(fname)
|
|
||||||
|
|
||||||
def _warn(self, message):
|
def _warn(self, message):
|
||||||
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Warning, 'Warning', message)
|
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Warning, 'Warning', message)
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
@ -82,57 +82,6 @@ class QDoubleSpinBox(QtWidgets.QDoubleSpinBox):
|
|||||||
event.ignore()
|
event.ignore()
|
||||||
|
|
||||||
|
|
||||||
class TextLogWidget(QtWidgets.QTextEdit):
|
|
||||||
highlight = Signal()
|
|
||||||
|
|
||||||
def __init__(self, parent, highlight_input=False):
|
|
||||||
super(TextLogWidget, self).__init__(parent)
|
|
||||||
self.highlight_input = highlight_input
|
|
||||||
|
|
||||||
def write(self, text):
|
|
||||||
self.append(text)
|
|
||||||
if self.highlight_input:
|
|
||||||
self.highlight.emit()
|
|
||||||
|
|
||||||
|
|
||||||
class LogWidget(QtWidgets.QWidget):
|
|
||||||
def __init__(self, parent):
|
|
||||||
super(LogWidget, self).__init__(parent, Qt.Window)
|
|
||||||
self.current_active_error = False
|
|
||||||
self.qmb = None
|
|
||||||
self.setWindowTitle('PyLoT Log')
|
|
||||||
self.setMinimumWidth(800)
|
|
||||||
self.setMinimumHeight(600)
|
|
||||||
|
|
||||||
self.stdout = TextLogWidget(self)
|
|
||||||
self.stderr = TextLogWidget(self, highlight_input=True)
|
|
||||||
self.stderr.highlight.connect(self.active_error)
|
|
||||||
|
|
||||||
self.tabs = QTabWidget()
|
|
||||||
self.tabs.addTab(self.stdout, 'Log')
|
|
||||||
self.tabs.addTab(self.stderr, 'Errors')
|
|
||||||
|
|
||||||
self.layout = QtWidgets.QVBoxLayout()
|
|
||||||
self.textfield = QtWidgets.QTextEdit()
|
|
||||||
self.setLayout(self.layout)
|
|
||||||
self.layout.addWidget(self.tabs)
|
|
||||||
|
|
||||||
def active_error(self):
|
|
||||||
if self.current_active_error == False:
|
|
||||||
self.current_active_error = True
|
|
||||||
self.show()
|
|
||||||
self.activateWindow()
|
|
||||||
self.tabs.setCurrentWidget(self.stderr)
|
|
||||||
self.qmb = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Icon.Warning,
|
|
||||||
'Error', 'Error occurred. Please check log!')
|
|
||||||
self.qmb.buttonClicked.connect(self.reset_error)
|
|
||||||
self.qmb.show()
|
|
||||||
|
|
||||||
def reset_error(self):
|
|
||||||
# used to make sure that write errors is finished before raising new Message box etc.
|
|
||||||
self.current_active_error = False
|
|
||||||
|
|
||||||
|
|
||||||
def getDataType(parent):
|
def getDataType(parent):
|
||||||
type = QInputDialog().getItem(parent, "Select phases type", "Type:",
|
type = QInputDialog().getItem(parent, "Select phases type", "Type:",
|
||||||
["manual", "automatic"])
|
["manual", "automatic"])
|
||||||
@ -1269,7 +1218,7 @@ class PylotCanvas(FigureCanvas):
|
|||||||
parent.refreshPhaseText()
|
parent.refreshPhaseText()
|
||||||
|
|
||||||
def keyPressHandler(self, gui_event):
|
def keyPressHandler(self, gui_event):
|
||||||
if gui_event.key == 'ctrl+p':
|
if gui_event.key == 'ctrl+s':
|
||||||
self.saveFigure()
|
self.saveFigure()
|
||||||
|
|
||||||
def connectEvents(self):
|
def connectEvents(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user