[casetta] Ideas for version 0.4 of casetta /GPLv3 |
[ Thread Index | Date Index | More lists.tuxfamily.org/casetta Archives ]
Hello, About casetta website, I would like to mention that the link to the web svn repository is broken : The link on this page (http://casetta.tuxfamily.org/download) points to : http://svnweb.tuxfamily.org/listing.php?repname=casetta+%28casetta%29&path=%2F&sc=0 The good link seems to be : http://svnweb.tuxfamily.org/listing.php?repname=casetta/casetta&path=%2F&sc=0 (Tuxfamily svn repository was reorganized ?) I have some ideas/proposals for casetta 0.4 (I insist on this point, they are just ideas :-) : - Reorganize the transfer tool (devices_serial.py), casio link management module (cas.py) and the data manager (data.py)... Because today, if you want to implement support for a new format in receive only, you need to modify a lot of functions: - receive_data in devices_serial (#Make the data line and next) - If you receive a picture, a matrix, a list, several variables... You need to add some conditions in this function - almost all functions in cas.py Cas.py The architecture of cas.py is not very clear. You have a lot a function and in almost each function, you have a lot of if data.__class__ == "xxx". This has several drawbacks : Increased risk of error, unclear functioning and this shows that an object-oriented approach should be used. What I propose to do : Create classes in cas.py, which derives from classes of data.py and add methods to these classes which have the same usefulness as the current functions. For example, for programs we could have (in cas.py) : See cas-exple.py in attachements. Of course, same thing have to be done for all classes of data.py. Using this new """architecture""", when implementing a new raw format, you just need to modify one class... Maybe, it would be good to also create a generic TransferableData class. The only function which cannot be transformed into a method is : det_data_format. But I don't like the way it works. Why does it return a string : header_type rather than directly an object (Which is created after in receive data of devices_serial.py ?)) See cas-exple.py in Attachements Devices_serial.py Keep cool ! For this file I don't want to change everything like the previous :-D I would like to change some part of the file : In send_data() function : raw_data_list = [data.raw_data[0:1028], data.raw_data[1028:2056], data.raw_data[2056:3084], data.raw_data[3084:4112]] elif data.__class__ == datacls.Matrix or data.__class__ == datacls.List or data.__class__ == datacls.SimlEquationMatrix or data.__class__ == datacls.PolyEquationMatrix: raw_data_list = data.get_raw_data_list() else: raw_data_list = [data.raw_data] I would like to replace this by : raw_data_list = data.get_raw_data_list(). This means each Transferable object in cas.py, should have a method who returns a list of data to be transferred even if this list contains only one element In receive_data() function : ## List/Matrix management specific block if ( data_type == 'list' or data_type == 'matrix' or data_type == 'simlequation-matrix' or data_type == 'polyequation-matrix' ) and (index-13)%14==0 and index <= data_len-14: # Checksum test calc_crc=self.get_byte() filereceived.write(calc_crc) if abs(255 - (crc % 256)) + 1 == ord(calc_crc): self.send_byte('\x06') crc=0 resp=self.get_byte() filereceived.write(resp) if resp != '\x3a': raise errors.BadAnswerFromCalc(resp) else: raise errors.ChecksumError() ## Screencapture management specific block if data_type == 'screencapture' and sub_type == 'color' \ and (index == 1024 or index == 2048): resp2 = self.get_byte() self.send_byte('\x06') resp2 = self.get_byte() crc = 0 ## Picture management specific block if data_type == 'picture' and (index + 1) % 1028 == 0 \ and index != 0 and index + 1 < data_len: # IMAGE / color screencapture newcrc = ord(self.get_byte()) crc = abs(255 - (crc % 256)) + 1 if not newcrc == crc : raise errors.ChecksumError() crc = 0 self.send_byte('\x06') resp2 = self.get_byte() if not resp2 == '\x3a': raise errors.BadAnswerFromCalc(resp2) #if data_type == 1 and bytesproc + 1 == 62684: # print 'byte 62684 of a backup : send 0x06' # send_byte('\x06') raw_data += byte I think each Transferable object should have a method return the indexes where the transmission needs to be stopped but I am not sure of how to do that. "Talk is cheap. Show me the code" Data.py The worst is before you. I don't want to change anything in this file. ;-) Just add some things ! Maybe we should create a generic FileObject management class which could manage File List, Variable Files, Y=Data Files and son. I am very interested in getting your opinion about these proposals. My other proposals (I am pretty sure you will agree with them) for casetta 0.4 are : - Full support ? For Graph65 - Picture Extractor from backups (I have one, which uses the white sheet to detect a picture in a backup because color bytes and son are not stored in backups). It is not so bad.. - List/Matrix extractors from backup - Better img_to_basic function That's all ! Yours, --
Fabien ANDRE aka Xion345 Linux User #418689 -- fabien.andre.g@xxxxxxxxxx -- xion345@xxxxxxxxxxxxx Les cons peuvent être vaincus mais ils n'admettent jamais l'être. ( Richard Stallman, Not dated ) |
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |