Code Monkey home page Code Monkey logo

kom2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kom2's Issues

Implement correct behaviour for handles

Freeing handles should only be possible when all other "child" handles have been freed. This would mean tracking the relationship between handles, which isn't happening at the moment:

This is more of a nice to have, since I doubt KiCad would be trying to release handles out of order

Crashes on MacOS when using PK as reference

When using pk as key the pk is not rendered:
grafik
When using IPN as key the IPN is rendered as name. The part can be added in that case. Note: Only one part has an IPN set
grafik

Once I click on an item without a label KiCad goes away.

Version KiCad:

Application: KiCad Schematic Editor arm64 on arm64
Version: 7.0.5-0, release build
Libraries:
    wxWidgets 3.2.2
    FreeType 2.12.1
    HarfBuzz 5.3.1
    FontConfig 2.14.0
    libcurl/7.88.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0
Platform: macOS Ventura Version 13.4 (Build 22F66), 64 bit, Little endian, wxMac
Build Info:
    Date: May 26 2023 08:14:40
    wxWidgets: 3.2.2 (wchar_t,wx containers)
    Boost: 1.80.0
    OCC: 7.6.3
    Curl: 7.77.0
    ngspice: 38
    Compiler: Clang 13.0.0 with C++ ABI 1002
Build settings:
    KICAD_SPICE=ON

Version kom2:

[release-20230522](https://github.com/clj/kom2/releases/tag/release-20230522)

Suggestion: Config identifier

It would be great if one could define an optional config identifier to the connection string. That could then be passed to the InvenTree API as a header and be used server side to identify which host is using which config. Would be usedfull to detect outdated configs.

Allowed values for the "key" field in the .kicad_dbl file

We need to figure out what we can use to uniquely reference a Part from KiCad. This is needed both for the documentation but also because the driver needs to know what "columns" to offer up as unique to KiCad (since it enumerates the tables on startup).

The KiCad documentation states about the contents of the .kicad_dbl file:

key: The column name containing a unique key that will be used to identify parts from the table.

So we need something that always returns the same part for the same value of key. As far as I understand it, the only things I can use from a Part instance in InvenTree that is unique is either:

  • pk; or
  • a combination of name, IPN, and revision (see: the InvenTree Part model); or
  • maybe the IPN, there is the potential for them to be mostly unique, but this isn't a DB level constraint so it is possible that duplicate IPNs exist in the DB. In this case we would need to make sure that we always return the same part to KiCad if there happens to be multiple parts with the same IPN. The IPN field can also be empty, see: #5.

In the InvenTree documentation the description of the name for a part says:

Name - The Part name is a simple (unique) text label

But unless combined with IPN and revision that doesn't seem to be the case.


What KiCad displays the "item" column is a combination of the library name and the value of each item's key as defined in the .kicad_dbl file. This means that using the pk (i.e. the Primary Key of a Part instance) yields names that aren't very "nice" (image from: #2 (comment)):

256113541-83c62cbf-1c26-40e9-9737-0c29ff3c36dc

IPN is perhaps a bit nicer, at least how I use it. But I fear that the combination of name, IPN and revision might be a bit long. Although this would depend on what users have in the name column for their Parts.

Windows Support

Would love to see Windows support, and happy to provide time / code to implement.

@clj any pointers where to start? I have zero experience with Go or ODBC ;)

Filtering rows without an IPN

See issue #3 for an example of how rows with an empty IPN are shown in KiCad, but does not produce useful behaviour and sometimes (but not always) causes KiCad to crash.

I am not sure what the best way to deal with this is. The problem is that the driver is implemented so that filtering can be done either using:

  • pk; or
  • IPN

When the initial SELECT * FROM "category" is issued, the driver doesn't know which is being used. This means if the driver always filters out rows without an IPN then the driver becomes unusable for people who set the key to pk, since if they don't use IPNs at all, then all the rows will get filtered. As an example, the InvenTree demo server does not always have IPNs attached to parts.

How to solve:

  • have an option that can be specified in the connection string to filter out empty IPNs
    • should that be the default?

Interesting Crash

I saw an interesting crash the first time I loaded the data. The following request was made to the API, and then KiCad crashed:

image

  1. Perhaps there is some integer bug in your code, requesting the wrong ID?
  2. Does your interface handle a 400 response (or any non-200 response) from the server?

Originally posted by @SchrodingersGat in #2 (comment)

Order parts queries

Probably by the part primary key. This would primarily be to make parts with duplicate IPN behave deterministically. E.g. if we say that if there are more than one part with the same IPN, and the first one is the one that we return to KiCad, then ordering by PK would ensure that this part is always the same.

?ordering=pk should achieve that.

Suggestion: API Token

@clj if you are not already, I suggest that you use an API token to perform requests. It is significantly faster than username/password auth.

If you are already doing this, please ignore and close out this issue :)

Crash with invalid credentials

I have discovered one source of crash:

If your .kicad_dbl configuration file has invalid InvenTree credentials, KiCad simply crashes without warning.

This is repeatable, and there is no "error message" or anything, simply a hard crash out of the KiCad application

Strange ID values

When loading parts based on "pk" values, sometimes the displayed values are very odd:

image

Here the values seem to have a hex offset applied, e.g. 2787433775112 = 0x28900000008 and corresponds to Part ID 8.

This looks like it might be associated with a 64-bit integer value somewhere?

Option for filtering tables

If possible within the kicad_dbl file format, it would be very handy to be able to add a "filters" attribute to each library entry.

For example, only return parts in the "Resistors" category which have the "KiCadFootprint" parameter defined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.