def Export( self ): width = self._width.value() directory = self._directory_picker.GetPath() last_png_export_dir = directory if last_png_export_dir is not None and last_png_export_dir != '': HG.client_controller.new_options.SetNoneableString( 'last_png_export_dir', last_png_export_dir ) for obj in self._payload_objs: ( payload_description, payload_bytes ) = ClientSerialisable.GetPayloadDescriptionAndBytes( obj ) title = obj.GetName() text = '' path = os.path.join( directory, title ) if not path.endswith( '.png' ): path += '.png' ClientSerialisable.DumpToPng( width, payload_bytes, title, payload_description, text, path ) self._export.setText( 'done!' ) HG.client_controller.CallLaterQtSafe(self._export, 2.0, self._export.setText, 'export')
def Export( self ): width = self._width.value() payload_description = self._payload_description.text() payload_bytes = ClientSerialisable.GetPayloadBytes( self._payload_obj ) title = self._title.text() text = self._text.text() path = self._filepicker.GetPath() if path is not None and path != '': base_dir = os.path.dirname( path ) HG.client_controller.new_options.SetNoneableString( 'last_png_export_dir', base_dir ) if not path.endswith( '.png' ): path += '.png' ClientSerialisable.DumpToPng( width, payload_bytes, title, payload_description, text, path ) self._export.setText( 'done!' ) HG.client_controller.CallLaterQtSafe(self._export, 2.0, self._export.setText, 'export')