Introducing gmould

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

Introducing gmould

#1 Post by afifio »

Hello everyone,

This is my first post so please be nice :D
I'm developing a gtkdialog user interface designer, named gmould, the intro is at its blog page http://gmould.blogspot.com/, please visit and comment. For the mean time, I still did not upload it to anywhere, except the screenies on that blog page.

I will update the the blog of any development, if I got the (time that is).

The software was made as a thank you to the puppylinux community.
Thank you puppylinux.

For now here is whats available:
  • Your project installer and removal
    Project generator and skeleton
    Widget generator
    gtkdialog XML editor
    Bash script editor (text editor only, no test/run)
    Markup editor
    Actions editor
Ffor now, just have a look at the screenies.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#2 Post by zigbert »

What a great way of saying Hello to us.


Welcome
Sigmund

simargl5

#3 Post by simargl5 »

seems interesting...

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#4 Post by afifio »

Hi forum veterans :)

Yes, its interesting, not because I create it, but the possibility. I need response.

Because speed might be an issue. Which is better ?
Widget will be created from
  • a) database - speed penalty
    b) lots of small definition files - less speed penalty for access time
    c) single big definition file - memory penalty ? hundreds if not thousand of vars here
    d) lots of ready made small xml files - flexibility penalty
    e) single ready made huge xml file - almost 100kb and not flexible
    f) fully bash scripted - then gmould gui editor is pretty much useless but the lib will be fully utilise
Currently I use option b and moving to c). Widgets will be created in memory on demand from these small files.
You can actually use all the options above at the same time - headache for me. XML + Interpreted Script = headache for IDE/GUI designer. Been there, done this and its still a headache.

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

Anyone want ?

#5 Post by afifio »

Hi,

Anyone want developer release for gmould ?
Cause I think I need 2nd party review.
Before I lose focus that is :)

Code is rather disorganized state but it does its job, so please dont peek in there.

I need info about
- execution speed
- runtime speed
- usability/easy to use
- enhancement/suggestion

Btw, blog have new post and screenshot of gmould
http://gmould.blogspot.com/

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Re: Anyone want ?

#6 Post by seaside »

afifio wrote:Hi,

Anyone want developer release for gmould ?
Cause I think I need 2nd party review.
Before I lose focus that is :)

Code is rather disorganized state but it does its job, so please dont peek in there.

I need info about
- execution speed
- runtime speed
- usability/easy to use
- enhancement/suggestion

Btw, blog have new post and screenshot of gmould
http://gmould.blogspot.com/
afifio,

There doesn't seem to be anything there?

Code: Select all

env GIT_SSL_NO_VERIFY=true git clone https://code.google.com/p/gmould/
Cloning into 'gmould'...
warning: You appear to have cloned an empty repository.
We don't want you to lose focus :D

Cheers,
s

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#7 Post by afifio »

Patience my padawan... :lol: :lol:

actually I have the trouble understanding how to git push...or better said - I dont understand much about git.

Anyway its uploaded now, please download and test, if fail, simply do...
mkdir -p /root/projects/
copy gmould to there, xterm to that directory
and run ./setup.sh

Signal manager not yet created, should be easy.
Components section is just for testing.

happy generating.

These git push/pull etc etc stuff pretty confusing, so many stuff to setup

Now updated, the 1 millionth person who download will get a gold yacht.

Requirements:
gtkdialog version 0.8.3 r473M or better
bash and its friends.
https://code.google.com/p/gmould/source ... uld.tar.gz 600kb

git clone https://code.google.com/p/gmould/

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#8 Post by amigo »

Oh my! That does look a little complex to use, but I think your idea is good. A couple of points:
1. What about a pre-view functionality?
2. Could you make this produce *nicely indented* xml? That makes it *much* easier to view, understand and edit.

