Skip to content

Commit 7d06e38

Browse files
committed
PBL-42328: Add emu-set-content-size.
1 parent a4a9be8 commit 7d06e38

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

pebble_tool/commands/emucontrol.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,33 @@ def __call__(self, args):
292292
def add_parser(cls, parser):
293293
parser = super(EmuSetTimelinePeekCommand, cls).add_parser(parser)
294294
parser.add_argument('state', choices=['on', 'off'], help="Set whether a timeline quick view is visible.")
295+
296+
297+
class EmuSetContentSizeCommand(PebbleCommand):
298+
command = 'emu-set-content-size'
299+
valid_connections = {'qemu', 'emulator'}
300+
301+
def __call__(self, args):
302+
super(EmuSetContentSizeCommand, self).__call__(args)
303+
sizes = {
304+
'small': QemuContentSize.ContentSize.Small,
305+
'medium': QemuContentSize.ContentSize.Medium,
306+
'large': QemuContentSize.ContentSize.Large,
307+
'x-large': QemuContentSize.ContentSize.ExtraLarge,
308+
}
309+
if self.pebble.firmware_version < (4, 2, 0):
310+
raise ToolError("Content size is only supported by firmware version 4.2 or later.")
311+
if isinstance(self.pebble.transport, ManagedEmulatorTransport):
312+
platform = self.pebble.transport.platform
313+
if platform == 'emery':
314+
if args.size == 'small':
315+
raise ToolError("Emery does not support the 'small' content size.")
316+
else:
317+
if args.size == 'x-large':
318+
raise ToolError("Only Emery supports the 'x-large' content size.")
319+
send_data_to_qemu(self.pebble.transport, QemuContentSize(size=sizes[args.size]))
320+
321+
@classmethod
322+
def add_parser(cls, parser):
323+
parser = super(EmuSetContentSizeCommand, cls).add_parser(parser)
324+
parser.add_argument('size', choices=['small', 'medium', 'large', 'x-large'], help="Set the content size.")

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
libpebble2==0.0.23
1+
libpebble2==0.0.25
22
enum34==1.0.4
33
httplib2==0.9.1
44
oauth2client==1.4.12

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from setuptools import setup, find_packages
55

66
requires = [
7-
'libpebble2==0.0.23',
7+
'libpebble2==0.0.25',
88
'httplib2==0.9.1',
99
'oauth2client==1.4.12',
1010
'progressbar2==2.7.3',

0 commit comments

Comments
 (0)