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.
So much to do