Hobby-hacking Eric

2006-01-29

radical departure for wxDarcs

This morning before getting up, I had the sudden thought that I was aiming for something truly pointless in the previous incarnations of wxDarcs. The story goes that wxDarcs was supposed to provide you a change-oriented view your repository instead of a task-oriented one. That is, instead of deciding "I want to do darcs send" and then choosing your patches, you first select your patches and then tell the gui "I want to send these guys".

I realised that there a few headaches that I did not really want to deal with, and the task of building a darcs gui was getting more and more complicated as the days went on. All sorts of stuff I hadn't thought of, like for instance, when you do a darcs send, the only patches the console interface shows you are the ones that don't already exist in the remote repository. You don't get that with the change-oriented view. And also, the business of splitting the commands up so that they are only available in the right contexts would be really annoying to deal with: for example, at first, I only had the Revert in the 'Changes tab, and the Record option in the Whatsnew tab. But that's annoying, because you have to think to go to the Changes tab in order to get a Revert button. What if your brain is hardwired in task-oriented mode? What if you're saying to yourself, ok, I want to send in my changes? You shouldn't have to think, "oh, I need to go look at the changes tab first".

So the original goal was to resurrect the wxhaskell code, and I'm now going to aim more towards that direction. Well... in fact, that's already been long done and that patches are waiting acceptance. My new direction is to make more use of the original wxhaskell code. For instance, when you click on the Record button, all my gui code does is execute the record command, which launches its very own GUI. None of this select-your-patch-and-then-your-operation nonsense.

Here is what it looks like now. It's the same story: you first start out with an empty repository viewer:


When you click open, you get the stardard directory-choosing dialogue from your operating system. You choose darcs repo, what you get is this interface. Notice that I now use the tree widget I had for Whatsnew:


I think this is a clear improvement. Simpler code, simpler user interface, much more down to earth and direct. No more silly tabs. And now, if you click on the Record button, you get the original David Roundy (I assume) gui for Record, this being a result of me giving up on the change-oriented approach to darcs. Oh, and another thing I managed to implement is this business of the --gui flag. Now, there is no distinct wxDarcs main module. If you call darcs with just the --gui flag, or if you call the program as wxDarcs (i stuck a cp darcs wxDarcs in the Makefile), you get the wxDarcs standalone interface.

But here's a major piece of bad news. A huge blocker, and clear evidence that I don't actually know crap about haskell or programming or computers. When I tried to link my buttons to commands is that the commands refuse to relinquish their locks when you close the guis which are associated to them. This means, for example, that you can't Record some stuff, and then Send it, because darcs is always stuck with a lock from Record. It doesn't matter whether you close the window by cancelling or recording, it simply does not come back. Plus, when you close all the windows of wxDarcs, you get a bus error. Yipee.

Totally stumped here. It's as if we never make it out of the function for the inner gui, even when we close the window. The whole record command is wrapped with a withRepoLock, and for some reason, you never get to the closing end of that bracket. Yet you do when you're calling the record gui from the command line. So confused.


No comments:

Blog Archive