Skip to content

Commit

Permalink
refactor: optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
alfrix committed Nov 26, 2024
1 parent 48fcfbf commit a92be75
Show file tree
Hide file tree
Showing 45 changed files with 57 additions and 29 deletions.
1 change: 1 addition & 0 deletions ks_includes/KlippyGtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import pathlib

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions ks_includes/KlippyRest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import re

import requests


Expand Down
2 changes: 1 addition & 1 deletion ks_includes/KlippyWebsocket.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/python

import threading
import json
import logging
import threading

import gi
import websocket
Expand Down
11 changes: 5 additions & 6 deletions ks_includes/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import configparser
import copy
import gettext
import os
import logging
import json
import re
import copy
import pathlib
import locale

import logging
import os
import pathlib
import re
from io import StringIO

SCREEN_BLANKING_OPTIONS = [
Expand Down
1 change: 1 addition & 0 deletions ks_includes/files.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os

import gi

gi.require_version("Gtk", "3.0")
Expand Down
7 changes: 2 additions & 5 deletions ks_includes/functions.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import ctypes
import logging
import logging.handlers
import os
import re
import struct
import subprocess
import sys
import threading
import time
import traceback
from queue import SimpleQueue as Queue

import ctypes
import struct

dpms_loaded = False
try:
ctypes.cdll.LoadLibrary('libXext.so.6')
Expand Down
1 change: 1 addition & 0 deletions ks_includes/printer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion ks_includes/screen_panel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import datetime
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
5 changes: 2 additions & 3 deletions ks_includes/sdbus_nm.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This is the backend of the UI panel that communicates to sdbus-networkmanager
# TODO device selection/swtichability
# Alfredo Monclus (alfrix) 2024
import subprocess
import logging
import subprocess
from uuid import uuid4

import sdbus
from sdbus_block.networkmanager import (
Expand All @@ -18,8 +19,6 @@
enums,
exceptions,
)
from gi.repository import GLib
from uuid import uuid4

NONE = 0 # The access point has no special security requirements.
PAIR_WEP40 = 1 # 40/64-bit WEP is supported for pairwise/unicast encryption.
Expand Down
1 change: 0 additions & 1 deletion ks_includes/widgets/bedmap.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 0 additions & 1 deletion ks_includes/widgets/heatergraph.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import datetime
import logging
import math
from array import array

import gi

Expand Down
1 change: 0 additions & 1 deletion ks_includes/widgets/keyboard.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
import os

import gi
Expand Down
1 change: 1 addition & 0 deletions ks_includes/widgets/lockscreen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version('Gtk', '3.0')
Expand Down
1 change: 1 addition & 0 deletions ks_includes/widgets/prompts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions ks_includes/widgets/screensaver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/base_panel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion panels/bed_level.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import re
import math
import re

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/bed_mesh.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import contextlib
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion panels/camera.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import mpv
import logging
import mpv

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion panels/console.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time
import re
import time

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/exclude.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/extrude.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import re

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/fan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/fine_tune.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import re

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/gcode_macros.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import re

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/gcodes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/input_shaper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/job_status.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import logging
import os

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/led.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/limits.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/main_menu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion panels/menu.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import json
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion panels/move.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
import logging
import re

import gi

gi.require_version("Gtk", "3.0")
Expand Down
2 changes: 1 addition & 1 deletion panels/network.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import subprocess
import logging
import os

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/pins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/power.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion panels/pressure_advance.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Pango
from gi.repository import Gtk
from ks_includes.screen_panel import ScreenPanel

# TODO multi-extruder support
Expand Down
3 changes: 2 additions & 1 deletion panels/printer_select.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib
from gi.repository import Gtk
from ks_includes.screen_panel import ScreenPanel
from ks_includes.widgets.autogrid import AutoGrid
from ks_includes.KlippyGtk import find_widget
Expand Down
1 change: 1 addition & 0 deletions panels/retraction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/shutdown.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/splash_screen.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os

import gi

gi.require_version("Gtk", "3.0")
Expand Down
3 changes: 2 additions & 1 deletion panels/spoolman.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import os.path
import pathlib
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/system.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
1 change: 1 addition & 0 deletions panels/temperature.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
Expand Down
2 changes: 1 addition & 1 deletion panels/zcalibrate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging

import gi

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Pango, GLib
from ks_includes.screen_panel import ScreenPanel
from ks_includes.KlippyGtk import find_widget
from datetime import datetime


Expand Down

0 comments on commit a92be75

Please sign in to comment.