diff --git a/onionshare_gui/menu.py b/onionshare_gui/menu.py new file mode 100644 index 00000000..59f63048 --- /dev/null +++ b/onionshare_gui/menu.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +""" +OnionShare | https://onionshare.org/ + +Copyright (C) 2016 Micah Lee + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +""" +from PyQt5 import QtCore, QtWidgets + +from onionshare import strings + +class Menu(QtWidgets.QMenuBar): + """ + OnionShare's menu bar. + """ + def __init__(self, parent=None): + super(Menu, self).__init__(parent) + + file_menu = self.addMenu(strings._('gui_menu_file_menu', True)) + + settings_action = file_menu.addAction(strings._('gui_menu_settings_action', True)) + settings_action.triggered.connect(self.settings) + quit_action = file_menu.addAction(strings._('gui_menu_quit_action', True)) + quit_action.triggered.connect(self.quit) + + def settings(self): + """ + Settings action triggered. + """ + print("Settings clicked") + + def quit(self): + """ + Quit action triggered. + """ + self.parent().qtapp.quit() diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 6a7da111..83b13200 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -25,6 +25,7 @@ from PyQt5.QtCore import pyqtSlot import onionshare from onionshare import strings, helpers, web +from .menu import Menu from .file_selection import FileSelection from .server_status import ServerStatus from .downloads import Downloads @@ -70,6 +71,9 @@ class OnionShareGui(QtWidgets.QMainWindow): self.setWindowTitle('OnionShare') self.setWindowIcon(window_icon) + # the menu bar + self.setMenuBar(Menu()) + def send_files(self, filenames=None): """ Build the GUI in send files mode. diff --git a/resources/locale/en.json b/resources/locale/en.json index 46478d99..f69e3133 100644 --- a/resources/locale/en.json +++ b/resources/locale/en.json @@ -58,5 +58,8 @@ "zip_progress_bar_format": "Crunching files: %p%", "error_stealth_not_supported": "To create stealth onion services, you need at least Tor 0.2.9.1-alpha (or Tor Browser 6.5) and at least python3-stem 1.5.0.", "gui_advanced_options": "Advanced options", - "gui_create_stealth": "Create stealth onion service" + "gui_create_stealth": "Create stealth onion service", + "gui_menu_file_menu": "&File", + "gui_menu_settings_action": "&Settings", + "gui_menu_quit_action": "&Quit" }