Skip to content

Commit

Permalink
Removed the non-working in-app bug reporting;
Browse files Browse the repository at this point in the history
Turned bug-reporting into idea/issue reporting
New view menu
Some cleanup and changes to icons
  • Loading branch information
bsteubing committed Nov 4, 2019
1 parent 832a0f4 commit 7f9f4c4
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 82 deletions.
2 changes: 2 additions & 0 deletions activity_browser/app/ui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self):
self.vertical_container.addLayout(self.main_horizontal_box)

self.main_widget = QtWidgets.QWidget()
self.main_widget.icon = qicons.main_window
self.main_widget.name = "&Main Window"
self.main_widget.setLayout(self.vertical_container)

Expand All @@ -71,6 +72,7 @@ def __init__(self):
working_layout.addWidget(self.log)

self.debug_widget = QtWidgets.QWidget()
self.debug_widget.icon = qicons.debug
self.debug_widget.name = "&Debug Window"
self.debug_widget.setLayout(working_layout)

Expand Down
95 changes: 24 additions & 71 deletions activity_browser/app/ui/menu_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
import json

import brightway2 as bw
import requests
from PyQt5 import QtCore, QtWidgets, QtGui

from .icons import qicons
from .utils import abt1
from ..signals import signals
from .widgets import BiosphereUpdater
from .wizards.settings_wizard import SettingsWizard
Expand All @@ -22,6 +20,7 @@ def __init__(self, window):
self.menubar.addMenu(self.setup_file_menu())
# self.menubar.addMenu(self.setup_tools_menu())
# self.menubar.addMenu(self.setup_extensions_menu())
self.menubar.addMenu(self.setup_view_menu())
self.menubar.addMenu(self.setup_windows_menu())
self.menubar.addMenu(self.setup_help_menu())
window.setMenuBar(self.menubar)
Expand All @@ -37,50 +36,41 @@ def connect_signals(self):
def setup_file_menu(self):
menu = QtWidgets.QMenu('&File', self.window)
menu.addAction(
qicons.import_db,
'&Import database...',
signals.import_database.emit
)
menu.addAction(self.update_biosphere_action)
menu.addAction(
qicons.settings,
'&Settings...',
self.open_settings_wizard
)
return menu

# # TOOLS
# def setup_tools_menu(self):
# menu = QtWidgets.QMenu('&Tools', self.window)
# menu.addAction(
# '&Graph Explorer',
# lambda x="Graph Explorer": signals.show_tab.emit(x)
# )
# # menu.addAction(
# # '&Show/hide history',
# # lambda x="Project History": signals.show_or_hide_tab.emit(x)
# # )
#
# # self.graph_navigator = QtWidgets.QMenu('&Windows', self.window)
# # self.update_windows_menu()
# return menu

# WINDOWS
def setup_windows_menu(self):
self.windows_menu = QtWidgets.QMenu('&Windows', self.window)

