Giter Club home page Giter Club logo

dcspy's Introduction

image Python CI Coverage Status Codacy Badge License Downloads dcspy Patreon Discord image pre-commit.ci status Maintainability Rating CII Best Practices Downloads Rate this package

dcspylogo

DCSpy

DCSpy is able to pull information from DCS aircraft and display on Logitech G-series keyboards LCD.

Features:

  • Logitech device with 160x43 px (4 lines) monochrome LCD - G13, G15 (v1 and v2) and G510
  • Logitech device with 320x240 px (8 lines) full RGBA LCD - G19
  • Support for other Logitech devices:
    • Keyboards: G910, G710, G110, G105, G103, G11
    • Headphones: G35, G633, G930, G933
    • Mouses: G600, G300, G400, G700, G9, MX518, G402, G502, G602
  • Setup G-Keys to any toggle, switch or knob in cockpit - Setup of G-Keys
  • Support for all aircraft (official and mods) with clickable cockpits - DCS-BIOS aircraft
  • Modern looking GUI using Qt6/PySide6

See more information on Wiki page.

Aircraft and instruments

There are to kinds of supported aircraft:

  • Basic - allow assigning all G-Keys of Logitech keyboard to aircraft's instruments in the cockpit (all clickable cockpits supported by DCS-BIOS)
  • Advanced - additionally can display some information on LCD (listed below)

Why such way? Basically advanced support is for aircraft that I own and therefore can test it.

Advanced

  • F/A-18C Hornet UFC - Up Front Controller
  • F-16C Viper DED - Data Entry Display
  • Ka-50 Black Shark II and III - PVI-800 and autopilot channels
  • Mi-8MTV2 Hip - autopilot channels and Radios information
  • Mi-24P Hind - Autopilot channels and modes and Radios information
  • A-10C Warthog and A-10C II Tank Killer - Radio frequency information
  • F-14A and F-14B Tomcat - basic support for RIO CAP
  • AV-8B Night Attack Harrier - Up Front Controller and Option Display Unit
  • AH-64D Apache - Enhanced Up Front Display
  • F-15E Eagle - Upfront Control Panel
  • more to come...

Requirements

Notes:

  • If you upgrade DCSpy from 1.5.1 or older, you can safely remove Logitech LCD SDK from C:\Program Files\Logitech Gaming Software\LCDSDK_8.57.148. Since DCSpy version 1.6.0 uses built-in SDK in LGS (Logitech Gaming Software).

New ideas

I have lots of plans and new ideas how to improve it internally and form a user's perspective, but don't hesitate to contact me. Maybe it will motivate me to implement some new stuff. Please open issue if you find a bug or have any crazy idea. You are welcome dcspy Discord server.

Contributing

You want contribute, perfect see: contributing guide.

Credits

More details here.

Sponsored by Jetbrains Open Source Support Program

logo logo

dcspy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

qboriskr sleighzy

dcspy's Issues

Extra fail notification during start

Describe the bug
Extra fail notification during start when loading empty/basic aircraft.
Problem is in BasicAircraft._load_plane_yaml()

To Reproduce
Steps to reproduce the behavior:

  1. Click Start

Logs and Screenshots

DEBUG   | Starting thread <Thread(dcspy-app, initial)> for: {'lcd_type': 'G13', 'event': <threading.Event at 0x1f1ccc36d50: unset>, 'fonts_cfg': FontsConfig(name='consola.ttf', small=9, medium=11, large=16), 'dcs_bios': 'D:\\Users\\mplic\\Saved Games\\DCS.openbeta\\Scripts\\DCS-BIOS'}
WARNING | FileNotFoundError: C:\Users\mplic\AppData\Local\dcspy\.yaml.
Traceback (most recent call last):
  File "D:\Projects\dcspy_dev\dcspy\utils.py", line 66, in load_yaml
    with open(file=full_path, encoding='utf-8') as yaml_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\mplic\\AppData\\Local\\dcspy\\.yaml'
DEBUG   | [Errno 2] No such file or directory: 'C:\\Users\\mplic\\AppData\\Local\\dcspy\\.yaml'
INFO    | Loading: G13: 160x43

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

PyInstaller starting exception

When LogitechLcd.dll can not be located (LGS not installed)

ERROR   | Failed to load dynlib/dll 'C:\\Program Files\\Logitech Gaming Software\\SDK\\LCD\\x64\\LogitechLcd.dll'. Most likely this dynlib/dll was not found when the application was frozen.
Traceback (most recent call last):
  File "PyInstaller\loader\pyimod03_ctypes.py", line 53, in __init__
  File "ctypes\__init__.py", line 376, in __init__
