Page 1 of 1

pConvert a Measurements Units converted (Mar 3, 2007)

Posted: Thu 01 Mar 2007, 04:26
by rarsa
I had some time to spare and decided to tackle cleaning up a couple of tcl/tk applicaitions included in Puppy that had a rather old look.

I've completelly rewriten the tkConvert utility to make it fully GTK compatible.

This utility lets you convert from almost any measurement unit to another. It includes around 1,000 conversions.

In the process I managed to reduce 2159 lines of code while adding functionality!!,
(Barry, that's 103K. I'm making good in my promisse to give back the space taken by gnocl) I could still reduce around 400 lines of code and in the process add about another 1,000 available conversions and provide an even cleaner interface and make the code even more readable. But for now I think this is good enough.

Here is the GTK version with an Aqua theme (Click to see full size)
Image

Here is the cleaned up tk version (Click the thumbnail to see the full size image)
Image


Dependencies
The GTK version requires Gnocl. If you have a version of Puppy prior to 2.14 you'll need to get it from here:
http://www.murga-linux.com/puppy/viewtopic.php?t=15639

Re: TkConvert with a cleaned up UI

Posted: Thu 01 Mar 2007, 05:04
by WhoDo
rarsa wrote:I refrained from converting them to gnocl until it is included in the LiveCD so they still have the tk look, just a little bit cleaner.
Just so you know, rarsa, I have added gnocl to both Alpha's of Puppy 2.15CE.

Cheers

Re: TkConvert with a cleaned up UI

Posted: Thu 01 Mar 2007, 14:37
by rarsa
rarsa wrote:I refrained from converting them to gnocl until it is included in the LiveCD so they still have the tk look, just a little bit cleaner.
Clarification: I should have said: "I refrained from converting them directly to gnocl...

I wanted to release something that could be used and included right now. I will for sure convert them to GTK, wether it is gnocl or GINS.

I still cannot comment on GINS because I hadn't had time to play with it.

I've said before for a project like this I believe that ONE standard that is good enough is better than 10 different toolkits that are respectivelly "the best"

Posted: Fri 02 Mar 2007, 01:45
by BarryK
Rarsa,
how much work is involved in converting a Tcl/Tk app from Tk to Gnocl? What about some of the bigger guys, like Ical?

Posted: Fri 02 Mar 2007, 05:22
by rarsa
BarryK wrote:how much work is involved in converting a Tcl/Tk app from Tk to Gnocl? What about some of the bigger guys, like Ical?
The couple I've done haven't been difficult at all, it is very straight forward.

The only problem may be when trying to implement Tk functionality that it is not available in gnocl. Tk is a huge toolkit. Gnocl follows the 80/20 rule providing the 20% Tk functionality that is used 80% of the time. There is a workaround for special functionality though. You can embed a Tk window in a Gnocl window.

Code: Select all

wm state . withdrawn    ; # hide tk main window
set socket [gnocl::socket]
toplevel .embededTk -use [format "0x%x" [$socket getID]]
set trayWindow [gnocl::window -child $socket]
Another example is the remotedesktop client. It took In total effort hours maybe 4 hours for the remotedesktop client, and that was while learning Gnocl.

Gnocl syntax is more economical than Tk syntax so that helps.

Translating the tkConvert may take me 1/2 hour for the straight conversion. I want to cleanup the code though and that's where the extra time goes.

Posted: Fri 02 Mar 2007, 19:45
by rarsa
BarryK wrote:What about some of the bigger guys, like Ical?
Well, Ical is a compiled application so it would require a full language translation, not only a UI translation.

Do you have any applications in mind for translation. I have my own priority list but it is quite arbitrary.

Posted: Sat 03 Mar 2007, 19:33
by rarsa
pConvert uploaded!

http://www.murga-linux.com/puppy/viewto ... 866#100866

I've completelly rewriten the tkConvert utility to make it fully GTK compatible. I used Gnocl.

In the process I managed to reduce 2159 lines of code while adding functionality !!,

Barry, that's 103K. I'm making good in my promisse to give back the space taken by gnocl.

I could still reduce around 400 lines of code and in the process add about another 1,000 available conversions and provide an even cleaner interface and make the code even more readable. But for now I think this is good enough and going the extra mile would take me at least 8 hours.