You seem to have sprung this in a pretty advanced state -420 files already. So maybe consolidating some stuff would be useful. Your coding-style is pretty nice and easy-to-read on the small-scale level. But getting a handle on the overall execution order is gonna be hard for contribs... I know about that because I have a similar-scale project myself.

Another thing, that's a really awful of of exports in there. I know you have to export vars so gtkdialog can access them, but you could do away with using individual paths for each items you need -by using a PRE_FIX/and-then-path. I mean instead of having BIN_DIR DOC_DIR LIB_DIR you could simply have PRE_FIX/bin PRE_FIX/lib PRE_FIX/doc/name-version. And you might consider using at least some lower-case in what you export -to avoid any possible name-space collision in the environment.

Do I see correctly that it produces files with '#!/usr/bin/gtkdialog'
shebang? I've not seen anyone here produce gtkdialog programs which are run that way -they all use shell mixed in, so the product is a shell script. I know the advantages of running them directly with gtkdialog -it's just that everyone seems to make mixed scripts here.

Gotta love that XML, eh? LOL After seeing how big your project already is, maybe my #2 suggestion above could just be done with xslt(or such) after-the-fact. Computing padding for the output might be a nightmare.

Good luck.

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#9 Post by afifio »

Hi amigo,

Thanks for perusing the codes, its sort of jungle. Code review is very nice indeed.

1. What about a pre-view functionality?
2. Could you make this produce *nicely indented* xml? That makes it *much* easier to view, understand and edit.

1-Pre view is actually there, when you click OK. The widget generator should preview the widget - only. For the entire apps, I'm still not there. Would you like to realise 100 widget just to view how a widget will look ?
In future that might be an option I guess, until we create the build system.

2.The widget xml is indented (except for <action> tags). I do have bash xml beautifier but, still didnot check it, lots more stuff to be done here and there.

I believe what you see is the test script, its just there to test the generated widget. I MEANT it to be pack that way - so you can easily copy and paste the generated xml :)

------------------------
Regarding variable naming, yes its a bit jungle, the uppercase is
-to avoid any possible name-space collision in the environment.
. Its specifically uppercased and long to avoid collisions. I do got screwed up - which is gmould, which is use prog at dev, which is user prog at runtime etc. Too many variables in too many situation to handle.

The gtkdialog bang is from thunor examples. Granted everyone is using shell, its there just to test the widget only.


xslt to the rescue is correct, but do we need to add another dependency ? xsl is already complex plus generating with bash is kinda fun and easy.

The number of files is not important, number of functions are. There are a lot of junk in gmould. I should clean it up.
instead of having BIN_DIR DOC_DIR LIB_DIR you could simply have PRE_FIX/bin PRE_FIX/lib PRE_FIX/doc/name-version.

Code: Select all

PREFIX=/usr/share/gmould
PIX_DIR=PREFIX/pix
PIXDIST_DIR=PIX_DIR/dist
...after few thousand lines and files using PREFIX/pix/dist/ok.png,
I move the dist/ to somewhere else. Do I need to visit each line to change or....just change the PIXDIST_DIR ? plus

Code: Select all