FileNotFoundError: Could not find module 'C:\Program Files\Logitech Gaming Software\SDK\LCD\x64\LogitechLcd.dll' (or one of its dependencies). Try using the full path with constructor syntax.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "dcspy\sdk\__init__.py", line 36, in load_dll
    dll = _init_dll(lib_type)
          ^^^^^^^^^^^^^^^^^^^
  File "dcspy\sdk\__init__.py", line 25, in _init_dll
    return CDLL(dll_path)
           ^^^^^^^^^^^^^^
  File "PyInstaller\loader\pyimod03_ctypes.py", line 55, in __init__
pyimod03_ctypes.install.<locals>.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Program Files\\Logitech Gaming Software\\SDK\\LCD\\x64\\LogitechLcd.dll'. Most likely this dynlib/dll was not found when the application was frozen.  

To fix this, add to exception handling to load_dll()

except Exception as ex:
    LOG.error(f'{type(ex).__name__=}')
    LOG.error(f'{ex.msg=}')
    return None
  • We need find a way to show popup with explanation LGS is not installed
  • Do not let dcspy start thread or update status bar
  • disable start button
  • autostart should failed/not run

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Allow update LCD with text instead of image

Check if it make sense to allow update LCD just with 4 lines of text (need new general function for mono and color) or stick with generated image

Set text methods

logi_lcd_mono_set_text(line_no: int, text: str)
https://github.com/emcek/dcspy/blob/master/dcspy/lcd_sdk.py#L144

logi_lcd_color_set_title(text: str, rgb: Tuple[int, int, int] = (255, 255, 255))
https://github.com/emcek/dcspy/blob/master/dcspy/lcd_sdk.py#L179

Image update

update_display(image: Image) -> None:
https://github.com/emcek/dcspy/blob/master/dcspy/lcd_sdk.py#L216

Update image in code

https://github.com/emcek/dcspy/blob/master/dcspy/logitech.py#L67
https://github.com/emcek/dcspy/blob/master/dcspy/starter.py#L77

Download new version

Allow download new version.
Try detect the way dcspy was executes:

  • python
  • executable (pyinstaller)

Act accordingly:

  • suggest pip install
  • allow to download file directly from GitHub

Check implementation of ReleaseInfo:

  • list of downloadable assets

Fix mypy type hints for Pillow

Add types_Pillow and correct all mis-types

  • Aircraft.prepare_image - img_for_lcd use self.lcd.mode, maybe can be clever and it not needed
  • LcdInfo.foreground - Union[Tuple[i,i,i], Tuple[i,i,i,i]]
  • aircraft ImageDraw -> ImageDraw.Draw or ImageDraw.ImageDraw

use packaging > 21.3

  • Update packaging > 21.3
  • Redesign ReleaseInfo from utils
  • remove usage of version.LegacyVersion

Empty string as keyboard name

Describe the bug
Empty string as keyboard name.

Setting:
keyboard: ''
sas weird side effects

DEBUG   | QThreadPool with 8 thread(s)
Critical error: 'DcsPyQtGui' object has no attribute 'rb_'
Traceback (most recent call last):
  File "D:\Projects\dcspy_dev\dcspy\run.py", line 25, in run
    window = DcsPyQtGui()
             ^^^^^^^^^^^^
  File "D:\Projects\dcspy_dev\dcspy\qt_gui.py", line 85, in __init__
    self.apply_configuration(cfg=self.config)
  File "D:\Projects\dcspy_dev\dcspy\qt_gui.py", line 1057, in apply_configuration
    getattr(self, f'rb_{cfg["keyboard"].lower().replace(" ", "")}').toggle()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DcsPyQtGui' object has no attribute 'rb_'

Unhandled keys for G19

Describe the bug
Not all keys for G19 are handled for F-16C Viper

To Reproduce
Steps to reproduce the behavior:

  1. Start G-19
  2. Click on menu bitton
  3. KeyError

Logs and Screenshots

Exception in thread dcspy-app:
Traceback (most recent call last):
  File "D:\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "D:\Python310\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "D:\Python310\lib\site-packages\dcspy\starter.py", line 108, in dcspy_run
    _handle_connection(lcd, parser, dcs_sock, event)
  File "D:\Python310\lib\site-packages\dcspy\starter.py", line 41, in _handle_connection
    lcd.button_handle(sock)
  File "D:\Python310\lib\site-packages\dcspy\logitech.py", line 141, in button_handle
    sock.sendto(bytes(self.plane.button_request(button), 'utf-8'), SEND_ADDR)
  File "D:\Python310\lib\site-packages\dcspy\aircraft.py", line 301, in button_request
    button_bios_name = button_map[button]
KeyError: <LcdButton.menu: 16384>

