mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-18 01:08:12 +00:00
Add About window and basic commands to MenuBar (#113)
* Initial commit for about_window.py * Add some basic actions to the MenuBar * Fix keyboard shortcuts * Fix path to icon for Windows
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
''' app/ui/widgets/menubar.py '''
|
||||
from PyQt6.QtWidgets import QMenuBar
|
||||
import sys
|
||||
|
||||
from PyQt6.QtGui import QAction
|
||||
from PyQt6.QtWidgets import QMenuBar, QApplication
|
||||
|
||||
|
||||
class MenuBar(QMenuBar):
|
||||
@@ -12,12 +15,43 @@ class MenuBar(QMenuBar):
|
||||
|
||||
def __init__(self, parent=None) -> None:
|
||||
super().__init__(parent)
|
||||
|
||||
# setup menus
|
||||
file_menu = self.addMenu("File")
|
||||
# edit_menu = self.addMenu("Edit")
|
||||
# view_menu = self.addMenu("View")
|
||||
# help_menu = self.addMenu("Help")
|
||||
help_menu = self.addMenu("Help")
|
||||
|
||||
# Add actions to the menus
|
||||
# file_menu.addAction(self.parent().topbar.actions_call["Open"]) # type: ignore
|
||||
# file_menu.addAction(self.parent().topbar.actions_call["Save"]) # type: ignore
|
||||
# file_menu.addAction(self.parent().topbar.actions_call["Exit"]) # type: ignore
|
||||
# --file menu--
|
||||
# new job
|
||||
new_job_action = QAction("New Job...", self)
|
||||
new_job_action.setShortcut(f'Ctrl+N')
|
||||
new_job_action.triggered.connect(self.new_job)
|
||||
file_menu.addAction(new_job_action)
|
||||
# settings
|
||||
settings_action = QAction("Settings...", self)
|
||||
settings_action.triggered.connect(self.show_settings)
|
||||
settings_action.setShortcut(f'Ctrl+,')
|
||||
# file_menu.addAction(settings_action) # todo: enable once we have a setting screen
|
||||
# exit
|
||||
exit_action = QAction('&Exit', self)
|
||||
exit_action.setShortcut('Ctrl+Q')
|
||||
exit_action.triggered.connect(QApplication.instance().quit)
|
||||
file_menu.addAction(exit_action)
|
||||
|
||||
# --help menu--
|
||||
about_action = QAction("About", self)
|
||||
about_action.triggered.connect(self.show_about)
|
||||
help_menu.addAction(about_action)
|
||||
|
||||
def new_job(self):
|
||||
self.parent().new_job()
|
||||
|
||||
def show_settings(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def show_about():
|
||||
from src.ui.about_window import AboutDialog
|
||||
dialog = AboutDialog()
|
||||
dialog.exec()
|
||||
|
||||
Reference in New Issue
Block a user