<pic>$PREFIX/pix/dist/ok.png<pic> ---- pretty long and cryptic
or
<pic>$PIXDIST_DIR/ok.png<pic> ---- simpler, in fact, I intend to do
<pic>$PIXDIST_OK<pic> ---- currently in progress
replacing the entire line with variable however, is out, because xml have attributes :(.
--------------------------
Now the main idea, here are how gmould suppose to help:-
1.Separation of code and xml - separation of logic and view.
xml will reside in different file. Business logic-bash script will reside in different file. This way, code is cleaner and easier to read and maintain. Mixing bash and xml do have benefits but kinda bad for maintaining . Ever encounter the need to do this ?

Code: Select all

\"Hello or \'" or \"> etc etc 
or the wth - "eat "'"$fruit"' today"

//real example from /usr/sbin/quicksetup- 
<window resizable=\"false\" title=\"${H_u1}\" icon-name=\"${HELPICON}\" window_position=\"1\">
.

2.Modularity
Both xml and bash are combined from hundreds of small snippets. You change a bit here and there, without touching the other parts - aka the visual basic style. Function argument preferably and SHOULD be only 1 - variable name, its up to the function to get the data it need, either from running environment or from tmp files or provide its own default value (less headache in future). Yes, I still did not do it in gmould eventhough I said it here, was naive when I start.

3.A build process
A build process will build (create and combine) these snippets into few large file - ready to distribute.

You can think it like this
XML - mould, bash script - cake, you the chef, think more about the cake.

I better stop now before this become a religion, preaching too much. :lol: :lol: :lol:
So much to do :(

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#10 Post by afifio »

Solved See code below


The function is in common.sh line 2036
Problem: parse this so we can get 3rd column
a|b b|c c c|d d d d|e e e e
This code below gets:d

Code: Select all

function TreeNodeGetColumn()
{
	local col=$1
	let "col+=2"
	# 1 is row, 2 is icon, thats why +2
	# data file should have icon|data1|data2|etc, no need row number
	echo  "${!col}"                         <------------- fail here ?
};export -f TreeNodeGetColumn

function TreeNodeExportColumn()
{
local col=$1
shift
local ifssaved=$IFS
IFS="|"                         <------------- fail here ?
TreeNodeGetColumn $col $*
IFS=$ifsaved
};export -f TreeNodeExportColumn
[Solution]---------------------------------------------------------------------------------

Code: Select all

function TreeNodeExportColumn()
{
	local col=$1
	shift
	local data=$*                                           <-------------------------this
	local OIFS=$IFS
	export IFS="|"
	TreeNodeGetColumn $col $data
	export IFS=$OIFS
};export -f TreeNodeExportColumn
Lesson: When you do a 'shift', the remainder must be assigned to a variable. IFS only applied to next function, using it in the current function that sets it seem does not work. Why ?

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#11 Post by amigo »

"Separation of code and xml" I wasn't suggesting that it was go to do so -quite the opposite as you note. I was just saying that nobody here does that -hence the programs they produce are often a nightmare and not adaptable to other desktop environments. I mean because they are not producing command-line versions of their program which are then controlled through external gui programs. I hope you gain many followers -maybe you can push them towards better separation of functional and gui code...

namespace pollution is more likely when suing ALLCAPS variable names, but I see you have many which are pretty safe (starting with GM_, or similar). I like using descriptive variable names too, but try to keep the names short without abbreviating(much) -so that code lines don't run off the right side so much. Of course, you can always use search/replace to adjust things consistently.

"have bash xml beautifier" In what file is that located? I'd like to see it. I have a padding routine in a small tool which shows dependency chains -either flat, as a tree, or as stairways...

Hmm, with those functions, do you really need two? I came up with this which makes shorter work of it -but I'm not exactly sure what you are passing to TreeNodeExportColumn:

Code: Select all

TEXT="a|b b|c c c|d d d d|e e e e"
function TreeNodeExportColumn() 
{
	local col=$1
	shift
	local IFS='|'
	set -- $(echo "$@")
	echo "${!col}"
}

TreeNodeExportColumn 3 $TEXT
# uncomment to show how the local IFS stays inside
# echo IFS="'$IFS'"
Or, to make it more versatile, by also passing the separator you want:

Code: Select all

TEXT="a|b b|c c c|d d d d|e e e e"
function TreeNodeExportColumn2() 
{
	local col="$1"
	local sep=$2
	shift 2
	local IFS="$sep"
	set -- $(echo "$@")
	echo "${!col}"
}

TreeNodeExportColumn2 3 '|' $TEXT
"few thousand lines and files using PREFIX/pix/dist/ok.png," Hmmm, you might be able to consolidate some of those paths. I really agonize with you -I have project which is above 20,000 lines of bash. It started out probably pretty similar to your initial idea -a nice little template or two -maybe 150 lines total. Luckily, I did redesign and re-write the thing twice, as versions 2 and 3 before I settle on an 'API' which I could live with for the last ten years. Buuttt, every winter I think "I'm gonna re-write that". It's tough to rationalize when you've got something working and it's thousands of lines.

I really wish I had re-written it again later when it was still around 3,000 lines. At that point I began splitting the functions out into separate files about 30 with functions, plus about 20 scripts, libs or executables. Still, some of the function files are over 1,000 lines -each with a main 'public' function and any sub-functions used only by that main function. One file holds any functions which are used by more than just one main function.

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#12 Post by afifio »

amigo wrote: Hmm, with those functions, do you really need two? I came up with this which makes shorter work of it -but I'm not exactly sure what you are passing to TreeNodeExportColumn:

Code: Select all

TEXT="a|b b|c c c|d d d d|e e e e"
function TreeNodeExportColumn() 
{
	local col=$1
	shift
	local IFS='|'
	set -- $(echo "$@")
	echo "${!col}"
}

TreeNodeExportColumn 3 $TEXT
# uncomment to show how the local IFS stays inside
# echo IFS="'$IFS'"
Or, to make it more versatile, by also passing the separator you want:

Code: Select all

TEXT="a|b b|c c c|d d d d|e e e e"
function TreeNodeExportColumn2() 
{
	local col="$1"
	local sep=$2
	shift 2
	local IFS="$sep"
	set -- $(echo "$@")
	echo "${!col}"
}

TreeNodeExportColumn2 3 '|' $TEXT
Yeah, the API dilemma, when things progress we might end up creating APIs. I'm trying to avoid that, probably just 2 lib - common and gmould...maybe another for extended gtkdialog components.

I'm expecting user will use the 2 libs to assist them in their bash apps. I still didnt figure out yet what they will require, can you do that ? Maybe provide me with your common.sh ? I think developer will require basic stuff - like filesystem access, finding linux specific enviroment etc etc. These codes are everywhere in most applications, they keep building each their own. I'm thinking of using your libraries since yours are more established ?

I havent test the code above yet, but by single glance, it seems much much better than mine. I think yours will do the job, mine already did but took 2 lame function. Thanks.

The pretty and parser is here, not mine. I didnt use it, i just thought I might need it.
https://gist.github.com/mralexgray/1209534

Wanna join me doing the gmould dance ? I do need help from veteran bash users.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#13 Post by amigo »

Wanna join me? -sorry, my plate is already full. And, I don't really like gtkdialog for more than really simple dialogs with 2-3 widgets. Did I mention how I despise XML??

I don't have any common.sh/other with general bash functions for use everywhere. I dabbled with a small project where I implemented several POSIX commands in bash-only:
http://distro.ibiblio.org/amigolinux/do ... /BashTrix/

The most useful little functions are implementations of basename, dirname, cut, grep and a few others like that. They do make routines much faster where one would normally call externals and pipe them.

My project is 'src2pkg', a program which downloads, unpacks, configures, compiles and packages sources or other content. The code has built up over a very long time. Most of the functionality is built with steps dedicated to the purpose although I occasionally I split out a it of code -like 'pkg-check' which checks package sanity, or exploderpm (which is even in some Puppies).

Currently I am designing a new package format and will add the ability to create them to src2pkg -but I'm considering re-writing src2pkg from scratch to simplify it and follow the new package format.

When I mentioned the 'API', what I meant was the exposed parts of the package-building steps -16 named functions and a bunch of variables as on/off switches for individual features, and other variables. None of it translates into useful functions for other purposes.

In addition to src2pkg, I also maintain a large repo, a handful of abandoned projects and build/use my own distro (KISS). KISS is at version 5.0 and each version has built on the previous version. It is all built from scratch using src2pkg and (currently) the '*.tpkg' package format. Lately I've been working on a new package format with a faster and more flexible plain-file database. Anyway, that keeps me busy enough when I am in the coding mood -which is usually only in Winter...

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#14 Post by jpeps »

amigo wrote:Wanna join me? -sorry, my plate is already full. And, I don't really like gtkdialog for more than really simple dialogs with 2-3 widgets. Did I mention how I despise XML??
XML is used a lot in object oriented programming. Eclipse uses them for the layouts, menus, values, and manifest files. They're also great for storing simple database info (I posted one example in the Java thread).

My hunch is that the tool would have to be fairly sophisticated to warrant learning and using it. A tool like Eclipse automates many coding processes in addition to error checking, etc., which is why it's worth learning. Looks like afifio has done some impressive work, though.

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#15 Post by afifio »

amigo wrote:Wanna join me? -sorry, my plate is already full. And, I don't really like gtkdialog for more than really simple dialogs with 2-3 widgets. Did I mention how I despise XML??

I don't have any common.sh/other with general bash functions for use everywhere. I dabbled with a small project where I implemented several POSIX commands in bash-only:
http://distro.ibiblio.org/amigolinux/do ... /BashTrix/

The most useful little functions are implementations of basename, dirname, cut, grep and a few others like that. They do make routines much faster where one would normally call externals and pipe them.
I dont think you mentioned that you despise XML anywhere. Probably in another account ? :) gmould was created because scripts people dont really like defining gui in XML.

Anyway, thanks for the link, I'll rip whatever I can. Its the small things that I want. the cut, tr, sed, basename etc etc functions.

Since you maintain a distro, that would be busy I guess.
I'm still looking for gmould contributors/developer etc etc.

Currently gmould start spitting XML snippets in preparation for the next step. Future plan :
- creating custom widget generator for the layout/containers - easy
- defining parent-child relation between layout and widget - hard
- build system to combine it to a single XML, cat $file >> $XML --- of course :):) - easiest

