Skip to content

Commit

Permalink
fix obvious errors when NetworkManager is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
fogti committed Sep 3, 2023
1 parent 2191c72 commit f2f5d28
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions eduvpn/nm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@
from eduvpn.utils import run_in_glib_thread
from eduvpn.variants import ApplicationVariant

gi.require_version("NM", "1.0") # noqa: E402
from gi.repository import GLib # type: ignore
from gi.repository.Gio import Task # type: ignore

_logger = logging.getLogger(__name__)

LINUX_NET_FOLDER = Path("/sys/class/net")

try:
import gi

gi.require_version("NM", "1.0")
from gi.repository import NM, GLib # type: ignore
from gi.repository import NM # type: ignore
except (ImportError, ValueError):
_logger.warning("Network Manager not available")
NM = None
Expand Down Expand Up @@ -238,7 +236,7 @@ def iface(self) -> Optional[str]:
return devices[0].get_iface()

@property
def ipv4_config(self) -> Optional[NM.IPConfig]:
def ipv4_config(self) -> Optional["NM.IPConfig"]:
"""
Get the ipv4 config for the active VPN connection
"""
Expand Down Expand Up @@ -792,7 +790,7 @@ def quit_loop(*args, **kwargs):


def add_connection_callback(
client: NM.Client, result: Task, user_data: Tuple[NMManager, Optional[Callable]]
client: "NM.Client", result: Task, user_data: Tuple[NMManager, Optional[Callable]]
) -> None:
object, callback = user_data
new_con = client.add_connection_finish(result)
Expand Down
1 change: 0 additions & 1 deletion eduvpn/ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import gi

gi.require_version("Gtk", "3.0") # noqa: E402
gi.require_version("NM", "1.0") # noqa: E402
from datetime import datetime
from functools import partial

Expand Down

0 comments on commit f2f5d28

Please sign in to comment.