Skip to content

Commit

Permalink
[Added] Support for KiCad 7.0.8 ERC details
Browse files Browse the repository at this point in the history
  • Loading branch information
set-soft committed Oct 12, 2023
1 parent 4f6859c commit 0cf5df6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] -
### Added
- Support for KiCad 7.0.8
- New options widgets in the ERC dialog (skipped when no interposer)
- New behavior when schematic already opened
- Experimental option to enable the file creation by PID when using the
interposer. Use KIAUTO_USE_PID_FOR_CREATE=1 environment variable

Expand Down
1 change: 1 addition & 0 deletions kiauto/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
KICAD_VERSION_6_99 = 6099000
KICAD_VERSION_7_99 = 7099000
KICAD_VERSION_7_0_3 = 7000003
KICAD_VERSION_7_0_8 = 7000008
KICAD_SHARE = '/usr/share/kicad/'
KICAD_NIGHTLY_SHARE = '/usr/share/kicad-nightly/'
RULES_KEY = 'Ctrl+Shift+A'
Expand Down
20 changes: 18 additions & 2 deletions src/eeschema_do
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ from kiauto.file_util import (load_filters, wait_for_file_created_by_process, ap
from kiauto.misc import (REC_W, REC_H, __version__, NO_SCHEMATIC, EESCHEMA_CFG_PRESENT, KICAD_CFG_PRESENT, RULES_KEY,
WAIT_START, WRONG_SCH_NAME, EESCHEMA_ERROR, Config, KICAD_VERSION_5_99, WONT_OVERWRITE,
USER_HOTKEYS_PRESENT, __copyright__, __license__, TIME_OUT_MULT, get_en_locale, KICAD_CLI_ERROR,
KICAD_VERSION_7_0_3)
KICAD_VERSION_7_0_3, KICAD_VERSION_7_0_8)
from kiauto.interposer import (check_interposer, dump_interposer_dialog, start_queue, wait_start_by_msg,
set_kicad_process, open_dialog_i, wait_kicad_ready_i,
paste_output_file_i, exit_kicad_i, paste_text_i, wait_queue,
Expand All @@ -59,6 +59,8 @@ TITLE_CONFIRMATION = '^Confirmation$'
TITLE_REMAP_SYMBOLS = '^Remap Symbols$'
TITLE_ERROR = '^(KiCad Schematic Editor )?Error$'
TITLE_WARNING = '^Warning$'
# KiCad 7.0.8 for already open (not reliable)
TITLE_FILE_OPEN_WARNING = '^File Open Warning$'
KI6_LOADING = r'^\[no schematic loaded\] '


Expand Down Expand Up @@ -140,6 +142,15 @@ def dismiss_already_running():
time.sleep(5)


def dismiss_already_opened():
nf_title = TITLE_FILE_OPEN_WARNING
wait_for_window(nf_title, nf_title, 1)
logger.info('Dismiss file already opened')
xdotool(['search', '--onlyvisible', '--name', nf_title, 'windowfocus'])
logger.debug('Found, sending Return')
xdotool(['key', 'Left', 'Return'])


def wait_eeschema(cfg, time, others=None):
return wait_for_window('Main eeschema window', cfg.ee_window_title, time, others=others, popen_obj=cfg.popen_obj)

Expand All @@ -153,7 +164,7 @@ def wait_eeschema_start(cfg):
other = None
try:
wait_eeschema(cfg, wait_start, others=[TITLE_CONFIRMATION, TITLE_REMAP_SYMBOLS, TITLE_ERROR, TITLE_WARNING,
KI6_LOADING])
TITLE_FILE_OPEN_WARNING, KI6_LOADING])
except RuntimeError: # pragma: no cover
logger.debug('Time-out waiting for eeschema, will retry')
failed_focuse = True
Expand All @@ -176,6 +187,8 @@ def wait_eeschema_start(cfg):
return False
elif other == TITLE_CONFIRMATION:
dismiss_already_running()
elif other == TITLE_FILE_OPEN_WARNING:
dismiss_already_opened()
elif other == TITLE_WARNING:
dismiss_warning()
# This is crazy, if we miss a lib we get an "Error", pressing ESC solves it
Expand Down Expand Up @@ -445,6 +458,9 @@ def eeschema_run_erc_schematic_6_0_n(cfg):
logger.info('Open the save dialog')
wait_point(cfg)
keys_save = ['key', 'Tab', 'Tab', 'Tab', 'Tab', 'Tab', 'Tab', 'Tab', 'Tab', 'Return']
if cfg.kicad_version >= KICAD_VERSION_7_0_8:
keys_save.extend(['Tab', 'Tab'])
keys_save.append('Return')
xdotool(keys_save)
# Wait for the save dialog
try_again = False
Expand Down

0 comments on commit 0cf5df6

Please sign in to comment.