Skip to content

Commit

Permalink
device: move imports of ui modules to beginning of files
Browse files Browse the repository at this point in the history
  • Loading branch information
pfps committed Feb 11, 2024
1 parent 7573f56 commit 1701de4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions lib/logitech_receiver/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

from struct import unpack as _unpack

from solaar.ui.config_panel import record_setting

from . import diversion as _diversion
from . import hidpp10 as _hidpp10
from . import hidpp20 as _hidpp20
Expand Down Expand Up @@ -410,7 +412,6 @@ def _process_feature_notification(device, status, n, feature):
elif feature == _F.BACKLIGHT2:
if (n.address == 0x00):
level = _unpack('!B', n.data[1:2])[0]
from solaar.ui.config_panel import record_setting # prevent circular import
record_setting(device, _st.Backlight2Level, [level])

elif feature == _F.REPROG_CONTROLS_V4:
Expand Down Expand Up @@ -440,7 +441,6 @@ def _process_feature_notification(device, status, n, feature):
if logger.isEnabledFor(logging.INFO):
logger.info('%s: WHEEL: ratchet: %d', device, ratchet)
if ratchet < 2: # don't process messages with unusual ratchet values
from solaar.ui.config_panel import record_setting # prevent circular import
record_setting(device, _st.ScrollRatchet, [2 if ratchet else 1])
else:
if logger.isEnabledFor(logging.INFO):
Expand All @@ -460,7 +460,6 @@ def _process_feature_notification(device, status, n, feature):
profile_sector = _unpack('!H', device.feature_request(_F.ONBOARD_PROFILES, 0x40)[:2])[0]
for profile in device.profiles.profiles.values() if device.profiles else []:
if profile.sector == profile_sector:
from solaar.ui.config_panel import record_setting # prevent circular import
record_setting(device, _st.AdjustableDpi, [profile.resolutions[resolution_index]])

_diversion.process_notification(device, status, n, feature)
Expand Down
4 changes: 3 additions & 1 deletion lib/solaar/ui/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import gi

from gi.repository import Gdk, GLib, Gtk
from gi.repository.GObject import TYPE_PYOBJECT
from logitech_receiver import hidpp10 as _hidpp10
from logitech_receiver.common import NamedInt as _NamedInt
Expand All @@ -38,6 +37,9 @@

# from solaar import __version__ as VERSION

gi.require_version('Gdk', '3.0')
from gi.repository import Gdk, GLib, Gtk # NOQA: E402

logger = logging.getLogger(__name__)

#
Expand Down

0 comments on commit 1701de4

Please sign in to comment.