I really need a working treeview :(

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#16 Post by jpeps »

afifio wrote:
I really need a working treeview :(
Maybe you could check in with Thunor over in the GtkDialog Development thread.

User avatar
matiasbatero
Posts: 60
Joined: Fri 12 Oct 2012, 01:27
Location: Mar del Plata, Argentina

#17 Post by matiasbatero »

Nice Project!!

I'm installing gtkdialog with gtk3 on my crunchbang debian... in a few hours i'll test your app.

I will have more consolidated suggest later. But looking your screenshots, it seems some complex. Personally i like your GUI, looks good and very pretty. I prefer another concept to write gui's with gtkdialog, for example based on bash functions, with capability to draw inside or drawing to external xml using redirection. Personally when time pass, i forget some widget attribute tags and values, so i develop with gtkdialog-wiki.
Months ago, i had a idea to build a "GUI-maker" using YAD tree widget with editable fields, to solve this.

PD: Sos de Argentina?

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#18 Post by afifio »

Thats the main idea, bash spit out xml. but later, you will need more and more and before you know it, its much better to write xml.

I do favor bash generated xml on runtime, but now I'm limiting it only for the extended components. If you downloaded it, have look at the manager dialogs, specifically gmTreeview. I extend the common treeview to export full row and etc etc etc. The "usual stuff", now just issuing
gmTreeview $varname
and you get the whole thing and its extendable if needed. I call it - components, its should be available to all gtkdialog developer to use and its settings should be easily configurable through gmould. Sort of commdlg.dll in windows.

In future I expect to extend a few more widget, but, gmould still not mature enough,- yet :):)

