From 4d7ec877469e627d1724be81b831f1672a1e0d3e Mon Sep 17 00:00:00 2001 From: A_D Date: Thu, 21 Jan 2021 12:01:01 +0200 Subject: [PATCH] Renamed ProtocolHandler implementations so not to clash --- protocol.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/protocol.py b/protocol.py index 8f43d190..7c331058 100644 --- a/protocol.py +++ b/protocol.py @@ -54,7 +54,7 @@ if sys.platform == 'darwin' and getattr(sys, 'frozen', False): kInternetEventClass = kAEGetURL = struct.unpack('>l', b'GURL')[0] keyDirectObject = struct.unpack('>l', b'----')[0] - class ProtocolHandler(GenericProtocolHandler): + class DarwinProtocolHandler(GenericProtocolHandler): POLL = 100 # ms def start(self, master): @@ -194,7 +194,7 @@ elif sys.platform == 'win32' and getattr(sys, 'frozen', False) and not is_wine a ) return 0 - class ProtocolHandler(GenericProtocolHandler): + class WindowsProtocolHandler(GenericProtocolHandler): def __init__(self): GenericProtocolHandler.__init__(self) @@ -273,7 +273,7 @@ else: # Linux / Run from source from http.server import BaseHTTPRequestHandler, HTTPServer - class ProtocolHandler(GenericProtocolHandler): + class LinuxProtocolHandler(GenericProtocolHandler): def __init__(self): GenericProtocolHandler.__init__(self) @@ -342,4 +342,12 @@ else: # Linux / Run from source # singleton -protocolhandler = ProtocolHandler() +protocolhandler: GenericProtocolHandler + +if sys.platform == 'darwin' and getattr(sys, 'frozen', False): + protocolhandler = DarwinProtocolHandler() # pyright: reportUnboundVariable=false + +elif sys.platform == 'win32' and getattr(sys, 'frozen', False) and not is_wine: + protocolhandler = WindowsProtocolHandler() +else: + protocolhandler = LinuxProtocolHandler()