Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvisscher committed Sep 20, 2024
1 parent c18de52 commit 6ef655a
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion activity_browser/ui/menu_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@


class MenuBar(QtWidgets.QMenuBar):
"""
Main menu bar at the top of the Activity Browser window. Contains submenus for different user interaction categories
"""
def __init__(self, window):
super().__init__(parent=window)

Expand All @@ -23,10 +26,14 @@ def __init__(self, window):


class ProjectMenu(QtWidgets.QMenu):
"""
Project menu: contains actions related to managing the project, such as project duplication, database importing etc.
"""

def __init__(self, parent=None) -> None:
super().__init__(parent)

self.setTitle("Project")
self.setTitle("&Project")

self.new_proj_action = actions.ProjectNew.get_QAction()
self.dup_proj_action = actions.ProjectDuplicate.get_QAction()
Expand Down Expand Up @@ -68,6 +75,10 @@ def biosphere_exists(self) -> None:


class ViewMenu(QtWidgets.QMenu):
"""
View menu: contains actions in regard to hiding and showing specific UI elements.
"""

def __init__(self, parent=None) -> None:
super().__init__(parent)

Expand All @@ -91,6 +102,10 @@ def __init__(self, parent=None) -> None:


class ToolsMenu(QtWidgets.QMenu):
"""
Tools Menu: contains actions in regard to special tooling aspects of the AB
"""

def __init__(self, parent=None) -> None:
super().__init__(parent)
self.setTitle("&Tools")
Expand All @@ -101,6 +116,10 @@ def __init__(self, parent=None) -> None:


class HelpMenu(QtWidgets.QMenu):
"""
Help Menu: contains actions that show info to the user or redirect them to online resources
"""

def __init__(self, parent=None) -> None:
super().__init__(parent)
self.setTitle("&Help")
Expand All @@ -119,6 +138,8 @@ def __init__(self, parent=None) -> None:
)

def about(self):
"""Displays an 'about' window to the user containing e.g. the version of the AB and copyright info"""
# set the window text in html format
text = f"""
Activity Browser - a graphical interface for Brightway2.<br><br>
Application version: <b>{version("activity_browser")}</b><br>
Expand All @@ -130,20 +151,24 @@ def about(self):
For license information please see the copyright on <a href="https://github.com/LCA-ActivityBrowser/activity-browser/blob/main/LICENSE.txt">this page</a>.<br><br>
"""

# set up the window
about_window = QtWidgets.QMessageBox(parent=application.main_window)
about_window.setWindowTitle("About the Activity Browser")
about_window.setIconPixmap(qicons.ab.pixmap(QSize(150, 150)))
about_window.setText(text)

# execute
about_window.exec_()

def open_wiki(self):
"""Opens the AB github wiki in the users default browser"""
url = QUrl(
"https://github.com/LCA-ActivityBrowser/activity-browser/wiki"
)
QtGui.QDesktopServices.openUrl(url)

def raise_issue_github(self):
"""Opens the github create issue page in the users default browser"""
url = QUrl(
"https://github.com/LCA-ActivityBrowser/activity-browser/issues/new/choose"
)
Expand Down Expand Up @@ -192,6 +217,8 @@ def populate(self):


class MigrationsMenu(QtWidgets.QMenu):
"""Menu that shows actions that regard to brightway migrations"""

def __init__(self, parent=None) -> None:
super().__init__(parent)

Expand Down

0 comments on commit 6ef655a

Please sign in to comment.