Skip to content

Commit

Permalink
Update compare_resolution function
Browse files Browse the repository at this point in the history
The current compare_resolution function uses deprecated functions, and
it appears that any solution using Gdk with Wayland will fail to locate
a primary monitor (https://gitlab.gnome.org/GNOME/gtk/-/issues/1028).
Additionally, this change adds a hint if an error arises
  • Loading branch information
mckees committed Jan 16, 2025
1 parent 9253900 commit 7d62796
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions checkbox-core-snap/series16/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ parts:
- python3-requests-unixsocket
- python3-serial
- python3-setuptools
- python3-tk
- python3-yaml
- pyotherside
- libbluetooth3
Expand Down
1 change: 1 addition & 0 deletions checkbox-core-snap/series18/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ parts:
source-type: local
stage-packages:
- python3-requests-unixsocket
- python3-tk
- libbluetooth3
- libsystemd0
- v4l-utils
Expand Down
1 change: 1 addition & 0 deletions checkbox-core-snap/series20/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ parts:
- python3-distutils
- python3-pkg-resources
- python3.8-minimal
- python3-tk
build-packages:
- libbluetooth-dev
- libsystemd-dev
Expand Down
1 change: 1 addition & 0 deletions checkbox-core-snap/series22/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ parts:
- python3-distutils
- python3-pkg-resources
- python3.10-minimal
- python3-tk
build-packages:
- libbluetooth-dev
- libsystemd-dev
Expand Down
1 change: 1 addition & 0 deletions checkbox-core-snap/series24/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ parts:
- python3-minimal
- python3-pkg-resources
- python3.12-minimal
- python3-tk
build-packages:
- libbluetooth-dev
- libsystemd-dev
Expand Down
15 changes: 10 additions & 5 deletions providers/base/bin/resolution_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import gi
import sys
import tkinter as tk

Check warning on line 5 in providers/base/bin/resolution_test.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/resolution_test.py#L5

Added line #L5 was not covered by tests

from argparse import ArgumentParser

Expand All @@ -19,12 +20,16 @@ def check_resolution():


def compare_resolution(min_h, min_v):
# Evaluate just the primary display
screen = Gdk.Screen.get_default()
geom = screen.get_monitor_geometry(screen.get_primary_monitor())
try:
root = tk.Tk()
except tk.TclError as e:
print(e)
print("Are you sure the device is logged in and has a screen?")
width = root.winfo_screenwidth()
height = root.winfo_screenheight()

Check warning on line 29 in providers/base/bin/resolution_test.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/resolution_test.py#L23-L29

Added lines #L23 - L29 were not covered by tests
print("Minimum acceptable display resolution: %d x %d" % (min_h, min_v))
print("Detected display resolution: %d x %d" % (geom.width, geom.height))
return geom.width >= min_h and geom.height >= min_v
print("Detected display resolution: %d x %d" % (width, height))
return width >= min_h and height >= min_v

Check warning on line 32 in providers/base/bin/resolution_test.py

View check run for this annotation

Codecov / codecov/patch

providers/base/bin/resolution_test.py#L31-L32

Added lines #L31 - L32 were not covered by tests


def main():
Expand Down
4 changes: 4 additions & 0 deletions providers/base/units/graphics/packaging.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ Depends: gnome-randr
unit: packaging meta-data
os-id: debian
Depends: gnome-screenshot

unit: packaging meta-data
os-id: debian
Depends: python3-tk

0 comments on commit 7d62796

Please sign in to comment.