Merge ~kissiel/checkbox-support:xrandr-rotation-improv into checkbox-support:master

Proposed by Maciej Kisielewski
Status: Merged
Approved by: Maciej Kisielewski
Approved revision: 66a31225e4b4cdc503e61dd408fd3388ff5d6c57
Merged at revision: 0b8440cc5190190519630b13bfb1d77e726a3726
Proposed branch: ~kissiel/checkbox-support:xrandr-rotation-improv
Merge into: checkbox-support:master
Diff against target: 13 lines (+2/-0)
1 file modified
checkbox_support/contrib/xrandr.py (+2/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+368471@code.launchpad.net

Description of the change

xrandr: fix crashing when DISPLAY is not defined

Tested by running "from checkbox_support.contrib import xrandr" with and without having DISPLAY defined in environ.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/checkbox_support/contrib/xrandr.py b/checkbox_support/contrib/xrandr.py
index eee9c4e..9a79f40 100644
--- a/checkbox_support/contrib/xrandr.py
+++ b/checkbox_support/contrib/xrandr.py
@@ -977,6 +977,8 @@ class Screen(object):
977def get_current_display():977def get_current_display():
978 """Returns the currently used display"""978 """Returns the currently used display"""
979 display_url = os.getenv("DISPLAY")979 display_url = os.getenv("DISPLAY")
980 if display_url is None:
981 raise SystemExit("DISPLAY environment variable is not defined!")
980 open_display = xlib.XOpenDisplay982 open_display = xlib.XOpenDisplay
981 # Set .argtypes and .restype, to ensure proper983 # Set .argtypes and .restype, to ensure proper
982 # type check and conversion984 # type check and conversion

Subscribers

People subscribed via source and target branches