Re: [casetta] About compatibility between casio models |
[ Thread Index | Date Index | More lists.tuxfamily.org/casetta Archives ]
Fabien ANDRE a écrit :
Errr... What I think about that ? First and foremost I am impressed by this system :-DWhat do you think about it?Seriously, I think that the model you propose for casetta is the best... for users ! But it may be the worst for developers as it seems quite complicated to implement :-p
And because we are free software developers, we'll choose the best for users :)
About the implementation, I have the beginning of an idea. It would use the new object models of cas.py. /I think each get_raw_data_list method (which is called before any transfer) could call another method named is_valid which would take the model of calculator in argument and raise errors. For example for a program :class TransferableProgram(datacls.Program): .... def is_valid(self, calculator_model): if calculator_model != "G100" and len(self.name): raise TooLongNameError if calculator_model == "G25": for line in self.get_text(): raise class TransferableList(datacls.List): .... def is_valid(self, calculator_model): if calculator_model == "G25": raise ListNotAvailableAn then casetta_cli and gasetta could provide fixes using try: except blocks. Or maybe we should directly include a method to do the various fixes inside the objects. This implementation has advantages : quite easy to implement, ability to make completely different tests for any data_type and drawbacks : the method is_valid may be enormous for some data_types such as programs, it is not really "clean" as the compatibility test suite is not located is a specific module, and we cannot distinguish fatal, major errors and warnings. For warnings maybe just a return -1, "Your picture uses colors, I may not be displayed correctly." is enough.
This is a good idea, but raising exceptions has a problem : is a data has more than one problem, only the first found will reported... I think it could be better to have a strict separation between transfers and compatibility check: the casetta python package provides both, and it's the interface choice to make a test before a transfer. I think it would be better if the compatibility system return an object like that:
report.has_error #return if we can transfer the file or not report.has_warning #return if we should display some warnings for data in my_file: report[data].has_error #return if this data has raised an error report[data].has_warning #return if the data has raised a warning for error in report[data].errors: error.summary #informations about the error error.can_be_fixed #return if the error can be fixed error.is_warning #return if the error is a warning error.fix() #return the data fixed This object should be generated by a module which take: * For each data, some test functions * For each casio models, some rules to use with previous functionsIt's a detail, but an error.summary property will said that we introduce some end-user text to translate in casetta (for the moment, all end-user messages are in interfaces). Maybe we can make instead an error.id property, with constants for each id, and interfaces will use their messages for each id...
About backups, I think they should use the Fx-Interface model, they should be calculator dependent, although it may be possible to transfer a backup of a G35 to a G65. However, we will have huge problems !
The Fx-Interface is to make manage backup in another way than all other data. We could simply use a rule to check is the model match the backup (it's easy, we know where the model is stored in a backup), isn't it ?
About the particularities, you are right it is the first thing we should do. Listing the particularities may help us to find a good implementation.Where should we publish this information on the wiki ?
Here : http://casetta.tuxfamily.org/formats/modelsI'll make the firsts tickets about the compatibility system in http://dev.filyb.info/casetta/
Cheers, -- Thesa ~ Florian Birée e-mail : florian@xxxxxxxxxx Messagerie Instantanée Jabber/XMPP/Google Talk : florian.biree@xxxxxxxxx Site web : http://florian.biree.name/ Carnet web : http://filyb.info/
begin:vcard fn;quoted-printable:Florian Bir=C3=A9e n;quoted-printable:Bir=C3=A9e;Florian org;quoted-printable:Universit=C3=A9 Toulouse III : Paul Sabatier;Licence STS adr:;;118, route de Narbonne;Toulouse Cedex 9;;31062;France email;internet:florian@xxxxxxxxxx title;quoted-printable:=C3=89tudiant tel;fax:0959465803 tel;home:0954465803 x-mozilla-html:FALSE url:http://florian.biree.name/ version:2.1 end:vcard
Attachment:
signature.asc
Description: OpenPGP digital signature
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |