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 Fri 19 Sep 2014, 00:09
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Introducing gmould
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [21 Posts]   Goto page: 1, 2 Next
Author Message
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Sat 09 Nov 2013, 15:59    Post subject:  Introducing gmould
Subject description: development of gtkdialog user interface designer
 

Hello everyone,

This is my first post so please be nice Very Happy
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.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5723
Location: Valåmoen, Norway

PostPosted: Sat 09 Nov 2013, 17:26    Post subject:  

What a great way of saying Hello to us.


Welcome
Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
simargl5

Joined: 29 Oct 2013
Posts: 31

PostPosted: Sat 09 Nov 2013, 19:11    Post subject:  

seems interesting...
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Sun 10 Nov 2013, 06:41    Post subject:  

Hi forum veterans Smile

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.
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Wed 13 Nov 2013, 08:39    Post subject: Anyone want ?  

Hi,

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

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/
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Thu 14 Nov 2013, 18:55    Post subject: Re: Anyone want ?  

afifio wrote:
Hi,

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

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:
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 Very Happy

Cheers,
s
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Thu 14 Nov 2013, 21:54    Post subject:  

Patience my padawan... Laughing Laughing

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/browse/gmould.tar.gz 600kb

git clone https://code.google.com/p/gmould/
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Fri 15 Nov 2013, 07:07    Post subject:  

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.
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Fri 15 Nov 2013, 13:17    Post subject:  

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 Smile

------------------------
Regarding variable naming, yes its a bit jungle, the uppercase is
Quote:
-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.

Quote:
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:
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:
<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 Sad.
--------------------------
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:
\"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. Laughing Laughing Laughing
So much to do Sad
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Fri 15 Nov 2013, 13:37    Post subject:  

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:
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:

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 ?
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Sat 16 Nov 2013, 13:22    Post subject:  

"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:
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:
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.
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Sat 16 Nov 2013, 17:47    Post subject:  

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:
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:
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.
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Sun 17 Nov 2013, 03:51    Post subject:  

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/download/AmigoProjects/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...
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 17 Nov 2013, 04:18    Post subject:  

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.
Back to top
View user's profile Send private message 
afifio

Joined: 26 Oct 2013
Posts: 19

PostPosted: Sun 17 Nov 2013, 12:38    Post subject:  

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/download/AmigoProjects/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 ? Smile 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 SmileSmile - easiest

I really need a working treeview Sad
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [21 Posts]   Goto page: 1, 2 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.1551s ][ Queries: 12 (0.0122s) ][ GZIP on ]