mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 00:07:14 +03:00
[1805] Update Prototypes
This commit is contained in:
parent
256be4c8a9
commit
b1ba45ab90
@ -8,7 +8,7 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
import winsound
|
import winsound
|
||||||
from ctypes.wintypes import DWORD, LONG, MSG, ULONG, WORD
|
from ctypes.wintypes import DWORD, LONG, MSG, ULONG, WORD, HWND, BOOL, UINT
|
||||||
import pywintypes
|
import pywintypes
|
||||||
import win32api
|
import win32api
|
||||||
import win32gui
|
import win32gui
|
||||||
@ -21,6 +21,8 @@ assert sys.platform == 'win32'
|
|||||||
logger = get_main_logger()
|
logger = get_main_logger()
|
||||||
|
|
||||||
UnregisterHotKey = ctypes.windll.user32.UnregisterHotKey # TODO: Coming Soon
|
UnregisterHotKey = ctypes.windll.user32.UnregisterHotKey # TODO: Coming Soon
|
||||||
|
UnregisterHotKey.argtypes = [HWND, ctypes.c_int]
|
||||||
|
UnregisterHotKey.restype = BOOL
|
||||||
|
|
||||||
MOD_ALT = 0x0001
|
MOD_ALT = 0x0001
|
||||||
MOD_CONTROL = 0x0002
|
MOD_CONTROL = 0x0002
|
||||||
@ -138,6 +140,7 @@ class INPUT(ctypes.Structure):
|
|||||||
|
|
||||||
SendInput = ctypes.windll.user32.SendInput
|
SendInput = ctypes.windll.user32.SendInput
|
||||||
SendInput.argtypes = [ctypes.c_uint, ctypes.POINTER(INPUT), ctypes.c_int]
|
SendInput.argtypes = [ctypes.c_uint, ctypes.POINTER(INPUT), ctypes.c_int]
|
||||||
|
SendInput.restype = UINT
|
||||||
|
|
||||||
INPUT_MOUSE = 0
|
INPUT_MOUSE = 0
|
||||||
INPUT_KEYBOARD = 1
|
INPUT_KEYBOARD = 1
|
||||||
|
1
l10n.py
1
l10n.py
@ -50,7 +50,6 @@ if sys.platform == 'win32':
|
|||||||
GetUserPreferredUILanguages.argtypes = [
|
GetUserPreferredUILanguages.argtypes = [
|
||||||
DWORD, ctypes.POINTER(ctypes.c_ulong), LPCVOID, ctypes.POINTER(ctypes.c_ulong)
|
DWORD, ctypes.POINTER(ctypes.c_ulong), LPCVOID, ctypes.POINTER(ctypes.c_ulong)
|
||||||
]
|
]
|
||||||
|
|
||||||
GetUserPreferredUILanguages.restype = BOOL
|
GetUserPreferredUILanguages.restype = BOOL
|
||||||
|
|
||||||
LOCALE_NAME_USER_DEFAULT = None
|
LOCALE_NAME_USER_DEFAULT = None
|
||||||
|
@ -36,7 +36,7 @@ MAX_FCMATERIALS_DISCREPANCY = 5 # Timestamp difference in seconds
|
|||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
import ctypes
|
import ctypes
|
||||||
from ctypes.wintypes import BOOL, HWND, LPARAM
|
from ctypes.wintypes import BOOL, HWND, LPARAM, HANDLE
|
||||||
import win32gui
|
import win32gui
|
||||||
|
|
||||||
from watchdog.events import FileSystemEventHandler, FileSystemEvent
|
from watchdog.events import FileSystemEventHandler, FileSystemEvent
|
||||||
@ -45,6 +45,8 @@ if sys.platform == 'win32':
|
|||||||
|
|
||||||
EnumWindowsProc = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
|
EnumWindowsProc = ctypes.WINFUNCTYPE(BOOL, HWND, LPARAM)
|
||||||
CloseHandle = ctypes.windll.kernel32.CloseHandle
|
CloseHandle = ctypes.windll.kernel32.CloseHandle
|
||||||
|
CloseHandle.argtypes = [HANDLE]
|
||||||
|
CloseHandle.restype = BOOL
|
||||||
GetProcessHandleFromHwnd = ctypes.windll.oleacc.GetProcessHandleFromHwnd
|
GetProcessHandleFromHwnd = ctypes.windll.oleacc.GetProcessHandleFromHwnd
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
5
prefs.py
5
prefs.py
@ -188,7 +188,7 @@ class AutoInc(contextlib.AbstractContextManager):
|
|||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
import ctypes
|
import ctypes
|
||||||
import winreg
|
import winreg
|
||||||
from ctypes.wintypes import HINSTANCE, LPCWSTR, LPWSTR, MAX_PATH, POINT, RECT, SIZE, UINT
|
from ctypes.wintypes import HINSTANCE, LPCWSTR, LPWSTR, MAX_PATH, POINT, RECT, SIZE, UINT, BOOL
|
||||||
import win32gui
|
import win32gui
|
||||||
is_wine = False
|
is_wine = False
|
||||||
try:
|
try:
|
||||||
@ -204,6 +204,8 @@ if sys.platform == 'win32':
|
|||||||
if not is_wine:
|
if not is_wine:
|
||||||
try:
|
try:
|
||||||
CalculatePopupWindowPosition = ctypes.windll.user32.CalculatePopupWindowPosition
|
CalculatePopupWindowPosition = ctypes.windll.user32.CalculatePopupWindowPosition
|
||||||
|
CalculatePopupWindowPosition.argtypes = [POINT, SIZE, UINT, RECT, RECT]
|
||||||
|
CalculatePopupWindowPosition.restype = BOOL
|
||||||
|
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
@ -225,6 +227,7 @@ if sys.platform == 'win32':
|
|||||||
|
|
||||||
LoadString = ctypes.windll.user32.LoadStringW
|
LoadString = ctypes.windll.user32.LoadStringW
|
||||||
LoadString.argtypes = [HINSTANCE, UINT, LPWSTR, ctypes.c_int]
|
LoadString.argtypes = [HINSTANCE, UINT, LPWSTR, ctypes.c_int]
|
||||||
|
LoadString.restype = ctypes.c_int
|
||||||
|
|
||||||
|
|
||||||
class PreferencesDialog(tk.Toplevel):
|
class PreferencesDialog(tk.Toplevel):
|
||||||
|
12
stats.py
12
stats.py
@ -25,7 +25,7 @@ logger = EDMCLogging.get_main_logger()
|
|||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
import ctypes
|
import ctypes
|
||||||
from ctypes.wintypes import POINT, RECT, SIZE, UINT
|
from ctypes.wintypes import POINT, RECT, SIZE, UINT, BOOL
|
||||||
import win32gui
|
import win32gui
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -33,6 +33,7 @@ if sys.platform == 'win32':
|
|||||||
CalculatePopupWindowPosition.argtypes = [
|
CalculatePopupWindowPosition.argtypes = [
|
||||||
ctypes.POINTER(POINT), ctypes.POINTER(SIZE), UINT, ctypes.POINTER(RECT), ctypes.POINTER(RECT)
|
ctypes.POINTER(POINT), ctypes.POINTER(SIZE), UINT, ctypes.POINTER(RECT), ctypes.POINTER(RECT)
|
||||||
]
|
]
|
||||||
|
CalculatePopupWindowPosition.restype = BOOL
|
||||||
|
|
||||||
except Exception: # Not supported under Wine 4.0
|
except Exception: # Not supported under Wine 4.0
|
||||||
CalculatePopupWindowPosition = None # type: ignore
|
CalculatePopupWindowPosition = None # type: ignore
|
||||||
@ -240,7 +241,7 @@ def ships(companion_data: dict[str, Any]) -> list[ShipRet]:
|
|||||||
"""
|
"""
|
||||||
Return a list of 5 tuples of ship information.
|
Return a list of 5 tuples of ship information.
|
||||||
|
|
||||||
:param data: [description]
|
:param companion_data: [description]
|
||||||
:return: A 5 tuple of strings containing: Ship ID, Ship Type Name (internal), Ship Name, System, Station, and Value
|
:return: A 5 tuple of strings containing: Ship ID, Ship Type Name (internal), Ship Name, System, Station, and Value
|
||||||
"""
|
"""
|
||||||
ships: list[dict[str, Any]] = companion.listify(cast(list, companion_data.get('ships')))
|
ships: list[dict[str, Any]] = companion.listify(cast(list, companion_data.get('ships')))
|
||||||
@ -250,16 +251,15 @@ def ships(companion_data: dict[str, Any]) -> list[ShipRet]:
|
|||||||
ships.insert(0, ships.pop(current)) # Put current ship first
|
ships.insert(0, ships.pop(current)) # Put current ship first
|
||||||
|
|
||||||
if not companion_data['commander'].get('docked'):
|
if not companion_data['commander'].get('docked'):
|
||||||
out: list[ShipRet] = []
|
|
||||||
# Set current system, not last docked
|
# Set current system, not last docked
|
||||||
out.append(ShipRet(
|
out: list[ShipRet] = [ShipRet(
|
||||||
id=str(ships[0]['id']),
|
id=str(ships[0]['id']),
|
||||||
type=ship_name_map.get(ships[0]['name'].lower(), ships[0]['name']),
|
type=ship_name_map.get(ships[0]['name'].lower(), ships[0]['name']),
|
||||||
name=str(ships[0].get('shipName', '')),
|
name=str(ships[0].get('shipName', '')),
|
||||||
system=companion_data['lastSystem']['name'],
|
system=companion_data['lastSystem']['name'],
|
||||||
station='',
|
station='',
|
||||||
value=str(ships[0]['value']['total'])
|
value=str(ships[0]['value']['total'])
|
||||||
))
|
)]
|
||||||
out.extend(
|
out.extend(
|
||||||
ShipRet(
|
ShipRet(
|
||||||
id=str(ship['id']),
|
id=str(ship['id']),
|
||||||
@ -299,7 +299,7 @@ def export_ships(companion_data: dict[str, Any], filename: AnyStr) -> None:
|
|||||||
h.writerow(list(thing))
|
h.writerow(list(thing))
|
||||||
|
|
||||||
|
|
||||||
class StatsDialog():
|
class StatsDialog:
|
||||||
"""Status dialog containing all of the current cmdr's stats."""
|
"""Status dialog containing all of the current cmdr's stats."""
|
||||||
|
|
||||||
def __init__(self, parent: tk.Tk, status: tk.Label) -> None:
|
def __init__(self, parent: tk.Tk, status: tk.Label) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user