Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.

Commit

Permalink
WIP commit: Added exceptions for vpn settings open
Browse files Browse the repository at this point in the history
  • Loading branch information
pocc committed Aug 27, 2018
1 parent 6845bdd commit 48c32fc
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 153 deletions.
15 changes: 3 additions & 12 deletions src/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ def show_main_menu(self):
"""
# Set entered dashboard email/redacted password to be shown by default
self.main_window_ui.set_dashboard_user_layout()

self.browser.scrape_administered_orgs()
current_org = self.browser.get_active_org_name()
org_list = self.browser.get_org_list()
org_list = self.browser.get_org_names()
current_org = org_list[self.browser.get_active_org_index()]
self.org_dropdown.addItems(org_list)
# Get the data we need and remove the cruft we don't
self.status.showMessage("Status: Fetching networks in " +
Expand All @@ -90,14 +88,7 @@ def show_main_menu(self):
self.network_dropdown.clear()
self.refresh_network_dropdown()

# When we have the organization, we can scrape networks
# When the user changes the organization dropdown, call the scrap
# networks method. Only change organization when there are more than 1
# organization to change

# We don't need to change organization if the user chooses
# "-- Select an Organization --"

# All of the major MainWindow slots that signals target
self.org_dropdown.currentIndexChanged.connect(self.change_organization)
self.network_dropdown.activated.connect(self.change_network)
self.connect_btn.clicked.connect(self.setup_vpn)
Expand Down
25 changes: 23 additions & 2 deletions src/gui/menu_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
# limitations under the License.

"""This class contains the menubars of the program."""
import sys

from PyQt5.QtWidgets import QAction
from PyQt5.QtWidgets import QDialog
from PyQt5.QtWidgets import QLabel
from PyQt5.QtWidgets import QVBoxLayout
from PyQt5.QtWidgets import QTextEdit

import src.modules.os_utils as os_utils
from src.gui.modal_dialogs import show_error_dialog


class MenuBars:
"""Menubars of the GUI
Expand Down Expand Up @@ -81,8 +85,25 @@ def generate_menu_bars(self):

@staticmethod
def file_sysprefs():
"""Open system VPN settings"""
os_utils.open_vpnsettings()
"""Open system VPN settings
Even if errors are raised, they will only be shown after the program
closes because Qt supresses some messages (there are ways to get
around this.)
Raises:
FileNotFoundError: If vpn settings are not found
"""
try:
os_utils.open_vpnsettings()
except FileNotFoundError as e:
if sys.platform.startswith('linux'):
show_error_dialog(
str(e) + '\n\nThis happens when gnome-network-manager is '
'not installed and systems vpn prefs are opened in linux.')
else:
show_error_dialog(str(e) + '\n\nUnknown error: VPN settings '
'not found')

@staticmethod
def file_quit_action():
Expand Down
2 changes: 1 addition & 1 deletion src/modules/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def program_structure(self):
"""

# Get organization info so we have something to show user
self.interface.browser.count_admin_orgs()
self.interface.browser.org_data_setup()
self.interface.show_main_menu()

"""
Expand Down

0 comments on commit 48c32fc

Please sign in to comment.