[Pkg-privacy-commits] [onionshare] 43/256: Add a menu bar, with a stub for Settings, and Quit

Ulrike Uhlig ulrike at moszumanska.debian.org
Fri May 26 12:53:09 UTC 2017


This is an automated email from the git hooks/post-receive script.

ulrike pushed a commit to branch master
in repository onionshare.

commit 00b0ce443c1fc2f7b17e986cf8cf3f275ff4fbfc
Author: Micah Lee <micah at micahflee.com>
Date:   Wed Dec 28 15:55:31 2016 -0800

    Add a menu bar, with a stub for Settings, and Quit
---
 onionshare_gui/menu.py           | 48 ++++++++++++++++++++++++++++++++++++++++
 onionshare_gui/onionshare_gui.py |  4 ++++
 resources/locale/en.json         |  5 ++++-
 3 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/onionshare_gui/menu.py b/onionshare_gui/menu.py
new file mode 100644
index 0000000..59f6304
--- /dev/null
+++ b/onionshare_gui/menu.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+"""
+OnionShare | https://onionshare.org/
+
+Copyright (C) 2016 Micah Lee <micah at micahflee.com>
+
+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 <http://www.gnu.org/licenses/>.
+"""
+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 6a7da11..83b1320 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 46478d9..f69e313 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"
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git



More information about the Pkg-privacy-commits mailing list