self.show_hide_menu = QtWidgets.QMenu('&Show/hide...', self.window)
self.show_hide_menu.addAction(
'&Project History',
lambda x="Project History": signals.toggle_show_or_hide_tab.emit(x)
)
self.show_hide_menu.addAction(
# VIEW
def setup_view_menu(self):
view_menu = QtWidgets.QMenu('&View', self.window)
view_menu.addAction(
qicons.graph_explorer,
'&Graph Explorer',
lambda x="Graph Explorer": signals.toggle_show_or_hide_tab.emit(x)
)
self.show_hide_menu.addAction(
view_menu.addAction(
qicons.history,
'&Activity History',
lambda x="History": signals.toggle_show_or_hide_tab.emit(x)
)
view_menu.addAction(
qicons.welcome,
'&Welcome screen',
lambda x="Welcome": signals.toggle_show_or_hide_tab.emit(x)
)
# self.windows_menu.addMenu(self.show_hide_menu)
return view_menu

# WINDOWS
def setup_windows_menu(self):
self.windows_menu = QtWidgets.QMenu('&Windows', self.window)
self.update_windows_menu()
return self.windows_menu

Expand All @@ -89,34 +79,28 @@ def update_windows_menu(self):
for index in range(self.window.stacked.count()): # iterate over widgets in QStackedWidget
widget = self.window.stacked.widget(index)
self.windows_menu.addAction(
widget.icon,
widget.name,
lambda widget=widget: self.window.stacked.setCurrentWidget(widget),
)
self.windows_menu.addMenu(self.show_hide_menu)

# HELP
def setup_help_menu(self):
bug_icon = qicons.debug
help_menu = QtWidgets.QMenu('&Help', self.window)
help_menu.addAction(
self.window.icon,
'&About Activity Browser',
self.about)

help_menu.addAction(
'&About Qt',
lambda: QtWidgets.QMessageBox.aboutQt(self.window)
)
help_menu.addAction(
bug_icon,
'&Report Bug on github',
qicons.issue,
'&Report an idea/issue on GitHub',
self.raise_issue_github
)
help_menu.addAction(
bug_icon,
'&Report Bug',
self.raise_issue_from_app
)

return help_menu

def about(self):
Expand Down Expand Up @@ -148,37 +132,6 @@ def raise_issue_github(self):
url = QtCore.QUrl('https://github.com/LCA-ActivityBrowser/activity-browser/issues/new')
QtGui.QDesktopServices.openUrl(url)

def raise_issue_api(self, content):
abt2 = 'C5F02AZ12E56E6D46Z811D'
auth = (
'ActivityBrowser',
''.join(reversed(abt1 + ''.join(reversed(abt2.lower())))).replace('z', '')
)
data = {
'title': 'New issue reported from app',
'body': content
}

url = 'https://api.github.com/repos/LCA-ActivityBrowser/activity-browser/issues'
response = requests.post(url, data=json.dumps(data), auth=auth)
if response.status_code != 201:
print(response)
print(response.text)

def raise_issue_from_app(self):
text, _ = QtWidgets.QInputDialog.getMultiLineText(
None,
'Report new bug',
('Please describe the buggy behaviour. View existing issues on ' +
'<a href="https://github.com/LCA-ActivityBrowser/activity-browser/issues">github</a>.'+
'<br>If you have a github account, please consider raising the issue directly on github.'
),
)
if text:
content = text + '\n\nLog Output:\n```\n{}```'.format(self.window.log.toPlainText())
self.raise_issue_api(content)
print(content)

def open_settings_wizard(self):
self.settings_wizard = SettingsWizard()

Expand Down
4 changes: 2 additions & 2 deletions activity_browser/app/ui/panels/left.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ def __init__(self, *args):
self.tabs = {
"Project": ProjectTab(self),
"Impact Categories": MethodsTab(self),
"Project History": HistoryTab(self),
"History": HistoryTab(self),
}
for tab_name, tab in self.tabs.items():
self.addTab(tab, tab_name)
# tabs hidden at start
self.hide_tab("Project History")
self.hide_tab("History")

4 changes: 2 additions & 2 deletions activity_browser/app/ui/tables/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def _resize(self) -> None:

def contextMenuEvent(self, a0) -> None:
menu = QtWidgets.QMenu()
menu.addAction(qicons.left, "Open activity/activities", self.open_activities)
menu.addAction(qicons.right, "Open activities", self.open_activities)
menu.addAction(self.delete_exchange_action)
menu.addAction(self.remove_formula_action)
menu.exec(a0.globalPos())
Expand Down Expand Up @@ -386,5 +386,5 @@ def _resize(self) -> None:

def contextMenuEvent(self, a0) -> None:
menu = QtWidgets.QMenu()
menu.addAction(qicons.left, "Open activity/activities", self.open_activities)
menu.addAction(qicons.right, "Open activities", self.open_activities)
menu.exec(a0.globalPos())
6 changes: 3 additions & 3 deletions activity_browser/app/ui/tables/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def contextMenuEvent(self, a0) -> None:
lambda: signals.delete_database.emit(self.selected_db_name)
)
menu.addAction(
qicons.duplicate, "Copy database",
qicons.duplicate_database, "Copy database",
lambda: signals.copy_database.emit(self.selected_db_name)
)
menu.addAction(
Expand Down Expand Up @@ -156,7 +156,7 @@ def contextMenuEvent(self, event) -> None:
"""
menu = QtWidgets.QMenu()
menu.addAction(
qicons.left, "Open activity",
qicons.right, "Open activity",
lambda: self.open_activity_tab(self.currentIndex())
)
menu.addAction(
Expand All @@ -167,7 +167,7 @@ def contextMenuEvent(self, event) -> None:
menu.addAction(self.duplicate_activity_action)
menu.addAction(self.delete_activity_action)
menu.addAction(
qicons.add_db, "Duplicate to other database",
qicons.duplicate_to_other_database, "Duplicate to other database",
lambda: signals.show_duplicate_to_db_interface.emit(self.get_key(self.currentIndex()))
)
menu.exec(event.globalPos())
Expand Down
2 changes: 1 addition & 1 deletion activity_browser/app/ui/tables/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ def contextMenuEvent(self, event: QContextMenuEvent):
"""
menu = QMenu(self)
menu.addAction(
qicons.add, "Open activity/activities", self.open_activity_tab
qicons.add, "Open activities", self.open_activity_tab
)
menu.addAction(self.rename_action)
menu.addAction(self.delete_action)
Expand Down
4 changes: 2 additions & 2 deletions activity_browser/app/ui/tabs/project_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ def __init__(self, parent):

# Buttons
self.add_default_data_button = QtWidgets.QPushButton(
qicons.add_db, "Add Default Data (Biosphere flows, LCIA methods)"
qicons.import_db, "Add Default Data (Biosphere flows, LCIA methods)"
)
self.new_database_button = QtWidgets.QPushButton(qicons.add, "New")
self.import_database_button = QtWidgets.QPushButton(qicons.add_db, "Import")
self.import_database_button = QtWidgets.QPushButton(qicons.import_db, "Import")

# Header widget
self.header_layout.addWidget(self.add_default_data_button)
Expand Down
2 changes: 1 addition & 1 deletion activity_browser/app/ui/widgets/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def populate_database_combo(self):
available_target_dbs.remove(current_db)

for db_name in available_target_dbs:
self.database_combo.addItem(qicons.duplicate, db_name)
self.database_combo.addItem(qicons.duplicate_activity, db_name)
self.database_combo.blockSignals(False)

def duplicate_confirm_dialog(self, target_db):
Expand Down
Binary file removed activity_browser/icons/main/debug.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added activity_browser/icons/main/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added activity_browser/icons/main/idea.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added activity_browser/icons/main/import_database.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added activity_browser/icons/main/ladybird.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified activity_browser/icons/main/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added activity_browser/icons/main/welcome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7f9f4c4

Please sign in to comment.