mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Add a menu bar, with a stub for Settings, and Quit
This commit is contained in:
parent
5328f339f0
commit
00b0ce443c
48
onionshare_gui/menu.py
Normal file
48
onionshare_gui/menu.py
Normal file
@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
OnionShare | https://onionshare.org/
|
||||
|
||||
Copyright (C) 2016 Micah Lee <micah@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()
|
@ -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.
|
||||
|
@ -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"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user