The benefits is - better looking and more capable components.
Here are the list of components I would like to create (but not enough time):-

Create the Accordion - like MSOutlookbar
Deprecating the entrybox and use comboboxentry(improved of course)
Better preferences dialog - generic of course.
Toolbar editor
TabMenu editor (ribbon menu)
Menu editor - possibly deprecated in favour of ribbon
Help editor - can be done already, but I want to include picture also
RTF style editor - for the pango markup stuff, addition to MarkupEditor
Better common form controls (most is done already)
Improve the collapsible section, too bad , we cannot dock.
...
as you can see, there are lots more to be done. The problem - my interest in gmould is wobbling, maybe I move back to generating html using php :)

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#19 Post by amigo »

I'm having another look at the 'easybashgui' project which features a set of functions like: ok_message "Message here"
which is then rendered in any one of:
yad, gtkdialog, kdialog, zenity, Xdialog, dialog, or whiptail or plain console

He has a good concept there which could also be extended to use an voice/audio or other interface. Here are the supported functions:
message
ok_message
alert_message
text
question
input
menu
tagged_menu
list
fselect (= "file select" )
dselect (= "directory select" )
wait_seconds
wait_for
terminate_wait_for
progress
adjust

Of course, these are all pretty simple functions. gtkdialog can use complex gui with many widgets which might be difficult to implement using the other tools. Perhaps that is because we tend to imagine the interface according to the way it will look -instead of how it will function.

