mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
implement resolution active set (#249)
Fixes #80 Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
committed by
Jente Hidskes
parent
9dcd2c6c05
commit
de3bb0e579
@@ -429,6 +429,12 @@ def func_resolution_active_get(r, args):
|
||||
print(r.index)
|
||||
|
||||
|
||||
def func_resolution_active_set(r, args):
|
||||
r, p, d = find_resolution(r, args)
|
||||
r.set_active()
|
||||
d.commit()
|
||||
|
||||
|
||||
def func_resolution_default_get(r, args):
|
||||
p, d = find_profile(r, args)
|
||||
for r in p.resolutions:
|
||||
@@ -707,7 +713,7 @@ parser_def = [
|
||||
arg_type: int,
|
||||
},
|
||||
],
|
||||
func: func_dummy, # FIXME: func_active_resolution_set,
|
||||
func: func_resolution_active_set,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -213,13 +213,14 @@ class TestRatbgagCtlResolution(TestRatbagCtl):
|
||||
self.launch_fail_test(command + " 10 test_device")
|
||||
self.launch_fail_test(command + " test_device x")
|
||||
|
||||
@unittest.skip("Resolution active set not implemented")
|
||||
def test_resolution_active_set(self):
|
||||
command = "Resolution active set"
|
||||
r = self.launch_good_test(command + " 2 test_device")
|
||||
self.assertNotEqual(r, '')
|
||||
r = self.launch_good_test("Resolution active get test_device")
|
||||
self.assertEqual(int(r), 2)
|
||||
r = self.launch_good_test(command + " 0 test_device")
|
||||
self.assertEqual(r, '')
|
||||
r = self.launch_good_test("Resolution active get test_device")
|
||||
self.assertEqual(int(r), 0)
|
||||
self.launch_fail_test(command)
|
||||
self.launch_fail_test(command + " X test_device")
|
||||
self.launch_fail_test(command + " 1 test_device X")
|
||||
|
||||
@@ -426,6 +426,10 @@ class RatbagdResolution(_RatbagdDBus):
|
||||
"""Set this resolution to be the default."""
|
||||
return self._dbus_call("SetDefault", "")
|
||||
|
||||
def set_active(self):
|
||||
"""Set this resolution to be the active one."""
|
||||
return self._dbus_call("SetActive", "")
|
||||
|
||||
|
||||
class RatbagdButton(_RatbagdDBus):
|
||||
"""Represents a ratbagd button."""
|
||||
|
||||
Reference in New Issue
Block a user