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 Wed 03 Sep 2014, 00:38
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
BaCon Bits
Post new topic   Reply to topic View previous topic :: View next topic
Page 5 of 12 [168 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, ..., 10, 11, 12 Next
Author Message
sunburnt


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

PostPosted: Mon 12 Sep 2011, 18:41    Post subject:  

Yeah... I`ve used the CONCAT$ before, I just didn`t think of using it here.
And boy is that a pain in the arse! I`m remembering how crude Basic is...

I`ve said here many times, it takes 10 lines of Visual Basic for 1 of Bash.
Bash script`s intimidating as you start learning it, but it`s very powerful.!
But BaCon will compile! Too bad there isn`t a real converter for script to C.

P.S. Hey GatorDog, should I post a pic. of my app. here for all to see?
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Mon 12 Sep 2011, 21:20    Post subject:  

Quote:
P.S. Hey GatorDog, should I post a pic. of my app. here for all to see?
Sure. Go ahead and throw in the source code too. We all can learn Smile

rod
Back to top
View user's profile Send private message 
sunburnt


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

PostPosted: Mon 12 Sep 2011, 22:59    Post subject:  

A BaCon-HUG GUI front end for pDebThing, a Debian package downloader.
I wrote another GUI in gtkDialog, they both use the same Bash script backend.
I could have written more of the backend code in BaCon Basic,
. but it just calls shell commands anyway, so I didn`t write much of it in BaCon.

This is a good example of the type of GUI`s I talk about, with no backend code.
This way the backend and frontend ( GUI ) code is separate and replaceable.
Here there is one set of backend code and two sets of frontend code I wrote.
More GUIs could be written in Perl or Python, and the backend C or whatever.

Both GUIs look the same as they both use GTK widgets.

# The first pic. is the main tab panel of the Debian downloader.
The left ListBox shows the groups of packages.
Click a group and it`s list of packages shows in the right ListBox.
The right ListBox shows the packages in the selected group.
Click a package and it`s description info. shows on the second tab panel.

# The second pic. is the second tab panel that shows the description info.
000_DebDnld_BaCon.png
 Description   Upper one is package selection , lower one is package info.
 Filesize   63.47 KB
 Viewed   698 Time(s)

000_DebDnld_BaCon.png


Last edited by sunburnt on Tue 13 Sep 2011, 17:54; edited 3 times in total
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Mon 12 Sep 2011, 23:34    Post subject:  

sunburnt

Looking neat and clean Very Happy

rod
Back to top
View user's profile Send private message 
sunburnt


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

PostPosted: Mon 12 Sep 2011, 23:41    Post subject:  

GatorDog; Trying to get the GUI to show all the info.
Here`s one part for the first listbox, the second`s the same.
The var. TMP$ is set above and the files exist. What`s wrong?
Code:
TMP$ = "/tmp/deb-dnld"

   OPEN CONCAT$(TMP$,"/main.list") FOR READING AS inFile
   WHILE NOT(ENDFILE(inFile)) DO
      READLN TXT$ FROM inFile
      IF CHOP$(TXT$) = "" THEN CONTINUE
      TEXT(lstGRPS_,TXT$)
   WEND
   CLOSE FILE inFile

And this is the info. box, is this code right for filling an edit box?
Code:
   OPEN CONCAT$(TMP$,"/pkg.info") FOR READING AS inFile
   WHILE NOT(ENDFILE(inFile)) DO
      READLN TXT$ FROM inFile
      INFO$ = CONCAT$(INFO$,TXT$,NL$)
   WEND
   CLOSE FILE inFile
   TEXT(edINFO_,INFO$)

Last edited by sunburnt on Tue 13 Sep 2011, 01:25; edited 1 time in total
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Tue 13 Sep 2011, 00:53    Post subject:  

Terry,
I think your file I/O code itself is OK.

I'm guessing that for the top code snippet that you're getting a blank List?
I'll bet you a Little Debbies Chocolate Snack Cookie that "main.list" has
a final newline (NL$) character. NL$ is the default seperator when reading
in a text file. So, the final NL$ is seperating the text before it from the "nothing" (ie. null)
after it. So the final thing the TEXT(lstGRPS_,TXT$) is a null character.
Guess what that does. It clears the list box.

If you want to skip blank lines, you can put this in the WHILE loop
IF CHOP$(TXT$) = "" THEN CONTINUE
That will just skip processing that line and go read in the next line.
If you want the blank line, then substitute in a space for that list line.
IF CHOP$(TXT$) = "" THEN TMP$ = " "

An edit widget is cleared the same way, TEXT(Edit_widget_, "").
But your code there is adding a NL$ to each line so I don't think that's a problem there.

rod

ed. Snack Cookie vs. Snake Cookie Embarassed
Back to top
View user's profile Send private message 
sunburnt


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

PostPosted: Tue 13 Sep 2011, 01:37    Post subject:  

Hey GatorDog; Look above at the corrected first listBox, I`m sure that`s right...
The listboxes are still empty...

I see that the CHOP line is removing blank lines.
And you`re right... All 3 lists have a trailing blank line or more.
All 3 files are there for this testing, and are there sometimes during operation.

I assume the info. editBox handles null lines, other wise it couldn`t show them.

### Q: Would this work also: IF TXT$ <> "" THEN TEXT(lstGRPS_,TXT$)
It gives a compile error: Cause: expected expression before token ","

Last edited by sunburnt on Tue 13 Sep 2011, 04:32; edited 1 time in total
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Tue 13 Sep 2011, 03:23    Post subject:  

sunburnt,
I don't spot anything yet that looks out of place, but I may be looking through
the wrong section of my tri-focals Laughing

If you'd like to, either upload your code and the sample files your working with
or PM them, and I'll take a look.

rod
Back to top
View user's profile Send private message 
sunburnt


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

PostPosted: Tue 13 Sep 2011, 04:10    Post subject:  

Hey GatorDog; Well your code was needed as always, of course.
But in the final code error it was just my stupid code holding it up.

Posted the pics. of the working GUI displaying Debian packages and info.
I had to widen the GUI to get rid of the hoz. scroll bar, I`ve seen this before.
What`s weird is that the text isn`t anywhere near the edge of the listBox.

# Same Q: This should work also: IF TXT$ <> "" THEN TEXT(lstGRPS_,TXT$)
It gives a compile error: Cause: expected expression before token ","

When I get help with mtPaint, I`ll come back and clean up the pics.
The code`s very long, but when it`s fully functional I`ll post the BaCon file.

# Note: I think I`ll try editBoxes instead of the 2 listBoxes.
..... The listBoxes waste space between the lines, not very efficient.

Thanks again buddy... Terry
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Tue 13 Sep 2011, 12:17    Post subject:  

Quote:
# Same Q: This should work also: IF TXT$ <> "" THEN TEXT(lstGRPS_,TXT$)
It gives a compile error: Cause: expected expression before token ","

In this case "less than nothing" probably doesn't make sense; so just the "greater than" should accomplish the task.

Quote:
When I get help with mtPaint, I`ll come back and clean up the pics.
If you're just wanting to get two views of a GUI into one picture..
- Run two instances of the GUI, place them side-by-side, overlap etc.
- Pup menu/Graphic/mtPaint snapshot.
- Select area and crop.
- Optionally Scale
- Save

Example below

Note- the forum makes some limits on image dimensions. Beyond those
limits the image isn't displayed, but becomes a download. The dimensions
are probably documented somewhere, but there's always the trial & error method Rolling Eyes

Quote:
# Note: I think I`ll try editBoxes instead of the 2 listBoxes.
... The listBoxes waste space between the lines, not very efficient.

Well, the tradeoff here is that Bacon cannot grab a single (1) line from an EDIT widget.
So you probably need the listbox for the select window, but the info window could be an edit widget.

rod
snap_blt.png
 Description   ex.. combine pics using snapshot
 Filesize   62.61 KB
 Viewed   604 Time(s)

snap_blt.png

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


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

PostPosted: Mon 19 Sep 2011, 04:01    Post subject:  

Gui starts and quits, didn`t change anything big, added a Combo.
I stared at it for several hours, so post it and sleep.

# A compiled Bacon gui`s fairly portable I think... Should work on most Linuxes?

So if you get a few minutes to stare at it GatorDog...
deb-dnld_post.bac.gz
Description  Can`t seem to get the FileDialog to work either.
gz

 Download 
Filename  deb-dnld_post.bac.gz 
Filesize  1.55 KB 
Downloaded  183 Time(s) 
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Mon 19 Sep 2011, 18:50    Post subject:  

sunburnt,

1. Try setting a Var$ to the CONCAT$( path/filename.... and then use
OPEN VAR$ .
I think that is causing the crash.

2. You have two CLOSE FILE's in a row, but I think main problem is #1.

3. I put in a filedialog to getcha' a filename. I used a button to call it but
you'll probably want to call it from the program.

-----
I put all of the "OPEN FILE AS..." inside of a SUB since I don't have those
files on my system. It's just a cheap trick way of commenting them out Cool
Quote:
A compiled Bacon gui`s fairly portable I think... Should work on most Linuxes?

That should be correct. Though I've received little to no feedback on how the GUI's I've made "look" for other people. Crying or Very sad

rod
deb-dnld_with_filedialog.tar.gz
Description 
gz

 Download 
Filename  deb-dnld_with_filedialog.tar.gz 
Filesize  1.97 KB 
Downloaded  180 Time(s) 
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 19 Sep 2011, 22:22    Post subject:  

Quote:
A compiled Bacon gui`s fairly portable I think... Should work on most Linuxes?


only thing to beware of is the glibc version

the GUI just needs to match the glibc of the distro
this is not a problem you just have to recompile for the target machine

I discovered this by trying a recently compiled
app that was compiled using a more recent glibc

a quick recompile of the app against the older glibc did the trick
Quote:



@GatorDog That should be correct. Though I've received little to no feedback on how the GUI's I've made "look" for other people



I have plans to test a lot of the code you posted
so much code so little time keep posting when I have more free
time I will go though the examples maybe just knowing other
people are interested will help

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
GatorDog


Joined: 12 Sep 2006
Posts: 136

PostPosted: Mon 19 Sep 2011, 23:43    Post subject:  

Quote:
A compiled Bacon gui`s fairly portable I think... Should work on most Linuxes?

If the program is compiled with INCLUDE "hug.bac", my understanding is that
everything is compiled in that it needs to run. I've tested a couple of bacon
programs on another system and that seemed to be the case; however it
may not be that way across the board. If someone knows, please chime in.

Whereas compiling with INCLUDE "hug_imports.bac", it is dependent on a
shared object file ( .so), in this case hug.so .

The tradeoff being that the former is more portable and the latter gives a
significantly smaller executable file.

To be safe, when posting I've started attaching both the source program and
a standalone compiled version of it. That way anyone should be able to
check it out even if they're not running the Puppy devx package.

===================================
Tnx Joe, constructive feedback welcome Very Happy
rod
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 19 Sep 2011, 23:45    Post subject:  

Hey GatorDog

Im trying to get your first example compile to test it

this tell me I have to recompile no big deal

Code:

# ./pFontSelect
./pFontSelect: /lib/libc.so.6: version `GLIBC_2.7' not found (required by ./pFontSelect)
#



this tell me in the sources I am missing files to recompile with no problem I'll go to the bacon web site and look for that file
Code:

# bacon pFontSelect.bac
Converting 'pFontSelect.bac'... 34   
ERROR: missing file '/usr/share/BaCon/hug_imports.bac' for INCLUDE at line 34 in file 'pFontSelect.bac'!

#


fix it
download http://www.basic-converter.org/hug_imports.bac
mkdir -p /usr/share/BaCon
copy the hug_imports.bac into the folder


compile it
Code:

# bacon pFontSelect.bac
Converting 'pFontSelect.bac'... done.   .bac'... 94   
Compiling 'pFontSelect.bac'... done.
Program 'pFontSelect' ready.
#


try to run the compiled app
Code:

./pFontSelect           
Could not open library ./hug.so: cannot open shared object file: No such file or directory
#



ok looks like I have to compile a *.so now Im stuck whats the code for that
I'll read more about this

Code:

# bacon -f hug.bac       
Converting 'hug.bac'... done.   
Compiling 'hug.bac'... done.
Program 'hug.so' ready.
#



ok lets try now
Code:
# bacon pFontSelect.bac
Converting 'pFontSelect.bac'... done.   .bac'... 94   
Compiling 'pFontSelect.bac'... done.
Program 'pFontSelect' ready.
# ./pFontSelect


Code:

(<unknown>:27668): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: 'medium' is not a valid value for the 'weight' attribute on <span> tag, line 1; valid values are for example 'light', 'ultrabold' or a number

(<unknown>:27668): Gtk-WARNING **: Failed to set text from markup due to error parsing markup: 'medium' is not a valid value for the 'weight' attribute on <span> tag, line 1; valid values are for example 'light', 'ultrabold' or a number

ok the GUI came up some markup I need to sort out

looking good getting close





P.S we posted at the same time
Joe
pfont.png
 Description   
 Filesize   36.78 KB
 Viewed   620 Time(s)

pfont.png


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 5 of 12 [168 Posts]   Goto page: Previous 1, 2, 3, 4, 5, 6, 7, ..., 10, 11, 12 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.1282s ][ Queries: 13 (0.0295s) ][ GZIP on ]