Code Monkey home page Code Monkey logo

guidefate's Introduction

GUIDeFATE

GUI Design From A Text Editor

Designing a graphical User interface requires knowledge of things like toolkit libraries, platform context etc. At least I think it does. I am a relatively new programmer in that I have near zero experience in GUI programming outside a web page. So when I explore how to design an application which works outside a command line or a browser window, I feel tremendously out of my depth. When I see the programming interfaces to these interfaces (QT, GTK, TK, ncurses, HTML) my bewilderment reaches even greater heights.

Sure there are clever things like wxGlade, and QT Designer etc. These are tools that also require more skill than I possess; I am old and I can just about use a text editor as an IDE. So what is needed? I need a GUI designer that: -

  1. Is simple, abstracting away from the underlying Toolkit/platform
  2. Requires the simplest designer possible, with a visual representation of the interface
  3. Allows the use use of multiple different GUI engines
  4. Makes it easy recognise the interface elements by simply looking at the code

How might this work?

The user uses a text editor to design the window. Not new of course...text editors have had to be used to describe windows when other graphical representation methods were not possible. As this is already a two dimensional data, it should be possible to convert this into an actual graphical interface through an interpreter. The developer simply has to draw the interface in text and then program the interaction that is required. From version 0.06 multiple backends are supported, version 0.11 has 7 backends. For more details and working examples see the wiki

How do I use it?

GUIDeFATE requires an available working backend with their relevant connecting Perl modules. Different users will find different backends can be installed on their system. For instance Wx may not install easily in Perl versions before 5.16 without a lot of effort. Tk installs relatively easily gnerally and Gtk, and Win32 (for windows machines) may be more easily installed. Currently I dont feel it is robust enough for installation through CPAN...primarily because an attempt is made to install the backends which inariably fail because (e.g. Win32 is not available on Linux machines). So what I would suggest is that you test by unpacking this repo, and use the Examples Folder; scrpting using use lib <path_to_lib>; in your code will allow testing without committing. The example code that comes with the folder will probably be the best way to see how it works.

Textual Representation of a Graphical Interface

A simple hello world

+------------------+
|T Message         |
+------------------+
|                  |
|  Hello World! !  |
|                  |
+------------------+

hello world

A Calculator

+------------------------+
|T  Calculator           |
+------------------------+
|  [__________________]  |
|  { V }{ % }{ C }{AC }  |
|  { 1 }{ 2 }{ 3 }{ + }  |
|  { 4 }{ 5 }{ 6 }{ - }  |
|  { 7 }{ 8 }{ 9 }{ * }  |
|  { . }{ 0 }{ = }{ / }  |
|  made with GUIdeFATE   |
+------------------------+

Example PERL script

#!/usr/bin/perl -w
use strict;
use GUIDeFATE;
use GUIDeFATE qw<$frame>;
package Main;

my $window=<<END;
+------------------------+
|T  Calculator           |
+------------------------+
|  [                  ]  |
|  { V }{ % }{ C }{AC }  |
|  { 1 }{ 2 }{ 3 }{ + }  |
|  { 4 }{ 5 }{ 6 }{ - }  |
|  { 7 }{ 8 }{ 9 }{ * }  |
|  { . }{ 0 }{ = }{ / }  |
|  made with GUIdeFATE   |
+------------------------+

END

my $gui=GUIDeFATE->new($window [$backend],[$assist]); # API changed at version 0.06
# $backend is one of Wx(Default), Tk, Qt, Html, Web, Gtk2 or Gtk
# $assist is one or  "q" (quiet, default), "v" (verbose) or "a" for Autogenerate
$gui->MainLoop;

This produces something like:-

Calculator Screenshot

From Version 0.10 seven backends are supported. Wx, Tk, Gtk, Qt, Win32, HTML, Websocket. These have different prerequisites. Multiple Backends

  • Perl5.8.8, Exporter, Wx, Wx::Perl::Imagick (for Wx interface)
  • Perl5.8.8, Exporter, Tk, Image::Magick, Tk::JPEG, MIME::Base64 (for Tk interface)
  • Perl5.8.8, Exporter, Glib, Gtk3 (for Gtk3 interface)
  • Perl5.8.8, Exporter, Glib, Gtk2 (for Gtk2 interface)
  • Perl5.8.8, Exporter, QtCore4, QtGui4 (for Qt interface)
  • Perl5.8.8, Exporter, Win32, Imager (for Win32 interface)
  • Perl5.8.8, Exporter (for HTML interface)
  • Perl5.8.8, Exporter, Net::WebSocket::Server (for WebSocket interface )

Widgets

Supported Widgets: -

Widgets supported:-

  • Static Text
|    Static text            |
  • Text Entry box
|   [ Default text    ]     |
  • Buttons
|   {Button Label     }     |
  • MultiLine Text box
|  +T-----------------+     |
|  |                  |     |
|  |                  |     |
|  |                  |     |
|  +------------------+     |
  • Combo Box
|   ^listName  ^            |
  • Image Panel
|  +I-----------------+     |
|  |                  |     |
|  |                  |     |
|  |                  |     |
|  +------------------+     |
  • Menu
Menu
-File
--New
--Open
--Save Script
--Quit
  • Fileselector
	my $file= $frame->showFileSelectorDialog("Save file",0);
  • Message box
   if($frame->showDialog("Sure?","This will wipe existing text...proceed?","OKC","!")){

}
  • Timer (experimental memory leaks in non GTK backends)

  • Tooltips

		$frame->tooltip(<widget-Id>,<Tooltip text>);
  • CheckListBox (not so well in Websocket and Wx)
|   +C-------------------+   |
|   |checklistitems      |   |
|   |                    |   |
|   +--------------------+   |

More will be made as time goes along

NOTE: Amajor change happens from version 0.13 onwards. The Back-end modules (e.g. GFTk, GFWx, etc) will now reside in a folder called GUIDeFATE...this is reduce root namespace pollution making it easier to maintain. This will be commited to CPAN in a few months.

guidefate's People

Contributors

manwar avatar naltun avatar saiftynet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

guidefate's Issues

CPAN installation failed

The exit code was 1 and the last error message was:

make: *** No rule to make target 'script/Executioner.pl', needed by 'blib/script/Executioner.pl'.  Stop.
  SAIFTYNET/GUIDeFATE-0.05.tar.gz
  /usr/bin/make -- NOT OK

Namespace

It is clear that GUIDeFATE as is is pollution the root namespace. I would like to have the modules that GUIDeFATE uses to be on something like GUIDeFATE::GFwx etc. No sure how to do this...

Error when trying to use invaid/unknown GUI plugin

Minor issue:

$ perl /tmp/test.pl text
Can't call method "getFrame" without a package or object reference at /tmp/test.pl line 32.

This kind of error should be handled (report that "text" is not a supported backend)

CPAN?

Hey @saiftynet, will you be adding GUIDeFATE to CPAN eventually?

Congrats on the cool project! I already have an idea for my first project. ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.