Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 23 Sep 2014, 20:34
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 64 [952 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 62, 63, 64 Next
Author Message
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sat 19 Sep 2009, 13:26    Post subject:  

Dear nikin,

The program is yours - I added a lot of comments, I think. The reason I export ORIGIFILE in the original init vars is so that the dialog will know about it. PDFFILE is also exported, but that happens in the function fix_filename(), once we have determined whether or not we have anything passed on the command line. In the latest version, it is the last line in that function.

I think it this script could be linked to the copnversion program nicely. I am having a problem getting graphics to print in html2pdf conversion, but it may be that my ghostscript settings are bad. I will check.

As for seaside's proposal, I will check my little gtkialog "manual" - a short but useful synopsis of most commands written in French (with examples). I think it is posted in earlier pages of this topic. Otherwise look up my posts. It will be there somehwere. If you don't find it, I can post it again.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sat 19 Sep 2009, 14:48    Post subject:  

Dear nikin,

This is the link to the gtkdialog manual:

[url]
http://www.murga-linux.com/puppy/viewtopic.php?t=40420
[/url]

I found the examples very instructive - since they show syntax. The author also explains a few things nicely.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Sat 19 Sep 2009, 22:53    Post subject:  

nikin-

I was away from Puppy and could only give you some general hints before.

Here's a quick concept code I put together.
Code:

#! /usr/sbin/gtkdialog -e
## gtkdialog3 has to be linked to gtkdialog in usr/sbin
ORIGINALFILE=root/somewhere/somefilename.doc

function change_pdf() {

PDFFILE="`basename $ORIGINALFILE | cut -d. -f1`.pdf"
echo $PDFFILE
}

export MAIN_DIALOG='
<vbox>
<entry>
<input>echo $ORIGINALFILE</input>
<variable>ORIGINALFILE</variable>
<action>change_pdf</action>
</entry>
<entry>
<input>change_pdf</input>
<variable>PDFFILE</variable>
</entry>
  <button>
    <label>Exit</label>
  </button>
</vbox>
'



After the original file name is selected in the first box, the function change_pdf will convert the original file name to "original file basename".pdf and it will appear in the second box and all the variables are retained.

There are probably other ways to do this and Gtkdialog is sometimes very mysterious. Very Happy
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5031
Location: Arizona, U.S.A.

PostPosted: Sun 20 Sep 2009, 01:03    Post subject:  

Very good zigbert! This is Wiki material for sure...
I made some script libraries years ago to make gtkDialog easier.
The author of gtkDialog said: "It`s a very bad program I wrote years ago."
I agree, it`s not a very good setup, but then I hate XML stye script anyway...
Basic style command lines are far easier to understand and use by anyone.
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 20 Sep 2009, 05:19    Post subject:  

Dear nikin,

I added a help screen to PPDF. I think we could modify the text to make it more informative, but it's a start.

With kind regards,
vovchik
pdfprint.tar.gz
Description 
gz

 Download 
Filename  pdfprint.tar.gz 
Filesize  1.82 KB 
Downloaded  1099 Time(s) 
Back to top
View user's profile Send private message 
nikin

Joined: 14 Sep 2009
Posts: 18

PostPosted: Sun 20 Sep 2009, 08:08    Post subject:  

Dear seaside:

Quote:
I was away from Puppy and could only give you some general hints before.

Here's a quick concept code I put together.


Almost working
I haked it together so dat it works. Some UTF compatibility problems stil emerge.. but i willfix them .

Modified


Code:

#! /usr/sbin/gtkdialog -e
## gtkdialog3 has to be linked to gtkdialog in usr/sbin

function change_pdf() {

PDFFILE="`basename $ORIGINALFILE | cut -d. -f1`.pdf"
export PDFFILE
echo $PDFFILE
}

export MAIN_DIALOG='
<vbox>
<entry>
<input>echo $ORIGINALFILE</input>
<variable>ORIGINALFILE</variable>
<action>change_pdf</action>
<action>refresh:PDFFILE</action>
</entry>
<entry>
<input>change_pdf</input>
<variable>PDFFILE</variable>
</entry>
  <button>
    <label>Exit</label>
  </button>
</vbox>
'




Thank you for the hint. Very Happy
Back to top
View user's profile Send private message 
nikin

Joined: 14 Sep 2009
Posts: 18

PostPosted: Sun 20 Sep 2009, 08:15    Post subject:  

Quote:
Dear nikin,

I added a help screen to PPDF. I think we could modify the text to make it more informative, but it's a start.

With kind regards,
vovchik


Dear vovchik,

Nice addition again... after i get home from work, i will put it together with the code i built from seaside's source.

Question:
Should i include the capability do password protect the genared pdf?
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Sun 20 Sep 2009, 09:22    Post subject:  

Dear nikin,

With seaside's mods and all of our ideas, I think we will have a nice and useful program for Puppy. Password protection is not a bad idea - my only problem is that I password protected a few pdfs a few years ago and no longer remember the password Sad.

Good luck... I am eager to see the results.

With kind regards,
vovchik
Back to top
View user's profile Send private message 
nikin

Joined: 14 Sep 2009
Posts: 18

PostPosted: Sun 20 Sep 2009, 23:13    Post subject: ppdf 0.1.5  

Hi everyone!

I had some time and done the folowing:

- merged seaside's idea.
- merged vovchik's last version
- reworked the code to work in event driven mode
- rewritten help text.
- Changed Help box button from CANCEL to CLOSE
- Changed main dialog button from CANCEL to QUIT
- The program now tries to automatically create the gtkdialog link

Get it, test it, comment on it.
And i would like to thank everyone who helped Smile
I reached my original goals by now.

Now its time for ideas on how to improove.
The main thing in my mind is to make it possible to add opening and editing passwords

bytheway its called ppdf becouse it is written to replace puppypdf

i would like to make 1.8 the first release so any bugreports are highly welcommed.

And i think this program begins to get a nice gtkdialog example. only if i could comment inside the dialogdescriptions.

its 5 am ...ihaveto sleep. Crying or Very sad

Bests

nikin[list=][/list]
ppdf_0.1.5.tar.gz
Description 
gz

 Download 
Filename  ppdf_0.1.5.tar.gz 
Filesize  1.96 KB 
Downloaded  1103 Time(s) 
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 21 Sep 2009, 03:21    Post subject:  

Dear nikin,

Nice work. We do have a little problem now in that the parameter passing from the command line for ORIGIFILE does not work. Try dropping a file (e.g. doc) onto ppdf. The filename should show up in the Original input box - as it did before. Now it does not, so it cannot be used as a "handler" in ROX. I am looking into it. When you wake up and have time, please also have a look....

With kind regards,
vovchik
Back to top
View user's profile Send private message 
nikin

Joined: 14 Sep 2009
Posts: 18

PostPosted: Mon 21 Sep 2009, 06:04    Post subject:  

Dear vovchik,

You right. But thereis no easy way to solve it as i see. becouse gtkdialog does not give you the entered command line args.

what works fine is a helper-script.

Code:

#!/bin/bash

export ORIGIFILE="$@"
`./ppdf`


Bests
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Mon 21 Sep 2009, 07:11    Post subject:  

Dear nikin,

Your solution with the helper script is great and WORKS! I am now thinking of a few additional file types that could perhaps be processed by other programs - and a case statement in the ppdf_convert() function could determine which prog - abiword or something else - would do the "xxx2pdf" processing....

With kind regards,
vovchik
Back to top
View user's profile Send private message 
nikin

Joined: 14 Sep 2009
Posts: 18

PostPosted: Mon 21 Sep 2009, 10:53    Post subject:  

Dear vovchik

It is god idea.. first thing that comes in mind are ppt-s but we need openoffice for that
i also have a little script wich was never finished and it ries to make some size optimization on images inside odp files.

if any program comes in your mind, just tell me.
Merging multiple files would be good to, but that is something for 0.2.0

Bests nikin
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Tue 22 Sep 2009, 06:55    Post subject:  

Dear nikin,

I am thinking about what additional conversions to pdf might be included without burdening Puppy too much. I have OO installed, so odt would be useful for me. The which command could be sued to check for soffice or swriter and, if not found, that extension would not be processed and a gxmessage error could pop up indicating the absence of OO on the user's machine (e,g, Cannot handle the extension "xxx" on this computer). For a case statement check, we could use this:
Code:
ORIGIEXT=${ORIGIFILE##*.}
export ORIGIEXT


Here is a stupid icon I came up with last night.

With kind regards,
vovchik
ppdf-but.png
 Description   
 Filesize   22.85 KB
 Viewed   2330 Time(s)

ppdf-but.png

Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Tue 22 Sep 2009, 11:47    Post subject:  

nikin,

I just downloaded and looked at your program (forum has been down). You have put together a very attractive, useful, and well-done program. Thank you.

I tried it out with Choicepup and it accepted all the input very nicely and it then produced nothing and no error.... and suddenly a light bulb Idea went off.....Choicepup does not have Abiword installed! I installed it and everything was perfect. Very Happy

There is one line ##### that you can remove here..
Code:

export MAIN_DIALOG='
<vbox>
<entry>
<input>echo $ORIGINALFILE</input>
<variable>ORIGINALFILE</variable>
######<action>change_pdf</action>######
<action>refresh:PDFFILE</action>
</entry>
<entry>
<input>change_pdf</input>
<variable>PDFFILE</variable>
</entry>


The "refresh:PDFFILE" action makes the "change-pdf" action take place.

The "helper script" wrapper was a great idea and I sure agree with you that it would be much better if GTKdialog could be commented (it makes my head hurt to read XML Mad )

Very nicely done!

vovchik:

I liked your icon - is that a hat on the top?
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 64 [952 Posts]   Goto page: Previous 1, 2, 3, 4, 5, ..., 62, 63, 64 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0898s ][ Queries: 13 (0.0072s) ][ GZIP on ]