Actually the real code is just 230 Lines of code (including spaces)

1000 lines that correspond to the conversions table. Here is where getting creative a lot of redundancy could be cut.

Posted: Tue 26 Jun 2007, 10:26
by disciple
If anybody else ever feels like rewriting it for whatever reason, they may want to think about whether the interface can be improved. Check out the freeware windows convert program at http://joshmadison.com/software/convert/ (there is a screenshot). Personally I find the interface much more efficient.

Posted: Thu 05 Mar 2015, 23:15
by musher0
Hello, all.

This is a voice from the past... This is musher0's great-grandfather talking
to you!!! Yes, to YOU !!!

Joking aside, I was about to create a new thread for modern unit
converters when I found this old one in big-pup's list on Smokey01.com.
So... why not revive it?

A useful program is a useful program is a useful program.

Given that our current gMeasures is limited to temperature conversions...
Have you noticed? The top part of gMeasures does not work. I mean:
nothing works in gMeasures except the temperature conversions...

My dog team and I decided to dog-sleigh a care package to the Puppy
community: :)

please find attached a pet archive of tkConvert -- since no modern Puppy
can unpack a pup archive anymore !

With illustrations as well, of both programs rarsa has presented above.
The only difference between them -- to the user's eye -- is their "coat".

For pConvert, as rarsa mentioned above, you'll need a valid tcl-tk
language installed (tcl-tk is now at version 8.6 or thereabouts) plus the
gnocl gtk-tcl bridge library. A new "pet format" archive of gnocl is now
here.

As far as I can tell, both these little programs outperform gMeasures.

(With apologies to whoever the maintainer of gMeasures now is... But
I'm really tempted to not present any apology...

That current Puppies have no working unit converter application is a real
shame. Another shame is that none of our current developers caught the
fault before I did. "No further comment", as politicians say... Or I'll
really become impolite...)

Forget the last paragraph and enjoy your new working unit converter app!

musher0

~~~~~~~~~~~~~~
PS If you don't like tcl-tk programs, I've just uploaded on this board a
python solution called gonvert. BFN.

Posted: Fri 06 Mar 2015, 00:45
by BarryK
musher0 wrote:Given that our current gMeasures is limited to temperature conversions...
Have you noticed? The top part of gMeasures does not work. I mean:
nothing works in gMeasures except the temperature conversions...
I use gmeasures every now and again, and the top part works fine.

Yep, still works, trying it now in Quirky 7.0.1.

There is another one created recently, that was offered to me for possible inclusion in Quirky.
Haven't had my morning cup of coffee yet, can't remember it's name or author.

Anyway, here is the source of gmeasures, as used in Quirky:

http://distro.ibiblio.org/quirky/quirky ... .7.tar.bz2

Posted: Fri 06 Mar 2015, 01:06
by don570
BarryK wrote:There is another one created recently, that was offered to me for possible inclusion in Quirky.
Haven't had my morning cup of coffee yet, can't remember it's name or author.
I made Puppy units to convert the common units.
I made it specifically for students since I added a lot of
useful math info.

It only needs gtkdialog 0.8.3 and is very small.

http://murga-linux.com/puppy/viewtopic.php?t=92152

__________________________________

Posted: Fri 06 Mar 2015, 02:23
by musher0
@BK
I won't argue with you, if you say it works on your system, then it works
on your system. However, I am not lying either, and gMeasures is not
working in my slacko-6.0b neither in PPrecise 5.4.3.

Please bear in mind, Sir, that I do not have your experience in diagnosing
and solving application problems. Since I cannot "negotiate" those
problems directly yet, I "shop around" to find other viable solutions.

It stands to logic that I wouldn't have spent more than a day searching the
web for replacements to gMeasures and another half day preparing and
updating these pets if gMeasures had worked. I don't invent these
problems, I only try to solve them because I believe in Puppy. If I
didn't, I'd simply wipe my partition clean and load, say, Porteus? :)

@don570
I believe that you've done a good job of presenting a maximum of unit
conversions. However, your interface is not intuitive: having to go back to
a lower right-hand button that keeps changing function all the time is not
the handiest thing, and it's confusing, IMO.

So I lost patience with your work and looked for something else. Sorry
for speaking my mind so frankly.

BFN.

musher0

Posted: Fri 06 Mar 2015, 07:24
by musher0