diff options
Diffstat (limited to 'examples/ide')
-rw-r--r-- | examples/ide/.cvsignore | 6 | ||||
-rw-r--r-- | examples/ide/README | 7 | ||||
-rw-r--r-- | examples/ide/break.xpm | 29 | ||||
-rwxr-xr-x | examples/ide/browse.py | 117 | ||||
-rw-r--r-- | examples/ide/continue.xpm | 27 | ||||
-rw-r--r-- | examples/ide/edit.py | 181 | ||||
-rw-r--r-- | examples/ide/edit.xpm | 38 | ||||
-rwxr-xr-x | examples/ide/gtkcons.py | 329 | ||||
-rwxr-xr-x | examples/ide/gtkdb.py | 350 | ||||
-rwxr-xr-x | examples/ide/gtkprof.py | 133 | ||||
-rw-r--r-- | examples/ide/minibreak.xpm | 19 | ||||
-rw-r--r-- | examples/ide/next.xpm | 32 | ||||
-rwxr-xr-x | examples/ide/pyide.py | 180 | ||||
-rw-r--r-- | examples/ide/quit.xpm | 36 | ||||
-rw-r--r-- | examples/ide/return.xpm | 35 | ||||
-rw-r--r-- | examples/ide/run.xpm | 28 | ||||
-rw-r--r-- | examples/ide/step.xpm | 35 |
17 files changed, 1582 insertions, 0 deletions
diff --git a/examples/ide/.cvsignore b/examples/ide/.cvsignore new file mode 100644 index 00000000..c2831020 --- /dev/null +++ b/examples/ide/.cvsignore @@ -0,0 +1,6 @@ +Makefile.in +Makefile +*~ +*.pyc +*.pyo + diff --git a/examples/ide/README b/examples/ide/README new file mode 100644 index 00000000..99568b0f --- /dev/null +++ b/examples/ide/README @@ -0,0 +1,7 @@ +This directory contains some tools that can be used to help develop python +applications. There is a graphical front end to the profiler and debugger, +and a graphical python console, and a 'module browser'. + +I will probably link these together with an editor (just use emacs, or write +one in python?). + diff --git a/examples/ide/break.xpm b/examples/ide/break.xpm new file mode 100644 index 00000000..f5221a30 --- /dev/null +++ b/examples/ide/break.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * break_xpm[] = { +"21 22 4 1", +" c None", +". c #000000", +"X c #FFFFFF", +"o c #FF0000", +" ......... ", +" .XXXXXXXXX. ", +" .XXoooooooXX. ", +" .XXoooooooooXX. ", +" .XXoooooooooooXX. ", +" .XXoooooooooooooXX. ", +".XXoooooooooooooooXX.", +".XoooooooooooooooooX.", +".XooXXoXXXoXXooXXooX.", +".XoXooXoXoXooXoXoXoX.", +".XoXooooXoXooXoXoXoX.", +".XooXXooXoXooXoXXooX.", +".XooooXoXoXooXoXoooX.", +".XoXooXoXoXooXoXoooX.", +".XooXXooXooXXooXoooX.", +".XXoooooooooooooooXX.", +" .XXoooooooooooooXX. ", +" .XXoooooooooooXX. ", +" .XXoooooooooXX. ", +" .XXoooooooXX. ", +" .XXXXXXXXX. ", +" ......... "}; diff --git a/examples/ide/browse.py b/examples/ide/browse.py new file mode 100755 index 00000000..ba8e55d1 --- /dev/null +++ b/examples/ide/browse.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python + +# This is an example of using dynamic trees (trees where nodes are only +# calculated as they are needed) with pygtk. This particular example +# allows for the browsing of the variables in a module, allowing the +# descent into classes and modules and other objects with a __dict__ +# attribute. + +# If this file is run straight, it will let you browse the gtk module. + +from gtk import * + +class BrowseTreeItem(GtkTreeItem): + def __init__(self, name, dict=None, disp=None): + GtkTreeItem.__init__(self, name) + self.name = name + self.dict = dict + self.disp = disp + self.exp_id = self.connect("expand", self.sig_expand) + def init_subtree(self): + if self.dict: + self.subtree = GtkTree() + self.subtree.set_selection_mode(SELECTION_BROWSE) + self.subtree.connect("select_child", self.subsel_child) + self.set_subtree(self.subtree) + self.subtree.show() + def subsel_child(self, _t, _c): + if self.disp: + key = _c.children()[0].get() + if key == '__builtins__': # builtins includes itself + value = key + else: + value = `self.dict[key]` + self.disp.set_text(value) + def sig_select(self): + if self.disp: + self.disp.set_text(value) + def sig_expand(self, _t): + keys = self.dict.keys() + keys.sort() + for key in keys: + dict = None + try: + dict = vars(self.dict[key]) + except TypeError: + pass + item = BrowseTreeItem(key, dict, self.disp) + self.subtree.append(item) + item.init_subtree() + item.show() + self.disconnect(self.exp_id) + +class BrowseVariables(GtkVBox): + def __init__(self, name, dict): + GtkVBox.__init__(self) + self.set_spacing(2) + + self.sw = GtkScrolledWindow() + self.sw.set_usize(300, 200) + self.sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) + self.pack_start(self.sw) + self.sw.show() + + self.disp = GtkEntry() + self.disp.set_editable(FALSE) + self.pack_start(self.disp, expand=FALSE) + self.disp.show() + + self.root_tree = GtkTree() + self.sw.add(self.root_tree) + self.root_tree.show() + + self.browse = BrowseTreeItem(name, dict, self.disp) + self.root_tree.append(self.browse) + self.browse.init_subtree() + self.browse.show() + +class BrowseWindow(GtkWindow): + def __init__(self, name, dict): + GtkWindow.__init__(self) + self.set_title("Browse Window") + + box = GtkVBox() + self.add(box) + box.show() + + browse = BrowseVariables(name, dict) + browse.border_width(10) + box.pack_start(browse) + browse.show() + + separator = GtkHSeparator() + box.pack_start(separator, expand=FALSE) + separator.show() + + box2 = GtkVBox(spacing=10) + box2.border_width(10) + box.pack_start(box2, expand=FALSE) + box2.show() + + button = GtkButton("Close") + box2.pack_start(button) + button.set_flags(CAN_DEFAULT) + button.grab_default() + button.show() + self.close_button = button + +if __name__ == '__main__': + import gtk + win = BrowseWindow('gtk', vars(gtk)) + win.set_title("Browse gtk.py") + win.connect("destroy", mainquit) + win.connect("delete_event", mainquit) + win.close_button.connect("clicked", mainquit) + win.show() + + mainloop() diff --git a/examples/ide/continue.xpm b/examples/ide/continue.xpm new file mode 100644 index 00000000..f44f61d7 --- /dev/null +++ b/examples/ide/continue.xpm @@ -0,0 +1,27 @@ +/* XPM */ +static char * continue_xpm[] = { +"20 22 2 1", +" c None", +". c #000000", +" ", +" ", +" . . ", +" .. .. ", +" ... ... ", +" .... .... ", +" ..... ..... ", +" ...... ...... ", +" ....... ....... ", +" ........ ........ ", +" .................. ", +" .................. ", +" ........ ........ ", +" ....... ....... ", +" ...... ...... ", +" ..... ..... ", +" .... .... ", +" ... ... ", +" .. .. ", +" . . ", +" ", +" "}; diff --git a/examples/ide/edit.py b/examples/ide/edit.py new file mode 100644 index 00000000..7b0f0349 --- /dev/null +++ b/examples/ide/edit.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python + +# This is a sample implementation of an editor. + +from gtk import * +import GtkExtra +import os + +BLOCK_SIZE = 2048 + +class EditWindow(GtkWindow): + def __init__(self, quit_cb=None): + GtkWindow.__init__(self, WINDOW_TOPLEVEL) + self.set_usize(470, 300) + self.connect("delete_event", self.file_exit) + + self.quit_cb = quit_cb + + self.table = GtkTable(2,3) + self.add(self.table) + self.table.show() + hdlbox = GtkHandleBox() + self.table.attach(hdlbox, 0,2, 0,1, xoptions=FILL, + yoptions=FILL) + hdlbox.show() + self.menubar = self.create_menu() + hdlbox.add(self.menubar) + self.menubar.show() + + self.text = GtkText() + self.text.connect("changed", self.set_dirty) + self.text.set_editable(TRUE) + self.table.attach(self.text, 0,1, 1,2) + self.text.show() + + vadj = self.text.get_vadjustment() + self.vscroll = GtkVScrollbar(vadj) + self.table.attach(self.vscroll, 1,2, 1,2, xoptions=FILL) + self.vscroll.show() + vadj.connect('changed', self.chk_scroll) + + self.text.realize() + self.dirty = 0 + self.file_new() + self.text.grab_focus() + + def set_dirty(self, text=None): + self.dirty = 1 + def chk_scroll(self, adj): + if adj.upper - adj.lower <= adj.page_size: + self.vscroll.hide() + else: + self.vscroll.show() + + def load_file(self, fname): + try: + fd = open(fname) + self.text.freeze() + self.text.delete_text(0, self.text.get_length()) + buf = fd.read(BLOCK_SIZE) + while buf != '': + self.text.insert_defaults(buf) + buf = fd.read(BLOCK_SIZE) + self.text.thaw() + self.text.get_vadjustment().set_value(0) + self.text.queue_draw() + self.set_title(os.path.basename(fname)) + self.fname = fname + self.dirty = 0 + self.new = 0 + except: + GtkExtra.message_box('Edit', "Can't open " + fname, + ("OK",)) + + def create_menu(self): + mf = GtkExtra.MenuFactory() + + mf.add_entries([ + ('File/New', '<control>N', self.file_new), + ('File/Open...', '<control>O', self.file_open), + ('File/Save', '<control>S', self.file_save), + ('File/Save As...', None, self.file_saveas), + ('File/<separator>',None, None), + ('File/Exit', '<control>Q', self.file_exit), + ('Edit/Cut', '<control>X', self.edit_cut), + ('Edit/Copy', '<control>C', self.edit_copy), + ('Edit/Paste', '<control>V', self.edit_paste), + ('Edit/Clear', None, self.edit_clear), + ('Edit/<separator>',None, None), + ('Edit/Find...', None, self.edit_find), + ('Edit/Find Next', None, self.edit_find_next), + ('Help/About...', None, self.help_about) + ]) + # activate key bindings ... + self.add_accel_group(mf.accelerator) + self.mf = mf + return mf + + def chk_save(self): + if self.dirty: + ret = GtkExtra.message_box("Unsaved File", + (self.fname or "Untitled")+ + " has not been saved\n" + + "Do you want to save it?", + ("Yes", "No", "Cancel")) + if ret == None or ret == "Cancel": return 1 + if ret == "Yes": self.file_save() + return 0 + + def file_new(self, mi=None): + if self.chk_save(): return + self.text.freeze() + self.text.delete_text(0, self.text.get_length()) + self.text.thaw() + self.dirty = 0 + self.fname = None + self.set_title("Untitled") + self.new = 1 + def file_open(self, mi=None): + if self.chk_save(): return + fname = GtkExtra.file_open_box(modal=FALSE) + if not fname: return + self.load_file(fname) + def file_save(self, mi=None): + if self.new: + self.file_saveas() + return + try: + pos = 0 + length = self.text.get_length() + fd = open(self.fname, "w") + while pos < length: + buf = self.text.get_chars(pos, + min(pos+BLOCK_SIZE, length)) + if buf != None: fd.write(buf) + pos = pos + BLOCK_SIZE + self.dirty = 0 + except: + GtkExtra.message_box("Save", "Error saving file " + + self.fname, ("OK",)) + + def file_saveas(self, mi=None): + fname = GtkExtra.file_save_box(modal=FALSE) + if not fname: return + self.fname = fname + self.set_title(os.path.basename(fname)) + self.new = 0 + self.file_save() + def file_exit(self, mi=None, event=None): + if self.chk_save(): return + self.hide() + self.destroy() + if self.quit_cb: self.quit_cb(self) + def edit_cut(self, mi): + self.text.cut_clipboard(0) + def edit_copy(self, mi): + self.text.copy_clipboard(0) + def edit_paste(self, mi): + self.text.paste_clipboard(0) + def edit_clear(self, mi): + self.text.delete_selection() + # I'll implement these later + def edit_find(self, mi): pass + def edit_find_next(self, mi): pass + def help_about(self, mi): + GtkExtra.message_box("Edit Window", "Copyright (C) 1998 " + + "James Henstridge\n" + + "This program is covered by the GPL>=2", + ("OK",)) + +def edit(fname, mainwin=FALSE): + if mainwin: quit_cb = mainquit + else: quit_cb = None + w = EditWindow(quit_cb=quit_cb) + w.load_file(fname) + w.show() + w.set_usize(0,0) + if mainwin: mainloop() +if __name__ == '__main__': + import sys + edit(sys.argv[-1], mainwin=TRUE) diff --git a/examples/ide/edit.xpm b/examples/ide/edit.xpm new file mode 100644 index 00000000..a2291f36 --- /dev/null +++ b/examples/ide/edit.xpm @@ -0,0 +1,38 @@ +/* XPM */ +static char *edit[] = { +/* width height num_colors chars_per_pixel */ +" 20 22 8 1", +/* colors */ +". c #ffffff", +"# c None", +"a c #9999ff", +"b c #999999", +"c c #6666cc", +"d c #663399", +"e c #333333", +"f c #000000", +/* pixels */ +"eeeeeeeeeeeee#######", +"e..........e.e######", +"e..........e..eeffff", +"e..........e.effadf#", +"e..........effacdf##", +"e.........ffaccdff##", +"e........facccdfbf##", +"e.......faccddfbbf##", +"e......faccddf..bf##", +"e.....faccddf...bf##", +"e....faccddf....bf##", +"e...eaccddf.....bf##", +"e...facddf......bf##", +"e..eacddf.......bf##", +"e..faeff........bf##", +"e.eaeb..........bf##", +"e.feb...........bf##", +"e.fb............bf##", +"e.f.............bf##", +"e...............bf##", +"eebbbbbbbbbbbbbbef##", +"##ffffffffffffffff##" +}; + diff --git a/examples/ide/gtkcons.py b/examples/ide/gtkcons.py new file mode 100755 index 00000000..140dca93 --- /dev/null +++ b/examples/ide/gtkcons.py @@ -0,0 +1,329 @@ +#!/usr/bin/env python + +# Interactive Python-GTK Console +# Copyright (C), 1998 James Henstridge <james@daa.com.au> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# This module implements an interactive python session in a GTK window. To +# start the session, use the gtk_console command. Its specification is: +# gtk_console(namespace, title, copyright) +# where namespace is a dictionary representing the namespace of the session, +# title is the title on the window and +# copyright is any additional copyright info to print. +# +# As well as the starting attributes in namespace, the session will also +# have access to the list __history__, which is the command history. + +import sys, string, traceback +#sys.path.append('/home/james/.gimp/plug-ins') +from gtk import * + +stdout = sys.stdout + +if not hasattr(sys, 'ps1'): sys.ps1 = '>>> ' +if not hasattr(sys, 'ps2'): sys.ps2 = '... ' + +# some functions to help recognise breaks between commands +def remQuotStr(s): + '''Returns s with any quoted strings removed (leaving quote marks)''' + r = '' + inq = 0 + qt = '' + prev = '_' + while len(s): + s0, s = s[0], s[1:] + if inq and (s0 != qt or prev == '\\'): + prev = s0 + continue + prev = s0 + if s0 in '\'"': + if inq: + inq = 0 + else: + inq = 1 + qt = s0 + r = r + s0 + return r + +def bracketsBalanced(s): + '''Returns true iff the brackets in s are balanced''' + s = filter(lambda x: x in '()[]{}', s) + stack = [] + brackets = {'(':')', '[':']', '{':'}'} + while len(s) != 0: + if s[0] in ")]}": + if len(stack) != 0 and brackets[stack[-1]] == s[0]: + del stack[-1] + else: + return 0 + else: + stack.append(s[0]) + s = s[1:] + return len(stack) == 0 + +class gtkoutfile: + '''A fake output file object. It sends output to a TK test widget, + and if asked for a file number, returns one set on instance creation''' + def __init__(self, w, fn, font): + self.__fn = fn + self.__w = w + self.__font = font + def close(self): pass + flush = close + def fileno(self): return self.__fn + def isatty(self): return 0 + def read(self, a): return '' + def readline(self): return '' + def readlines(self): return [] + def write(self, s): + #stdout.write(str(self.__w.get_point()) + '\n') + self.__w.freeze() + self.__w.insert(self.__font, self.__w.fg, + self.__w.bg, s) + self.__w.thaw() + self.__w.queue_draw() + def writelines(self, l): + self.__w.freeze() + for s in l: self.__w.insert(self.__font, + self.__w.fg, self.__w.bg, s) + self.__w.thaw() + self.__w.queue_draw() + def seek(self, a): raise IOError, (29, 'Illegal seek') + def tell(self): raise IOError, (29, 'Illegal seek') + truncate = tell + +class Console(GtkVBox): + def __init__(self, namespace={}, copyright='', quit_cb=None): + GtkVBox.__init__(self, spacing=2) + self.border_width(2) + self.copyright = copyright + #self.set_usize(475, 300) + + self.quit_cb = quit_cb + + #load the fonts we will use + self.normal = load_font( + "-*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*") + self.title = load_font( + "-*-helvetica-bold-r-normal-*-*-100-*-*-*-*-*-*") + self.error = load_font( + "-*-helvetica-medium-o-normal-*-12-100-*-*-*-*-*-*") + self.command = load_font( + "-*-helvetica-bold-r-normal-*-*-100-*-*-*-*-*-*") + + self.inp = GtkHBox() + self.pack_start(self.inp) + self.inp.show() + + self.text = GtkText() + self.text.set_editable(FALSE) + self.text.set_word_wrap(TRUE) + self.text.set_usize(500, 400) + self.inp.pack_start(self.text, padding=1) + self.text.show() + + self.vscroll = GtkVScrollbar(self.text.get_vadjustment()) + self.vscroll.set_update_policy(POLICY_AUTOMATIC) + self.inp.pack_end(self.vscroll, expand=FALSE) + self.vscroll.show() + + self.inputbox = GtkHBox(spacing=2) + self.pack_end(self.inputbox, expand=FALSE) + self.inputbox.show() + + self.prompt = GtkLabel(sys.ps1) + self.prompt.set_padding(xp=2, yp=0) + self.prompt.set_usize(26, -1) + self.inputbox.pack_start(self.prompt, fill=FALSE, expand=FALSE) + self.prompt.show() + + self.closer = GtkButton("Close") + self.closer.connect("clicked", self.quit) + self.inputbox.pack_end(self.closer, fill=FALSE, expand=FALSE) + self.closer.show() + + self.line = GtkEntry() + self.line.set_usize(400,-1) + self.line.connect("key_press_event", self.key_function) + self.inputbox.pack_start(self.line, padding=2) + self.line.show() + + # now let the text box be resized + self.text.set_usize(0, 0) + self.line.set_usize(0, -1) + + self.namespace = namespace + + self.cmd = '' + self.cmd2 = '' + + # set up hooks for standard output. + self.stdout = gtkoutfile(self.text, sys.stdout.fileno(), + self.normal) + self.stderr = gtkoutfile(self.text, sys.stderr.fileno(), + self.error) + + # set up command history + self.history = [''] + self.histpos = 0 + self.namespace['__history__'] = self.history + + def init(self): + self.text.realize() + self.text.style = self.text.get_style() + self.text.fg = self.text.style.fg[STATE_NORMAL] + self.text.bg = self.text.style.white + + self.text.insert(self.title, self.text.fg, + self.text.bg, 'Python %s\n%s\n\n' % + (sys.version, sys.copyright) + + 'Interactive Python-GTK Console - ' + + 'Copyright (C) 1998 James Henstridge\n\n' + + self.copyright + '\n') + self.line.grab_focus() + + def quit(self, *args): + self.hide() + self.destroy() + if self.quit_cb: self.quit_cb() + + def key_function(self, entry, event): + if event.keyval == GDK.Return: + self.line.emit_stop_by_name("key_press_event") + self.eval() + if event.keyval == GDK.Tab: + self.line.emit_stop_by_name("key_press_event") + self.line.append_text('\t') + idle_add(self.focus_text) + elif event.keyval in (GDK.KP_Up, GDK.Up): + self.line.emit_stop_by_name("key_press_event") + self.historyUp() + idle_add(self.focus_text) + elif event.keyval in (GDK.KP_Down, GDK.Down): + self.line.emit_stop_by_name("key_press_event") + self.historyDown() + idle_add(self.focus_text) + elif event.keyval in (GDK.D, GDK.d) and \ + event.state & GDK.CONTROL_MASK: + self.line.emit_stop_by_name("key_press_event") + self.ctrld() + + def focus_text(self): + self.line.grab_focus() + return FALSE # don't requeue this handler + + def ctrld(self): + self.quit() + + def historyUp(self): + if self.histpos > 0: + l = self.line.get_text() + if len(l) > 0 and l[0] == '\n': l = l[1:] + if len(l) > 0 and l[-1] == '\n': l = l[:-1] + self.history[self.histpos] = l + self.histpos = self.histpos - 1 + self.line.set_text(self.history[self.histpos]) + + def historyDown(self): + if self.histpos < len(self.history) - 1: + l = self.line.get_text() + if len(l) > 0 and l[0] == '\n': l = l[1:] + if len(l) > 0 and l[-1] == '\n': l = l[:-1] + self.history[self.histpos] = l + self.histpos = self.histpos + 1 + self.line.set_text(self.history[self.histpos]) + + def eval(self): + l = self.line.get_text() + '\n' + if len(l) > 1 and l[0] == '\n': l = l[1:] + self.histpos = len(self.history) - 1 + if len(l) > 0 and l[-1] == '\n': + self.history[self.histpos] = l[:-1] + else: + self.history[self.histpos] = l + self.line.set_text('') + self.text.freeze() + self.text.insert(self.command, self.text.fg, self.text.bg, + self.prompt.get() + l) + self.text.thaw() + if l == '\n': + self.run(self.cmd) + self.cmd = '' + self.cmd2 = '' + return + self.histpos = self.histpos + 1 + self.history.append('') + self.cmd = self.cmd + l + self.cmd2 = self.cmd2 + remQuotStr(l) + l = string.rstrip(l) + if not bracketsBalanced(self.cmd2) or l[-1] == ':' or \ + l[-1] == '\\' or l[0] in ' \11': + self.prompt.set(sys.ps2) + self.prompt.queue_draw() + return + self.run(self.cmd) + self.cmd = '' + self.cmd2 = '' + + def run(self, cmd): + sys.stdout, self.stdout = self.stdout, sys.stdout + sys.stderr, self.stderr = self.stderr, sys.stderr + try: + try: + r = eval(cmd, self.namespace, self.namespace) + if r is not None: + print `r` + except SyntaxError: + exec cmd in self.namespace + except: + if hasattr(sys, 'last_type') and \ + sys.last_type == SystemExit: + self.quit() + else: + traceback.print_exc() + self.prompt.set(sys.ps1) + self.prompt.queue_draw() + adj = self.text.get_vadjustment() + adj.set_value(adj.upper - adj.page_size) + sys.stdout, self.stdout = self.stdout, sys.stdout + sys.stderr, self.stderr = self.stderr, sys.stderr + +def gtk_console(ns, title='Python', copyright='', menu=None): + win = GtkWindow() + win.set_usize(475, 300) + win.connect("destroy", mainquit) + win.connect("delete_event", mainquit) + win.set_title(title) + cons = Console(namespace=ns, copyright=copyright, quit_cb=mainquit) + if menu: + box = GtkVBox() + win.add(box) + box.show() + box.pack_start(menu, expand=FALSE) + menu.show() + box.pack_start(cons) + else: + win.add(cons) + cons.show() + win.show() + win.set_usize(0,0) + cons.init() + mainloop() + +if __name__ == '__main__': + gtk_console({'__builtins__': __builtins__, '__name__': '__main__', + '__doc__': None}) + diff --git a/examples/ide/gtkdb.py b/examples/ide/gtkdb.py new file mode 100755 index 00000000..6874d34b --- /dev/null +++ b/examples/ide/gtkdb.py @@ -0,0 +1,350 @@ +#!/usr/bin/env python + +import sys +import bdb +import repr +import string +import linecache # for linecache.getlines(filename) +from gtk import * +import GtkExtra + +class GtkDb(GtkWindow, bdb.Bdb): + def __init__(self): + GtkWindow.__init__(self) + bdb.Bdb.__init__(self) + self.realize() + + self.set_title("GtkDb") + self.connect("destroy", self.do_quit) + self.connect("delete_event", self.do_quit) + + self.box = GtkVBox() + self.add(self.box) + self.box.show() + + toolbar = GtkToolbar(ORIENTATION_HORIZONTAL, TOOLBAR_BOTH) + toolbar.set_space_size(10) + self.box.pack_start(toolbar, expand=FALSE) + toolbar.show() + + toolbar.append_item("next", "Next statement", None, + GtkPixmap(self, "next.xpm"), self.do_next) + toolbar.append_item("step", "Step into function", None, + GtkPixmap(self, "step.xpm"), self.do_step) + toolbar.append_space() + toolbar.append_item("return", + "Continue execution to end of function", + None, GtkPixmap(self, "return.xpm"), + self.do_return) + toolbar.append_space() + toolbar.append_item("continue", + "Continue execution to next break point", + None, GtkPixmap(self, "continue.xpm"), + self.do_continue) + toolbar.append_item("break", + "toggle break point at selected line",None, + GtkPixmap(self,"break.xpm"),self.do_break) + toolbar.append_space() + toolbar.append_item("edit", + "edit the value of the selected variable", + None, GtkPixmap(self, "edit.xpm"), + self.do_edit) + toolbar.append_item("run", + "Execute some code in the current stack context", + None, GtkPixmap(self, "run.xpm"), + self.do_run) + toolbar.append_space() + toolbar.append_item("quit", "Quit the debugger", None, + GtkPixmap(self, "quit.xpm"), self.do_quit) + + sep = GtkHSeparator() + self.box.pack_start(sep, expand=FALSE) + sep.show() + + vpane = GtkVPaned() + self.box.pack_start(vpane) + vpane.show() + + hpane = GtkHPaned() + vpane.add1(hpane) + hpane.show() + + self.stackdisp = GtkCList(1, ['Stack Frame']) + self.stackdisp.connect("select_row", self.update_curstack) + self.stackdisp.set_usize(280, 125) + self.stackdisp.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) + self.stackdisp.set_selection_mode(SELECTION_BROWSE) + self.stackdisp.border_width(2) + hpane.add1(self.stackdisp) + self.stackdisp.show() + + self.vardisp = GtkCList(3, ['local var', 'type', 'value']) + self.vardisp.connect("select_row", self.update_selectedvar) + self.vardisp.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) + self.vardisp.set_selection_mode(SELECTION_BROWSE) + self.vardisp.set_column_width(0, 75) + self.vardisp.set_column_width(1, 30) + self.vardisp.border_width(2) + hpane.add2(self.vardisp) + self.vardisp.show() + self.vardisp.selected = 0 + self.vardisp.varnames = [] + + self.filedisp = GtkCList(3, ['break', 'lineno', 'line']) + self.minibreak = GtkPixmap(self, "minibreak.xpm") + # This is giving a warning -- probably a bug in GTK + self.filedisp.set_column_widget(0, self.minibreak) + self.filedisp.column_titles_show() + self.filedisp.set_column_width(0, 14) + self.filedisp.set_column_width(1, 35) + self.filedisp.connect("select_row", self.update_selection) + self.filedisp.set_column_justification(1, JUSTIFY_RIGHT) + self.filedisp.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) + self.filedisp.set_selection_mode(SELECTION_BROWSE) + self.filedisp.border_width(2) + self.filedisp.set_usize(600, 200) + vpane.add2(self.filedisp) + self.filedisp.show() + + separator = GtkHSeparator() + self.box.pack_start(separator, expand=FALSE) + separator.show() + + align = GtkAlignment(0.0, 0.5, 0.0, 0.0) + self.box.pack_start(align, expand=FALSE) + align.show() + self.status = GtkLabel() + self.status.set_padding(4, 1) + align.add(self.status) + self.status.show() + + self.filename = None + self.selected = 0 + self.blockupdate = 0 + + def set_status(self, str): + self.status.set(str) + + def update_selection(self, clist, r, c, event): + if self.blockupdate: return + self.selected = r + 1 + if c == 0: # break point column + self.do_break() + + def update_curstack(self, clist, r, c, event): + if self.blockupdate: return + self.curindex = r + self.curframe = self.stack[self.curindex][0] + self.lineno = None + self.update_code_listing() + self.update_var_listing() + + def update_selectedvar(self, clist, r, c, event): + self.vardisp.selected = r + + def set_quit(self): + self.hide() + self.destroy() + bdb.Bdb.set_quit(self) + + def reset(self): + bdb.Bdb.reset(self) + self.forget() + def forget(self): + self.lineno = None + self.stack = [] + self.curindex = 0 + self.curframe = None + def setup(self, f, t): + self.forget() + self.stack, self.curindex = self.get_stack(f, t) + self.curframe = self.stack[self.curindex][0] + + # interaction functions -- overriden from bdb + def user_line(self, frame): + # called when we stop or break at this line + self.interaction(frame, None) + def user_return(self, frame, return_value): + # called when a return trap is set here + frame.f_locals['__return__'] = return_value + if frame.f_code.co_name: + func = frame.f_code.co_name + else: + func = "<lambda>" + self.set_status(func + " rerturned " + repr.repr(return_value)) + self.interaction(frame, None) + def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): + frame.f_locals['__exception__'] = exc_type, exc_value + if type(exc_type) == type(''): + exc_type_name = exc_type + else: exc_type_name = exc_type.__name__ + self.set_status(exc_type_name + ':' + repr.repr(exc_value)) + self.interaction(frame, exc_traceback) + + def interaction(self, frame, traceback): + self.setup(frame, traceback) + self.update_stack_listing(self.curindex) + mainloop() + self.forget() + + def update_stack_listing(self, curindex): + self.stackdisp.freeze() + self.blockupdate = 1 + self.stackdisp.clear() + for i in range(len(self.stack)): + frame_lineno = self.stack[i] + row = self.format_stack_entry(frame_lineno, "##!##") + row = string.split(row, "##!##")[0] + self.stackdisp.append([row]) + self.blockupdate = 0 + self.stackdisp.moveto(curindex, 0, 1.0, 0.0) + self.stackdisp.select_row(curindex, 0) + self.stackdisp.thaw() + + def update_var_listing(self): + self.vardisp.freeze() + self.vardisp.clear() + locals = self.curframe.f_locals + self.vardisp.varnames = locals.keys() + self.vardisp.varnames.sort() + for var in self.vardisp.varnames: + row = [var, type(locals[var]).__name__, repr.repr( + locals[var])] + self.vardisp.append(row) + self.vardisp.thaw() + + def update_code_listing(self): + frame = self.curframe + newfile = frame.f_code.co_filename + if newfile != self.filename: + lines = linecache.getlines(newfile) + self.filename = newfile + self.filedisp.freeze() + self.blockupdate = 1 + self.filedisp.clear() + breaks = self.get_file_breaks(newfile) + for line in range(len(lines)): + self.filedisp.append(['', repr.repr(line+1), + lines[line]]) + if line+1 in breaks: + self.filedisp.set_pixmap(line, 0, + self.minibreak) + self.blockupdate = 0 + self.filedisp.thaw() + self.selected = frame.f_lineno + lineno = self.selected + self.filedisp.moveto(lineno - 1, 2) + self.filedisp.select_row(lineno - 1, 2) + + def do_next(self, _b=None): + self.set_next(self.curframe) + mainquit() + def do_step(self, _b=None): + self.set_step() + mainquit() + def do_return(self, _b=None): + self.set_return(self.curframe) + mainquit() + def do_continue(self, _b=None): + self.set_continue() + mainquit() + def do_quit(self, _b=None, _e=None): + self.set_quit() + mainquit() + def do_break(self, _b=None): + breaks = self.get_file_breaks(self.filename) + if self.selected in breaks: + err = self.clear_break(self.filename, self.selected) + if err: + self.set_status(err) + return + self.filedisp.set_text(self.selected-1, 0, ' ') + else: + err = self.set_break(self.filename, self.selected) + if err: + self.set_status(err) + return + self.filedisp.set_pixmap(self.selected-1, 0, + self.minibreak) + def do_run(self, _b=None): + line = GtkExtra.input_box("Execute Code", + "Enter code to execute:") + if line == None: return + locals = self.curframe.f_locals + globals = self.curframe.f_globals + globals['__privileged__'] = 1 + try: + code = compile(line + '\n', '<stdin>', 'single') + exec code in globals, locals + except: + if type(sys.exc_type) == type(''): + exc_type_name = sys.exc_type + else: exc_type_name = sys.exc_type.__name__ + self.set_status('*** ' + exc_type_name + ': ' + + str(sys.exc_value)) + return + self.update_var_listing() + + def do_edit(self, _b=None): + locals = self.curframe.f_locals + varname = self.vardisp.varnames[self.vardisp.selected] + val = repr.repr(locals[varname]) + value = GtkExtra.input_box("Edit Variable", + "Enter new value for" + varname + ":", val) + if value == None: return + globals = self.curframe.f_globals + globals['__privileged__'] = 1 + try: + val = eval(value, globals, locals) + self.curframe.f_locals[varname] = val + except: + if type(sys.exc_type) == type(''): + exc_type_name = sys.exc_type + else: exc_type_name = sys.exc_type.__name__ + self.set_status('*** ' + exc_type_name + ': ' + + str(sys.exc_value)) + return + row = self.vardisp.selected + self.vardisp.set_text(row, 1, type(val).__name__) + self.vardisp.set_text(row, 2, repr.repr(val)) + +# this makes up the interface that is compatible with pdb. +def run(statement, globals=None, locals=None): + win = GtkDb() + win.show() + win.run(statement, globals, locals) + +def runeval(expression, globals=None, locals=None): + win = GtkDb() + win.show() + return win.runeval(expression, globals, locals) + +def runcall(*args): + win = GtkDb() + win.show() + return apply(win.runcall, args) + +def set_trace(): + win = GtkDb() + win.show() + win.set_trace() + +def post_mortem(traceback): + win = GtkDb() + win.show() + win.reset() + win.interaction(None, traceback) + +def pm(): + post_mortem(sys.last_traceback) + +if __name__ == '__main__': + import os + if not sys.argv[1:]: + print "usage: gtkdb.py scriptfile [args ...]" + sys.exit(2) + filename = sys.argv[1] + del sys.argv[0] # delete gtkdb.py + sys.path.insert(0, os.path.dirname(filename)) + + run('execfile("' + filename + '")', {'__name__': '__main__'}) diff --git a/examples/ide/gtkprof.py b/examples/ide/gtkprof.py new file mode 100755 index 00000000..c005e166 --- /dev/null +++ b/examples/ide/gtkprof.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python + +import profile, pstats, fpformat + +from gtk import * + +class PStatWindow(GtkWindow): + def __init__(self, stats): + GtkWindow.__init__(self) + self.connect("destroy", self.quit) + self.connect("delete_event", self.quit) + self.set_title("Profile Statistics") + + self.stats = stats + + box1 = GtkVBox() + self.add(box1) + box1.show() + + text = `stats.total_calls` + " function calls " + if stats.total_calls != stats.prim_calls: + text = text + "( " + `stats.prim_calls` + \ + " primitive calls) " + text = text + "in " + fpformat.fix(stats.total_tt, 3) + \ + " CPU seconds" + label = GtkLabel(text) + label.set_padding(2, 2) + box1.pack_start(label, expand=FALSE) + label.show() + + titles = ['ncalls', 'tottime', 'percall', 'cumtime', + 'percall', 'filename:lineno(function)'] + clist = GtkCList(len(titles), titles) + clist.set_column_width(0, 40) + clist.set_column_width(1, 50) + clist.set_column_width(2, 50) + clist.set_column_width(3, 50) + clist.set_column_width(4, 50) + clist.set_usize(500, 200) + clist.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC) + self.clist = clist + clist.border_width(10) + box1.pack_start(clist) + clist.show() + + for i in range(5): + clist.set_column_justification(i, JUSTIFY_RIGHT) + + self.insert_stats() + + separator = GtkHSeparator() + box1.pack_start(separator, expand=FALSE) + separator.show() + + box2 = GtkVBox(spacing=10) + box2.border_width(10) + box1.pack_start(box2, expand=FALSE) + box2.show() + + button = GtkButton("close") + button.connect("clicked", self.quit) + self.close_button = button + box2.pack_start(button) + button.set_flags(CAN_DEFAULT) + button.grab_default() + button.show() + + def quit(self, *args): + self.hide() + self.destroy() + mainquit() + + def get_stats_list(self): + if self.stats.fcn_list: + return self.stats.fcn_list[:] + else: + return sekf.stats.stats.keys() + + def insert_stats(self): + list = self.get_stats_list() + if list: + row = [None] * 6 + self.clist.clear() + self.clist.freeze() + for func in list: + cc,nc,tt,ct,callers = self.stats.stats[func] + row[0] = `nc` + if nc != cc: + row[0] = row[0] + '/' + `cc` + row[1] = fpformat.fix(tt, 3) + if nc == 0: + row[2] = '' + else: + row[2] = fpformat.fix(tt/nc, 3) + row[3] = fpformat.fix(ct, 3) + if cc == 0: + row[4] = '' + else: + row[4] = fpformat.fix(ct/cc, 3) + file,line,name = func + row[5] = file + ":" + `line` + "(" + name + \ + ")" + self.clist.append(row) + self.clist.thaw() + + +def run(cmd): + prof = profile.Profile() + try: + stats = pstats.Stats(prof.run(cmd)) + except SystemExit: + pass + stats.strip_dirs().sort_stats("time", "module", "name") + win = PStatWindow(stats) + win.show() + mainloop() + +def run_file(file): + return run('execfile("' + file + '")') + + +if __name__ == '__main__': + import sys, os + if not sys.argv[1:]: + print "usage: gtkprof.py scriptfile [args ...]" + sys.exit(2) + filename = sys.argv[1] + del sys.argv[0] + sys.path.insert(0, os.path.dirname(filename)) + + run_file(filename) + + diff --git a/examples/ide/minibreak.xpm b/examples/ide/minibreak.xpm new file mode 100644 index 00000000..6fd11e7c --- /dev/null +++ b/examples/ide/minibreak.xpm @@ -0,0 +1,19 @@ +/* XPM */ +static char * minibreak_xpm[] = { +"12 12 4 1", +" c None", +". c #000000", +"X c #FF0000", +"o c #FFFFFF", +" ...... ", +" .oooooo. ", +" .ooXXXXoo. ", +".ooXXXXXXoo.", +".oXXXXXXXXo.", +".oXXXXXXXXo.", +".oXXXXXXXXo.", +".oXXXXXXXXo.", +".ooXXXXXXoo.", +" .ooXXXXoo. ", +" .oooooo. ", +" ...... "}; diff --git a/examples/ide/next.xpm b/examples/ide/next.xpm new file mode 100644 index 00000000..6c0cf361 --- /dev/null +++ b/examples/ide/next.xpm @@ -0,0 +1,32 @@ +/* XPM */ +static char *next[] = { +/* width height num_colors chars_per_pixel */ +" 20 22 2 1", +/* colors */ +". c None", +"# c #000000", +/* pixels */ +"....................", +"....................", +"......#.............", +"......##............", +"......###...........", +"......####..........", +"......#####.........", +"......######........", +"......#######.......", +"......########......", +"......#########.....", +"......#########.....", +"......########......", +"......#######.......", +"......######........", +"......#####.........", +"......####..........", +"......###...........", +"......##............", +"......#.............", +"....................", +"...................." +}; + diff --git a/examples/ide/pyide.py b/examples/ide/pyide.py new file mode 100755 index 00000000..545ec4cd --- /dev/null +++ b/examples/ide/pyide.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python + +from gtk import * +import GtkExtra +import gtkcons, gtkdb, gtkprof, edit +import os, sys, string + +# select a good VT emulator +for vt in 'Eterm', 'nxterm', 'xterm-color', 'xterm', 'rxvt': + for dirname in string.split(os.environ['PATH'], os.pathsep): + fullname = os.path.join(dirname, vt) + if os.path.exists(fullname): + VT_CMD = fullname + ' -geometry 80x6 -e ' + break + else: + continue + break +else: + VT_CMD='' # this is not ideal + +class Application(GtkWindow): + def __init__(self): + GtkWindow.__init__(self, WINDOW_TOPLEVEL) + self.connect("destroy", self.quit) + self.connect("delete_event", self.quit) + self.set_title("Python") + self.set_usize(475, 325) + self.main_box = GtkVBox() + self.add(self.main_box) + self.main_box.show() + hdlbox = GtkHandleBox() + self.main_box.pack_start(hdlbox, expand=FALSE) + hdlbox.show() + mf = GtkExtra.MenuFactory() + mf.add_entries([ + ('File/New', '<control>N', self.file_new), + ('File/Open...', '<control>O', self.file_open), + ('File/<separator>', None, None), + ('File/Exit', '<control>Q', self.file_exit), + ('Edit/Copy', '<control>C', self.edit_copy), + ('Edit/Paste', '<control>V', self.edit_paste), + ('Edit/Clear', None, self.edit_clear), + ('Python/Reload Module...', None, self.python_reload), + ('Python/<separator>', None, None), + ('Python/Run...', None, self.python_run), + ('Python/Debug...', None, self.python_debug), + ('Python/Profile...', None, self.python_prof), + ('Help/About...', None, self.help_about), + ]) + self.add_accel_group(mf.accelerator) + hdlbox.add(mf) + mf.show() + self.mf = mf + self.interp = gtkcons.Console( + namespace={'__builtins__': __builtins__, + '__name__': '__main__', + '__doc__': None}, quit_cb=self.quit) + self.main_box.pack_start(self.interp) + self.interp.show() + self.interp.init() + self.editwins = [] + def quit(self, *args): + for win in self.editwins: + if win.chk_save(): return + win.hide() + win.destroy() + mainquit() + + def reload_file(self, fname): + if not os.path.isfile(fname): + GtkExtra.message_box("File Not Found", fname + + " was not found.", ("OK",)) + dir = os.path.dirname(fname) + base = os.path.basename(fname) + if dir not in sys.path: sys.path.insert(0, dir) + if string.lower(base[-3:]) == '.py': base = base[:-3] + elif string.lower(base[-4:]) == '.pyc': base = base[:-4] + if not sys.modules.has_key(base): + self.interp.run('import ' + base) + else: + self.interp.run('import ' + base) + self.interp.run('reload(' + base + ')') + + # execute a python script normally or with the debugger or profiler + def run_script(self, fname): + if not fname or os.path.exists(fname): + GtkExtra.message_box("Run","Invalid filename",("OK",)) + return + args = GtkExtra.input_box("Arguments", + "Enter any command line arguments") + if args == None: return + os.system(VT_CMD+'python "'+fname+'" ' + args + ' &') + def debug_script(self, fname): + if not fname or os.path.exists(fname): + GtkExtra.message_box("Debug", "Invalid filename", + ("OK",)) + return + args = GtkExtra.input_box("Arguments", + "Enter any command line arguments") + if args == None: return + os.system(VT_CMD+'python '+gtkdb.__file__+' "'+fname+'" ' + + args + ' &') + def profile_script(self, fname): + if not fname or not os.ppath.exists(fname): + GtkExtra.message_box("Profile", "Invalid filename", + ("OK",)) + return + args = GtkExtra.input_box("Arguments", + "Enter any command line arguments") + if args == None: return + os.system(VT_CMD+'python '+gtkprof.__file__+' "'+fname+'" ' + + args + ' &') + + def add_py_menu(self, ew): + def run(b=None, ew=ew, app=self): app.run_script(ew.fname) + def dbg(b=None, ew=ew, app=self): app.debug_script(ew.fname) + def prf(b=None, ew=ew, app=self): app.profile_script(ew.fname) + py_menu = GtkExtra.MenuFactory(MENU_FACTORY_MENU) + py_menu.add_entries([ + ('Run...', None, run), + ('Debug...', None, dbg), + ('Profile...', None, prf) + ]) + mi = GtkMenuItem('Python') + ew.mf.insert(mi, 2) + mi.show() + mi.set_submenu(py_menu) + ew.mf.hide() + ew.mf.show() + + def file_new(self, mi=None): + ew = edit.EditWindow(quit_cb=self.rem_editwin) + self.editwins.append(ew) + self.add_py_menu(ew) + ew.show() + ew.set_usize(0,0) + def file_open(self, mi=None): + fname = GtkExtra.file_open_box(modal=FALSE) + if fname: + ew = edit.EditWindow(quit_cb=self.rem_editwin) + ew.load_file(fname) + self.editwins.append(ew) + self.add_py_menu(ew) + ew.show() + ew.set_usize(0,0) + def rem_editwin(self, win=None, event=None): + for i in range(len(self.editwins)): + if self.editwins[i] == win: + del self.editwins[i] + break + def file_exit(self, mi=None): + self.quit() + def edit_copy(self, mi=None): + self.interp.text.copy_clipboard(0) + def edit_paste(self, mi=None): + self.interp.line.paste_clipboard(0) + def edit_clear(self, mi=None): + self.interp.line.delete_selection() + def python_reload(self, mi=None): + print "python_reload" + def python_run(self, mi=None): + fname = GtkExtra.file_sel_box("Run") + if fname: + self.run_script(fname) + def python_debug(self, mi=None): + fname = GtkExtra.file_sel_box("Debug") + if fname: + self.debug_script(fname) + def python_prof(self, mi=None): + fname = GtkExtra.file_sel_box("Profile") + if fname: + self.profile_script(fname) + def help_about(self, mi=None): + print "help_about" + +if __name__ == '__main__': + app = Application() + app.show() + app.set_usize(0,0) + mainloop() diff --git a/examples/ide/quit.xpm b/examples/ide/quit.xpm new file mode 100644 index 00000000..11d0bb01 --- /dev/null +++ b/examples/ide/quit.xpm @@ -0,0 +1,36 @@ +/* XPM */ +static char *quit[] = { +/* width height num_colors chars_per_pixel */ +" 20 22 6 1", +/* colors */ +". c #ffcc33", +"# c None", +"a c #996600", +"b c #666666", +"c c #333333", +"d c #000000", +/* pixels */ +"####################", +"####################", +"####################", +"########d####d######", +"#######dad##dd###dd#", +"#######d.addaad#dad#", +"######da......dda.d#", +"#dddddd..........ad#", +"da...............dc#", +"cda..............dc#", +"#cd..............ad#", +"##d...............ad", +"#da.............addc", +"#d.............ddcc#", +"da.............dc###", +"dddd...........ad###", +"#ccd........adaad###", +"###d..da....dcddd###", +"###dbdcda...c#ccc###", +"###cdc#ccdadc#######", +"####c###ccdc########", +"##########c#########" +}; + diff --git a/examples/ide/return.xpm b/examples/ide/return.xpm new file mode 100644 index 00000000..a908f597 --- /dev/null +++ b/examples/ide/return.xpm @@ -0,0 +1,35 @@ +/* XPM */ +static char *return[] = { +/* width height num_colors chars_per_pixel */ +" 20 22 5 1", +/* colors */ +". c None", +"# c #999999", +"a c #666666", +"b c #333333", +"c c #000000", +/* pixels */ +"....................", +"..............c.....", +"..............cc....", +".........#bcccccc...", +".....#bccccccccccc..", +"..#bccccccccccccccc.", +".acccccccccccccccccc", +"#cccccccccccccccccc.", +"bccccccccccccccccc..", +"ccccccccccccccccc...", +"cccccccccb#...cc....", +"ccccccb#......c.....", +"cccb#..b............", +"cc..bbbbbb..........", +"c.bbbbbbbb.a........", +"bbbbbbbbbbb#........", +".bbbbbbbbb.a........", +"..bbbbbbbbb#........", +"...bbbbbbb.a........", +".....bbbbbb#........", +"........bb.a........", +"...................." +}; + diff --git a/examples/ide/run.xpm b/examples/ide/run.xpm new file mode 100644 index 00000000..fbfb4ed8 --- /dev/null +++ b/examples/ide/run.xpm @@ -0,0 +1,28 @@ +/* XPM */ +static char * run_xpm[] = { +"20 22 3 1", +" c None", +". c #000000", +"X c #C00080", +" ", +" ", +" .... ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XXXX. ", +" .XX. ", +" .XX. ", +" .XX. ", +" .XX. ", +" .. ", +" .. ", +" .. ", +" .. ", +" ", +" .. ", +" .XX. ", +" .XX. ", +" .. ", +" ", +" "}; diff --git a/examples/ide/step.xpm b/examples/ide/step.xpm new file mode 100644 index 00000000..4e5c7bb3 --- /dev/null +++ b/examples/ide/step.xpm @@ -0,0 +1,35 @@ +/* XPM */ +static char *forward[] = { +/* width height num_colors chars_per_pixel */ +" 20 22 5 1", +/* colors */ +". c None", +"# c #999999", +"a c #666666", +"b c #333333", +"c c #000000", +/* pixels */ +"....................", +"........bb.a........", +".....bbbbbb#........", +"...bbbbbbb.a........", +"..bbbbbbbbb#........", +".bbbbbbbbb.a........", +"bbbbbbbbbbb#........", +"c.bbbbbbbb.a........", +"cc..bbbbbb..........", +"cccb#..b............", +"ccccccb#......c.....", +"cccccccccb#...cc....", +"ccccccccccccccccc...", +"bccccccccccccccccc..", +"#cccccccccccccccccc.", +".acccccccccccccccccc", +"..#bccccccccccccccc.", +".....#bccccccccccc..", +".........#bcccccc...", +"..............cc....", +"..............c.....", +"...................." +}; + |