Compare commits

...

8 Commits

Author SHA1 Message Date
a8efd1c3e1 Fix examples a bit 2024-06-03 18:07:23 -03:00
ce9cd97bda updated README 2024-06-03 18:01:48 -03:00
7340f72ae2 No more vmode 2024-06-03 17:59:38 -03:00
f2057962ff In Python3 we need to return the module 2024-06-03 17:57:27 -03:00
ca2dc8f9cf Reorg'd code, doesn't work 2024-06-03 17:43:14 -03:00
fcdb8a28b3 Reorg'd code, doesn't work 2024-06-03 17:42:43 -03:00
656bb9ebad C formatting using astyle --style=allman 2024-06-03 11:41:35 -03:00
d038fcd217 Fix imports, apply black 2024-06-03 11:38:36 -03:00
56 changed files with 7290 additions and 7537 deletions

162
.gitignore vendored Normal file
View File

@ -0,0 +1,162 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

View File

@ -1,739 +0,0 @@
##########################################################
# This is the Python interface to the pyxforms C module
#
import sys
import xforms
import forms
import objects
import bitmaps
import pixmaps
import box
import browser
import button
import choice
import clock
import counter
import dial
import frame
import input
import menu
import positioner
import slider
import timer
###############################################################################
# These are function needed to run the XForms library
# Needs a LOT of work
def xfinit (appname,appclass,argv0):
xforms.init (appname,appclass,argv0)
###############################################################################
# This is the synthetic event-loop to use under python:
_objects={}
def runforms():
while 1:
ob=_objects[str(xforms.do_forms())]
ob.cb (ob.args)
###############################################################################
# This is the default callback function:
def _nocb(args):
print "This object has no Callback!"
##############################################################################
#This is the Form class
class Form:
def __init__(self,t=6,w=200,h=200):
self.id=forms.create (0,w,h)
self.__box=Box(t,0,0,w,h,"")
self.Add (self.__box)
self.__box.c1=11
self.__box.c2=15
self.__minx=1 # Reasonable defaults for things that
self.__miny=1 # I can't get from XForms
self.__maxx=10000 # Notice that if the C code changes them
self.__maxy=10000 # They get out of sync!
self.__title=sys.argv[0] #the "preferred" form title
self.__placement=16388
self.__decoration=1
self.objs=() # A place to store the obj list. Useful?
def Show (self):
self.winid=forms.show (self.id,self.__placement,self.__decoration,self.title)
def Hide (self):
forms.hide (self.id)
def Freeze (self):
forms.freeze (self.id)
def Unfreeze (self):
forms.unfreeze (self.id)
def Activate (self):
forms.activate (self.id)
def Deactivate (self):
forms.deactivate (self.id)
def Scale (self,x,y):
forms.scale (self.id,x,y)
def Redraw (self):
forms.redraw (self.id)
def Add (self,object):
forms.add_object (self.id,object.id)
object.parent=self
def Setminsize (self,x,y):
forms.set_minsize (self.id,x,y)
self.__minx=x # The __ is needed to avoid endless looping
self.__miny=y # on min[xy], which are non-gettable from XForms
def Setmaxsize (self,x,y):
forms.set_maxsize (self.id,x,y)
self.__maxx=x
self.__maxy=y
def Settitle (self,title):
forms.set_title (self.id,title)
self.__title=title
def Gettitle (self):
if self.visible:
return forms.get_title(self.id)
else:
return self.__title
def Setcolor (c1,c2):
self.__box.Setcolor (c1,c2)
def __setattr__(self,name,value):
if name=="x":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,value,ty,tw,th)
elif name=="y":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,value,tw,th)
elif name=="w":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,ty,value,th)
elif name=="h":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,ty,tw,value)
elif name=="dblbuffer":
forms.set_dblbuffer(self.id,value)
elif name=="frozen":
if value:
self.Freeze()
else:
self.Unfreeze()
elif name=="active":
if value:
self.Activate()
else:
self.Deactivate()
elif name=="visible":
if value:
self.Show()
else:
self.Hide()
elif name=="minx":
self.Setminsize (value,self.__miny)
elif name=="miny":
self.Setminsize (self.__minx,value)
elif name=="maxx":
self.Setminsize (value,self.__maxy)
elif name=="maxy":
self.Setminsize (self.__maxx,value)
elif name=="title":
self.Settitle (value)
elif name=="c1":
self.__box.c1=value
elif name=="c2":
self.__box.c2=value
else:
self.__dict__ [name]=value
def __getattr__(self,name):
if name=="x":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return tx
elif name=="y":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return ty
elif name=="w":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return tw
elif name=="h":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return th
elif name=="minx":
return self.__minx
elif name=="miny":
return self.__miny
elif name=="maxx":
return self.__maxx
elif name=="maxy":
return self.__maxy
elif name=="vmode":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return vmode
elif name=="active":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return active
elif name=="dblbuffer":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return dblbuffer
elif name=="frozen":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return frozen
elif name=="visible":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return visible
elif name=="border":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return border
elif name=="other":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return other
elif name=="title":
return self.Gettitle ()
elif name=="c1":
return self.__box.c1
elif name=="c2":
return self.__box.c2
def __del__(self):
pass
#I'm not sure if this is a nice thing to do
# forms.free (self.id)
###############################################################################
#This is the XFObject class, for generic XForms objects
class XFObject:
def __init__ (self):
self.id=0
self.__c1=11
self.__c2=15
def Setgravity (self,a,b):
objects.set_gravity (self.id,a,b)
def Redraw (self):
objects.redraw (self.id)
def Scale (self,x,y):
objects.scale (self.id,x,y)
def Show (self):
objects.show (self.id)
self.Setcolor (self.__c1,self.__c2)
def Hide (self):
objects.hide (self.id)
def Delete(self):
objects.delete (self.id)
def Setcolor (self,c1,c2):
self.__c1=c1
self.__c2=c2
objects.set_color (self.id,c1,c2)
def Activate (self):
objects.activate (self.id)
def Deactivate (self):
objects.deactivate (self.id)
def __setattr__ (self,name,value):
if name=="boxtype":
objects.set_boxtype (self.id,value)
elif name=="bw":
objects.set_bw (self.id,value)
elif name=="labelsize":
objects.set_ls (self.id,value)
elif name=="labelstyle":
objects.set_lstyle (self.id,value)
elif name=="labelcolor":
objects.set_lcol (self.id,value)
elif name=="labelalign":
objects.set_lalign (self.id,value)
elif name=="label":
objects.set_label (self.id,value)
elif name=="shortcut":
objects.set_shortcut (self.id,value,1)
elif name=="dblbuffer":
objects.set_dblbuffer(self.id,value)
elif name=="x":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,value,ty,tw,th)
elif name=="y":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,value,tw,th)
elif name=="w":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,ty,value,th)
elif name=="h":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,ty,tw,value)
elif name=="resize":
objects.set_resize (self.id,value)
elif name=="c1":
self.Setcolor (value,self.__c2)
elif name=="c2":
self.Setcolor (self.__c1,value)
else:
self.__dict__ [name]=value
def __getattr__(self,name):
if name=="c1":
return self.__c1
elif name=="c2":
return self.__c2
def __del__ (self):
#probably a BAD idea
objects.free(self.id)
###############################################################################
# The Bitmap Class
class Bitmap(XFObject):
def __init__(self,t=0,x=10,y=10,w=100,h=100,l="Bitmap"):
XFObject.__init__ (self)
self.id=bitmaps.create(t,x,y,w,h,l)
def Load (self,file):
bitmaps.set_file (self.id,file)
def __setattr__ (self,name,value):
if name=="background":
objects.set_color(self.id,value,0)
elif name=="foreground":
objects.set_lcol(self.id,value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
# The Pixmap Class
class Pixmap(XFObject):
def __init__(self,t=0,x=10,y=10,w=100,h=100,l="Pixmap"):
XFObject.__init__ (self)
self.id=pixmaps.create(t,x,y,w,h,l)
def Load (self,file):
pixmaps.set_file (self.id,file)
def __setattr__ (self,name,value):
if name=="background":
objects.set_color(self.id,value,0)
elif name=="foreground":
objects.set_lcol(self.id,value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
# The Box Class
class Box(XFObject):
def __init__(self,t=6,x=10,y=10,w=90,h=90,l="Box"):
XFObject.__init__ (self)
self.id=box.create(t,x,y,w,h,l)
###############################################################################
# The Browser class
#
# I want the Browser class to act just like what it is: a list
# only with a "few" more methods and stuff
class Browser (XFObject):
def __init__(self,t=1,x=10,y=10,w=90,h=120,l="Browser"):
XFObject.__init__ (self)
self.id=browser.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Add(self,line):
browser.add_line (self.id,line)
def Addto(self,line):
browser.addto (self.id,line)
def Insert(self,n,line):
browser.insert_line(self.id,n,line)
def Delete(self,n):
browser.delete_line(self.id,n)
def Replace(self,n,line):
browser.replace_line(self.id,n,line)
def Getline(self,n):
return browser.get_line (self.id,n)
def Load(self,path):
return browser.load (self.id,path)
def Select(self,n):
browser.select_line (self.id,n)
def Deselect(self,n):
browser.deselect_line (self.id,n)
def Deselectall(self):
browser.deselect(self.id)
def Isselected(self,n):
return browser.isselected_line(self.id,n)
def Gettopline(self):
return browser.get_topline(self.id)
def Get(self):
return browser.get(self.id)
def Getmaxline(self):
return browser.get_maxline(self.id)
def Screenlines(self):
return browser.get_screenlines(self.id)
def Settopline(self,n):
browser.set_topline(self.id,n)
def Setfontsize(self,n):
browser.set_fontsize(self.id,n)
def Setfontstyle(self,n):
browser.set_fontstyle(self.id,n)
def Setspecialkey(self,c):
browser.set_specialkey(self.id,c)
def Setleftslider(self,l):
browser.set_leftslider(self.id,l)
def __setattr__ (self,name,value):
if name=="leftslider":
self.Setleftslider(value)
elif name=="specialkey":
self.Setspecialkey(value)
elif name=="fontstyle":
self.Setfontstyle(value)
elif name=="fontsize":
self.Setfontsize(value)
elif name=="topline":
self.Settopline(value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
#This is the Button class.
class Button(XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Button"):
XFObject.__init__ (self)
self.id=button.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def __call__(self,v=-1):
# I think this is nice: if you have a button called b,
# b() returns the button's value
# b(1) or b(0) SETS the button value.
# You can also set/get it with b.value, though
if v==-1:
return button.get(self.id)
else:
button.set (self.id,v)
def __setattr__ (self,name,value):
if name=="value":
self(value)
else:
XFObject.__setattr__(self,name,value)
def __getattr__ (self,name):
if name=="value":
return self()
elif name=="numb":
return button.get_numb (self.id)
pass
else:
return XFObject.__getattr__(self,name)
###############################################################################
# This is the Roundbutton class
class Roundbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Roundbutton"):
XFObject.__init__ (self)
self.id=button.create_round(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Lightbutton class
class Lightbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Lightbutton"):
XFObject.__init__ (self)
self.id=button.create_light(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Checkbutton class
class Checkbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Checkbutton"):
XFObject.__init__ (self)
self.id=button.create_check(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Bitmapbutton class
class Bitmapbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Bitmapbutton"):
XFObject.__init__ (self)
self.id=button.create_bitmap(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Pixmapbutton class
class Pixmapbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Pixmapbutton"):
XFObject.__init__ (self)
self.id=button.create_pixmap(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Choice Class
#This one needs a getattr, setattr pair
class Choice (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Choice"):
XFObject.__init__ (self)
self.id=choice.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Clear (self):
choice.clear(self.id)
def Addto (self,s):
choice.addto(self.id,s)
def Replace (self,n,s):
choice.replace(self.id,n,s)
def Delete (self,n):
choice.delete(self.id,n)
def Set (self,n):
choice.set(self.id,n)
def Settext (self,s):
choice.set_text (self.id,s)
def Get (self):
return choice.get (self.id)
def Getmaxitems (self):
return choice.get_maxitems (self.id)
def Gettext (self):
return choice.get_text (self.id)
def Setfontsize (self,n):
choice.set_fontsize(self.id,n)
def Setalign (self,n):
choice.set_align (self.id,n)
def Setmode (self,n,m):
choice.set_item_mode (self.id,n,m)
##############################################################################
# This is the clock class
class Clock (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=90,l="Clock"):
XFObject.__init__ (self)
self.id=clock.create(t,x,y,w,h,l)
def Get (self):
return clock.get (self.id)
##############################################################################
# This is the counter class
class Counter (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Counter"):
XFObject.__init__ (self)
self.id=counter.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
counter.set_value (self.id,v)
def Setbounds (self,min,max):
counter.set_bounds (self.id,min,max)
def Setstep (self,s1,s2):
counter.set_step (self.id,s1,s2)
def Setprecision (self,p):
counter.set_precision (self.id,p)
def Get (self):
return counter.get_value (self.id)
def Setreturn (self,v):
counter.set_return (self.id,v)
##############################################################################
# This is the Dial class
class Dial (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Dial"):
XFObject.__init__ (self)
self.id=dial.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
dial.set_value(self.id,v)
def Get (self):
return dial.get_value (self.id)
def Setbounds (self,min,max):
dial.set_bounds (self.id,min,max)
def Getbounds (self):
return dial.get_bounds (self.id)
def Setstep (self,v):
dial.set_step (self.id,v)
def Setreturn (self,v):
dial.set_return (self.id,v)
###############################################################################
# This is the Frame class
class Frame (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Frame"):
XFObject.__init__ (self)
self.id=frame.create(t,x,y,w,h,l)
###############################################################################
# This is the Input class
class Input (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Input"):
XFObject.__init__ (self)
self.id=input.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,s):
input.set (self.id,s)
def Setcolor (self,c1,c2):
input.set_color (self.id,c1,c2)
def Get (self):
return input.get(self.id)
def Setreturn (self,v):
input.set_return (self.id,v)
def Setscroll (self,v):
input.set_scroll (self.id,v)
def Setcursorpos (self,x,y=1):
input.set_cursorpos (self.id,x,y)
def Setselected (self,v):
input.set_selected (self.id,v)
def Setselectedrange (self,x1,x2):
input.set_selected_range (self.id,x1,x2)
def __setattr__ (self,name,value):
if name=="value":
self.Set(value)
else:
XFObject.__setattr__(self,name,value)
def __getattr__ (self,name):
if name=="value":
return self.Get()
else:
return XFObject.__getattr__(self,name)
###############################################################################
# This is the Menu class
class Menu (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Menu"):
XFObject.__init__ (self)
self.id=menu.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Clear (self):
menu.clear (self.id)
def Set (self,s):
menu.set (self.id,s)
def Addto (self,s):
menu.addto(self.id,s)
def Replace (self,n,s):
menu.replace_item (self.id,n,s)
def Delete (self,n):
menu.delete_item (self.id,n)
def Setshortcut (self,n,s):
menu.set_item_shortcut (self.id,n,s)
def Setmode (self,n,m):
menu.set_item_mode (self.id,n,m)
def Showsymbol (self,n):
menu.show_symbol (self.id,n)
def Get (self):
return menu.get (self.id)
def Getmaxitems (self):
return menu.get_maxitems (self.id)
def Gettext (self):
return menu.get_text (self.id)
###############################################################################
# This is the Positioner class
class Positioner (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Positioner"):
XFObject.__init__ (self)
self.id=positioner.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Setx (self,v):
positioner.set_xvalue (self.id,v)
def Sety (self,v):
positioner.set_yvalue (self.id,v)
def Setxbounds (self,x1,x2):
positioner.set_xbounds (self.id,x1,x2)
def Setybounds (self,y1,y2):
positioner.set_ybounds (self.id,y1,y2)
def Setxstep (self,v):
positioner.set_xstep (self.id,v)
def Setystep (self,v):
positioner.set_ystep (self.id,v)
def Getx (self):
return positioner.get_xvalue (self.id)
def Gety (self):
return positioner.get_yvalue (self.id)
def Getxbounds (self):
positioner.get_xbounds (self.id)
def Getybounds (self):
positioner.get_ybounds (self.id)
def Setreturn (self,v):
positioner.set_return (self.id,v)
###############################################################################
# This is the Slider class
class Slider (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Slider"):
XFObject.__init__ (self)
self.id=slider.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Get (self):
return slider.get_value (self.id)
def Set (self,v):
slider.set_value(self.id,v)
def Getbounds (self):
return slider.get_bounds (self.id)
def Setbounds (self,v1,v2):
slider.set_bounds(self.id,v1,v2)
def Setreturn (self,v):
slider.set_return (self.id,v)
def Setstep (self,v):
slider.set_step (self.id,v)
def Setsize (self,v):
slider.set_size (self.id,v)
###############################################################################
# This is the Valslider class
class Valslider (Slider):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Valslider"):
XFObject.__init__ (self)
self.id=slider.create_val(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Setprecision (self,v):
slider.set_precision (self.id,v)
##############################################################################
# This is the Timer class
class Timer (XFObject):
def __init__(self,t=1,x=10,y=10,w=60,h=30,l="Timer"):
XFObject.__init__ (self)
self.id=timer.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
timer.set(self.id,v)
def Get (self):
return timer.get (self.id)

View File

@ -1,494 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char browser_create__doc__[] =
"Creates a Browser"
;
static PyObject *
browser_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_browser(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char browser_add_line__doc__[] =
"Adds a line to a browser"
;
static PyObject *
browser_add_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *l;
if (!PyArg_ParseTuple(args, "ls",&o,&l))
return NULL;
fl_add_browser_line ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_addto__doc__[] =
"Adds a line to a browser, and shifts it there"
;
static PyObject *
browser_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *l;
if (!PyArg_ParseTuple(args, "ls",&o,&l))
return NULL;
fl_addto_browser ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_insert_line__doc__[] =
""
;
static PyObject *
browser_insert_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char *l;
if (!PyArg_ParseTuple(args, "lis",&o,&n,&l))
return NULL;
fl_insert_browser_line ((FL_OBJECT *)o,n,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_delete_line__doc__[] =
"Deletes a line from a browser"
;
static PyObject *
browser_delete_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_delete_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_replace_line__doc__[] =
"Replaces a line of abrowser"
;
static PyObject *
browser_replace_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char *l;
if (!PyArg_ParseTuple(args, "lis",&o,&n,&l))
return NULL;
fl_replace_browser_line ((FL_OBJECT *)o,n,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_get_line__doc__[] =
"Gets a browser's line"
;
static PyObject *
browser_get_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char s[1024];
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
strcpy(s,fl_get_browser_line ((FL_OBJECT *)o,n));
return Py_BuildValue ("s",s);
}
static char browser_load__doc__[] =
"Loads a file into a browser"
;
static PyObject *
browser_load(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
int r;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
r=fl_load_browser((FL_OBJECT *)o,s);
return Py_BuildValue ("i",r);
}
static char browser_select_line__doc__[] =
"Selects a browser line"
;
static PyObject *
browser_select_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_select_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_deselect_line__doc__[] =
"Deselects a browser's line"
;
static PyObject *
browser_deselect_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_deselect_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_deselect__doc__[] =
"Deselects all lines in a browser"
;
static PyObject *
browser_deselect(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_deselect_browser ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_isselected_line__doc__[] =
"Is that line selected in the browser?"
;
static PyObject *
browser_isselected_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n,r;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
r=fl_isselected_browser_line((FL_OBJECT *)o,n);
return Py_BuildValue ("i",r);
}
static char browser_get_topline__doc__[] =
"The number of the 1st visible line in the browser"
;
static PyObject *
browser_get_topline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_topline((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get__doc__[] =
"You better read the xforms manual on fl_get_browser for this one..."
;
static PyObject *
browser_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get_maxline__doc__[] =
"Returns the number of lines in the browser"
;
static PyObject *
browser_get_maxline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_maxline((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get_screenlines__doc__[] =
"Returns the number of visible lines in the browser"
;
static PyObject *
browser_get_screenlines(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_screenlines((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char browser_set_topline__doc__[] =
"Sets the browser's first visible line"
;
static PyObject *
browser_set_topline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_set_browser_topline((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_fontsize__doc__[] =
"Set the browser's font size"
;
static PyObject *
browser_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_fontsize((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_fontstyle__doc__[] =
"Set the browser's font style"
;
static PyObject *
browser_set_fontstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_fontstyle((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_specialkey__doc__[] =
"Set the character used to change text formatting in the browser"
;
static PyObject *
browser_set_specialkey(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_specialkey((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
// static char browser_set_leftslider__doc__[] =
// "Set the browser's slider to the left"
// ;
//
// static PyObject *
// browser_set_leftslider(self, args)
// PyObject *self; /* Not used */
// PyObject *args;
// {
// long o;
// int s;
//
// if (!PyArg_ParseTuple(args, "li",&o,&s))
// return NULL;
// fl_set_browser_leftslider((FL_OBJECT *)o,s);
// Py_INCREF(Py_None);
// return Py_None;
// }
/* List of methods defined in the module */
static struct PyMethodDef browser_methods[] = {
{"create", browser_create, 1, browser_create__doc__},
{"add_line", browser_add_line, 1, browser_add_line__doc__},
{"addto", browser_addto, 1, browser_addto__doc__},
{"insert_line", browser_insert_line, 1, browser_insert_line__doc__},
{"delete_line", browser_delete_line, 1, browser_delete_line__doc__},
{"replace_line", browser_replace_line, 1, browser_replace_line__doc__},
{"get_line", browser_get_line, 1, browser_get_line__doc__},
{"load", browser_load, 1, browser_load__doc__},
{"select_line", browser_select_line, 1, browser_select_line__doc__},
{"deselect_line", browser_deselect_line, 1, browser_deselect_line__doc__},
{"deselect", browser_deselect, 1, browser_deselect__doc__},
{"isselected_line", browser_isselected_line, 1, browser_isselected_line__doc__},
{"get_topline", browser_get_topline, 1, browser_get_topline__doc__},
{"get", browser_get, 1, browser_get__doc__},
{"get_maxline", browser_get_maxline, 1, browser_get_maxline__doc__},
{"get_screenlines", browser_get_screenlines, 1, browser_get_screenlines__doc__},
{"set_topline", browser_set_topline, 1, browser_set_topline__doc__},
{"set_fontsize", browser_set_fontsize, 1, browser_set_fontsize__doc__},
{"set_fontstyle", browser_set_fontstyle, 1, browser_set_fontstyle__doc__},
{"set_specialkey", browser_set_specialkey, 1, browser_set_specialkey__doc__},
// {"set_leftslider", browser_set_leftslider, 1, browser_set_leftslider__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbrowser) */
static char browser_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"browser", /* m_name */
browser_module_documentation, /* m_doc */
-1, /* m_size */
browser_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_browser()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("browser.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module browser");
}

View File

@ -1,377 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char button_create__doc__[] =
"Creates a normal button"
;
static PyObject *
button_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_button(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_round__doc__[] =
"Creates a round button"
;
static PyObject *
button_create_round(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_roundbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_light__doc__[] =
"Creates a light button"
;
static PyObject *
button_create_light(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_lightbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_check__doc__[] =
"Creates a check button"
;
static PyObject *
button_create_check(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_checkbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_bitmap__doc__[] =
"Creates a bitmap button"
;
static PyObject *
button_create_bitmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_bitmapbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_pixmap__doc__[] =
"Creates a pixmap button"
;
static PyObject *
button_create_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_pixmapbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_set_bitmap_data__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_bitmap_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_bitmap_file__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_bitmap_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_data__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_file__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_pixmap__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_get_pixmap_pixmap__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_get_pixmap_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_get__doc__[] =
"Gets the button's value"
;
static PyObject *
button_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_button((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char button_set__doc__[] =
"Sets the button's value"
;
static PyObject *
button_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int v;
if (!PyArg_ParseTuple(args, "li",&o,&v))
return NULL;
fl_set_button((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char button_get_numb__doc__[] =
"Get's the number of the mouse button last pressed on the button object"
;
static PyObject *
button_get_numb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
n=fl_get_button_numb((FL_OBJECT *)o);
return Py_BuildValue ("i",n);
}
static char button_create_generic__doc__[] =
"Creates a generic button (useful mainly for extensions)"
;
static PyObject *
button_create_generic(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int c,t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiiis",&c,&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_generic_button (c,t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
/* List of methods defined in the module */
static struct PyMethodDef button_methods[] = {
{"create", button_create, 1, button_create__doc__},
{"create_round", button_create_round, 1, button_create_round__doc__},
{"create_light", button_create_light, 1, button_create_light__doc__},
{"create_check", button_create_check, 1, button_create_check__doc__},
{"create_bitmap", button_create_bitmap, 1, button_create_bitmap__doc__},
{"create_pixmap", button_create_pixmap, 1, button_create_pixmap__doc__},
{"set_bitmap_data", button_set_bitmap_data, 1, button_set_bitmap_data__doc__},
{"set_bitmap_file", button_set_bitmap_file, 1, button_set_bitmap_file__doc__},
{"set_pixmap_data", button_set_pixmap_data, 1, button_set_pixmap_data__doc__},
{"set_pixmap_file", button_set_pixmap_file, 1, button_set_pixmap_file__doc__},
{"set_pixmap_pixmap", button_set_pixmap_pixmap, 1, button_set_pixmap_pixmap__doc__},
{"get_pixmap_pixmap", button_get_pixmap_pixmap, 1, button_get_pixmap_pixmap__doc__},
{"get", button_get, 1, button_get__doc__},
{"set", button_set, 1, button_set__doc__},
{"get_numb", button_get_numb, 1, button_get_numb__doc__},
{"create_generic", button_create_generic, 1, button_create_generic__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbutton) */
static char button_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"button", /* m_name */
button_module_documentation, /* m_doc */
-1, /* m_size */
button_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_button()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("button.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module button");
}

View File

@ -1,353 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char choice_create__doc__[] =
"Creates a choice object"
;
static PyObject *
choice_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_choice(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char choice_clear__doc__[] =
"Clears the list of choices"
;
static PyObject *
choice_clear(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_clear_choice((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_addto__doc__[] =
"Adds a line to a choice object"
;
static PyObject *
choice_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *t;
if (!PyArg_ParseTuple(args, "ls",&o,&t))
return NULL;
fl_addto_choice((FL_OBJECT *)o,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_replace__doc__[] =
"Replaces a line in a choice"
;
static PyObject *
choice_replace(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
char *t;
if (!PyArg_ParseTuple(args, "lis",&o,&l,&t))
return NULL;
fl_replace_choice((FL_OBJECT *)o,l,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_delete__doc__[] =
"Deletes a line in a choice"
;
static PyObject *
choice_delete(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
if (!PyArg_ParseTuple(args, "li",&o,&l))
return NULL;
fl_delete_choice((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set__doc__[] =
"Sets the choice"
;
static PyObject *
choice_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
if (!PyArg_ParseTuple(args, "li",&o,&l))
return NULL;
fl_set_choice ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_text__doc__[] =
"Sets the choice at the item with the given text"
;
static PyObject *
choice_set_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *t;
if (!PyArg_ParseTuple(args, "ls",&o,&t))
return NULL;
fl_set_choice_text((FL_OBJECT *)o,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_get__doc__[] =
"Gets the choice's selected option number"
;
static PyObject *
choice_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_choice((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char choice_get_maxitems__doc__[] =
"Gets the total number of items in the choice"
;
static PyObject *
choice_get_maxitems(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_choice_maxitems((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char choice_get_text__doc__[] =
"Gets the text of the current choice"
;
static PyObject *
choice_get_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char t[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (t,fl_get_choice_text((FL_OBJECT *)o));
return Py_BuildValue("s",t);
}
static char choice_set_fontsize__doc__[] =
"Sets the choice's fontsize"
;
static PyObject *
choice_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_choice_fontsize((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_align__doc__[] =
"Sets the alignment of the choice"
;
static PyObject *
choice_set_align(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_choice_align((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_item_mode__doc__[] =
"Sets an item's mode ?"
;
static PyObject *
choice_set_item_mode(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
unsigned m;
if (!PyArg_ParseTuple(args, "lil",&o,&n,&m))
return NULL;
fl_set_choice_item_mode((FL_OBJECT *)o,n,m);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_item_shortcut__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
choice_set_item_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef choice_methods[] = {
{"create", choice_create, 1, choice_create__doc__},
{"clear", choice_clear, 1, choice_clear__doc__},
{"addto", choice_addto, 1, choice_addto__doc__},
{"replace", choice_replace, 1, choice_replace__doc__},
{"delete", choice_delete, 1, choice_delete__doc__},
{"set", choice_set, 1, choice_set__doc__},
{"set_text", choice_set_text, 1, choice_set_text__doc__},
{"get", choice_get, 1, choice_get__doc__},
{"get_maxitems", choice_get_maxitems, 1, choice_get_maxitems__doc__},
{"get_text", choice_get_text, 1, choice_get_text__doc__},
{"set_fontsize", choice_set_fontsize, 1, choice_set_fontsize__doc__},
{"set_align", choice_set_align, 1, choice_set_align__doc__},
{"set_item_mode", choice_set_item_mode, 1, choice_set_item_mode__doc__},
{"set_item_shortcut", choice_set_item_shortcut, 1, choice_set_item_shortcut__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initchoice) */
static char choice_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"choice", /* m_name */
choice_module_documentation, /* m_doc */
-1, /* m_size */
choice_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_choice()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("choice.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module choice");
}

View File

@ -1,212 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char counter_create__doc__[] =
"Creates a counter"
;
static PyObject *
counter_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_counter(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char counter_set_value__doc__[] =
"Sets the value of the counter (Use only on visible counters!)"
;
static PyObject *
counter_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_counter_value((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_bounds__doc__[] =
"Sets the counter's max & min"
;
static PyObject *
counter_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_counter_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_step__doc__[] =
"Set the counter's step size (small & large)"
;
static PyObject *
counter_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s,l;
if (!PyArg_ParseTuple(args, "ldd",&o,&s,&l))
return NULL;
fl_set_counter_step((FL_OBJECT *)o,s,l);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_precision__doc__[] =
"Sets the counter's precision"
;
static PyObject *
counter_set_precision(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int p;
if (!PyArg_ParseTuple(args, "li",&o,&p))
return NULL;
fl_set_counter_precision ((FL_OBJECT *)o,p);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_get_value__doc__[] =
"Returns the counter's value"
;
static PyObject *
counter_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_counter_value((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char counter_set_return__doc__[] =
"Makes the counter return always or when released"
;
static PyObject *
counter_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_counter_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef counter_methods[] = {
{"create", counter_create, 1, counter_create__doc__},
{"set_value", counter_set_value, 1, counter_set_value__doc__},
{"set_bounds", counter_set_bounds, 1, counter_set_bounds__doc__},
{"set_step", counter_set_step, 1, counter_set_step__doc__},
{"set_precision", counter_set_precision, 1, counter_set_precision__doc__},
{"get_value", counter_get_value, 1, counter_get_value__doc__},
{"set_return", counter_set_return, 1, counter_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initcounter) */
static char counter_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"counter", /* m_name */
counter_module_documentation, /* m_doc */
-1, /* m_size */
counter_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_counter()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("counter.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module counter");
}

View File

@ -1,212 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char dial_create__doc__[] =
"Creates a dial"
;
static PyObject *
dial_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_dial(t,x,y,w,h,l);
return Py_BuildValue ("l",o);;
}
static char dial_set_value__doc__[] =
"Sets the dial value"
;
static PyObject *
dial_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_dial_value ((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_get_value__doc__[] =
"Gets the dial's value"
;
static PyObject *
dial_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_dial_value((FL_OBJECT *)o);
return Py_BuildValue("d",r);
}
static char dial_set_bounds__doc__[] =
"Sets the dial bounds"
;
static PyObject *
dial_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_dial_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_get_bounds__doc__[] =
"Gets the dial bounds"
;
static PyObject *
dial_get_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_dial_bounds((FL_OBJECT *)o,&min,&max);
return Py_BuildValue("dd",min,max);
}
static char dial_set_step__doc__[] =
"Sets the dial step"
;
static PyObject *
dial_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_dial_step ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_set_return__doc__[] =
"Makes a dial return always or when released"
;
static PyObject *
dial_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_dial_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef dial_methods[] = {
{"create", dial_create, 1, dial_create__doc__},
{"set_value", dial_set_value, 1, dial_set_value__doc__},
{"get_value", dial_get_value, 1, dial_get_value__doc__},
{"set_bounds", dial_set_bounds, 1, dial_set_bounds__doc__},
{"get_bounds", dial_get_bounds, 1, dial_get_bounds__doc__},
{"set_step", dial_set_step, 1, dial_set_step__doc__},
{"set_return", dial_set_return, 1, dial_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initdial) */
static char dial_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"dial", /* m_name */
dial_module_documentation, /* m_doc */
-1, /* m_size */
dial_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_dial()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("dial.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module dial");
}

View File

@ -1,700 +0,0 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char forms_create__doc__[] =
"Creates a form"
;
static PyObject *
forms_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int box,w,h;
FL_FORM *ret;
if (!PyArg_ParseTuple(args, "iii",&box,&w,&h))
return NULL;
ret=fl_bgn_form (FL_NO_BOX,w,h);
fl_end_form ();
return Py_BuildValue("l",(long)ret);
}
static char forms_freeze__doc__[] =
"Freezes a form"
;
static PyObject *
forms_freeze(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_freeze_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unfreeze__doc__[] =
"Unfreezes a form"
;
static PyObject *
forms_unfreeze(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_unfreeze_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_deactivate__doc__[] =
"Deactivates a form"
;
static PyObject *
forms_deactivate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_deactivate_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_activate__doc__[] =
"Activates a form"
;
static PyObject *
forms_activate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_activate_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_activate_all__doc__[] =
"Activates all forms"
;
static PyObject *
forms_activate_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_activate_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_deactivate_all__doc__[] =
"Deactivates all forms"
;
static PyObject *
forms_deactivate_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_deactivate_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_freeze_all__doc__[] =
"Freezes all forms"
;
static PyObject *
forms_freeze_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_freeze_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unfreeze_all__doc__[] =
"Unfreezes all forms"
;
static PyObject *
forms_unfreeze_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_unfreeze_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_scale__doc__[] =
"Scales a form x and y times"
;
static PyObject *
forms_scale(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
double x,y;
if (!PyArg_ParseTuple(args, "ldd",&form,&x,&y))
return NULL;
fl_scale_form ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_position__doc__[] =
"Sets the form position"
;
static PyObject *
forms_set_position(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_set_form_position((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_property__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_property(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unset_property__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_unset_property(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_callback__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_size__doc__[] =
"Sets the form's size"
;
static PyObject *
forms_set_size(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_size((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_hotspot__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_hotspot(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_hotobject__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_hotobject(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_minsize__doc__[] =
"Sets the form minimum size"
;
static PyObject *
forms_set_minsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_minsize ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_maxsize__doc__[] =
"Sets the form maximum size"
;
static PyObject *
forms_set_maxsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_maxsize ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_event_cmask__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_event_cmask(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_event_cmask__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_get_event_cmask(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_geometry__doc__[] =
"Set the form's geometry"
;
static PyObject *
forms_set_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "liiii",&form,&x,&y,&w,&h))
return NULL;
fl_set_form_geometry ((FL_FORM *)form,x,y,w,h);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_geometry__doc__[] =
"Get the form's geometry"
;
static PyObject *
forms_get_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
x=((FL_FORM *)form)->x;
y=((FL_FORM *)form)->y;
w=((FL_FORM *)form)->w;
h=((FL_FORM *)form)->h;
return Py_BuildValue ("iiii",x,y,w,h);
}
static char forms_show__doc__[] =
"Shows the form"
;
static PyObject *
forms_show(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form,ret;
int a,b;
char *c;
if (!PyArg_ParseTuple(args, "liis",&form,&a,&b,&c))
return NULL;
ret=fl_show_form ((FL_FORM *)form,a,b,c);
return Py_BuildValue("l",ret);
}
static char forms_hide__doc__[] =
"Hides a form"
;
static PyObject *
forms_hide(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_hide_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_free__doc__[] =
"Releases a form's memory"
;
static PyObject *
forms_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_free_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_redraw__doc__[] =
"Redraws a form"
;
static PyObject *
forms_redraw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_redraw_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_dblbuffer__doc__[] =
"Sets the form as doublebuffered or not"
;
static PyObject *
forms_set_dblbuffer(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int choice;
if (!PyArg_ParseTuple(args, "li",&form,&choice))
return NULL;
fl_set_form_dblbuffer ((FL_FORM *)form,choice);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_prepare_window__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_prepare_window(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_show_window__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_show_window(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_add_object__doc__[] =
"Adds an object to the form"
;
static PyObject *
forms_add_object(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long f,o;
if (!PyArg_ParseTuple(args, "ll",&f,&o))
return NULL;
fl_add_object((FL_FORM *)f,(FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_attr__doc__[] =
"Gets a bunch of attributes from the form"
;
static PyObject *forms_get_attr(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
return Py_BuildValue ("iiiiil",
//((FL_FORM *)o)->vmode,
((FL_FORM *)o)->deactivated,
((FL_FORM *)o)->use_pixmap,
((FL_FORM *)o)->frozen,
((FL_FORM *)o)->visible,
((FL_FORM *)o)->wm_border,
(long)((FL_FORM *)o)->prop);
}
static char forms_set_title__doc__[] =
"Sets the form's title"
;
static PyObject *
forms_set_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
char *title;
if (!PyArg_ParseTuple(args, "ls",&form,&title))
return NULL;
fl_set_form_title ((FL_FORM *)form,title);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_title__doc__[] =
"Gets the form's title (Undocumented on XForms, but...)"
;
static PyObject *
forms_get_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
char title[2048];
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
strcpy (title,((FL_FORM *)form)->label);
return Py_BuildValue ("s",title);
}
/* List of methods defined in the module */
static struct PyMethodDef forms_methods[] = {
{ "create", forms_create, 1, forms_create__doc__ },
{ "freeze", forms_freeze, 1, forms_freeze__doc__ },
{ "unfreeze", forms_unfreeze, 1, forms_unfreeze__doc__ },
{ "deactivate", forms_deactivate, 1, forms_deactivate__doc__ },
{ "activate", forms_activate, 1, forms_activate__doc__ },
{ "activate_all", forms_activate_all, 1, forms_activate_all__doc__ },
{ "deactivate_all", forms_deactivate_all, 1, forms_deactivate_all__doc__ },
{ "freeze_all", forms_freeze_all, 1, forms_freeze_all__doc__ },
{ "unfreeze_all", forms_unfreeze_all, 1, forms_unfreeze_all__doc__ },
{ "scale", forms_scale, 1, forms_scale__doc__ },
{ "set_position", forms_set_position, 1, forms_set_position__doc__ },
{ "set_property", forms_set_property, 1, forms_set_property__doc__ },
{ "unset_property", forms_unset_property, 1, forms_unset_property__doc__ },
{ "set_callback", forms_set_callback, 1, forms_set_callback__doc__ },
{ "set_size", forms_set_size, 1, forms_set_size__doc__ },
{ "set_hotspot", forms_set_hotspot, 1, forms_set_hotspot__doc__ },
{ "set_hotobject", forms_set_hotobject, 1, forms_set_hotobject__doc__ },
{ "set_minsize", forms_set_minsize, 1, forms_set_minsize__doc__ },
{ "set_maxsize", forms_set_maxsize, 1, forms_set_maxsize__doc__ },
{ "set_event_cmask", forms_set_event_cmask, 1, forms_set_event_cmask__doc__ },
{ "get_event_cmask", forms_get_event_cmask, 1, forms_get_event_cmask__doc__ },
{ "set_geometry", forms_set_geometry, 1, forms_set_geometry__doc__ },
{ "get_geometry", forms_get_geometry, 1, forms_get_geometry__doc__ },
{ "show", forms_show, 1, forms_show__doc__ },
{ "hide", forms_hide, 1, forms_hide__doc__ },
{ "free", forms_free, 1, forms_free__doc__ },
{ "redraw", forms_redraw, 1, forms_redraw__doc__ },
{ "set_dblbuffer", forms_set_dblbuffer, 1, forms_set_dblbuffer__doc__ },
{ "prepare_window", forms_prepare_window, 1, forms_prepare_window__doc__ },
{ "show_window", forms_show_window, 1, forms_show_window__doc__ },
{ "add_object", forms_add_object, 1, forms_add_object__doc__ },
{ "get_attr", forms_get_attr, 1, forms_get_attr__doc__ },
{ "set_title", forms_set_title, 1, forms_set_title__doc__ },
{ "get_title", forms_get_title, 1, forms_get_title__doc__ },
{ NULL, NULL } /* sentinel */
};
/* Initialization function for the module (*must* be called initforms) */
static char forms_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"forms", /* m_name */
forms_module_documentation, /* m_doc */
-1, /* m_size */
forms_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_forms()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("forms.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module forms");
}

View File

@ -1,507 +0,0 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char goodies_set_font__doc__[] =
"Sets the goodies font XXXXXXBroken?"
;
static PyObject *
goodies_set_font(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii"),&i,&j)
return NULL;
fl_set_goodies_font (i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_message__doc__[] =
"Shows a message (3 lines)"
;
static PyObject *
goodies_show_message(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
if (!PyArg_ParseTuple(args, "sss",&s1,&s2,&s3))
return NULL;
fl_show_message (s1,s2,s3);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_alert__doc__[] =
"Shows an alert message"
;
static PyObject *
goodies_show_alert(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
int i;
if (!PyArg_ParseTuple(args, "sssi",&s1,&s2,&s3,&i))
return NULL;
fl_show_alert (s1,s2,s3,i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_question__doc__[] =
"Shows a question"
;
static PyObject *
goodies_show_question(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1;
int v,r;
if (!PyArg_ParseTuple(args, "ss",&s1,&v))
return NULL;
r=fl_show_question (s1,v);
return Py_BuildValue ("i",r);
}
static char goodies_show_input__doc__[] =
"Asks a line of text"
;
static PyObject *
goodies_show_input(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,r[2048];
if (!PyArg_ParseTuple(args, "ss",&s1,&s2))
return NULL;
strcpy (r,fl_show_input(s1,s2));
return Py_BuildValue ("s",r);
}
static char goodies_show_colormap__doc__[] =
"Shows a colormap"
;
static PyObject *
goodies_show_colormap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,r;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
r=fl_show_colormap (i);
return Py_BuildValue ("i",r);
}
static char goodies_show_choice__doc__[] =
"Shows a choice"
;
static PyObject *
goodies_show_choice(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3,*s4,*s5,*s6;
int i1,i2,r;
if (!PyArg_ParseTuple(args, "sssisssi",&s1,&s2,&s3,&i1,&s4,&s5,&s6,&i2))
return NULL;
r=fl_show_choice (s1,s2,s3,i1,s4,s5,s6,i2);
return Py_BuildValue("i",r);
}
static char goodies_set_choices_shortcut__doc__[] =
"Sets the choice's shortcuts"
;
static PyObject *
goodies_set_choices_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
if (!PyArg_ParseTuple(args, "sss",&s1,&s2,&s3))
return NULL;
fl_set_choices_shortcut (s1,s2,s3);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_oneliner__doc__[] =
"Shows a one-liner"
;
static PyObject *
goodies_show_oneliner(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1;
int i,j;
if (!PyArg_ParseTuple(args, "sii",&s1,&i,&j))
return NULL;
fl_show_oneliner (s1,i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_hide_oneliner__doc__[] =
"Hides a oneliner"
;
static PyObject *
goodies_hide_oneliner(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_hide_oneliner();
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_oneliner_font__doc__[] =
"Sets the oneliner font"
;
static PyObject *
goodies_set_oneliner_font(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii",&i,&j))
return NULL;
fl_set_oneliner_font(i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_oneliner_color__doc__[] =
"Sets the oneliner color"
;
static PyObject *
goodies_set_oneliner_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii",&i,&j))
return NULL;
fl_set_oneliner_color (i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_use_fselector__doc__[] =
"??"
;
static PyObject *
goodies_use_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
fl_use_fselector (i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_fselector__doc__[] =
"Shows a fselector"
;
static PyObject *
goodies_show_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3,*s4,r[2048];
if (!PyArg_ParseTuple(args, "ssss",&s1,&s2,&s3,&s4))
return NULL;
strcpy (r,fl_show_fselector (s1,s2,s3,s4));
return Py_BuildValue ("s",r);
}
static char goodies_set_fselector_placement__doc__[] =
""
;
static PyObject *
goodies_set_fselector_placement(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
fl_set_fselector_placement(i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_fselector_callback__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_set_fselector_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_get_directory__doc__[] =
""
;
static PyObject *
goodies_get_directory(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_directory());
return Py_BuildValue ("s",r);
}
static char goodies_get_pattern__doc__[] =
""
;
static PyObject *
goodies_get_pattern(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_pattern());
return Py_BuildValue ("s",r);
}
static char goodies_get_filename__doc__[] =
""
;
static PyObject *
goodies_get_filename(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_filename());
return Py_BuildValue ("s",r);
}
static char goodies_refresh_fselector__doc__[] =
""
;
static PyObject *
goodies_refresh_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_refresh_fselector();
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_add_fselector_appbutton__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_add_fselector_appbutton(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_disable_fselector_cache__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_disable_fselector_cache(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_invalidate_fselector_cache__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_invalidate_fselector_cache(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_get_fselector_form__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_get_fselector_form(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_hide_fselector__doc__[] =
"Hides a fselector"
;
static PyObject *
goodies_hide_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_hide_fselector();
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef goodies_methods[] = {
{"set_font", goodies_set_font, 1, goodies_set_font__doc__},
{"show_message", goodies_show_message, 1, goodies_show_message__doc__},
{"show_alert", goodies_show_alert, 1, goodies_show_alert__doc__},
{"show_question", goodies_show_question, 1, goodies_show_question__doc__},
{"show_input", goodies_show_input, 1, goodies_show_input__doc__},
{"show_colormap", goodies_show_colormap, 1, goodies_show_colormap__doc__},
{"show_choice", goodies_show_choice, 1, goodies_show_choice__doc__},
{"set_choices_shortcut", goodies_set_choices_shortcut, 1, goodies_set_choices_shortcut__doc__},
{"show_oneliner", goodies_show_oneliner, 1, goodies_show_oneliner__doc__},
{"hide_oneliner", goodies_hide_oneliner, 1, goodies_hide_oneliner__doc__},
{"set_oneliner_font", goodies_set_oneliner_font, 1, goodies_set_oneliner_font__doc__},
{"set_oneliner_color", goodies_set_oneliner_color, 1, goodies_set_oneliner_color__doc__},
{"use_fselector", goodies_use_fselector, 1, goodies_use_fselector__doc__},
{"show_fselector", goodies_show_fselector, 1, goodies_show_fselector__doc__},
{"set_fselector_placement", goodies_set_fselector_placement, 1, goodies_set_fselector_placement__doc__},
{"set_fselector_callback", goodies_set_fselector_callback, 1, goodies_set_fselector_callback__doc__},
{"get_directory", goodies_get_directory, 1, goodies_get_directory__doc__},
{"get_pattern", goodies_get_pattern, 1, goodies_get_pattern__doc__},
{"get_filename", goodies_get_filename, 1, goodies_get_filename__doc__},
{"refresh_fselector", goodies_refresh_fselector, 1, goodies_refresh_fselector__doc__},
{"add_fselector_appbutton", goodies_add_fselector_appbutton, 1, goodies_add_fselector_appbutton__doc__},
{"disable_fselector_cache", goodies_disable_fselector_cache, 1, goodies_disable_fselector_cache__doc__},
{"invalidate_fselector_cache", goodies_invalidate_fselector_cache, 1, goodies_invalidate_fselector_cache__doc__},
{"get_fselector_form", goodies_get_fselector_form, 1, goodies_get_fselector_form__doc__},
{"hide_fselector", goodies_hide_fselector, 1, goodies_hide_fselector__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initgoodies) */
static char goodies_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"goodies", /* m_name */
goodies_module_documentation, /* m_doc */
-1, /* m_size */
goodies_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_goodies()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("goodies.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module goodies");
}

View File

@ -1,254 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char input_create__doc__[] =
"Creates an Input object"
;
static PyObject *
input_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_input (t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char input_set__doc__[] =
"Sets the contents of an input object"
;
static PyObject *
input_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_input((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_color__doc__[] =
"Sets the color of the input object's text"
;
static PyObject *
input_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c1,c2;
if (!PyArg_ParseTuple(args, "lii",&o,&c1,&c2))
return NULL;
fl_set_input_color ((FL_OBJECT *)o,c1,c2);
Py_INCREF(Py_None);
return Py_None;
}
static char input_get__doc__[] =
"Gets the input's value"
;
static PyObject *
input_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char r[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (r,fl_get_input((FL_OBJECT *)o));
return Py_BuildValue ("s",r);
}
static char input_set_return__doc__[] =
"Makes the input return always or when released"
;
static PyObject *
input_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_scroll__doc__[] =
"Makes the input scrollable"
;
static PyObject *
input_set_scroll(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_scroll((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_cursorpos__doc__[] =
"Sets the input's cursor position"
;
static PyObject *
input_set_cursorpos(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i,j;
if (!PyArg_ParseTuple(args, "lii",&o,&i,&j))
return NULL;
fl_set_input_cursorpos ((FL_OBJECT *)o,i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_selected__doc__[] =
"Sets the input as selected"
;
static PyObject *
input_set_selected(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_selected((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_selected_range__doc__[] =
"Sets a range of the input object as selected"
;
static PyObject *
input_set_selected_range(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i,j;
if (!PyArg_ParseTuple(args, "lii",&o,&i,&j))
return NULL;
fl_set_input_selected_range((FL_OBJECT *)o,i,j);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef input_methods[] = {
{"create", input_create, 1, input_create__doc__},
{"set", input_set, 1, input_set__doc__},
{"set_color", input_set_color, 1, input_set_color__doc__},
{"get", input_get, 1, input_get__doc__},
{"set_return", input_set_return, 1, input_set_return__doc__},
{"set_scroll", input_set_scroll, 1, input_set_scroll__doc__},
{"set_cursorpos", input_set_cursorpos, 1, input_set_cursorpos__doc__},
{"set_selected", input_set_selected, 1, input_set_selected__doc__},
{"set_selected_range", input_set_selected_range, 1, input_set_selected_range__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initinput) */
static char input_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"input", /* m_name */
input_module_documentation, /* m_doc */
-1, /* m_size */
input_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_input()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("input.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module input");
}

View File

@ -1,314 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char menu_create__doc__[] =
"Creates a menu"
;
static PyObject *
menu_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_menu(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char menu_clear__doc__[] =
"Removes all the menu's options"
;
static PyObject *
menu_clear(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_clear_menu ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set__doc__[] =
"Sets the menu contents"
;
static PyObject *
menu_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_menu ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_addto__doc__[] =
"Adds an option to an existing menu"
;
static PyObject *
menu_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_addto_menu ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_replace_item__doc__[] =
"Replaces an item from the menu"
;
static PyObject *
menu_replace_item(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
char *s;
if (!PyArg_ParseTuple(args, "lis",&o,&i,&s))
return NULL;
fl_replace_menu_item((FL_OBJECT *)o,i,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_delete_item__doc__[] =
"Deletes an option from a menu"
;
static PyObject *
menu_delete_item(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_delete_menu_item((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set_item_shortcut__doc__[] =
"Sets a menu item's shortcut"
;
static PyObject *
menu_set_item_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
char *s;
if (!PyArg_ParseTuple(args, "lis",&o,&i,&s))
return NULL;
fl_set_menu_item_shortcut((FL_OBJECT *)o,i,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set_item_mode__doc__[] =
"Sets the item mode (unselectable, etc)"
;
static PyObject *
menu_set_item_mode(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
unsigned long m;
if (!PyArg_ParseTuple(args, "lil",&o,&i,&m))
return NULL;
fl_set_menu_item_mode((FL_OBJECT *)o,i,m);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_show_symbol__doc__[] =
"Shows a simbol menu with the label"
;
static PyObject *
menu_show_symbol(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_show_menu_symbol ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_get__doc__[] =
"Gets the last selected item's number"
;
static PyObject *
menu_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_menu((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char menu_get_maxitems__doc__[] =
"returns the number of items in a menu"
;
static PyObject *
menu_get_maxitems(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_menu_maxitems((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char menu_get_text__doc__[] =
"Returns the text of the menu last selected choice"
;
static PyObject *
menu_get_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char s[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (s,fl_get_menu_text((FL_OBJECT *)o));
return Py_BuildValue ("s",s);
}
/* List of methods defined in the module */
static struct PyMethodDef menu_methods[] = {
{"create", menu_create, 1, menu_create__doc__},
{"clear", menu_clear, 1, menu_clear__doc__},
{"set", menu_set, 1, menu_set__doc__},
{"addto", menu_addto, 1, menu_addto__doc__},
{"replace_item", menu_replace_item, 1, menu_replace_item__doc__},
{"delete_item", menu_delete_item, 1, menu_delete_item__doc__},
{"set_item_shortcut", menu_set_item_shortcut, 1, menu_set_item_shortcut__doc__},
{"set_item_mode", menu_set_item_mode, 1, menu_set_item_mode__doc__},
{"show_symbol", menu_show_symbol, 1, menu_show_symbol__doc__},
{"get", menu_get, 1, menu_get__doc__},
{"get_maxitems", menu_get_maxitems, 1, menu_get_maxitems__doc__},
{"get_text", menu_get_text, 1, menu_get_text__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initmenu) */
static char menu_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"menu", /* m_name */
menu_module_documentation, /* m_doc */
-1, /* m_size */
menu_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_menu()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("menu.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module menu");
}

View File

@ -1,521 +0,0 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char obj_set_boxtype__doc__[] =
"Sets the objects Boxtype"
;
static PyObject *
obj_set_boxtype(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int type;
if (!PyArg_ParseTuple(args, "li",&object,&type))
return NULL;
fl_set_object_boxtype ((FL_OBJECT *)object,type);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_bw__doc__[] =
"Sets the object's Border Width"
;
static PyObject *
obj_set_bw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int bw;
if (!PyArg_ParseTuple(args, "li",&object,&bw))
return NULL;
fl_set_object_bw ((FL_OBJECT *)object,bw);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_resize__doc__[] =
"Sets the objects \"Resize policy\""
;
static PyObject *
obj_set_resize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
unsigned a;
if (!PyArg_ParseTuple(args, "ll",&object,&a))
return NULL;
fl_set_object_resize ((FL_OBJECT *)object,a);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_gravity__doc__[] =
"Sets the objects gravity"
;
static PyObject *
obj_set_gravity(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
unsigned a,b,c;
if (!PyArg_ParseTuple(args, "lll",&object,&a,&b))
return NULL;
fl_set_object_gravity ((FL_OBJECT *)object,a,b);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lsize__doc__[] =
"Sets the object's label size"
;
static PyObject *
obj_set_lsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int size;
if (!PyArg_ParseTuple(args, "li",&object,&size))
return NULL;
fl_set_object_lsize((FL_OBJECT *)object,size);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lstyle__doc__[] =
"Sets the object's label style"
;
static PyObject *
obj_set_lstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int style;
if (!PyArg_ParseTuple(args, "li",&object,&style))
return NULL;
fl_set_object_lstyle((FL_OBJECT *)object,style);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lcol__doc__[] =
"Sets the object's label color"
;
static PyObject *
obj_set_lcol(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c;
if (!PyArg_ParseTuple(args, "li",&o,&c))
return NULL;
fl_set_object_lcol((FL_OBJECT *)o,c);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_dragndrop__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_dragndrop(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_focus__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_focus(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_redraw__doc__[] =
"Redraws the object"
;
static PyObject *
obj_redraw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_redraw_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lalign__doc__[] =
"Sets the label alignment"
;
static PyObject *
obj_set_lalign(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int a;
if (!PyArg_ParseTuple(args, "li",&o,&a))
return NULL;
fl_set_object_lalign((FL_OBJECT *)o,a);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_callback__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_show__doc__[] =
"Shows the object"
;
static PyObject *
obj_show(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_show_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_hide__doc__[] =
"Hides the object"
;
static PyObject *
obj_hide(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_hide_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_free__doc__[] =
"Releases the object's memory"
;
static PyObject *
obj_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_free_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_delete__doc__[] =
"Deletes the object from it's form"
;
static PyObject *
obj_delete(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_delete_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_color__doc__[] =
"Sets the object color"
;
static PyObject *
obj_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
float a,b;
if (!PyArg_ParseTuple(args, "lff",&o,&a,&b))
return NULL;
fl_set_object_color((FL_OBJECT *)o,(int)a,(int)b);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_label__doc__[] =
"Sets the label"
;
static PyObject *
obj_set_label(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_object_label((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_activate__doc__[] =
"Activates the object"
;
static PyObject *
obj_activate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_activate_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_deactivate__doc__[] =
"Activates the object"
;
static PyObject *
obj_deactivate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_deactivate_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_shortcut__doc__[] =
"Sets the shortcut to the object"
;
static PyObject *
obj_set_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
int i;
if (!PyArg_ParseTuple(args, "lsi",&o,&s,&i))
return NULL;
fl_set_object_shortcut ((FL_OBJECT *)o,s,i);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_dblbuffer__doc__[] =
"Sets the object as double buffered"
;
static PyObject *
obj_set_dblbuffer(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c;
if (!PyArg_ParseTuple(args, "li",&o,&c))
return NULL;
fl_set_object_dblbuffer((FL_OBJECT *)o,c);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_geometry__doc__[] =
"Sets the object's geometry"
;
static PyObject *
obj_set_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "liiii",&o,&x,&y,&w,&h))
return NULL;
fl_set_object_geometry ((FL_OBJECT *)o,x,y,w,h);
fl_redraw_object ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_get_geometry__doc__[] =
"Sets the object's geometry"
;
static PyObject *
obj_get_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
x=((FL_OBJECT *)o)->x;
y=((FL_OBJECT *)o)->y;
w=((FL_OBJECT *)o)->w;
h=((FL_OBJECT *)o)->h;
fl_redraw_object ((FL_OBJECT *)o);
return Py_BuildValue ("iiii",x,y,w,h);
}
/* List of methods defined in the module */
static struct PyMethodDef obj_methods[] = {
{"set_boxtype", obj_set_boxtype, 1, obj_set_boxtype__doc__},
{"set_bw", obj_set_bw, 1, obj_set_bw__doc__},
{"set_resize", obj_set_resize, 1, obj_set_resize__doc__},
{"set_gravity", obj_set_gravity, 1, obj_set_gravity__doc__},
{"set_lsize", obj_set_lsize, 1, obj_set_lsize__doc__},
{"set_lstyle", obj_set_lstyle, 1, obj_set_lstyle__doc__},
{"set_lcol", obj_set_lcol, 1, obj_set_lcol__doc__},
{"set_dragndrop", obj_set_dragndrop, 1, obj_set_dragndrop__doc__},
{"set_focus", obj_set_focus, 1, obj_set_focus__doc__},
{"redraw", obj_redraw, 1, obj_redraw__doc__},
{"set_lalign", obj_set_lalign, 1, obj_set_lalign__doc__},
{"set_callback", obj_set_callback, 1, obj_set_callback__doc__},
{"show", obj_show, 1, obj_show__doc__},
{"hide", obj_hide, 1, obj_hide__doc__},
{"free", obj_free, 1, obj_free__doc__},
{"delete", obj_delete, 1, obj_delete__doc__},
{"set_color", obj_set_color, 1, obj_set_color__doc__},
{"set_label", obj_set_label, 1, obj_set_label__doc__},
{"activate", obj_activate, 1, obj_activate__doc__},
{"deactivate", obj_deactivate, 1, obj_deactivate__doc__},
{"set_shortcut", obj_set_shortcut, 1, obj_set_shortcut__doc__},
{"set_dblbuffer", obj_set_dblbuffer, 1, obj_set_dblbuffer__doc__},
{"set_geometry", obj_set_geometry, 1, obj_set_geometry__doc__},
{"get_geometry", obj_get_geometry, 1, obj_get_geometry__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initobjects) */
static char objects_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"objects", /* m_name */
objects_module_documentation, /* m_doc */
-1, /* m_size */
obj_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_objects()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("objects.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module objects");
}

View File

@ -1,381 +0,0 @@
/***********************************************************
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char pup_new__doc__[] =
""
;
static PyObject *
pup_new(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_def__doc__[] =
""
;
static PyObject *
pup_def(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_addto__doc__[] =
""
;
static PyObject *
pup_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set__doc__[] =
""
;
static PyObject *
pup_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_free__doc__[] =
""
;
static PyObject *
pup_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_do__doc__[] =
""
;
static PyObject *
pup_do(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_shortcut__doc__[] =
""
;
static PyObject *
pup_set_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_position__doc__[] =
""
;
static PyObject *
pup_set_position(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_selection__doc__[] =
""
;
static PyObject *
pup_set_selection(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_fontsize__doc__[] =
""
;
static PyObject *
pup_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_fontstyle__doc__[] =
""
;
static PyObject *
pup_set_fontstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_shadow__doc__[] =
""
;
static PyObject *
pup_set_shadow(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_softedge__doc__[] =
""
;
static PyObject *
pup_set_softedge(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_color__doc__[] =
""
;
static PyObject *
pup_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_title__doc__[] =
""
;
static PyObject *
pup_set_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_itemcb__doc__[] =
""
;
static PyObject *
pup_set_itemcb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_menucb__doc__[] =
""
;
static PyObject *
pup_set_menucb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_submenu__doc__[] =
""
;
static PyObject *
pup_set_submenu(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef pup_methods[] = {
{"new", pup_new, 1, pup_new__doc__},
{"def", pup_def, 1, pup_def__doc__},
{"addto", pup_addto, 1, pup_addto__doc__},
{"set", pup_set, 1, pup_set__doc__},
{"free", pup_free, 1, pup_free__doc__},
{"do", pup_do, 1, pup_do__doc__},
{"set_shortcut", pup_set_shortcut, 1, pup_set_shortcut__doc__},
{"set_position", pup_set_position, 1, pup_set_position__doc__},
{"set_selection", pup_set_selection, 1, pup_set_selection__doc__},
{"set_fontsize", pup_set_fontsize, 1, pup_set_fontsize__doc__},
{"set_fontstyle", pup_set_fontstyle, 1, pup_set_fontstyle__doc__},
{"set_shadow", pup_set_shadow, 1, pup_set_shadow__doc__},
{"set_softedge", pup_set_softedge, 1, pup_set_softedge__doc__},
{"set_color", pup_set_color, 1, pup_set_color__doc__},
{"set_title", pup_set_title, 1, pup_set_title__doc__},
{"set_itemcb", pup_set_itemcb, 1, pup_set_itemcb__doc__},
{"set_menucb", pup_set_menucb, 1, pup_set_menucb__doc__},
{"set_submenu", pup_set_submenu, 1, pup_set_submenu__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initpopups) */
static char popups_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"popups", /* m_name */
popups_module_documentation, /* m_doc */
-1, /* m_size */
pup_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_popups()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("popups.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module popups");
}

View File

@ -1,313 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char posit_create__doc__[] =
"Creates a positioner"
;
static PyObject *
posit_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_positioner(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char posit_set_xvalue__doc__[] =
"Sets the x-value of the positioner"
;
static PyObject *
posit_set_xvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_positioner_xvalue((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_xvalue__doc__[] =
"Gets the x-value of the positioner"
;
static PyObject *
posit_get_xvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_positioner_xvalue((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char posit_set_xbounds__doc__[] =
"Sets the positioner's x min/max"
;
static PyObject *
posit_set_xbounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_positioner_xbounds ((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_xbounds__doc__[] =
"Gets the positioner's x min/max"
;
static PyObject *
posit_get_xbounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_positioner_xbounds ((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char posit_set_yvalue__doc__[] =
"Sets the y-value of the positioner"
;
static PyObject *
posit_set_yvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_positioner_yvalue((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_yvalue__doc__[] =
"Gets the y-value of the positioner"
;
static PyObject *
posit_get_yvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_positioner_yvalue((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char posit_set_ybounds__doc__[] =
"Sets the positioner's y min/max"
;
static PyObject *
posit_set_ybounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_positioner_ybounds ((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_ybounds__doc__[] =
"Gets the positioner's y min/max"
;
static PyObject *
posit_get_ybounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_positioner_ybounds ((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char posit_set_xstep__doc__[] =
"Sets the positioner x-step"
;
static PyObject *
posit_set_xstep(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_positioner_xstep ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_set_ystep__doc__[] =
"Sets the positioner y-step"
;
static PyObject *
posit_set_ystep(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_positioner_ystep ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_set_return__doc__[] =
"Makes the positioner return always or when released"
;
static PyObject *
posit_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_positioner_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef posit_methods[] = {
{"create", posit_create, 1, posit_create__doc__},
{"set_xvalue", posit_set_xvalue, 1, posit_set_xvalue__doc__},
{"get_xvalue", posit_get_xvalue, 1, posit_get_xvalue__doc__},
{"set_xbounds", posit_set_xbounds, 1, posit_set_xbounds__doc__},
{"get_xbounds", posit_get_xbounds, 1, posit_get_xbounds__doc__},
{"set_yvalue", posit_set_yvalue, 1, posit_set_yvalue__doc__},
{"get_yvalue", posit_get_yvalue, 1, posit_get_yvalue__doc__},
{"set_ybounds", posit_set_ybounds, 1, posit_set_ybounds__doc__},
{"get_ybounds", posit_get_ybounds, 1, posit_get_ybounds__doc__},
{"set_xstep", posit_set_xstep, 1, posit_set_xstep__doc__},
{"set_ystep", posit_set_ystep, 1, posit_set_ystep__doc__},
{"set_return", posit_set_return, 1, posit_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initpositioner) */
static char positioner_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"positioner", /* m_name */
positioner_module_documentation, /* m_doc */
-1, /* m_size */
posit_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_positioner()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("positioner.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module positioner");
}

View File

@ -1,274 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char slider_create__doc__[] =
""
;
static PyObject *
slider_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_slider(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char slider_create_val__doc__[] =
"Creates a val_slider"
;
static PyObject *
slider_create_val(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_valslider(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char slider_set_value__doc__[] =
"Sets the slider's value"
;
static PyObject *
slider_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_slider_value ((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_get_value__doc__[] =
"Gets the slider value"
;
static PyObject *
slider_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
v=fl_get_slider_value ((FL_OBJECT *)o);
return Py_BuildValue ("d",v);
}
static char slider_set_bounds__doc__[] =
"Sets the slider's min/max"
;
static PyObject *
slider_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_slider_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_get_bounds__doc__[] =
""
;
static PyObject *
slider_get_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_slider_bounds((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char slider_set_return__doc__[] =
"Makes the slider return always or when released"
;
static PyObject *
slider_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_slider_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_step__doc__[] =
"Sets the slider's step"
;
static PyObject *
slider_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_slider_step ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_size__doc__[] =
"Sets the slider's thingy size"
;
static PyObject *
slider_set_size(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_slider_size ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_precision__doc__[] =
"Sets the valslider's precision"
;
static PyObject *
slider_set_precision(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_slider_precision ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef slider_methods[] = {
{"create", slider_create, 1, slider_create__doc__},
{"create_val", slider_create_val, 1, slider_create_val__doc__},
{"set_value", slider_set_value, 1, slider_set_value__doc__},
{"get_value", slider_get_value, 1, slider_get_value__doc__},
{"set_bounds", slider_set_bounds, 1, slider_set_bounds__doc__},
{"get_bounds", slider_get_bounds, 1, slider_get_bounds__doc__},
{"set_return", slider_set_return, 1, slider_set_return__doc__},
{"set_step", slider_set_step, 1, slider_set_step__doc__},
{"set_size", slider_set_size, 1, slider_set_size__doc__},
{"set_precision", slider_set_precision, 1, slider_set_precision__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initslider) */
static char slider_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"slider", /* m_name */
slider_module_documentation, /* m_doc */
-1, /* m_size */
slider_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_slider()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("slider.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module slider");
}

View File

@ -1,450 +0,0 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char xyplot_set_return__doc__[] =
"Makes the XyPlot return always or when released"
;
static PyObject *
xyplot_set_return (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple (args, "li", &o, &i))
return NULL;
fl_set_xyplot_return ((FL_OBJECT *) o, i);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_xtics__doc__[] =
"Changes the number of xtics (major and minor) in a xyplot"
;
static PyObject *
xyplot_set_xtics (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i, j;
if (!PyArg_ParseTuple (args, "lii", &o, &i, &j))
return NULL;
fl_set_xyplot_xtics ((FL_OBJECT *) o, i, j);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_ytics__doc__[] =
"Changes the number of ytics (major and minor) in a xyplot"
;
static PyObject *
xyplot_set_ytics (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i, j;
if (!PyArg_ParseTuple (args, "lii", &o, &i, &j))
return NULL;
fl_set_xyplot_ytics ((FL_OBJECT *) o, i, j);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_xbounds__doc__[] =
"Sets the xmin and xmax in a xyplot"
;
static PyObject *
xyplot_set_xbounds (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double u, v;
if (!PyArg_ParseTuple (args, "ldd", &o, &u, &v))
return NULL;
fl_set_xyplot_xbounds ((FL_OBJECT *) o, u, v);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_ybounds__doc__[] =
"Sets the xmin and xmax in a xyplot"
;
static PyObject *
xyplot_set_ybounds (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double u, v;
if (!PyArg_ParseTuple (args, "ldd", &o, &u, &v))
return NULL;
fl_set_xyplot_ybounds ((FL_OBJECT *) o, u, v);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_get__doc__[] =
"Gets the current value of the point that changed"
;
static PyObject *
xyplot_get (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
float x, y;
int i;
if (!PyArg_ParseTuple (args, "l", &o))
return NULL;
fl_get_xyplot ((FL_OBJECT *) o, &x, &y, &i);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_get_data__doc__[] =
""
;
static PyObject *
xyplot_get_data (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_create__doc__[] =
""
;
static PyObject *
xyplot_create (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_data__doc__[] =
""
;
static PyObject *
xyplot_set_data (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_file__doc__[] =
""
;
static PyObject *
xyplot_set_file (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_add_text__doc__[] =
""
;
static PyObject *
xyplot_add_text (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_delete_text__doc__[] =
""
;
static PyObject *
xyplot_delete_text (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_add_overlay__doc__[] =
""
;
static PyObject *
xyplot_add_overlay (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_overlay_type__doc__[] =
""
;
static PyObject *
xyplot_set_overlay_type (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_delete_overlay__doc__[] =
""
;
static PyObject *
xyplot_delete_overlay (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_interpolate__doc__[] =
""
;
static PyObject *
xyplot_set_interpolate (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_fontsize__doc__[] =
""
;
static PyObject *
xyplot_set_fontsize (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_fontstyle__doc__[] =
""
;
static PyObject *
xyplot_set_fontstyle (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_inspect__doc__[] =
""
;
static PyObject *
xyplot_set_inspect (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_symbolsize__doc__[] =
""
;
static PyObject *
xyplot_set_symbolsize (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_replace_point__doc__[] =
""
;
static PyObject *
xyplot_replace_point (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef xyplot_methods[] =
{
{"set_return", xyplot_set_return, 1, xyplot_set_return__doc__},
{"set_xtics", xyplot_set_xtics, 1, xyplot_set_xtics__doc__},
{"set_ytics", xyplot_set_ytics, 1, xyplot_set_ytics__doc__},
{"set_xbounds", xyplot_set_xbounds, 1, xyplot_set_xbounds__doc__},
{"set_ybounds", xyplot_set_ybounds, 1, xyplot_set_ybounds__doc__},
{"get", xyplot_get, 1, xyplot_get__doc__},
{"get_data", xyplot_get_data, 1, xyplot_get_data__doc__},
{"create", xyplot_create, 1, xyplot_create__doc__},
{"set_data", xyplot_set_data, 1, xyplot_set_data__doc__},
{"set_file", xyplot_set_file, 1, xyplot_set_file__doc__},
{"add_text", xyplot_add_text, 1, xyplot_add_text__doc__},
{"delete_text", xyplot_delete_text, 1, xyplot_delete_text__doc__},
{"add_overlay", xyplot_add_overlay, 1, xyplot_add_overlay__doc__},
{"set_overlay_type", xyplot_set_overlay_type, 1, xyplot_set_overlay_type__doc__},
{"delete_overlay", xyplot_delete_overlay, 1, xyplot_delete_overlay__doc__},
{"set_interpolate", xyplot_set_interpolate, 1, xyplot_set_interpolate__doc__},
{"set_fontsize", xyplot_set_fontsize, 1, xyplot_set_fontsize__doc__},
{"set_fontstyle", xyplot_set_fontstyle, 1, xyplot_set_fontstyle__doc__},
{"set_inspect", xyplot_set_inspect, 1, xyplot_set_inspect__doc__},
{"set_symbolsize", xyplot_set_symbolsize, 1, xyplot_set_symbolsize__doc__},
{"replace_point", xyplot_replace_point, 1, xyplot_replace_point__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initxyplot) */
static char xyplot_module_documentation[] =
""
;
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"xyplot", /* m_name */
xyplot_module_documentation, /* m_doc */
-1, /* m_size */
xyplot_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_xyplot ()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict (m);
ErrorObject = PyBytes_FromString ("xyplot.error");
PyDict_SetItemString (d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred ())
Py_FatalError ("can't initialize module xyplot");
}

View File

@ -1,739 +0,0 @@
##########################################################
# This is the Python interface to the pyxforms C module
#
import sys
import xforms
import forms
import objects
import bitmaps
import pixmaps
import box
import browser
import button
import choice
import clock
import counter
import dial
import frame
import input
import menu
import positioner
import slider
import timer
###############################################################################
# These are function needed to run the XForms library
# Needs a LOT of work
def xfinit (appname,appclass,argv0):
xforms.init (appname,appclass,argv0)
###############################################################################
# This is the synthetic event-loop to use under python:
_objects={}
def runforms():
while 1:
ob=_objects[str(xforms.do_forms())]
ob.cb (ob.args)
###############################################################################
# This is the default callback function:
def _nocb(args):
print("This object has no Callback!")
##############################################################################
#This is the Form class
class Form:
def __init__(self,t=6,w=200,h=200):
self.id=forms.create (0,w,h)
self.__box=Box(t,0,0,w,h,"")
self.Add (self.__box)
self.__box.c1=11
self.__box.c2=15
self.__minx=1 # Reasonable defaults for things that
self.__miny=1 # I can't get from XForms
self.__maxx=10000 # Notice that if the C code changes them
self.__maxy=10000 # They get out of sync!
self.__title=sys.argv[0] #the "preferred" form title
self.__placement=16388
self.__decoration=1
self.objs=() # A place to store the obj list. Useful?
def Show (self):
self.winid=forms.show (self.id,self.__placement,self.__decoration,self.title)
def Hide (self):
forms.hide (self.id)
def Freeze (self):
forms.freeze (self.id)
def Unfreeze (self):
forms.unfreeze (self.id)
def Activate (self):
forms.activate (self.id)
def Deactivate (self):
forms.deactivate (self.id)
def Scale (self,x,y):
forms.scale (self.id,x,y)
def Redraw (self):
forms.redraw (self.id)
def Add (self,object):
forms.add_object (self.id,object.id)
object.parent=self
def Setminsize (self,x,y):
forms.set_minsize (self.id,x,y)
self.__minx=x # The __ is needed to avoid endless looping
self.__miny=y # on min[xy], which are non-gettable from XForms
def Setmaxsize (self,x,y):
forms.set_maxsize (self.id,x,y)
self.__maxx=x
self.__maxy=y
def Settitle (self,title):
forms.set_title (self.id,title)
self.__title=title
def Gettitle (self):
if self.visible:
return forms.get_title(self.id)
else:
return self.__title
def Setcolor (c1,c2):
self.__box.Setcolor (c1,c2)
def __setattr__(self,name,value):
if name=="x":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,value,ty,tw,th)
elif name=="y":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,value,tw,th)
elif name=="w":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,ty,value,th)
elif name=="h":
(tx,ty,tw,th)=forms.get_geometry (self.id)
forms.set_geometry (self.id,tx,ty,tw,value)
elif name=="dblbuffer":
forms.set_dblbuffer(self.id,value)
elif name=="frozen":
if value:
self.Freeze()
else:
self.Unfreeze()
elif name=="active":
if value:
self.Activate()
else:
self.Deactivate()
elif name=="visible":
if value:
self.Show()
else:
self.Hide()
elif name=="minx":
self.Setminsize (value,self.__miny)
elif name=="miny":
self.Setminsize (self.__minx,value)
elif name=="maxx":
self.Setminsize (value,self.__maxy)
elif name=="maxy":
self.Setminsize (self.__maxx,value)
elif name=="title":
self.Settitle (value)
elif name=="c1":
self.__box.c1=value
elif name=="c2":
self.__box.c2=value
else:
self.__dict__ [name]=value
def __getattr__(self,name):
if name=="x":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return tx
elif name=="y":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return ty
elif name=="w":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return tw
elif name=="h":
(tx,ty,tw,th)=forms.get_geometry (self.id)
return th
elif name=="minx":
return self.__minx
elif name=="miny":
return self.__miny
elif name=="maxx":
return self.__maxx
elif name=="maxy":
return self.__maxy
elif name=="vmode":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return vmode
elif name=="active":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return active
elif name=="dblbuffer":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return dblbuffer
elif name=="frozen":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return frozen
elif name=="visible":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return visible
elif name=="border":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return border
elif name=="other":
(vmode,active,dblbuffer,frozen,visible,border,other)=forms.get_attr(self.id)
return other
elif name=="title":
return self.Gettitle ()
elif name=="c1":
return self.__box.c1
elif name=="c2":
return self.__box.c2
def __del__(self):
pass
#I'm not sure if this is a nice thing to do
# forms.free (self.id)
###############################################################################
#This is the XFObject class, for generic XForms objects
class XFObject:
def __init__ (self):
self.id=0
self.__c1=11
self.__c2=15
def Setgravity (self,a,b):
objects.set_gravity (self.id,a,b)
def Redraw (self):
objects.redraw (self.id)
def Scale (self,x,y):
objects.scale (self.id,x,y)
def Show (self):
objects.show (self.id)
self.Setcolor (self.__c1,self.__c2)
def Hide (self):
objects.hide (self.id)
def Delete(self):
objects.delete (self.id)
def Setcolor (self,c1,c2):
self.__c1=c1
self.__c2=c2
objects.set_color (self.id,c1,c2)
def Activate (self):
objects.activate (self.id)
def Deactivate (self):
objects.deactivate (self.id)
def __setattr__ (self,name,value):
if name=="boxtype":
objects.set_boxtype (self.id,value)
elif name=="bw":
objects.set_bw (self.id,value)
elif name=="labelsize":
objects.set_ls (self.id,value)
elif name=="labelstyle":
objects.set_lstyle (self.id,value)
elif name=="labelcolor":
objects.set_lcol (self.id,value)
elif name=="labelalign":
objects.set_lalign (self.id,value)
elif name=="label":
objects.set_label (self.id,value)
elif name=="shortcut":
objects.set_shortcut (self.id,value,1)
elif name=="dblbuffer":
objects.set_dblbuffer(self.id,value)
elif name=="x":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,value,ty,tw,th)
elif name=="y":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,value,tw,th)
elif name=="w":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,ty,value,th)
elif name=="h":
(tx,ty,tw,th)=objects.get_geometry (self.id)
objects.set_geometry (self.id,tx,ty,tw,value)
elif name=="resize":
objects.set_resize (self.id,value)
elif name=="c1":
self.Setcolor (value,self.__c2)
elif name=="c2":
self.Setcolor (self.__c1,value)
else:
self.__dict__ [name]=value
def __getattr__(self,name):
if name=="c1":
return self.__c1
elif name=="c2":
return self.__c2
def __del__ (self):
#probably a BAD idea
objects.free(self.id)
###############################################################################
# The Bitmap Class
class Bitmap(XFObject):
def __init__(self,t=0,x=10,y=10,w=100,h=100,l="Bitmap"):
XFObject.__init__ (self)
self.id=bitmaps.create(t,x,y,w,h,l)
def Load (self,file):
bitmaps.set_file (self.id,file)
def __setattr__ (self,name,value):
if name=="background":
objects.set_color(self.id,value,0)
elif name=="foreground":
objects.set_lcol(self.id,value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
# The Pixmap Class
class Pixmap(XFObject):
def __init__(self,t=0,x=10,y=10,w=100,h=100,l="Pixmap"):
XFObject.__init__ (self)
self.id=pixmaps.create(t,x,y,w,h,l)
def Load (self,file):
pixmaps.set_file (self.id,file)
def __setattr__ (self,name,value):
if name=="background":
objects.set_color(self.id,value,0)
elif name=="foreground":
objects.set_lcol(self.id,value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
# The Box Class
class Box(XFObject):
def __init__(self,t=6,x=10,y=10,w=90,h=90,l="Box"):
XFObject.__init__ (self)
self.id=box.create(t,x,y,w,h,l)
###############################################################################
# The Browser class
#
# I want the Browser class to act just like what it is: a list
# only with a "few" more methods and stuff
class Browser (XFObject):
def __init__(self,t=1,x=10,y=10,w=90,h=120,l="Browser"):
XFObject.__init__ (self)
self.id=browser.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Add(self,line):
browser.add_line (self.id,line)
def Addto(self,line):
browser.addto (self.id,line)
def Insert(self,n,line):
browser.insert_line(self.id,n,line)
def Delete(self,n):
browser.delete_line(self.id,n)
def Replace(self,n,line):
browser.replace_line(self.id,n,line)
def Getline(self,n):
return browser.get_line (self.id,n)
def Load(self,path):
return browser.load (self.id,path)
def Select(self,n):
browser.select_line (self.id,n)
def Deselect(self,n):
browser.deselect_line (self.id,n)
def Deselectall(self):
browser.deselect(self.id)
def Isselected(self,n):
return browser.isselected_line(self.id,n)
def Gettopline(self):
return browser.get_topline(self.id)
def Get(self):
return browser.get(self.id)
def Getmaxline(self):
return browser.get_maxline(self.id)
def Screenlines(self):
return browser.get_screenlines(self.id)
def Settopline(self,n):
browser.set_topline(self.id,n)
def Setfontsize(self,n):
browser.set_fontsize(self.id,n)
def Setfontstyle(self,n):
browser.set_fontstyle(self.id,n)
def Setspecialkey(self,c):
browser.set_specialkey(self.id,c)
def Setleftslider(self,l):
browser.set_leftslider(self.id,l)
def __setattr__ (self,name,value):
if name=="leftslider":
self.Setleftslider(value)
elif name=="specialkey":
self.Setspecialkey(value)
elif name=="fontstyle":
self.Setfontstyle(value)
elif name=="fontsize":
self.Setfontsize(value)
elif name=="topline":
self.Settopline(value)
else:
XFObject.__setattr__(self,name,value)
###############################################################################
#This is the Button class.
class Button(XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Button"):
XFObject.__init__ (self)
self.id=button.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def __call__(self,v=-1):
# I think this is nice: if you have a button called b,
# b() returns the button's value
# b(1) or b(0) SETS the button value.
# You can also set/get it with b.value, though
if v==-1:
return button.get(self.id)
else:
button.set (self.id,v)
def __setattr__ (self,name,value):
if name=="value":
self(value)
else:
XFObject.__setattr__(self,name,value)
def __getattr__ (self,name):
if name=="value":
return self()
elif name=="numb":
return button.get_numb (self.id)
pass
else:
return XFObject.__getattr__(self,name)
###############################################################################
# This is the Roundbutton class
class Roundbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Roundbutton"):
XFObject.__init__ (self)
self.id=button.create_round(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Lightbutton class
class Lightbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Lightbutton"):
XFObject.__init__ (self)
self.id=button.create_light(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Checkbutton class
class Checkbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Checkbutton"):
XFObject.__init__ (self)
self.id=button.create_check(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Bitmapbutton class
class Bitmapbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Bitmapbutton"):
XFObject.__init__ (self)
self.id=button.create_bitmap(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Pixmapbutton class
class Pixmapbutton (Button):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Pixmapbutton"):
XFObject.__init__ (self)
self.id=button.create_pixmap(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
###############################################################################
# This is the Choice Class
#This one needs a getattr, setattr pair
class Choice (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Choice"):
XFObject.__init__ (self)
self.id=choice.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Clear (self):
choice.clear(self.id)
def Addto (self,s):
choice.addto(self.id,s)
def Replace (self,n,s):
choice.replace(self.id,n,s)
def Delete (self,n):
choice.delete(self.id,n)
def Set (self,n):
choice.set(self.id,n)
def Settext (self,s):
choice.set_text (self.id,s)
def Get (self):
return choice.get (self.id)
def Getmaxitems (self):
return choice.get_maxitems (self.id)
def Gettext (self):
return choice.get_text (self.id)
def Setfontsize (self,n):
choice.set_fontsize(self.id,n)
def Setalign (self,n):
choice.set_align (self.id,n)
def Setmode (self,n,m):
choice.set_item_mode (self.id,n,m)
##############################################################################
# This is the clock class
class Clock (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=90,l="Clock"):
XFObject.__init__ (self)
self.id=clock.create(t,x,y,w,h,l)
def Get (self):
return clock.get (self.id)
##############################################################################
# This is the counter class
class Counter (XFObject):
def __init__(self,t=0,x=10,y=10,w=90,h=30,l="Counter"):
XFObject.__init__ (self)
self.id=counter.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
counter.set_value (self.id,v)
def Setbounds (self,min,max):
counter.set_bounds (self.id,min,max)
def Setstep (self,s1,s2):
counter.set_step (self.id,s1,s2)
def Setprecision (self,p):
counter.set_precision (self.id,p)
def Get (self):
return counter.get_value (self.id)
def Setreturn (self,v):
counter.set_return (self.id,v)
##############################################################################
# This is the Dial class
class Dial (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Dial"):
XFObject.__init__ (self)
self.id=dial.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
dial.set_value(self.id,v)
def Get (self):
return dial.get_value (self.id)
def Setbounds (self,min,max):
dial.set_bounds (self.id,min,max)
def Getbounds (self):
return dial.get_bounds (self.id)
def Setstep (self,v):
dial.set_step (self.id,v)
def Setreturn (self,v):
dial.set_return (self.id,v)
###############################################################################
# This is the Frame class
class Frame (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Frame"):
XFObject.__init__ (self)
self.id=frame.create(t,x,y,w,h,l)
###############################################################################
# This is the Input class
class Input (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Input"):
XFObject.__init__ (self)
self.id=input.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,s):
input.set (self.id,s)
def Setcolor (self,c1,c2):
input.set_color (self.id,c1,c2)
def Get (self):
return input.get(self.id)
def Setreturn (self,v):
input.set_return (self.id,v)
def Setscroll (self,v):
input.set_scroll (self.id,v)
def Setcursorpos (self,x,y=1):
input.set_cursorpos (self.id,x,y)
def Setselected (self,v):
input.set_selected (self.id,v)
def Setselectedrange (self,x1,x2):
input.set_selected_range (self.id,x1,x2)
def __setattr__ (self,name,value):
if name=="value":
self.Set(value)
else:
XFObject.__setattr__(self,name,value)
def __getattr__ (self,name):
if name=="value":
return self.Get()
else:
return XFObject.__getattr__(self,name)
###############################################################################
# This is the Menu class
class Menu (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Menu"):
XFObject.__init__ (self)
self.id=menu.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Clear (self):
menu.clear (self.id)
def Set (self,s):
menu.set (self.id,s)
def Addto (self,s):
menu.addto(self.id,s)
def Replace (self,n,s):
menu.replace_item (self.id,n,s)
def Delete (self,n):
menu.delete_item (self.id,n)
def Setshortcut (self,n,s):
menu.set_item_shortcut (self.id,n,s)
def Setmode (self,n,m):
menu.set_item_mode (self.id,n,m)
def Showsymbol (self,n):
menu.show_symbol (self.id,n)
def Get (self):
return menu.get (self.id)
def Getmaxitems (self):
return menu.get_maxitems (self.id)
def Gettext (self):
return menu.get_text (self.id)
###############################################################################
# This is the Positioner class
class Positioner (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=60,l="Positioner"):
XFObject.__init__ (self)
self.id=positioner.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Setx (self,v):
positioner.set_xvalue (self.id,v)
def Sety (self,v):
positioner.set_yvalue (self.id,v)
def Setxbounds (self,x1,x2):
positioner.set_xbounds (self.id,x1,x2)
def Setybounds (self,y1,y2):
positioner.set_ybounds (self.id,y1,y2)
def Setxstep (self,v):
positioner.set_xstep (self.id,v)
def Setystep (self,v):
positioner.set_ystep (self.id,v)
def Getx (self):
return positioner.get_xvalue (self.id)
def Gety (self):
return positioner.get_yvalue (self.id)
def Getxbounds (self):
positioner.get_xbounds (self.id)
def Getybounds (self):
positioner.get_ybounds (self.id)
def Setreturn (self,v):
positioner.set_return (self.id,v)
###############################################################################
# This is the Slider class
class Slider (XFObject):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Slider"):
XFObject.__init__ (self)
self.id=slider.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Get (self):
return slider.get_value (self.id)
def Set (self,v):
slider.set_value(self.id,v)
def Getbounds (self):
return slider.get_bounds (self.id)
def Setbounds (self,v1,v2):
slider.set_bounds(self.id,v1,v2)
def Setreturn (self,v):
slider.set_return (self.id,v)
def Setstep (self,v):
slider.set_step (self.id,v)
def Setsize (self,v):
slider.set_size (self.id,v)
###############################################################################
# This is the Valslider class
class Valslider (Slider):
def __init__(self,t=0,x=10,y=10,w=60,h=30,l="Valslider"):
XFObject.__init__ (self)
self.id=slider.create_val(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Setprecision (self,v):
slider.set_precision (self.id,v)
##############################################################################
# This is the Timer class
class Timer (XFObject):
def __init__(self,t=1,x=10,y=10,w=60,h=30,l="Timer"):
XFObject.__init__ (self)
self.id=timer.create(t,x,y,w,h,l)
_objects[str(self.id)]=self
self.cb=_nocb
self.args=self
def Set (self,v):
timer.set(self.id,v)
def Get (self):
return timer.get (self.id)

View File

@ -1,4 +1,4 @@
This is the 0.1 Alpha release pf pyxform, my interface between Python 1.3 This is the 0.3 Alpha release pf pyxform, my interface between Python
And The XForms library. And The XForms library.
You need: You need:
@ -7,33 +7,26 @@ A standard Unix, whit X-window, and Xpm library
I only tested it under Linux (it used to be a Slackware 3.0 ELF), but I only tested it under Linux (it used to be a Slackware 3.0 ELF), but
should do well under anything XForms and Python work. should do well under anything XForms and Python work.
XForms 0.8 XForms 1.24 or later
It's a free-for-non-commercial-use Widget library for X11 It's a free-for-non-commercial-use Widget library for X11
you can get it at: you can get it at:
http://bragg.phys.uwm.edu/xforms http://xforms-toolkit.org
BE CAREFUL: YOU NEED THE 0.80 beta, not the 0.75 official.
Python 1.3 Python 3.8 or later
It's a beautiful ,free, language. It's a beautiful ,free, language.
Get it from Get it from
ftp://ftp.python.org
http://www.python.org http://www.python.org
It's still fairly incomplete, mainly because of lack of free time, but it It's still fairly incomplete, mainly because of lack of free time, but it
is functional. is functional.
Also, it only covers the functionality of XForms 0.8, any new widgets or
methods added after that are not wrapped.
I tried to provide the easiest possible way to make a GUI for python under I tried to provide the easiest possible way to make a GUI for python under
UNIX, and think it's ready to be seen. UNIX, and think it's ready to be seen.
Sadly, there are no docs, yet, but the examples should be enough to get a Sadly, there are no docs, yet, but the examples should be enough to get a
taste of the module, and the source should be readable. taste of the module, and the source should be readable.
To add it to your Python, put the *.c files in the Modules directory in BTW: If anyone likes it, email me at roberto.alsina@gmail.com
Python-1.3/Modules.
Add Modules/Setup.pyxform at the end of your Python-1.3/Modules/Setup file,
and edit it for your site.
BTW: If anyone likes it, email me at ralsina@unl.edu.ar
And for those non-unix people: Dr Zhao (The XForms author) say the next
version will have win32 support....

View File

@ -7,12 +7,8 @@ In order to fully understand this (and use the hundreds of things not
demonstrated), you should: demonstrated), you should:
a) Read the XForms docs a) Read the XForms docs
b) Read the Pyxform.py file b) Read the pyxforms/__init__.py file
c) Read all the .c files c) Read all the .c files
Anyway, it's just a sampler, this should get MUCH more complete soon Anyway, it's just a sampler, this should get MUCH more complete soon
Anyway, you can email me
Roberto Alsina
ralsina@unl.edu.ar

View File

@ -1,11 +1,11 @@
#!/usr/local/bin/python #!/usr/bin/env python
from Pyxform import * from pyxforms import *
# #
# Init the library (sucks but works) # Init the library (sucks but works)
# #
xfinit ('Something','1',sys.argv[0]) xfinit("Something", "1", sys.argv[0])
# #
# Create a "Window" - A form in XForms parlance # Create a "Window" - A form in XForms parlance

53
examples/demo2.py Executable file
View File

@ -0,0 +1,53 @@
#!/usr/bin/env python
from pyxforms import *
from pyxforms.goodies import *
#
# Init the library (sucks but works)
#
xfinit("Something", "1", sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win = Form()
#
# Show it
win.Show()
#
# Create a button
a_button = Button(0, 10, 10, 100, 30, "Press Me")
#
# Put it inside win
win.Add(a_button)
#
# Define a function, that will be executed when the button is pressed
def funct(self):
# It shows a message and exits (or not)
answer = show_question("Do you want to exit?", "")
if answer == 1:
sys.exit()
#
# And bind the function to the button
a_button.cb = funct
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

77
examples/demo3.py Executable file
View File

@ -0,0 +1,77 @@
#!/usr/bin/env python
from pyxforms import *
from pyxforms.goodies import *
#
# Init the library (sucks but works)
#
xfinit("Something", "1", sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win = Form()
#
# Show it
win.Show()
#
# Create a button, and 2 sliders
a_button = Button(0, 10, 10, 100, 30, "Press Me")
h_slider = Slider(5, 0, 180, 200, 20, "")
v_slider = Slider(4, 180, 0, 20, 180, "")
#
# Set some values for the sliders
h_slider.Setbounds(0, 200)
h_slider.Set(0)
v_slider.Setbounds(0, 200)
v_slider.Set(0)
#
# Put them inside win
win.Add(a_button)
win.Add(h_slider)
win.Add(v_slider)
#
# Define a function, that will be executed when the button is pressed
def funct(self):
# It shows a message and exits (or not)
answer = show_question("Do you want", "to exit?", "")
if answer == 1:
sys.exit()
#
# And another one, for when the sliders move
def slide(self):
# It moves the button to the position of the sliders
a_button.x = h_slider.Get()
a_button.y = v_slider.Get()
#
# And bind the functions to the controls
a_button.cb = funct
h_slider.cb = v_slider.cb = slide
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

80
examples/demo4.py Executable file
View File

@ -0,0 +1,80 @@
#!/usr/bin/env python
from pyxforms import *
from pyxforms.goodies import *
#
# Init the library (sucks but works)
#
xfinit("Something", "1", sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win = Form()
#
# Show it
win.Show()
#
# Create a button, and 2 valsliders
a_button = Button(0, 10, 10, 100, 30, "Press Me")
h_slider = Valslider(5, 0, 180, 200, 20, "")
v_slider = Valslider(4, 180, 0, 20, 180, "")
#
# Set some values for the sliders
h_slider.Setbounds(0, 200)
h_slider.Set(0)
h_slider.Setprecision(0)
v_slider.Setbounds(0, 200)
v_slider.Set(0)
v_slider.Setprecision(0)
#
# Put them inside win
win.Add(a_button)
win.Add(h_slider)
win.Add(v_slider)
#
# Define a function, that will be executed when the button is pressed
def funct(self):
# It shows a message and exits (or not)
answer = show_question("Do you want", "to exit?", "")
if answer == 1:
sys.exit()
#
# And another one, for when the sliders move
def slide(self):
# It moves the button to the position of the sliders
a_button.x = h_slider.Get()
a_button.y = v_slider.Get()
#
# And bind the functions to the controls
a_button.cb = funct
h_slider.cb = v_slider.cb = slide
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

65
examples/demo5.py Executable file
View File

@ -0,0 +1,65 @@
#!/usr/local/bin/python
from pyxforms import *
from goodies import *
#
# Init the library (sucks but works)
#
xfinit("Something", "1", sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win = Form(6, 640, 480)
#
# Show it
win.Show()
#
# Create a browser and a Button
brow = Browser(0, 10, 10, 620, 440, "Read Me")
but1 = Button(0, 10, 450, 100, 25, "Push Me")
but2 = Button(0, 120, 450, 100, 25, "Exit")
#
# Put them inside win
win.Add(brow)
win.Add(but1)
win.Add(but2)
#
# The exit function
def funct(self):
# It shows a message and exits (or not)
answer = show_question("Do you want", "to exit?", "")
if answer == 1:
sys.exit()
but2.cb = funct
#
# And the interesting function
def browse_file(self):
# Asks for a file, and puts it in the browser
filename = show_fselector("", "", "", "")
brow.Load(filename)
but1.cb = browse_file
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

24
pyproject.toml Normal file
View File

@ -0,0 +1,24 @@
[project]
name = "pyxforms"
version = "0.3.0"
description = "A Python binding for XForms"
authors = [
{ name = "Roberto Alsina", email = "roberto.alsina@gmail.com" }
]
dependencies = []
readme = "README.md"
requires-python = ">= 3.8"
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[tool.rye]
managed = true
dev-dependencies = []
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["src/pyxforms"]

11
requirements-dev.lock Normal file
View File

@ -0,0 +1,11 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
-e file:.

11
requirements.lock Normal file
View File

@ -0,0 +1,11 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false
# generate-hashes: false
-e file:.

View File

@ -1,51 +0,0 @@
#!/usr/local/bin/python
from Pyxform import *
from goodies import *
#
# Init the library (sucks but works)
#
xfinit ('Something','1',sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win=Form()
#
# Show it
win.Show()
#
# Create a button
a_button=Button(0,10,10,100,30,"Press Me")
#
# Put it inside win
win.Add (a_button)
#
# Define a function, that will be executed when the button is pressed
def funct (self):
# It shows a message and exits (or not)
answer=show_question ("Do you want","to exit?","")
if answer==1:
sys.exit()
#
# And bind the function to the button
a_button.cb=funct
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

View File

@ -1,75 +0,0 @@
#!/usr/local/bin/python
from Pyxform import *
from goodies import *
#
# Init the library (sucks but works)
#
xfinit ('Something','1',sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win=Form()
#
# Show it
win.Show()
#
# Create a button, and 2 sliders
a_button=Button(0,10,10,100,30,"Press Me")
h_slider=Slider(5,0,180,200,20,"")
v_slider=Slider(4,180,0,20,180,"")
#
# Set some values for the sliders
h_slider.Setbounds(0,200)
h_slider.Set(0)
v_slider.Setbounds(0,200)
v_slider.Set(0)
#
# Put them inside win
win.Add (a_button)
win.Add (h_slider)
win.Add (v_slider)
#
# Define a function, that will be executed when the button is pressed
def funct (self):
# It shows a message and exits (or not)
answer=show_question ("Do you want","to exit?","")
if answer==1:
sys.exit()
#
# And another one, for when the sliders move
def slide (self):
# It moves the button to the position of the sliders
a_button.x=h_slider.Get()
a_button.y=v_slider.Get()
#
# And bind the functions to the controls
a_button.cb=funct
h_slider.cb=v_slider.cb=slide
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

View File

@ -1,77 +0,0 @@
#!/usr/local/bin/python
from Pyxform import *
from goodies import *
#
# Init the library (sucks but works)
#
xfinit ('Something','1',sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win=Form()
#
# Show it
win.Show()
#
# Create a button, and 2 valsliders
a_button=Button(0,10,10,100,30,"Press Me")
h_slider=Valslider(5,0,180,200,20,"")
v_slider=Valslider(4,180,0,20,180,"")
#
# Set some values for the sliders
h_slider.Setbounds(0,200)
h_slider.Set(0)
h_slider.Setprecision(0)
v_slider.Setbounds(0,200)
v_slider.Set(0)
v_slider.Setprecision(0)
#
# Put them inside win
win.Add (a_button)
win.Add (h_slider)
win.Add (v_slider)
#
# Define a function, that will be executed when the button is pressed
def funct (self):
# It shows a message and exits (or not)
answer=show_question ("Do you want","to exit?","")
if answer==1:
sys.exit()
#
# And another one, for when the sliders move
def slide (self):
# It moves the button to the position of the sliders
a_button.x=h_slider.Get()
a_button.y=v_slider.Get()
#
# And bind the functions to the controls
a_button.cb=funct
h_slider.cb=v_slider.cb=slide
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

View File

@ -1,60 +0,0 @@
#!/usr/local/bin/python
from Pyxform import *
from goodies import *
#
# Init the library (sucks but works)
#
xfinit ('Something','1',sys.argv[0])
#
# Create a "Window" - A form in XForms parlance
win=Form(6,640,480)
#
# Show it
win.Show()
#
# Create a browser and a Button
brow=Browser(0,10,10,620,440,"Read Me")
but1=Button (0,10,450,100,25,"Push Me")
but2=Button (0,120,450,100,25,"Exit")
#
# Put them inside win
win.Add (brow)
win.Add (but1)
win.Add (but2)
#
# The exit function
def funct (self):
# It shows a message and exits (or not)
answer=show_question ("Do you want","to exit?","")
if answer==1:
sys.exit()
but2.cb=funct
#
# And the interesting function
def browse_file(self):
# Asks for a file, and puts it in the browser
filename=show_fselector("","","","")
brow.Load (filename)
but1.cb=browse_file
#
# Start the event loop
# It will run until you press the button and say yes
runforms()

View File

@ -1,5 +0,0 @@
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0

230
setup.py
View File

@ -1,99 +1,139 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from setuptools import setup, Extension from setuptools import setup, Extension
bitmaps = Extension('Pyxform.bitmaps', bitmaps = Extension(
sources = [ 'Pyxform/Modules/bitmaps.c'], name="pyxforms.bitmaps",
libraries = ['forms'], sources=["src/pyxforms/bitmaps.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
box = Extension('Pyxform.box', )
sources = [ 'Pyxform/Modules/box.c'], box = Extension(
libraries = ['forms'], name="pyxforms.box",
library_dirs = ['/usr/local/lib']) sources=["src/pyxforms/box.c"],
browser = Extension('Pyxform.browser', libraries=["forms"],
sources = [ 'Pyxform/Modules/browser.c'], )
libraries = ['forms'], browser = Extension(
library_dirs = ['/usr/local/lib']) name="pyxforms.browser",
button = Extension('Pyxform.button', sources=["src/pyxforms/browser.c"],
sources = [ 'Pyxform/Modules/button.c'], libraries=["forms"],
libraries = ['forms'], )
library_dirs = ['/usr/local/lib']) button = Extension(
choice = Extension('Pyxform.choice', name="pyxforms.button",
sources = [ 'Pyxform/Modules/choice.c'], sources=["src/pyxforms/button.c"],
libraries = ['forms'], libraries=["forms"],
library_dirs = ['/usr/local/lib']) )
clock = Extension('Pyxform.clock', choice = Extension(
sources = [ 'Pyxform/Modules/clock.c'], name="pyxforms.choice",
libraries = ['forms'], sources=["src/pyxforms/choice.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
counter = Extension('Pyxform.counter', )
sources = [ 'Pyxform/Modules/counter.c'], clock = Extension(
libraries = ['forms'], name="pyxforms.clock",
library_dirs = ['/usr/local/lib']) sources=["src/pyxforms/clock.c"],
dial = Extension('Pyxform.dial', libraries=["forms"],
sources = [ 'Pyxform/Modules/dial.c'], )
libraries = ['forms'], counter = Extension(
library_dirs = ['/usr/local/lib']) name="pyxforms.counter",
forms = Extension('Pyxform.forms', sources=["src/pyxforms/counter.c"],
sources = [ 'Pyxform/Modules/forms.c'], libraries=["forms"],
libraries = ['forms'], )
library_dirs = ['/usr/local/lib']) dial = Extension(
frame = Extension('Pyxform.frame', name="pyxforms.dial",
sources = [ 'Pyxform/Modules/frame.c'], sources=["src/pyxforms/dial.c"],
libraries = ['forms'], libraries=["forms"],
library_dirs = ['/usr/local/lib']) )
goodies = Extension('Pyxform.goodies', forms = Extension(
sources = [ 'Pyxform/Modules/goodies.c'], name="pyxforms.forms",
libraries = ['forms'], sources=["src/pyxforms/forms.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
input = Extension('Pyxform.input', )
sources = [ 'Pyxform/Modules/input.c'], frame = Extension(
libraries = ['forms'], name="pyxforms.frame",
library_dirs = ['/usr/local/lib']) sources=["src/pyxforms/frame.c"],
menu = Extension('Pyxform.menu', libraries=["forms"],
sources = [ 'Pyxform/Modules/menu.c'], )
libraries = ['forms'], goodies = Extension(
library_dirs = ['/usr/local/lib']) name="pyxforms.goodies",
objects = Extension('Pyxform.objects', sources=["src/pyxforms/goodies.c"],
sources = [ 'Pyxform/Modules/objects.c'], libraries=["forms"],
libraries = ['forms'], )
library_dirs = ['/usr/local/lib']) input = Extension(
pixmaps = Extension('Pyxform.pixmaps', name="pyxforms.input",
sources = [ 'Pyxform/Modules/pixmaps.c'], sources=["src/pyxforms/input.c"],
libraries = ['forms'], libraries=["forms"],
library_dirs = ['/usr/local/lib']) )
popups = Extension('Pyxform.popups', menu = Extension(
sources = [ 'Pyxform/Modules/popups.c'], name="pyxforms.menu",
libraries = ['forms'], sources=["src/pyxforms/menu.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
positioner = Extension('Pyxform.positioner', )
sources = [ 'Pyxform/Modules/positioner.c'], objects = Extension(
libraries = ['forms'], name="pyxforms.objects",
library_dirs = ['/usr/local/lib']) sources=["src/pyxforms/objects.c"],
slider = Extension('Pyxform.slider', libraries=["forms"],
sources = [ 'Pyxform/Modules/slider.c'], )
libraries = ['forms'], pixmaps = Extension(
library_dirs = ['/usr/local/lib']) name="pyxforms.pixmaps",
text = Extension('Pyxform.text', sources=["src/pyxforms/pixmaps.c"],
sources = [ 'Pyxform/Modules/text.c'], libraries=["forms"],
libraries = ['forms'], )
library_dirs = ['/usr/local/lib']) popups = Extension(
timer = Extension('Pyxform.timer', name="pyxforms.popups",
sources = [ 'Pyxform/Modules/timer.c'], sources=["src/pyxforms/popups.c"],
libraries = ['forms'], libraries=["forms"],
library_dirs = ['/usr/local/lib']) )
xforms = Extension('Pyxform.xforms', positioner = Extension(
sources = [ 'Pyxform/Modules/xforms.c'], name="pyxforms.positioner",
libraries = ['forms'], sources=["src/pyxforms/positioner.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
xyplot = Extension('Pyxform.xyplot', )
sources = [ 'Pyxform/Modules/xyplot.c'], slider = Extension(
libraries = ['forms'], name="pyxforms.slider",
library_dirs = ['/usr/local/lib']) sources=["src/pyxforms/slider.c"],
setup (name = 'PyXForms', libraries=["forms"],
version = '0.2', )
description = 'This is OLD code', text = Extension(
author = 'Roberto Alsina', name="pyxforms.text",
author_email = 'ralsina@netmanagers.com.ar', sources=["src/pyxforms/text.c"],
ext_modules = [bitmaps, box, browser, button, choice, clock, counter, dial, forms, frame, goodies, input, menu, objects, pixmaps, popups, positioner, slider, text, timer, xforms, xyplot], libraries=["forms"],
packages = ['Pyxform'] )
timer = Extension(
name="pyxforms.timer",
sources=["src/pyxforms/timer.c"],
libraries=["forms"],
)
xforms = Extension(
name="pyxforms.xforms",
sources=["src/pyxforms/xforms.c"],
libraries=["forms"],
)
xyplot = Extension(
name="pyxforms.xyplot",
sources=["src/pyxforms/xyplot.c"],
libraries=["forms"],
)
setup(
ext_modules=[
bitmaps,
box,
browser,
button,
choice,
clock,
counter,
dial,
forms,
frame,
goodies,
input,
menu,
objects,
pixmaps,
popups,
positioner,
slider,
text,
timer,
xforms,
xyplot,
],
) )

924
src/pyxforms/__init__.py Normal file
View File

@ -0,0 +1,924 @@
##########################################################
# This is the Python interface to the pyxforms C module
#
import sys
from . import (
xforms,
forms,
objects,
bitmaps,
pixmaps,
box,
browser,
button,
choice,
clock,
counter,
dial,
frame,
input,
menu,
positioner,
slider,
timer,
)
###############################################################################
# These are function needed to run the XForms library
# Needs a LOT of work
def xfinit(appname, appclass, argv0):
xforms.init(appname, appclass, argv0)
###############################################################################
# This is the synthetic event-loop to use under python:
_objects = {}
def runforms():
while 1:
ob = _objects[str(xforms.do_forms())]
ob.cb(ob.args)
###############################################################################
# This is the default callback function:
def _nocb(args):
print("This object has no Callback!")
##############################################################################
# This is the Form class
class Form:
def __init__(self, t=6, w=200, h=200):
self.id = forms.create(0, w, h)
self.__box = Box(t, 0, 0, w, h, "")
self.Add(self.__box)
self.__box.c1 = 11
self.__box.c2 = 15
self.__minx = 1 # Reasonable defaults for things that
self.__miny = 1 # I can't get from XForms
self.__maxx = 10000 # Notice that if the C code changes them
self.__maxy = 10000 # They get out of sync!
self.__title = sys.argv[0] # the "preferred" form title
self.__placement = 16388
self.__decoration = 1
self.objs = () # A place to store the obj list. Useful?
def Show(self):
self.winid = forms.show(
self.id, self.__placement, self.__decoration, self.title
)
def Hide(self):
forms.hide(self.id)
def Freeze(self):
forms.freeze(self.id)
def Unfreeze(self):
forms.unfreeze(self.id)
def Activate(self):
forms.activate(self.id)
def Deactivate(self):
forms.deactivate(self.id)
def Scale(self, x, y):
forms.scale(self.id, x, y)
def Redraw(self):
forms.redraw(self.id)
def Add(self, object):
forms.add_object(self.id, object.id)
object.parent = self
def Setminsize(self, x, y):
forms.set_minsize(self.id, x, y)
self.__minx = x # The __ is needed to avoid endless looping
self.__miny = y # on min[xy], which are non-gettable from XForms
def Setmaxsize(self, x, y):
forms.set_maxsize(self.id, x, y)
self.__maxx = x
self.__maxy = y
def Settitle(self, title):
forms.set_title(self.id, title)
self.__title = title
def Gettitle(self):
if self.visible:
return forms.get_title(self.id)
else:
return self.__title
def Setcolor(c1, c2):
self.__box.Setcolor(c1, c2)
def __setattr__(self, name, value):
if name == "x":
(tx, ty, tw, th) = forms.get_geometry(self.id)
forms.set_geometry(self.id, value, ty, tw, th)
elif name == "y":
(tx, ty, tw, th) = forms.get_geometry(self.id)
forms.set_geometry(self.id, tx, value, tw, th)
elif name == "w":
(tx, ty, tw, th) = forms.get_geometry(self.id)
forms.set_geometry(self.id, tx, ty, value, th)
elif name == "h":
(tx, ty, tw, th) = forms.get_geometry(self.id)
forms.set_geometry(self.id, tx, ty, tw, value)
elif name == "dblbuffer":
forms.set_dblbuffer(self.id, value)
elif name == "frozen":
if value:
self.Freeze()
else:
self.Unfreeze()
elif name == "active":
if value:
self.Activate()
else:
self.Deactivate()
elif name == "visible":
if value:
self.Show()
else:
self.Hide()
elif name == "minx":
self.Setminsize(value, self.__miny)
elif name == "miny":
self.Setminsize(self.__minx, value)
elif name == "maxx":
self.Setminsize(value, self.__maxy)
elif name == "maxy":
self.Setminsize(self.__maxx, value)
elif name == "title":
self.Settitle(value)
elif name == "c1":
self.__box.c1 = value
elif name == "c2":
self.__box.c2 = value
else:
self.__dict__[name] = value
def __getattr__(self, name):
if name == "x":
(tx, ty, tw, th) = forms.get_geometry(self.id)
return tx
elif name == "y":
(tx, ty, tw, th) = forms.get_geometry(self.id)
return ty
elif name == "w":
(tx, ty, tw, th) = forms.get_geometry(self.id)
return tw
elif name == "h":
(tx, ty, tw, th) = forms.get_geometry(self.id)
return th
elif name == "minx":
return self.__minx
elif name == "miny":
return self.__miny
elif name == "maxx":
return self.__maxx
elif name == "maxy":
return self.__maxy
elif name == "vmode":
(active, dblbuffer, frozen, visible, border, other) = forms.get_attr(
self.id
)
return vmode
elif name == "active":
(active, dblbuffer, frozen, visible, border, other) = forms.get_attr(
self.id
)
return active
elif name == "dblbuffer":
(active, dblbuffer, frozen, visible, border, other) = forms.get_attr(
self.id
)
return dblbuffer
elif name == "frozen":
(active, dblbuffer, frozen, visible, border, other) = forms.get_attr(
self.id
)
return frozen
elif name == "visible":
(active, dblbuffer, frozen, visible, border, other) = forms.get_attr(
self.id
)
return visible
elif name == "border":
(active, dblbuffer, frozen, visible, border, other) = forms.get_attr(
self.id
)
return border
elif name == "other":
(active, dblbuffer, frozen, visible, border, other) = forms.get_attr(
self.id
)
return other
elif name == "title":
return self.Gettitle()
elif name == "c1":
return self.__box.c1
elif name == "c2":
return self.__box.c2
def __del__(self):
pass
# I'm not sure if this is a nice thing to do
# forms.free (self.id)
###############################################################################
# This is the XFObject class, for generic XForms objects
class XFObject:
def __init__(self):
self.id = 0
self.__c1 = 11
self.__c2 = 15
def Setgravity(self, a, b):
objects.set_gravity(self.id, a, b)
def Redraw(self):
objects.redraw(self.id)
def Scale(self, x, y):
objects.scale(self.id, x, y)
def Show(self):
objects.show(self.id)
self.Setcolor(self.__c1, self.__c2)
def Hide(self):
objects.hide(self.id)
def Delete(self):
objects.delete(self.id)
def Setcolor(self, c1, c2):
self.__c1 = c1
self.__c2 = c2
objects.set_color(self.id, c1, c2)
def Activate(self):
objects.activate(self.id)
def Deactivate(self):
objects.deactivate(self.id)
def __setattr__(self, name, value):
if name == "boxtype":
objects.set_boxtype(self.id, value)
elif name == "bw":
objects.set_bw(self.id, value)
elif name == "labelsize":
objects.set_ls(self.id, value)
elif name == "labelstyle":
objects.set_lstyle(self.id, value)
elif name == "labelcolor":
objects.set_lcol(self.id, value)
elif name == "labelalign":
objects.set_lalign(self.id, value)
elif name == "label":
objects.set_label(self.id, value)
elif name == "shortcut":
objects.set_shortcut(self.id, value, 1)
elif name == "dblbuffer":
objects.set_dblbuffer(self.id, value)
elif name == "x":
(tx, ty, tw, th) = objects.get_geometry(self.id)
objects.set_geometry(self.id, value, ty, tw, th)
elif name == "y":
(tx, ty, tw, th) = objects.get_geometry(self.id)
objects.set_geometry(self.id, tx, value, tw, th)
elif name == "w":
(tx, ty, tw, th) = objects.get_geometry(self.id)
objects.set_geometry(self.id, tx, ty, value, th)
elif name == "h":
(tx, ty, tw, th) = objects.get_geometry(self.id)
objects.set_geometry(self.id, tx, ty, tw, value)
elif name == "resize":
objects.set_resize(self.id, value)
elif name == "c1":
self.Setcolor(value, self.__c2)
elif name == "c2":
self.Setcolor(self.__c1, value)
else:
self.__dict__[name] = value
def __getattr__(self, name):
if name == "c1":
return self.__c1
elif name == "c2":
return self.__c2
def __del__(self):
# probably a BAD idea
objects.free(self.id)
###############################################################################
# The Bitmap Class
class Bitmap(XFObject):
def __init__(self, t=0, x=10, y=10, w=100, h=100, l="Bitmap"):
XFObject.__init__(self)
self.id = bitmaps.create(t, x, y, w, h, l)
def Load(self, file):
bitmaps.set_file(self.id, file)
def __setattr__(self, name, value):
if name == "background":
objects.set_color(self.id, value, 0)
elif name == "foreground":
objects.set_lcol(self.id, value)
else:
XFObject.__setattr__(self, name, value)
###############################################################################
# The Pixmap Class
class Pixmap(XFObject):
def __init__(self, t=0, x=10, y=10, w=100, h=100, l="Pixmap"):
XFObject.__init__(self)
self.id = pixmaps.create(t, x, y, w, h, l)
def Load(self, file):
pixmaps.set_file(self.id, file)
def __setattr__(self, name, value):
if name == "background":
objects.set_color(self.id, value, 0)
elif name == "foreground":
objects.set_lcol(self.id, value)
else:
XFObject.__setattr__(self, name, value)
###############################################################################
# The Box Class
class Box(XFObject):
def __init__(self, t=6, x=10, y=10, w=90, h=90, l="Box"):
XFObject.__init__(self)
self.id = box.create(t, x, y, w, h, l)
###############################################################################
# The Browser class
#
# I want the Browser class to act just like what it is: a list
# only with a "few" more methods and stuff
class Browser(XFObject):
def __init__(self, t=1, x=10, y=10, w=90, h=120, l="Browser"):
XFObject.__init__(self)
self.id = browser.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Add(self, line):
browser.add_line(self.id, line)
def Addto(self, line):
browser.addto(self.id, line)
def Insert(self, n, line):
browser.insert_line(self.id, n, line)
def Delete(self, n):
browser.delete_line(self.id, n)
def Replace(self, n, line):
browser.replace_line(self.id, n, line)
def Getline(self, n):
return browser.get_line(self.id, n)
def Load(self, path):
return browser.load(self.id, path)
def Select(self, n):
browser.select_line(self.id, n)
def Deselect(self, n):
browser.deselect_line(self.id, n)
def Deselectall(self):
browser.deselect(self.id)
def Isselected(self, n):
return browser.isselected_line(self.id, n)
def Gettopline(self):
return browser.get_topline(self.id)
def Get(self):
return browser.get(self.id)
def Getmaxline(self):
return browser.get_maxline(self.id)
def Screenlines(self):
return browser.get_screenlines(self.id)
def Settopline(self, n):
browser.set_topline(self.id, n)
def Setfontsize(self, n):
browser.set_fontsize(self.id, n)
def Setfontstyle(self, n):
browser.set_fontstyle(self.id, n)
def Setspecialkey(self, c):
browser.set_specialkey(self.id, c)
def Setleftslider(self, l):
browser.set_leftslider(self.id, l)
def __setattr__(self, name, value):
if name == "leftslider":
self.Setleftslider(value)
elif name == "specialkey":
self.Setspecialkey(value)
elif name == "fontstyle":
self.Setfontstyle(value)
elif name == "fontsize":
self.Setfontsize(value)
elif name == "topline":
self.Settopline(value)
else:
XFObject.__setattr__(self, name, value)
###############################################################################
# This is the Button class.
class Button(XFObject):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Button"):
XFObject.__init__(self)
self.id = button.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def __call__(self, v=-1):
# I think this is nice: if you have a button called b,
# b() returns the button's value
# b(1) or b(0) SETS the button value.
# You can also set/get it with b.value, though
if v == -1:
return button.get(self.id)
else:
button.set(self.id, v)
def __setattr__(self, name, value):
if name == "value":
self(value)
else:
XFObject.__setattr__(self, name, value)
def __getattr__(self, name):
if name == "value":
return self()
elif name == "numb":
return button.get_numb(self.id)
pass
else:
return XFObject.__getattr__(self, name)
###############################################################################
# This is the Roundbutton class
class Roundbutton(Button):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Roundbutton"):
XFObject.__init__(self)
self.id = button.create_round(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
###############################################################################
# This is the Lightbutton class
class Lightbutton(Button):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Lightbutton"):
XFObject.__init__(self)
self.id = button.create_light(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
###############################################################################
# This is the Checkbutton class
class Checkbutton(Button):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Checkbutton"):
XFObject.__init__(self)
self.id = button.create_check(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
###############################################################################
# This is the Bitmapbutton class
class Bitmapbutton(Button):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Bitmapbutton"):
XFObject.__init__(self)
self.id = button.create_bitmap(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
###############################################################################
# This is the Pixmapbutton class
class Pixmapbutton(Button):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Pixmapbutton"):
XFObject.__init__(self)
self.id = button.create_pixmap(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
###############################################################################
# This is the Choice Class
# This one needs a getattr, setattr pair
class Choice(XFObject):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Choice"):
XFObject.__init__(self)
self.id = choice.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Clear(self):
choice.clear(self.id)
def Addto(self, s):
choice.addto(self.id, s)
def Replace(self, n, s):
choice.replace(self.id, n, s)
def Delete(self, n):
choice.delete(self.id, n)
def Set(self, n):
choice.set(self.id, n)
def Settext(self, s):
choice.set_text(self.id, s)
def Get(self):
return choice.get(self.id)
def Getmaxitems(self):
return choice.get_maxitems(self.id)
def Gettext(self):
return choice.get_text(self.id)
def Setfontsize(self, n):
choice.set_fontsize(self.id, n)
def Setalign(self, n):
choice.set_align(self.id, n)
def Setmode(self, n, m):
choice.set_item_mode(self.id, n, m)
##############################################################################
# This is the clock class
class Clock(XFObject):
def __init__(self, t=0, x=10, y=10, w=90, h=90, l="Clock"):
XFObject.__init__(self)
self.id = clock.create(t, x, y, w, h, l)
def Get(self):
return clock.get(self.id)
##############################################################################
# This is the counter class
class Counter(XFObject):
def __init__(self, t=0, x=10, y=10, w=90, h=30, l="Counter"):
XFObject.__init__(self)
self.id = counter.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Set(self, v):
counter.set_value(self.id, v)
def Setbounds(self, min, max):
counter.set_bounds(self.id, min, max)
def Setstep(self, s1, s2):
counter.set_step(self.id, s1, s2)
def Setprecision(self, p):
counter.set_precision(self.id, p)
def Get(self):
return counter.get_value(self.id)
def Setreturn(self, v):
counter.set_return(self.id, v)
##############################################################################
# This is the Dial class
class Dial(XFObject):
def __init__(self, t=0, x=10, y=10, w=60, h=60, l="Dial"):
XFObject.__init__(self)
self.id = dial.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Set(self, v):
dial.set_value(self.id, v)
def Get(self):
return dial.get_value(self.id)
def Setbounds(self, min, max):
dial.set_bounds(self.id, min, max)
def Getbounds(self):
return dial.get_bounds(self.id)
def Setstep(self, v):
dial.set_step(self.id, v)
def Setreturn(self, v):
dial.set_return(self.id, v)
###############################################################################
# This is the Frame class
class Frame(XFObject):
def __init__(self, t=0, x=10, y=10, w=60, h=60, l="Frame"):
XFObject.__init__(self)
self.id = frame.create(t, x, y, w, h, l)
###############################################################################
# This is the Input class
class Input(XFObject):
def __init__(self, t=0, x=10, y=10, w=60, h=30, l="Input"):
XFObject.__init__(self)
self.id = input.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Set(self, s):
input.set(self.id, s)
def Setcolor(self, c1, c2):
input.set_color(self.id, c1, c2)
def Get(self):
return input.get(self.id)
def Setreturn(self, v):
input.set_return(self.id, v)
def Setscroll(self, v):
input.set_scroll(self.id, v)
def Setcursorpos(self, x, y=1):
input.set_cursorpos(self.id, x, y)
def Setselected(self, v):
input.set_selected(self.id, v)
def Setselectedrange(self, x1, x2):
input.set_selected_range(self.id, x1, x2)
def __setattr__(self, name, value):
if name == "value":
self.Set(value)
else:
XFObject.__setattr__(self, name, value)
def __getattr__(self, name):
if name == "value":
return self.Get()
else:
return XFObject.__getattr__(self, name)
###############################################################################
# This is the Menu class
class Menu(XFObject):
def __init__(self, t=0, x=10, y=10, w=60, h=30, l="Menu"):
XFObject.__init__(self)
self.id = menu.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Clear(self):
menu.clear(self.id)
def Set(self, s):
menu.set(self.id, s)
def Addto(self, s):
menu.addto(self.id, s)
def Replace(self, n, s):
menu.replace_item(self.id, n, s)
def Delete(self, n):
menu.delete_item(self.id, n)
def Setshortcut(self, n, s):
menu.set_item_shortcut(self.id, n, s)
def Setmode(self, n, m):
menu.set_item_mode(self.id, n, m)
def Showsymbol(self, n):
menu.show_symbol(self.id, n)
def Get(self):
return menu.get(self.id)
def Getmaxitems(self):
return menu.get_maxitems(self.id)
def Gettext(self):
return menu.get_text(self.id)
###############################################################################
# This is the Positioner class
class Positioner(XFObject):
def __init__(self, t=0, x=10, y=10, w=60, h=60, l="Positioner"):
XFObject.__init__(self)
self.id = positioner.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Setx(self, v):
positioner.set_xvalue(self.id, v)
def Sety(self, v):
positioner.set_yvalue(self.id, v)
def Setxbounds(self, x1, x2):
positioner.set_xbounds(self.id, x1, x2)
def Setybounds(self, y1, y2):
positioner.set_ybounds(self.id, y1, y2)
def Setxstep(self, v):
positioner.set_xstep(self.id, v)
def Setystep(self, v):
positioner.set_ystep(self.id, v)
def Getx(self):
return positioner.get_xvalue(self.id)
def Gety(self):
return positioner.get_yvalue(self.id)
def Getxbounds(self):
positioner.get_xbounds(self.id)
def Getybounds(self):
positioner.get_ybounds(self.id)
def Setreturn(self, v):
positioner.set_return(self.id, v)
###############################################################################
# This is the Slider class
class Slider(XFObject):
def __init__(self, t=0, x=10, y=10, w=60, h=30, l="Slider"):
XFObject.__init__(self)
self.id = slider.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Get(self):
return slider.get_value(self.id)
def Set(self, v):
slider.set_value(self.id, v)
def Getbounds(self):
return slider.get_bounds(self.id)
def Setbounds(self, v1, v2):
slider.set_bounds(self.id, v1, v2)
def Setreturn(self, v):
slider.set_return(self.id, v)
def Setstep(self, v):
slider.set_step(self.id, v)
def Setsize(self, v):
slider.set_size(self.id, v)
###############################################################################
# This is the Valslider class
class Valslider(Slider):
def __init__(self, t=0, x=10, y=10, w=60, h=30, l="Valslider"):
XFObject.__init__(self)
self.id = slider.create_val(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Setprecision(self, v):
slider.set_precision(self.id, v)
##############################################################################
# This is the Timer class
class Timer(XFObject):
def __init__(self, t=1, x=10, y=10, w=60, h=30, l="Timer"):
XFObject.__init__(self)
self.id = timer.create(t, x, y, w, h, l)
_objects[str(self.id)] = self
self.cb = _nocb
self.args = self
def Set(self, v):
timer.set(self.id, v)
def Get(self):
return timer.get(self.id)

View File

@ -107,7 +107,8 @@ static char bitmaps_module_documentation[] =
; ;
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"bitmaps", "bitmaps",
bitmaps_module_documentation, bitmaps_module_documentation,
@ -137,4 +138,5 @@ PyInit_bitmaps()
/* Check for errors */ /* Check for errors */
if (PyErr_Occurred()) if (PyErr_Occurred())
Py_FatalError("can't initialize module bitmaps"); Py_FatalError("can't initialize module bitmaps");
return m;
} }

View File

@ -50,7 +50,8 @@ box_create(self, args)
/* List of methods defined in the module */ /* List of methods defined in the module */
static struct PyMethodDef box_methods[] = { static struct PyMethodDef box_methods[] =
{
{"create", box_create, 1, box_create__doc__}, {"create", box_create, 1, box_create__doc__},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
@ -63,7 +64,8 @@ static char box_module_documentation[] =
; ;
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"box", /* m_name */ "box", /* m_name */
box_module_documentation, /* m_doc */ box_module_documentation, /* m_doc */
@ -93,5 +95,6 @@ PyInit_box()
/* Check for errors */ /* Check for errors */
if (PyErr_Occurred()) if (PyErr_Occurred())
Py_FatalError("can't initialize module box"); Py_FatalError("can't initialize module box");
return m;
} }

497
src/pyxforms/browser.c Normal file
View File

@ -0,0 +1,497 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char browser_create__doc__[] =
"Creates a Browser"
;
static PyObject *
browser_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_browser(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char browser_add_line__doc__[] =
"Adds a line to a browser"
;
static PyObject *
browser_add_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *l;
if (!PyArg_ParseTuple(args, "ls",&o,&l))
return NULL;
fl_add_browser_line ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_addto__doc__[] =
"Adds a line to a browser, and shifts it there"
;
static PyObject *
browser_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *l;
if (!PyArg_ParseTuple(args, "ls",&o,&l))
return NULL;
fl_addto_browser ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_insert_line__doc__[] =
""
;
static PyObject *
browser_insert_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char *l;
if (!PyArg_ParseTuple(args, "lis",&o,&n,&l))
return NULL;
fl_insert_browser_line ((FL_OBJECT *)o,n,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_delete_line__doc__[] =
"Deletes a line from a browser"
;
static PyObject *
browser_delete_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_delete_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_replace_line__doc__[] =
"Replaces a line of abrowser"
;
static PyObject *
browser_replace_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char *l;
if (!PyArg_ParseTuple(args, "lis",&o,&n,&l))
return NULL;
fl_replace_browser_line ((FL_OBJECT *)o,n,l);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_get_line__doc__[] =
"Gets a browser's line"
;
static PyObject *
browser_get_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
char s[1024];
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
strcpy(s,fl_get_browser_line ((FL_OBJECT *)o,n));
return Py_BuildValue ("s",s);
}
static char browser_load__doc__[] =
"Loads a file into a browser"
;
static PyObject *
browser_load(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
int r;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
r=fl_load_browser((FL_OBJECT *)o,s);
return Py_BuildValue ("i",r);
}
static char browser_select_line__doc__[] =
"Selects a browser line"
;
static PyObject *
browser_select_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_select_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_deselect_line__doc__[] =
"Deselects a browser's line"
;
static PyObject *
browser_deselect_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_deselect_browser_line ((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_deselect__doc__[] =
"Deselects all lines in a browser"
;
static PyObject *
browser_deselect(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_deselect_browser ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_isselected_line__doc__[] =
"Is that line selected in the browser?"
;
static PyObject *
browser_isselected_line(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n,r;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
r=fl_isselected_browser_line((FL_OBJECT *)o,n);
return Py_BuildValue ("i",r);
}
static char browser_get_topline__doc__[] =
"The number of the 1st visible line in the browser"
;
static PyObject *
browser_get_topline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_topline((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get__doc__[] =
"You better read the xforms manual on fl_get_browser for this one..."
;
static PyObject *
browser_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get_maxline__doc__[] =
"Returns the number of lines in the browser"
;
static PyObject *
browser_get_maxline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_maxline((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char browser_get_screenlines__doc__[] =
"Returns the number of visible lines in the browser"
;
static PyObject *
browser_get_screenlines(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_browser_screenlines((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char browser_set_topline__doc__[] =
"Sets the browser's first visible line"
;
static PyObject *
browser_set_topline(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "li",&o,&n))
return NULL;
fl_set_browser_topline((FL_OBJECT *)o,n);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_fontsize__doc__[] =
"Set the browser's font size"
;
static PyObject *
browser_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_fontsize((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_fontstyle__doc__[] =
"Set the browser's font style"
;
static PyObject *
browser_set_fontstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_fontstyle((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char browser_set_specialkey__doc__[] =
"Set the character used to change text formatting in the browser"
;
static PyObject *
browser_set_specialkey(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int s;
if (!PyArg_ParseTuple(args, "li",&o,&s))
return NULL;
fl_set_browser_specialkey((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
// static char browser_set_leftslider__doc__[] =
// "Set the browser's slider to the left"
// ;
//
// static PyObject *
// browser_set_leftslider(self, args)
// PyObject *self; /* Not used */
// PyObject *args;
// {
// long o;
// int s;
//
// if (!PyArg_ParseTuple(args, "li",&o,&s))
// return NULL;
// fl_set_browser_leftslider((FL_OBJECT *)o,s);
// Py_INCREF(Py_None);
// return Py_None;
// }
/* List of methods defined in the module */
static struct PyMethodDef browser_methods[] =
{
{"create", browser_create, 1, browser_create__doc__},
{"add_line", browser_add_line, 1, browser_add_line__doc__},
{"addto", browser_addto, 1, browser_addto__doc__},
{"insert_line", browser_insert_line, 1, browser_insert_line__doc__},
{"delete_line", browser_delete_line, 1, browser_delete_line__doc__},
{"replace_line", browser_replace_line, 1, browser_replace_line__doc__},
{"get_line", browser_get_line, 1, browser_get_line__doc__},
{"load", browser_load, 1, browser_load__doc__},
{"select_line", browser_select_line, 1, browser_select_line__doc__},
{"deselect_line", browser_deselect_line, 1, browser_deselect_line__doc__},
{"deselect", browser_deselect, 1, browser_deselect__doc__},
{"isselected_line", browser_isselected_line, 1, browser_isselected_line__doc__},
{"get_topline", browser_get_topline, 1, browser_get_topline__doc__},
{"get", browser_get, 1, browser_get__doc__},
{"get_maxline", browser_get_maxline, 1, browser_get_maxline__doc__},
{"get_screenlines", browser_get_screenlines, 1, browser_get_screenlines__doc__},
{"set_topline", browser_set_topline, 1, browser_set_topline__doc__},
{"set_fontsize", browser_set_fontsize, 1, browser_set_fontsize__doc__},
{"set_fontstyle", browser_set_fontstyle, 1, browser_set_fontstyle__doc__},
{"set_specialkey", browser_set_specialkey, 1, browser_set_specialkey__doc__},
// {"set_leftslider", browser_set_leftslider, 1, browser_set_leftslider__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbrowser) */
static char browser_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"browser", /* m_name */
browser_module_documentation, /* m_doc */
-1, /* m_size */
browser_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_browser()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("browser.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module browser");
return m;
}

380
src/pyxforms/button.c Normal file
View File

@ -0,0 +1,380 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char button_create__doc__[] =
"Creates a normal button"
;
static PyObject *
button_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_button(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_round__doc__[] =
"Creates a round button"
;
static PyObject *
button_create_round(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_roundbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_light__doc__[] =
"Creates a light button"
;
static PyObject *
button_create_light(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_lightbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_check__doc__[] =
"Creates a check button"
;
static PyObject *
button_create_check(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_checkbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_bitmap__doc__[] =
"Creates a bitmap button"
;
static PyObject *
button_create_bitmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_bitmapbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_create_pixmap__doc__[] =
"Creates a pixmap button"
;
static PyObject *
button_create_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_pixmapbutton(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char button_set_bitmap_data__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_bitmap_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_bitmap_file__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_bitmap_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_data__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_data(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_file__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_file(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_set_pixmap_pixmap__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_set_pixmap_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_get_pixmap_pixmap__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
button_get_pixmap_pixmap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char button_get__doc__[] =
"Gets the button's value"
;
static PyObject *
button_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_button((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char button_set__doc__[] =
"Sets the button's value"
;
static PyObject *
button_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int v;
if (!PyArg_ParseTuple(args, "li",&o,&v))
return NULL;
fl_set_button((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char button_get_numb__doc__[] =
"Get's the number of the mouse button last pressed on the button object"
;
static PyObject *
button_get_numb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
n=fl_get_button_numb((FL_OBJECT *)o);
return Py_BuildValue ("i",n);
}
static char button_create_generic__doc__[] =
"Creates a generic button (useful mainly for extensions)"
;
static PyObject *
button_create_generic(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int c,t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiiis",&c,&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_generic_button (c,t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
/* List of methods defined in the module */
static struct PyMethodDef button_methods[] =
{
{"create", button_create, 1, button_create__doc__},
{"create_round", button_create_round, 1, button_create_round__doc__},
{"create_light", button_create_light, 1, button_create_light__doc__},
{"create_check", button_create_check, 1, button_create_check__doc__},
{"create_bitmap", button_create_bitmap, 1, button_create_bitmap__doc__},
{"create_pixmap", button_create_pixmap, 1, button_create_pixmap__doc__},
{"set_bitmap_data", button_set_bitmap_data, 1, button_set_bitmap_data__doc__},
{"set_bitmap_file", button_set_bitmap_file, 1, button_set_bitmap_file__doc__},
{"set_pixmap_data", button_set_pixmap_data, 1, button_set_pixmap_data__doc__},
{"set_pixmap_file", button_set_pixmap_file, 1, button_set_pixmap_file__doc__},
{"set_pixmap_pixmap", button_set_pixmap_pixmap, 1, button_set_pixmap_pixmap__doc__},
{"get_pixmap_pixmap", button_get_pixmap_pixmap, 1, button_get_pixmap_pixmap__doc__},
{"get", button_get, 1, button_get__doc__},
{"set", button_set, 1, button_set__doc__},
{"get_numb", button_get_numb, 1, button_get_numb__doc__},
{"create_generic", button_create_generic, 1, button_create_generic__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initbutton) */
static char button_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"button", /* m_name */
button_module_documentation, /* m_doc */
-1, /* m_size */
button_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_button()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("button.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module button");
return m;
}

356
src/pyxforms/choice.c Normal file
View File

@ -0,0 +1,356 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char choice_create__doc__[] =
"Creates a choice object"
;
static PyObject *
choice_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_choice(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char choice_clear__doc__[] =
"Clears the list of choices"
;
static PyObject *
choice_clear(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_clear_choice((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_addto__doc__[] =
"Adds a line to a choice object"
;
static PyObject *
choice_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *t;
if (!PyArg_ParseTuple(args, "ls",&o,&t))
return NULL;
fl_addto_choice((FL_OBJECT *)o,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_replace__doc__[] =
"Replaces a line in a choice"
;
static PyObject *
choice_replace(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
char *t;
if (!PyArg_ParseTuple(args, "lis",&o,&l,&t))
return NULL;
fl_replace_choice((FL_OBJECT *)o,l,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_delete__doc__[] =
"Deletes a line in a choice"
;
static PyObject *
choice_delete(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
if (!PyArg_ParseTuple(args, "li",&o,&l))
return NULL;
fl_delete_choice((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set__doc__[] =
"Sets the choice"
;
static PyObject *
choice_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int l;
if (!PyArg_ParseTuple(args, "li",&o,&l))
return NULL;
fl_set_choice ((FL_OBJECT *)o,l);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_text__doc__[] =
"Sets the choice at the item with the given text"
;
static PyObject *
choice_set_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *t;
if (!PyArg_ParseTuple(args, "ls",&o,&t))
return NULL;
fl_set_choice_text((FL_OBJECT *)o,t);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_get__doc__[] =
"Gets the choice's selected option number"
;
static PyObject *
choice_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_choice((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char choice_get_maxitems__doc__[] =
"Gets the total number of items in the choice"
;
static PyObject *
choice_get_maxitems(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_choice_maxitems((FL_OBJECT *)o);
return Py_BuildValue("i",r);
}
static char choice_get_text__doc__[] =
"Gets the text of the current choice"
;
static PyObject *
choice_get_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char t[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (t,fl_get_choice_text((FL_OBJECT *)o));
return Py_BuildValue("s",t);
}
static char choice_set_fontsize__doc__[] =
"Sets the choice's fontsize"
;
static PyObject *
choice_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_choice_fontsize((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_align__doc__[] =
"Sets the alignment of the choice"
;
static PyObject *
choice_set_align(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_choice_align((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_item_mode__doc__[] =
"Sets an item's mode ?"
;
static PyObject *
choice_set_item_mode(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int n;
unsigned m;
if (!PyArg_ParseTuple(args, "lil",&o,&n,&m))
return NULL;
fl_set_choice_item_mode((FL_OBJECT *)o,n,m);
Py_INCREF(Py_None);
return Py_None;
}
static char choice_set_item_shortcut__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
choice_set_item_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef choice_methods[] =
{
{"create", choice_create, 1, choice_create__doc__},
{"clear", choice_clear, 1, choice_clear__doc__},
{"addto", choice_addto, 1, choice_addto__doc__},
{"replace", choice_replace, 1, choice_replace__doc__},
{"delete", choice_delete, 1, choice_delete__doc__},
{"set", choice_set, 1, choice_set__doc__},
{"set_text", choice_set_text, 1, choice_set_text__doc__},
{"get", choice_get, 1, choice_get__doc__},
{"get_maxitems", choice_get_maxitems, 1, choice_get_maxitems__doc__},
{"get_text", choice_get_text, 1, choice_get_text__doc__},
{"set_fontsize", choice_set_fontsize, 1, choice_set_fontsize__doc__},
{"set_align", choice_set_align, 1, choice_set_align__doc__},
{"set_item_mode", choice_set_item_mode, 1, choice_set_item_mode__doc__},
{"set_item_shortcut", choice_set_item_shortcut, 1, choice_set_item_shortcut__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initchoice) */
static char choice_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"choice", /* m_name */
choice_module_documentation, /* m_doc */
-1, /* m_size */
choice_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_choice()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("choice.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module choice");
return m;
}

View File

@ -66,7 +66,8 @@ clock_get(self, args)
/* List of methods defined in the module */ /* List of methods defined in the module */
static struct PyMethodDef clock_methods[] = { static struct PyMethodDef clock_methods[] =
{
{"create", clock_create, 1, clock_create__doc__}, {"create", clock_create, 1, clock_create__doc__},
{"get", clock_get, 1, clock_get__doc__}, {"get", clock_get, 1, clock_get__doc__},
@ -80,7 +81,8 @@ static char clock_module_documentation[] =
"" ""
; ;
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"clock", /* m_name */ "clock", /* m_name */
clock_module_documentation, /* m_doc */ clock_module_documentation, /* m_doc */
@ -110,5 +112,6 @@ PyInit_clock()
/* Check for errors */ /* Check for errors */
if (PyErr_Occurred()) if (PyErr_Occurred())
Py_FatalError("can't initialize module clock"); Py_FatalError("can't initialize module clock");
return m;
} }

215
src/pyxforms/counter.c Normal file
View File

@ -0,0 +1,215 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char counter_create__doc__[] =
"Creates a counter"
;
static PyObject *
counter_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_counter(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char counter_set_value__doc__[] =
"Sets the value of the counter (Use only on visible counters!)"
;
static PyObject *
counter_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_counter_value((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_bounds__doc__[] =
"Sets the counter's max & min"
;
static PyObject *
counter_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_counter_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_step__doc__[] =
"Set the counter's step size (small & large)"
;
static PyObject *
counter_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s,l;
if (!PyArg_ParseTuple(args, "ldd",&o,&s,&l))
return NULL;
fl_set_counter_step((FL_OBJECT *)o,s,l);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_set_precision__doc__[] =
"Sets the counter's precision"
;
static PyObject *
counter_set_precision(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int p;
if (!PyArg_ParseTuple(args, "li",&o,&p))
return NULL;
fl_set_counter_precision ((FL_OBJECT *)o,p);
Py_INCREF(Py_None);
return Py_None;
}
static char counter_get_value__doc__[] =
"Returns the counter's value"
;
static PyObject *
counter_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_counter_value((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char counter_set_return__doc__[] =
"Makes the counter return always or when released"
;
static PyObject *
counter_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_counter_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef counter_methods[] =
{
{"create", counter_create, 1, counter_create__doc__},
{"set_value", counter_set_value, 1, counter_set_value__doc__},
{"set_bounds", counter_set_bounds, 1, counter_set_bounds__doc__},
{"set_step", counter_set_step, 1, counter_set_step__doc__},
{"set_precision", counter_set_precision, 1, counter_set_precision__doc__},
{"get_value", counter_get_value, 1, counter_get_value__doc__},
{"set_return", counter_set_return, 1, counter_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initcounter) */
static char counter_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"counter", /* m_name */
counter_module_documentation, /* m_doc */
-1, /* m_size */
counter_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_counter()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("counter.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module counter");
return m;
}

215
src/pyxforms/dial.c Normal file
View File

@ -0,0 +1,215 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char dial_create__doc__[] =
"Creates a dial"
;
static PyObject *
dial_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_dial(t,x,y,w,h,l);
return Py_BuildValue ("l",o);;
}
static char dial_set_value__doc__[] =
"Sets the dial value"
;
static PyObject *
dial_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_dial_value ((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_get_value__doc__[] =
"Gets the dial's value"
;
static PyObject *
dial_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_dial_value((FL_OBJECT *)o);
return Py_BuildValue("d",r);
}
static char dial_set_bounds__doc__[] =
"Sets the dial bounds"
;
static PyObject *
dial_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_dial_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_get_bounds__doc__[] =
"Gets the dial bounds"
;
static PyObject *
dial_get_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_dial_bounds((FL_OBJECT *)o,&min,&max);
return Py_BuildValue("dd",min,max);
}
static char dial_set_step__doc__[] =
"Sets the dial step"
;
static PyObject *
dial_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_dial_step ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char dial_set_return__doc__[] =
"Makes a dial return always or when released"
;
static PyObject *
dial_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_dial_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef dial_methods[] =
{
{"create", dial_create, 1, dial_create__doc__},
{"set_value", dial_set_value, 1, dial_set_value__doc__},
{"get_value", dial_get_value, 1, dial_get_value__doc__},
{"set_bounds", dial_set_bounds, 1, dial_set_bounds__doc__},
{"get_bounds", dial_get_bounds, 1, dial_get_bounds__doc__},
{"set_step", dial_set_step, 1, dial_set_step__doc__},
{"set_return", dial_set_return, 1, dial_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initdial) */
static char dial_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"dial", /* m_name */
dial_module_documentation, /* m_doc */
-1, /* m_size */
dial_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_dial()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("dial.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module dial");
return m;
}

703
src/pyxforms/forms.c Normal file
View File

@ -0,0 +1,703 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char forms_create__doc__[] =
"Creates a form"
;
static PyObject *
forms_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int box,w,h;
FL_FORM *ret;
if (!PyArg_ParseTuple(args, "iii",&box,&w,&h))
return NULL;
ret=fl_bgn_form (FL_NO_BOX,w,h);
fl_end_form ();
return Py_BuildValue("l",(long)ret);
}
static char forms_freeze__doc__[] =
"Freezes a form"
;
static PyObject *
forms_freeze(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_freeze_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unfreeze__doc__[] =
"Unfreezes a form"
;
static PyObject *
forms_unfreeze(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_unfreeze_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_deactivate__doc__[] =
"Deactivates a form"
;
static PyObject *
forms_deactivate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_deactivate_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_activate__doc__[] =
"Activates a form"
;
static PyObject *
forms_activate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_activate_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_activate_all__doc__[] =
"Activates all forms"
;
static PyObject *
forms_activate_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_activate_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_deactivate_all__doc__[] =
"Deactivates all forms"
;
static PyObject *
forms_deactivate_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_deactivate_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_freeze_all__doc__[] =
"Freezes all forms"
;
static PyObject *
forms_freeze_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_freeze_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unfreeze_all__doc__[] =
"Unfreezes all forms"
;
static PyObject *
forms_unfreeze_all(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_unfreeze_all_forms ();
Py_INCREF(Py_None);
return Py_None;
}
static char forms_scale__doc__[] =
"Scales a form x and y times"
;
static PyObject *
forms_scale(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
double x,y;
if (!PyArg_ParseTuple(args, "ldd",&form,&x,&y))
return NULL;
fl_scale_form ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_position__doc__[] =
"Sets the form position"
;
static PyObject *
forms_set_position(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_set_form_position((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_property__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_property(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_unset_property__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_unset_property(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_callback__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_size__doc__[] =
"Sets the form's size"
;
static PyObject *
forms_set_size(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_size((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_hotspot__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_hotspot(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_hotobject__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_hotobject(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_minsize__doc__[] =
"Sets the form minimum size"
;
static PyObject *
forms_set_minsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_minsize ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_maxsize__doc__[] =
"Sets the form maximum size"
;
static PyObject *
forms_set_maxsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y;
if (!PyArg_ParseTuple(args, "lii",&form,&x,&y))
return NULL;
fl_set_form_maxsize ((FL_FORM *)form,x,y);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_event_cmask__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_set_event_cmask(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_event_cmask__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_get_event_cmask(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_geometry__doc__[] =
"Set the form's geometry"
;
static PyObject *
forms_set_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "liiii",&form,&x,&y,&w,&h))
return NULL;
fl_set_form_geometry ((FL_FORM *)form,x,y,w,h);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_geometry__doc__[] =
"Get the form's geometry"
;
static PyObject *
forms_get_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
x=((FL_FORM *)form)->x;
y=((FL_FORM *)form)->y;
w=((FL_FORM *)form)->w;
h=((FL_FORM *)form)->h;
return Py_BuildValue ("iiii",x,y,w,h);
}
static char forms_show__doc__[] =
"Shows the form"
;
static PyObject *
forms_show(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form,ret;
int a,b;
char *c;
if (!PyArg_ParseTuple(args, "liis",&form,&a,&b,&c))
return NULL;
ret=fl_show_form ((FL_FORM *)form,a,b,c);
return Py_BuildValue("l",ret);
}
static char forms_hide__doc__[] =
"Hides a form"
;
static PyObject *
forms_hide(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_hide_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_free__doc__[] =
"Releases a form's memory"
;
static PyObject *
forms_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_free_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_redraw__doc__[] =
"Redraws a form"
;
static PyObject *
forms_redraw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
fl_redraw_form ((FL_FORM *)form);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_set_dblbuffer__doc__[] =
"Sets the form as doublebuffered or not"
;
static PyObject *
forms_set_dblbuffer(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
int choice;
if (!PyArg_ParseTuple(args, "li",&form,&choice))
return NULL;
fl_set_form_dblbuffer ((FL_FORM *)form,choice);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_prepare_window__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_prepare_window(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_show_window__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
forms_show_window(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char forms_add_object__doc__[] =
"Adds an object to the form"
;
static PyObject *
forms_add_object(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long f,o;
if (!PyArg_ParseTuple(args, "ll",&f,&o))
return NULL;
fl_add_object((FL_FORM *)f,(FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_attr__doc__[] =
"Gets a bunch of attributes from the form"
;
static PyObject *forms_get_attr(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
return Py_BuildValue ("iiiiil",
//((FL_FORM *)o)->vmode,
((FL_FORM *)o)->deactivated,
((FL_FORM *)o)->use_pixmap,
((FL_FORM *)o)->frozen,
((FL_FORM *)o)->visible,
((FL_FORM *)o)->wm_border,
(long)((FL_FORM *)o)->prop);
}
static char forms_set_title__doc__[] =
"Sets the form's title"
;
static PyObject *
forms_set_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
char *title;
if (!PyArg_ParseTuple(args, "ls",&form,&title))
return NULL;
fl_set_form_title ((FL_FORM *)form,title);
Py_INCREF(Py_None);
return Py_None;
}
static char forms_get_title__doc__[] =
"Gets the form's title (Undocumented on XForms, but...)"
;
static PyObject *
forms_get_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long form;
char title[2048];
if (!PyArg_ParseTuple(args, "l",&form))
return NULL;
strcpy (title,((FL_FORM *)form)->label);
return Py_BuildValue ("s",title);
}
/* List of methods defined in the module */
static struct PyMethodDef forms_methods[] =
{
{ "create", forms_create, 1, forms_create__doc__ },
{ "freeze", forms_freeze, 1, forms_freeze__doc__ },
{ "unfreeze", forms_unfreeze, 1, forms_unfreeze__doc__ },
{ "deactivate", forms_deactivate, 1, forms_deactivate__doc__ },
{ "activate", forms_activate, 1, forms_activate__doc__ },
{ "activate_all", forms_activate_all, 1, forms_activate_all__doc__ },
{ "deactivate_all", forms_deactivate_all, 1, forms_deactivate_all__doc__ },
{ "freeze_all", forms_freeze_all, 1, forms_freeze_all__doc__ },
{ "unfreeze_all", forms_unfreeze_all, 1, forms_unfreeze_all__doc__ },
{ "scale", forms_scale, 1, forms_scale__doc__ },
{ "set_position", forms_set_position, 1, forms_set_position__doc__ },
{ "set_property", forms_set_property, 1, forms_set_property__doc__ },
{ "unset_property", forms_unset_property, 1, forms_unset_property__doc__ },
{ "set_callback", forms_set_callback, 1, forms_set_callback__doc__ },
{ "set_size", forms_set_size, 1, forms_set_size__doc__ },
{ "set_hotspot", forms_set_hotspot, 1, forms_set_hotspot__doc__ },
{ "set_hotobject", forms_set_hotobject, 1, forms_set_hotobject__doc__ },
{ "set_minsize", forms_set_minsize, 1, forms_set_minsize__doc__ },
{ "set_maxsize", forms_set_maxsize, 1, forms_set_maxsize__doc__ },
{ "set_event_cmask", forms_set_event_cmask, 1, forms_set_event_cmask__doc__ },
{ "get_event_cmask", forms_get_event_cmask, 1, forms_get_event_cmask__doc__ },
{ "set_geometry", forms_set_geometry, 1, forms_set_geometry__doc__ },
{ "get_geometry", forms_get_geometry, 1, forms_get_geometry__doc__ },
{ "show", forms_show, 1, forms_show__doc__ },
{ "hide", forms_hide, 1, forms_hide__doc__ },
{ "free", forms_free, 1, forms_free__doc__ },
{ "redraw", forms_redraw, 1, forms_redraw__doc__ },
{ "set_dblbuffer", forms_set_dblbuffer, 1, forms_set_dblbuffer__doc__ },
{ "prepare_window", forms_prepare_window, 1, forms_prepare_window__doc__ },
{ "show_window", forms_show_window, 1, forms_show_window__doc__ },
{ "add_object", forms_add_object, 1, forms_add_object__doc__ },
{ "get_attr", forms_get_attr, 1, forms_get_attr__doc__ },
{ "set_title", forms_set_title, 1, forms_set_title__doc__ },
{ "get_title", forms_get_title, 1, forms_get_title__doc__ },
{ NULL, NULL } /* sentinel */
};
/* Initialization function for the module (*must* be called initforms) */
static char forms_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"forms", /* m_name */
forms_module_documentation, /* m_doc */
-1, /* m_size */
forms_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_forms(void)
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("forms.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module forms");
return m;
}

View File

@ -48,7 +48,8 @@ frame_create(self, args)
/* List of methods defined in the module */ /* List of methods defined in the module */
static struct PyMethodDef frame_methods[] = { static struct PyMethodDef frame_methods[] =
{
{"create", frame_create, 1, frame_create__doc__}, {"create", frame_create, 1, frame_create__doc__},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
@ -61,7 +62,8 @@ static char frame_module_documentation[] =
"" ""
; ;
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"frame", /* m_name */ "frame", /* m_name */
frame_module_documentation, /* m_doc */ frame_module_documentation, /* m_doc */
@ -91,5 +93,6 @@ PyInit_frame()
/* Check for errors */ /* Check for errors */
if (PyErr_Occurred()) if (PyErr_Occurred())
Py_FatalError("can't initialize module frame"); Py_FatalError("can't initialize module frame");
return m;
} }

510
src/pyxforms/goodies.c Normal file
View File

@ -0,0 +1,510 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char goodies_set_font__doc__[] =
"Sets the goodies font XXXXXXBroken?"
;
static PyObject *
goodies_set_font(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii"),&i,&j)
return NULL;
fl_set_goodies_font (i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_message__doc__[] =
"Shows a message (3 lines)"
;
static PyObject *
goodies_show_message(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
if (!PyArg_ParseTuple(args, "sss",&s1,&s2,&s3))
return NULL;
fl_show_message (s1,s2,s3);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_alert__doc__[] =
"Shows an alert message"
;
static PyObject *
goodies_show_alert(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
int i;
if (!PyArg_ParseTuple(args, "sssi",&s1,&s2,&s3,&i))
return NULL;
fl_show_alert (s1,s2,s3,i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_question__doc__[] =
"Shows a question"
;
static PyObject *
goodies_show_question(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1;
int v,r;
if (!PyArg_ParseTuple(args, "ss",&s1,&v))
return NULL;
r=fl_show_question (s1,v);
return Py_BuildValue ("i",r);
}
static char goodies_show_input__doc__[] =
"Asks a line of text"
;
static PyObject *
goodies_show_input(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,r[2048];
if (!PyArg_ParseTuple(args, "ss",&s1,&s2))
return NULL;
strcpy (r,fl_show_input(s1,s2));
return Py_BuildValue ("s",r);
}
static char goodies_show_colormap__doc__[] =
"Shows a colormap"
;
static PyObject *
goodies_show_colormap(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,r;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
r=fl_show_colormap (i);
return Py_BuildValue ("i",r);
}
static char goodies_show_choice__doc__[] =
"Shows a choice"
;
static PyObject *
goodies_show_choice(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3,*s4,*s5,*s6;
int i1,i2,r;
if (!PyArg_ParseTuple(args, "sssisssi",&s1,&s2,&s3,&i1,&s4,&s5,&s6,&i2))
return NULL;
r=fl_show_choice (s1,s2,s3,i1,s4,s5,s6,i2);
return Py_BuildValue("i",r);
}
static char goodies_set_choices_shortcut__doc__[] =
"Sets the choice's shortcuts"
;
static PyObject *
goodies_set_choices_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3;
if (!PyArg_ParseTuple(args, "sss",&s1,&s2,&s3))
return NULL;
fl_set_choices_shortcut (s1,s2,s3);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_oneliner__doc__[] =
"Shows a one-liner"
;
static PyObject *
goodies_show_oneliner(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1;
int i,j;
if (!PyArg_ParseTuple(args, "sii",&s1,&i,&j))
return NULL;
fl_show_oneliner (s1,i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_hide_oneliner__doc__[] =
"Hides a oneliner"
;
static PyObject *
goodies_hide_oneliner(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_hide_oneliner();
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_oneliner_font__doc__[] =
"Sets the oneliner font"
;
static PyObject *
goodies_set_oneliner_font(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii",&i,&j))
return NULL;
fl_set_oneliner_font(i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_oneliner_color__doc__[] =
"Sets the oneliner color"
;
static PyObject *
goodies_set_oneliner_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i,j;
if (!PyArg_ParseTuple(args, "ii",&i,&j))
return NULL;
fl_set_oneliner_color (i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_use_fselector__doc__[] =
"??"
;
static PyObject *
goodies_use_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
fl_use_fselector (i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_show_fselector__doc__[] =
"Shows a fselector"
;
static PyObject *
goodies_show_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char *s1,*s2,*s3,*s4,r[2048];
if (!PyArg_ParseTuple(args, "ssss",&s1,&s2,&s3,&s4))
return NULL;
strcpy (r,fl_show_fselector (s1,s2,s3,s4));
return Py_BuildValue ("s",r);
}
static char goodies_set_fselector_placement__doc__[] =
""
;
static PyObject *
goodies_set_fselector_placement(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i;
if (!PyArg_ParseTuple(args, "i",&i))
return NULL;
fl_set_fselector_placement(i);
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_set_fselector_callback__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_set_fselector_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_get_directory__doc__[] =
""
;
static PyObject *
goodies_get_directory(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_directory());
return Py_BuildValue ("s",r);
}
static char goodies_get_pattern__doc__[] =
""
;
static PyObject *
goodies_get_pattern(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_pattern());
return Py_BuildValue ("s",r);
}
static char goodies_get_filename__doc__[] =
""
;
static PyObject *
goodies_get_filename(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
char r[2048];
if (!PyArg_ParseTuple(args, ""))
return NULL;
strcpy (r,fl_get_filename());
return Py_BuildValue ("s",r);
}
static char goodies_refresh_fselector__doc__[] =
""
;
static PyObject *
goodies_refresh_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_refresh_fselector();
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_add_fselector_appbutton__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_add_fselector_appbutton(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_disable_fselector_cache__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_disable_fselector_cache(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_invalidate_fselector_cache__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_invalidate_fselector_cache(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_get_fselector_form__doc__[] =
"XXXXXX Not implemented"
;
static PyObject *
goodies_get_fselector_form(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char goodies_hide_fselector__doc__[] =
"Hides a fselector"
;
static PyObject *
goodies_hide_fselector(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
fl_hide_fselector();
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef goodies_methods[] =
{
{"set_font", goodies_set_font, 1, goodies_set_font__doc__},
{"show_message", goodies_show_message, 1, goodies_show_message__doc__},
{"show_alert", goodies_show_alert, 1, goodies_show_alert__doc__},
{"show_question", goodies_show_question, 1, goodies_show_question__doc__},
{"show_input", goodies_show_input, 1, goodies_show_input__doc__},
{"show_colormap", goodies_show_colormap, 1, goodies_show_colormap__doc__},
{"show_choice", goodies_show_choice, 1, goodies_show_choice__doc__},
{"set_choices_shortcut", goodies_set_choices_shortcut, 1, goodies_set_choices_shortcut__doc__},
{"show_oneliner", goodies_show_oneliner, 1, goodies_show_oneliner__doc__},
{"hide_oneliner", goodies_hide_oneliner, 1, goodies_hide_oneliner__doc__},
{"set_oneliner_font", goodies_set_oneliner_font, 1, goodies_set_oneliner_font__doc__},
{"set_oneliner_color", goodies_set_oneliner_color, 1, goodies_set_oneliner_color__doc__},
{"use_fselector", goodies_use_fselector, 1, goodies_use_fselector__doc__},
{"show_fselector", goodies_show_fselector, 1, goodies_show_fselector__doc__},
{"set_fselector_placement", goodies_set_fselector_placement, 1, goodies_set_fselector_placement__doc__},
{"set_fselector_callback", goodies_set_fselector_callback, 1, goodies_set_fselector_callback__doc__},
{"get_directory", goodies_get_directory, 1, goodies_get_directory__doc__},
{"get_pattern", goodies_get_pattern, 1, goodies_get_pattern__doc__},
{"get_filename", goodies_get_filename, 1, goodies_get_filename__doc__},
{"refresh_fselector", goodies_refresh_fselector, 1, goodies_refresh_fselector__doc__},
{"add_fselector_appbutton", goodies_add_fselector_appbutton, 1, goodies_add_fselector_appbutton__doc__},
{"disable_fselector_cache", goodies_disable_fselector_cache, 1, goodies_disable_fselector_cache__doc__},
{"invalidate_fselector_cache", goodies_invalidate_fselector_cache, 1, goodies_invalidate_fselector_cache__doc__},
{"get_fselector_form", goodies_get_fselector_form, 1, goodies_get_fselector_form__doc__},
{"hide_fselector", goodies_hide_fselector, 1, goodies_hide_fselector__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initgoodies) */
static char goodies_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"goodies", /* m_name */
goodies_module_documentation, /* m_doc */
-1, /* m_size */
goodies_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_goodies()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("goodies.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module goodies");
return m;
}

257
src/pyxforms/input.c Normal file
View File

@ -0,0 +1,257 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char input_create__doc__[] =
"Creates an Input object"
;
static PyObject *
input_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_input (t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char input_set__doc__[] =
"Sets the contents of an input object"
;
static PyObject *
input_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_input((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_color__doc__[] =
"Sets the color of the input object's text"
;
static PyObject *
input_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c1,c2;
if (!PyArg_ParseTuple(args, "lii",&o,&c1,&c2))
return NULL;
fl_set_input_color ((FL_OBJECT *)o,c1,c2);
Py_INCREF(Py_None);
return Py_None;
}
static char input_get__doc__[] =
"Gets the input's value"
;
static PyObject *
input_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char r[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (r,fl_get_input((FL_OBJECT *)o));
return Py_BuildValue ("s",r);
}
static char input_set_return__doc__[] =
"Makes the input return always or when released"
;
static PyObject *
input_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_scroll__doc__[] =
"Makes the input scrollable"
;
static PyObject *
input_set_scroll(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_scroll((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_cursorpos__doc__[] =
"Sets the input's cursor position"
;
static PyObject *
input_set_cursorpos(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i,j;
if (!PyArg_ParseTuple(args, "lii",&o,&i,&j))
return NULL;
fl_set_input_cursorpos ((FL_OBJECT *)o,i,j);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_selected__doc__[] =
"Sets the input as selected"
;
static PyObject *
input_set_selected(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_input_selected((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char input_set_selected_range__doc__[] =
"Sets a range of the input object as selected"
;
static PyObject *
input_set_selected_range(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i,j;
if (!PyArg_ParseTuple(args, "lii",&o,&i,&j))
return NULL;
fl_set_input_selected_range((FL_OBJECT *)o,i,j);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef input_methods[] =
{
{"create", input_create, 1, input_create__doc__},
{"set", input_set, 1, input_set__doc__},
{"set_color", input_set_color, 1, input_set_color__doc__},
{"get", input_get, 1, input_get__doc__},
{"set_return", input_set_return, 1, input_set_return__doc__},
{"set_scroll", input_set_scroll, 1, input_set_scroll__doc__},
{"set_cursorpos", input_set_cursorpos, 1, input_set_cursorpos__doc__},
{"set_selected", input_set_selected, 1, input_set_selected__doc__},
{"set_selected_range", input_set_selected_range, 1, input_set_selected_range__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initinput) */
static char input_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"input", /* m_name */
input_module_documentation, /* m_doc */
-1, /* m_size */
input_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_input()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("input.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module input");
return m;
}

317
src/pyxforms/menu.c Normal file
View File

@ -0,0 +1,317 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char menu_create__doc__[] =
"Creates a menu"
;
static PyObject *
menu_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_menu(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char menu_clear__doc__[] =
"Removes all the menu's options"
;
static PyObject *
menu_clear(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_clear_menu ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set__doc__[] =
"Sets the menu contents"
;
static PyObject *
menu_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_menu ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_addto__doc__[] =
"Adds an option to an existing menu"
;
static PyObject *
menu_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_addto_menu ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_replace_item__doc__[] =
"Replaces an item from the menu"
;
static PyObject *
menu_replace_item(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
char *s;
if (!PyArg_ParseTuple(args, "lis",&o,&i,&s))
return NULL;
fl_replace_menu_item((FL_OBJECT *)o,i,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_delete_item__doc__[] =
"Deletes an option from a menu"
;
static PyObject *
menu_delete_item(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_delete_menu_item((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set_item_shortcut__doc__[] =
"Sets a menu item's shortcut"
;
static PyObject *
menu_set_item_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
char *s;
if (!PyArg_ParseTuple(args, "lis",&o,&i,&s))
return NULL;
fl_set_menu_item_shortcut((FL_OBJECT *)o,i,s);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_set_item_mode__doc__[] =
"Sets the item mode (unselectable, etc)"
;
static PyObject *
menu_set_item_mode(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
unsigned long m;
if (!PyArg_ParseTuple(args, "lil",&o,&i,&m))
return NULL;
fl_set_menu_item_mode((FL_OBJECT *)o,i,m);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_show_symbol__doc__[] =
"Shows a simbol menu with the label"
;
static PyObject *
menu_show_symbol(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_show_menu_symbol ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char menu_get__doc__[] =
"Gets the last selected item's number"
;
static PyObject *
menu_get(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_menu((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char menu_get_maxitems__doc__[] =
"returns the number of items in a menu"
;
static PyObject *
menu_get_maxitems(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_menu_maxitems((FL_OBJECT *)o);
return Py_BuildValue ("i",r);
}
static char menu_get_text__doc__[] =
"Returns the text of the menu last selected choice"
;
static PyObject *
menu_get_text(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char s[2048];
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
strcpy (s,fl_get_menu_text((FL_OBJECT *)o));
return Py_BuildValue ("s",s);
}
/* List of methods defined in the module */
static struct PyMethodDef menu_methods[] =
{
{"create", menu_create, 1, menu_create__doc__},
{"clear", menu_clear, 1, menu_clear__doc__},
{"set", menu_set, 1, menu_set__doc__},
{"addto", menu_addto, 1, menu_addto__doc__},
{"replace_item", menu_replace_item, 1, menu_replace_item__doc__},
{"delete_item", menu_delete_item, 1, menu_delete_item__doc__},
{"set_item_shortcut", menu_set_item_shortcut, 1, menu_set_item_shortcut__doc__},
{"set_item_mode", menu_set_item_mode, 1, menu_set_item_mode__doc__},
{"show_symbol", menu_show_symbol, 1, menu_show_symbol__doc__},
{"get", menu_get, 1, menu_get__doc__},
{"get_maxitems", menu_get_maxitems, 1, menu_get_maxitems__doc__},
{"get_text", menu_get_text, 1, menu_get_text__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initmenu) */
static char menu_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"menu", /* m_name */
menu_module_documentation, /* m_doc */
-1, /* m_size */
menu_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_menu()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("menu.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module menu");
return m;
}

524
src/pyxforms/objects.c Normal file
View File

@ -0,0 +1,524 @@
#include <Python.h>
#include <forms.h>
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char obj_set_boxtype__doc__[] =
"Sets the objects Boxtype"
;
static PyObject *
obj_set_boxtype(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int type;
if (!PyArg_ParseTuple(args, "li",&object,&type))
return NULL;
fl_set_object_boxtype ((FL_OBJECT *)object,type);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_bw__doc__[] =
"Sets the object's Border Width"
;
static PyObject *
obj_set_bw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int bw;
if (!PyArg_ParseTuple(args, "li",&object,&bw))
return NULL;
fl_set_object_bw ((FL_OBJECT *)object,bw);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_resize__doc__[] =
"Sets the objects \"Resize policy\""
;
static PyObject *
obj_set_resize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
unsigned a;
if (!PyArg_ParseTuple(args, "ll",&object,&a))
return NULL;
fl_set_object_resize ((FL_OBJECT *)object,a);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_gravity__doc__[] =
"Sets the objects gravity"
;
static PyObject *
obj_set_gravity(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
unsigned a,b,c;
if (!PyArg_ParseTuple(args, "lll",&object,&a,&b))
return NULL;
fl_set_object_gravity ((FL_OBJECT *)object,a,b);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lsize__doc__[] =
"Sets the object's label size"
;
static PyObject *
obj_set_lsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int size;
if (!PyArg_ParseTuple(args, "li",&object,&size))
return NULL;
fl_set_object_lsize((FL_OBJECT *)object,size);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lstyle__doc__[] =
"Sets the object's label style"
;
static PyObject *
obj_set_lstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long object;
int style;
if (!PyArg_ParseTuple(args, "li",&object,&style))
return NULL;
fl_set_object_lstyle((FL_OBJECT *)object,style);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lcol__doc__[] =
"Sets the object's label color"
;
static PyObject *
obj_set_lcol(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c;
if (!PyArg_ParseTuple(args, "li",&o,&c))
return NULL;
fl_set_object_lcol((FL_OBJECT *)o,c);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_dragndrop__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_dragndrop(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_focus__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_focus(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_redraw__doc__[] =
"Redraws the object"
;
static PyObject *
obj_redraw(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_redraw_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_lalign__doc__[] =
"Sets the label alignment"
;
static PyObject *
obj_set_lalign(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int a;
if (!PyArg_ParseTuple(args, "li",&o,&a))
return NULL;
fl_set_object_lalign((FL_OBJECT *)o,a);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_callback__doc__[] =
"XXXXXXNot implemented"
;
static PyObject *
obj_set_callback(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char obj_show__doc__[] =
"Shows the object"
;
static PyObject *
obj_show(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_show_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_hide__doc__[] =
"Hides the object"
;
static PyObject *
obj_hide(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_hide_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_free__doc__[] =
"Releases the object's memory"
;
static PyObject *
obj_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_free_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_delete__doc__[] =
"Deletes the object from it's form"
;
static PyObject *
obj_delete(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_delete_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_color__doc__[] =
"Sets the object color"
;
static PyObject *
obj_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
float a,b;
if (!PyArg_ParseTuple(args, "lff",&o,&a,&b))
return NULL;
fl_set_object_color((FL_OBJECT *)o,(int)a,(int)b);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_label__doc__[] =
"Sets the label"
;
static PyObject *
obj_set_label(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
if (!PyArg_ParseTuple(args, "ls",&o,&s))
return NULL;
fl_set_object_label((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_activate__doc__[] =
"Activates the object"
;
static PyObject *
obj_activate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_activate_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_deactivate__doc__[] =
"Activates the object"
;
static PyObject *
obj_deactivate(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_deactivate_object((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_shortcut__doc__[] =
"Sets the shortcut to the object"
;
static PyObject *
obj_set_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
char *s;
int i;
if (!PyArg_ParseTuple(args, "lsi",&o,&s,&i))
return NULL;
fl_set_object_shortcut ((FL_OBJECT *)o,s,i);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_dblbuffer__doc__[] =
"Sets the object as double buffered"
;
static PyObject *
obj_set_dblbuffer(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int c;
if (!PyArg_ParseTuple(args, "li",&o,&c))
return NULL;
fl_set_object_dblbuffer((FL_OBJECT *)o,c);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_set_geometry__doc__[] =
"Sets the object's geometry"
;
static PyObject *
obj_set_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "liiii",&o,&x,&y,&w,&h))
return NULL;
fl_set_object_geometry ((FL_OBJECT *)o,x,y,w,h);
fl_redraw_object ((FL_OBJECT *)o);
Py_INCREF(Py_None);
return Py_None;
}
static char obj_get_geometry__doc__[] =
"Sets the object's geometry"
;
static PyObject *
obj_get_geometry(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int x,y,w,h;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
x=((FL_OBJECT *)o)->x;
y=((FL_OBJECT *)o)->y;
w=((FL_OBJECT *)o)->w;
h=((FL_OBJECT *)o)->h;
fl_redraw_object ((FL_OBJECT *)o);
return Py_BuildValue ("iiii",x,y,w,h);
}
/* List of methods defined in the module */
static struct PyMethodDef obj_methods[] =
{
{"set_boxtype", obj_set_boxtype, 1, obj_set_boxtype__doc__},
{"set_bw", obj_set_bw, 1, obj_set_bw__doc__},
{"set_resize", obj_set_resize, 1, obj_set_resize__doc__},
{"set_gravity", obj_set_gravity, 1, obj_set_gravity__doc__},
{"set_lsize", obj_set_lsize, 1, obj_set_lsize__doc__},
{"set_lstyle", obj_set_lstyle, 1, obj_set_lstyle__doc__},
{"set_lcol", obj_set_lcol, 1, obj_set_lcol__doc__},
{"set_dragndrop", obj_set_dragndrop, 1, obj_set_dragndrop__doc__},
{"set_focus", obj_set_focus, 1, obj_set_focus__doc__},
{"redraw", obj_redraw, 1, obj_redraw__doc__},
{"set_lalign", obj_set_lalign, 1, obj_set_lalign__doc__},
{"set_callback", obj_set_callback, 1, obj_set_callback__doc__},
{"show", obj_show, 1, obj_show__doc__},
{"hide", obj_hide, 1, obj_hide__doc__},
{"free", obj_free, 1, obj_free__doc__},
{"delete", obj_delete, 1, obj_delete__doc__},
{"set_color", obj_set_color, 1, obj_set_color__doc__},
{"set_label", obj_set_label, 1, obj_set_label__doc__},
{"activate", obj_activate, 1, obj_activate__doc__},
{"deactivate", obj_deactivate, 1, obj_deactivate__doc__},
{"set_shortcut", obj_set_shortcut, 1, obj_set_shortcut__doc__},
{"set_dblbuffer", obj_set_dblbuffer, 1, obj_set_dblbuffer__doc__},
{"set_geometry", obj_set_geometry, 1, obj_set_geometry__doc__},
{"get_geometry", obj_get_geometry, 1, obj_get_geometry__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initobjects) */
static char objects_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"objects", /* m_name */
objects_module_documentation, /* m_doc */
-1, /* m_size */
obj_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_objects()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("objects.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module objects");
return m;
}

View File

@ -89,7 +89,8 @@ pmp_set_file(self, args)
/* List of methods defined in the module */ /* List of methods defined in the module */
static struct PyMethodDef pmp_methods[] = { static struct PyMethodDef pmp_methods[] =
{
{"create", pmp_create, 1, pmp_create__doc__}, {"create", pmp_create, 1, pmp_create__doc__},
{"set_data", pmp_set_data, 1, pmp_set_data__doc__}, {"set_data", pmp_set_data, 1, pmp_set_data__doc__},
{"set_file", pmp_set_file, 1, pmp_set_file__doc__}, {"set_file", pmp_set_file, 1, pmp_set_file__doc__},
@ -104,7 +105,8 @@ static char pixmaps_module_documentation[] =
"" ""
; ;
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"pixmaps", /* m_name */ "pixmaps", /* m_name */
pixmaps_module_documentation, /* m_doc */ pixmaps_module_documentation, /* m_doc */
@ -134,5 +136,6 @@ PyInit_pixmaps()
/* Check for errors */ /* Check for errors */
if (PyErr_Occurred()) if (PyErr_Occurred())
Py_FatalError("can't initialize module pixmaps"); Py_FatalError("can't initialize module pixmaps");
return m;
} }

384
src/pyxforms/popups.c Normal file
View File

@ -0,0 +1,384 @@
/***********************************************************
Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
The Netherlands.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char pup_new__doc__[] =
""
;
static PyObject *
pup_new(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_def__doc__[] =
""
;
static PyObject *
pup_def(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_addto__doc__[] =
""
;
static PyObject *
pup_addto(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set__doc__[] =
""
;
static PyObject *
pup_set(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_free__doc__[] =
""
;
static PyObject *
pup_free(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_do__doc__[] =
""
;
static PyObject *
pup_do(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_shortcut__doc__[] =
""
;
static PyObject *
pup_set_shortcut(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_position__doc__[] =
""
;
static PyObject *
pup_set_position(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_selection__doc__[] =
""
;
static PyObject *
pup_set_selection(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_fontsize__doc__[] =
""
;
static PyObject *
pup_set_fontsize(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_fontstyle__doc__[] =
""
;
static PyObject *
pup_set_fontstyle(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_shadow__doc__[] =
""
;
static PyObject *
pup_set_shadow(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_softedge__doc__[] =
""
;
static PyObject *
pup_set_softedge(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_color__doc__[] =
""
;
static PyObject *
pup_set_color(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_title__doc__[] =
""
;
static PyObject *
pup_set_title(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_itemcb__doc__[] =
""
;
static PyObject *
pup_set_itemcb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_menucb__doc__[] =
""
;
static PyObject *
pup_set_menucb(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
static char pup_set_submenu__doc__[] =
""
;
static PyObject *
pup_set_submenu(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef pup_methods[] =
{
{"new", pup_new, 1, pup_new__doc__},
{"def", pup_def, 1, pup_def__doc__},
{"addto", pup_addto, 1, pup_addto__doc__},
{"set", pup_set, 1, pup_set__doc__},
{"free", pup_free, 1, pup_free__doc__},
{"do", pup_do, 1, pup_do__doc__},
{"set_shortcut", pup_set_shortcut, 1, pup_set_shortcut__doc__},
{"set_position", pup_set_position, 1, pup_set_position__doc__},
{"set_selection", pup_set_selection, 1, pup_set_selection__doc__},
{"set_fontsize", pup_set_fontsize, 1, pup_set_fontsize__doc__},
{"set_fontstyle", pup_set_fontstyle, 1, pup_set_fontstyle__doc__},
{"set_shadow", pup_set_shadow, 1, pup_set_shadow__doc__},
{"set_softedge", pup_set_softedge, 1, pup_set_softedge__doc__},
{"set_color", pup_set_color, 1, pup_set_color__doc__},
{"set_title", pup_set_title, 1, pup_set_title__doc__},
{"set_itemcb", pup_set_itemcb, 1, pup_set_itemcb__doc__},
{"set_menucb", pup_set_menucb, 1, pup_set_menucb__doc__},
{"set_submenu", pup_set_submenu, 1, pup_set_submenu__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initpopups) */
static char popups_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"popups", /* m_name */
popups_module_documentation, /* m_doc */
-1, /* m_size */
pup_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_popups()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("popups.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module popups");
return m;
}

316
src/pyxforms/positioner.c Normal file
View File

@ -0,0 +1,316 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char posit_create__doc__[] =
"Creates a positioner"
;
static PyObject *
posit_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int t,x,y,w,h;
char *l;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_positioner(t,x,y,w,h,l);
return Py_BuildValue("l",o);
}
static char posit_set_xvalue__doc__[] =
"Sets the x-value of the positioner"
;
static PyObject *
posit_set_xvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_positioner_xvalue((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_xvalue__doc__[] =
"Gets the x-value of the positioner"
;
static PyObject *
posit_get_xvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_positioner_xvalue((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char posit_set_xbounds__doc__[] =
"Sets the positioner's x min/max"
;
static PyObject *
posit_set_xbounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_positioner_xbounds ((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_xbounds__doc__[] =
"Gets the positioner's x min/max"
;
static PyObject *
posit_get_xbounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_positioner_xbounds ((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char posit_set_yvalue__doc__[] =
"Sets the y-value of the positioner"
;
static PyObject *
posit_set_yvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_positioner_yvalue((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_yvalue__doc__[] =
"Gets the y-value of the positioner"
;
static PyObject *
posit_get_yvalue(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double r;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
r=fl_get_positioner_yvalue((FL_OBJECT *)o);
return Py_BuildValue ("d",r);
}
static char posit_set_ybounds__doc__[] =
"Sets the positioner's y min/max"
;
static PyObject *
posit_set_ybounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_positioner_ybounds ((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_get_ybounds__doc__[] =
"Gets the positioner's y min/max"
;
static PyObject *
posit_get_ybounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_positioner_ybounds ((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char posit_set_xstep__doc__[] =
"Sets the positioner x-step"
;
static PyObject *
posit_set_xstep(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_positioner_xstep ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_set_ystep__doc__[] =
"Sets the positioner y-step"
;
static PyObject *
posit_set_ystep(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_positioner_ystep ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char posit_set_return__doc__[] =
"Makes the positioner return always or when released"
;
static PyObject *
posit_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_positioner_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef posit_methods[] =
{
{"create", posit_create, 1, posit_create__doc__},
{"set_xvalue", posit_set_xvalue, 1, posit_set_xvalue__doc__},
{"get_xvalue", posit_get_xvalue, 1, posit_get_xvalue__doc__},
{"set_xbounds", posit_set_xbounds, 1, posit_set_xbounds__doc__},
{"get_xbounds", posit_get_xbounds, 1, posit_get_xbounds__doc__},
{"set_yvalue", posit_set_yvalue, 1, posit_set_yvalue__doc__},
{"get_yvalue", posit_get_yvalue, 1, posit_get_yvalue__doc__},
{"set_ybounds", posit_set_ybounds, 1, posit_set_ybounds__doc__},
{"get_ybounds", posit_get_ybounds, 1, posit_get_ybounds__doc__},
{"set_xstep", posit_set_xstep, 1, posit_set_xstep__doc__},
{"set_ystep", posit_set_ystep, 1, posit_set_ystep__doc__},
{"set_return", posit_set_return, 1, posit_set_return__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initpositioner) */
static char positioner_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"positioner", /* m_name */
positioner_module_documentation, /* m_doc */
-1, /* m_size */
posit_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_positioner()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("positioner.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module positioner");
return m;
}

277
src/pyxforms/slider.c Normal file
View File

@ -0,0 +1,277 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char slider_create__doc__[] =
""
;
static PyObject *
slider_create(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_slider(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char slider_create_val__doc__[] =
"Creates a val_slider"
;
static PyObject *
slider_create_val(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int t,x,y,w,h;
char *l;
long o;
if (!PyArg_ParseTuple(args, "iiiiis",&t,&x,&y,&w,&h,&l))
return NULL;
o=(long)fl_create_valslider(t,x,y,w,h,l);
return Py_BuildValue ("l",o);
}
static char slider_set_value__doc__[] =
"Sets the slider's value"
;
static PyObject *
slider_set_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "ld",&o,&v))
return NULL;
fl_set_slider_value ((FL_OBJECT *)o,v);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_get_value__doc__[] =
"Gets the slider value"
;
static PyObject *
slider_get_value(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double v;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
v=fl_get_slider_value ((FL_OBJECT *)o);
return Py_BuildValue ("d",v);
}
static char slider_set_bounds__doc__[] =
"Sets the slider's min/max"
;
static PyObject *
slider_set_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "ldd",&o,&min,&max))
return NULL;
fl_set_slider_bounds((FL_OBJECT *)o,min,max);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_get_bounds__doc__[] =
""
;
static PyObject *
slider_get_bounds(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double min,max;
if (!PyArg_ParseTuple(args, "l",&o))
return NULL;
fl_get_slider_bounds((FL_OBJECT *)o,&min,&max);
return Py_BuildValue ("dd",min,max);
}
static char slider_set_return__doc__[] =
"Makes the slider return always or when released"
;
static PyObject *
slider_set_return(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_slider_return ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_step__doc__[] =
"Sets the slider's step"
;
static PyObject *
slider_set_step(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_slider_step ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_size__doc__[] =
"Sets the slider's thingy size"
;
static PyObject *
slider_set_size(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double s;
if (!PyArg_ParseTuple(args, "ld",&o,&s))
return NULL;
fl_set_slider_size ((FL_OBJECT *)o,s);
Py_INCREF(Py_None);
return Py_None;
}
static char slider_set_precision__doc__[] =
"Sets the valslider's precision"
;
static PyObject *
slider_set_precision(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple(args, "li",&o,&i))
return NULL;
fl_set_slider_precision ((FL_OBJECT *)o,i);
Py_INCREF(Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef slider_methods[] =
{
{"create", slider_create, 1, slider_create__doc__},
{"create_val", slider_create_val, 1, slider_create_val__doc__},
{"set_value", slider_set_value, 1, slider_set_value__doc__},
{"get_value", slider_get_value, 1, slider_get_value__doc__},
{"set_bounds", slider_set_bounds, 1, slider_set_bounds__doc__},
{"get_bounds", slider_get_bounds, 1, slider_get_bounds__doc__},
{"set_return", slider_set_return, 1, slider_set_return__doc__},
{"set_step", slider_set_step, 1, slider_set_step__doc__},
{"set_size", slider_set_size, 1, slider_set_size__doc__},
{"set_precision", slider_set_precision, 1, slider_set_precision__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initslider) */
static char slider_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"slider", /* m_name */
slider_module_documentation, /* m_doc */
-1, /* m_size */
slider_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_slider()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyBytes_FromString("slider.error");
PyDict_SetItemString(d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred())
Py_FatalError("can't initialize module slider");
return m;
}

View File

@ -46,7 +46,8 @@ text_create(self, args)
/* List of methods defined in the module */ /* List of methods defined in the module */
static struct PyMethodDef text_methods[] = { static struct PyMethodDef text_methods[] =
{
{"create", text_create, 1, text_create__doc__}, {"create", text_create, 1, text_create__doc__},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
@ -59,7 +60,8 @@ static char text_module_documentation[] =
"" ""
; ;
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"text", /* m_name */ "text", /* m_name */
text_module_documentation, /* m_doc */ text_module_documentation, /* m_doc */
@ -89,5 +91,6 @@ PyInit_text()
/* Check for errors */ /* Check for errors */
if (PyErr_Occurred()) if (PyErr_Occurred())
Py_FatalError("can't initialize module text"); Py_FatalError("can't initialize module text");
return m;
} }

View File

@ -85,7 +85,8 @@ timer_get(self, args)
/* List of methods defined in the module */ /* List of methods defined in the module */
static struct PyMethodDef timer_methods[] = { static struct PyMethodDef timer_methods[] =
{
{"create", fl_timer_create, 1, timer_create__doc__}, {"create", fl_timer_create, 1, timer_create__doc__},
{"set", timer_set, 1, timer_set__doc__}, {"set", timer_set, 1, timer_set__doc__},
{"get", timer_get, 1, timer_get__doc__}, {"get", timer_get, 1, timer_get__doc__},
@ -100,7 +101,8 @@ static char timer_module_documentation[] =
"" ""
; ;
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"timer", /* m_name */ "timer", /* m_name */
timer_module_documentation, /* m_doc */ timer_module_documentation, /* m_doc */
@ -130,5 +132,6 @@ PyInit_timer()
/* Check for errors */ /* Check for errors */
if (PyErr_Occurred()) if (PyErr_Occurred())
Py_FatalError("can't initialize module timer"); Py_FatalError("can't initialize module timer");
return m;
} }

View File

@ -58,7 +58,8 @@ pyxforms_do_forms(self,args)
return Py_BuildValue("l",(long)obj); return Py_BuildValue("l",(long)obj);
} }
static PyMethodDef xformsMethods [] ={ static PyMethodDef xformsMethods [] =
{
/* XForms specifics */ /* XForms specifics */
{"init",pyxforms_init,1}, {"init",pyxforms_init,1},
@ -68,7 +69,8 @@ static PyMethodDef xformsMethods [] ={
}; };
static struct PyModuleDef moduledef = { static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"xforms", /* m_name */ "xforms", /* m_name */
"", /* m_doc */ "", /* m_doc */
@ -83,6 +85,6 @@ static PyMethodDef xformsMethods [] ={
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit_xforms() PyInit_xforms()
{ {
PyModule_Create(&moduledef); return PyModule_Create(&moduledef);
} }

452
src/pyxforms/xyplot.c Normal file
View File

@ -0,0 +1,452 @@
/***********************************************************
Copyright 1996 Roberto Alsina
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
#include "Python.h"
#include "forms.h"
static PyObject *ErrorObject;
/* ----------------------------------------------------- */
static char xyplot_set_return__doc__[] =
"Makes the XyPlot return always or when released"
;
static PyObject *
xyplot_set_return (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i;
if (!PyArg_ParseTuple (args, "li", &o, &i))
return NULL;
fl_set_xyplot_return ((FL_OBJECT *) o, i);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_xtics__doc__[] =
"Changes the number of xtics (major and minor) in a xyplot"
;
static PyObject *
xyplot_set_xtics (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i, j;
if (!PyArg_ParseTuple (args, "lii", &o, &i, &j))
return NULL;
fl_set_xyplot_xtics ((FL_OBJECT *) o, i, j);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_ytics__doc__[] =
"Changes the number of ytics (major and minor) in a xyplot"
;
static PyObject *
xyplot_set_ytics (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
int i, j;
if (!PyArg_ParseTuple (args, "lii", &o, &i, &j))
return NULL;
fl_set_xyplot_ytics ((FL_OBJECT *) o, i, j);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_xbounds__doc__[] =
"Sets the xmin and xmax in a xyplot"
;
static PyObject *
xyplot_set_xbounds (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double u, v;
if (!PyArg_ParseTuple (args, "ldd", &o, &u, &v))
return NULL;
fl_set_xyplot_xbounds ((FL_OBJECT *) o, u, v);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_ybounds__doc__[] =
"Sets the xmin and xmax in a xyplot"
;
static PyObject *
xyplot_set_ybounds (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
double u, v;
if (!PyArg_ParseTuple (args, "ldd", &o, &u, &v))
return NULL;
fl_set_xyplot_ybounds ((FL_OBJECT *) o, u, v);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_get__doc__[] =
"Gets the current value of the point that changed"
;
static PyObject *
xyplot_get (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
long o;
float x, y;
int i;
if (!PyArg_ParseTuple (args, "l", &o))
return NULL;
fl_get_xyplot ((FL_OBJECT *) o, &x, &y, &i);
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_get_data__doc__[] =
""
;
static PyObject *
xyplot_get_data (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_create__doc__[] =
""
;
static PyObject *
xyplot_create (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_data__doc__[] =
""
;
static PyObject *
xyplot_set_data (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_file__doc__[] =
""
;
static PyObject *
xyplot_set_file (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_add_text__doc__[] =
""
;
static PyObject *
xyplot_add_text (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_delete_text__doc__[] =
""
;
static PyObject *
xyplot_delete_text (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_add_overlay__doc__[] =
""
;
static PyObject *
xyplot_add_overlay (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_overlay_type__doc__[] =
""
;
static PyObject *
xyplot_set_overlay_type (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_delete_overlay__doc__[] =
""
;
static PyObject *
xyplot_delete_overlay (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_interpolate__doc__[] =
""
;
static PyObject *
xyplot_set_interpolate (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_fontsize__doc__[] =
""
;
static PyObject *
xyplot_set_fontsize (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_fontstyle__doc__[] =
""
;
static PyObject *
xyplot_set_fontstyle (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_inspect__doc__[] =
""
;
static PyObject *
xyplot_set_inspect (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_set_symbolsize__doc__[] =
""
;
static PyObject *
xyplot_set_symbolsize (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
static char xyplot_replace_point__doc__[] =
""
;
static PyObject *
xyplot_replace_point (self, args)
PyObject *self; /* Not used */
PyObject *args;
{
if (!PyArg_ParseTuple (args, ""))
return NULL;
Py_INCREF (Py_None);
return Py_None;
}
/* List of methods defined in the module */
static struct PyMethodDef xyplot_methods[] =
{
{"set_return", xyplot_set_return, 1, xyplot_set_return__doc__},
{"set_xtics", xyplot_set_xtics, 1, xyplot_set_xtics__doc__},
{"set_ytics", xyplot_set_ytics, 1, xyplot_set_ytics__doc__},
{"set_xbounds", xyplot_set_xbounds, 1, xyplot_set_xbounds__doc__},
{"set_ybounds", xyplot_set_ybounds, 1, xyplot_set_ybounds__doc__},
{"get", xyplot_get, 1, xyplot_get__doc__},
{"get_data", xyplot_get_data, 1, xyplot_get_data__doc__},
{"create", xyplot_create, 1, xyplot_create__doc__},
{"set_data", xyplot_set_data, 1, xyplot_set_data__doc__},
{"set_file", xyplot_set_file, 1, xyplot_set_file__doc__},
{"add_text", xyplot_add_text, 1, xyplot_add_text__doc__},
{"delete_text", xyplot_delete_text, 1, xyplot_delete_text__doc__},
{"add_overlay", xyplot_add_overlay, 1, xyplot_add_overlay__doc__},
{"set_overlay_type", xyplot_set_overlay_type, 1, xyplot_set_overlay_type__doc__},
{"delete_overlay", xyplot_delete_overlay, 1, xyplot_delete_overlay__doc__},
{"set_interpolate", xyplot_set_interpolate, 1, xyplot_set_interpolate__doc__},
{"set_fontsize", xyplot_set_fontsize, 1, xyplot_set_fontsize__doc__},
{"set_fontstyle", xyplot_set_fontstyle, 1, xyplot_set_fontstyle__doc__},
{"set_inspect", xyplot_set_inspect, 1, xyplot_set_inspect__doc__},
{"set_symbolsize", xyplot_set_symbolsize, 1, xyplot_set_symbolsize__doc__},
{"replace_point", xyplot_replace_point, 1, xyplot_replace_point__doc__},
{NULL, NULL} /* sentinel */
};
/* Initialization function for the module (*must* be called initxyplot) */
static char xyplot_module_documentation[] =
""
;
static struct PyModuleDef moduledef =
{
PyModuleDef_HEAD_INIT,
"xyplot", /* m_name */
xyplot_module_documentation, /* m_doc */
-1, /* m_size */
xyplot_methods, /* m_methods */
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL, /* m_free */
};
PyMODINIT_FUNC
PyInit_xyplot ()
{
PyObject *m, *d;
/* Create the module and add the functions */
m = PyModule_Create(&moduledef);
/* Add some symbolic constants to the module */
d = PyModule_GetDict (m);
ErrorObject = PyBytes_FromString ("xyplot.error");
PyDict_SetItemString (d, "error", ErrorObject);
/* XXXX Add constants here */
/* Check for errors */
if (PyErr_Occurred ())
Py_FatalError ("can't initialize module xyplot");
return m;
}