Do not import fast_data_types at the top level of utility modules
This commit is contained in:
parent
63a2ecb89c
commit
cf7ecd5e66
@ -9,7 +9,6 @@ from collections import deque
|
|||||||
|
|
||||||
from .conf.utils import resolve_config
|
from .conf.utils import resolve_config
|
||||||
from .constants import appname, defconf, is_macos, is_wayland, str_version
|
from .constants import appname, defconf, is_macos, is_wayland, str_version
|
||||||
from .fast_data_types import GLFW_KEY_UNKNOWN, glfw_get_key_name
|
|
||||||
|
|
||||||
CONFIG_HELP = '''\
|
CONFIG_HELP = '''\
|
||||||
Specify a path to the configuration file(s) to use. All configuration files are
|
Specify a path to the configuration file(s) to use. All configuration files are
|
||||||
@ -641,6 +640,7 @@ def print_shortcut(key_sequence, action):
|
|||||||
names.append(name)
|
names.append(name)
|
||||||
if key:
|
if key:
|
||||||
if is_native:
|
if is_native:
|
||||||
|
from .fast_data_types import GLFW_KEY_UNKNOWN, glfw_get_key_name
|
||||||
names.append(glfw_get_key_name(GLFW_KEY_UNKNOWN, key))
|
names.append(glfw_get_key_name(GLFW_KEY_UNKNOWN, key))
|
||||||
else:
|
else:
|
||||||
names.append(krmap[key])
|
names.append(krmap[key])
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import pwd
|
|||||||
import sys
|
import sys
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from .fast_data_types import set_boss as set_c_boss
|
|
||||||
|
|
||||||
appname = 'kitty'
|
appname = 'kitty'
|
||||||
version = (0, 11, 3)
|
version = (0, 11, 3)
|
||||||
@ -94,6 +93,7 @@ def get_boss():
|
|||||||
|
|
||||||
|
|
||||||
def set_boss(m):
|
def set_boss(m):
|
||||||
|
from .fast_data_types import set_boss as set_c_boss
|
||||||
get_boss.boss = m
|
get_boss.boss = m
|
||||||
set_c_boss(m)
|
set_c_boss(m)
|
||||||
|
|
||||||
|
|||||||
@ -15,16 +15,13 @@ from time import monotonic
|
|||||||
from .constants import (
|
from .constants import (
|
||||||
appname, is_macos, is_wayland, supports_primary_selection
|
appname, is_macos, is_wayland, supports_primary_selection
|
||||||
)
|
)
|
||||||
from .fast_data_types import (
|
|
||||||
GLSL_VERSION, close_tty, log_error_string, open_tty, redirect_std_streams,
|
|
||||||
x11_display
|
|
||||||
)
|
|
||||||
from .rgb import Color, to_color
|
from .rgb import Color, to_color
|
||||||
|
|
||||||
BASE = os.path.dirname(os.path.abspath(__file__))
|
BASE = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
def load_shaders(name):
|
def load_shaders(name):
|
||||||
|
from .fast_data_types import GLSL_VERSION
|
||||||
vert = open(os.path.join(BASE, '{}_vertex.glsl'.format(name))).read().replace('GLSL_VERSION', str(GLSL_VERSION), 1)
|
vert = open(os.path.join(BASE, '{}_vertex.glsl'.format(name))).read().replace('GLSL_VERSION', str(GLSL_VERSION), 1)
|
||||||
frag = open(os.path.join(BASE, '{}_fragment.glsl'.format(name))).read().replace('GLSL_VERSION', str(GLSL_VERSION), 1)
|
frag = open(os.path.join(BASE, '{}_fragment.glsl'.format(name))).read().replace('GLSL_VERSION', str(GLSL_VERSION), 1)
|
||||||
return vert, frag
|
return vert, frag
|
||||||
@ -38,6 +35,7 @@ def safe_print(*a, **k):
|
|||||||
|
|
||||||
|
|
||||||
def log_error(*a, **k):
|
def log_error(*a, **k):
|
||||||
|
from .fast_data_types import log_error_string
|
||||||
try:
|
try:
|
||||||
msg = k.get('sep', ' ').join(map(str, a)) + k.get('end', '')
|
msg = k.get('sep', ' ').join(map(str, a)) + k.get('end', '')
|
||||||
log_error_string(msg.replace('\0', ''))
|
log_error_string(msg.replace('\0', ''))
|
||||||
@ -180,6 +178,7 @@ def detach(fork=True, setsid=True, redirect=True):
|
|||||||
if setsid:
|
if setsid:
|
||||||
os.setsid()
|
os.setsid()
|
||||||
if redirect:
|
if redirect:
|
||||||
|
from .fast_data_types import redirect_std_streams
|
||||||
redirect_std_streams(os.devnull)
|
redirect_std_streams(os.devnull)
|
||||||
|
|
||||||
|
|
||||||
@ -195,6 +194,7 @@ def init_startup_notification_x11(window_handle, startup_id=None):
|
|||||||
sid = startup_id or os.environ.pop('DESKTOP_STARTUP_ID', None) # ensure child processes dont get this env var
|
sid = startup_id or os.environ.pop('DESKTOP_STARTUP_ID', None) # ensure child processes dont get this env var
|
||||||
if not sid:
|
if not sid:
|
||||||
return
|
return
|
||||||
|
from .fast_data_types import x11_display
|
||||||
display = x11_display()
|
display = x11_display()
|
||||||
if not display:
|
if not display:
|
||||||
return
|
return
|
||||||
@ -369,10 +369,12 @@ def write_all(fd, data):
|
|||||||
class TTYIO:
|
class TTYIO:
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
from .fast_data_types import open_tty
|
||||||
self.tty_fd, self.original_termios = open_tty(True)
|
self.tty_fd, self.original_termios = open_tty(True)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, *a):
|
def __exit__(self, *a):
|
||||||
|
from .fast_data_types import close_tty
|
||||||
close_tty(self.tty_fd, self.original_termios)
|
close_tty(self.tty_fd, self.original_termios)
|
||||||
|
|
||||||
def send(self, data):
|
def send(self, data):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user