Compare commits
1 Commits
master
...
VIS-1-VIS-
Author | SHA1 | Date | |
---|---|---|---|
cf6db0f987 |
BIN
win_venv/files/input/test.jpg
Normal file
BIN
win_venv/files/input/test.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 562 KiB |
@ -1,11 +1,14 @@
|
||||
#import tkinter as tk
|
||||
import sys
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from PyQt5 import QtCore
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QMainWindow, QGridLayout, QMenu, QFileDialog, QAction
|
||||
from PyQt5.QtGui import QIcon, QPixmap
|
||||
|
||||
|
||||
# todo: change app into class (no time to do it now so sorry for it being messy code
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
@ -28,7 +31,20 @@ def main():
|
||||
menuBar = w.menuBar()
|
||||
homeMenu = QMenu("&Home", w)
|
||||
menuBar.addMenu(homeMenu)
|
||||
homeMenu.addAction("Load new file")
|
||||
|
||||
def showDialog():
|
||||
home_dir = str(Path.home())
|
||||
fname = QFileDialog.getOpenFileName(w, 'Load new file', home_dir)
|
||||
if fname[0]:
|
||||
shutil.copy(fname[0], 'files/input/test.jpg') #copy the file to destination dir
|
||||
|
||||
|
||||
# Load new file
|
||||
loadFileAct = QAction('&Load new file', w)
|
||||
loadFileAct.setStatusTip('Load new file')
|
||||
# todo: fix - it opens on app run not on click
|
||||
#loadFileAct.triggered.connect(showDialog())
|
||||
homeMenu.addAction(loadFileAct)
|
||||
|
||||
# Exit app
|
||||
exitAct = QAction('&Exit', w)
|
||||
@ -37,12 +53,12 @@ def main():
|
||||
exitAct.triggered.connect(app.quit)
|
||||
homeMenu.addAction(exitAct)
|
||||
|
||||
|
||||
historyMenu = menuBar.addMenu("&History")
|
||||
helpMenu = menuBar.addMenu("&Help")
|
||||
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user