@@ -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." )
0 commit comments