Skip to content

Commit 0a5700c

Browse files
committed
FAILED -> ERROR
1 parent d61e730 commit 0a5700c

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

inputremapper/gui/controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ def start_injecting(self):
658658
self.message_broker.unsubscribe(self.show_injector_result)
659659
self.show_status(
660660
CTX_APPLY,
661-
_("Failed to apply preset %s") % self.data_manager.active_preset.name,
661+
_('Failed to apply preset "%s"') % self.data_manager.active_preset.name,
662662
)
663663

664664
def show_injector_result(self, msg: InjectorStateMessage):
@@ -667,7 +667,7 @@ def show_injector_result(self, msg: InjectorStateMessage):
667667
state = msg.state
668668

669669
def running():
670-
msg = _("Applied preset %s") % self.data_manager.active_preset.name
670+
msg = _('Applied preset "%s"') % self.data_manager.active_preset.name
671671
if self.data_manager.active_preset.dangerously_mapped_btn_left():
672672
msg += _(", CTRL + DEL to stop")
673673
self.show_status(CTX_APPLY, msg)
@@ -697,10 +697,10 @@ def no_grab():
697697
assert self.data_manager.active_preset # make mypy happy
698698
state_calls: Dict[InjectorState, Callable] = {
699699
InjectorState.RUNNING: running,
700-
InjectorState.FAILED: partial(
700+
InjectorState.ERROR: partial(
701701
self.show_status,
702702
CTX_ERROR,
703-
_('Failed to apply preset "%s"') % self.data_manager.active_preset.name,
703+
_('Error applying preset "%s"') % self.data_manager.active_preset.name,
704704
),
705705
InjectorState.NO_GRAB: no_grab,
706706
InjectorState.UPGRADE_EVDEV: partial(

inputremapper/gui/data_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def start_injecting(self) -> bool:
570570
self.do_when_injector_state(
571571
{
572572
InjectorState.RUNNING,
573-
InjectorState.FAILED,
573+
InjectorState.ERROR,
574574
InjectorState.NO_GRAB,
575575
InjectorState.UPGRADE_EVDEV,
576576
},

inputremapper/injection/injector.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class InjectorCommand(str, enum.Enum):
6262
class InjectorState(str, enum.Enum):
6363
UNKNOWN = "UNKNOWN"
6464
STARTING = "STARTING"
65-
FAILED = "FAILED"
65+
ERROR = "FAILED"
6666
RUNNING = "RUNNING"
6767
STOPPED = "STOPPED"
6868
NO_GRAB = "NO_GRAB"
@@ -174,7 +174,7 @@ def get_state(self) -> InjectorState:
174174
if state in (InjectorState.STARTING, InjectorState.RUNNING) and not alive:
175175
# we thought it is running (maybe it was when get_state was previously),
176176
# but the process is not alive. It probably crashed
177-
state = InjectorState.FAILED
177+
state = InjectorState.ERROR
178178
logger.error("Injector was unexpectedly found stopped")
179179

180180
logger.debug(

tests/unit/test_controller.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
from inputremapper.gui.reader_client import ReaderClient
5151
from inputremapper.gui.utils import CTX_ERROR, CTX_APPLY, gtk_iteration
5252
from inputremapper.gui.gettext import _
53-
from inputremapper.injection.global_uinputs import GlobalUInputs, UInput, FrontendUInput
53+
from inputremapper.injection.global_uinputs import GlobalUInputs, FrontendUInput
5454
from inputremapper.configs.mapping import UIMapping, MappingData, Mapping
5555
from tests.lib.spy import spy
5656
from tests.lib.patches import FakeDaemonProxy
@@ -1048,17 +1048,17 @@ def f(data):
10481048

10491049
self.controller.start_injecting()
10501050
gtk_iteration(50)
1051-
self.assertEqual(calls[-1].msg, _("Applied preset %s") % "preset2")
1051+
self.assertEqual(calls[-1].msg, _('Applied preset "%s"') % "preset2")
10521052

1053-
mock.return_value = InjectorState.FAILED
1053+
mock.return_value = InjectorState.ERROR
10541054
self.controller.start_injecting()
10551055
gtk_iteration(50)
1056-
self.assertEqual(calls[-1].msg, _("Failed to apply preset %s") % "preset2")
1056+
self.assertEqual(calls[-1].msg, _('Error applying preset "%s"') % "preset2")
10571057

10581058
mock.return_value = InjectorState.NO_GRAB
10591059
self.controller.start_injecting()
10601060
gtk_iteration(50)
1061-
self.assertEqual(calls[-1].msg, "The device was not grabbed")
1061+
self.assertEqual(calls[-1].msg, _('Failed to apply preset "%s"') % "preset2")
10621062

10631063
mock.return_value = InjectorState.UPGRADE_EVDEV
10641064
self.controller.start_injecting()

tests/unit/test_injector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def tearDown(self):
107107
time.sleep(0.2)
108108
self.assertIn(
109109
self.injector.get_state(),
110-
(InjectorState.STOPPED, InjectorState.FAILED, InjectorState.NO_GRAB),
110+
(InjectorState.STOPPED, InjectorState.ERROR, InjectorState.NO_GRAB),
111111
)
112112
self.injector = None
113113
evdev.InputDevice.grab = self.grab

0 commit comments

Comments
 (0)