Spe 0.4.0.d Python IDE for Blender

Spe 0.3.0.a

Spe is a python IDE with auto-indentation, auto completion, call tips, syntax coloring, syntax highlighting, class explorer, source index, auto todo list, sticky notes, integrated pycrust shell, python file browser, recent file browser, drag&drop, context help, … Special is its blender support with a blender 3d object browser and its ability to run interactively inside blender. Spe is extensible with boa.

:Links:

Spe now ships with a minimal preference dialog box, which will be
further extended. The most important editor settings can now be set, so
spe can now also be used by those who prefer tabs instead of spaces.
I’m afraid spe will fail to work with Python 2.2.1, so please upgrade!

:Batteries included:

  • Kiki:
    Regular Expression (regex) console. Altough still a pre-alpha
    release, it might be already usefull. For more info: http://project5.tk
  • wxGlade:
    wxGlade is a GUI designer written in Python with the
    popular GUI toolkit wxPython, that helps you create
    wxWindows/wxPython user interfaces. As you can guess by the
    name, its model is Glade, the famous GTK+/GNOME GUI builder,
    with which wxGlade shares the philosophy and the look & feel
    (but not a line of code). For more info:
    http://wxglade.sourceforge.net

:New features:
- preference dialog

:Fixes:
- sm.zfill fix
- options of find tab now work
- find tab layout fixed for Linux
- no syntax check on python files

:Requirements:
- full python_ 2.3 or 2.2.2 (updated!)
- wxpython_ 2.4.1.2
- optional blender_ 2.28c

:Wanted:
- people to help implementing new features, documenting, …

:Contributors:
- Tina Hirsch

oke… gonna try this once more. today or tomorrow. cu

spe-0.2.0.b (minor bugfix release) is already out!

I guess you mean 0.3.0b… :). Ye I recognized, but didnt write.

EDIT
btw… were you able to fix the bug I told? -> I cant use blender while spe is open (if started from blender)

That’s not a bug of spe. Blender always blocks when a python script is running. I think stani answered this already and wrote this also somewhere in the docs, though I can’t find it anymore.

ow sorry. thx

Thanks Cevina for your help. This is the fragment of the documentation:

When spe is active, the Blender screen will always be redrawn automatically. So the results of any command you type in the interactive shell or of any program you run within spe, will be visible in the Blender window. Unfortunately it is not possible to interact with Blender directly when Spe is active. So it is impossible to rotate for example the view with the mouse. (Maybe one time the python development team could solve this issue and let run blender and spe in parallel. However this might be an illusion.)

Well, I posted the issue on the Blender Python developpers mailing list, so they’ll let me know if there is a solution.

Stani

oke… new problem. pressing B-KEY in blenpy crashes the script. the console says the following.

bash-2.05b# ./blender
Using a clean Global Dictionary.
This module must be run within Blender
Traceback (most recent call last):
  File "/usr/lib/python2.2/site-packages/blenpy/gui.py", line 81, in _key
    if key in self._keys.keys():self._keys[key](val)
TypeError: dirAsk() takes exactly 1 argument (2 given)

I tried it with python 2.3, blender 2.28c, linux.

Thanks, I fixed it. If you don’t want to wait for the next release change in the file blenpy\pyGui.py the code on line 537 into:

    def dirAsk(self,arg=None):
        """Pops up a dialog to ask for a directory."""
        dir=self.value['dirEdit'].val.strip()
        if dir in ['','...']:dir=self.workingDir
        dir=askdirectory(dir,title='Choose Python script directory...')
        if dir:
            self.value['dirEdit'].val=str(dir)
            self.dirAdd()

More bug reports are always welcome :smiley:
Stani

kewl :smiley: I started to think Im n00bykewby (<- senseless word…).

new one :slight_smile: I edited pyGui…

Using a clean Global Dictionary.
This module must be run within Blender
No module named _tkinter:
Import can't find module, or can't find name in module.

