The time now is Tue 21 May 2013, 13:23
All times are UTC - 4 |
|
Page 5 of 12 [166 Posts] |
Goto page: Previous 1, 2, 3, 4, 5, 6, 7, ..., 10, 11, 12 Next |
| Author |
Message |
sunburnt

Joined: 08 Jun 2005 Posts: 4004 Location: Arizona, U.S.A.
|
Posted: 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
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: 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
rod
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4004 Location: Arizona, U.S.A.
|
Posted: 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.
 |
| Description |
Upper one is package selection , lower one is package info. |
| Filesize |
63.47 KB |
| Viewed |
568 Time(s) |

|
Last edited by sunburnt on Tue 13 Sep 2011, 17:54; edited 3 times in total
|
|
Back to top
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: Mon 12 Sep 2011, 23:34 Post subject:
|
|
sunburnt
Looking neat and clean
rod
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4004 Location: Arizona, U.S.A.
|
Posted: 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
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: 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
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4004 Location: Arizona, U.S.A.
|
Posted: 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
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: 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
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
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4004 Location: Arizona, U.S.A.
|
Posted: 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
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: 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
| 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
| Description |
ex.. combine pics using snapshot |
| Filesize |
62.61 KB |
| Viewed |
488 Time(s) |

|
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4004 Location: Arizona, U.S.A.
|
Posted: 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...
| Description |
Can`t seem to get the FileDialog to work either.
|

Download |
| Filename |
deb-dnld_post.bac.gz |
| Filesize |
1.55 KB |
| Downloaded |
88 Time(s) |
|
|
Back to top
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: 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
| 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.
rod
| Description |
|

Download |
| Filename |
deb-dnld_with_filedialog.tar.gz |
| Filesize |
1.97 KB |
| Downloaded |
96 Time(s) |
|
|
Back to top
|
|
 |
big_bass

Joined: 13 Aug 2007 Posts: 1736
|
Posted: 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
_________________ slackware 14
|
|
Back to top
|
|
 |
GatorDog

Joined: 12 Sep 2006 Posts: 136
|
Posted: 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
rod
|
|
Back to top
|
|
 |
big_bass

Joined: 13 Aug 2007 Posts: 1736
|
Posted: 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
| Description |
|
| Filesize |
36.78 KB |
| Viewed |
464 Time(s) |

|
_________________ slackware 14
|
|
Back to top
|
|
 |
|
|
Page 5 of 12 [166 Posts] |
Goto page: Previous 1, 2, 3, 4, 5, 6, 7, ..., 10, 11, 12 Next |
|
|
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
|