BetaRavener / uPyLoader

File transfer and communication tool for MicroPython boards
MIT License
354 stars 77 forks source link

Merge of AutoTransfer + FileListImprovement #20

Closed jdeltoft closed 7 years ago

jdeltoft commented 7 years ago

This is my resolution of the merge conflicts between my #11 and #19 pull requests. Autotransfer and FileListImprovement branches. I apologize that they got mixed together a bit but the area of code was very dependent on both changes.

The changes here are working well for me, but I must say I don't think the processEvents() and repaint() calls are perfectly understood. I would expect at the end of this update to compile_files() that the remoteNameEdit.setText() would have filled out the edit field with the mpy file name. It does fill it in, but then get's over-ridden by something.

The good news though in my testing is that everything seems to work now. File timestamps update when I compile. I put in an error if you try to compile a .mpy file, and the auto transfers work if you're connected to a device.

BetaRavener commented 7 years ago

Hi, I've just returned from my trip so I will test it out later in the evening. Should everything be ok, I'll merge it to master branch.

BetaRavener commented 7 years ago

Unfortunately, it's not working well for me. First, the selection of compiled files does not work at all and as a result, nothing is selected. I have tracked this and it's caused by QApplication.processEvents(). If it's not called, then selection is fine, but timestamp doesn't update.

Also there seems to be some bug in displaying selection after the repaint or update event has been called on the TreeView (those rows with gap in highlight shouldn't be highlighted at all and when you move mouse over them, the highlight disappears). image

This TreeView is terrible widget. I wonder if there might be a better solution, maybe a library or something that works properly.

jdeltoft commented 7 years ago

Let me check your refactoring. Sorry!! I should have mentioned that I saw some of this in my same testing. I thought having the mpy not selected after an auto transfer wouldn't be a big deal since having it selected doesn't serve much purpose anyway. It only does the re-selection if you're doing a single py file compile anyway.

In my testing I tried selecting about 10 py files, and clicked compile. It created the 10 mpy files just fine, with updated timestamps, and in the right order (based on my sorting change earlier with "type" selected) and it didn't do that weird partial highlighting you're showing. Strange, I'll have to see if I can find out how to break it like that.

I've bought a book on pyqt recently, so I'll see if I can work out a better way to update the timestamp. Let me merge your changes and test where things are at, as well as review for you. Let me know if you want me to try anything specific.

jdeltoft commented 7 years ago

Posted this question on QT Centre Forum. It's just driving me nuts that QFileSystemWatcher has no way to update if the timestamps change.

http://www.qtcentre.org/threads/68458-QFileSystemWatcher-and-getting-updated-timestamps?p=299649#post299649

I tested out what you have refactored here, and it worked great for single and multiple files. I think you probably go ahead and push it to the mainline personally. Nice work!

jdeltoft commented 7 years ago

Ooops, I noticed that the merge here includes a hard coded path in the main.spec file. Did you update that for your own path?

pathex=['C:\Users\celtofj\My Documents\github\uPyLoader

jdeltoft commented 7 years ago

So at this point, let me know if there is anything more you would like me to work on. Otherwise, I think with your refactoring here it's running on my local merged branch quite well and I think you probably can take it from here?

BetaRavener commented 7 years ago

Ok I'll merge it to master. If we manage to find solution on the timestamps, it can be added later.

jdeltoft commented 7 years ago

Cool!

BetaRavener commented 7 years ago

Just by sheer luck I have actually managed to get that timestamps working! Heh. And I was just fixing a bug with the auto-transfer checkbox that also disappeared during GUI rebuild. I had to make another hack so that sorting would work, but now it seems to be ok. I'm going to create another release because the last one could cause crashes on compilation.

jdeltoft commented 7 years ago

I was using the first release last night without issue, but sounds like some good fixups. Will download and use this 0.1.1 build now. That's great that you fixed the timestamps too, it just always bugged me for some reason. LOL I'll check out your changes.