add more icons
This commit is contained in:
parent
a061e489dd
commit
98149b6d57
BIN
icons/nix_plot.png
Normal file
BIN
icons/nix_plot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1007 B |
BIN
icons/nix_table.png
Normal file
BIN
icons/nix_table.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
icons/quit.png
Normal file
BIN
icons/quit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
3
main.py
3
main.py
@ -7,8 +7,7 @@ def main():
|
||||
app = QApplication(sys.argv)
|
||||
window = NixView()
|
||||
window.show()
|
||||
app.exec()
|
||||
return 0
|
||||
sys.exit(app.exec_())
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,29 +1,42 @@
|
||||
from PyQt5.QtWidgets import QFrame, QLabel, QListWidget, QMainWindow, QStackedLayout, QToolBar, QAction, QStatusBar, QVBoxLayout, QWidget, QGridLayout, QSpacerItem, QSizePolicy
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QFrame, QLabel, QListWidget, QMainWindow, QMenuBar, QStackedLayout, QToolBar, QAction, QStatusBar, QVBoxLayout, QWidget, QGridLayout, QSpacerItem, QSizePolicy
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QKeySequence
|
||||
from PyQt5.QtCore import Qt, QSize
|
||||
import typing
|
||||
|
||||
from file_handler import FileHandler
|
||||
|
||||
class NixView(QMainWindow):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(NixView, self).__init__(*args, **kwargs)
|
||||
self.setWindowTitle("NixView")
|
||||
self.setWindowIcon(QIcon('./icons/nixview.icns'))
|
||||
|
||||
cw = CentralWidget(self)
|
||||
self.setCentralWidget(cw)
|
||||
self._file_handler = FileHandler()
|
||||
self.setStatusBar(QStatusBar(self))
|
||||
self.setMenuBar(QMenuBar(self))
|
||||
self.create_actions()
|
||||
|
||||
self.setStatusBar(QStatusBar(self))
|
||||
|
||||
cw = CentralWidget(self)
|
||||
self.setCentralWidget(cw)
|
||||
self.show()
|
||||
|
||||
def create_actions(self):
|
||||
self._file_open_action = QAction(QIcon("./icons/nix_open.png"), "Open", self)
|
||||
self._file_open_action.setStatusTip("Open nix file")
|
||||
self._file_open_action.triggered.connect(self.onFileOpenClick)
|
||||
self._file_open_action.setShortcut(QKeySequence("Ctrl+o"))
|
||||
self._file_open_action.triggered.connect(self.on_file_open)
|
||||
|
||||
self._file_close_action = QAction(QIcon("./icons/nix_close.png"), "Close", self)
|
||||
self._file_close_action.setStatusTip("Close nix file")
|
||||
self._file_close_action.triggered.connect(self.onFileCloseClick)
|
||||
self._file_close_action.setStatusTip("Close current nix file")
|
||||
self._file_close_action.setShortcut(QKeySequence("Ctrl+w"))
|
||||
self._file_close_action.setEnabled(False)
|
||||
self._file_close_action.triggered.connect(self.on_file_close)
|
||||
|
||||
self._quit_action = QAction(QIcon("./icons/quit.png"), "Quit", self)
|
||||
self._quit_action.setStatusTip("Close current file and quit")
|
||||
self._quit_action.triggered.connect(self.on_quit)
|
||||
|
||||
self.create_toolbar()
|
||||
self.create_menu()
|
||||
@ -35,18 +48,31 @@ class NixView(QMainWindow):
|
||||
|
||||
self._toolbar.addAction(self._file_open_action)
|
||||
self._toolbar.addAction(self._file_close_action)
|
||||
self._toolbar.addAction(self._quit_action)
|
||||
self.addToolBar(self._toolbar)
|
||||
|
||||
|
||||
def create_menu(self):
|
||||
pass
|
||||
menu = self.menuBar()
|
||||
file_menu = menu.addMenu("&File")
|
||||
file_menu.addAction(self._file_open_action)
|
||||
file_menu.addAction(self._file_close_action)
|
||||
file_menu.addAction(self._quit_action)
|
||||
self.setMenuBar(menu)
|
||||
|
||||
def onFileOpenClick(self, s):
|
||||
print("click", s)
|
||||
def on_file_open(self, s):
|
||||
success, msg = self._file_handler.open("nix_test.h5")
|
||||
self.statusBar().showMessage(msg, 5000)
|
||||
self._file_close_action.setEnabled(success)
|
||||
|
||||
def onFileCloseClick(self, s):
|
||||
print("click", s)
|
||||
def on_file_close(self, s):
|
||||
self._file_handler.close()
|
||||
self.statusBar().showMessage("Successfully closed current file", 1000)
|
||||
|
||||
def on_quit(self, s):
|
||||
self._file_handler.close()
|
||||
sys.exit()
|
||||
|
||||
|
||||
class CentralWidget(QWidget):
|
||||
|
||||
@ -66,7 +92,7 @@ class SplashScreen(QWidget):
|
||||
super().__init__(parent=parent)
|
||||
layout = QGridLayout()
|
||||
self.setLayout(layout)
|
||||
self.setStyleSheet("background-color: red;")
|
||||
self.setStyleSheet("background-color: white;")
|
||||
label = QLabel()
|
||||
label.setPixmap(QPixmap("./icons/nixview256.png"))
|
||||
label.setAlignment(Qt.AlignCenter)
|
||||
|
Loading…
Reference in New Issue
Block a user