These blocks of python code are for use with Illumination Software Creator
by Radical Breeze. Illumination Software Creator is for rapid
application development using graphical building blocks. It
produces python code for a range of operating systems. The links
below take you to the custom blocks. There is also a diagram below of
the custom block dialog within Illumination Software Creator.
This diagram has added notes to assist those just starting with custom
blocks. Custom blocks should be placed in
the Illumination>CustomBlocks folder which resides in yiur home
folder. Once in the folder they will become available for use.
Five of the custom blocks have been used in the application JpegComment (v0.4) for which the isc can be found here ~ in addition it is possible to download the finished Python script and application icon from here.
Run a Linux Command Line Script and Return a Variable (SystemScript)
This block runs any legitimate linux command line script and returns the output from that script. Download Block.
Block Content
import os
# Leading spaces required as indent... ISCVariable2=os.popen( ISCVariable1 ).read() # Line below is where Output 1 is called... #Output1
Reading a Jpeg File Comment (JpegFileReadComment)
Jpeg
files contain data about the file as well as the image. Within
this data header there can be two types of comment ~ the standard jpeg
comment and the exif comment. This block reads the standard jpeg
comment using the command line application exiv2 which is available from the repositories. Download Block.
Requires: exiv2 to be installed
Block Content
import os
# Leading spaces required as indent... commandLine= 'exiv2 -pc "'+ ISCVariable1 +'"' ISCVariable2=os.popen(commandLine).read() # Line below is where Output 1 is called... #Output1
Writing a comment to a Jepg File (JpegWriteFileComment)
Jpeg
files contain data about the file as well as the image. Within this
data header there can be two types of comment ~ the standard jpeg
comment and the exif comment. This block writes the standard jpeg
comment using the command line application exiv2 which is available from the repositories. Download Block.
Requires: exiv2 to be installed
Block Content
import os
# Leading spaces required as indent... commandLine= 'exiv2 -c "'+ ISCVariable2 + '" "'+ISCVariable1+'"' os.system(commandLine) # Line below tells is where Output 1 is called... #Output1
Determining the ID for a Window from its Name (WindowID)
It can sometimes be necessary to
determine a Window ID ( see JpegWindow) from the name of the
Window. For Illumination Software Creator the name of the window
is the text that appears in the Window Title bar not the Name (ie. the
second entry in the list of properties that are listed when you click
on the Window in the Design Window stage). This custom block can
determine the ID of Windows created with Illumination Software Creator
and those created with other applications. It requires the
installation of xwininfo. Download Block.
Requires: xwininfo
Block Content
import os
# Leading spaces required as indent... ISCVariable3="xwininfo -tree -root -name '"+ISCVariable1 +"' | sed '1,1d' | sed '2,7d' | awk '{print $4}' | tr -d '\n'" ISCVariable2=os.popen( ISCVariable3 ).read() # Line below is where Output 1 is called... #Output1
Placing a Jpeg Image in a Window (JpegWindow)
Version 3.0 does not have the
ability to display jpeg images. Until a later version introduces
this capability this offers a limited method to place an image on the
desktop. It requires Imagemagick which is avaialble from
Linux repositories. It utilises the display command from
Imagemagick to render the image in a window. The WindowID custom
block can be used to determine the window ID for use in this block. Download Block.
Requires: Imagemagick
Block Content
import os
# Leading spaces required as indent.. commandLine="display -page 250x250 -window "+ISCVariable2+" '"+ISCVariable1+"'" os.system(commandLine) # Line below tells is where Output 1 is called... #Output1
Opening a Jpeg File Using the GTK+ File Chooser (JpegFileOpen)
This custom block opens Jpeg files. It outputs the full path to the file and its directory as a second variable. Minor modifications to the filter statements will enable the custom block for use with other file types. Download Block.
Block Content
import pygtk pygtk.require('2.0') import gtk
# Leading spaces required as indent... dialog = gtk.FileChooserDialog("Open..", None, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN, gtk.RESPONSE_OK)) dialog.set_current_folder(ISCVariable2) dialog.set_default_response(gtk.RESPONSE_OK) filter = gtk.FileFilter() filter.set_name("Jpeg Files") filter.add_mime_type("text/txt") filter.add_mime_type("image/jpeg") filter.add_pattern("*.jpg") filter.add_pattern("*.jpeg") dialog.add_filter(filter) response = dialog.run() if response == gtk.RESPONSE_OK: ISCVariable1 = dialog.get_filename() ISCVariable2 = dialog.get_current_folder() pass elif response == gtk.RESPONSE_CANCEL: pass dialog.destroy() # Line below is where Output 1 is called... #Output1