pConvert a Measurements Units converted (Mar 3, 2007)

Stuff that has yet to be sorted into a category.
Post Reply
Message
Author
User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

pConvert a Measurements Units converted (Mar 3, 2007)

#1 Post 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
Attachments
pConvert-2.15-1.pet
This is the GTK version. Install this package if you have Puppy 2.14 or newer
(11.95 KiB) Downloaded 837 times
tkConvert-2.15-1.pup
This is the Tk version Install this package if you don't want to install gnocl
(23.12 KiB) Downloaded 756 times
Last edited by rarsa on Sat 03 Mar 2007, 19:35, edited 4 times in total.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
WhoDo
Posts: 4428
Joined: Wed 12 Jul 2006, 01:58
Location: Lake Macquarie NSW Australia

Re: TkConvert with a cleaned up UI

#2 Post 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

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

Re: TkConvert with a cleaned up UI

#3 Post 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"
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#4 Post 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?

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#5 Post 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.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#6 Post 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.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#7 Post 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.
[url]http://rarsa.blogspot.com[/url] Covering my eclectic thoughts
[url]http://www.kwlug.org/blog/48[/url] Covering my Linux How-to

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#8 Post 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.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#9 Post 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.
Attachments
pConvert_at _work_2015-03-05.jpg
(25.1 KiB) Downloaded 160 times
Old_but_still_serviceable_tkConvert_2015-03-05.jpg
(32.19 KiB) Downloaded 198 times
tkConvert-2.15-1.pet
(22.03 KiB) Downloaded 367 times
Last edited by musher0 on Fri 06 Mar 2015, 02:25, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#10 Post 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
[url]https://bkhome.org/news/[/url]

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#11 Post 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

__________________________________

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post 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
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#13 Post by musher0 »

musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply