mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-19 07:43:57 +08:00
Updated Python code with Python 3.6+ features:
- utf-8 encoding is now the default (PEP 3120)
- Replace list comprehensions by Generator Expressions (PEP 289)
- Replace yield loop by yield from (PEP 380)
- Remove the (object) subclass when defining a class
- Replace the IOError alias by OSError (PEP 3151)
- Define sets with curly braces {} instead of set()
- Remove "r" parameter from open function, which is default
Co-Authored-By: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-Authored-By: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>
Co-authored-by: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-authored-by: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>
old-commit-hash: 332f568a82
21 lines
466 B
Python
21 lines
466 B
Python
import os
|
|
from cffi import FFI
|
|
|
|
import sip # pylint: disable=import-error
|
|
|
|
from common.ffi_wrapper import suffix
|
|
from common.basedir import BASEDIR
|
|
|
|
|
|
def get_ffi():
|
|
lib = os.path.join(BASEDIR, "selfdrive", "ui", "qt", "libpython_helpers" + suffix())
|
|
|
|
ffi = FFI()
|
|
ffi.cdef("void set_main_window(void *w);")
|
|
return ffi, ffi.dlopen(lib)
|
|
|
|
|
|
def set_main_window(widget):
|
|
ffi, lib = get_ffi()
|
|
lib.set_main_window(ffi.cast('void*', sip.unwrapinstance(widget)))
|