Code Monkey home page Code Monkey logo

Comments (4)

davidfor avatar davidfor commented on May 25, 2024

I have to say woops. I tested the change with the extended driver, but I didn't check the main driver. With the suggestion above, the options in the main driver are changed. So, it assignment is a reference rather than a copy. I knew I should have just made the suggestion and left the implementation up to someone else :)

A quick bit of reading. The first two lines should be:

    EXTRA_CUSTOMIZATION_DEFAULT = KOBOTOUCH.EXTRA_CUSTOMIZATION_DEFAULT[:]
    EXTRA_CUSTOMIZATION_MESSAGE = KOBOTOUCH.EXTRA_CUSTOMIZATION_MESSAGE[:]

from calibre-kobo-driver.

jgoguen avatar jgoguen commented on May 25, 2024

My only concern about this is how will the extra options be affected in the future when the main driver adds more options? Let's say right now my settings array with the extended driver looks like this:

[u'',  # OPT_COLLECTIONS
True,  # OPT_CREATE_BOOKSHELVES
True,  # OPT_DELETE_BOOKSHELVES
True,  # OPT_UPLOAD_COVERS
True,  # OPT_UPLOAD_GRAYSCALE_COVERS
True,  # OPT_KEEP_COVER_ASPECT_RATIO
True,  # OPT_SHOW_EXPIRED_BOOK_RECORDS
True,  # OPT_SHOW_PREVIEWS
True,  # OPT_SHOW_RECOMMENDATIONS
True,  # OPT_UPDATE_SERIES_DETAILS
False, # OPT_SUPPORT_NEWER_FIRMWARE
u'',   # OPT_DEBUGGING_TITLE
True,  # OPT_EXTRA_FEATURES -- index 12, KoboTouchExtended options start here
False, # OPT_DELETE_UNMANIFESTED
False, # OPT_UPLOAD_ENCUMBERED
False, # OPT_SKIP_FAILED
True,  # OPT_HYPHENATE
False, # OPT_REPLACE_LANG
True,  # OPT_SMARTEN_PUNCTUATION
True   # OPT_CLEAN_MARKUP
]

So for now, it indicates that I want extra features enabled (index 12) and I do not want to delete files that are not in the manifest (index 13). If a new option gets added to the main driver with the way you suggest (I think) it would have index 12 and OPT_EXTRA_FEATURES would now have index 13 and it would be read as saying that I do not want to enable extra features. New installations would be fine, and this would work fine until new options are added to the main driver. At least I think that's how it would work?

Not that I have any better ideas for how to handle a subclass that requires superclass options not change but a superclass that at the same time must be free to change options :)

from calibre-kobo-driver.

davidfor avatar davidfor commented on May 25, 2024

There is going to be trouble with this no matter what. If an extra option is added to the main driver, then there will be a conflict over what that value means. The main driver will use it for one thing, and the extended for another.

But, there is already a solution. When I added the debug title option, I decided to make it the last option. In fact, I planned to remove it before release,but it was to useful. Since then I have added a couple of extra options. The settings method handles the move to keep the debugging title as the last option. This should work to move any options after it as well. But, I have to admit I haven't tested that.

from calibre-kobo-driver.

jgoguen avatar jgoguen commented on May 25, 2024

Well, it looks OK to me. In theory :)

I see no reason not to go with what you suggested then, and if it does turn out to cause conflicts later I can figure something out then.

from calibre-kobo-driver.

Related Issues (20)

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.