MitjaNemec / Kicad_action_plugins

Kicad action plugins
413 stars 62 forks source link

5.99: remove .strip() from UUID to preserve leading zeros #133

Closed ottojo closed 2 years ago

ottojo commented 3 years ago

searching for hierarchical sheet filenames fails if the UUID contains a leading zero, which is stripped in self.dict_of_sheets, and not in other places like here

this removes this, which should not be necessary anyways, as far as i can tell the UUIDs are always taken from the schematic file, and can probably be assumed to be of consistent format/string-representation.

MitjaNemec commented 3 years ago

Yeah, the strip is a remainder from when I migrated the plugin to 5.99. when opening 5.1 projects in 5.99 timestamp gets replaced with UUID, with all leading zeros. And IIRC first 5.99 project with early 5.99 versions also had UUID in format only but content was still timestap with leading zeros. Thus stripping the leading zeros was a quick fix solution for plugin to work in 5.99. Obviously I've introduced at leas one bug doing this.

This is/was required as I parse schematics file, which can contain timestamps, and matching it against layout UUID.

I'll have to take a look at the edge cases (5.1 import to 5.99) before I either merge this or I strip the zeroes everywhere. It might take some time as it is summer here.

MitjaNemec commented 3 years ago

Thanks for the feedback, it is much appreciated

MitjaNemec commented 2 years ago

Thanks for the your contribution, but I've managed to forget about your pull request and then solve this issue when solving #137.

The .strip('00000000-0000-0000-0000-0000') managed to strip also only one or more leading/trailing zeros in UUID. I should have used .replace('00000000-0000-0000-0000-0000', '') instead and read how standard python methods work more thoroughly and not assume from the name.

Anyhow your PR is not needed anymore, so I am closing it.

As this is my firs time closing the PR without merging, I am not sure what is the etiquette. Obviously your PR made me think about this when tackling with #137, but no you don't get to contribute to the code base (looking at the git log). I do hope that you are not offended by this. You did contribute to the plugin, it is just that your contribution can only be seen by looking at this discussion.

But given my python coding skills, I am certain there are and will bi more bugs like this one.

ottojo commented 2 years ago

No problem whatsoever, i'm happy the issue is fixed!