Verify git ref for DCS-BIOS live

Snippet:

from git import Repo, BadName

commit_hash = 'abcde'  # Replace this with the actual hash

repo = Repo('.')  # Use the repository in the current directory
try:
    commit = repo.commit(commit_hash)
    print(f"The commit {commit_hash} exists in the local repository.")
except BadName:
    print(f"The commit {commit_hash} is not found in the local repository.")

Auto save all options

  • Allow auto save after changing any options from GUI
  • Remove Save button
  • maybe remove log entry

Clean up after failed migration for 3.0.0

Describe the bug
Check migration for 3.0.0 from perspective 3.1.2 and try cleanup:

'font_color_s'  -> 'font_color_m'
'font_color_xs' -> 'font_color_s'
'font_mono_s' -> 'font_mono_m'
'font_mono_xs' -> 'font_mono_s'

Verbose flag

Verbose flag should impact file and console logs.

Log from very beginning

Try logging migration phase

2024-01-13 23:43:40,429 | dcspy             | DEBUG   | MainThread | 
############################################################
Start session: 2024-01-13 23:43:40.429839
############################################################ / config_logger:28
2024-01-13 23:43:40,430 | dcspy             | INFO    | MainThread | Log file store at: C:\Users\mplic\AppData\Local\Temp\dcspy.log / config_logger:29
2024-01-13 23:43:40,430 | dcspy             | DEBUG   | MainThread | Arch: nt / win32 / 64bit / WindowsPE / <module>:21
2024-01-13 23:43:40,430 | dcspy             | DEBUG   | MainThread | Python: CPython-3.12.0 / <module>:22
2024-01-13 23:43:40,430 | dcspy             | DEBUG   | MainThread | Python exec: D:\Projects\venvs\dcspy_312\Scripts\python.exe / <module>:23
2024-01-13 23:43:40,486 | dcspy             | DEBUG   | MainThread | uname_result(system='Windows', node='ARMIKROG', release='10', version='10.0.19045', machine='AMD64') / <module>:24
2024-01-13 23:43:40,486 | dcspy             | DEBUG   | MainThread | Configuration: {'api_ver': '3.1.2', 'autostart': False, 'check_bios': False, 'check_ver': False, 'completer_items': 20, 'current_plane': 'A-10C', 'dcs': 'C:/Program Files/Eagle Dynamics/DCS World OpenBeta', 'dcsbios': 'D:/Users/mplic/Saved Games/DCS.openbeta/Scripts/DCS-BIOS', 'f16_ded_font': True, 'font_color_l': 32, 'font_color_m': 22, 'font_color_s': 18, 'font_mono_l': 16, 'font_mono_m': 11, 'font_mono_s': 9, 'font_name': 'consola.ttf', 'git_bios': True, 'git_bios_ref': 'master', 'gkeys_area': 2, 'gkeys_float': False, 'keyboard': 'G13', 'save_lcd': False, 'show_gui': True, 'toolbar_area': 4, 'toolbar_style': 0, 'verbose': True} from: C:\Users\mplic\AppData\Local\dcspy\config.yaml / <module>:25
2024-01-13 23:43:40,486 | dcspy             | INFO    | MainThread | dcspy 3.1.2 https://github.com/emcek/dcspy / <module>:26
2024-01-13 23:43:40,487 | dcspy             | INFO    | MainThread | DCS openbeta ver: 2.9.2.49940 / <module>:28
2024-01-13 23:43:40,530 | dcspy.sdk         | DEBUG   | MainThread | Selected DLL: C:\Program Files\Logitech Gaming Software\SDK\LCD\x64\LogitechLcd.dll / load_dll:50
2024-01-13 23:43:40,565 | dcspy.sdk         | INFO    | MainThread | Loading of LCD SDK success / load_dll:54
2024-01-13 23:43:40,567 | dcspy.sdk         | DEBUG   | MainThread | Selected DLL: C:\Program Files\Logitech Gaming Software\SDK\G-key\x64\LogitechGkey.dll / load_dll:50
2024-01-13 23:43:40,571 | dcspy.sdk         | INFO    | MainThread | Loading of Gkey SDK success / load_dll:54
2024-01-13 23:43:40,678 | dcspy.qt_gui      | DEBUG   | MainThread | QThreadPool with 8 thread(s) / __init__:56

Cancel color change not working

To Reproduce
Steps to reproduce the behavior:

  1. Try change color
  2. Click No
  3. New color save, but is shouldn't
  4. option is set to new color which was canceled

Allow start without GUI

Add way to start DCSpy without GUI, selecting LCD, editing setting, etc.

Research the best way (or both):
- [ ] by CLI parameter

  • by config flag in YAML file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.