Traceback (most recent call last):
  File "/usr/lib/python2.2/site-packages/blenpy/gui.py", line 81, in _key
    if key in self._keys.keys():self._keys[key](val)
  File "/usr/lib/python2.2/site-packages/blenpy/pyGui.py", line 541, in dirAsk
    dir=askdirectory(dir,title='Choose Python script directory...')
  File "/usr/lib/python2.2/site-packages/sm/tk.py", line 42, in askdirectory
    return _showDialog(tkFileDialog.askdirectory,title=title,
UnboundLocalError: local variable 'tkFileDialog' referenced before assignment

and another one. pressing g,f,h for any help starts mozilla… which is okay. but the site is not correct. it shows my home site. no outputs…

new one I edited pyGui…

This is not a blenpy bug, but it seems that you don’t have the complete tkinter installation. It is strange because you have the full Python installation, no? This comes from the python documentation:

Most of the time, the Tkinter module is all you really need, but a number of additional modules are available as well. The Tk interface is located in a binary module named _tkinter. This module contains the low-level interface to Tk, and should never be used directly by application programmers. It is usually a shared library (or DLL), but might in some cases be statically linked with the Python interpreter.
tkFileDialog
Common dialogs to allow the user to specify a file to open or save.

pressing g,f,h for any help starts mozilla… which is okay. but the site is not correct. it shows my home site. no outputs…

Strange because for me it works correctly (Windows XP,Python2.2.2) Can you tell me the outcome of the following code if you type it in a Blender text window and than you press Alt+P:

import os,blenpy
print os.path.dirname(blenpy.__file__)

The code for the g,f,h key presses is in blenpy\plugins ools.py line 63 Change it into the following code and tell me the outcome…

def help(keyDown=0):
    """Blenpy Help@G"""
    # TODO:launchHelp
    if not keyDown:
        print 'Trying to open: %s\\doc\\help.rtf'%BLENPY_PATH
        webbrowser.open('%s\\doc\\help.rtf'%BLENPY_PATH,1)

1st
oke… the outcome of

import os,blenpy
print os.path.dirname(blenpy.__file__)
Using a clean Global Dictionary.
/usr/lib/python2.2/site-packages/blenpy

this dir exists and contains the following (as assumed)

bash-2.05b# ls -l
total 206
-rw-r--r--    1 root     root          855 Oct  2 18:15 __init__.py
-rw-r--r--    1 root     root          947 Oct  3 00:10 __init__.pyc
-rw-r--r--    1 root     root           46 Sep  9 15:35 blenpy_changes.txt
-rw-r--r--    1 root     root        42828 May 12 08:47 demo.blend
drwxr-xr-x    3 root     root          224 Sep 28 18:42 doc
-rw-r--r--    1 root     root         9859 Oct  2 18:15 gui.py
-rw-r--r--    1 root     root        13724 Oct  3 00:10 gui.pyc
drwxr-xr-x    2 root     root          256 Sep 28 18:42 icons
-rw-r--r--    1 root     root        35692 May 12 20:36 new.blend
drwxr-xr-x    2 root     root          472 Oct  3 00:10 plugins
-rw-r--r--    1 root     root        37296 Oct  3 01:11 pyGui.py
-rw-r--r--    1 root     root        41657 Oct  3 01:12 pyGui.pyc

2nd
same again. no outputs, just mozilla with my homesite.

tkinter
now to the module Tkinter:

&gt;&gt;&gt; import Tkinter
&gt;&gt;&gt; print dir('Tkinter')
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__repr__', '__rmul__', '__setattr__', '__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

it works. sometimes… here’s another one. (it works from time to time)

&gt;&gt;&gt; import Tkinter
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in ?
  File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 35, in ?
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

btw I just recognized :slight_smile: my pversion is not 2.3… its 2.2.3. here is the python output

Python 2.2.3 (#1, Jul 31 2003, 13:46:05)
[GCC 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

maybe this was a bit too much :). but hope that will help you…
cu

EDIT
shall I install another python version?

About 2nd:
Same problem here. I’ll try to find out the reason.

About tkinter:
I use also gentoo with the same gcc and python version, but tkinter works without probs. When does it not work? Randomly or when you use python in the bash or in spe or …?
Hm, do you have dev-lang/tk installed - especially at compilation time of python (USE-flag tcltk)? Check if you have the file /usr/lib/python2.2/lib-dynload/_tkinter.so
If it’s missing you need to recompile python with tcltk enabled.
Though in this case I don’t understand why ‘import Tkinter’ works sometimes??

Solution to browser prob:
e.g. line 71 from blenpy/tools.py:

if not keyDown:webbrowser.open('file://%s/doc/blenpy.html'%BLENPY_PATH,1)

i.e. urls use slashes not backslashes, and “file://” was missing.
Another problem is help.rtf. mozilla cannot display it - maybe convert it to html too?

rocks :slight_smile: I’m gonna try this now. cu

EDIT
browser thing works… that’s right! now the tkinter

EDIT2
compiling with tcltk flag. a emerge --pretend told me the packages tk and tcl are new :slight_smile: so this will work I guess. maybe an edit3 later :slight_smile:

EDIT3*
it works :smiley: very kewl. I gotta say!

Haha, it was good I was on holiday, so you could it solve it yourself. I’ll update the path for the browser. Chimera, could you put a link to spe&blenpy somewhere on your site?
Thanks,
Stani

though there arent many visitors there… yes sure :). and a small tutorial maybe.

and a small tutorial maybe

That would be great! I can always put in the distribution if you like.
Thanks,
Stani

Spe 0.4.0.a

Spe nows ships with PyChecker. For more info see http://spe.pycs.net

spe-0.4.0.b released