Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from calexandru2018/testing
Browse files Browse the repository at this point in the history
Dashboard close behavior and labels layout updated.
  • Loading branch information
calexandru2018 authored Feb 26, 2020
2 parents de4dd27 + e2f1cf4 commit 264e587
Show file tree
Hide file tree
Showing 6 changed files with 1,117 additions and 333 deletions.
6 changes: 4 additions & 2 deletions custom_pvpn_cli_ng/protonvpn_cli/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ def fastest(protocol=None, gui_enabled=False):
server_pool.append(server)

fastest_server = get_fastest_server(server_pool)
openvpn_connect(fastest_server, protocol, gui_enabled)
if gui_enabled:
return openvpn_connect(fastest_server, protocol, gui_enabled)
openvpn_connect(fastest_server, protocol)


def country_f(country_code, protocol=None):
Expand Down Expand Up @@ -348,7 +350,7 @@ def disconnect(passed=False):
logger.debug("No connection found")


def status():
def status(gui_enabled=False):
"""
Display the current VPN status
Expand Down
2 changes: 1 addition & 1 deletion protonvpn_linux_gui/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "1.1.5"
VERSION = "1.2.0"
PATH_AUTOCONNECT_SERVICE = "/etc/systemd/system/protonvpn-autoconnect.service"
TEMPLATE ="""
[Unit]
Expand Down
35 changes: 18 additions & 17 deletions protonvpn_linux_gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import re
import sys
import pathlib
from threading import Thread
import time

# ProtonVPN base CLI package import
from custom_pvpn_cli_ng.protonvpn_cli.constants import (USER, CONFIG_FILE, CONFIG_DIR, VERSION)
Expand Down Expand Up @@ -110,6 +112,9 @@ def connect_to_selected_server_button_clicked(self, button):
connection.openvpn_connect(selected_server, protocol)
update_labels_status(self.interface)

# def log_result(self, res):
# return res

def quick_connect_button_clicked(self, button):
"""Button/Event handler to connect to the fastest server
"""
Expand Down Expand Up @@ -138,9 +143,11 @@ def disconnect_button_clicked(self, button):

def refresh_server_list_button_clicked(self, button):
"""Button/Event handler to refresh/repopulate server list
- At the moment, will also refresh the Dashboard information, this will be fixed in the future.
"""
server_list_object = self.interface.get_object("ServerListStore")
populate_server_list(server_list_object)
update_labels_status(self.interface)

def about_menu_button_clicked(self, button):
"""Button /Event handlerto open About dialog
Expand Down Expand Up @@ -299,27 +306,20 @@ def purge_configurations_button_clicked(self, button):
cli.purge_configuration(gui_enabled=True)

class initialize_gui:
"""Initializes a GUI
-----
The GUI only makes external calls to the cli commands.
-----
Will request for the same data protonvpn init to initialize a user:
-Username
-Password
-Plan
-Protocol
There are two ways of starting this GUI, either by reversing the commented code so that it can be launched as part of the CLI:
"""Initializes the GUI
---
-protonvpn gui:
This will start from within the main CLI menu. Gui is invoked through cli()
Or leave it be as it is, and configuration is setup during installation with "pip3 install -e .", this way it can be launched as a separte command from the usual CLI:
-protonvpn-gui:
This will start the GUI without invoking cli()
If user has not initialized a profile, the GUI will ask for the following data:
- Username
- Password
- Plan
- Protocol
sudo protonvpn-gui
- Will start the GUI without invoking cli()
"""
def __init__(self):
check_root()

interface = Gtk.Builder()

posixPath = pathlib.PurePath(pathlib.Path(__file__).parent.absolute().joinpath("resources/main.glade"))
Expand All @@ -338,6 +338,7 @@ def __init__(self):
window = interface.get_object("LoginWindow")
else:
window = interface.get_object("Dashboard")
window.connect("destroy", Gtk.main_quit)
load_on_start(interface)

window.show()
Expand Down
Loading

0 comments on commit 264e587

Please sign in to comment.