Made imports pythonic

This commit is contained in:
itdominator 2022-12-11 14:52:09 -06:00
parent 1e7ad1ea34
commit 9db3dea48a
9 changed files with 41 additions and 20 deletions

View File

@ -1,4 +1,5 @@
import builtins, threading import builtins
import threading
# Python imports # Python imports
import builtins import builtins

View File

@ -82,6 +82,6 @@ class Controller(DummyMixin, ControllerData):
def set_clipboard_data(self, data: type) -> None: def set_clipboard_data(self, data: type) -> None:
proc = subprocess.Popen(['xclip','-selection','clipboard'], stdin=subprocess.PIPE) proc = subprocess.Popen(['xclip','-selection','clipboard'], stdin=subprocess.PIPE)
proc.stdin.write(data) proc.stdin.write(data.encode("utf-8"))
proc.stdin.close() proc.stdin.close()
retcode = proc.wait() retcode = proc.wait()

View File

@ -1,3 +1,12 @@
# Python imports
# Lib imports
# Application imports
class DummyMixin: class DummyMixin:
""" DummyMixin is an example of how mixins are used and structured in a project. """ """ DummyMixin is an example of how mixins are used and structured in a project. """

View File

@ -1,5 +1,6 @@
# Python imports # Python imports
import os, json import os
import json
from os.path import join from os.path import join
# Lib imports # Lib imports

View File

@ -1,5 +1,6 @@
# Python imports # Python imports
import os, time import os
import time
# Lib imports # Lib imports

View File

@ -1,11 +1,16 @@
# Python imports # Python imports
import os, sys, importlib, traceback import os
from os.path import join, isdir import sys
import portlib
import traceback
from os.path import join
from os.path import isdir
# Lib imports # Lib imports
import gi import gi
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio from gi.repository import Gtk
from gi.repository import Gio
# Application imports # Application imports
from .manifest import Plugin, ManifestProcessor from .manifest import Plugin, ManifestProcessor

View File

@ -1,6 +1,9 @@
# Python imports # Python imports
import os, threading, time import os
from multiprocessing.connection import Listener, Client import threading
import ime
from multiprocessing.connection import Client
from multiprocessing.connection import Listener
# Lib imports # Lib imports
@ -55,11 +58,11 @@ class IPCServer:
while True: while True:
conn = listener.accept() conn = listener.accept()
start_time = time.perf_counter() start_time = time.perf_counter()
self.handle_ipc_message(conn, start_time) self._handle_ipc_message(conn, start_time)
listener.close() listener.close()
def handle_ipc_message(self, conn, start_time) -> None: def _handle_ipc_message(self, conn, start_time) -> None:
while True: while True:
msg = conn.recv() msg = conn.recv()
if settings.is_debug(): if settings.is_debug():

View File

@ -1,5 +1,6 @@
# Python imports # Python imports
import os, logging import os
import logging
# Application imports # Application imports

View File

@ -114,8 +114,8 @@ class Settings:
self._builder.connect_signals(handlers) self._builder.connect_signals(handlers)
def get_builder(self) -> any: return self._builder
def set_builder(self, builder) -> any: self._builder = builder def set_builder(self, builder) -> any: self._builder = builder
def get_builder(self) -> any: return self._builder
def get_glade_file(self) -> str: return self._GLADE_FILE def get_glade_file(self) -> str: return self._GLADE_FILE
def get_logger(self) -> Logger: return self._logger def get_logger(self) -> Logger: return self._logger