Skip to content

Commit

Permalink
Window: draw 'Switch resolution' label
Browse files Browse the repository at this point in the history
  • Loading branch information
Hjdskes committed Jul 7, 2017
1 parent fb068e3 commit 59af2d8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions piper/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from gettext import gettext as _

from .gi_composites import GtkTemplate
from .mousemap import MouseMap
from .ratbagd import RatbagErrorCode
Expand Down Expand Up @@ -54,8 +56,13 @@ def __init__(self, ratbag, *args, **kwargs):
self._setup_resolutions_page()

def _setup_resolutions_page(self):
# TODO: mousemap needs to show which button switches resolution
mousemap = MouseMap("#Device", self._device, spacing=20, border_width=20)
profile = self._device.active_profile

mousemap = MouseMap("#Buttons", self._device, spacing=20, border_width=20)
for button in profile.buttons:
if button.action_type == "special" and button.special == "resolution-default":
label = Gtk.Label(_("Switch resolution"))
mousemap.add(label, "#button{}".format(button.index))

self.rate_500.connect("toggled", self._on_report_rate_toggled, 500)
self.rate_500.set_active(profile.active_resolution.report_rate == 500)
Expand All @@ -66,7 +73,6 @@ def _setup_resolutions_page(self):
# Place the MouseMap on the left
self.box_resolutions.reorder_child(mousemap, 0)

profile = self._device.active_profile
for resolution in reversed(profile.resolutions):
row = ResolutionRow(resolution)
self.listbox.prepend(row)
Expand Down

0 comments on commit 59af2d8

Please sign in to comment.