I've seen some really hideous tools using gtkdialog here in the forum. Some sort of re-usable templates should help to fight such things.

Just to show what I mean about hideous and poorly-conceived tools. One fellow posted a thing which would show a box, maybe 300x400 pixels, and filled with just buttons. No menu, or panels or anything except buttons -all with names; whizpup, do it, backtrack, chirp, sjdzegrbt, Whack! and other such! Can you imagine such a thing? And then, another fellow posted to congratulate him on the great, clean design! Combine that with a garbled name like whizbangipuppify253 and a murkily-expressed purpose for the program "This beauty whangs your puppified do-hickey instead of thingifying your 'do it' whang, like the standard puppy does. (Update: since version whizbangipuppify253-beta-alpha-omega0.7.111a, whizbangipuppify253 can now also thingify your 'do it' whang jut like the standard puppies. (I had **lots*** of people PM'ing me asking me to restore this behavior.) So, now just by booting with the whizbangipuppify253=restore-old-behavior and then clicking 37 checkboxes in the (New!) WhizBangiPuppify253PersonalPreferences tool. (Sorry, I still haven't created a *.desktop file to start the WBP253PP(WhizBangiPuppify253PersonalPreferences) app from the menu or clicking an icon, so you'll have to start it from the command-line in terminal-thingy or whatever you call it."

Then, two hours later the OP posts again and has completely re-written the thing (From Scratch!) -but don't worry about your old settings after having run 'WBP253PP', because he has now written a GUI to convert your old settings file (/usr/root/share/bin/application/my-stuff/WBP253PP/menu/setting/etc/local/share/app/WBP253PP.conf) into the new format and location at: .... surely I need not tell you where the new conf file is, right?? You already know because you've been watching the thread and testing the tool, too. Right? LOL LOL

afifio
Posts: 19
Joined: Sat 26 Oct 2013, 16:57

#20 Post by afifio »

Yeap, easy bash gui is good. I dont think gmould can compete with it yet. I can rip the code, but I dont think that what I want with gmould. gmould meant for gtkdialog, although we can modify it to generate html or any other markup or codes.

Developing with gui, is different from processing from command line. gmould is not for the "Please insert your name" entrybox with Ok button. Its not meant to be use for that, we all can conjure up a bash function to create a button instead of using the whole load of gmould to do that. Hoewever, when you start developing larger apps, gmould will help you create it faster and better. For a bigger project, you probably will appreciate gmould. For smaller project gmould will still help, not much though.

The bad thing is - the big application already done and done and redone again, and they take helluva of resource to perform what gtkdialog do for nickel.

Different tool for different job. Looking at its small niche, I do wonder if people will use gmould at all ? :):):)

amigo:Dont worry! gmould can create the desktop awareness for you! LOL. Hmmm I really have to look at the NewProjectWindow, but its not that important.

blog update - reason to use action group.

Offtopic - Now my laptop is getting hot again, still no processor fan probably because of Transmission and Seamonkey running :(

Post Reply