Jeremy Sanders wrote:

On Tue, 19 Apr 2005, James Graham wrote:

Attached is the patch I mentioned to add a dropdown combo box containing the distance measures. The patch seems to work - doing things like entering "25cm" will correctly parse out the units and update the combobox and lineedit. The major piece of wierdness is that selecting "fraction" in the dropdown with a number > 1 will actually choose "pts" (this is what the code in actually does, but it doesn't seem like great UI).

James - I think I've managed to make a cleaner patch based on your ideas to solve the problem. I'm using a combobox, but its list is populated according to the number currently entered. e.g., if "15cm" is in the box, the options are 15pt, 15mm, 15cm, 15in, 15%, 1/15. (maybe it should do _real_ unit conversions :-)

Do you think this is as good as your solution?

It's certianly cleaner in terms of the appearance (i.e. it doesn't make
the screen so cluttered) and it seems to work reasonably well, but there
are a few problems. Ideally the following things would happen:
Alternative unit names would be converted into their canonical forms
e.g. inches -> in when the combobox lost focus
Numbers > 1 without units would be given the units "pt"
Numbers < 1 without units would be converetd to % i.e 0.15 would be
converted to 15% for display

real unit conversions would also be nice :)

Apologies for messing around with what you did.

Don't apologise, that's the idea :)

"But if science you say still sounds too deep,
Just do what Beaker does, just shrug and 'Meep!'"

-- Dr. Bunsen Honeydew & Beaker of Muppet Labs

Répondre à