Commit 3635dfd7 authored by Margaux Mouchene's avatar Margaux Mouchene
Browse files

create toolbar for colormap, enable/disable menu items when needed

parent f23a759a
......@@ -5,7 +5,7 @@ import logging
from PyQt5.QtWidgets import (
QSizePolicy, QApplication, QLabel, QWidget, QGridLayout,
QPushButton,QSlider, QMainWindow, QFileDialog, QToolBar,
QMenu, QAction, QMenuBar
QMenu, QAction, QMenuBar, QLineEdit
)
from PyQt5.QtCore import (
......@@ -82,6 +82,24 @@ class MainWindow(QMainWindow):
minimap_button.toggled.connect(self.minimap_widget.setVisible)
self.minimap_widget.sigClosing.connect(minimap_button.setChecked)
# Colormap:
self.colormap = QToolBar("Colormap toolbar")
rainbow_button = QPushButton('Rainbow')#, clicked=self.map_model.map_style(1))
rainbow_button.setDisabled(True)
redblue_button = QPushButton('RdBu')#,clicked=self.map_model.map_style(0))
redblue_button.setDisabled(True)
v_i = QLineEdit('min')
v_i.setMaximumWidth(100)
v_a = QLineEdit('max')
v_a.setMaximumWidth(100)
self.colormap.addWidget(rainbow_button)
self.colormap.addWidget(redblue_button)
self.colormap.addWidget(v_i)
self.colormap.addWidget(v_a)
self.addToolBar(Qt.BottomToolBarArea, self.colormap)
# palette button:
palette_button = QPushButton('palette',
clicked=self.map_widget.next_palette)
......@@ -92,8 +110,9 @@ class MainWindow(QMainWindow):
# addWidget(widget, fromRow, fromColumn, rowSpan, columnSpan)
main_layout.addWidget(self.slider, 0, 0, 1, 2)
main_layout.addWidget(self.date_label, 1, 0)
main_layout.addWidget(palette_button, 3, 1)
# main_layout.addWidget(palette_button, 3, 1)
main_layout.addWidget(self.map_widget, 2, 0, 1, 2)
# main_layout.addWidget(self.colormap, 3, 1, 1, 2)
main_widget = QWidget()
main_widget.setLayout(main_layout)
self.setCentralWidget(main_widget)
......@@ -114,20 +133,25 @@ class MainWindow(QMainWindow):
filemenu.addSeparator()
filemenu.addAction(quit_action)
viewmenu = menubar.addMenu('View')
plotwin_action = QAction("Plot Window", self)
plotwin_action.setCheckable(True)
plotwin_action.setChecked(False)
plotwin_action.toggled.connect(self.show_plot_window)
self.plotwin_action = QAction("Plot Window", self)
self.plotwin_action.setCheckable(True)
self.plotwin_action.setChecked(False)
self.plotwin_action.toggled.connect(self.show_plot_window)
self.plotwin_action.setEnabled(False)
minimap_action = QAction("Minimap", self)
minimap_action.setCheckable(True)
minimap_action.setChecked(True)
minimap_action.toggled.connect(self.minimap_widget.setVisible)
self.minimap_widget.sigClosing.connect(minimap_action.setChecked)
viewmenu.addAction(plotwin_action)
colormap_action =QAction("Colormap", self)
colormap_action.setCheckable(True)
colormap_action.setChecked(True)
colormap_action.toggled.connect(self.colormap.setVisible)
viewmenu.addAction(self.plotwin_action)
viewmenu.addAction(minimap_action)
viewmenu.addAction(colormap_action)
......@@ -180,8 +204,7 @@ class MainWindow(QMainWindow):
self.slider.setMaximum(len(self.map_model.loader)-1)
self.slider.setValue(len(self.map_model.loader)//2)
# enable plot buttons:
# self.plotwindowbutton.setEnabled(True)
# self.clear_graph_button.setEnabled(True)
self.plotwin_action.setEnabled(True)
def display_date(self):
""" display the date_number's date and print it on status bar """
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment