Rename OnionShareGui to MainWindow

This commit is contained in:
Micah Lee 2019-10-20 19:41:20 -07:00
parent ef6c7e280e
commit 0e44020bb6
5 changed files with 22 additions and 22 deletions

View File

@ -31,7 +31,7 @@ from onionshare.onion import Onion
from onionshare.onionshare import OnionShare from onionshare.onionshare import OnionShare
from .widgets import Alert from .widgets import Alert
from .onionshare_gui import OnionShareGui from .main_window import MainWindow
class Application(QtWidgets.QApplication): class Application(QtWidgets.QApplication):
@ -164,7 +164,7 @@ def main():
app = OnionShare(common, onion, local_only) app = OnionShare(common, onion, local_only)
# Launch the gui # Launch the gui
gui = OnionShareGui(common, onion, qtapp, app, filenames, config, local_only) gui = MainWindow(common, onion, qtapp, app, filenames, config, local_only)
# Clean up when app quits # Clean up when app quits
def shutdown(): def shutdown():

View File

@ -34,9 +34,9 @@ from .update_checker import UpdateThread
from .server_status import ServerStatus from .server_status import ServerStatus
class OnionShareGui(QtWidgets.QMainWindow): class MainWindow(QtWidgets.QMainWindow):
""" """
OnionShareGui is the main window for the GUI that contains all of the MainWindow is the main window for the GUI that contains all of the
GUI elements. GUI elements.
""" """
@ -47,10 +47,10 @@ class OnionShareGui(QtWidgets.QMainWindow):
def __init__( def __init__(
self, common, onion, qtapp, app, filenames, config=False, local_only=False self, common, onion, qtapp, app, filenames, config=False, local_only=False
): ):
super(OnionShareGui, self).__init__() super(MainWindow, self).__init__()
self.common = common self.common = common
self.common.log("OnionShareGui", "__init__") self.common.log("MainWindow", "__init__")
self.setMinimumWidth(820) self.setMinimumWidth(820)
self.setMinimumHeight(660) self.setMinimumHeight(660)
@ -344,19 +344,19 @@ class OnionShareGui(QtWidgets.QMainWindow):
def share_mode_clicked(self): def share_mode_clicked(self):
if self.mode != self.MODE_SHARE: if self.mode != self.MODE_SHARE:
self.common.log("OnionShareGui", "share_mode_clicked") self.common.log("MainWindow", "share_mode_clicked")
self.mode = self.MODE_SHARE self.mode = self.MODE_SHARE
self.update_mode_switcher() self.update_mode_switcher()
def receive_mode_clicked(self): def receive_mode_clicked(self):
if self.mode != self.MODE_RECEIVE: if self.mode != self.MODE_RECEIVE:
self.common.log("OnionShareGui", "receive_mode_clicked") self.common.log("MainWindow", "receive_mode_clicked")
self.mode = self.MODE_RECEIVE self.mode = self.MODE_RECEIVE
self.update_mode_switcher() self.update_mode_switcher()
def website_mode_clicked(self): def website_mode_clicked(self):
if self.mode != self.MODE_WEBSITE: if self.mode != self.MODE_WEBSITE:
self.common.log("OnionShareGui", "website_mode_clicked") self.common.log("MainWindow", "website_mode_clicked")
self.mode = self.MODE_WEBSITE self.mode = self.MODE_WEBSITE
self.update_mode_switcher() self.update_mode_switcher()
@ -451,7 +451,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
If the user cancels before Tor finishes connecting, ask if they want to If the user cancels before Tor finishes connecting, ask if they want to
quit, or open settings. quit, or open settings.
""" """
self.common.log("OnionShareGui", "_tor_connection_canceled") self.common.log("MainWindow", "_tor_connection_canceled")
def ask(): def ask():
a = Alert( a = Alert(
@ -497,7 +497,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
""" """
The TorConnectionDialog wants to open the Settings dialog The TorConnectionDialog wants to open the Settings dialog
""" """
self.common.log("OnionShareGui", "_tor_connection_open_settings") self.common.log("MainWindow", "_tor_connection_open_settings")
# Wait 1ms for the event loop to finish closing the TorConnectionDialog # Wait 1ms for the event loop to finish closing the TorConnectionDialog
QtCore.QTimer.singleShot(1, self.open_settings) QtCore.QTimer.singleShot(1, self.open_settings)
@ -506,7 +506,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
""" """
Open the SettingsDialog. Open the SettingsDialog.
""" """
self.common.log("OnionShareGui", "open_settings") self.common.log("MainWindow", "open_settings")
def reload_settings(): def reload_settings():
self.common.log( self.common.log(
@ -674,7 +674,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
""" """
When the URL gets copied to the clipboard, display this in the status bar. When the URL gets copied to the clipboard, display this in the status bar.
""" """
self.common.log("OnionShareGui", "copy_url") self.common.log("MainWindow", "copy_url")
self.system_tray.showMessage( self.system_tray.showMessage(
strings._("gui_copied_url_title"), strings._("gui_copied_url") strings._("gui_copied_url_title"), strings._("gui_copied_url")
) )
@ -683,7 +683,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
""" """
When the stealth onion service HidServAuth gets copied to the clipboard, display this in the status bar. When the stealth onion service HidServAuth gets copied to the clipboard, display this in the status bar.
""" """
self.common.log("OnionShareGui", "copy_hidservauth") self.common.log("MainWindow", "copy_hidservauth")
self.system_tray.showMessage( self.system_tray.showMessage(
strings._("gui_copied_hidservauth_title"), strings._("gui_copied_hidservauth_title"),
strings._("gui_copied_hidservauth"), strings._("gui_copied_hidservauth"),
@ -723,7 +723,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.settings_action.setEnabled(not active) self.settings_action.setEnabled(not active)
def closeEvent(self, e): def closeEvent(self, e):
self.common.log("OnionShareGui", "closeEvent") self.common.log("MainWindow", "closeEvent")
self.system_tray.hide() self.system_tray.hide()
try: try:
if self.mode == OnionShareGui.MODE_SHARE: if self.mode == OnionShareGui.MODE_SHARE:
@ -733,7 +733,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
else: else:
server_status = self.receive_mode.server_status server_status = self.receive_mode.server_status
if server_status.status != server_status.STATUS_STOPPED: if server_status.status != server_status.STATUS_STOPPED:
self.common.log("OnionShareGui", "closeEvent, opening warning dialog") self.common.log("MainWindow", "closeEvent, opening warning dialog")
dialog = QtWidgets.QMessageBox() dialog = QtWidgets.QMessageBox()
dialog.setWindowTitle(strings._("gui_quit_title")) dialog.setWindowTitle(strings._("gui_quit_title"))
if self.mode == OnionShareGui.MODE_SHARE: if self.mode == OnionShareGui.MODE_SHARE:

View File

@ -11,7 +11,7 @@ from onionshare.common import Common
from onionshare.settings import Settings from onionshare.settings import Settings
from onionshare.onion import Onion from onionshare.onion import Onion
from onionshare.web import Web from onionshare.web import Web
from onionshare_gui import Application, OnionShare, OnionShareGui from onionshare_gui import Application, OnionShare, MainWindow
from onionshare_gui.mode.share_mode import ShareMode from onionshare_gui.mode.share_mode import ShareMode
from onionshare_gui.mode.receive_mode import ReceiveMode from onionshare_gui.mode.receive_mode import ReceiveMode
from onionshare_gui.mode.website_mode import WebsiteMode from onionshare_gui.mode.website_mode import WebsiteMode
@ -53,7 +53,7 @@ class GuiBaseTest(object):
web = Web(common, False, True) web = Web(common, False, True)
open("/tmp/settings.json", "w").write(json.dumps(test_settings)) open("/tmp/settings.json", "w").write(json.dumps(test_settings))
gui = OnionShareGui( gui = MainWindow(
common, common,
testonion, testonion,
qtapp, qtapp,

View File

@ -10,7 +10,7 @@ from onionshare.common import Common
from onionshare.settings import Settings from onionshare.settings import Settings
from onionshare.onion import Onion from onionshare.onion import Onion
from onionshare.web import Web from onionshare.web import Web
from onionshare_gui import Application, OnionShare, OnionShareGui from onionshare_gui import Application, OnionShare, MainWindow
from .GuiShareTest import GuiShareTest from .GuiShareTest import GuiShareTest
@ -45,7 +45,7 @@ class GuiWebsiteTest(GuiShareTest):
web = Web(common, False, True) web = Web(common, False, True)
open("/tmp/settings.json", "w").write(json.dumps(test_settings)) open("/tmp/settings.json", "w").write(json.dumps(test_settings))
gui = OnionShareGui( gui = MainWindow(
common, common,
testonion, testonion,
qtapp, qtapp,

View File

@ -10,7 +10,7 @@ from onionshare.common import Common
from onionshare.settings import Settings from onionshare.settings import Settings
from onionshare.onion import Onion from onionshare.onion import Onion
from onionshare.web import Web from onionshare.web import Web
from onionshare_gui import Application, OnionShare, OnionShareGui from onionshare_gui import Application, OnionShare, MainWindow
from onionshare_gui.mode.share_mode import ShareMode from onionshare_gui.mode.share_mode import ShareMode
from onionshare_gui.mode.receive_mode import ReceiveMode from onionshare_gui.mode.receive_mode import ReceiveMode
@ -54,7 +54,7 @@ class TorGuiBaseTest(GuiBaseTest):
web = Web(common, False, False) web = Web(common, False, False)
open("/tmp/settings.json", "w").write(json.dumps(test_settings)) open("/tmp/settings.json", "w").write(json.dumps(test_settings))
gui = OnionShareGui( gui = MainWindow(
common, common,
testonion, testonion,
qtapp, qtapp,