def eeschema_export_bom(output_directory): wait_for_window('eeschema', '\[') logger.info('Focus main eeschema window') xdotool(['search', '--name', '\[', 'windowfocus']) logger.info('Open Tools->Generate Bill Of Materials') xdotool(['key', 'alt+t']) xdotool(['key', 'm']) logger.info('Run generate') wait_for_window('plot', 'Bill of Material') xdotool(['search', '--name', 'Bill of Material', 'windowfocus']) xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(2)
def eeschema_export_bom(output_directory): wait_for_window('eeschema', '\[') logger.info('Focus main eeschema window') xdotool(['search', '--name', '\[', 'windowfocus']) logger.info('Open Tools->Generate Bill Of Materials') xdotool(['key', 'alt+t']) xdotool(['key', 'm']) logger.info('Run generate') wait_for_window('plot', 'Bill of Material') xdotool(['search', '--name', 'Bill of Material', 'windowfocus']) xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(2)
def eeschema_export_bom(output_directory): wait_for_window("eeschema", "\[") logger.info("Focus main eeschema window") xdotool(["search", "--name", "\[", "windowfocus"]) logger.info("Open Tools->Generate Bill Of Materials") xdotool(["key", "alt+t"]) xdotool(["key", "m"]) logger.info("Run generate") wait_for_window("plot", "Bill of Material") xdotool(["search", "--name", "Bill of Material", "windowfocus"]) xdotool(["key", "Return"]) logger.info("Wait before shutdown") time.sleep(2)
def eeschema_export_bom(output_directory, wait_init): # Give enough time to load the libraries time.sleep(float(wait_init)) logger.info('Open Tools->Generate Bill Of Materials') xdotool(['key', 'alt+t']) xdotool(['key', 'm']) logger.info('Run generate') wait_for_window('plot', 'Bill of Material') xdotool(['search', '--name', 'Bill of Material', 'windowfocus']) xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(5)
def pcbnew_cleanup(footprints, wait_init): """Send keystrokes for cleaning the pcb Keyword arguments: footprints -- the list of footprints """ # Give enough time to load the libraries # This should be a parameter time.sleep(float(wait_init)) logger.info('Open Edit -> Cleanup tracks and vias') xdotool(['key', 'alt+e']) xdotool(['key', 'c']) xdotool(['key', 'c']) xdotool(['key', 'c']) xdotool(['key', 'Return']) wait_for_window('cleanup', 'Cleaning Options') logger.info('Go!') xdotool(['key', 'Return']) logger.info('Wait to fill') time.sleep(5) xdotool(['key', 'b']) logger.info('Wait to save') time.sleep(4) logger.info('Save board') xdotool(['key', 'alt+f']) xdotool(['key', 's']) logger.info('Wait before shutdown') time.sleep(5)
def eeschema_plot_schematic(output_name, wait_init): """Send keystrokes for printing schematic Keyword arguments: output_name -- The output pdf file name """ # Give enough time to load the libraries time.sleep(float(wait_init)) logger.info('Open File->Print') xdotool(['key', 'alt+f']) xdotool(['key', 'p']) wait_for_window('print', 'Print') logger.info('Set color output') xdotool(['key', 'alt+b']) logger.info('Open Print dialog') xdotool(['key', 'Tab']) xdotool(['key', 'Tab']) xdotool(['key', 'Tab']) xdotool(['key', 'Return']) logger.info('Enter build output directory') xdotool(['key', 'Tab']) xdotool(['key', 'alt+n']) xdotool(['type', output_name]) wait_for_window('print', 'Print') logger.info('Print!') xdotool(['key', 'alt+p']) logger.info('Wait before shutdown') time.sleep(10)
def eeschema_plot_schematic(output_directory): wait_for_window('eeschema', '\[') logger.info('Focus main eeschema window') xdotool(['search', '--name', '\[', 'windowfocus']) logger.info('Open File->Plot->Plot') xdotool(['key', 'alt+f']) xdotool(['key', 'p']) xdotool(['key', 'p']) wait_for_window('plot', 'Plot') xdotool(['search', '--name', 'Plot', 'windowfocus']) logger.info('Enter build output directory') xdotool(['type', output_directory]) logger.info('Select PDF plot format') xdotool([ 'key', 'Tab', 'Tab', 'Tab', 'Tab', 'Tab', 'Up', 'Up', 'Up', 'space', ]) logger.info('Plot') xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(2)
def eeschema_plot_schematic(output_directory): wait_for_window('eeschema', '\[') logger.info('Focus main eeschema window') xdotool(['search', '--name', '\[', 'windowfocus']) logger.info('Open File->Plot->Plot') xdotool(['key', 'alt+f']) xdotool(['key', 'p']) xdotool(['key', 'p']) wait_for_window('plot', 'Plot') xdotool(['search', '--name', 'Plot', 'windowfocus']) logger.info('Enter build output directory') xdotool(['type', output_directory]) logger.info('Select PDF plot format') xdotool([ 'key', 'Tab', 'Tab', 'Tab', 'Tab', 'Tab', 'Up', 'Up', 'Up', 'space', ]) logger.info('Plot') xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(2)
def eeschema_plot_schematic(output_directory, kicad_4): wait_for_window('eeschema', '\[', additional_commands=['windowfocus']) logger.info('Open File->Plot->Plot') xdotool(['key', 'alt+f']) if kicad_4: xdotool(['key', 'p']) xdotool(['key', 'p']) else: xdotool(['key', 'l']) wait_for_window('plot', 'Plot', additional_commands=['windowfocus']) time.sleep(2) if not kicad_4: # Move/resize window to standard position and click into the text box xdotool(['search', '--name', 'Plot', 'windowmove', '0', '0']) xdotool(['search', '--name', 'Plot', 'windowsize', str(WIDTH), str(HEIGHT)]) time.sleep(2) xdotool(['mousemove', '400', '20', 'click', '1']) logger.info('Enter build output directory') xdotool(['key', 'BackSpace', 'BackSpace']) xdotool(['type', output_directory]) time.sleep(2) if kicad_4: logger.info('Select PDF plot format') xdotool([ 'key', 'Tab', 'Tab', 'Tab', 'Tab', 'Tab', 'Up', 'Up', 'Up', 'space', ]) time.sleep(2) logger.info('Plot') xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(5)
def _pcbnew_export_3d(output_file): if os.path.exists(output_file): os.remove(output_file) wait_for_window('pcbnew', 'Pcbnew ', additional_commands=['windowfocus']) time.sleep(1) logger.info('Open 3d viewer') xdotool(['key', 'alt+3']) wait_for_window('3D Viewer', '3D Viewer', additional_commands=['windowfocus']) time.sleep(3) # Maximize window xdotool(['search', '--name', '3D Viewer', 'windowmove', '0', '0']) xdotool([ 'search', '--name', '3D Viewer', 'windowsize', str(WIDTH), str(HEIGHT) ]) time.sleep(3) logger.info('Zoom in') for i in range(6): xdotool([ 'click', '4', ]) time.sleep(0.2) logger.info('Move right') xdotool([ 'key', 'alt+v', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Return', ]) time.sleep(2) for i in range(2): logger.info('Rotate X Clockwise') xdotool([ 'key', 'alt+v', 'Down', 'Down', 'Down', 'Down', 'Return', ]) time.sleep(2) for i in range(2): logger.info('Rotate Y counter-clockwise') xdotool([ 'key', 'alt+v', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Return', ]) time.sleep(2) logger.info('Rotate Z counter-clockwise') xdotool([ 'key', 'alt+v', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Down', 'Return', ]) time.sleep(2) logger.info('Wait for rendering...') _wait_for_pcbnew_idle() time.sleep(5) logger.info('Export current view') xdotool([ 'key', 'alt+f', 'Return', ]) logger.info('Enter build output filename') xdotool([ 'key', 'ctrl+a', ]) xdotool(['type', output_file]) logger.info('Save') xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(2)
def _pcbnew_export_3d(output_file, width, height, transforms): if os.path.exists(output_file): os.remove(output_file) wait_for_window('pcbnew', 'Pcbnew ', additional_commands=['windowfocus']) time.sleep(1) logger.info('Open 3d viewer') xdotool(['key', 'alt+3']) wait_for_window('3D Viewer', '3D Viewer', additional_commands=['windowfocus']) time.sleep(3) # Maximize window xdotool(['search', '--name', '3D Viewer', 'windowmove', '0', '0']) xdotool([ 'search', '--name', '3D Viewer', 'windowsize', str(width), str(height) ]) time.sleep(3) for transform in transforms: description, func = _transforms[transform] logger.info(description) func() logger.info('Wait for rendering...') _wait_for_pcbnew_idle() time.sleep(5) logger.info('Export current view') xdotool([ 'key', 'alt+f', 'Return', ]) logger.info('Enter build output filename') xdotool([ 'key', 'ctrl+a', ]) xdotool(['type', output_file]) logger.info('Save') xdotool(['key', 'Return']) logger.info('Wait before shutdown') time.sleep(2)
def _invoke_view_option(index): command = ['key', 'alt+v'] + ['Down'] * index + ['Return'] xdotool(command) time.sleep(2)
def _zoom_in(): xdotool([ 'click', '4', ]) time.sleep(0.2)