[Pkg-privacy-commits] [onionshare] 183/256: Remove the menu bar, and replace it with a settings button owned by the OnionShareGui object
Ulrike Uhlig
ulrike at moszumanska.debian.org
Fri May 26 12:53:36 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 3e3d669a49d21514744a08c0d6359bb85ee267ee
Author: Micah Lee <micah at micahflee.com>
Date: Tue May 16 15:24:14 2017 -0700
Remove the menu bar, and replace it with a settings button owned by the OnionShareGui object
---
onionshare_gui/file_selection.py | 6 +++++
onionshare_gui/menu.py | 51 ---------------------------------------
onionshare_gui/onionshare_gui.py | 29 +++++++++++++---------
share/images/settings.png | Bin 0 -> 411 bytes
4 files changed, 24 insertions(+), 62 deletions(-)
diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py
index 5fbf5a7..6accc11 100644
--- a/onionshare_gui/file_selection.py
+++ b/onionshare_gui/file_selection.py
@@ -256,3 +256,9 @@ class FileSelection(QtWidgets.QVBoxLayout):
Returns the total number of files and folders in the list.
"""
return len(self.file_list.filenames)
+
+ def setFocus(self):
+ """
+ Set the Qt app focus on the file selection box.
+ """
+ self.file_list.setFocus()
diff --git a/onionshare_gui/menu.py b/onionshare_gui/menu.py
deleted file mode 100644
index 4697d39..0000000
--- a/onionshare_gui/menu.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-OnionShare | https://onionshare.org/
-
-Copyright (C) 2017 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
-from .settings_dialog import SettingsDialog
-
-class Menu(QtWidgets.QMenuBar):
- """
- OnionShare's menu bar.
- """
- def __init__(self, onion, qtapp):
- super(Menu, self).__init__()
- self.onion = onion
- self.qtapp = qtapp
-
- 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.
- """
- SettingsDialog(self.onion, self.qtapp)
-
- 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 76811cc..6471aa4 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -26,7 +26,6 @@ from onionshare.onion import *
from .tor_connection_dialog import TorConnectionDialog
from .settings_dialog import SettingsDialog
-from .menu import Menu
from .file_selection import FileSelection
from .server_status import ServerStatus
from .downloads import Downloads
@@ -66,9 +65,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
tor_con.open_settings.connect(self._tor_connection_open_settings)
tor_con.start()
- # Menu bar
- self.setMenuBar(Menu(self.onion, self.qtapp))
-
# Check for updates in a new thread, if enabled
system = platform.system()
if system == 'Windows' or system == 'Darwin':
@@ -121,8 +117,13 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.status_bar = QtWidgets.QStatusBar()
self.status_bar.setSizeGripEnabled(False)
version_label = QtWidgets.QLabel('v{0:s}'.format(common.get_version()))
- version_label.setStyleSheet('color: #666666; padding: 0 10px;')
+ version_label.setStyleSheet('color: #666666')
+ settings_button = QtWidgets.QPushButton()
+ settings_button.setDefault(False)
+ settings_button.setIcon( QtGui.QIcon(common.get_resource_path('images/settings.png')) )
+ settings_button.clicked.connect(self.open_settings)
self.status_bar.addPermanentWidget(version_label)
+ self.status_bar.addPermanentWidget(settings_button)
self.setStatusBar(self.status_bar)
# Status bar, zip progress bar
@@ -139,11 +140,14 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.setCentralWidget(central_widget)
self.show()
- # check for requests frequently
+ # Check for requests frequently
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.check_for_requests)
self.timer.start(500)
+ # Always start with focus on file selection
+ self.file_selection.setFocus()
+
def _tor_connection_canceled(self):
"""
If the user cancels before Tor finishes connecting, ask if they want to
@@ -161,7 +165,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
a.exec_()
if a.clickedButton() == settings_button:
- SettingsDialog(self.onion, self.qtapp)
+ self.open_settings()
else:
self.qtapp.quit()
@@ -174,11 +178,14 @@ class OnionShareGui(QtWidgets.QMainWindow):
"""
common.log('OnionShareGui', '_tor_connection_open_settings')
- def open_settings():
- SettingsDialog(self.onion, self.qtapp)
-
# Wait 1ms for the event loop to finish closing the TorConnectionDialog
- QtCore.QTimer.singleShot(1, open_settings)
+ QtCore.QTimer.singleShot(1, self.open_settings)
+
+ def open_settings(self):
+ """
+ Open the SettingsDialog.
+ """
+ SettingsDialog(self.onion, self.qtapp)
def start_server(self):
"""
diff --git a/share/images/settings.png b/share/images/settings.png
new file mode 100644
index 0000000..4c69de0
Binary files /dev/null and b/share/images/settings.png differ
--
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