NOTE:
This project is no longer being maintained: it was developed for my
masters thesis, which was completed in early 1997. I still, however,
welcome any questions or comments that people may have.
[Home]
[ToC]
[Prev]
[Next]
iHTML Python Language
Standard ihDoc Module
The ihDoc module provides a standard interface for document
programs, i.e. programs connected to an HTML document through an
<OBJECT>
tag that occurs in the document's
<HEAD>
. These programs will
typically be written as a subclass of this class, named
ihMain
.
Exported Values
There are no global values defined by this module.
Exported Exceptions
There are no global exceptions defined by this module.
Exported Functions
There are no global functions defined by this module.
Exported Types
There are no global types defined by this module.
Exported Classes
The Document
is the main
definition of the document program. It provides services for manipulating
and interacting with the global document environment, and base-line
functionality needed by all document programs. When a document program is
executed, its main entry point -- named ihMain
--
is expected to return an instance of a class that is a subclass of
Document
and implements the desired program logic.
Hierarchy
- Superclass
- none.
- Subclasses
- none.
Methods
-
__init__(self, ...)
-
- Summary
- Initialize class instance and
attach to the browser-side document.
- Arguments
- Argument dictionary must be passed.
- Result
- A new instance of the class.
- Bugs
-
The connection from the iHTML library to the user
document is not made until after this function
returns; this needs to be done during the
initialization itself.
Reformat
should not need to be called to display the document;
this seriously breaks progressive displays. Instead, we
should introduce a <CALL>
tag,
to insert dynamically constructed markup into the document,
and a document message that is send when the entire document
has been fetched and parsed.
- See Also
- Document tutorial.
- Description
- When a new
Document
instance is created, this initialization method
does the low-level setup required by the iHTML library.
While no arguments are
specifically defined by this class, the argument dictionary
handed to the ihMain
entry
must pass them up to this initialization function.
This is typically accomplished with a program structure such
as such as:
class ihMain(ihDoc.Document):
def __init__(self,**args):
apply(ihDoc.Document.__init__,(self,),args)
In all cases, this super-class initialization must be
performed before any other actions are taken.
-
Reformat(self)
-
- Summary
- Make the browser document re-examine and
display the current HTML parse tree.
- Arguments
- none.
- Result
- nothing.
- Bugs
- As of the 0.4 version of iHTML under Mosaic,
calling this function a second time with a changed display
will result in a crash.
- See Also
-
ihMarkup
module.
- Description
- This method will always be called at
least once -- it must be called during
__init__()
to display the initial
page to the user. Typically, the program will do whatever
initial construction of that page that needs to be done
before it is "presentable", and then this function is called
to display it.
-
ShowProgress(self, text)
-
- Summary
- Display progress report to user.
- Arguments
-
- text
- A
string
containing the text to display.
- Result
- nothing.
- Description
- Calling this function displays the given to
text to the user in the form of a progress report. This
should be used to, for example, tell the user that data is
being sent over the network. The exact way this information
is presented to the user is browser-dependent.
-
ShowLink(self, link)
-
- Summary
- Tell the user about a hyper-link.
- Arguments
-
- link
- A
string
of
text which should be displayed about the link.
- Result
- nothing.
- Description
- This displays to the user information about a
link that is "in focus" -- e.g., the cursor is positioned
over it. The exact way this information is presented to the
user is browser-dependent.
-
AddHandler(self, func)
-
- Summary
- Add an event handler to the document.
- Arguments
-
- func
- A function to call when processing
document events. It is called with two parameters:
this
Document
class, and the
Event
that occurred.
- Result
- nothing.
- Bugs
- The first argument handed to the function is
actually the library's low-level document object and not the
user's class.
- See Also
- Module ihEvent.
- Description
- This method adds a new function to the
Document
's handler list. This is a
list of functions that are called whenever a document-level
event occurs; each function in the list is successively
called until one of them returns a value that is something
besides None
.
All events sent to this handler are document-class events;
this includes such things as document resizing, scrolling,
etc. There will hopefully soon be a more complete set of
events, including keypresses, mouse movement, mouse buttons,
hyperlinks, etc.
-
RemHandler(self, func)
-
- Summary
- Remove the given function from the document's
list of handlers.
- Arguments
-
- func
- Function which was previously added
through
AddHandler()
- Result
- nothing.
- Bugs
- This function is currently not implemented.
Members
-
Capabilities
- A set of information about the capability of the
browser the program is running under. Retrieving an attribute
returns in integer representing that capability; 0 means the browser
doesn't have it and 1 means it does. Some capabilities define other
values. The currently defined capability attributes are:
-
forms
- Does this browser support HTML forms?
-
sockets
- Are socket connections supported?
-
comp_mosaic
- Does the browser support the basic Mosaic feature-set?
-
disp_text
- Does the browser support text display?
-
disp_graphics
- Does the browser support graphical display?
-
disp_mono
- Does the browser support monochrome graphics?
-
disp_color
- Does the browser support color graphics? The return value is
the number of pens supported.
-
disp_true
- Does the browser support a true-color display? The return
value is the bit depth per pixel.
-
VisHTMLTree
- The current HTML parse tree representing the
document.
-
ViewTop
- The top of the user's view within the entire
document, in pixels.
-
ViewBottom
- The bottom of the user's view within the entire
document, in pixels.
-
ViewLeft
- The left side of the user's view within the entire
document, in pixels.
-
ViewRight
- The right side of the user's view within the entire
document, in pixels.
-
ViewHeight
- The amount of the document visible to the user at any
one time, in pixels.
-
ViewWidth
- The amount of the document visible to the user at
any one time, in pixels
-
DocHeight
- The total height of the current document, in pixels.
-
DocWidth
- The total width of the current document, in pixels.
Description
Current problems:
- All of the document member variables are not connected to the
low-level document, and thus do not represent the current state of
the document. In the next release, they will probably change to
methods.
- Changing the view information (to, for example, scroll through the
document) is not yet supported
[Home]
[ToC]
[Prev]
[Next]
This web page and all material contained herein is
Copyright (c) 1997 Dianne Hackborn, unless otherwise noted. All rights
reserved.