diff --git a/PyGUI-2.5.3/CHANGES.txt b/PyGUI-2.5.3/CHANGES.txt
deleted file mode 100644
index 58afa79..0000000
--- a/PyGUI-2.5.3/CHANGES.txt
+++ /dev/null
@@ -1,874 +0,0 @@
-2.5.3
------
-
-Enhancements:
-
- - Cocoa: Reading and writing the clipboard is now implemented.
-
-Bug fixes:
-
- - Cocoa: Prevented spurious changes of input focus due to clicking
- on a view.
-
- - Cocoa: Put in fudge factor to correct text positioning when using
- Courier New.
-
- - Cocoa: Prevented burning 100% CPU time during a modal event loop.
-
- - Win32: Was unable to save a document over an existing file.
-
- - Win32: Reading an empty clipboard did not work.
-
-
-2.5.2
------
-
-Bug fixes:
-
- - Win32: When run from a command shell, application would exit when
- focus switched to another process.
-
-
-2.5.1
------
-
-Bug fixes:
-
- - The file distutils_extensions.py was missing from the distribution.
-
-
-2.5
----
-
-Modifications:
-
- - The old autoloading system has been removed and replaced with
- something that will hopefully be friendlier towards py2exe and
- py2app. There have been some minor changes to the API as a
- result:
-
- - Any class or function not explicitly documented as being in
- a submodule *MUST* now be imported directly from the GUI
- package, not from the submodule that it resides in.
-
- - Importing is mandatory. You must do either 'from GUI import
- Foo' or 'import GUI.Foo' for every class Foo that you use,
- not just 'import GUI' and then refer to GUI.Foo.
-
- - Some classes and functions that were previously available
- directly from the GUI package are now in submodules and must
- be imported from there:
-
- - All the alert functions are now in GUI.Alerts
- - All the file dialog functions are now in GUI.FileDialogs
- - FileType, FileRef and DirRef are now in GUI.Files
- - DefaultButton and CancelButton are now in GUI.StdButtons
-
- Note that for best results, PyGUI should be installed using
- 'python setup.py install' before using it with py2exe or py2app.
- These tools will not be able to automatically find submodules of
- a PyGUI that is used directly from the source directory.
-
- New features:
-
- - Improved facilities for customising menus when building a menu bar
- with StdMenus.basic_menus().
-
- - Functions for creating PyGUI Images from PIL images and numpy arrays.
-
- - Resource cacheing (see Resources.get_resource()).
-
- - ListButton control providing a pop-up or pull-down menu of choices.
-
- - GridView - a user-defined view consisting of a regular grid of cells.
-
- - PaletteView - a GridView specialised for implementing tool palettes.
-
- Enhancements:
-
- - Added get_default_save_directory() and get_default_save_filename()
- methods to Document, and get_default_open_directory() to Application.
-
- - Setting both 'content_size' and 'scrolling' using keyword args to
- the ScrollableView constructor now works as expected.
-
- - Padding may now be specified around the contents of a Row, Column
- or Grid.
-
- - ScrollableView now has a background_color property specifying a color
- to automatically fill areas outside the extent.
-
- Bug fixes:
-
- - Cocoa: Setting the border property of a TextField did not work.
-
- - Cocoa: Setting the content_size of a ScrollableView did not work.
-
- - Cocoa: Current point was not advanced correctly when drawing text.
-
- - Cocoa: Worked around a memory leak in PyObjC 2.3 affecting
- Canvas.lines() and related methods.
-
- - Gtk: Canvas.gsave()/grestore() did not work properly.
-
- - Gtk: 'style' argument to Window constructor was not handled properly.
-
- - Gtk, Windows: The mechanism for quitting the application when there are
- no visible windows left has been made more reliable.
-
- - Windows: Application was not initially brought to the foreground when
- launched.
-
- - Windows: Initial filename argument to request_new_file did not work.
-
- - Setting the save_file_type property of an Application did not work.
-
- - Relative filenames passed as command line arguments caused problems.
-
- - Setting content_width and content_height properties did not work properly.
-
- - NumPy arrays did not work as parameters to Canvas methods taking
- sequences of points.
-
-
-2.4.1
------
-
-Enhancements:
-
- - On MacOSX, the unmodified character corresponding to a key event
- with Option pressed is now put into the 'key' attribute. On all
- platforms, 'key' now mirrors 'char' if there is no other particular
- value for it to have.
-
- - Key events now have a 'unichars' attribute on all platforms.
-
- - Return key on main keyboard now sets 'key' to 'return' instead of
- an empty string.
-
-
-2.4
----
-
-Enhancements:
-
- - Classifiers for PyPi upload added to setup.py. [Vernon Cole]
-
- - Automatically detect Python 3 and convert syntax while installing.
- [Vernon Cole]
-
- - Code modifications for Python 3 compatibility. All tests now pass
- using Python 3.1 on MacOSX and Windows.
-
-
-Bug fixes:
-
- - Win32: Invoking the last command in the last menu in the menu bar
- with the mouse did not work.
-
- - Win32: ScrollableView re-implemented without using the MFC View class.
- This eliminates several problems that were plaguing the old implementation.
-
- - Win32: Font sizes were too small when using some pywin32 builds.
-
-
-2.3.3
------
-
-Bug fixes:
-
- - Previous fix for Pixmap coordinates in Cocoa did not work on
- some MacOSX versions.
-
-
-2.3.2
------
-
-Bug fixes:
-
- - Canvas docs incorrectly stated that the current path was cleared after
- filling or stroking.
-
- - Cocoa: Coordinate system for drawing in a Pixmap was upside down.
-
-
-2.3.1
------
-
-Bug fixes:
-
- - Win32: Fixed a bug in the previous ScrollableView fix.
-
- - Win32: If a modal dialog was dismissed by pressing the Enter key,
- the subsequent key-up event could spuriously trigger a button
- in another window.
-
-
-2.3
----
-
-Enhancements:
-
- - GLView selects modelview matrix and sets it to identity before
- calling render().
-
- - Added init_projection() method to GLView, called from default
- implementation of viewport_changed() with projection matrix
- selected and set to identity.
-
- - Texture.gl_id() method returns the texture ID for the current
- context without binding it.
-
- - Texture.gl_tex_image_2D() method loads texture data from an Image.
-
- - Updated to work on Snow Leopard with PyObjC 2.3.
-
-
-Bug fixes:
-
- - Filename case error in setup.py causing cursor resources not to
- be installed.
-
- - Crash on closing a window containing a GLView due to attempting
- to call glViewport for an invalid GL context.
-
- - Fixed some problems with Images and Pixmaps in Cocoa.
-
- - Win32: Fixed crash concerning ScrollableView with pywin32 build
- 213 and later.
-
-
-2.2
----
-
-New features:
-
- - TextEditor component with scroll bars and uniform tab stops
- for editing large amounts of text.
-
- - Row, Column and Grid layout classes.
-
- - Printing support.
-
-
-Enhancements:
-
- - Component add() and remove() methods now accept a sequence of
- items as well as a single item.
-
- - All Controls now uniformly have a 'value' property.
-
- - RadioGroup add() and remove() methods replaced with add_item(),
- remove_item(), add_items() and remove_items() to avoid name clash
- when mixing a RadioGroup with a Component.
-
-Bug fixes:
-
- - Unicode strings as menu item titles did not work properly.
-
- - Win32: Misnamed function in GDI+ interface (GdipAddPathLine2).
-
-
-2.1.1
------
-
-Enhancements:
-
- - CheckBox now has a 'mixed' property that can be changed
- after creation.
-
-Bug fixes:
-
- - Cocoa: Text fields had the wrong border style.
-
- - Gtk: Window show/hide was broken in 2.1.
-
- - Windows: File dialogs did not set initial directory properly.
-
-
-2.1
----
-
-Enhancements:
-
- - All menus can now be removed by assigning an empty list to
- the menus property of the application.
-
- - Cocoa: Hide, Hide Others and Show All now enabled in the
- application menu.
-
- - Win32: Added more standard cursors.
-
-Bug fixes:
-
- - Gtk: Removed spurious 'self' in TextField.set_selection().
-
- - Win32: Can run PyGUI apps using pythonw now.
-
- - Win32: Fixed coordinate transformation problems in ScrollableView.
-
-
-2.0.7
------
-
-Bug fixes:
-
- - Cocoa: Canvas.lines and Canvas.poly did not work.
-
-
-2.0.6
------
-
-Enhancements:
-
- - Cocoa: Redesigned handling of standard editing commands for
- builtin components to make them overridable and to cooperate
- better with custom components.
-
-
-2.0.5
------
-
-Bug fixes:
-
- - Win32: Removed experimental mouse leave event handling that
- was causing problems on some systems.
-
- - Win32: Trying native backend before gtk in case gtk is
- installed.
-
- - Cocoa: Custom view objects could not be targeted.
-
- - Cocoa: Canvas.rect() did not work.
-
- - Gtk: Mouse move events were being reported as mouse drags.
-
-Enhancements:
-
- - Win32: hand and fist cursors improved.
-
- - Added selection_forecolor and selection_backcolor to the
- StdColors submodule.
-
-API changes:
-
- - Removed mouse_enter and mouse_leave events from the official
- API for the time being, since they are not easy to implement
- consistently across all platforms.
-
-
-2.0.4
------
-
-Bug fixes:
-
- - BlobEdit demo: Reduced flickering on Windows.
-
- - Win32: Full menu list of a window sometimes not updated
- properly, leading to '_all_menus' attribute error.
-
- - Win32: Disabled customization of Control colour for now,
- since it doesn't seem to work properly on XP.
-
- - Win32: Tab key with no control focused did not tab to the
- first control.
-
- - Win32: Return/Enter now activates a focused control as
- well as space.
-
- - Win32: Error in printed instructions for test 29.
-
- - Win32: Changed the way window background colour is handled
- to prevent flickering when resizing.
-
- - Win32: Fixed problem with 'pitch_and_family' when creating
- a font.
-
- - Canvas was missing fill_frame_rect() on some platforms.
-
- - Canvas.frame_rect() was not starting a new path on some
- platforms.
-
- - Pressing Tab in a window with no subcomponents caused crash.
-
-
-2.0.3
------
-
-Bug fixes:
-
- - BlobEdit demo:
- - clear background before drawing.
- - Win32 - attribute error on startup.
-
-
-
-2.0.2
------
-
-Bug fixes:
-
- - Fixed problem on Windows resulting in "This module should
- not be imported" error.
-
- - Cocoa: Canvas was using fillcolor instead of textcolor
- for drawing text.
-
-
-2.0.1
------
-
-Bug fixes:
-
- - Fixed problems in setup.py affecting installation on
- Linux and Windows.
-
-2.0
----
-
-API changes:
-
- - The 'extent' property of ScrollableView is now just a size
- rather than a rectangle.
-
- - By default, containers now re-layout their contents when their
- size changes for any reason, not just when the user resizes the
- window. There is a new property auto_layout controlling this
- behaviour. Conversely, the default behaviour of the resize()
- method is now *not* to re-layout the contents, with an option
- to do so.
-
-New features:
-
- - Major additions made to the Canvas class. Full set of Postscript
- style path construction operators now implemented on all platforms,
- and a wide variety of new high-level functions have been added.
-
- - Added a keeps_document_open attribute to Window to allow for
- windows that do not keep their associated document open.
-
- - Added 'fullscreen' window style.
-
- - Added 'invisible' cursor to StdCursors.
-
- - Added delta attribute to mouse_move and mouse_drag events
- (currently MacOSX only).
-
- - Added leading, cap_height, x_height properties to Font.
-
- - Added enter-key and escape-key actions to TextField.
-
-Enhancements:
-
- - Mouse and keyboard event handling can now be overridden for
- all component classes, not just user-defined views.
-
- - Cocoa: Change dot is set in window title bar when the
- window's associated document needs saving.
-
- - When saving a document, data is written to a temporary file
- which is then renamed, to avoid destroying the original file
- if the write fails.
-
- - Container.shrink_wrap() will figure out a reasonable padding if
- you don't specify one.
-
- - Setup script only installs relevant backend for platform.
-
-Modifications:
-
- - Renamed 'tabbable' property to 'tab_stop'. Provided a mechanism
- for the user to express a preferences as to whether non-textfield
- controls are tabbed into, defaulting to platform conventions.
-
- - Canvas now has separate pen, fill and text colour properties. The
- 'forecolor' property is write-only and sets all three to the same
- colour. Erasing operations replace image with background colour,
- other operations blend.
-
-Bug fixes:
-
- - Cocoa: Default and cancel buttons in dialogs were being
- activated twice when Enter or Escape pressed.
-
- - Crash occurred when closing a Window that was not attached
- to a Document.
-
- - Exceptions.InternalError had nonexistent base class.
-
-
-1.7.3
------
-
-Enhancements:
-
- - Cocoa: Tasks continue to run while menus and controls are
- being manipulated.
-
- - Cocoa: Using more reliable method of handling command line
- arguments in non-py2app environments. Should address
- problems with IDLE.
-
-
-1.7.2
------
-
-New features:
-
- - New events and event handling facilities:
-
- - Support for multiple mouse buttons. The mouse_down and
- mouse_up events now have a 'button' attribute.
-
- - Views can define methods to handle mouse_drag and mouse_up
- events as an alternative to using track_mouse().
-
- - New mouse events: mouse_enter, mouse_leave.
-
- See "Mouse Events" under the "Event Handling" topic for a
- discussion of the new event features.
-
- - Improved alignment of different control types when they
- are laid out by place_row().
-
- - New file dialog functions for requesting multiple files
- and requesting old and new directories.
-
- - New Application properties: open_file_types, save_file_type,
- file_type
-
-Enhancements:
-
- - Changed Gtk implementation of file dialogs to use newer
- widgets, and implemented file type filtering.
-
- - Tidied up the APIs of FileRef and DirRef, and made them
- immutable.
-
- - Cocoa: Slider in discrete mode now only calls action when
- the value changes, instead of whenever the mouse is dragged.
-
- - Cocoa: Undo and Redo supported in TextFields.
-
- - Cocoa: File open requests sent to a running application
- from the Finder are handled.
-
- - Cocoa: Expanded BlobEdit example to demonstrate
- - resource handling
- - building an application using py2app, with file and
- application icons and launching from the Finder by
- opening an associated file.
-
-API changes:
-
- - Application.make_new_document() and make_file_document()
- abstract methods collapsed into a single make_document()
- method.
-
- - You should no longer call new_cmd() from your application's
- __init__. Instead, do this in your implementation of
- Application.open_app() if needed.
-
-Bug fixes:
-
- - Frames did not work.
-
- - Error in the installation instructions in the README file
- corrected.
-
- - Cocoa: Attempting to create a Font with an unsupported
- combination of attributes now results in fallback to the
- application font instead of a crash.
-
- - Cocoa, Gtk: Canvas.xxx_arc() methods did not work.
-
- - Gtk: Stroking an unclosed path did not work.
-
- - Cocoa: Return/Enter in single-line text field was not
- propagated to containing components.
-
- - Setup.py did not install the standard cursor resources.
-
- - Documentation of alert functions adjusted (caution_alert
- removed, stop_alert added).
-
- - Cocoa: Drawing text with a foreground colour other than
- black did not work.
-
- - Gtk: Fixed glitches in selection handling when switching
- focus between TextFields.
-
- - Gtk: Text can no longer be copied out of a password
- entry field.
-
- - Cocoa: Edit menu commands did not work in a Cocoa-defined
- dialog (e.g. save file dialog).
-
- - Cocoa: Custom cursor of a ScrollableView now appears only in
- the content area, instead of over the scroll bars as well.
-
- - Cocoa: Update the window change dot when document need saving.
-
-
-1.7.1
------
-
-New features:
-
- - Slider control.
-
- - run() convenience function, equivalent to application().run().
-
- - Geometry.rects_intersect() function.
-
-Enhancements:
-
- - Files given on the command line will be opened when run() is
- called.
-
- - BlobEdit example application now demonstrates use of the
- update_rect parameter to View.draw().
-
-Bug fixes:
-
- - Disabled a debugging statement that was inadvertently left on
- in Cursor.__init__.
-
- - Changed the package name in setup.py to something more meaningful
- than 'foo'.
-
-
-1.7
----
-
-New features:
-
- - OpenGL: DisplayList class for managing display lists,
- analogous to the Texture class.
-
- - Cursor class and 'cursor' property of Views.
-
- - Facilities for locating resource files associated with the
- application.
-
-Modifications:
-
- - Cocoa: More informative error message produced when an application
- is run with python instead of pythonw.
-
- - Cocoa: View.track_mouse() now allows Tasks to run while the mouse is
- being tracked.
-
- - Cocoa: Exceptions occurring during the firing of a Task are propagated
- to the main event loop for handling.
-
- - Documentation added for class Task.
-
- - OpenGL: API for context sharing has been changed. Instead of passing one
- GLView or GLPixmap as the 'share' argument to the constructor of another,
- there is now a class GL.ShareGroup which is passed to a GLView or GLPixmap
- constructor as 'share_group'.
-
- - GL.Texture instances now deallocate associated OpenGL resources
- when they are no longer referenced.
-
- - The 'binary' attribute of class Document now defaults to true. If false,
- the document's file is opened for reading in universal newlines mode.
-
- - Cocoa: Setting the Macintosh creator and type code of a file using a
- FileRef and FileType is now implemented.
-
- - RadioGroups are now iterable, so they can be used directly in the
- place_row() and place_column() methods of a Container.
-
-Bug fixes:
-
- - Cocoa: Getting the extent property of a ScrollableView did not work.
-
- - Cocoa: Worked around a PyObjC bug that was causing Tasks to leak memory.
-
- - Cocoa: Request New File dialog with a file type having a Macintosh
- type code did not work.
-
-1.6.1
------
-
-Bug fixes:
-
- - Mouse down event in a GLView caused a crash.
-
- - Canvas methods fill_poly() and stroke_poly() didn't work. Added
- a test for these.
-
-
-1.6
----
-
-Implementation changes:
-
- - The Macintosh implementation has been completely rewritten to
- use Cocoa instead of Carbon. The Carbon version is no longer
- supported.
-
-API changes:
-
- There are some backward-incompatible changes to the API in this
- version. Apologies if this causes inconvenience, but I feel it's
- important to get the API right while there's still a chance.
-
- - A ScrollableView class has been introduced which encapsulates all
- details of scrolling. The View class is no longer scrollable.
- The ScrollFrame class has been removed.
-
- - View.draw() is now passed a second parameter indicating the
- rectangle needing to be drawn.
-
- - Canvas.frame_arc() and Canvas.fill_arc() only support circular
- arcs, and take a centre and radius instead of a rectangle.
-
- - Menu constructor now takes a single parameter containing a list
- of item descriptors, instead of taking each descriptor as a
- separate argument.
-
- - The Application.std_menu_bar property has been removed. Use the new
- StdMenus.basic_menus() function instead.
-
- - The visible property and the show() and hide() methods are now
- only defined for Windows, not Components in general.
-
-Behaviour changes:
-
- - ModalDialog.dismiss() also hides the dialog.
-
- - Setting TextField.selection also makes the text field the target.
-
- - TextField.select_all() also makes the text field the target.
-
-New features:
-
- - FileType class for platform-specific file type metadata
-
- - Window.auto_position property
-
- - Alpha channel support added to API (not fully implemented
- on all platforms yet).
-
- - New Canvas methods: stroke_rect(), stroke_arc(), stroke_oval(),
- stroke_poly()
-
- - New OpenGL-related classes: GLConfig, GLPixmap, Texture
-
- - Key names for function keys added
-
- - Frame class (general-purpose plain vanilla Container)
-
- - Enhanced facilities for creating and modifying menus (still under
- development):
-
- - StdMenus module to hold stuff related to standard menus
-
- - MenuList class with facilities for finding menus by command
-
- - Menu class can have items added to it after construction
-
- See the new doc section "Customising the Standard Menu Bar" for
- more information.
-
- - The BlobEdit example application has been improved. You can now
- get rid of unwanted blobs by shift-clicking on them.
-
-
-1.5.3 (not released)
------
-
-Bug fixes:
-
- - Modal dialogs can now be dismissed with None as the return value.
-
- - Mouse events in a GLView were being reported in the coordinate
- system of the view's container rather than the view itself.
-
- - Menu items were not being disabled and unchecked before menu
- setup.
-
- - The list of objects observing a Model is now kept outside of
- the model object, to make pickling of models easier.
-
- - Mac: Shift & option menu command key modifiers did not work.
-
- - Mac: Setting the width or height of a view's extent to zero caused a
- crash when calculating scroll bar values.
-
- - Mac: Reading the font property of a Canvas did not work.
-
- - Mac: Setting the selection of a TextField did not work.
-
- - Mac: Font, colour and justification settings of controls interacted
- in strange ways.
-
-Enhancements:
-
- - update() method added to View and GLView for immediate redrawing.
-
- - ModalDialog.dismiss() now hides the dialog.
-
-
-1.5.2 (not released)
------
-
-Modifications:
-
- - GLView.with_context() now returns the return value of the supplied
- function.
-
- - Application.quit_cmd() now destroys all windows before exiting
- the event loop (previously only those belonging to a document
- were destroyed).
-
-
-1.5.1
------
-
-Bug fixes:
-
- - Menu item groups did not work.
-
- - Mac: Labels were not updated properly on changing the text property.
-
- - Mac: Setup script failed when Pyrex was not available.
-
-New examples:
-
- - Tests/08-menu.py now includes an example of using a menu item group.
-
-1.5
----
-
-New features:
-
- - OpenGL view component added.
-
-
-1.4
----
-
-New features:
-
- - Image class for loading and drawing RGB images.
-
- - Pixmap class for offscreen drawing.
-
- - Containers now have a shrink_wrap() method to facilitate
- bottom-up component layout strategies. See class Frame.
-
-Bug fixes:
-
- - Access to 'text' property of TextField in password mode didn't work.
-
- - TextField not refreshed properly when 'text' property changed.
-
- - Distutils script did not install subdirectories of the GUI package.
-
-API changes:
-
- - 'password' property of TextField is now initialize-only.
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/.gdb_history b/PyGUI-2.5.3/Demos/BlobEdit/.gdb_history
deleted file mode 100644
index e0f364f..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/.gdb_history
+++ /dev/null
@@ -1,3 +0,0 @@
-run dist/blobedit.app/Contents/MacOS/blobedit
-where
-q
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Makefile b/PyGUI-2.5.3/Demos/BlobEdit/Makefile
deleted file mode 100644
index 3f533fc..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-app:
- python setup.py py2app
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob.tiff b/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob.tiff
deleted file mode 100644
index 2321c7d..0000000
Binary files a/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob_app.icns b/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob_app.icns
deleted file mode 100644
index d183c57..0000000
Binary files a/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob_app.icns and /dev/null differ
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob_file.icns b/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob_file.icns
deleted file mode 100644
index 7436015..0000000
Binary files a/PyGUI-2.5.3/Demos/BlobEdit/Resources/blob_file.icns and /dev/null differ
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Samples/asdf.blob b/PyGUI-2.5.3/Demos/BlobEdit/Samples/asdf.blob
deleted file mode 100644
index 1d01606..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/Samples/asdf.blob
+++ /dev/null
@@ -1,73 +0,0 @@
-(lp0
-(i__main__
-Blob
-p1
-(dp2
-S'rect'
-p3
-(F40.0
-F16.0
-F80.0
-F56.0
-tp4
-sba(i__main__
-Blob
-p5
-(dp6
-g3
-(F77.0
-F89.0
-F117.0
-F129.0
-tp7
-sba(i__main__
-Blob
-p8
-(dp9
-g3
-(F182.0
-F53.0
-F222.0
-F93.0
-tp10
-sba(i__main__
-Blob
-p11
-(dp12
-g3
-(F98.0
-F206.0
-F138.0
-F246.0
-tp13
-sba(i__main__
-Blob
-p14
-(dp15
-g3
-(F200.0
-F147.0
-F240.0
-F187.0
-tp16
-sba(i__main__
-Blob
-p17
-(dp18
-g3
-(F219.0
-F251.0
-F259.0
-F291.0
-tp19
-sba(i__main__
-Blob
-p20
-(dp21
-g3
-(F310.0
-F194.0
-F350.0
-F234.0
-tp22
-sba.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Samples/frown.blob b/PyGUI-2.5.3/Demos/BlobEdit/Samples/frown.blob
deleted file mode 100644
index 47705f8..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/Samples/frown.blob
+++ /dev/null
@@ -1,73 +0,0 @@
-(lp0
-(i__main__
-Blob
-p1
-(dp2
-S'rect'
-p3
-(I55
-I71
-I95
-I111
-tp4
-sba(i__main__
-Blob
-p5
-(dp6
-g3
-(I245
-I71
-I285
-I111
-tp7
-sba(i__main__
-Blob
-p8
-(dp9
-g3
-(F150.0
-F181.0
-F190.0
-F221.0
-tp10
-sba(i__main__
-Blob
-p11
-(dp12
-g3
-(F119.0
-F198.0
-F159.0
-F238.0
-tp13
-sba(i__main__
-Blob
-p14
-(dp15
-g3
-(F189.0
-F202.0
-F229.0
-F242.0
-tp16
-sba(i__main__
-Blob
-p17
-(dp18
-g3
-(I230
-I225
-I270
-I265
-tp19
-sba(i__main__
-Blob
-p20
-(dp21
-g3
-(I73
-I224
-I113
-I264
-tp22
-sba.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Samples/line.blob b/PyGUI-2.5.3/Demos/BlobEdit/Samples/line.blob
deleted file mode 100644
index fbd0df5..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/Samples/line.blob
+++ /dev/null
@@ -1,73 +0,0 @@
-(lp0
-(i__main__
-Blob
-p1
-(dp2
-S'rect'
-p3
-(F239.0
-F101.0
-F279.0
-F141.0
-tp4
-sba(i__main__
-Blob
-p5
-(dp6
-g3
-(F171.0
-F45.0
-F211.0
-F85.0
-tp7
-sba(i__main__
-Blob
-p8
-(dp9
-g3
-(F193.0
-F58.0
-F233.0
-F98.0
-tp10
-sba(i__main__
-Blob
-p11
-(dp12
-g3
-(F216.0
-F78.0
-F256.0
-F118.0
-tp13
-sba(i__main__
-Blob
-p14
-(dp15
-g3
-(F259.0
-F123.0
-F299.0
-F163.0
-tp16
-sba(i__main__
-Blob
-p17
-(dp18
-g3
-(F282.0
-F151.0
-F322.0
-F191.0
-tp19
-sba(i__main__
-Blob
-p20
-(dp21
-g3
-(F307.0
-F176.0
-F347.0
-F216.0
-tp22
-sba.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/Samples/smile.blob b/PyGUI-2.5.3/Demos/BlobEdit/Samples/smile.blob
deleted file mode 100644
index 96ce86d..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/Samples/smile.blob
+++ /dev/null
@@ -1,73 +0,0 @@
-(lp0
-(i__main__
-Blob
-p1
-(dp2
-S'rect'
-p3
-(I55
-I71
-I95
-I111
-tp4
-sba(i__main__
-Blob
-p5
-(dp6
-g3
-(I245
-I71
-I285
-I111
-tp7
-sba(i__main__
-Blob
-p8
-(dp9
-g3
-(I153
-I272
-I193
-I312
-tp10
-sba(i__main__
-Blob
-p11
-(dp12
-g3
-(I107
-I258
-I147
-I298
-tp13
-sba(i__main__
-Blob
-p14
-(dp15
-g3
-(I194
-I257
-I234
-I297
-tp16
-sba(i__main__
-Blob
-p17
-(dp18
-g3
-(I230
-I225
-I270
-I265
-tp19
-sba(i__main__
-Blob
-p20
-(dp21
-g3
-(I73
-I224
-I113
-I264
-tp22
-sba.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/blobedit.py b/PyGUI-2.5.3/Demos/BlobEdit/blobedit.py
deleted file mode 100644
index f082346..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/blobedit.py
+++ /dev/null
@@ -1,132 +0,0 @@
-#
-# BlobEdit - A totally silly application for showing
-# ======== off the GUI framework and providing an example
-# of its use.
-#
-# Blobs are red squares that you place on a Blob Document
-# by clicking and move around by dragging. You can save
-# your blob arrangement in a file and load it back later
-# to impress your friends (or send them away screaming).
-#
-# News flash: Got a blob you don't want? Now you can
-# get rid of it by shift-clicking it! Isn't that useful!
-#
-
-import pickle
-from GUI import Application, ScrollableView, Document, Window, Cursor, rgb
-from GUI.Files import FileType
-from GUI.Geometry import pt_in_rect, offset_rect, rects_intersect
-from GUI.StdColors import black, red
-
-
-class BlobApp(Application):
-
- def __init__(self):
- Application.__init__(self)
- self.blob_type = FileType(name = "Blob Document", suffix = "blob",
- #mac_creator = "BLBE", mac_type = "BLOB", # These are optional
- )
- self.file_type = self.blob_type
- self.blob_cursor = Cursor("blob.tiff")
-
- def open_app(self):
- self.new_cmd()
-
- def make_document(self, fileref):
- return BlobDoc(file_type = self.blob_type)
-
- def make_window(self, document):
- win = Window(size = (400, 400), document = document)
- view = BlobView(model = document, extent = (1000, 1000), scrolling = 'hv',
- cursor = self.blob_cursor)
- win.place(view, left = 0, top = 0, right = 0, bottom = 0, sticky = 'nsew')
- win.show()
-
-
-class BlobView(ScrollableView):
-
- def draw(self, canvas, update_rect):
- canvas.erase_rect(update_rect)
- canvas.fillcolor = red
- canvas.pencolor = black
- for blob in self.model.blobs:
- if blob.intersects(update_rect):
- blob.draw(canvas)
-
- def mouse_down(self, event):
- x, y = event.position
- blob = self.model.find_blob(x, y)
- if blob:
- if not event.shift:
- self.drag_blob(blob, x, y)
- else:
- self.model.delete_blob(blob)
- else:
- self.model.add_blob(Blob(x, y))
-
- def drag_blob(self, blob, x0, y0):
- for event in self.track_mouse():
- x, y = event.position
- self.model.move_blob(blob, x - x0, y - y0)
- x0 = x
- y0 = y
-
- def blob_changed(self, model, blob):
- self.invalidate_rect((0,0,self.extent[0],self.extent[1]))
-
-
-class BlobDoc(Document):
-
- blobs = None
-
- def new_contents(self):
- self.blobs = []
-
- def read_contents(self, file):
- self.blobs = pickle.load(file)
-
- def write_contents(self, file):
- pickle.dump(self.blobs, file)
-
- def add_blob(self, blob):
- self.blobs.append(blob)
- self.changed()
- self.notify_views('blob_changed', blob)
-
- def find_blob(self, x, y):
- for blob in self.blobs:
- if blob.contains(x, y):
- return blob
- return None
-
- def move_blob(self, blob, dx, dy):
- self.notify_views('blob_changed', blob)
- blob.move(dx, dy)
- self.changed()
- self.notify_views('blob_changed', blob)
-
- def delete_blob(self, blob):
- self.notify_views('blob_changed', blob)
- self.blobs.remove(blob)
- self.changed()
-
-
-class Blob:
-
- def __init__(self, x, y):
- self.rect = (x - 20, y - 20, x + 20, y + 20)
-
- def contains(self, x, y):
- return pt_in_rect((x, y), self.rect)
-
- def intersects(self, rect):
- return rects_intersect(rect, self.rect)
-
- def move(self, dx, dy):
- self.rect = offset_rect(self.rect, (dx, dy))
-
- def draw(self, canvas):
- canvas.fill_frame_rect(self.rect)
-
-
-BlobApp().run()
diff --git a/PyGUI-2.5.3/Demos/BlobEdit/setup.py b/PyGUI-2.5.3/Demos/BlobEdit/setup.py
deleted file mode 100644
index b141dc6..0000000
--- a/PyGUI-2.5.3/Demos/BlobEdit/setup.py
+++ /dev/null
@@ -1,31 +0,0 @@
-import sys
-print sys.path
-
-from distutils.core import setup
-import py2app
-
-setup(
- app=['blobedit.py'],
- data_files=[
- 'Resources/blob.tiff',
- 'Resources/blob_file.icns',
- 'Resources/blob_app.icns'
- ],
- options = dict(
- py2app = dict(
- #includes = ['objc', 'Foundation', 'AppKit'],
- #packages = ['GUI'],
- plist = dict(
- #CFBundleSignature = "BLBE", # If you are using mac_creator
- CFBundleIconFile = "blob_app",
- CFBundleDocumentTypes = [
- dict(CFBundleTypeName = "BlobEdit Document",
- CFBundleTypeRole = "Editor",
- #CFBundleTypeOSTypes = ["BLOB"], # If you are using mac_type
- CFBundleTypeExtensions = ["blob"],
- CFBundleTypeIconFile = "blob_file",
- )]
- ),
- ),
- )
-)
diff --git a/PyGUI-2.5.3/Demos/NagBox/nag_box.py b/PyGUI-2.5.3/Demos/NagBox/nag_box.py
deleted file mode 100644
index dbb71ed..0000000
--- a/PyGUI-2.5.3/Demos/NagBox/nag_box.py
+++ /dev/null
@@ -1,22 +0,0 @@
-from GUI import ModalDialog, Label, Button, Task, application
-
-class NagBox(ModalDialog):
-
- def __init__(self, text, timeout):
- ModalDialog.__init__(self)
- label = Label(text)
- self.ok_button = Button("OK", action = "ok", enabled = False)
- self.place(label, left = 20, top = 20)
- self.place(self.ok_button, top = label + 20, right = label.right)
- self.shrink_wrap(padding = (20, 20))
- self.timer = Task(self.enable_button, timeout)
-
- def enable_button(self):
- self.ok_button.enabled = True
-
- def ok(self):
- self.dismiss(True)
-
-
-dlog = NagBox("Consider yourself nagged.", 10)
-dlog.present()
diff --git a/PyGUI-2.5.3/Doc/Application.html b/PyGUI-2.5.3/Doc/Application.html
deleted file mode 100644
index 82630ad..0000000
--- a/PyGUI-2.5.3/Doc/Application.html
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
Application
-
-
-
-class Application(MessageHandler)
-Each application has exactly one Application object, which
-looks after application-wide concerns such as maintaining the set of
-windows and documents, running the event loop, and handling global menu
-commands.
-Global Functions
-
-- application()
-- Returns the Application instance. The first time an
-instance of Application or a subclass of Application is created, a
-global reference to it is stored; the application
-function returns this reference.
-
-- If this function is called before any application object
-has been created, it creates an instance of class Application
-automatically.
-
-Constructor
-
-- Application(title =
-None)
-- Creates and initializes an Application. The title must be
-specified as a keyword argument; it
-defaults to the name of the main Python file, or in the case of a
-MacOSX application built with Py2App, it is taken from the info.plist
-resource.
-
-Properties
-
-
-- menus
-- List of application-wide Menu instances. These menus will
-always be
-available regardless of which window is active.
-
-
-- Do not modify the contents of this list
-directly. If you want to add or remove menus, build a new
-list of menus and assign the whole
-list to the menus property. Otherwise, the
-displayed menus may
-not be updated properly.
-
-
-- windows
-- Read only. List of all currently
-existing Window instances.
-Do not modify this list.
-
-
-
-- documents
-- Read only. List of all currently
-existing Document instances. Do not modify this list.
-
-
-- open_file_types
-- A list of FileTypes
-specifying the types of files that can be opened by the Open...
-command. If empty, any type of file is acceptable. You only need to set
-this if you want to make use of the default implementation of the Open... command.
-
-
-- save_file_type
-- A FileType
-specifying the default file type for Documents that don't specify one
-of their own. You only need to set
-this if you want to make use of the default implementations of the Save and Save As... commands,
-and you don't explicitly set the file_type
-property of all your Documents.
-
-
-- file_type
-- Write only.
-This is a convenience property for applications that only deal with one
-type of file. Setting it to a FileType f is the same as
-setting open_file_types
-to [f] and save_file_type
-to f.
-
-
-- target
-- Read-only.
-The object which is the current target of keyboard events and menu
-commands. This will be a Component contained within the frontmost
-window, the frontmost window itself, or if there are no windows, the
-Application itself.
-
-
-- target_window
-- Read-only.
-The Window containing the current target of keyboard
-events and menu commands, or None if there are no windows.
-
-
-
-
-Attributes
- page_setup
- A default application-wide PageSetup instance that is edited by the generic implementation of the Page Setup command and used by default implementations of the Print command.
Methods
-
-
-- run()
-- The main event loop. A program calls this method after
-initialisation, and it retains control until the application is quit.
-Catches any unhandled exceptions and reports them to the user via report_exception().
-
-The normal method of quitting the application is to call quit_cmd().
-This gives the user the opportunity to close any open documents and
-save any unsaved changes. If this is undesirable for some reason, a
-more direct exit can be achieved using _quit().
-
-
-
-- event_loop()
-- Runs an event loop, fetching and handling input events
-until exit_event_loop()
-is called.
-
-If a Cancel
-exception is raised during the event loop, it is silently caught and
-the event loop continues. The handling of an exception of any other
-type is platform-dependent; it may break the event loop and be
-propagated, or it may be handled within the loop using report_exception().
-- exit_event_loop()
-- Causes the current call to event_loop() to
-exit.
-
-
-- report_exception()
-- Displays an alert box reporting the current exception (as
-determined by sys.exc_info())
-and giving the user the option of continuing, getting a traceback or
-exiting the application.
-
-
-
-
-- new_cmd()
-- Implements the standard New command.
-Calls make_document to create a new document,
-initialises it as an empty document, and calls make_window
-to create an initial window for it.
-
-
-- open_cmd()
-- Implements the standard Open...
-command. Requests a file name from the user, calls make_document
-to create a document, loads the document from the file, and calls make_window
-to create an initial window for it.
-
-
-- quit_cmd()
-- Implements the standard Quit command.
-Asks the user whether to save changes to any changed documents, and if
-the user doesn't cancel, raises a Quit exception.
- page_setup_cmd()
- Default implementation of the Page Setup... command. Edits the PageSetup instance referred to by the page_setup attribute.
-
-
-- query_clipboard()
-- Returns true if the clipboard contains any data. This is
-likely to
-be more efficient than testing the result of get_clipboard().
-
-
-- get_clipboard()
-- Returns the current contents of the clipboard as a
-string, or an
-empty string if the clipboard contains no data.
-
-
-
-
-
-- set_clipboard(data)
-- Replaces the contents of the clipboard with the given
-data, which
-should be a string.
-
-
-
- - _quit()
- Exits the main event loop immediately, without giving any option to save changes. For emergency use only.
-Abstract Methods
-
-
-- open_app()
-- This
-method is called when the application is started without any
-command-line arguments. The default implementation does nothing. In a
-document-based application, you will typically override it to call the new_cmd()
-method to create a new, empty document.
-
-
-
-- make_document(file_ref or None)
-- If you want to use the built-in support for the New or Open...
-commands, you need to implement this method.
-
-If the file_ref
-argument is None, you should create a new Document object of the
-appropriate class in response to a New command.
-
-Otherwise, should
-create a new Document object of the appropriate class for
-the file represented by the given FileRef.
-You may
-examine the file name, read the beginning of the file or do whatever
-else
-is necessary to determine what class of object to create. If you can't
-recognise the file, you should return None, and an appropriate error
-message will be displayed. The default implementation returns None.
-
-
-
-- make_window(document)
-- If you want to use the built-in support for the New and Open...
-commands, you need to implement this method. Your
-implementation
-should create a Window containing a component hierarchy suitable
-for viewing the given Document object. There is no default
-implementation.
- get_default_open_directory()
- Called by the default implementation of open_cmd() to find an initial directory for request_old_file(). Should return a DirRef or FileRef, or None if there is no preferred location.
The default implementation returns the last directory in which a document was opened or saved during this session.
-
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Button.html b/PyGUI-2.5.3/Doc/Button.html
deleted file mode 100644
index 0468770..0000000
--- a/PyGUI-2.5.3/Doc/Button.html
+++ /dev/null
@@ -1,49 +0,0 @@
-
-PyGUI - class Button
-
-
-
-
-A Button is a momentary-action pushbutton, invoking an action
-when it is
-clicked.
-
-Constructors
-
-- Button(title)
-
-Creates a generic pushbutton with the given title.
-
-
Properties
-
-- title
-- Title string to display inside the button.
-
-
-- style
-- One of 'normal', 'default'
-or 'cancel'. Setting this to 'default'
-or 'cancel causes the button to take on the
-appearance of a default button or a cancel button respectively,
-according to platform conventions. (This property only affects the
-appearance
-of the button, it does not automatically make the button
-respond to
-keyboard commands.)
-
-Action Properties
-
-- action
-- Action to perform when the button is clicked. See Actions.
-
-Methods
-
-
-- activate()
-- Animates a simulation of the button being pressed
-momentarily, and then invokes its action.
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Canvas.html b/PyGUI-2.5.3/Doc/Canvas.html
deleted file mode 100644
index 0890222..0000000
--- a/PyGUI-2.5.3/Doc/Canvas.html
+++ /dev/null
@@ -1,496 +0,0 @@
-
-PyGUI - class Canvas
-
-
-
-
-class Canvas
-Canvas is an abstract class representing something that can be
-drawn upon. It may represent an area of the screen, an offscreen
-pixmap, or something else such as a printed page.
-
-The drawing model of a Canvas is based on the Postscript
-drawing model. In this model, drawing is performed by first building up
-a geometric description of a path, and then stroking
-the path with a pen or filling
-the path with a colour, or both. Paths can also be used to define a clipping
-region to which subsequent drawing is restricted.
-The Postscript model is extended with the additional
-drawing operations:
- Erasing
-is filling the path with a background colour. On platforms supporting
-alpha transparency, the background colour completely replaces the
-colour in the existing image, instead of being blended with it as is
-the case for the other drawing operations.
- Framing is
-similar to stroking, except that the pen is moved around the inside of
-the path instead of being centred on the path. It is equivalent to stroking a path displaced inwards by half the pen size.
-
-Higher-level operations are also provided for convenient
-drawing of common shapes such as rectangles, ellipses, arcs and
-polygons.
-
-Graphics state
-Each canvas maintains a graphics state consisting
-of the following items:
-
-- A pen colour and pen size for
-stroking and framing operations.
-- A fill colour for filling operations.
- A text colour for drawing text.
-- A background
-colour for erasing operations.
-- A font for drawing text.
-- A current point used in path
-construction and text drawing.
-
-- A clipping region to which all drawing
-operations are restricted.
-
-The canvas also maintains a graphics state stack. The
-current graphics state can be saved by pushing it onto the stack with gsave, and
-restored by popping it from the stack with grestore.
-Current path
-Each canvas has a current path. The current path
-consists of a collection of path segments, each of
-which is a sequence of straight lines and/or Bezier curves. Each path
-segment can be either open or closed.
-Some operations expect closed path segments, in which case an open
-segment is treated as though it were closed by a line connecting its
-last point to its first point.
-
-Paths are constructed using the newpath,
-moveto, lineto, rmoveto,
-rlineto, curveto, rcurveto,
-arc and closepath methods. There are
-also some higher-level methods for adding commonly-used geometric
-shapes to the path.
Once constructed, a path can be used in the following ways:
-
-- It can be stroked with the current pen
-colour and size using the stroke method.
-- It can be filled with the current fill
-colour using the fill method.
-- It can be both filled and stroked using the fill_stroke
-method.
-- It can be erased with the current background colour using
-the erase
-method.
-- It can be used to restrict the current clipping region (see
-below) using the clip method.
-
-Note that the current path is not part of the
-state saved on the graphics state stack, and is unaffected by gsave and grestore.
Overlapping path elements
If
-the lines and curves making up a path intersect, or the regions they
-enclose overlap, the region enclosed by the path as a whole is
-determined using the even-odd winding number rule.
-Under this rule, the overlapping regions behave as though they were
-"exclusive-or"ed together. Thus, you can create a region with a hole in
-it using one segment for the outer boundary and another one for the
-boundary of the hole.
Note that this only works for segments
-belonging to a single path. Segments of different paths are independent
-and do not exclusive-or together.
-Current point
Path construction makes use of the current point.
-When a line or curve is added to a path, the current point is used as
-the first point of the element, and the last point of the element
-becomes the new current point. The current point is also used by
-certain other operations such as text drawing.
Under certain circumstances, the current point may be undefined. The current point is undefined when a new path has been started using newpath, and after a path segment has been closed using closepath or by calling one of the higher-level methods that adds a closed shape to the path. The current point becomes defined when moveto or rmoveto is called, or a line or curve is added to the path.
-
Some methods require the current point to be defined. The result of
-calling these methods when the current point is undefined is
-platform-dependent.
Drawing text
-Text is drawn using the show_text method, which
-draws a string
-in the current font and text colour, starting at the current point. The
-current
-point is then advanced to the end of the string, ready for drawing
-another
-string.
-Drawing Images
-Images and Pixmaps can also be drawn on Canvases, using methods
-provided by those classes. See ImageBase
-for details.
-Clipping
-Each canvas has a clipping
-region to which all drawing is clipped. The initial
-clipping region depends on the type of canvas and the circumstances
-under which it was created. For a canvas passed to a view's draw
-method, it is the region of the view requiring drawing. For a canvas
-obtained by calling a view's with_canvas method,
-it is the viewed rectangle.
-
-The clipping region can be modified by the clip and rectclip
-methods, which set the clipping region to the intersection of the
-current clipping region and a path or rectangle. There is no explicit
-way of enlarging the clipping region, so modifications to the clipping
-region should normally be made within a gsave/grestore pair
-to restore the previous clipping region afterwards.
-Higher-level operations
-In addition to the primitive operations making up the drawing model,
-there are a number of higher-level drawing methods which provide more
-convenient ways of drawing commonly-used shapes.
-
-The available shapes are:
-
-- Rectangle
-- Oval
-- an ellipse defined by a bounding rectangle.
-- Arc
-- a circular arc defined by a centre point, radius and start and end
-angles.
-- Wedge
-- a "pie slice" shape consisting of a circular arc together with two radial lines from
-the centre point to the endpoints of the arc.
-- Polyline
-- a connected sequence of straight lines.
-- Polygon
-- a sequence of straight lines forming a closed polygon.
- Polycurve - an open sequence of connected Bezier curves.
- Loop - a closed sequence of connected Bezier curves.
-
-Note
-that the Arc, Polyline and Polycurve are considered open shapes, even if the
-starting and ending points coincide. For corresponding closed shapes,
-use an Oval, Poly or Loop respectively.
Operations
-are provided both for adding these shapes to a path, and for drawing
-them directly without having to construct a path first.
-Summary of Operations
-The following matrix of higher-level operations is supported.
-
-
-
-
- |
-Add to Path |
-Fill |
-Stroke |
-Frame |
-Fill and Stroke |
-Fill and Frame |
-Erase |
-
-
-| Path |
- |
-fill |
-stroke |
- |
-fill_stroke |
- |
- |
-
-
-| Rectangle |
-rect |
-fill_rect |
-stroke_rect |
-frame_rect |
-fill_stroke_rect |
-fill_frame_rect |
-erase_rect |
-
-
-| Oval |
-oval |
-fill_oval |
-stroke_oval |
-frame_oval |
-fill_stroke_oval |
-fill_frame_oval |
-erase_oval |
-
-
-| Arc |
-arc |
- |
-stroke_arc |
-frame_arc |
- |
- |
- |
-
-
-| Wedge |
-wedge |
-fill_wedge |
-stroke_wedge |
- |
-fill_stroke_wedge |
- |
-erase_wedge |
-
-
-| Polyline |
-lines |
- |
-stroke_lines |
- |
- |
- |
- |
-
-
-| Polygon |
-poly |
-fill_poly |
-stroke_poly |
- |
-fill_stroke_poly |
- |
-erase_poly |
-
| Polycurve | curves | | stroke_curves | | | | |
| Loop | loop | fill_loop | stroke_loop | | fill_stroke_loop | | erase_loop |
-
-
-
Note: There are no filling or erasing operations for Arcs, Polylines and Polycurves because they are open shapes.
Note:
-There are currently no framing operations for Polygons and Loops because there is no
-straightforward way of determining an "inwards" direction in which to
-displace the pen.
-Properties
-
-
-- pencolor
-- Colour to be used for stroking and framing
-operations.
-
-
-- fillcolor
-- Colour to be used for filling operations.
-
- textcolor
- Colour to be used for drawing text.
-- backcolor
-- Colour to be used for erasing operations.
- forecolor
- Write-only. Setting this property sets the pen, fill and text colours to the same colour.
-
-
-
-
-- pensize
-- Width of the pen used for stroking and framing.
-
-
-
-
-- font
-- Font to be used in text drawing operations.
- current_point
- Read-only. The current point. If the current point is undefined, the result is platform-dependent.
- printing
- Read-only. True if the canvas is producing output for a printer or other non-display destination.
-
-
-
-
-
-
-Primitive methods
-
-
-- newpath()
-- Clears the current path.
-
-
-- moveto(x,
-y)
-- Moves the current point to (x, y).
-A subsequent call to lineto, rlineto,
-curveto, rcurveto or arc
-will start a new segment of the current path.
-
-
-- lineto(x,
-y)
-- Adds a straight line to the the current path from the
-current point to (x, y), and
-then makes (x, y) the current
-point.
-
-
-- rmoveto(dx,
-dy)
-rlineto(dx,
-dy)- The same as moveto
-and lineto, except that the coordinates are
-measured relative to
-the current point.
-
-
-- curveto(cp1, cp2, ep)
-- Adds a Bezier curve to the current path segment starting
-at the current point, having control points cp1 and cp2, and ending at
-the point ep. The end point of the curve becomes the new current point.
-
-
-- rcurveto(cp1, cp2, ep)
-- The same as curveto
-except that cp1, cp2 and ep are measured
-relative to the current point.
-
-- closepath()
-- Closes the last segment of the current path by adding a
-straight line
-from its last point to its first point. A subsequent call to lineto,
-rlineto, curveto, rcurveto
-or arc will start a new
-segment of the current path.
-
-
-
-
-- fill()
-- Fills the interior of the current path with the current
-fill color. The interior of the path is determined using the even-odd
-winding number
-rule.
-
-
-- stroke()
-- Draws a line along the current path using the current pen
-size and pen colour. The width of the line is distributed as evenly as
-possible either side of the path. The treatment of joins between lines
-is implementation-dependent.
-
-
-- fill_stroke()
-- Fills and then strokes the current path.
-
-
-
-
-- erase()
-- Fills the interior of the current path with the current
-background color.
-
-
-
-
-- show_text(string)
-
-- Draws the given text using the current font and
-foreground color. The left end of the baseline of the text starts at the current point.
-After drawing, the current
-point is advanced rightwards along the baseline by the width of the characters
-drawn. The effect on the current path is undefined. If the current
-point is not defined when this method is called, the result is
-platform-dependent.
-
-
-
-
-
-
-
-
-- clip()
-- Replaces the current clipping region with the
-intersection of the current clipping region and the interior of the
-current path. The interior of the path is determined using the
-even-odd winding number rule.
-
-
-
-
-- gsave()
-- Pushes the current graphics state onto the graphics state
-stack.
-
-
-
-
-- grestore()
-- Pops the most recently saved graphics state from the
-graphics state stack and makes it the current graphics
-state.
-
-
-- initgraphics()
-- Sets all the elements of the current graphics state to
-default values.
-
-
-Higher-level path methods
-
-- rect(rect)
-- Adds a new closed segment to the current path in the shape
-of a
-rectangle.
-
-
-- oval(rect)
-- Adds a new closed segment to the current path in the shape
-of an ellipse bounded by the given rectangle.
-- arc(centre, radius, start_angle, end_angle)
- Adds a circular arc to the current path segment with the
-given centre and radius. The arc is drawn clockwise from the start
-angle to the end angle. Both angles are in degrees clockwise from
-the positive x-axis.
-If the current point is defined, a straight line is added from
-the current point to the start point of the arc. The end point of the
-arc becomes the new current point.
- wedge(centre, radius, start_angle, end_angle)
- Adds a new closed segment to the current path in the shape of a wedge. The wedge is defined as for arc.
--
-lines(points)
-- Adds a new open segment to the current path consisting of a
-sequence of straight lines. Equivalent to calling moveto for the first point and then lineto for each subsequent point.
-
- linesto(points)
- Adds a connected sequence of straight lines to the current path segment. Equivalent to calling lineto for each point.
-- poly(points)
-- Adds a new closed segment to the current path in the shape
-of a polygon.
-
- curves(points)
- Adds a new open segment to the current path consisting of a
-sequence of connected Bezier curves. Equivalent to calling moveto for the first point and then curveto for each subsequent group of 3 points.
- curvesto(points)
- Adds a sequence of connected Bezier curves to the current path segment. Equivalent to calling curveto for each consecutive group of 3 points.
- loop(points)
- Adds a new closed segment to the current path consisting of a
-sequence of connected Bezier curves. Equivalent to calling curves followed by closepath.
-- rectclip(rect)
-- Replaces the current clipping region with the intersection
-of the current clipping region and the given rectangle. The effect on
-the current point and current path are undefined.
-
-Higher-level drawing methods
-Note: The effect of these methods on the current path is undefined.
-
-
-- fill_rect(rect)
- stroke_rect(rect)
frame_rect(rect)
fill_stroke_rect(rect)
fill_frame_rect(rect)
-erase_rect(rect)
-- Performs the indicated operation on the given rectangle.
--
-
-
-- fill_oval(rect)
-stroke_oval(rect)
-- frame_oval(rect)
fill_stroke_oval(rect)
-- fill_frame_oval(rect)
-erase_oval(rect)
-- Performs the indicated operation on an ellipse bounded by
-the specified
-rectangle.
-
-
-- stroke_arc(centre,
-radius, start_angle, end_angle)
-
-- frame_arc(centre,
-radius, start_angle, end_angle)
-- Performs the indicated operation on a circular arc. The arc is defined as for the arc method.
-
-
-
-
-
-- fill_wedge(centre,
-radius,
-start_angle, end_angle)
-stroke_wedge(centre,
-radius,
-start_angle, end_angle)
-- fill_stroke_wedge(centre,
-radius,
-start_angle, end_angle)
-erase_wedge(centre,
-radius,
-start_angle, end_angle)
-- Performs the indicated operation on a pie-shaped
-wedge. The wedge is defined as for the arc method.
-
-
-- stroke_lines(points)
-- Strokes a sequence of connected line segments.
-
-
-- fill_poly(points)
-stroke_poly(points)
-fill_stroke_poly(points)
-erase_poly(points)
-- Performs the indicated operation on a closed polygon.
- fill_loop(points)
-stroke_loop(points)
-fill_stroke_loop(points)
-erase_loop(points) - Performs the indicated operation on a closed sequence of Bezier curves. See loop.
-
-
-
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/CheckBox.html b/PyGUI-2.5.3/Doc/CheckBox.html
deleted file mode 100644
index 782839f..0000000
--- a/PyGUI-2.5.3/Doc/CheckBox.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-PyGUI - class CheckBox
-
-
-
- class CheckBox(Control)
- A CheckBox is a control which has either two or three possible states. The possible states of a two-state check box are on and off; three-state check boxes may have an additional state mixed.
- Clicking the CheckBox changes it from one state to another. Each time
-the state changes, its action is performed.
Constructor
- CheckBox(title)
- Constructs a CheckBox with the given title.
- Properties
-
- - title
- - Title string to be displayed beside the check box.
-
-
- - value
- - The state of the check box. May have the values True or False, and in the case of a three-state check box, 'mixed'.
-
-
- - action
- - Action to perform when the user changes the state of the check box.
-See Actions.
-
-
-
- - auto_toggle
- - True if the on property is to be automatically changed when
-the user clicks the check box. Defaults to true. If set to false, the action
-will still be performed when the check box is clicked, but the program
-is responsible for changing the state.
- mixed
- If true, the check box can be in a mixed state. Defaults to false.
-
-
- ---
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Color.html b/PyGUI-2.5.3/Doc/Color.html
deleted file mode 100644
index 492737b..0000000
--- a/PyGUI-2.5.3/Doc/Color.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-PyGUI - class Color
-
-
-
-
- class Color
- A Color object is used to represent a color for drawing on a Canvas. Color objects are immutable.
-
-Support for alpha values in colors is platform-dependent. On
-platforms with no alpha support, alpha values always read as 1.0. Even
-if colors with alpha are supported by a platform, alpha values may be
-ignored by some operations.
-
-
- Constructor functions
-
- - rgb(red, green, blue, alpha = 1.0)
- - Returns a Color instance constructed from components in the RGB color space.
-Each component should be in the range 0.0 to 1.0.
-
-
- Properties
-
-
- - red
- - green
- - blue
-
- - Read-only. Components in the RGB color space, in the range
-0.0 to 1.0.
-
- - alpha
- - Read-only. Alpha (opacity) value of the color. 0.0 is fully transparent, 1.0 is fully opaque.
-
-
- - rgb
- - Read-only. Components of the color as a tuple (red, green, blue).
-
-
- - rgba
- - Read-only. Components of the color as a tuple (red, green, blue, alpha).
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Column.html b/PyGUI-2.5.3/Doc/Column.html
deleted file mode 100644
index 049e41d..0000000
--- a/PyGUI-2.5.3/Doc/Column.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-Column class
-class Column(Frame)
A Column is a container that lays out a collection of components in a vertical column.
The
-initial size of the container is made just big enough to hold its
-contents. The horizontal alignment of items within the column may be
-specified, and one item may optionally be designated to expand vertically when the container is resized.
In addition, the width and/or height of all items may optionally be equalized before they are laid out.
Constructor
- Column(items, keyword = value, ...)
- Creates a Column containing the specified items, which should be a sequence of Components. The following keyword arguments may be used:
| spacing = 10 | Vertical space to leave between items. |
| padding = (0, 0) | Space to leave horizontally and vertically around all the items. |
| align = 'l' | Specifies horizontal alignment and anchoring of items. One of 'l', 'c', 'r' or 'lr' for left, centre, right or left-and-right. |
| equalize = '' | Specifies whether to make the size of all items equal in the horizontal and/or vertical direction. One of 'w', 'h' or 'wh'. |
| expand = None | Specifies
-which item, if any, is to change size vertically when the container is
-resized. May be the item itself or an index into the item list. Items
-above this item will be anchored to the top of the container, and
-items below it will be anchored to the bottom of the container.
If specified by an index, the item at that index may be None to leave an expanding space in the column. |
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/CommandSet.html b/PyGUI-2.5.3/Doc/CommandSet.html
deleted file mode 100644
index fc5c12d..0000000
--- a/PyGUI-2.5.3/Doc/CommandSet.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-CommandSetclass CommandSet
CommandSet
-is a subclass of the built-in set type designed for representing a set
-of command names, as used by the basic_menus() function. The following
-additional features are provided.
- The constructor accepts a single item (a string) as well as a collection of items.
- The + operator may be used as a synonym for | (set union).
- Union and difference operations accept a string or sequence of strings as the other operand.
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Component.html b/PyGUI-2.5.3/Doc/Component.html
deleted file mode 100644
index cf1382a..0000000
--- a/PyGUI-2.5.3/Doc/Component.html
+++ /dev/null
@@ -1,160 +0,0 @@
-
-Component
-
-
-
-
- Component is an abstract base class representing a visual component of
- the graphical user interface. A Component owns a rectangular region
- of screen space defined by its bounds property. It may be contained
- within another component, in which case it is clipped to the boundaries of
- its container.
-
-You should not derive directly from Component. Custom components should be based on a View or Frame.
-
- Geometry Properties
- The geometry properties control the position and size of the component
- within its container. There are several overlapping sets of geometry properties,
- corresponding to different ways of defining the component's bounding rectangle.
- The properties within each set are orthogonal, meaning that any one of
-them may be changed without affecting the others.
-
-
- - bounds
- - A rectangle (left, top, right, bottom) in the container's
-coordinate system.
-
-
-
- - left
- - top
- - right
- - bottom
- - Each of these properties corresponds to one element of the bounds
- rectangle. Changing one of these properties changes the position of one
-edge of the component without affecting any of the others (and will consequently
- change the width or height).
-
-
-
- - x
- - y
- - width
- - height
- - The x and y properties are the coordinates of the
- top left corner of the component in its container's coordinate system.
-Assigning to x or y will change the position of the component
-within its container, but not its size.
-
-
-
-
-
- - position
- - size
- - The position property is equivalent to the tuple (x,
- y). The size property is equivalent to the tuple (width, height).
-
-
-Other Properties
-
-
- - container
- - The Frame which contains this Component, if any. Setting this property
- has the effect of removing the Component from the previous container and
- adding it to the new container.
- anchor
- This
-property controls the layout behaviour of the component when its
-container is resized. It is a string made up of the letters 'l', 'r', 't' and 'b' for left, right, top and bottom.
If
-the component is anchored to the left or top of its container, it
-remains stationary when the container is resized. If it is anchored to
-the right or bottom, it moves along with that side of the container. If
-it is anchored to both left and right, or both top and bottom, it
-stretches when the container is resized.
-
- - border
- - Setting this to true requests that the component be given a border.
- The width and style of the border (or whether it even exists at all) is platform-dependent.
- When the border is present, it is positioned around the outside of the component's
- bounds rectangle, and is not included in the component's size.
- tab_stop
- A boolean indicating whether the component can be navigated into using the Tab key.
The default value of this property depends on the component's class, platform conventions and the setting of the PYGUI_KEYBOARD_NAVIGATION
-environment variable. For the standard control classes, you should
-normally leave it set to the default value so as not to interfere with
-the user's expectations. However, you may want to set it to false if
-you provide some other way of invoking the control's function using the
-keyboard.
Note: This
-property is currently ignored for standard controls on MacOSX, where
-the platform conventions and the user's System Preferences settings are
-always followed.
-
- Resizing Attributes
- These attributes determine what happens to the container's position and
- size when the size of its container changes as a result of the user resizing
-the containing window, or a containing component's resize method
-being called. These attributes are typically not set directly, but are established
-by the container's place method when the component is added to
-the container.
-
-NOTE: Because these are attributes and not properties, you can't set them using keyword arguments in the constructor.
-
-
-
-
- - hmove
- - If true, a change to the width of the container causes this component
- to move horizontally by the same amount.
-
-
-
-
- - vmove
- - If true, a change to the height of the container causes this component
- to move vertically by the same amount.
-
-
-
-
- - hstretch
- - If true, a change to the width of the container causes the width
-of this component to change by the same amount.
-
-
-
-
- - vstretch
- - If true, a change to the height of the container causes the height
-of this component to change by the same amount.
-
-
- Methods
- become_target()
- - Arranges for this component to have the first chance to handle
- keystrokes, menu commands and other messages dispatched to the containing
-window. If the component is not contained in a window, the effect is undefined.
-
- Note: Depending on the
-platform, not all components may be capable of becoming targets. This
-method is only guaranteed to work on components which directly handle
-input events. Its effect on other components is undefined.
-
-
-
- - is_target()
- - Returns true if this component is the current message target
-within its containing window. If the component is not contained in a window,
-the result is undefined.
-
-
Abstract methods
- mouse_down(event)
mouse_drag(event)
mouse_up(event)
mouse_move(event) - These methods are called in response to mouse events occuring in the view. The position attribute
- of the event contains the location of the mouse in local coordinates.
- container_resized(delta)
- Called from the resized() method of the component's container. The delta parameter is a tuple (dx, dy)
-indicating the amount by which the container has changed size. The
-default implementation updates the position and size of the component
-according to its resizing options.
Destructor
-
-
- - destroy()
- - Destroys the component and removes it from the screen. It should not
-be used again.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Container.html b/PyGUI-2.5.3/Doc/Container.html
deleted file mode 100644
index b02c4a1..0000000
--- a/PyGUI-2.5.3/Doc/Container.html
+++ /dev/null
@@ -1,90 +0,0 @@
-
-Container
-
-
-
-
- Container is an abstract base class for components which can contain other components. The contained
- components are clipped to the boundary of their container.
- The Container class provides a flexible placement facility for laying out
-its contents and specifying how the contents behave when the container is resized.
-
-You should not derive directly from Container. Custom components should be based on View or Frame.
-
- Properties
-
- - contents
- - List of contained Components.
-
-
- - Do not modify the contents of this list directly. Use the
-placement methods, or the add and remove methods, to modify
-the containment hierarchy.
- content_width
content_height
content_size - The
-size of the content area of the container. The content area is the area
-available to subcomponents, excluding any borders, scrollbars or other
-decorations that the component may have.
- auto_layout
- A
-boolean controlling whether the layout of subcomponents is
-automatically adjusted when the container changes size. Defaults to
-true.
-
-
- Methods
-
- - add(component)
- - Adds the given component to this container.
-
-
- - remove(component)
- - If the given component is among the contents of this container, removes
- it.
-
-
- - place(item,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None)
-
-
- - place_row(items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '',border = None)
-
-
- - place_column(items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None)
-
-
- - These methods add a component or list of components to the container with
-the specified placement options. See Placement Methods.
-
-
-
-
- - shrink_wrap(padding = None)
- - Changes
-the size of the container so that it neatly encloses its contents. By
-default it leaves the same amount of space at the right and bottom of
-the contents as there is at the left and top. This can be overridden by
-specifying a tuple (right, bottom) for padding. If the container is empty, its size is not changed.
-
- - resize(geometry_property = value,
-..., auto_layout = False)
- This
-method allows the size of the container to be changed without affecting
-the layout of subcomponents. It is equivalent to assigning the given
-values to the specified geometry properties, except that the auto_layout property setting is temporarily overridden by the given parameter.
Callbacks
- resized(delta)
- Called when the size of the container changes for any reason while the auto_layout property is true. The delta parameter is a tuple (dx, dy) representing the amount by which the size has changed. The default implementation calls container_resized() on each of the subcomponents.
-
-
-
-
-Destructor
-
-
- - destroy()
- - Destroys the container and all its contained subcomponents.
-
-
- ---
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Control.html b/PyGUI-2.5.3/Doc/Control.html
deleted file mode 100644
index 0988bd5..0000000
--- a/PyGUI-2.5.3/Doc/Control.html
+++ /dev/null
@@ -1,40 +0,0 @@
-
-PyGUI - class Control
-
-
-
-
-Class Control is an abstract base class for controls. It provides a set of
-properties that most controls have in common.
-
-Note that some platforms may not support changing all of these properties.
-
-You should not derive directly from Control. Custom components should be based on View or Frame.
-Properties
-
-
- - value
- The value of the control. Its type depends on the kind of control.
- enabled
- - True if the control can be manipulated by the user. Disabled controls
-are typically displayed in a different way, and do not respond to user actions.
-
-
- - font
- - Font in which to display the control's title or text, if it has any.
-
-
- - color
- - Color in which to display the control's title or text, if it has
-any.
-
-
- - just
- - Justification of the control's title or text, if it has any. One
-of 'left', 'center' or 'right'.
-
-
- - lines
- - The height of the control measured in lines of the current font.
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Cursor.html b/PyGUI-2.5.3/Doc/Cursor.html
deleted file mode 100644
index 5fa4e80..0000000
--- a/PyGUI-2.5.3/Doc/Cursor.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-PyGUI - class Cursor
-
-class Cursor
-The Cursor class represents an image that may be used as a mouse cursor. A Cursor can be assigned to the cursor
-property of a View to control the appearance of the cursor when the
-mouse is over that view. A cursor can be obtained from a resource file,
-constructed from an Image, or obtained from a set of predefined cursors in the StdCursors module.
-
-The capabilites of cursors vary from one platform to another. There may
-be a limit on the size of a cursor, and coloured cursors may or may not
-be supported. For maximum portability, cursor images should be black
-and white and no larger than 16x16 pixels.
-Constructors
-
- - Cursor(resource_name, hotspot = None)
- Constructs a cursor from the specified resource, which should be an image file.
-
-
- - If no hotspot is specifed, a hotspot file is searched for using the resource name with the suffix replaced by ".hot". The hotspot file should be a single-line text file containing two coordinates separated by whitespace.
-
-If no hotspot is specifed and no hotspot file is found, the hotspot defaults to the centre of the image.
-
-
- - Cursor(image, hotspot = None)
-
- - Constructs a Cursor having the specified Image
-and hotspot point. If the image has an alpha channel, it is used as the
-cursor's mask. If no hotspot is specified, it defaults to the centre of
-the image.
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Dialog.html b/PyGUI-2.5.3/Doc/Dialog.html
deleted file mode 100644
index d2b4818..0000000
--- a/PyGUI-2.5.3/Doc/Dialog.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
- Dialog
-
-class Dialog(Window)
-
-The Dialog class is a subclass of Window designed
-for use as a dialog box. It provides facilities for defining default and
-cancel buttons that are activated by keyboard equivalents.
-
-A Dialog differs from a Window in having a default style of 'nonmodal_dialog',
-and by default (if possible on the platform) not being closable, zoomable
-or resizable. These options can be overridden in the constructor call.
-
-On platforms which display a menu bar at the top of each window, a Dialog
-does not normally have a menu bar. Enabled menu items are still available by their
-keyboard equivalents while the Dialog is active, however.
-Constructor
-
-
- - Dialog(style = 'nonmodal_dialog',
- - closable = False,
- resizable = False, zoomable = False,
- - movable = platform_default, hidable
-= platform_default)
- - Constructs a Dialog with the specified options. The default values
-for the movable and hidable options are platform-dependent.
-
-
-Action Properties
-
-
- - default_action
- - Action
-to perform in response to a Return or Enter key event. This action is
-also typically invoked by activating a default button or pressing
-Return or Enter in a text field. The default is 'ok', which is implemented by ModalDialog to dismiss the dialog with the value True. You can create a button which invokes this action using DefaultButton.
- cancel_action
- - Action to perform in response to an Escape key event. This action is also typically invoked by activating a cancel button or pressing Escape in a text field. The default is 'cancel', which is implemented by ModalDialog to dismiss the dialog with the value False. You can create a button which invokes this action using CancelButton.
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/DirRef.html b/PyGUI-2.5.3/Doc/DirRef.html
deleted file mode 100644
index 6c6b9fe..0000000
--- a/PyGUI-2.5.3/Doc/DirRef.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-PyGUI - DirRef class
-
-
-
-
-class Files.DirRef
-
-A DirRef is a platform-independent representation of an existing directory. DirRef objects are immutable.
-
-See also: FileRef
-
-Constructor
-
-
- - DirRef(path = string)
- - Constructs a DirRef from a full pathname.
-
-Only the absolute pathname of an existing directory should be used. The
-effect of a relative or nonexistent pathname, or the pathname of
-something which is not a directory, is undefined.
-
-
-
-Properties
-
-
- - path
- - Read only. The full pathname of the directory.
-
-
-
----
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/DisplayList.html b/PyGUI-2.5.3/Doc/DisplayList.html
deleted file mode 100644
index 9de5bcc..0000000
--- a/PyGUI-2.5.3/Doc/DisplayList.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
-PyGUI - GL.DisplayList
-
-class GL.DisplayList
-
-The DisplayList class in the GL submodule provides a context-independent
-representation of an OpenGL display list. You can use a single DisplayList
-object with multiple GLViews and/or GLPixmaps without being concerned
-whether they are sharing display list spaces or not, and without having to
-keep track of OpenGL display list numbers.
-
-To use a DisplayList, you provide it with a setup function
-that makes the necessary OpenGL calls to define the display list. Then,
-whenever you want to draw the display list, you call its call
-method. Whenever the display list is used in a context where it has not
-been used before, the setup function will be called to compile a
-representation of it for that context.
-
-As an alternative to plugging in a setup function, you can also subclass DisplayList and override the do_setup method.
-
-Inside your setup function or method, you can freely make calls to draw other DisplayList and Texture
-objects, and PyGUI will make sure that everything is done in the right
-order. To make this work, calls to the setup methods of those other
-objects are deferred until definition of the first display list has
-completed.
-
-Note: If you make your own
-calls to glNewList and glEndList, you must not attempt to use any
-DisplayList or Texture objects between these calls, because PyGUI will
-not know that a display list is being defined, and will try to do
-things that don't work in that situation. Therefore it is recommended
-that if you use these objects, you use them for all of your display list and texure management.
-Constructor
-
- - DisplayList(setup = None)
- - Constructs a new DisplayList with the given setup function. See the setup property.
-
-
-Properties
-
- - setup
- - Function to define the contents of the display list. It should be
-a callable object of no arguments. A call to glNewList will have been
-made before the setup function is called, and glEndList will be called
-after it returns.
-
-Methods
-
- - call()
- - Call the display list, using glCallList. If the display list has
-not previously been used with the current context (or one with which it
-is sharing display lists), an OpenGL display list number is allocated
-and the setup function is called to compile a representation of the display list.
-
-
-- deallocate()
- Deallocates any OpenGL resources currently allocated to the DisplayList. If it is used again, new resources will be allocated.
-
-
-
-
-Abstract Methods
-
- - do_setup()
- - As an alternative to supplying a setup function, a subclass can override this method to define the display list.
-
---
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Document.html b/PyGUI-2.5.3/Doc/Document.html
deleted file mode 100644
index e9c2e7f..0000000
--- a/PyGUI-2.5.3/Doc/Document.html
+++ /dev/null
@@ -1,116 +0,0 @@
-
-Document class
-
-
-
-
- A Document represents an application data structure that can be stored
- in a file. It implements standard functionality such as asking the user for
-file names and opening and closing files.
- Each Document can have one or more windows associated with it. When the
- last window belonging to a document is closed, the document itself is closed.
- A Document provides support for keeping track of whether it has been
- edited, and asking the user whether to save changes when it is closed.
- Properties
-
- - needs_saving
- - A boolean indicating that the document has been edited and needs
-to be saved.
-
-
- - file
- - A FileRef identifying the file that the document was read from or
-last written to, or None.
-
-
- - file_types
- A list of FileType
-specifying the type of file read and written by the document. This may
-be None if the document does not deal with files or does not care about
-file types.
-
- - title
-
- - Document title to be displayed in window headers. The default value
-of this property is derived from the last pathname component of the associated
-file, or if the document is not associated with a file, a title such as "Untitled-n"
-is constructed. Assigning to this property will cause all associated windows
-to update their titles accordingly.
-
-
- - windows
- - Read-only. List of windows associated with this document.
- page_setup
- A PageSetup instance to be used by views having this document attached as a model.
-
-
- Attributes
-
- - binary
- - Determines the mode in which the file object passed to the read_contents and write_contents
-methods is opened. If true, the file is opened in binary mode for
-reading or writing. If false, the file is opened in text mode for
-writing, and universal newlines mode for reading.
-
-
- - This attribute may be specified as a class attribute. The default value is true.
- pickle_as_parent_model
- (Read only) This is set to False as a class attribute, and you should not override it. Its purpose is to prevent the Document from being pickled along with a Model, as described here.
-
-
- Abstract Methods
-
- - new_contents()
- - Should initialise the document to the appropriate state following
- a New command.
-
-
-
- - write_contents(file)
- - Should write the document's contents to the given file, which is an already-open file object.
-
-
- - read_contents(file)
- Should initialise the document's contents by reading it from the
-given file, which is an already-open file object.
If you restore the contents by unpickling a previously-pickled Model whose parent attribute referred to the Document, you will need to re-set the parent here.
- destroy_contents()
- - Called when the contents of the document are about to be discarded.
- If the contents contains any Model objects, they should be destroyed.
- get_default_save_directory()
- Called
-when the user is about to be asked for a location in which to save a
-document that has not been saved before, to find a defaultdirectory for request_new_file(). Should return a DirRef or FileRef, or None if there is no particular preferred location. The default implementation returns None.
- get_default_save_filename()
- Called when the user is about to be asked for a location in which to save a document that has not been saved before, to find a default file name for request_new_file(). Should return a suggested file name, or an empty string to require the user to enter a file name. The default implementation returns an empty string.
-
-
- Methods
-
- - changed()
- - Mark the document as needing to be saved. Equivalent to setting the needs_saving property to true.
-
-
- - save_changes()
- - If the document has been edited, ask the user whether to save changes
- and do so if requested.
-
-
- - save_cmd()
- - Implements the standard Save command. Writes the document
-to its associated file, asking the user for one first if necessary.
-
-
- - save_as_cmd()
- - Implements the standard Save As... command. Asks the user
-for a new file and writes the document to it.
-
-
- - revert_cmd()
- - Implements the standard Revert command. Discards the current
- contents of the document and re-reads it from the associated file.
-
-
- - close_cmd()
- - Implements the standard Close command. Asks whether to save
- any changes, then destroys any associated windows.
- page_setup_cmd()
- Default implementation of the Page Setup... command. Edits the PageSetup instance referred to by the page_setup attribute. If it is None, a new PageSetup instance is created.
-
-
- Destructor
-
- - destroy()
- - Destroys any associated Windows, then destroys the Document.
-
-
- ---
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Event.html b/PyGUI-2.5.3/Doc/Event.html
deleted file mode 100644
index 64b091f..0000000
--- a/PyGUI-2.5.3/Doc/Event.html
+++ /dev/null
@@ -1,164 +0,0 @@
-
-PyGUI - class Event
-
-
-
- class Event
- An Event object represents an input event such as a mouse click or keystroke.
-
- Attributes
-
- - kind
- - A code indicating the type of event. One of:
-
-
-
-
-
'mouse_down'
- 'mouse_drag'
- 'mouse_up''mouse_move''key_down'
- 'key_up'
-
-
-
- position
-
- For mouse events, the location of the mouse pointer when the event
-occurred, in the coordinate system of the component receiving the event. For
-mouse-down events, this is the component in which the click occurred. For
-other mouse events, it is the view whose track_mouse method was
-used to receive the event.
deltaFor
-mouse-move and mouse-drag events, a 2-tuple representing the relative
-mouse motion since the last mouse event, unconstrained by screen
-boundaries. Currently implemented only on MacOSX.
-
-
- global_position
- The location in screen coordinates of the mouse pointer when the event
-occurred. This attribute is valid for all event types.
-
-
-
- time
-
- Time at which the event occurred. The origin and units are platform-dependent.
-
- num_clicks
- For mouse-down events, the number of clicks which have so far occurred
-sufficiently close together in time and space to be considered a multiple
-click.
-
-
- buttonFor mouse-down and mouse-up events, the mouse button that caused the event. One of 'left', 'middle' or 'right'.
-
-
- NOTE:
-Portable applications should not rely on all of these values being
-available. Some platforms have only 2 buttons (e.g. Windows) or 1
-button (e.g. Macintosh). You should provide alternative ways of
-invoking middle and right mouse button functions if you want your
-application to be usable on these platforms.
-
-
-
-
-
- char
-
- For key-down and key-up events, the ASCII character corresponding
-to the key. If the key is not associated with a character, or the character cannot be represented in ASCII, this is
-an empty string.
unicharsFor key-down and key-up events, a Unicode string representing the textual value of the key, if any.
-
-
- - key
- - For keys which do not have an ASCII character, and certain other special keys, this is a string naming
-the key. It may have the following values:
-
-
-
-
- 'left_arrow'
-'right_arrow'
-'up_arrow'
-'down_arrow' 'return'
-'enter'
-'f1' to 'f15'
- |
-
- |
- 'insert' 'delete'
- 'home'
-'end'
-'page_up'
-'page_down'
- |
-
-
-
-
-
-
- - Note: The Return key on the main keyboard and the Enter key on the numeric keypad both set the char attribute to '\r'. They are distinguished by the key attribute being set to 'return' for the Return key and 'enter' for the Enter key. (On most PC keyboards, both of these keys are marked "Enter", but the same behaviour applies.)
Note: On Macintosh keyboards, the insert key is labelled "Help".
Note:
-On the Macintosh, keystrokes with the Option key produce accented
-characters and other special symbols which cannot be represented in
-ASCII; for these, the char attribute will be empty. The unichars attribute may be used to find the Unicode value for these characters, and the key attribute will contain an ASCII string identifying the keyboard key that was pressed. For example, Option-a produces unichars = u'\xe5' and key = 'a'.
-
-
- - auto
-
- - For key-down events, and on platforms which support it, a boolean
-indicating that the event is due to an auto-repeating key rather than a physical
-keystroke.
-
-
-
-
-
- Modifier Attributes
- The following attributes are boolean values indicating the state of mouse
- buttons and/or keyboard modifier keys at the time of the event.
-
- There are two groups of modifiers, high-level and low-level. The high-level
- modifiers are abstract and are mapped onto the available keys and buttons
- in a platform-dependent way. The low-level modifiers, on the other hand,
-represent physical keys.
-
- Some of the high-level modifiers may be defined in terms of the low-level
- modifiers, so the programmer should not rely on all possible combinations
- of modifiers being distinguishable. Modifiers within each group, however,
- should always be independent of each other.
- The high-level modifiers are:
-
-
- - extend_contig
- - extend_noncontig
- - These indicate that a selection is to be extended contiguously or
- non-contiguously. If neither of these is true, a new selection is to be begun
- or an existing selection deselected.
- -
- - option
- - This is a general-purpose modifier whose interpretation is up to the
-programmer.
-
-
- The low-level modifiers are:
-
-
- - shift
- - control
- - These represent the state of the shift and control keys on the keyboard.
- They ought to be available on most platforms, although there may be exceptions
- (early Macintosh keyboards, for example, had no Control key).
-
-
- Methods
-
- - position_in(view)
- - Returns the location of the event in the coordinate system of the
-specified view.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Exceptions.html b/PyGUI-2.5.3/Doc/Exceptions.html
deleted file mode 100644
index aa38e50..0000000
--- a/PyGUI-2.5.3/Doc/Exceptions.html
+++ /dev/null
@@ -1,46 +0,0 @@
-
-PyGUI - Exception classes
-Exception classes
-PyGUI defines the following exception classes for use by application code.
-
- - Cancel
-
-This exception can be raised to abort an operation, such as in response
-to the user clicking a Cancel button. It is silently caught by the main
-event loop.
-
-When writing code, you should keep the possibility of Cancel exceptions
-in mind, and make judicious use of try-finally to clean up after
-operations that could be cancelled part way through.
-
-
- - ApplicationError(message [, detail])
-
-
-This exception can be raised to signal an error that should be reported
-to the user. It is caught by the main event loop and a suitable alert
-displayed.
-
-The message should be a brief description of the error, including primary relevant information. The detail may be a longer discourse providing further information about the cause of the error and/or possible remedies. For example,
-
-
-
- -
-
-
- - "Unable to open the file 'InterestingStuff.txt'".
-
-
-
- - detail:
- - "Someone has spread peanut butter on the disk. Please clean it and try again."
-
-
-
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/FileRef.html b/PyGUI-2.5.3/Doc/FileRef.html
deleted file mode 100644
index 8da807c..0000000
--- a/PyGUI-2.5.3/Doc/FileRef.html
+++ /dev/null
@@ -1,82 +0,0 @@
-
-PyGUI - FileRef class
-
-
-
-
-class Files.FileRef
-
-A FileRef is a platform-independent representation of a file system object. It consists of two parts, a directory specification and the name of an object within that directory.
-A FileRef may name an existing object or one that does not yet
-exist. The directory specification always refers to an existing
-directory, however (although this is not necessarily enforced).
-
-When using a pathname in the construction of a FileRef, an absolute
-pathname should be used. The effect of specifying a relative pathname
-is undefined.
-
-FileRef objects are immutable.
-
-Constructors
-
-
- - FileRef(dir = DirRef or path, name = string)
- - Constructs a FileRef from a directory specification and a name
-within that directory. The directory may be specified either by a full
-pathname or a DirRef.
-
-
- - FileRef(path = string)
- - Constructs a FileRef from a full pathname.
-
-
-
-Properties
-
-
-
-
-- name
-
-- Read only. Name of the object within its parent directory.
-
-
-
-
-
-
-- dir
-
-- Read only. A DirRef representing the directory
-in which the object resides, or will reside in the case of an object which does
-not yet exist.
-
-
-
-Methods
-
-
-
-
-- open(mode, file_type = None)
-
-- Opens the referenced object as a file using the given mode (which is the
-same as the mode parameter to the built-in open function).
-If opening for writing and the file does not yet exist, it is created.
-
-If file_type is given, it should be a FileType
-instance specifying the file type metadata to be attached to the file.
-This parameter is only used if the call results in the creation of a
-new file. On platforms which do not have file type metadata, it is
-ignored.
-
- - mkdir()
- - Creates a directory with the name and parent directory specified by the FileRef. Returns a DirRef representing the created directory.
-
-
-
-
-
----
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/FileType.html b/PyGUI-2.5.3/Doc/FileType.html
deleted file mode 100644
index b08e434..0000000
--- a/PyGUI-2.5.3/Doc/FileType.html
+++ /dev/null
@@ -1,68 +0,0 @@
-
-PyGUI - FileType class
-
-class Files.FileType
-The FileType class provides a multi-platform representation of a file
-type, holding the metadata used by the various platforms to create and
-recognise files of a particular type. FileType instances are used by
-the standard file selection dialogs to restrict the set of selectable files, and by the FileRef class to enable creating a file of a
-specified type.
-Properties
-
- - name
- A short human-readable description of the file type.
-
-
- - suffix
-
-
-
-
-
- - Filename suffix (without dot) used to recognise files of this
-type. This is the most generic way of specifying a file type, as it
-works across most platforms.
-
- - This property is used by request_old_file() to filter the set of files that can be selected, and by request_new_file() to determine the suffix of the returned filename. Note, however, that it is ignored by FileRef.open()
-when creating a file. If you use a filename other than one returned by
-request_new_file(), it is your responsibility to add any
-necessary suffix.
-
-
-
-
- - mac_creator
- - On the Macintosh, the 4-character creator code to be given to
-newly-created files of this type. This property is used by FileRef.open() when creating a file, but not by the file dialog functions.
-On other platforms, this property is ignored.
-
-
-
-
- - mac_type
- - On the Macintosh, the 4-character type code. This property is
-used by FileRef.open() when creating a file, and by request_old_file() to filter the set of files that can be selected.
-
-On other platforms, this property is ignored.
-
- - mac_force_suffix
- - On MacOSX, this property controls whether files saved as this type are forced to have the specified suffix even when a mac_type
-is specified. The default is true, which ensures that the application
-will always recognise saved files as being of this type on all
-platforms.
-
-By specifying a mac_type and setting this property to false, you can
-allow files to be saved on the Macintosh with any file name. On the
-Macintosh their type will be recognised by the mac_type, and files
-saved on other platforms will be recognised by their suffix. However,
-to ensure that files saved on the Macintosh will be recognised on other
-platforms, you will need to manually give them the correct suffix.
-
-This property only applies when the file type specifies both a suffix
-and a mac_type. When there is no mac_type, the suffix is always
-enforced. When there is no suffix, this property is ignored (since
-there is no suffix to enforce).
-
-On non-Macintosh platforms, this property is ignored, and the suffix, if any, is always enforced.
-
-
---
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Font.html b/PyGUI-2.5.3/Doc/Font.html
deleted file mode 100644
index d0608e2..0000000
--- a/PyGUI-2.5.3/Doc/Font.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-PyGUI - class Font
-
-
-
- class Font
- A Font object represents a set of characters of a particular typeface,
- style and size. Font objects are immutable.
- Constructor
-
-
- - Font(family, size, style)
- - The family is the name of a font family ("Times", "Helvetica", etc...).
- The size is measured in points.
- The style is a list of zero or more of: 'bold', 'italic'.
-
-
- Properties
-
-
- - family
- - Read-only. Family name of the font.
-
-
- - style
- - Read-only. Style of the font.
-
-
- - size
- - Read-only. Point size of the font.
-
-
- - ascent
- - Read-only. Distance from the baseline of the font to the top
- of the tallest character.
-
-
- - descent
- - Read-only. Distance from the baseline of the font to the bottom
- of the lowest character.
-
-
- - height
- - Read-only. Height of the font (equal to ascent +
- descent).
- - leading
- Read-only. Recommended space to leave between adjacent lines of text.
- line_height
- - Read-only. Recommended distance between the baselines of adjacent lines of text (equal to ascent + descent + leading).
- cap_height
- Read-only. Height above the baseline of capital letters. May not be accurate on all platforms.
- x_height
- Read-only. Height above the baseline of lower case letters without ascenders. May not be accurate on all platforms.
-
-
-
- Methods
-
-
- - width(string [,start [,end]])
- - Returns the width of the specified part of the given string when
-drawn in this font.
-
-
- Constants
-
- - system_font
- - application_font
- - Predefined Font instances representing the standard fonts for system
- text and application text, respectively.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Frame.html b/PyGUI-2.5.3/Doc/Frame.html
deleted file mode 100644
index a207237..0000000
--- a/PyGUI-2.5.3/Doc/Frame.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-PyGUI - Frame class
-
-Frame is an instantiable subclass of Container that you can use as a general-purpose container of other components.
-
----
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/GL.html b/PyGUI-2.5.3/Doc/GL.html
deleted file mode 100644
index 21f9908..0000000
--- a/PyGUI-2.5.3/Doc/GL.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-PyGUI - GL module
-
-Module GL
-The GL submodule provides a number of facilities for using OpenGL
-graphics in PyGUI applications. Use of these requires the presence of a
-functioning PyOpenGL installation.
-Classes
-The following classes are defined in the GL submodule.
-
- - GLConfig
- - A bundle of OpenGL context attributes.
-
-
- - GLView
- - An on-screen view for displaying OpenGL graphics.
-
-
- - GLPixmap
- - An off-screen area for OpenGL graphics.
-
- - ShareGroup
- - A group of OpenGL contexts sharing textures and display lists.
-
-
-
-
- - Texture
- - A context-independent representation of an OpenGL texture.
-
- - DisplayList
- - A context-independent representation of an OpenGL display list.
-
-
-
-
-Exceptions
-
- - GLConfigError
- - Raised when attempting to construct a GLView or GLPixmap with a set of attributes that cannot be satisified.
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/GLConfig.html b/PyGUI-2.5.3/Doc/GLConfig.html
deleted file mode 100644
index dcebe21..0000000
--- a/PyGUI-2.5.3/Doc/GLConfig.html
+++ /dev/null
@@ -1,79 +0,0 @@
-
-PyGUI - GLConfig class
-
-class GL.GLConfig
-The GLConfig class of the GL submodule provides a bundle of attributes
-for configuring an OpenGL context. It also provides facilities for
-testing whether a given set of attributes is supported and finding out
-what attributes are supported on the platform where the application is
-running.
-Properties
-
- - double_buffer
- - True if double buffering is desired.
-
-
- - alpha
- - True if an alpha channel is required.
-
-
- - color_size
- - Desired number of bits per color buffer component.
-
-
- - alpha_size
- - Desired number of bits per alpha channel component.
-
-
- - stereo
- - True if a stereoscopic context is required.
-
-
- - aux_buffers
- - Number of auxiliary buffers required.
-
-
- - depth_buffer
- - True if a depth buffer is required.
-
-
- - depth_size
- - Desired number of bits per depth buffer element.
-
-
- - stencil_buffer
- - True if a stencil buffer is required.
-
-
- - stencil_size
- - Desired number of bits per stencil buffer element.
-
-
- - accum_buffer
- - True if an accumulation buffer is required.
-
-
- - accum_size
- - Desired number of bits per accumulation buffer element.
-
-
- - multisample
- - True if a multisampled context is desired.
-
-
- - samples_per_pixel
- - Desired number of samples per pixel when multisampling is active.
-
-
-Methods
-
-
- - supported(mode = 'both')
- - Tests whether the requested combination of attributes, or
-something close to them, can be satisfied. If successful, a new
-GLConfig instance is returned whose attributes reflect those actually
-available. Otherwise, None is returned.
The mode parameter may be 'screen', 'pixmap' or 'both' to request a configuration suitable for drawing to a GLView, a GLPixmap, or both a GLView and a GLPixmap.
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/GLPixmap.html b/PyGUI-2.5.3/Doc/GLPixmap.html
deleted file mode 100644
index 412282b..0000000
--- a/PyGUI-2.5.3/Doc/GLPixmap.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-PyGUI - GLPixmap class
-
-class GL.GLPixmap(ImageBase)
-The GLPixmap class in the GL submodule provides an off-screen area for
-OpenGL drawing that may subsequently be used as a 2D image and drawn
-into a Canvas.
-Constructors
-
- - GLPixmap(width, height, config, share_group = None)
- GLPixmap(width, height, config_attr = value..., share_group = None)
- - Creates a GLPixmap having the given size and characteristics.
-In the first form of the constructor, the characteristics are specified
-by a GLConfig instance. In the second form, attributes of the GLConfig
-class are specified as individual keyword arguments to the constructor.
-
-If share_group is specified, it should be a ShareGroup instance, and the GLPixmap is added to that group.
-
-Abstract methods
-
-
- - init_context()
- Immediately after the view's OpenGL context is created, it is made
- the current context and this method is called. You may use this method to
- establish any desired initial OpenGL state.
-
-Methods
-
-
-
-- with_context(function, flush = True)
- The function should be a callable object of no arguments.
-Calls function with the pixmap's OpenGL context as the current context. If flush is true, then after calling the function, a buffer flush or swap is performed as appropriate.
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/GLView.html b/PyGUI-2.5.3/Doc/GLView.html
deleted file mode 100644
index 5abea38..0000000
--- a/PyGUI-2.5.3/Doc/GLView.html
+++ /dev/null
@@ -1,102 +0,0 @@
-
-PyGUI - GLView
-
-
-
-
-class GL.GLView(Component, ViewBase)
-The GLView class of the GL
-submodule provides an area for displaying 3D graphics using OpenGL. It
-also provides model observation and input handling facilities via the ViewBase class.
-Constructors
-
-
-- GLView(config, share_group
-= None)
-GLView(config_attr = value..., share_group = None)
-- Creates a GLView having the given characteristics.
-In the first form of the constructor, the characteristics are specified
-by a GLConfig instance.
-In the second form, attributes of the GLConfig
-class are specified as individual keyword arguments to the constructor.
-
-
-
-- If share_group
-is specified, it should be a ShareGroup
-instance, and the GLView is added to that group.
-
-
-Abstract methods
-
-
-- init_context()
-- Immediately after the view's OpenGL context is created,
-it is made the current context and this method is called. You may use
-this method to establish any desired initial OpenGL state.
-
-
-- init_projection()
-- You may use this method to establish the desired
-projection matrix. It is called after init_context()
-during creation of the GLView, and again whenever the size of the view
-changes. When called, the view's OpenGL context is the current context,
-and its viewport has been set to (0, 0, w,
-h) where (w, h) is the
-new
-size of the view. Also, the projection matrix has been selected as the
-current matrix and loaded with an identity matrix. In most cases, you
-will simply need to call either gluPesrpective() or gluOrtho() to set
-up the projection.
-
-
-
-
-
-- render()
-- This method is called with the view's OpenGL context as
-the current context whenever the view needs to be redrawn. The
-modelview matrix has been selected and loaded with an identity matrix.
-On return, drawing will be flushed and buffers swapped as appropriate.
-
-
-
-- viewport_changed()
-- This
-is a lower-level method that is called when the size of the view
-changes, after setting the viewport but before doing anything else. The
-default implementation calls init_projection().
-You will not usually need to override this method.
-
-
-
-Methods
-
-
-- with_context(function,
-flush = True)
-- The function should be a
-callable object of no arguments. Calls function
-with the view's OpenGL context as the current context. If flush is true, then
-after calling the function, a buffer flush or swap is performed as
-appropriate.
-
-
-
-- invalidate()
-- Marks the whole view as needing to be redrawn.
-
-
-
-
-- update()
-- Causes the whole view to be redrawn immediately, without
-waiting
-for a return to the event loop.
-
-
-
----
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Geometry.html b/PyGUI-2.5.3/Doc/Geometry.html
deleted file mode 100644
index 5705a60..0000000
--- a/PyGUI-2.5.3/Doc/Geometry.html
+++ /dev/null
@@ -1,86 +0,0 @@
-
-PyGUI - Geometry submodule
-
-
-
-
- Geometry submodule
- The Geometry submodule provides a collection of functions for operating
-on points and rectangles. See the section on Coordinates,
-Points and Rectangles for a discussion of how these entities are defined.
- Point functions
-
- - add_pt(p1, p2)
- - Returns the point resulting from adding the coordinates of points p1 and p2.
-
-
- - sub_pt(p1, p2)
- - Returns the point resulting from subtracting the coordinates of point
- p2 from those of point p1.
-
- Rectangle functions
-
- - rect_sized(p, size)
- - Returns a rectangle of the specified size with p as its top left
-corner.
-
-
- - rect_left(r)
- - rect_top(r)
- - rect_right(r)
- - rect_bottom(r)
- - These functions return the left, top, right or bottom coordinate, respectively,
-of the given rectangle.
-
-
- - rect_width(r)
- - rect_height(r)
- - These functions return the width or height, respectively, of the given
-rectangle.
-
-
- - rect_topleft(r)
- - rect_botright(r)
- - These functions return the top left or bottom right point, respectively,
-of the given rectangle.
-
-
- - rect_size(r)
- - Returns the size of the given rectangle.
-
-
- - union_rect(r1, r2)
- - Returns the union of the rectangles r1 and r2, i.e. the
-smallest rectangle enclosing both r1 and r2.
-
-
- - sect_rect(r1, r2)
- - Returns the intersection of rectangles r1 and r2.
-
-
- - inset_rect(r, (dx, dy))
- - Returns the rectangle resulting from displacing the sides of the rectangle
- r inwards horizontally by dx and vertically by dy.
-
-
- - offset_rect(r, (dx, dy))
- - Returns the rectangle resulting from displacing the rectangle r horizontally by dx and vertically by dy.
-
-
- - empty_rect(r)
- - Returns true if r is an empty rectangle.
-
-
- - pt_in_rect(p, r)
- - Returns true if the point p is in the rectangle r. A point
-is considered to be in a rectangle if the pixel immediately below and to
-the right of the point is enclosed by the rectangle.
-
- - rects_intersect(r1, r2)
- - Returns true if the intersection of rectangles r1 and r2 is nonempty.
-
-
-
- ---
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Grid.html b/PyGUI-2.5.3/Doc/Grid.html
deleted file mode 100644
index 2302906..0000000
--- a/PyGUI-2.5.3/Doc/Grid.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Grid class
-class Grid(Frame)
A Grid is a container that lays out a collection of components in a two-dimensional grid.
The
-initial size of the container, and the width of each column and height
-of each row, are made just large enough to hold their contents. The
-horizontal and vertical alignment of components within their cells can
-be specified. One row and/or one column may be specified to expand when the Grid is resized.
In addition, the width and/or height of all items may optionally be equalized before they are laid out.
Note: Don't confuse this with the GridView class, which is a view providing a regular grid of user-drawn cells.
Constructor
- Grid(items, keyword = value, ...)
- Creates a Grid containing the specified items, which should be a sequence of rows, each of which is a sequence of Components. An item may be None to leave an empty cell in the grid. The following keyword arguments may be used:
| row_spacing | Vertical space to leave between rows. |
| column_spacing | Horizontal space to leave between columns. |
| padding = (0, 0) | Space to leave horizontally and vertically around all the items. |
| align = 'c' | Alignment of items within cells. A string made up of the letters 'l', 'r', 't', 'b' and 'c' for left, right, top, bottom and centre. |
| equalize = '' | Specifies whether to make the size of all items equal in the horizontal and/or vertical direction. One of 'w', 'h' or 'wh'. |
| expand_row = None | Index
-of a row whose items should change height when the container is
-resized. Items in rows above are anchored to the top of the container,
-and those in rows below are anchored to the bottom. |
| expand_column = None | Index
-of a column whose items should change width whent the container is
-resized. Items in columns to the left are anchored to the left of the
-container, and those in columns to the right are anchored to the right. |
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/GridView.html b/PyGUI-2.5.3/Doc/GridView.html
deleted file mode 100644
index 140206c..0000000
--- a/PyGUI-2.5.3/Doc/GridView.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
-GridView classA
-GridView is a user-defined view structured as a grid of equal-sized
-cells. Abstract methods are provided for drawing the contents of a cell
-and detecting mouse clicks in a cell based on their row and column
-numbers.
Note: Don't confuse this with the Grid class, which is a container for laying out other components in a grid.
The extent of a GridView is managed through the num_rows, num_columns and cell_size properties. The extent property inherited from ScrollableView should not be changed directly.
Constructor
- GridView(num_rows, num_columns, cell_size)
- Creates a grid view whose extent initially covers the specified number of rows and columns.
Properties
- num_rows
- Number of rows in the view's extent.
- num_columns
- Number of columns in the view's extent.
- cell_size
- The size of each cell. A tuple (width, height).
- backcolor
- Color with which to fill the background of a cell before calling draw_cell(), or None for no automatic background fill.
Abstract Methods
- draw_cell(canvas, row_number, column_number, cell_rect)
- Should draw the specified cell inside the given rectangle.
- click_cell(row_number, column_number, event)
- Called when a mouse_down event occurs in a cell.
Methods
- cell_rect(row_number, column_number)
- Returns the rectangle corresponding to the cell at the given row and column numbers.
- cell_containing_point(point)
- Returns a tuple (row_number, column_number) indicating the cell in which the given point lies.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Image.html b/PyGUI-2.5.3/Doc/Image.html
deleted file mode 100644
index 0bba748..0000000
--- a/PyGUI-2.5.3/Doc/Image.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-PyGUI - Image
-
-
-
-
-
-
-
- The Image class represents an RGB image that can be loaded from a file
-and drawn on a Canvas.
-
- On platforms which support it, an Image can have an alpha channel and will
- be rendered with transparency.
- Constructors
-
- - Image(file = filename)
- - Creates an Image from the contents of the given file. The set of
-supported file formats is platform-dependent.
- - Note: The file parameter must be specified using a
-keyword argument.
-
-
---
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ImageBase.html b/PyGUI-2.5.3/Doc/ImageBase.html
deleted file mode 100644
index 9a71ef9..0000000
--- a/PyGUI-2.5.3/Doc/ImageBase.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
-PyGUI - ImageBase class
-class ImageBase
-ImageBase is an abstract base class for 2D images that can be drawn on a Canvas.
-Properties
-
-
- - width
- Read only. The width of the image in pixels.
- - height
- Read only. The height of the image in pixels.
- - size
- Read only. The size of the image in pixels.
- - bounds
- Read only. The bounding rectangle of the image. The
-top left corner will always be (0, 0).
-
-Methods
-
-
- - draw(canvas, src_rect, dst_rect)
- Draws the part of the image specified by src_rect in the
- area of the given Canvas specified by dst_rect. If src_rect
- and dst_rect are different sizes, the image is scaled to fit.
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Label.html b/PyGUI-2.5.3/Doc/Label.html
deleted file mode 100644
index c7e87f4..0000000
--- a/PyGUI-2.5.3/Doc/Label.html
+++ /dev/null
@@ -1 +0,0 @@
-
PyGUI - class Label
class Label(Control)
A Label is a control which displays a piece of static text.
Properties
- text
- The string to display.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Menu.html b/PyGUI-2.5.3/Doc/Menu.html
deleted file mode 100644
index 7ddab29..0000000
--- a/PyGUI-2.5.3/Doc/Menu.html
+++ /dev/null
@@ -1,129 +0,0 @@
-
-PyGUI - class Menu
-
-
-
-
- class Menu
- From the point of view of the PyGUI API, a Menu is a collection of commands
- that the user can invoke. The manner in which these commands are made available
- to the user is platform-dependent, but typically a Menu instance will correspond
- to a pull-down menu in a menu bar.
-
- At any given moment, two sets of menus are available to the user, a set
- of application-wide menus determined by the menus attribute
- of the application object, and a set of window-specific menus determined
- by the menus attribute of the currently active window.
- A menu consists of a sequence of menu items, each of which
- has the following characteristics:
-
- - A label
- - An optional keyboard equivalent
- - An optional check mark
- - An enabled/disabled status
-
- - An internal command name for binding the menu item to an
- action
-
- A menu item can stand alone, or it can be part of an indexed group of items which share the same command name and are distinguished by an integer
- index. Examples of uses for indexed groups include a list of window titles
- in a "Windows" menu, or a list of font names in a "Font" menu.
-
- A menu can also contain separators for dividing items into visual groupings.
-
- The label, keyboard equivalent and command name of a stand-alone menu item
-are established when the menu is created and cannot be changed thereafter,
- other than by discarding the whole Menu instance and creating a new one.
- In contrast, the enabled/disabled status and check mark of each item, and
- the contents of indexed groups, is established dynamically during the setup
- phase of menu command processing. See Menu
- Setup for more information.
-
- When a menu item is invoked by the user, its associated command name is
- sent as a message up the message handling path starting from the current
-target (see Event Handling). If the item
-is part of an indexed group, its index is passed as a parameter of the message.
-
- Properties
-
- - title
- - Read-only. Title of the menu, to appear in the menu bar.
-
-
- Constructor
-
-
- - Menu(title, item_specs)
- - Creates a Menu with the given title and the specified items. The item_specs is a sequence of item specifications, each of which is one of the following:
-
-
- -
- - A MenuItem instance
- - The string '-' (hyphen) representing a separator.
-
- - A tuple (item_descriptor, command_name) representing a stand-alone menu item.
- - A tuple ([item_descriptor, ...], command_name) representing an indexed group of
-menu items.
-
-
-
-
- An item descriptor is a string specifying the item's label, optionally
- ending with '/' (a slash) followed by a keyboard equivalent.
-The keyboard equivalent consists of a basic command character, optionally
-preceded by one or more characters representing additional modifiers beyond
-the platform's standard menu-command modifier key.
-
-
- - The basic command character should be either an uppercase letter,
-a digit, or one of the following characters: `-=[]\;',./
-
-
- - An additional modifier character is one of the following:
-
-
- -
- - ^ (caret), representing the shift key.
- - @ (at-sign), representing a platform-dependent modifier
-key. On the Macintosh it is the Option key; its meaning on other platforms
-is yet to be determined.
-
-
-
-
-Properties
-
-
- - special
- - If true, then this is a menu that, by platform conventions,
-should appear after other (non-special) menus in the menu bar. You
-should probably not change this property yourself; it is used by the
-framework code to achieve proper ordering of the standard menus.
-
-
-
-Methods
-
-
- - append(item)
- - Adds an item to the end of the menu. The item should be an item specification as described above.
-
-
- - extend(items)
- - Adds items to the end of the menu. The items should be a sequence of item specifications as described above.
-
-
- - item_with_command(command_name)
- - Returns the MenuItem having the given command name, or None if there is no such item.
-
-
----
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/MenuItem.html b/PyGUI-2.5.3/Doc/MenuItem.html
deleted file mode 100644
index 0ce82de..0000000
--- a/PyGUI-2.5.3/Doc/MenuItem.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-PyGUI - MenuItem class
-class MenuItem
-A MenuItem represents a menu item or item group.
-
-This class is not very useful yet. You can't construct MenuItems directly; the only way to obtain one is from an existing Menu or MenuList using the item_with_command method, and you currently can't change any of its properties. Facilities for doing these things are planned.
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/MenuList.html b/PyGUI-2.5.3/Doc/MenuList.html
deleted file mode 100644
index 90e6645..0000000
--- a/PyGUI-2.5.3/Doc/MenuList.html
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
- PyGUI - MenuList class
-
-class MenuList(list)
-
-A MenuList is a specialised list subclass for holding Menu instances, for use as the menus
-property of an Application or Window. It provides ways of finding menus
-and menu items by command name, which allows you to modify the standard
-menus without making platform-specific assumptions about their layout.
-
-Methods
-
-
-
- -
- menu_with_command(command_name)
-
- - Returns the Menu containing the item with the specified command name, or None if there is no such menu.
-
-
- - item_with_command(command_name)
- - Returns the MenuItem having the specified command name, or None if there is no such item.
-
-
-
-
-
-
-
-
-
-
-
-
----
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/MessageHandler.html b/PyGUI-2.5.3/Doc/MessageHandler.html
deleted file mode 100644
index 160729e..0000000
--- a/PyGUI-2.5.3/Doc/MessageHandler.html
+++ /dev/null
@@ -1,54 +0,0 @@
-
-PyGUI - class MessageHandler
-
-
-
-
-
-class MessageHandler
-MessageHandler is an abstract base class for objects which
-participate in the message delivery hierarchy. The message delivery
-mechanism is used to handle events such as keystrokes and menu commands
-which are not directed at a particular point on the screen. See Event Handling for more
-information.
-Methods
-
-- handle(msg_name, ...)
-- If there is a method with the same name as the message,
-calls it
-with the message arguments. Otherwise, passes the message to the next
-handler.
- handle_here(msg_name, ...)
- If there is a method with the same name as the message,
-calls it
-with the message arguments. Otherwise, does nothing.
- handle_event(event)
- Equivalent to handle(event.kind, event).
- handle_event_here(event)
- Equivalent to handle_here(event.kind, event).
- pass_to_next_handler(msg_name, ...)
- Calls the handle() method of the next message handler, if any.
- pass_event_to_next_handler(event)
- Equivalent to pass_to_next_handler(event.kind, event).
-- next_handler()
-- Returns the object, if any, to which messages not handled
-by this object should be passed up.
-
-Abstract Methods
-
-
-
-- key_down(event)
-
-- key_up(event)
-- These methods are called in response to keyboard events.
-The default implementations pass the event to the next handler.
-
-- setup_menus(menu_state)
-- During the menu setup phase of menu command processing,
-this method
-is called for all handlers along the message path in reverse order,
-i.e.
-from the Application down to the current target. MessageHandlers should
-use
-this method to enable and otherwise configure any menu items that they
-respond
-to and which are currently valid. See Menu Setup for more
-information.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ModalDialog.html b/PyGUI-2.5.3/Doc/ModalDialog.html
deleted file mode 100644
index eb34022..0000000
--- a/PyGUI-2.5.3/Doc/ModalDialog.html
+++ /dev/null
@@ -1,40 +0,0 @@
-
-PyGUI - ModalDialog class
-
-
-
- class ModalDialog(Dialog)
- The ModalDialog class is a subclass of Dialog
-designed for modal dialogs. It has a default style of 'modal_dialog'
-and provides facilities for presenting the dialog modally.
-
- While a ModalDialog is active, interaction with other parts of the application
-is prevented. Other windows cannot be activated, application-wide menu commands
-other than those used by the dialog itself are not enabled, and unhandled
-events and messages are not forwarded to the application.
- Constructor
-
- - ModalDialog(style = 'modal_dialog',
- - closable = False, resizable = False, zoomable = False,
- - movable = default, hidable = default)
-
Constructs a ModalDialog with the specified options. The default values
-for the movable and hidable options are platform-dependent.
-
-
- Methods
-
- - present()
- - Present the dialog modally. The dialog is shown and a nested event
-loop is entered which prevents interaction with any other part of the application.
-This method retains control until the dialog's dismiss() method is
-called. The dialog is then hidden and the present() method returns with the value passed to dismiss().
-
-
-
-
- - dismiss(result = 0)
- - Hides the dialog and, if the dialog is being presented modally, causes the present() method to return with the given result as its return value.
- ok()
- Dismisses the dialog with the value True. By default, this method is called in response to pressing a DefaultButton or a Return/Enter key event.
- cancel()
- Dismisses the dialog with the value False. By default, this method is called in response to pressing a CancelButton or an Escape key event.
-
-
- ---
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Model.html b/PyGUI-2.5.3/Doc/Model.html
deleted file mode 100644
index dfb9592..0000000
--- a/PyGUI-2.5.3/Doc/Model.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
- Model class
-
- class Model(Properties)
- A Model represents an application data structure which can have observers.
-The observers are typically subclasses of View, but need not be. Class Model
-provides mechanisms for attaching and removing observers, and for notifying
-observers when the Model changes.
A Model can have another Model or Document as a parent. When you call the changed()
-method of a Model, the call is propagated to its parent, if any. If the
-Model is ultimately contained in a Document, that Document will then be
-marked as needing to be saved.
Pickling behaviour
Models
-are designed to be pickled as a convenient way of saving and restoring
-the state of a Document. There are two ways in which class Model
-provides special support for pickling.
- The link
-between a Model and its observers is maintained outside the Model
-object, so that the observers will not be pickled along with the Model.
- There
-is a mechanism to prevent the parent object of a Model from being
-pickled when it would not be appropriate to do so. By default, this
-mechanism is used to prevent a Document reached via the parent
-attribute of a Model from being pickled. This is important, because
-normally you only want to save the contents of a Document, not the
-Document object itself. Furthermore, the Document contains references
-to the Application and all of the Windows attached to it, so pickling
-the Document would result in attempting to pickle almost the entire
-state of the application.
The mechanism involves looking for an attribute called pickle_as_parent_model on the object referenced by the model's parent attribute. If that attribute exists and has a false value, then the parent attribute is omitted from the pickled state of the Model. Class Document has a pickle_as_parent_model attribute that defaults to False (and you should not change it).
A
-consequence is that the parent link from a Model to a containing
-Document is not automatically restored. You will need to set it
-yourself after unpickling in the Document's read_contents() method.
Constructor
- Model(parent = None)
- Creates a Model with the specified parent.
Properties
-
- - views
- - List of objects which are observing this Model. Do not modify this
-list directly; use the add_view and remove_view methods
-to add and remove observers.
-
-
- Attributes
- parent
- Containing Model or Document, if any.
Methods
-
- - add_view(view)
- - Adds the given object as an observer of this Model. If the object
-defines an add_model method, it is called with this Model as argument.
-
-
- - remove_view(view)
- - Removes the given object as an observer of this Model. If the object
-defines a remove_model method, it is called with this Model as argument.
-
-
- - notify_views(message = 'model_changed', ...)
- - Calls a method of each observer with the same name as the message,
-passing it any additional arguments.
- changed()
- If the Model is contained in a Document, mark the Document as needing to be saved.
-
-
- Pickle protocol
- __getstate__()
__setstate__(state) - These methods implement the special treatment of the parent attribute when pickling. The __getstate__ method returns a possibly-modified version of the Model's __dict__, and the __setstate__ method restores it. If you implement your own custom pickling behaviour, you should build on these methods.
Destructor
-
- - destroy
- - Dissociates the Model from any attached observers, and calls the
- model_destroyed method of each observer which defines it.
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Numerical.html b/PyGUI-2.5.3/Doc/Numerical.html
deleted file mode 100644
index 5ff24a6..0000000
--- a/PyGUI-2.5.3/Doc/Numerical.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-Numerical modulemodule Numerical
The Numerical module provides some facilities for interfacing with NumPy.
Functions
- image_from_ndarray(array, format, size = None)
- Creates an Image from a NumPy array of type uint8. The format may be 'RGB' or 'RGBA'. If a size is specified, it should be a tuple (width, height),
-and the array will be implicitly reshaped to match the specified size
-and format. Otherwise the array must have 3 dimensions, the size is
-inferred from the first two dimensions of the array, and the third
-dimension must match the number of bytes required by the format.
If
-possible, the returned Image will share data with the original array,
-but this is not guaranteed. The effect of modifying the array after
-creating the image is undefined.
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/PIL.html b/PyGUI-2.5.3/Doc/PIL.html
deleted file mode 100644
index 8f75612..0000000
--- a/PyGUI-2.5.3/Doc/PIL.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-PIL module
-module PIL
The PIL module provides some facilities for interfacing with the Python Imaging Library.
Functions
- image_from_pil_image(pil_image)
- Creates an Image from a PIL image object.
- Supported PIL image modes
Modes "RGB" and "RGBA" are
-supported on all platforms. - Mode "P" (indexed) is not supported on any
-platform.
- Other modes may or may not be supported.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/PageSetup.html b/PyGUI-2.5.3/Doc/PageSetup.html
deleted file mode 100644
index 14f35a2..0000000
--- a/PyGUI-2.5.3/Doc/PageSetup.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-PageSetup class
-class Printing.PageSetup
An instance of the PageSetup class is used to hold the information specified by the Page Setup command, such as margins, paper size and orientation.
The
-Application object maintains a default PageSetup instance in its
-page_setup property, and provides a default implementation of the Page
-Setup command which edits it. When a view prints itself in response to
-the Print command, if it can't obtain a PageSetup object from its associated model, it uses the one from the Application.
There
-is no provision for saving the Application's PageSetup object; its
-settings are retained only as long as the application runs. If you want
-page setup information saved with your document, you should attach a
-PageSetup object of your own to it and save it along with your
-document's data (see below).
You can explicitly invoke a Page Setup dialog for a specific PageSetup object using the present_page_setup_dialog() function.Saving page setup information
PageSetup
-objects are pickleable, to facilitate saving and restoring them. This
-method is recommended, rather than saving its properties individually,
-because pickled PageSetup objects retain platform-dependent information
-that may not be exposed through the generic properties. If you
-pickle a PageSetup object and later restore it on the same platform,
-all of the platform-specific information will be preserved.
The
-generic properties are also saved in a platform-independent way,
-so that if you unpickle it on a different platform, the most important
-attributes ought to come across as best they can.
There are also from_string() and to_string()
-methods which take and return a pickled representation as a string. You
-may find these more convenient if you are using a non-pickle-based file
-format.
Constructor
- PageSetup()
- Creates a PageSetup object with default settings.
Properties
- paper_name
- A string describing the paper size, such as "A4" or "Letter".
- paper_size
- A tuple (width, height) giving the size of the paper in points.
- orientation
- One of 'portrait' or 'landscape'.
- printer_name
- The name of the printer for which the page setup has been created.
- left_margin
top_margin
right_margin
bottom_margin - Distances from the edge of the paper to the printed area.
- margins
- A tuple containing the four margin values.
- page_width
page_height
page_size - The size of the printed area. This is equal to the paper size minus the margins.
- page_rect
- A
-rectangle representing the printed area. The origin of the coordinate system is at the
-top left corner of the page.
Class Methods
- from_string(string)
- Creates a PageSetup object from a string returned by the to_string() method.
Methods
- to_string()
- Returns a string-encoded representation suitable for passing to from_string().
Related Functions
- Printing.present_page_setup_dialog(page_setup)
- Presents a Page Setup
-dialog box for the specifed PageSetup object and allows the user to
-edit it. If the user accepts the changes, true is returned. Otherwise,
-the PageSetup object is unaltered and false is returned.
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/PaletteView.html b/PyGUI-2.5.3/Doc/PaletteView.html
deleted file mode 100644
index 398c164..0000000
--- a/PyGUI-2.5.3/Doc/PaletteView.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-PaletteView classclass PaletteView(GridView)
A
-PaletteView is a specialised subclass of GridView designed for
-implementing tool palettes and other such components. Instead of row
-and column numbers, the cells in a PaletteView are identified by a
-single integer index, called an item number, with items being numbered from left to right, top to bottom.
The PaletteView also has a notion of one or more items being selected, and provides support for highlighting selected items in a variety of ways.
PaletteView inherits from ScrollableView and can therefore be made scrollable if needed, although it does not show any scroll bars by default.
The extent of a PaletteView is managed through the num_items, items_per_row and cell_size properties. The num_rows and num_columns properties inherited from GridView, and the extent property inherited from ScrollableView, should not be changed directly.
Constructor
- PaletteView(num_items, items_per_row, cell_size)
- Creates a palette view with the specified initial property values.
Properties
- num_items
- Total number of items in the palette. The items will be laid out with items_per_row items in each row, using as many rows as necessary. If num_items is not an even multiple of items_per_row, some cells in the last row will be left empty.
- items_per_row
- The number of items in each row of the palette's extent.
- highlight_style
- The style in which to highlight selected items. Possible values are:
- 'fill' - the cell is filled with the highlight_color before calling draw_item().
- 'frame' - a rectangle is drawn around the cell as specified by highlight_color and highlight_thickness before calling draw_item().
- '' or None - no automatic highlighting is performed.
- highlight_color
- Color to use for highlighting of selected items.
- highlight_thickness
- When using the 'frame' highlight style, the pen width to use for drawing the highlight rectangle.
Abstract Methods
- draw_item(canvas, item_number, item_rect)
- Should draw the specified item in the given rectangle. Any automatic highlighting specified by the highlight_style property has already been applied.
- click_item(item_number, event)
- Called when a mouse_down event occurs in an item.
- item_is_selected(item_number)
- Should return true if the indicated item is to be regarded as selected.
- draw_item_and_highlight(canvas, item_number, item_rect, highlight)
- This method can optionally be overridden instead of draw_item()
-to gain more control over how items are highlighted. Your
-implementation should draw the specified item, and apply highlighting
-if highlight is true. If you override this method, draw_item() is not called and no automatic highlighting is performed.
Methods
- item_rect(item_number)
- Returns the rectangle corresponding to the given item number. If the item number is out of bounds (less than 0 or greater than num_items - 1), returns None.
- item_no_of_cell(row_number, column_number)
- Returns the item number corresponding to the specified cell, or None if the cell does not correspond to a valid item.
- cell_of_item_no(item_number)
- Returns the row and column numbers of the cell corresponding to the given item number. If the item number is out of bounds (less than 0 or greater than num_items - 1), returns None.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Pixmap.html b/PyGUI-2.5.3/Doc/Pixmap.html
deleted file mode 100644
index 36feeab..0000000
--- a/PyGUI-2.5.3/Doc/Pixmap.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-PyGUI - Class Pixmap
-
-
-
-
-
-A Pixmap is an offscreen area that can be used both as a destination for
-drawing and a source of image data for drawing in a View or another Pixmap.
-Constructor
-
-
- - Pixmap(width, height)
- - Creates a new, empty Pixmap with the given width and height.
-
-
Methods
- with_canvas(proc)
- - Calls the given procedure with a Canvas
-suitable for drawing on this Pixmap. The canvas is valid only for the duration
-of the call, and should not be retained beyond it.
-
-
----
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Printable.html b/PyGUI-2.5.3/Doc/Printable.html
deleted file mode 100644
index 18ffa35..0000000
--- a/PyGUI-2.5.3/Doc/Printable.html
+++ /dev/null
@@ -1,21 +0,0 @@
-
-Printable class
-class Printing.Printable
Printable is an abstract base class for components that provide an implementation of the Print command.
If
-enabled for the instance concerned, components inheriting from this
-class will automatically enable the Print command and will print
-themselves in response to it.
Printing behaviour is controlled by the printable
-property. Setting this property to false causes the Print command to be
-ignored and passed on to the Document or Application. You may need to
-do this if you want your document to be printed in a different way than
-it appears on screen. See the Printing topic for more information.
Printable components in the PyGUI framework include View, ScrollableView and TextEditor.
Note:
-The Printable class is designed for internal use by the PyGUI framework
-only; you should not inherit directly from it yourself. To implement a
-printable view, base it on one of the concrete component classes listed
-above.
Properties
- printable
- If true, the Print command is handled by this component, otherwise it is passed on to the next handler. Defaults to true.
- page_setup
- Read only. The PageSetup instance to be used when printing this component. By default, a page_setup attribute is looked for on the associated model, if any. If there is no model, or it does not have a page_setup attribute,
-or its value is None, the application's default PageSetup instance is
-used. You can customise this behaviour by overriding the get_page_setup() method.
- print_title
- Read only.
-Title to use for print jobs. The usage of this property is
-platform-dependent. Defaults to the title of the containing Window. You
-can customise it by overriding the get_print_title() method.
Methods
- print_cmd()
- Implements the standard Print command by calling print_view() with the value of the page_setup property.
- print_view(page_setup, prompt = True)
- Prints the contents of the component using the specified PageSetup object. If prompt
-is true, a printing dialog is first displayed, otherwise the printing
-operation is started immediately without user interaction.
Abstract Methods
- get_page_setup()
- Override this to customise the way the PageSetup object is obtained when handling the Print command.
- get_print_title()
- Determines the value of the print_title property.
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/RadioButton.html b/PyGUI-2.5.3/Doc/RadioButton.html
deleted file mode 100644
index e0256f2..0000000
--- a/PyGUI-2.5.3/Doc/RadioButton.html
+++ /dev/null
@@ -1 +0,0 @@
-
PyGUI - RadioButton
class RadioButton(Control)
A RadioButton is similar to a CheckBox, except
that RadioButtons are typically arranged in mutually-exclusive groups, so
that only one member of a group is on at a time. The appearance of
a RadioButton may differ from that of a CheckBox, depending on platform conventions.
The RadioGroup class is used to coordinate
the behaviour of a group of RadioButtons. Unlike CheckBoxes, RadioButtons
do not have individual on or action properties; the function
of these is performed by the RadioGroup to which the radio buttons belong.
Properties
- title
- Title string to display beside the radio button.
- group
- The RadioGroup instance to which this
button belongs.
- value
- Value associated with this RadioButton. If attached to a RadioGroup, when the button is selected the value
of the group will be set to this value.
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/RadioGroup.html b/PyGUI-2.5.3/Doc/RadioGroup.html
deleted file mode 100644
index fe0ce2f..0000000
--- a/PyGUI-2.5.3/Doc/RadioGroup.html
+++ /dev/null
@@ -1,62 +0,0 @@
-
-PyGUI - class RadioGroup
-
-
-
- class RadioGroup
- A RadioGroup is used to coordinate the activity of a group of RadioButtons. It ensures that only one of the
-RadioButtons is on at a time, and provides a value property which
-is equal to the value of the currently selected RadioButton. It
-also provides an action property which is invoked when the user
-changes the selection.
-
-You can iterate over the RadioButtons contained in a RadioGroup, which means you can use a RadioGroup directly in the place_row and place_column methods of a container.
-
-
- Properties
-
-
- - value
- - The value of the currently selected RadioButton. Setting this property
- updates the states of the RadioButtons accordingly.
-
-
-
-
- - action
- - Action to perform when the value changes as a result of the user
-clicking on a radio button.
-
-
- Constructor
-
-
- - RadioGroup(items)
- - Constructs a RadioGroup containing the given list of RadioButtons.
-
-
- Methods
-
-
- - add_item(item)
add_items([item, ...])
- - Adds one or more RadioButtons to this group.
-
-
-
-
- - remove_item(item)
remove_items([item, ...])
- - Removes one or more RadioButtons from this group.
-
-
-
-Operations
-
- - iter(group)
- - Returns an iterator over the RadioButtons contained in the group.
-
-
----
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Resources.html b/PyGUI-2.5.3/Doc/Resources.html
deleted file mode 100644
index 7e3ecd3..0000000
--- a/PyGUI-2.5.3/Doc/Resources.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-PyGUI - Resources
-
-module Resources
-A resource is a file
-containing information used by the application that is bundled with the
-application. PyGUI provides some functions for locating resources by
-looking in certain standard places for them.
-
-A resource is specified by a resource name. This is a relative pathname using '/' as a directory separator on all platforms. A resource specification may also include a type, which is a filename suffix (excluding the dot) to be appended to the resource name.
-
-The standard locations searched for resources are as follows:
-
-
-
-
- Search Order
- |
- MacOSX applications created with Py2App
- |
- Other platforms
- |
-
-
- 1. Application resources
- |
- The Resources directory in the application bundle.
- |
- A directory called Resources in the same directory as the application's main Python code file or its parent directory.
- |
-
-
- 2. PyGUI standard resources
- |
- A platform-dependent location within the PyGUI installation.
- |
-
-
-
-
-Global Functions
-
- - find_resource(name, type = None)
- - Searches for the named resource and returns the full pathname of the first matching file found on the search path. If type is specified, it is appended to the name with a dot between, after removing any existing dot-suffix from the name. The type itself should not contain a dot. If no matching file is found, ResourceNotFoundError is raised.
-
-
- - lookup_resource(name, type = None)
- - Searches for a resource as per find_resource, but if the resource is not found, None is returned instead of raising an exception.
- get_resource(loader, name, type = None, default = None, **kwds)
- Finds a resource and loads it using the specified loader function. The loader is called as loader(path, **kwds) where path
-is the full pathname of the resource. The loaded resource is cached,
-and subsequent calls referencing the same resource will return the
-cached value. If the resource is not found, the specified default is returned if any, otherwise ResourceNotFoundError is raised.
-
-Global Variables
-
-
-- resource_path
- A list of directory names to search for resources. This is
-initialised on startup to include the standard locations for PyGUI
-application resources. You can insert additional directories in this
-list to customise the search path.
-
-
-Exceptions
-
- - ResourceNotFoundError
- - Raised by find_resource when a resource cannot be found.
-
-
----
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Row.html b/PyGUI-2.5.3/Doc/Row.html
deleted file mode 100644
index 900df6d..0000000
--- a/PyGUI-2.5.3/Doc/Row.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-Row class
-class Row(Frame)
A Row is a container that lays out a collection of components in a horizontal row.
The
-initial size of the container is made just big enough to hold its
-contents. The vertical alignment of items within the row may be
-specified, and one item may optionally be designated to expand
-horizontally when the container is resized.
In addition, the width and/or height of all items may optionally be equalized before they are laid out.
Constructor
- Row(items, keyword = value, ...)
- Creates a Row containing the specified items, which should be a sequence of Components. The following keyword arguments may be used:
| spacing = 10 | Horizontal space to leave between items. |
| padding = (0, 0) | Space to leave horizontally and vertically around all the items. |
| align = 'c' | Specifies vertical alignment and anchoring of items. One of 't', 'c', 'b' or 'tb' for top, centre, bottom or top-and-bottom. |
| equalize = '' | Specifies whether to make the size of all items equal in the horizontal and/or vertical direction. One of 'w', 'h' or 'wh'. |
| expand = None | Specifies
-which item, if any, is to change size horizontally when the container
-is resized. May be the item itself or an index into the item list.
-Items to the left of this item will be anchored to the left of
-the container, and items to the right will be anchored to the
-right of the container.
If specified by an index, the item at that index may be None to leave an expanding space in the row. |
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ScrollableView.html b/PyGUI-2.5.3/Doc/ScrollableView.html
deleted file mode 100644
index 8a30169..0000000
--- a/PyGUI-2.5.3/Doc/ScrollableView.html
+++ /dev/null
@@ -1,46 +0,0 @@
-
-ScrollableView class
-
-
-A ScrollableView is a View with support for scrolling.
-Properties
-
- - scrolling
- - A string containing 'h' to enable horizontal scrolling and 'v' to enable vertical scrolling.
-
-
- - hscrolling
- - True if horizontal scrolling is enabled.
-
-
- - vscrolling
- - True if vertical scrolling is enabled.
-
-
- - extent
- - Tuple (width, height) defining the size of the scrollable area.
-
-
- - scroll_offset
- - Tuple (dx, dy) representing the difference in local coordinates between
- the top left corner of the view's bounds and the top left corner of the
- extent. Assigning to this property will cause the view to scroll. The value
- is clamped to the allowable scrolling range, as determined by the current
- bounds and extent.
-
-
- - line_scroll_amount
- - Tuple (dh, dv) representing the size of a "line" in each direction
- for scrolling purposes.
- background_color
- Color with which to fill any visible area of the view that lies outside the extent, or None to suppress automatic background drawing. When a background color is specified, the update_rect passed to the draw() method is clipped to exclude areas outside the extent.
Note: On MacOSX, it is impossible to draw outside the view's extent even when the background color is set to None.
-
-Methods
-
-- scroll_by(dx, dy)
- Scrolls the view by the given horizontal and vertical amounts, within
- the limits defined by the extent.
- - scroll_line_left()
- scroll_line_right()
- scroll_line_up()
- scroll_line_down()
- Scrolls the view by one line in the specified direction, as determined
- by the line_scroll_amount property.
- - scroll_page_left()
- scroll_page_right()
- scroll_page_up()
- scroll_page_down()
- Scrolls the view by one page in the specified direction. The size
- of a page is equal to the size of the viewed rectangle minus the line_scroll_amount.
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ShareGroup.html b/PyGUI-2.5.3/Doc/ShareGroup.html
deleted file mode 100644
index 5c3b361..0000000
--- a/PyGUI-2.5.3/Doc/ShareGroup.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-PyGUI - class GL.ShareGroup
-
-class GL.ShareGroup
-A ShareGroup represents a set of OpenGL contexts (GLViews or GLPixmaps) that are sharing textures and display lists.
-
-To set up a group of shared OpenGL contexts, you first create a ShareGroup, then you pass it as the share_group parameter when constructing the GLViews and GLPixmaps that you want to be members of the group.
-
-You can iterate over the members of a ShareGroup, and you can use the
-in operator to test whether a given GLView or GLPixmap is a member of
-the group. However, you can't explicitly add or remove members. A
-member can only be added by creating in the manner described above, and
-it is automatically removed from the group when it is no longer
-referenced elsewhere.
-Constructor
-
- - ShareGroup()
- - Creates a new share group.
-
-Operations
-
- - iter(share_group)
- - Returns an iterator over the members of the group (GLViews or GLPixmaps).
-
-
- - obj in share_group
- - Tests whether obj is a member of the share group.
-
---
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Slider.html b/PyGUI-2.5.3/Doc/Slider.html
deleted file mode 100644
index 4df8595..0000000
--- a/PyGUI-2.5.3/Doc/Slider.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-PyGUI - class Slider
-
-A Slider is a control that allows a user to select a value by dragging
-a knob along a scale. The range of values may be either discrete or
-continuous, and an action may be specified to be invoked whenever the
-user changes the value.
-Constructor
-
-
- - Slider(orient)
- - Constructs a Slide with the specified orientation, 'h' for horizontal and 'v' for vertical.
-Note: On some platforms, the orientation of the slider is determined by
-its relative width and height; on such platforms, the orient parameter
-is ignored. For maximum portability, ensure that the dimensions of the
-control and the orient parameter are in agreement with each other.
-
-
-Properties
-
-
- - value
- - The current value of the slider.
-
-
- - min_value
- max_value
- - The minimum and maximum values to which the slider can be set. These default to 0.0 and 1.0.
-
-
- - action
- - Action to perform when the user changes the value of the slider. See Actions.
-
-
- - ticks
- - The number of tick marks to display beside the slider, including
-the ones at each end. If this is set to 0, no tick marks will be
-displayed. The default is not to show any tick marks.
-
-
- - discrete
- - If true, the value of the control is constrained to correspond to one of the tick marks specified with the ticks property. If false, the value may be set to anything between the min_value and max_value. The default is false.
-
-
- - live
- - If true, the slider's action will be invoked continuously while
-the knob is being dragged. If false, the action will only be invoked
-when the mouse is released. The default is true.
-
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/StdColors.html b/PyGUI-2.5.3/Doc/StdColors.html
deleted file mode 100644
index 955a448..0000000
--- a/PyGUI-2.5.3/Doc/StdColors.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- StdColors
-
-module StdColors
-The StdColors submodule provides the following predefined Color instances.
-Global Names
-black
- dark_grey
- grey
- light_grey
- white
-
- red
- green
- blue
- cyan
- magenta
- yellow
- selection_forecolor
- Foreground colour for highlighting selected items.
- selection_backcolor
- Background colour for highlighting selected items.
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/StdCursors.html b/PyGUI-2.5.3/Doc/StdCursors.html
deleted file mode 100644
index 3730c38..0000000
--- a/PyGUI-2.5.3/Doc/StdCursors.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-StdCursors
-
-module StdCursors
-The StdCursors submodule provides a number of predefined Cursor instances.
-Global Names
-
-
- | Name | | Description | | Availability |
- arrow
- |
-
- |
- Standard arrow cursor
- | | All platforms |
-
-
- ibeam
- |
-
- |
- Text-editing cursor
- | | All platforms |
-
-
- crosshair
- |
-
- |
- Thin cross-hairs
- | | All platforms |
-
-
- fist
- |
-
- |
- A hand with the fingers closed
- | | All platforms |
-
-
- hand
- |
-
- |
- A hand with the fingers open
- | | All platforms |
-
-
- finger
- |
-
- |
- A hand with a pointing finger
- | | All platforms |
-
| invisible | | An empty cursor | | All platforms |
- | wait | | Hourglass | | Windows |
| up_arrow | | Upward pointing arrow | | Windows |
| size_all | | Four-pointed arrow | | Windows |
| size_w_e | | Horizontal two-headed arrow | | Windows |
| size_n_s | | Vertical two-headed arrow | | Windows |
| size_nw_se | | Two-headed arrow from top left to bottom right | | Windows |
| size_ne_sw | | Two-headed arrow from bottom left to top right | | Windows |
-
-
---
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/StdFonts.html b/PyGUI-2.5.3/Doc/StdFonts.html
deleted file mode 100644
index 62ee964..0000000
--- a/PyGUI-2.5.3/Doc/StdFonts.html
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- StdFonts
-
-
-StdFonts submodule
-The StdFonts submodule provides the following predefined Font instances.
Global Names
-
- - system_font
- - Default font for user interface elements such as menu items and control
-titles.
-
-
- - application_font
- - Default font for text entered and edited by the user.
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/StdMenus.html b/PyGUI-2.5.3/Doc/StdMenus.html
deleted file mode 100644
index f5e4d3c..0000000
--- a/PyGUI-2.5.3/Doc/StdMenus.html
+++ /dev/null
@@ -1,269 +0,0 @@
-
-
-StdMenus
-
-
-
-module StdMenus
-The StdMenus submodule provides facilities for creating menu bars
-containing standard menus and menu commands arranged according to
-platform conventions. The menus can be customised in a variety of ways:
-items can be included or excluded individually or by functional group,
-and the titles and keyboard equivalents of selected items can be
-overridden.
-Standard menu items
-The standard menu commands and their associated command names
-are as follows:
-
-
-
-
-Typical menu text
- |
-
- |
-Internal command name
- |
-
-
-
-General commands
- |
-
-
-About app_name
- |
-
- |
-about_cmd
- |
-
-
-| Help |
- |
-help_cmd |
-
-
-Preferences...
- |
-
- |
-preferences_cmd
- |
-
-
-Quit
- |
-
- |
-quit_cmd
- |
-
-
-
-File commands
- |
-
-
-New
- |
-
- |
-new_cmd
- |
-
-
-Open...
- |
-
- |
-open_cmd
- |
-
-
-Close
- |
-
- |
-close_cmd
- |
-
-
-Save
- |
-
- |
-save_cmd
- |
-
-
-Save As...
- |
-
- |
-save_as_cmd
- |
-
-
-Revert
- |
-
- |
-revert_cmd
- |
-
-
-
-Editing commands
- |
-
-
-Undo
- |
-
- |
-undo_cmd
- |
-
-
-Redo
- |
-
- |
-redo_cmd
- |
-
-
-Cut
- |
-
- |
-cut_cmd
- |
-
-
-Copy
- |
-
- |
-copy_cmd
- |
-
-
-Paste
- |
-
- |
-paste_cmd
- |
-
-
-Clear
- |
-
- |
-clear_cmd
- |
-
-
-Select All
- |
-
- |
-select_all_cmd
- |
-
-
-
-Command Groups
-To facilitate including or excluding groups of
-related commands, the StdMenus module provides the following predefined
-command sets that can be used to build values for the include and exclude
-parameters of the basic_menus()
-function.
-
-
-
-
-| Group |
- |
-Commands included |
-
-
-| fundamental_cmds |
- |
-quit_cmd
-May also include platfom-specific commands that are common to all
-applications. |
-
-
-| file_cmds |
- |
-new_cmd,
-open_cmd, close_cmd, save_cmd, save_as_cmd, revert_cmd |
-
-
-| print_cmds |
- |
-page_setup_cmd,
-print_cmd |
-
-
-| pref_cmds |
- |
-preferences_cmd |
-
-
-| help_cmds |
- |
-about_cmd,
-help_cmd |
-
-
-
-
-Functions
-
-- basic_menus(include = None,
-exclude = None, substitutions = {})
-- Returns a MenuList containing selected framework-defined
-menu
-commands, arranged and named according to platform conventions. It is
-recommended that you use this as a starting point for defining your own
-menu bars.
-
-The include
-and exclude
-parameters determine which of the standard menu items are included.
-Each of them can take either a single command name or a sequence or set
-of command names. The menu bar returned will include all of the
-standard menu items whose command names are in include and not
-in exclude.
-
-If include
-is not specified, it defaults to all of the standard commands. - The fundamental_cmds
-and edit_cmds
-are always included unless you explicitly exclude them via the exclude
-parameter.
-
-The substitutions
-parameter can be used to override the titles and/or keyboard
-equivalents of selected menu items. It takes a mapping from command
-names to replacement menu item strings as accepted by the Menu()
-constructor. Each item string may contain a replacement title, a
-replacement keyboard equivalent, or both, with standard values being
-used for the unspecified parts.
-
-Variables
-
-- fundamental_cmds
-file_cmds
-print_cmds
-pref_cmds
-help_cmds
-- Predefined CommandSet instances containing groups of
-standard command names.
-
----
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Task.html b/PyGUI-2.5.3/Doc/Task.html
deleted file mode 100644
index 31c15e4..0000000
--- a/PyGUI-2.5.3/Doc/Task.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-PyGUI - Class Task
-class Task
-A Task enables you to schedule code to be executed after a specified period of time, either once or repeatedly.
-
-Tasks are intended for applications in which accuracy of timing is not
-critical. Tasks are synchronised with the event loop, so if your
-application is busy processing an event when a Task becomes ready to
-execute, it will be delayed until processing of the event as finished.
-Also, on some platforms, Tasks might not run while a menu is being
-pulled down or other controls are being interacted with.
-Constructor
-
- - Task(proc, interval, repeat = False, start = True)
- - Creates a task which will execute the proc after interval seconds. If repeat is true, the task will continue to fire repeatedly every interval seconds, otherwise it will fire only once and then stop. If start is true, the task's timer will be started immediately, otherwise the task will remain dormant until it is activated using the start() method.
-
-Arbitrary fractions of a second may be specified for interval, although granularity of timing is platform-dependent.
-
-
-Properties
-
- - scheduled
- - Read only Returns true if the task has been scheduled to run by calling the start() method or passing true to the start parameter of the constructor.
-
-Methods
-
- - start()
- - Schedules the task for execution and starts its timer. If the task was already scheduled, or was previously unscheduled using stop() part way through a timing period, the time period is started anew.
-
-
- - stop()
- - Stops the task's timer and unschedules it. The task will remain dormant until start() is called again.
-
-
---
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/TextEditor.html b/PyGUI-2.5.3/Doc/TextEditor.html
deleted file mode 100644
index c428812..0000000
--- a/PyGUI-2.5.3/Doc/TextEditor.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-TextEditor class
-A TextEditor
-provides efficient editing of large amounts of text.
There may optionally be horizontal and/or vertical scroll bars. If there is no horizontal
-scroll bar, text is wrapped to the width of the component.
Tab stops may be set at regularly-spaced intervals.
Constructor
- TextEditor(scrolling = 'hv')
- Creates a TextEditor. Presence of scroll bars is controlled by the
-scrolling parameter, which is a string containing 'h' for horizontal
-and 'v' for vertical.
Properties
- text
- The text being edited, as a string.
- text_length
- Read only. The number of characters in the text
- selection
- A tuple of indexes (start, end) representing the range of selected characters.
- font
- The Font in which the text is displayed.
- tab_spacing
- Distance between tab stops.
Methods
- select_all()
- Selects all of the text.
- cut_cmd()
- copy_cmd()
- paste_cmd()
- clear_cmd()
select_all_cmd() - These implement the standard editing menu commands. The corresponding
- menu items are enabled automatically whenever the component has the keyboard
- focus.
-
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/TextField.html b/PyGUI-2.5.3/Doc/TextField.html
deleted file mode 100644
index 873e086..0000000
--- a/PyGUI-2.5.3/Doc/TextField.html
+++ /dev/null
@@ -1,73 +0,0 @@
-
-TextField class
-
-
-
- class TextField(Control)
- A TextField is a simple single or multi-line text entry area. All
- text in the field is displayed with the same attributes such as font, color and justification.
- Properties
-
-
- - text
- - Contents of the text field.
-
-
-
-
- - selection
- - A pair (start, end) indicating the starting and ending character
- positions of the selection. Character positions occur between characters
- and are numbered from 0.
-
- Note: This property is
-only valid when the text field is the current target. Setting this
-property causes the text field to become the target, and the result of
-reading it when the text field is not the target is undefined.
-
-
-
-
-
- - multiline
- - Initialize only. A boolean indicating whether multiple lines
- can be entered. If false, newline characters typed by the user are not
-entered into the text but are passed on to the next handler.
-
-
- - password
- - Initialize only. A boolean indicating that the text is to
-be displayed in an obfuscated manner, as for entering a password.
-
-
- - Note: On some platforms, it may not be possible to combine
- this with the multiline option.
Action Properties
- enter_action
- Action
-to perform when the Return or Enter key is pressed. (Multiline text
-fields only perform this action when the Enter key on the numeric
-keypad is used.) The default is 'default_action'.
- escape_action
- Action to perform when the Escape key is pressed. The default is 'cancel_action'.
-
-
- Methods
-
-
- - select_all()
- - Selects all of the text and makes the text field the current target.
-
-
-
- - cut_cmd()
- - copy_cmd()
- - paste_cmd()
- - clear_cmd()
- - These implement the standard editing menu commands. The corresponding
- menu items are enabled automatically whenever the text field has the keyboard
- focus.
-
-
- ---
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Texture.html b/PyGUI-2.5.3/Doc/Texture.html
deleted file mode 100644
index 48739c3..0000000
--- a/PyGUI-2.5.3/Doc/Texture.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-PyGUI - GL.Texture class
-
-
-
-class GL.Texture
-The Texture class in the GL submodule provides a context-independent
-representation of an OpenGL texture. You can use a single Texture
-object with multiple GLViews and/or GLPixmaps without being concerned
-whether they are sharing texture spaces or not, and without having to
-keep track of OpenGL texture numbers.
-
-Texture is an abstract class. To use it, you subclass it and define the
-do_setup
-method to make whatever OpenGL calls are necessary to set up the
-texture. Then, when you want to draw with the texture, you call the bind
-method to make it the current OpenGL texture. Whenever the Texture is
-used in a context where it has not been used before, your do_setup method
-will be called to create a representation of the texture appropriate to
-that context.
-
-Keep in mind that any call to bind
-can trigger allocation of a texture number and a call to your do_setup
-method, and this will usually happen while you are in the middle of
-doing OpenGL drawing. If this would be inconvenient, you may need to
-"preload" the texture by calling the bind method
-once in each context where the texture might be used, before you start
-drawing.
-Constructor
-
-
-- Texture(texture_type)
-- Constructs a texture of the given type. The texture_type should
-be one of the OpenGL texture type constants (GL_TEXTURE_2D etc).
-
-
-
-Methods
-
-
-- bind()
-- Makes this
-texture the current texture for the current context by calling
-glBindTexture. If this texture has not previously been used
-with the current context (or one with which it is sharing
-textures), an OpenGL texture number is allocated and do_setup is
-called to initialise a representation of the texture.
- gl_id()
- Returns
-the OpenGL texture number corresponding to this texture in the current
-context. May trigger allocation of a new texture and a call to do_setup().
-Does not bind the texture, unless a new texture is allocated, in which
-case the current texture binding may be changed as a side effect.
- gl_tex_image_2d(image, target = GL_TEXTURE_2D, internal_format = GL_RGBA,
border = False, with_mipmaps = False) - Loads the currently bound texture with data from an Image. You will typically call this from your do_setup() method to load the texture data. The image size is scaled up to a power of 2 if necessary. If border is true, the image will be assumed to have a 1-pixel wide border. If with_mipmaps is true, a set of mipmaps will be generated using gluBuild2DMipmaps. Note: border and with_mipmaps cannot both be true.
-- deallocate()
-- Deallocates any OpenGL resources currently allocated to the
-Texture. If it is used again, new resources will be allocated.
-
-
-
-Abstract methods
-
-
-- do_setup()
-- This method should be implemented to make the necessary
-OpenGL
-calls to initialise the texture. When this method is called, a texture
-number will already have been allocated and glBindTexture
-called to make it the current texture.
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ToDo/Picture.html b/PyGUI-2.5.3/Doc/ToDo/Picture.html
deleted file mode 100644
index d9234fa..0000000
--- a/PyGUI-2.5.3/Doc/ToDo/Picture.html
+++ /dev/null
@@ -1 +0,0 @@
-
PyGUI - class Picture
class Picture(Component)
[NOT YET IMPLEMENTED]
A Picture is a component which displays a static PixMap.
Properties
- image
- The PixMap to display.
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Tutorial.html b/PyGUI-2.5.3/Doc/Tutorial.html
deleted file mode 100644
index 571765f..0000000
--- a/PyGUI-2.5.3/Doc/Tutorial.html
+++ /dev/null
@@ -1,203 +0,0 @@
-
-BlobEdit
-
-
-
- Tutorial
- Here's a quick tutorial to give you an idea of how it all fits together
- in practice. It takes the form of an annotated listing of blobedit.py, a
-simple example application included with the source.
- What does BlobEdit do?
- BlobEdit edits Blob Documents. Blob Documents are documents containing
- Blobs. Blobs are red squares that you place by clicking and move around
-by dragging.
- BlobEdit demonstrates how to:
-
- - Define a Document class for holding a data structure, and an Application
- class that deals with it.
- - Give your Documents the ability to be saved in files, and define a file type for those files.
- - Define a View class for displaying your data structure, and ensure
-that the View is updated whenever the data structure changes.
- - Write a mouse tracking loop to handle dragging within a View.
- On
-MacOSX, build a stand-alone, double-clickable application with file and
-application icons and the ability to launch the application by opening
-its files.
-
-
-
- This tutorial may be extended in the future to cover more features of
-the framework.
- Imports
- We'll start by importing the modules and classes that we'll need (using
- clairvoyance to determine what they are):
- import pickle
from GUI import Application, ScrollableView, Document, Window, \
FileType, Cursor, rgb
from GUI.Geometry import pt_in_rect, offset_rect, rects_intersect
from GUI.StdColors import black, red
-
- The Application class
- Because we want to work with a custom Document, we'll have to define our
-own subclass of Application.
- class BlobApp(Application):
- The initialisation method will first initialise Application, and then set a few things up.
- def __init__(self):
Application.__init__(self)
-Let's define a file type for our
-application's files. Doing this will allow the application to recognise
-the files it can open, and on MacOSX it will also allow us to give our
-files distinctive icons if we build an application using py2app.
-Assigning our file type to the file_type property will cause it to be used automatically by the Open and Save commands.
-
- self.file_type = FileType(name = "Blob Document", suffix = "blob")
-Also, just for fun, let's create a custom cursor to use in our views. Here we're creating a cursor from the image file "blob.tiff", which will be looked for in the Resources directory alongside our main .py file.
-
- self.blob_cursor = Cursor("blob.tiff")
-We're not doing anything with the cursor yet, just storing it away for future use.
-
-Next, we'll define what our application is to do when it's started
-up without being given any files to open. We do this by overriding the open_app method and having it invoke the New command to create a new, empty document.
-
- def open_app(self):
self.new_cmd()
-The new_cmd method is the method that's invoked by the standard New menu command. There's also an open_cmd method that implements the Open... command. The default implementations of these methods know
-almost everything about what to do, but there are a few things we need
-to tell them. First, we need to define how to create a Document object of
-the appropriate kind. We do this by providing a make_document
-method:
-
- def make_document(self, fileref):
When a new document is being created, this method is called with fileref = None,
-and when an existing file is being opened, it is passed a FileRef.
-Since our application only deals with one type of file, we can ignore
-the fileref argument. All we have to do is create an instance of our document class
- and return it. All further initialization will be done by new_cmd or open_cmd.
-
-
- return BlobDoc()
-
-
-Finally, we need to tell our Application how to create a window for viewing
-our document. We do this by providing a make_window method. This
- method is passed the document object for which a window is to be made. Since
-our application only deals with one type of document, we know what class it
-will be. If we had defined more than one Document class, we would have to
-do some testing to find out which kind it was and construct a window accordingly.
-
- def make_window(self, document):
-
- First, we'll create a top-level Window object and associate it with
-the Document. The purpose of associating the Window with the Document is
-so that, when the Window is closed, the Document will get the chance to ask
-the user whether to save changes.
-
- win = Window(size = (400, 400), document = document)
-
- Next, we'll create a view for displaying our data structure. We'll call
- our view class BlobView here and define it later. We make our document the
-view's model, so that the view will be notified of any changes that require
-it to be redrawn.
-
- view = BlobView(model = document,
extent = (1000, 1000), scrolling = 'hv',
cursor = self.blob_cursor)
-
- We're intending to make our view class a subclass of ScrollableView so we can scroll it. Here we establish the extent of our view, which is the size of the area that the user will be able to scroll around in, and indicate with the scrolling parameter that it will have both horizontal and vertical scroll bars. We also give it the cursor that we created earlier.
-
-
-
- Next we place the view inside the window with options that determine
-its position, size and resizing behaviour. Without going deeply into details,
-we're saying that the edges of the scroll frame are to initially have offsets
-of 0 from the corresponding edges of the window, and that when the window
-is resized, the view is to be resized along with it.
-
-
- win.place(view, left = 0, top = 0, right = 0, bottom = 0,
sticky = 'nsew')
-
- (The options to the place method are very flexible, and there's
-much more you can do with it than is demonstrated here. See the documentation
-for it in the Container class for details.)
-
- Finally, we make the window visible on the screen. (It's easy to forget
- this step. If you leave it out, you won't see anything!)
-
- win.show()
- The Document class
- We'll represent the data structure within our document by means of a blobs attribute which will hold a list of Blobs.
- class BlobDoc(Document):
blobs = None
- We won't define an __init__ method for the document, because
-there are two different ways that a Document object can get initialised.
-If it was created by a "New" command, it gets initialised by calling new_contents,
-whereas if it was created by an "Open..." command, it gets initialised by
-calling read_contents. So, we'll put our initialisation in those
-methods. The new_contents method will create a new empty list of
-blobs, and the read_contents method will use pickle to
-read a list of blobs from the supplied file.
- def new_contents(self):
self.blobs = []
def read_contents(self, file):
self.blobs = pickle.load(file)
- The counterpart to read_contents is write_contents, which
-gets called during the processing of a "Save" or "Save As..." command.
- def write_contents(self, file):
pickle.dump(self.blobs, file)
- We'll also define some methods for modifying our data structure. Later
- we'll call these from our View in response to user input. After each modification,
- we call self.changed() to mark the document as needing to be saved,
-and self.notify_views() to notify any attached views that they need
-to be redrawn.
- def add_blob(self, blob):
self.blobs.append(blob)
self.changed()
self.notify_views()
def move_blob(self, blob, dx, dy):
blob.move(dx, dy)
self.changed()
self.notify_views()
def delete_blob(self, blob):
self.blobs.remove(blob)
self.changed()
self.notify_views()
We'll also find it useful to have a method that searches for a blob given a pair of coordinates.
- def find_blob(self, x, y):
for blob in self.blobs:
if blob.contains(x, y):
return blob
return None
-
- The View class
- Our view class will have two responsibilities: (1) drawing the blobs on
-the screen; (2) handling user input actions.
- class BlobView(ScrollableView):
- Drawing is done by the draw
-method. It is passed a Canvas object on which the drawing should be
-done. First, we'll select some colours for drawing our blobs. We're
-going to fill them with red and draw a line around them in black. Then
-we'll traverse the list of blobs and tell each one to draw itself on
-the canvas.
- def draw(self, canvas, update_rect):
canvas.fillcolor = red
canvas.pencolor = black
for blob in self.model.blobs:
if blob.intersects(update_rect):
blob.draw(canvas)
- The update_rect
-parameter is a rectangle that bounds the region needing to be drawn.
-Here we've shown one way in which it can be used, by only drawing blobs
-which intersect it. We don't strictly need to do this, since drawing is
-clipped to the update_rect anyway, but it can make the drawing process
-more efficient. (In this case it may actually make things worse, since
-testing for intersection in Python could be slower than letting the
-underlying graphics library do the clipping, but the technique is shown
-here for illustration purposes.)
Mouse clicks are handled by the mouse_down method. There
-are three
-things we want the user to be able to do with the mouse. If the click
-is
-in empty space, a new blob should be created; if the click is within an
-existing
-blob, it should be dragged, or if the shift key is held down, it should
-be deleted. So the first thing we will do is search the blob
-list to find out whether the clicked coordinates are within an existing
-blob.
- def mouse_down(self, event):
x, y = event.position
blob = self.model.find_blob(x, y)
-If we find a blob, we either drag it around or delete it depending on the state of the shift key.
- if blob:
if not event.shift:
self.drag_blob(blob, x, y)
else:
self.model.delete_blob(blob)
-If not, we add a new blob to the data structure:
- else:
self.model.add_blob(Blob(x, y))
If we're dragging a blob, we need to track the movements of the mouse
-until the mouse button is released. To do this we use the track_mouse method of class View.
-
- The track_mouse method returns an iterator which produces a series
-of mouse events as long as the mouse is dragged around with the button held
-down. It's designed to be used in a for-loop like this:
-
- def drag_blob(self, blob, x0, y0):
for event in self.track_mouse():
x, y = event.position
self.model.move_blob(blob, x - x0, y - y0)
x0 = x
y0 = y
- The Blob class
- Here's the implementation of the Blob class, representing a single
-blob.
- class Blob:
def __init__(self, x, y):
self.rect = (x - 20, y - 20, x + 20, y + 20)
def contains(self, x, y):
return pt_in_rect((x, y), self.rect)
def intersects(self, rect):
return rects_intersect(rect, self.rect)
def move(self, dx, dy):
self.rect = offset_rect(self.rect, (dx, dy))
def draw(self, canvas):
l, t, r, b = self.rect
canvas.newpath()
canvas.moveto(l, t)
canvas.lineto(r, t)
canvas.lineto(r, b)
canvas.lineto(l, b)
canvas.closepath()
canvas.fill_stroke()
- Instantiating the application
- Finally, to start everything off, we create an instance of our application
-class and call its run method. The run method runs the event loop,
-and retains control until the application is quit.
- BlobApp().run()
-Using py2app
-
-On MacOSX, while you can quite successfully run BlobEdit as a normal Python script, you may want to go a step further and use py2app to create a stand-alone, double-clickable MacOSX application bundle, complete with all the trimmings. There is a setup.py script in the Demos/BlobEdit directory of the PyGUI distribution that shows you how to do this. You invoke it with
-
-
python setup.py py2app
-
-and your application will appear in the dist directory.
-The End
-
-This tutorial will be expanded in the future, but for now, that's all, folks. Happy blobbing!
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/View.html b/PyGUI-2.5.3/Doc/View.html
deleted file mode 100644
index 8012cee..0000000
--- a/PyGUI-2.5.3/Doc/View.html
+++ /dev/null
@@ -1,106 +0,0 @@
-
-View class
-
-
-
-
- Class View is a general-purpose component
- for displaying 2D graphics and handling mouse and keyboard input. It
-also provides special support
- for being an observer of one or more Models.
-
- This page documents properties and methods concerned with drawing. See
-ViewBase for information about input handling
-and model observation.
-
Abstract methods
-
- - draw(canvas, update_rect)
- - Called when some or all of the view needs to be drawn. The canvas
- parameter is an object of class Canvas
-upon which the drawing should be done. The update_rect is the rectangle in the view's coordinate system that needs drawing.
-
-You can use the update_rect to improve efficiency by only drawing parts
-of the view that lie within it, although this is optional. Drawing will
-be clipped to the update_rect in any case.
The printing
-property of the canvas can be used to determine whether to draw
-features, such as selection highlighting, that should only appear on
-the screen and not on a printed page.
-
- Note: The canvas is only valid for the duration
- of this call and should not be retained beyond it. To draw into the view
- at other times, use the with_canvas method.
-
-
- - resized((dw, dh))
- - Called whenever the size of the view changes as a result of the user
-resizing the containing window.
-
-
- - container_resized((dw, dh))
- - Called whenever the view's container changes size as a result of the
-user resizing the containing window. The default implementation of this
-method adjusts the position and size of this component according to the
-settings of its resizing attributes.
-
-
-
- Methods
-
-
- - viewed_rect()
- - Returns the viewed rectangle, i.e. the rectangle in local coordinates
- that is currently visible in the view.
-
-
-
- - invalidate()
- - Marks the whole viewed rectangle as needing to be redrawn.
- -
- - invalidate_rect(rect)
- - Mark the given rectangle, in local coordinates, as needing to be
-redrawn.
-
-
- - update()
- - Causes invalidated areas to be redrawn immediately, without waiting
-for a return to the event loop.
-
-
-
- - with_canvas(function)
- - The function should be a callable object expecting one parameter.
- The function is called with a Canvas instance
- for drawing in the view. The canvas is only valid for the duration of the
- call and should not be retained beyond it.
- -
- local_to_global(p)
- - Transforms the given point from the view's local coordinate system
- to screen coordinates.
-
-
- - global_to_local(p)
- - Transforms the given point from screen coordinates to the view's local
-coordinate system.
-
-
- - local_to_container(p)
- - Transforms the given point from the view's local coordinate system
- to its container's local coordinate system.
-
-
- - container_to_local(p)
- - Transforms the given point from the view's container's local coordinate
- system to the view's local coordinate system.
-
-
-
-
----
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ViewBase.html b/PyGUI-2.5.3/Doc/ViewBase.html
deleted file mode 100644
index e0a80a2..0000000
--- a/PyGUI-2.5.3/Doc/ViewBase.html
+++ /dev/null
@@ -1,112 +0,0 @@
-
-ViewBase
-
-
-
-
-class ViewBase
-ViewBase is an abstract class providing common functionality for
-user-defined views. It provides facilities for associating
-the view with one or more Models,
-and some default
-behaviour for responding to changes in a model.
-
-ViewBase is not intended to be used directly as a base class. Usable
-subclasses of ViewBase include View
-and GLView.
-Properties
-
-
-- models
-- List of models being observed. Do not modify
-this list directly. Use the add_model
-and remove_model methods to attach and detach
-models.
-
-
-- model
-- Convenience property for when only one model is being
-observed. Reading this property returns models[0]
-when models is not empty, otherwise it returns None.
-Assigning a model to this property removes all other models and adds it
-as the sole model. Assigning None to this
-property removes all models.
-
-
-- cursor
-- The Cursor
-to display when the mouse is over the view, or None to use the
-default cursor.
-
-- To prevent any cursor from being shown over this view,
-set the cursor
-property to StdCursors.invisible.
-
-
-
-Abstract methods
-
-
-
-- model_changed()
-- Called when an attached model's notify_view
-method is called without specifying a message name. The default action
-is to call the
-view's invalidate method.
-
-
-- model_destroyed(model)
-- Called when an attached model is destroyed. The default
-action is to destroy the window containing this view, if any.
-
-Note: The model parameter should only be used
-to identify which model is being destroyed, if the view is observing
-more than one model. Do not rely on the state of the model object that
-is being destroyed.
-
-- targeted()
-- Called whenever this view becomes the current message
-target in a visible window.
-
-
-- untargeted()
-- Called whenever this view ceases to be the current
-message target in a visible window.
-
-
-
-
-Methods
-
-
-
-- add_model(model)
-- Attaches a model to this view, so that the view will be
-notified of
-changes to the model. This is an alternative to calling the model's add_view
-method.
-
-
-- remove_model(model)
-- Detaches a model from this view. This is an alternative
-to calling the model's remove_view method.
-
-
-
-
-- track_mouse()
-- Called following the receipt of a mouse-down event,
-returns an iterator which yields a series of mouse-drag events as long
-as the mouse button is held down, followed by a mouse-up event. The
-positions of all events are reported in the view's local coordinate
-system. While the iterator is active, all mouse movement events are
-reported, whether they occur within the view's bounds or not, and any
-other user input events are ignored.
-
-
-
--
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/Window.html b/PyGUI-2.5.3/Doc/Window.html
deleted file mode 100644
index b6d77de..0000000
--- a/PyGUI-2.5.3/Doc/Window.html
+++ /dev/null
@@ -1,224 +0,0 @@
-
-Window
-
-
-
-
- A Window is a top-level component. In order to be visible on the screen,
-a component must be directly or indirectly contained in a window.
- A newly-created window is initially hidden so that components can
- be added to it without unsightly flashing. Once constructed, it should be
- shown using the show method.
Size and position
The geometry properties of a window govern the size and position of the window's content
-area relative to the screen. Usually there will be borders, a title bar
-and so forth existing outside this area, and on some platforms there
-will also be a menu bar between the title and the content area. These
-things should be kept in mind if you are setting the position of a
-window explicitly. For example, trying to place a window in the top
-left corner of the screen by setting its position to (0, 0) will
-probably not work as expected, as it will result in the title bar and
-menus being hidden. (There is
-currently no good way of dealing with this; as a rule of thumb, allow 5
-pixels to the left and 40 pixels above to accommodate window
-decorations.)
-
- The initial position of a window is determined in a platform-dependent
- way, and may not correspond to the initial values of its x and
-y properties. For example, standard-style windows might be staggered
-and dialog-style windows might be centred on the screen. However, once the
-window has been shown for the first time, the x and y properties
-will reflect its actual screen position, and changing them will move the
-window to the specified position.
-Menus
-A window can be given a list of window-specific menus that are to be available
-(along with the application-wide menus) only when that window is active.
-The manner in which these menus are presented is platform-dependent.
-Document association
-A window can be associated with a document. When this is done, the behaviour
-of the window changes in the following ways:
-The window's title will (by default) be derived automatically from the document's
-title.
-
- - The document becomes the window's next handler for keyboard
-events and menu commands.
- - An attempt by the user to close the window is taken as a request to
-close the associated document, which may trigger a dialog asking whether
-to save changes.
- - Closing the document causes all its associated windows to be destroyed.
-
- Constructor
-
-
- - Window(style = 'standard',
- - movable = default, closable
- = default, hidable = default,
- - resizable = default, zoomable
-= default)
-
-
- - The style parameter determines the appearance of the window,
-according to platform conventions. It is one of:
-
-
-
-
- -
- - 'standard'
- - 'nonmodal_dialog'
- - 'modal_dialog'
- - 'alert'
- 'fullscreen'
-
-
-
-
- - Not all of these styles are necessarily distinguishable on all platforms.
-
-
- - Note that the 'modal_dialog'and 'alert' styles only affect the appearance of the
- window; they do not in themselves cause the window to behave modally. For a window
- with modal behaviour, use a ModalDialog or one of the alert functions.
-
-
- - The options'movable', 'closable', 'resizable', 'hidable'(minimizable) and 'zoomable'(maximizable) request
-the presence or absence of controls for performing these functions. The default
-values of these options depend on the window style in a platform-dependent
-way. Some combinations of styles and options may not be available, in which case you will get the nearest available combination.
-
A 'fullscreen'
-window is created without any title, borders or other decoration, and
-with an initial size and position that covers the whole screen. The
-effect of changing a fullscreen window's size or position is undefined.
-On MacOSX, the menu bar is hidden when a fullscreen window is the
-active window.
Note: the fullscreen style is currently not implemented on Gtk.
-
- Properties
-
- - title
- - Title of the window. Whether and how the title is displayed depends
- on the window style and platform conventions.
-
-
- - document
- - The Document instance to which this window belongs, if any.
-
-
- - menus
- - List of window-specific menus, i.e. those which should be available
- only when this window is active.
-
-
- - Do not modify the contents of this list. To change it, you
-should construct a new list of menus and then assign the whole list to this
-property.
-
- - visible
- - True if the window is shown on the screen. The visibility of the window can be changed using the show and hide methods, or by assigning to this property. The effect on window stacking order of assigning true to this property is undefined.
-
-
- - auto_position
- - If true, the window will be positioned automatically the first
-time it is shown. The method of positioning depends on the platform and
-the style of the window. Typically, dialog windows will be centred on
-the screen, and other windows will be staggered or the user will be
-asked to place them.
-
-If false, the initial position of the window is determined by the settings of its geometry properties.
-
-
- - target
- - Read only. The component within the window, if any, that is currently the target of keyboard events and menu commands. May not be implemented on all platforms.
-
-
-
-
-Attributes
-
-
- - keeps_document_open
- - A
-boolean controlling whether the presence of this window keeps its
-associated document open. When a window is closed, and its document has
-no other window whose keeps_document_open
-flag is true, the document and any other remaining windows for it are
-closed. Defaults to true. May be specified as a class attribute.
-
-
-
-Methods
-
-
-
- - show()
- - Makes the window visible on the screen (by setting the visible
-property to true), and brings it to the front.
-
-
-
-
- - hide()
- - Temporarily removes the window from the screen. Equivalent to setting
-the visible property to false.
-
-
-
-
- - bring_to_front()
- - Moves the window to the front of the stacking order. [NOT YET IMPLEMENTED]
-
-
-
-
- - send_to_back()
- - Moves the window to the back of the stacking order. [NOT YET IMPLEMENTED]
-
-
-
-
- - place_behind(window)
- - Places the window just behind the given window in the stacking order.
- [NOT YET IMPLEMENTED]
-
-
- modal_event_loop()
- Runs an event loop, fetching and handling input events for this window
-until exit_modal_event_loop()
-is called. Interaction with other windows is prevented.
-
-If a Cancel
-exception is raised during the event loop, it is silently caught and
-the event loop continues. The handling of an exception of any other
-type is platform-dependent; it may break the event loop and be
-propagated, or it may be handled within the loop using the application's report_exception() method.
- exit_modal_event_loop()
- Causes the current call to modal_event_loop() to
-exit.
Abstract methods
-
- - update_title()
- - Called when the title of the document owning this window changes.
- By default it changes the window title to match the document title.
-
-
-
-
- - close_cmd()
- - Called in response to the Close menu command, or by activation
- of whatever gadget is used to close a window on the platform concerned.
- If the window belongs to a document and the document does not own any other
- windows, the document's close_cmd method is called. In any other
- case, the destroy method of this window is called.
-
-
- Destructor
-
-
- - destroy()
- - Permanently removes the window from the screen, dissociates it from
- any document, and recursively destroys any sub-components. Neither the
-window nor any of its sub-components should be used again.
-
-
- - All windows and other components should be destroyed when they are
-no longer needed, otherwise they may not be garbage collected properly and
-may continue to tie up window system resources. This is taken care of by
-the framework when the user closes a window or document. In other situations
-you may need to call the destroy method yourself.
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/actions.html b/PyGUI-2.5.3/Doc/actions.html
deleted file mode 100644
index 6bc8e64..0000000
--- a/PyGUI-2.5.3/Doc/actions.html
+++ /dev/null
@@ -1 +0,0 @@
-
PyGUI - Actions
Actions
Some PyGUI classes have one or more action properties. An action
property specifies an action to perform in response to something done by
the user, e.g. clicking a button.
The value of an action property can take any of the following forms:
- A function (or other callable object)
- A tuple (function, arg, ...)
- A message name specifying a message to be sent up the message
handling hierarchy
- A tuple (message, arg, ...)
Invoking actions programmatically
As a general principle, action properties are only triggered in response
to actions performed by the user, not actions performed by the program. For
example, the action property of a CheckBox is triggered when the
user clicks on the check box, but not when the on property of the
check box is assigned to by program code. This makes it easier to set up
actions which keep different controls in sync with each other without inadvertently
creating infinite loops.
If you do want an action performed in response to program code, you will
need to trigger it explicitly. Corresponding to each action property xxx_action
there is a method called do_xxx_action which invokes the action.
For example, here is how you can change the on property of a check
box and trigger the action as though the user had clicked on the control:
my_checkbox.on = True
my_checkbox.do_action()
Overriding actions in subclasses
If you subclass a component and want the subclass to provide an action for
one of the superclass's action properties, there are a couple of ways you
can go about it. One is to simply pass a bound method of the subclass as
the initial value of the action property when calling the superclass's __init__
method. This is not the best way, however, since it uses up the action slot
and precludes the possibility of users of your class using it to further
customise the component's behaviour. Worse, if the user doesn't realise the
action slot is already in use and plugs in an action of his own, it will
supplant your subclass's action, which is probably not what you want.
A better way is to override the do_action method for the action.
This ensures that users of your class can't inadvertently wipe out your action,
and leaves the action property open for further customisation, which you
can allow by calling the superclass's do_action method from yours.
For example,
class MyControl(SomeControl):
def do_action(self):
...do something special here,
and then...
SomeControl.do_action(self) #
give user's action a go
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/alert_funcs.html b/PyGUI-2.5.3/Doc/alert_funcs.html
deleted file mode 100644
index 745c236..0000000
--- a/PyGUI-2.5.3/Doc/alert_funcs.html
+++ /dev/null
@@ -1,138 +0,0 @@
-
-Alert Functions
-
-
-
-
-module Alerts
-This module defines functions that display various commonly-used types
-of modal dialog containing a textual message.
-Alert kinds
-The kind parameter in the following functions
-determines the appearance of the dialog. It may take the following
-values:
-
-
-- 'stop'
-- Used for displaying an error message or other condition
-which prevents an operation from being completed.
-
-
-- 'caution'
-- Used for warning the user when an operation could cause
-loss of data or other undesirable effects.
-
-
-- 'note'
-- Used for presenting an informational message to the user.
-
-
-- 'query'
-- Used for requesting information from the user.
-
-
-Some platforms may not display all of these in a unique way.
-Functions
-
-Low-level alert functions
-
-- alert(kind, message, ok_label = "OK")
-- Displays an alert box with one button, which is the default
-button.
-Does not return a value.
-
-
-
-
-- alert2(kind, message,
-yes_label = "Yes", no_label = "No",
--
- default = 1, cancel = 0)
-- Displays an alert box with two buttons. Returns 1 if the
-"yes" button is pressed, 0 if the "no" button is pressed. The default
-and cancel parameters specify
-which buttons, if any, are activated by the standard keyboard
-equivalents,
-and take the values 1, 0 or
-None.
-
-
-
-
-- alert3(kind, message, yes_label = "Yes", no_label
-= "No",
- other_label = "Cancel", default
-= 1,
-cancel = -1)
-- Displays an alert box with three buttons. Returns 1 if the
-"yes" button
-is pressed, 0 if the "no" button is pressed, and -1 if the "other"
-button
-is pressed. The default and cancel
-parameters specify
-which buttons, if any, are activated by the standard keyboard
-equivalents,
-and take the values 1, 0, -1
-or None.
-
-
-
-In addition to the parameters listed above, these functions also accept
-the
-following optional parameters:
-
-
-- width
-- The overall width of the alert box.
-
-
-- lines
-- The number of lines to allow for in the text area of the
-alert box.
-
-
-These parameters are hints only; platforms are free to
-ignore them and calculate the size of the alert box from the text
-provided.
-High-level alert functions
-The following functions provide shorthands for calling the above
-functions
-with certain common combinations of parameters.
-
-- note_alert(message, ...)
-- Equivalent to alert('note', message,
-...).
-
-
-
-
-- stop_alert(message, ...)
-- Equivalent to alert('stop', message,
-...).
-
-
-- ask(message, ...)
-- Equivalent to alert2('query', message,
-...).
-
-
-
-
-- confirm(message, ...)
-- Equivalent to alert2('caution', message,
-...).
-
-
-- ask_or_cancel(message, ...)
-- Equivalent to alert3('query', message,
-...).
-
-
-- confirm_or_cancel(message, ...)
-- Equivalent to alert3('caution', message,
-...).
-
-
----
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/application_func.html b/PyGUI-2.5.3/Doc/application_func.html
deleted file mode 100644
index 9f83540..0000000
--- a/PyGUI-2.5.3/Doc/application_func.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-Global Functions
-
-
-- application()
-
-- Returns the Application instance. The first time an instance of Application
-or a subclass of Application is created, a global reference to it is stored;
-the application function returns this reference.
-
-- If this function is called before any Application object has been created,
-it creates an instance of class Application automatically.
-
- - run()
- - Runs the application. This is equivalent to application().run(). Retains control until the application is quit.
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/coordinates.cwk b/PyGUI-2.5.3/Doc/coordinates.cwk
deleted file mode 100644
index 372ebfc..0000000
Binary files a/PyGUI-2.5.3/Doc/coordinates.cwk and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/coordinates.html b/PyGUI-2.5.3/Doc/coordinates.html
deleted file mode 100644
index 4221bc2..0000000
--- a/PyGUI-2.5.3/Doc/coordinates.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- PyGUI - Coordinates, Points and Rectangles
-
-
- Coordinates, Points and Rectangles
-
-The coordinate system of a Window or View has (0, 0) at the top left corner,
-with x coordinates increasing to the right and y coordinates
-increasing downward. The coordinates label infinitely thin horizontal and
-vertical lines, and pixels exist between these lines, as illustrated in the
-figure below.
-
-A point is represented by a 2-tuple (x, y). A 2-tuple can also
-be used to represent as size (width, height) or a relative displacement
-(dx, dy).
-
-A rectangle is represented by a 4-tuple (left, top, right, bottom).
-If right <= left or bottom <= top, the
-rectangle is an empty rectangle and is considered to enclose no pixels.
-
-Angles are measured in degrees anticlockwise from the x-axis.
-
-The Geometry submodule provides a collection
-of functions for operating on points and rectangles.
-
-
-
-
Relationship between coordinates,
-pixels, points and rectangles
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/coordinates.jpg b/PyGUI-2.5.3/Doc/coordinates.jpg
deleted file mode 100644
index eb8cb84..0000000
Binary files a/PyGUI-2.5.3/Doc/coordinates.jpg and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/customising-standard-menus.html b/PyGUI-2.5.3/Doc/customising-standard-menus.html
deleted file mode 100644
index 4c18fab..0000000
--- a/PyGUI-2.5.3/Doc/customising-standard-menus.html
+++ /dev/null
@@ -1,88 +0,0 @@
-
-PyGUI - Customising the Standard Menus
-
-Customising the Standard Menu Bar
-
-By default, a PyGUI application comes with a standard set of menus
-containing all the commands that the PyGUI framework itself knows about
-- Open, Close, Save, Cut, Copy, Paste and so forth. It's likely that
-you won't use all of these commands in your application, will want to
-omit some of them. It's also likely that you will want to add new
-commands of your own. PyGUI offers a variety of mechanisms to do these
-things in a platform-independent way.
Choosing standard menu items
The basic_menus() function from the StdMenus
-module provides a starting point for building your application's main
-menu bar. Without any parameters, it returns a list of menus containing
-all of the standard commands, arranged according to platform
-conventions.
If you want to be more selective, there are a
-couple of ways to go about it. One is to start with all the standard
-items and take away the ones you don't want using the exclude
-parameter, which takes a sequence or set of command names. The StdMenus
-module exports a number of predefined command sets to make this easier.
-For example, the following creates a menu bar containing all the
-standard commands except those having to do with files or printing.
from GUI.StdMenus import basic_menus, file_cmds, print_cmds
menus = basic_menus(exclude = file_cmds + print_cmds)
The menu bar is installed by assigning it to the menus property of the application.
app = MyApplication()
app.menus = menus
-
The other way is to start with a minimal set of commands and add the extra ones that you want using the include parameter. When you specify a value for include, the menu bar will include only those items, plus the fundamental_cmds and edit_cmds,
-which are considered essential for most applications. The following
-creates a menu bar containing only the file-related commands and the
-"Preferences" command in addition to the essential ones.
menus = basic_menus(include = file_cmds + prefs_cmds)
You can use both include and exclude
-together; this is the only way to omit items from the essential set.
-The following includes all of the file-related commands except
-"Revert", and also omits the "Redo" command, which would otherwise be
-implicitly included because it is part of the edit_cmds set.
menus = basic_menus(include = file_cmds, exclude = ['revert_cmd', 'redo_cmd'])
Note,
-however, that it is generally a bad idea to exclude items from the
-essential set. On some platforms, for example, the editing commands
-need to be present in the menus in order for their keyboard equivalents
-to work in dialogs.
Modifying standard menu items
Sometimes
-you will want to give different titles or keyboard equivalents to
-standard menu commands. For example, in a game you might want the New,
-Open and Save commands to be called "New Game", "Load Game" and "Save
-Game", and give "Load Game" a keyboard equivalent of "L" instead of "O".
You can do this easily using the substitutions parameter to basic_menus(). It takes a dictionary whose keys are command names and values are replacement menu item strings. For example:
menus = basic_menus(substitutions = {
'new_cmd': "New Game",
'open_cmd': "Load Game.../L",
'save_cmd': "Save Game",
'save_as_cmd': "Save Game As..."})
Each
-replacement can override just the title, just the keyboard equivalent,
-or both. In the above example, the keyboard equivalent of open_cmd is overridden, but the other commands are left with their standard equivalents.Adding menus
-The simplest way to add new commands is to create one or more extra menus containing your
-commands, and add them to the end of the application's menu bar. Here's
-an example of how to do this.
-
-menus = basic_menus()
-my_menu = Menu("Widget", [("Swizzle", 'swiz_cmd'), ("Defibrillate", 'defib_cmd')])
-menus.append(my_menu)
-app.menus = menus
-
-
-Note that the new menu is added to the menu list before assigning the menu list to the application's menus property. This is important, to ensure that the menu bar is updated properly.
-Adding commands to standard menus
-Adding your own menus is all well and good, but you may want more
-control than that. For example, if you have some editing-related
-commands, you might want to add them to the Edit menu instead of
-putting them in a menu of their own.
-
-The problem with this is finding the right menu to add them to. PyGUI
-tries to make as few assumptions as possible about the layout of the
-standard menus, and if you want your application to be portable, you
-should do the same. So you shouldn't assume, for example, that the Edit
-menu is the second menu in the menu bar. (On the Mac, it's not!) You
-shouldn't even assume that there will be an Edit menu at all.
-
-Rather than a particular menu, it's better to think in terms of putting
-your commands near existing commands. PyGUI helps you out here by means
-of the MenuList class. A
-MenuList is just like an ordinary list, except that it also has a
-method that will take an internal command name and give you the menu
-which contains that command. So we can find the menu containing, say,
-the 'copy_cmd' command,
-and be fairly sure that it's the Edit menu, or whatever passes for it,
-on the platform we're running on. Once we've found the menu, we can use
-its append or extend methods to add our commands to it.
-
The basic_menus() function returns a MenuList, so here's how we can add some commands to the Edit menu:
-
-menus = basic_menus()
-edit_menu = menus.menu_with_command('copy_cmd')
-edit_menu.extend(["-", ("Biggify", 'enlarge_cmd'), ("Smallify", 'reduce_cmd')])
app.menus = menus
-
-Future plans
-One further thing you might want to do is insert commands in the
-middle of a menu (to get them even closer to an existing command). This is
-not currently supported, but is planned for a future version.
-
----
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/event_handling.html b/PyGUI-2.5.3/Doc/event_handling.html
deleted file mode 100644
index 795dcdc..0000000
--- a/PyGUI-2.5.3/Doc/event_handling.html
+++ /dev/null
@@ -1,117 +0,0 @@
-
-PyGUI - Event Handling
-
-
-
- Event Handling
- This section describes how the various types of events are handled, and
- how the Application, Document, Window and View classes interact when handling
- events.
- Events can be classified into three groups:
-
- - Mouse events
- - Keyboard events
- - Menu commands
-
- Although menu commands are not explicitly represented as Event objects,
- they are handled in a similar way to events.
- Mouse events
- There are four kinds of mouse events, mouse-down, mouse-drag, mouse-up and mouse_move.
-
- Mouse-down
-and mouse-up events occur when a mouse button is pressed or released.
-Mouse-drag events occur when the mouse is moved with a button held
-down. Mouse-move events occur when the mouse is moved with no button down.
-
-Mouse events are delivered simply by calling the
-correspondingly-named method, if any, of the View object with which
-they are associated. For example, mouse-down events are delivered by
-calling the mouse_down
-method of the view in which it occurs. If that view does not define a method with that name, the event is ignored.
-
-Note that mouse-drag and mouse-up events are sent to the view in
-which the preceding mouse-down event occurred, not the one currently
-containing the mouse.
-
-
- There is also an alternative way of receiving mouse-drag and mouse-up events, by entering a modal mouse-tracking loop in response
- to a mouse-down event (see Mouse Tracking).
Message delivery mechanism
- Keyboard events and menu commands are handled by a general mechanism called
- the message delivery mechanism. A message consists of a message
- name and optionally a tuple of arguments. The objects which can respond
-to messages are subclasses of MessageHandler, and are arranged in a hierarchy
- which corresponds partly to the Component containment hierarchy.
- Message delivery proceeds in two phases, the dispatching phase and
- the handling phase.
-
- At any given moment, one of the application's windows is the target
- window for keboard events and menu commands. Depending on the platform,
- this may be the frontmost window, or the window containing the mouse pointer,
- or it may be determined in some other way. Within the target window, one
-of the components is designated as the target object, or just target.
- The user typically makes a component the target by clicking on it or tabbing
- into it. A component can also be made the target by calling its become_target
-method.
-
- If no component has been selected as the target within a window, the target
- defaults to the window itself. If the application has no windows (possible
- on some platforms), the Application is the target.
-
- The dispatching phase consists of locating the target object and passing
- the message to it. The handling phase is then entered by calling the handle
-method of the target. If the target has a method called xxx, where
- xxx is the name of the message, it is called with the message arguments.
- Otherwise, the message is passed to the handle method of the object's
- next handler. In the case of a Component, the next handler is the
-component's container.
- When the message reaches a Window object, it passes to the Document object
- which owns the Window, and then to the Application object. If the Window
- is not owned by a Document, the message is passed directly to the Application.
- Keyboard events
- Keyboard events may be classified into key-down, key-up and
-auto-key events.
-
- Key-down events are processed by dispatching a message named key_down,
- with the event as its argument, to the current target.
-
- Key-up events are not supported by all platforms. Where they are supported,
- they are handled by dispatching a key_up message to the current
- target.
-
- An auto-key event is a key-down event generated by an auto-repeating key
- rather than a physical keystroke, and is also handled by dispatching a key_down message. Not all platforms allow auto-key events to be distinguished from
- key-down events; on platforms which do, they are distinguished by the auto
-attribute of the event object being set to true.
-
- Menu commands
- The binding between a menu item and the action it invokes is through an
- internal command name associated with the menu item. This allows
-menu items to be rearranged and their text altered without affecting the
-code of objects which handle the commands. Furthermore, the method to invoke
-in response to a menu command is located by sending messages along the same
- paths that keyboard events follow. This allows the same menu item to have
- different effects depending on the context in which it is used.
- There are two phases to handling menu commands, the setup phase and the execution phase. Each of these phases involves sending messages
- up the message handler hierarchy.
- The purpose of the setup phase is to set up the menus so that the appropriate
- subset of the commands are enabled, and any check marks or other visual
-indications are in an appropriate state.
- Before pulling down the menu, all items in all menus of the current menubar
- are first disabled (and any check marks, etc. are removed). Then the setup_menus
-method of each object along the next-handler chain from the current target
- is called. In response to this, each object enables those menu commands
-which it knows about and are currently legal (and sets up any necessary
-check marks, etc.)
- Then the menu is pulled down and the user allowed to make a selection.
- If a selection is made, a message is dispatched whose name is the command
- name of the selected item.
- As well as a single menu item, a command name can also be associated
- with a group of menu items whose contents can vary at run time. Examples
- might be a list of font names in a Font menu, or a list of window titles
-in a Windows menu. Within the group, individual items are distinguished by
-an integer index. When an item from the list is invoked, its index is passed
- as a parameter of the command message.
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/extent.intaglio b/PyGUI-2.5.3/Doc/extent.intaglio
deleted file mode 100644
index a7f8f84..0000000
Binary files a/PyGUI-2.5.3/Doc/extent.intaglio and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/extent.png b/PyGUI-2.5.3/Doc/extent.png
deleted file mode 100644
index 20463cc..0000000
Binary files a/PyGUI-2.5.3/Doc/extent.png and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/file_dialogs.html b/PyGUI-2.5.3/Doc/file_dialogs.html
deleted file mode 100644
index f2e19c7..0000000
--- a/PyGUI-2.5.3/Doc/file_dialogs.html
+++ /dev/null
@@ -1,105 +0,0 @@
-
-PyGUI - File Dialog Functions
-
-
-
- module FileDialogs
- This module defines functions that present dialog boxes for requesting new and existing files and directories according
-to platform conventions.
-
-Parameters
-The following parameters are used by these functions:
-
-
- - prompt
- - A prompt string to be displayed. It is up to the platform exactly
-where and how the prompt is shown, and it may not be shown at all in
-some cases. If omitted, a suitable default is used depending on the
-type of request.
-
-
- - default_dir
- - A FileRef or DirRef
-specifying the initial directory to be browsed. If omitted, a
-platform-dependent default is used (usually the last directory visited
-in the application by a file dialog).
-
-
- - default_name
- - For functions that request a new object name, the initial value
-entered into the name area of the dialog. If omitted, the name area is
-initially empty.
-
-
- - file_type, file_types
- - A FileType or list of FileTypes specifying acceptable file types.
-
-Functions
-
-
-
-
-
- - request_old_file(prompt = None, default_dir = None, file_types = None)
-
-
-
- - Prompts the user to select an existing file. If any file_types are supplied, the user is only allowed to select a file matching one of the specified types.
-
- - Returns a FileRef, or None if the user cancelled.
-
-
-
-
-
-
-
-
-- request_old_files(prompt = None, default_dir = None, file_types = None)
-
- - Prompts the user to select a set of existing files. If any file_types are supplied, the user is only allowed to select files matching one of the specified types.
- - Returns a list of FileRefs, or None if the user cancelled.
-
-
-- request_new_file(prompt = None, default_dir = None, default_name = None, file_type = None)
-
-
- - Prompts the user to supply a name and location for a new file. If file_type
-is specified, it should represent the type if file which is to be
-created; some platforms use this to restrict the list of existing files
-displayed, and to determine the suffix of the returned filename.
-
-
- - Returns a FileRef, or None if the user cancelled.
-
-
-
-
-
-
-
-
-
-- request_old_directory(prompt = None, default_dir = None)
-Prompts the user to select an existing directory.
-- Returns a FileRef, or None if the user cancelled.
-
-
-- request_old_directories(prompt = None, default_dir = None)
-
-Prompts the user to select a set of existing directories.
-
-
- - Returns a list of FileRefs, or None if the user cancelled.
-
-
- - request_new_directory(prompt = None, default_dir = None, default_name = None)
-
-
-- Prompts the user to supply a name and location for a new directory.
-
-- Returns a FileRef, or None if the user cancelled.
-
-
----
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/index.html b/PyGUI-2.5.3/Doc/index.html
deleted file mode 100644
index 8534aa0..0000000
--- a/PyGUI-2.5.3/Doc/index.html
+++ /dev/null
@@ -1,156 +0,0 @@
-
-PyGUI
-
-
-
-
-PyGUI
-A
-Graphical Application Framework
-for
-Python
-by Greg Ewing
-
-
-greg.ewing@canterbury.ac.nz
-
-
-
-
-Discussion
-
-
-Tutorials
Framework Classes
-Classes making up the foundation of the model-view architecture and
-message handling system.
-
-Abstract Classes
-These
-classes define properties and methods that other PyGUI classes have in
-common. They are for internal use by the PyGUI framework only. You
-should not instantiate these classes or derive your own classes
-directly from them.
-
-Window Classes
Components that appear as top-level windows on the desktop.
-
-User-Defined View Classes
Components with drawing and input-handling methods that you can override.Control Classes
Components for displaying and editing values.
-
-Layout Classes
Components for arranging other components.
Text Editing Classes
Components for displaying and editing text.Menu Classes
-Classes for creating and manipulating menus and menu items.
-
-Graphics Classes
-Classes concerned with drawing 2D graphics in user-defined views.
-
-Support Classes
Non-graphical classes used behind the scenes.
-
-OpenGL Classes
Classes concerned with 3D drawing using OpenGL.
-
-Printing Classes
Classes related to printing support.Functions
Stand-alone functions at the top level of the GUI package.
-
-Submodules
Functionality provided as submodules of the GUI package.
-
-- StdColors - Predefined Color objects
-- StdFonts - Predefined Font objects
-- StdCursors - Predefined Cursor objects
- StdMenus - Constructing standard Menus and MenuBars
- Alerts - Various kinds of alert boxes
- FileDialogs - Dialogs for requesting old and new file and directory names
- Resources - Functions for finding and loading resources bundled with an application
-- Geometry - Calculations with points and rectangles
- Printing - Classes and functions related to printing
-- GL - OpenGL facilities
- Numerical - NumPy interface
- PIL - Python Imaging Library interface
-
-Example Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/menu_setup.html b/PyGUI-2.5.3/Doc/menu_setup.html
deleted file mode 100644
index f02fdfa..0000000
--- a/PyGUI-2.5.3/Doc/menu_setup.html
+++ /dev/null
@@ -1,87 +0,0 @@
-
-PyGUI - Menu Setup
-
-
-
-
-Menu Setup
-During the setup phase of menu command handling, the setup_menus
-method of each component along the message handling path is called with a
-menu state object. The setup_menus method uses the menu state
-object to enable or disable menu commands, add or remove check marks, and
-establish the contents of menu item groups.
-
-Each setup phase begins with all menu items disabled and all check marks
-removed, so it is normally only necessary to enable items and add check marks,
-not disable or remove them. However, on occasion a component may want to
-disable an item or remove a check mark that was enabled or added by a component
-higher up in the message handling hierarchy. It can do this because the setup_menus
-methods are called from the top of the message handling hierarchy to the
-bottom, giving more specific handlers the chance to override menu setup decisions
-made by more general ones.
-Menu state objects
-A menu state object consists of a collection of command state and
-command group objects representing all the menu commands present in
-all the currently available menus, organised by their command names.
-An item can be selected from the menu state object by using the command name
-as either an attribute name or an index. For example, given a menu state
-object m, the state object for the command 'foo_cmd' can
-be referred to as either
-m.foo_cmd
-
-or
-m['foo_cmd']
-
-Note that it is not an error to reference a non-existent command. Referring
-to a command that is not currently present in the available menus returns
-a dummy command state object, manipulation of which has no effect.
-Command state objects
-A command state object represents the state of a single menu item.
-Properties
-
-
- - enabled
- - True if the item is to be selectable by the user.
-
-
- - checked
- - True if there is to be a distinguishing mark displayed beside the
-menu item. The precise appearance of this is platform-dependent.
-
-
-Command group objects
-A command group object is a sequence object representing an indexed group
-of menu items. It allows the contents of the group to be established, and
-provides access to the command state objects of the individual items. It
-also allows the enabled and checked status of all the items to be changed
-at once.
-Properties
-
-
- - enabled
- - checked
- - Write-only. Assigning to these properties changes the corresponding
-properties of all the items in the group.
-
-
-Operators
-
-
- - group[index]
- - Read-only. Returns a command state object for the item with
-the specified index.
-
-
-Methods
-
-
- - set_items(item_list)
- - Replaces the contents of the group with a set of menu items constructed
-from the item_list. Each member of the item_list should be
-a "text/key" string as accepted by the Menu class
-constructor.
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/navigation.html b/PyGUI-2.5.3/Doc/navigation.html
deleted file mode 100644
index 5476fd3..0000000
--- a/PyGUI-2.5.3/Doc/navigation.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-PyGUI - Keyboard NavigationKeyboard Navigation
Most
-platforms allow you to use the Tab key to move from one text field to
-another within a window. Some (e.g. Gtk, Windows) also allow you to tab
-into non-text controls such as buttons and check boxes. Some (e.g.
-MacOSX) do not do this by default, but provide a user preference
-setting for enabling it.
By default, PyGUI follows the platform conventions concerning the behaviour of the Tab key, but allows the user to change it.
On Gtk and Windows, setting the PYGUI_KEYBOARD_NAVIGATION
-environment variable to a true value ("True" or "1") enables tabbing
-into all controls, and setting it to a false value ("False" or "0")
-disables this.
On MacOSX, this environment variable is not used,
-and the System Preferences settings under Keyboard Shortcuts for tab
-key behaviour are always followed.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ownership.cwk b/PyGUI-2.5.3/Doc/ownership.cwk
deleted file mode 100644
index ec4d807..0000000
Binary files a/PyGUI-2.5.3/Doc/ownership.cwk and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/ownership.html b/PyGUI-2.5.3/Doc/ownership.html
deleted file mode 100644
index 264d480..0000000
--- a/PyGUI-2.5.3/Doc/ownership.html
+++ /dev/null
@@ -1,66 +0,0 @@
-
-PyGUI - Overview
-
-
-
-
-
- Overview of the PyGUI Framework
- This section briefly describes the main classes making up the PyGUI application
-framework and how they interact.
- Application class
- There is exactly one Application object which looks after everything that
-is global to the application. If your application is very simple, you may
-not even need to know about the Application class - an instance of it will
-be created automatically when needed. If you want to make use of the Document-View
-architecture, however, you will probably want to define a subclass of Application
-and add your own code to it.
- Document class
- A Document object represents an application data structure which
-can be stored in a file. A Document is also a Model so that it can have
-Views attached to it (see below). If the data structure is simple, it could
-be contained entirely in the Document object. A more complex data structure
-might be composed of many objects, with a Document object at the head. Some
-or all of these sub-objects may be Models so that Views can be attached to
-parts of the data structure.
- Window and Component classes
- A Window represents a top-level window on the screen. Windows serve
- as containers for Components, which are all the usual user interface widgets
- such as buttons, scroll bars, text fields, etc. Some kinds of Components
-are also Containers. A Container can contain other Components and clip them to its
-boundary. Window and View, for example, are subclasses of Container.
- View and Model classes
- A View is a general-purpose Component for displaying graphics and
- handling input events. A View can be associated with a Model representing
- the data structure that it is to display. There can be many Views attached
- to each Model, and when the Model is changed, all of its Views are notified
- so that they can update themselves.
- Ownership hierarchy
- There are ownership relationships between Application, Document, Window
- and Component objects. The Application is at the top of the hierarchy, and
-owns all of the Documents. Each Document can own some number of Windows,
-each Window owns all of its contained Components, those Components which are Containers own all their contained Components, and so forth. There can also be
-Windows that do not belong to a Document and are owned directly by the
-Application.
- The ownership hierarchy serves two purposes. It defines a path for handling
- events (see Event Handling), and
-it allows a Document to be closed when all the Windows belonging to it have
-been closed.
- Figure 1 below illustrates the ownership relationships, and Figure 2 shows
-some examples of how View-Model relationships might be set up.
-
-
-
-
- Figure 1
-
-
-
-
-
- Figure 2
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/ownership.jpg b/PyGUI-2.5.3/Doc/ownership.jpg
deleted file mode 100644
index da58115..0000000
Binary files a/PyGUI-2.5.3/Doc/ownership.jpg and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/page_setup.png b/PyGUI-2.5.3/Doc/page_setup.png
deleted file mode 100644
index 888638a..0000000
Binary files a/PyGUI-2.5.3/Doc/page_setup.png and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/pagination.png b/PyGUI-2.5.3/Doc/pagination.png
deleted file mode 100644
index 693e9c4..0000000
Binary files a/PyGUI-2.5.3/Doc/pagination.png and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/place.html b/PyGUI-2.5.3/Doc/place.html
deleted file mode 100644
index 30d49e5..0000000
--- a/PyGUI-2.5.3/Doc/place.html
+++ /dev/null
@@ -1,166 +0,0 @@
-
-PyGUI - Placement Methods
-
-
-
- Placement Methods
- Class Frame provides three methods, place, place_row
- and place_column, for adding and laying out subcomponents. These
- methods accept a very flexible set of options for specifying the position
- and size of the subcomponents, adding scroll bars and borders to them,
- and controlling how they behave when the containing frame is resized.
-
- Common placement options
- The following options are accepted by all three placement methods.
- Positioning options
-
-
- - left
- - right
- - top
- - bottom
- - These options specify the initial positions of the edges of a component.
-They may take one of four forms:
-
-
- - None
- This is the default value, and it leaves the edge unspecified.
- The position of an unspecified edge is determined by the component's current
- size and the positioning of the opposite edge. If the opposite edge is
-unspecified as well, the positions of both edges are left as they are.
- - A distance
- The edge is positioned at the specified distance from one of the
- edges of the containing frame. Which edge of the frame is used depends
- on the value of distance. Positive distances are measured from
-the left or top edge of the frame, whereas negative distances are measured
- from the right or bottom edge of the frame.
-
- A distance of zero is measured from the corresponding edge to the
- one being specified -- for example, specifying left = 0 positions the left edge of the component at the left edge
-of the frame, and specifying right = 0 positions
-the right edge of the component at the right edge of the frame.
- - A component
- The edge is aligned with the opposite edge of the specified
- component. For example, specifying left = my_button aligns the left edge of the component with the right edge of my_button.
- - An expression of the form component + distance
- or component - distance
- The edge is positioned at the specified distance from the opposite
- edge of the specified component. For example, specifying left = my_button + 10 positions the
- left edge of the component 10 pixels to the right of the right edge of
- my_button, and specifying bottom = my_label - 20 positions the bottom edge of the component
- 20 pixels above the top edge of my_label.
-
- It is important to understand that these options only control
- the initial position and size of the component. Specifying
-and edge relative to another component does not create any sort of connection
- or constraint between the two components. Whether the relationship will
-be maintained when the frame is subsequently resized depends entirely on
-the value of the sticky option (see below).
-
- - Note also that the left, top, right, and
- bottom options to the placement methods are quite different
- from the left, top, right, and bottom properties of components. The special forms described above
-can be used only with the former and not with the latter.
-
-
-
- Resizing options
-
- - sticky
- - This option controls what happens to the position and size of the
- component when the frame is subsequently resized. It consists of a string
- made up of the letters 'n', 's', 'e' and 'w'
- for north, south, east and west.
-
-
- - If sticky contains 'w' but not 'e', the
- component will "stick" to the left edge of the frame, meaning that its position
- and size in the horizontal direction will not change when the frame is resized.
- If it contains 'e' but not 'w', the component will stick
- to the right edge of the frame, meaning that it will move along with the
-right edge of the frame while retaining its size.
-
-
- - If sticky contains both 'e' and 'w', the
- component's left edge will stick to the left edge of the frame, and its right
- edge will stick to the right edge of the frame. The component will therefore
- stretch or shrink in the horizontal direction when the frame changes size.
-
-
- - Similar considerations apply to the letters 'n' and 's'
- with regard to the vertical direction.
-
-
- - The default value of sticky is 'nw', so that the
- component sticks to the top and left edges of the frame.
-
-
- Scrolling options
-
-
- - scrolling
- - This option is a string made up of the letters 'h' and 'v'
-specifying horizontal and vertical scrolling, respectively. It should only
-be used when the component being placed is a subclass of ScrollableView, or some other
-component that supports scrolling. The effect of using it on a component
-that does not support scrolling is undefined.
-
-
-Border options
-
-
- - border
- - This is a boolean option requesting that the component be given a
-border. Whether a border is actually added, and if so, its size and appearance,
-depends on the platform and on the type of component being placed. When a
-border is provided, it exists outside the bounds of the component, and is
-not included in the calculation of any component's position and size.
-
-
-
-Placing rows and columns
-
- - Whereas the place method places a single component at a time,
-the place_row and place_column methods can be used to lay
-out a list of components in a row or column. These two methods accept all
-of the placement options listed above, plus the following:
-
-
-
- - spacing
- - The amount of space to leave between adjacent components. If unspecified,
-a platform-dependent default is used.
-
-
-Placing a row or column is achieved by first placing one of the components
-as specified by the given options, and then placing each subsequent component
-relative to the previous one. All of the same placement options are applied
-to each subsequent component, except for one of its edges, which will be
-positioned at the specified spacing from the previous component.
-
-Which component is placed first, and the direction of subsequent component
-placement, is determined by which edges are specified in the placement options.
-For example, if you specify the left edge when placing a row, the
-first component in the list will be placed first, with its left edge at the
-specified position. The second component will then be placed to the right
-of the first, with the left edge of the second component relative to the
-right edge of the first, and so forth.
-
-On the other hand, if you specify the right edge (instead of the left
-edge), then the last component in the list will be placed first, and
-then the second-to-last to the left of it, and so forth.
-
-(It is currently illegal to specify both the left and right edges when placing
-a row, or both the top and bottom edges when placing a column. This restriction
-may be lifted in the future.)
-
-If you're finding the above description too confusing, just think of the
-edge specifications as applying to the whole collection of components rather
-than to any individual component. For example, my_frame.place_row([button1,
-button2, button3], top = 42,
-right = -12, spacing = 8)
-means "place these buttons in a row 8 pixels apart, 42 pixels from the top
-of the frame and 12 pixels from the right."
- ---
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/printing.html b/PyGUI-2.5.3/Doc/printing.html
deleted file mode 100644
index b5068c1..0000000
--- a/PyGUI-2.5.3/Doc/printing.html
+++ /dev/null
@@ -1,77 +0,0 @@
-
-Printing
-Printing
Most
-of the time you won't have to do anything to get basic printing support
-in your PyGUI application. There are default implementations of the Page Setup command in the Application class, and the Print
-command in the View and ScrollableView classes. The generic printing
-system uses the same code for printing a view as is used for drawing to
-the screen, so once you've written a draw() method for your view, you can also print it.
While
-the default printing system works well enough, it is fairly rudimentary
-and won't always do exactly what you want. However, you can
-customise and build upon it in various ways to provide more advanced
-features. This section explains how the printing support in PyGUI works
-and how you can extend it.
Page Setup
Page setup information is represented by an instance of the PageSetup
-class. This class holds all of the information typically specified by a
-"Page Setup" dialog. For PyGUI's purposes, the most important of these
-are the paper size (the physical size of the sheet of paper) and the margins (the distances from the edge of the paper to the region that will be printed on). Together these determine the page size (the size of the printed area). The following diagram illustrates the relationships between these attributes.
The Application object has a page_setup attribute that holds a default PageSetup instance, and an implementation of the Page Setup command that presents a dialog for editing it. The Document class also has a page_setup attribute and a corresponding Page Setup
-command handler. Thus, in a document-oriented application, each
-document has its own set of page setup information. If a view is
-associated with a document, it will use that document's PageSetup when
-printed; otherwise, it will use the application-wide one.
None
-of these PageSetup objects are automatically saved anywhere. If you
-want them to persist, you will need to save them along with your
-document data, or if you're not using documents, write the
-application-wide one to a preferences file. To facilitate this,
-PageSetup objects are designed to be pickled. They also have to_string() and from_string() methods, in case you don't want to use pickle.
You can customise the way page setup information is edited by overriding the page_setup_cmd() method of a view, a document or the application. You may want to make use of the utility function present_page_setup_dialog(), which displays the platform's standard page setup dialog for a given PageSetup instance.
Printing Views
The Print command is handled by the print_cmd() method of the View and ScrollableView classes. First, the view attempts to find a PageSetup instance. If the view's model attribute refers to a Document, and the document's page_setup
-attribute is not None, then it is used. Otherwise, the application-wide
-PageSetup is used. If you want the PageSetup to be located some other
-way, you can override the get_page_setup() method of the view.
Next, the view's print_view()
-method is called, with the PageSetup object as a parameter. This method
-does most of the hard work. First it determines the total size of the
-area to be printed. For a View, this is the same as the size of the
-view on the screen; for a ScrollableView, it is the view's extent.
Then the printed area is divided into pages. with the size of each page equal to the page_size attribute of the PageSetup. The view's draw()
-method is called once for each page, with a special canvas object that
-draws to the printer instead of the screen. In place of the update_rect
-parameter, a rectangle is passed representing the bounds of the page
-currently being drawn.
The following diagram illustrates a view
-with a large extent being divided into pages for printing. Note that
-the origin of the coordinate system as seen by the draw() method is
-always at the top left corner of the extent, regardless of which page
-is being printed. So the view doesn't need to know whether it's drawing
-to a screen or a printer (although it can find out if it wants to, as
-we will see below).
Customising Printing
Often
-you won't want to print a view exactly the same way as it appears on
-the screen. For example, things like selection highlighting and page
-boundaries should only be shown on the screen and not on the printed
-page. The Canvas object passed to the draw() method has a printing
-attribute that is true when printing and false when drawing to the
-screen. You can use this to determine which elements of the view should
-be drawn.
This technique is sufficient to accommodate minor
-differences between screen drawing and printing. Sometimes, however,
-you may want to lay out the document quite differently when printing.
-An example would be a word processor where you want to display the text
-in a continuous "galley" view on the screen, without any page breaks.
-When printed, however, you want to add headers and footers to each
-page. This presents a problem, because the extent of the view has to be
-increased when printing in order to accommodate the headers and footers.
The
-solution to this kind of problem is to use a different view subclass
-for printing. When you come to print, instead of printing the view that
-you use on the screen, create an off-screen instance of the printing
-view and call its print_view()
-method. The printing view can then calculate its extent appropriately
-and generally do things in as different a way as needed from the
-on-screen one.
An example of the use of this technique can be
-seen in PyGUI's TextEditor class. When printed, it wraps to the width
-of the page instead of the width of the view on the screen. It also
-figures out how many lines will fit on a page and avoids splitting a
-line between two pages. To accomplish this, it uses a separate View
-subclass behind the scenes (TextEditorPrintingView). It's implemented
-in pure Python, so you can examine it if you want to see how it works.
There
-are a couple of ways you can intervene in order to introduce your
-custom printing view into the printing process. One way is to override
-the print_view() method of the on-screen view to instantiate a printing view and then call its print_view() method instead. (This is the technique used by TextEditor.)
The
-other way, applicable in a document-oriented application, is to handle
-printing at the document level instead of the view level. This may make
-more sense if you have a number of different kinds of on-screen view of
-the document, but only one way of printing it. Whichever view is active
-when the user gives the Print command, you want the same printing code to be invoked.
To do it this way, you will first need to disable handling of the Print command in the view, otherwise it will never get as far as the document. You can do this by setting the printable property of the view to false. The view will then ignore the Print command and pass it on to the next handler.
Then you can give your Document subclass a print_cmd() method that creates an instance of your printing view and calls its print_view() method, passing it the document's page_setup. Remember to enable the Print command in the document's setup_menus() method.
---
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/printing.intaglio b/PyGUI-2.5.3/Doc/printing.intaglio
deleted file mode 100644
index 81f2cdc..0000000
Binary files a/PyGUI-2.5.3/Doc/printing.intaglio and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/py2app_py2exe.html b/PyGUI-2.5.3/Doc/py2app_py2exe.html
deleted file mode 100644
index 4e0faa3..0000000
--- a/PyGUI-2.5.3/Doc/py2app_py2exe.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-Py2Exe and PyGUIUsing PyGUI with Py2App and Py2Exe
As
-of PyGUI version 2.5, it is no longer necessary to explicitly tell
-Py2App or Py2Exe to include the GUI package. Just import the things
-that you use, and Py2App and Py2Exe will find them in the usual way.
However,
-Py2Exe does need a small amount of help to find certain modules in
-pywin32. A helper module is included in the GUI package to make the
-necessary adjustments; all you have to do is import it into your
-setup.py script along with py2exe. The imports at the top of your
-setup.py script should include the following:
from distutils.core import setup
import GUI.py2exe
import py2exe
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/std_buttons.html b/PyGUI-2.5.3/Doc/std_buttons.html
deleted file mode 100644
index 79e2486..0000000
--- a/PyGUI-2.5.3/Doc/std_buttons.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-module StdButtonsmodule StdButtons
This module defines some standard Button subclasses.
Constructors
- DefaultButton(title = "OK",
-style = 'default', action = 'default_action')
- CancelButton(title = "Cancel",
-style = 'cancel', action = 'cancel_action')
-These create buttons with the appropriate appearance and behaviour for
-use as OK or Cancel buttons in a dialog box. By default, when used in a
-modal dialog, the DefaultButton will dismiss the dialog with the value
-True, and the CancelButton will dismiss it with the value False. These
-actions can also be invoked with the Return/Enter and Escape keys. See Dialog and ModalDialog for more
-information.
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/terminology.html b/PyGUI-2.5.3/Doc/terminology.html
deleted file mode 100644
index 2c388d9..0000000
--- a/PyGUI-2.5.3/Doc/terminology.html
+++ /dev/null
@@ -1 +0,0 @@
-
PyGUI - Terminology
Terminology used in PyGUI
Properties
The term property has a special meaning in the PyGUI documentation.
It refers to an attribute having the following special characteristics:
- Access to the property is mediated by a pair of accessor methods.
Reading a property called foo is implemented by a method called
get_foo, and assigning to it is implemented by a method called
set_foo. These methods may be overridden in subclasses.
- An initial value for the property may be supplied in the form of a
keyword argument to the class's constructor. These keyword arguments will
not normally be listed explicitly in the documentation for the constructor,
but you can assume that the names of all the (non-readonly) properties of
the class and its superclasses are also acceptable as keyword arguments to
its constructor.
- Classes which support properties have a set() method which
accepts property names as keyword arguments. This can provide a convenient
way of setting the values of multiple properties at once.
Some properties are read-only, meaning that they cannot be assigned
to or given initial values in the constructor. Some are initialize-only,
meaning that they can be given initial values in the constructor but not changed
after that. The documentation for each property will make it clear when either
of these conditions applies.
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/using_the_view_class.html b/PyGUI-2.5.3/Doc/using_the_view_class.html
deleted file mode 100644
index 0a45b4e..0000000
--- a/PyGUI-2.5.3/Doc/using_the_view_class.html
+++ /dev/null
@@ -1,233 +0,0 @@
-
-
-
-
-
-
- PyGUI - Using the View class
-
-Using the View and ScrollableView classes
-
-Creating a user interface component for your application's data structure
-is achieved by subclassing and customising the View
-class, or its subclass ScrollableView. This section describes how these classes works and what needs to
-be done to accomplish various things with them.
-
-Coordinates, scrolling and the extent
-
-
-Each instance of View or ScrollableView has its own local coordinate system in which
- drawing takes place and the locations of mouse events are reported. For a plain View, the
- origin of the local coordinate system is always at the top left corner
- of the view. For a ScrollableView, the origin changes when the view is scrolled.
-
-
-
-In addition to its bounds rectangle, a ScrollableView also as an extent rectangle
-defining the limits of scrolling. The local coordinate system is
-relative to this rectangle, so that its top left corner is always at
-(0, 0) in local coordinates. The size of the extent rectangle is called
-the extent.
The scroll
- offset is the difference in local coordinates between the top left corner
- of the view and the top left corner of the extent rectangle. Figure 1 illustrates
-the relationship between the view's bounds, the extent rectangle, and the scroll offset.
-
-
-
-The part of the local coordinate system that is visible in the view is
- called the viewed rectangle. The scroll offset is constrained, as
- far as possible, so that the viewed rectangle lies within the extent rectangle. So,
- in order for scrolling to be possible in a given direction, the extent must
- be larger than the view's bounds in that direction.
-
-
-
-If
-the extent is smaller than the bounds in a given direction, there is
-no room for movement and the scroll offset in that direction will be
-clamped
-to zero. In that situation, the viewed rectangle will include areas
-that
-are outside the extent rectangle. These areas are filled with the background color of the ScrollableView before your drawing method is called.
The
-background color can be set to None to suppress automatic filling of
-the background areas. However, whether you are able to draw anything
-outside the extent rectangle yourself is platform-dependent, so for maximum portability you should either specify a background color or leave it set to the default.

-
-
-
-Figure
-1
-Bounds, extent, viewed rect and scroll offset
-
-
-
-Drawing and invalidating
-
- Whenever some part of the view needs to be drawn, the draw
-method is called with a Canvas
-object as parameter. The canvas object encapsulates a drawing state and
-provides drawing methods. The draw method is also passed an update rectangle that bounds the region needing to be drawn.
-
-
-
- The initial clipping region of the canvas is set to the update rectangle. In the simplest case, the draw method
- can just erase and redraw everything, and the clipping will ensure that
- only the parts that actually need drawing are affected. A more intelligent
- draw method can make tests against the update rectangle and be more
- selective about what to draw.
-
-
-
- There are two ways that calls to draw can be triggered. One
- is when part of a window becomes uncovered on the screen. The other is by
- calling the view's invalidate method, which marks the whole viewed
- rectangle as needing to be drawn, or invalidate_rect, which marks
- a specified rectangle.
-
-
-
- Note that the canvas passed to the draw method is only valid
- for the duration of the call, and should not be retained beyond it. To
-draw into the view at other times, it is necessary to call the with_canvas method, passing it a function that accepts a canvas as parameter. However,
- this should be avoided if possible. It is almost always easier and more
- efficient to simply invalidate the affected region and wait for the draw method to be called.
-
-Mouse tracking
-
- Mouse-down events are delivered to a view by calling its mouse_down
-method. In response, many applications will want to enter a mode in
-which the mouse is tracked and some action performed until a mouse-up
-event occurs. The track_mouse method provides a convenient way to do this. The idiom for using it goes like this:
-
-
-def mouse_down(self, event):
- # Do something in response to the mouse click,
- and then...
- for event in self.track_mouse():
- # Do something in response
- to dragging
- # Do something in response to release of the
-mouse
-
-
- The track_mouse method returns an iterator which yields a
-series of mouse events. All of these events will be mouse-drag events,
-except for the final one, which will be a mouse-up event. Thus, when the
-above loop is finished, event will be bound to a mouse-up event
-representing the location where the mouse was released.
-
-
-
- Note that the body of the loop will be executed for the final mouse-up
- event as well as for the mouse-drag events. Usually it doesn't do any harm
- to treat them both the same way, but if it matters, you'll need to test
- the kind of the event in the loop.
-
-
-
-Also note that track_mouse only reports mouse-drag and
-mouse-up events -- any other kind of events, such as key events,
-occurring during the drag will be ignored. If you need to handle such events while dragging, you will
-have to implement mouse tracking non-modally using mouse_drag and mouse_up methods on your view.
-
-Model observation
-
- Since one of the primary uses of a view is to display a model, some
- convenience features are provided to support using it in the role of a
-model observer. For the frequent case where the view observes a single
-model object, there is a model property. Assigning to this property
-has the side effect of connecting the view to the model.
-
-
-
- If the view needs to respond to changes in more than one model object,
- you can use the add_model and remove_model methods to
- attach and detach models, and the models property to retrieve a
- list of currently attached models.
-
-
-
- An alternative way of connecting and disconnecting views and models is to
-use the add_view and remove_view methods of the model. It
-doesn't matter whether you connect the view to the model or the model to
-the view; the end result is the same.
-
-
-
- A default model_changed method is provided which simply invalidates
- the whole view, causing it to be completely redrawn. If redrawing your
-view is fairly quick, you won't need to do anything else to respond to model
-changes -- just call the model's notify_views method and the view
-will update itself.
-
-
-
- If you need to be more selective about what you redraw, you'll have
- to pass some information about what part of the model has changed. There
- are a couple of levels at which you can customise the process. At one
-level, you can pass some parameters along with the model_changed
-message:
-
-
-
-
-
-
-
-
- In the
-model
- ...
- self.notify_views(changed_item = 42)
- ...
- |
-
- |
- In the
-view
- def model_changed(self, model, changed_item):
- ...
- |
-
-
-
-
-
-
-
-
- At another level, you can send a custom change message and define
-a method in the view to handle it:
-
-
-
-
-
-
-
-
- In the
-model
- ...
- self.notify_views('wibble_twisted',
- which = w)
- ...
- |
-
- |
- In the view
- def wibble_twisted(self,
- model, which):
- ...
- |
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Doc/view-model.cwk b/PyGUI-2.5.3/Doc/view-model.cwk
deleted file mode 100644
index af0b3ba..0000000
Binary files a/PyGUI-2.5.3/Doc/view-model.cwk and /dev/null differ
diff --git a/PyGUI-2.5.3/Doc/view-model.jpg b/PyGUI-2.5.3/Doc/view-model.jpg
deleted file mode 100644
index fb13dd8..0000000
Binary files a/PyGUI-2.5.3/Doc/view-model.jpg and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Application.py b/PyGUI-2.5.3/GUI/Cocoa/Application.py
deleted file mode 100644
index a456aab..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Application.py
+++ /dev/null
@@ -1,356 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Application class - PyObjC
-#
-#------------------------------------------------------------------------------
-
-import os, sys, traceback
-import objc
-from Foundation import NSObject, NSBundle, NSDefaultRunLoopMode, NSData, NSDate
-import AppKit
-from AppKit import NSApplication, NSResponder, NSScreen, NSMenu, NSMenuItem, \
- NSKeyDown, NSKeyUp, NSMouseMoved, NSLeftMouseDown, NSSystemDefined, \
- NSCommandKeyMask, NSPasteboard, NSStringPboardType, NSModalPanelRunLoopMode
-NSAnyEventMask = 0xffffffff
-from GUI import Globals, GApplications
-from GUI import application, export
-from GUI.GApplications import Application as GApplication
-from GUI import Event
-
-#------------------------------------------------------------------------------
-
-Globals.ns_screen_height = None
-Globals.ns_last_mouse_moved_event = None
-Globals.pending_exception = None
-Globals.ns_application = None
-
-ns_distant_future = NSDate.distantFuture()
-
-#------------------------------------------------------------------------------
-
-class Application(GApplication):
- # _ns_app _PyGui_NSApplication
- # _ns_pasteboard NSPasteboard
- # _ns_key_window Window
-
- _ns_menubar_update_pending = False
- _ns_files_opened = False
- _ns_using_clargs = False
- _ns_menus_updated = False
-
- def __init__(self, **kwds):
- self._ns_app = Globals.ns_application
- self._ns_app.pygui_app = self
- self._ns_pasteboard = NSPasteboard.generalPasteboard()
- self._ns_key_window = None
- GApplication.__init__(self, **kwds)
- self.ns_init_application_name()
-
- def destroy(self):
- del self.menus[:]
- import Windows
- Windows._ns_zombie_window = None
- self._ns_app.pygui_app = None
- self._ns_app = None
- self._ns_pasteboard = None
- GApplication.destroy(self)
-
- def set_menus(self, menu_list):
- GApplication.set_menus(self, menu_list)
- self._update_menubar()
-
- def _update_menubar(self):
- ns_app = self._ns_app
- ns_menubar = NSMenu.alloc().initWithTitle_("")
- menu_list = self._effective_menus()
- for menu in menu_list:
- ns_item = NSMenuItem.alloc()
- ns_item.initWithTitle_action_keyEquivalent_(menu.title, '', "")
- ns_menubar.addItem_(ns_item)
- ns_menu = menu._ns_menu
- # An NSMenu can only be a submenu of one menu at a time, so
- # remove it from the old menubar if necessary.
- old_supermenu = ns_menu.supermenu()
- if old_supermenu:
- i = old_supermenu.indexOfItemWithSubmenu_(ns_menu)
- old_supermenu.removeItemAtIndex_(i)
- ns_menubar.setSubmenu_forItem_(ns_menu, ns_item)
- # The menu you pass to setAppleMenu_ must *also* be a member of the
- # main menu.
- ns_app.setMainMenu_(ns_menubar)
- if menu_list:
- ns_app_menu = menu_list[0]._ns_menu
- ns_app.setAppleMenu_(ns_app_menu)
-
- def handle_next_event(self, modal_window = None):
- ns_app = self._ns_app
- if modal_window:
- ns_mode = NSModalPanelRunLoopMode
- ns_modal_window = modal_window._ns_window
- else:
- ns_mode = NSDefaultRunLoopMode
- ns_modal_window = None
- ns_event = ns_app.nextEventMatchingMask_untilDate_inMode_dequeue_(
- NSAnyEventMask, ns_distant_future, ns_mode, True)
- if ns_event:
- ns_window = ns_event.window()
- if not ns_window or not ns_modal_window or ns_window == ns_modal_window:
- ns_app.sendEvent_(ns_event)
-
- def get_target_window(self):
- # NSApplication.keyWindow() isn't reliable enough. We keep track
- # of the key window ourselves.
- return self._ns_key_window
-
- def zero_windows_allowed(self):
- return 1
-
- def query_clipboard(self):
- pb = self._ns_pasteboard
- pb_types = pb.types()
- return NSStringPboardType in pb_types
-
- def get_clipboard(self):
- pb = self._ns_pasteboard
- ns_data = pb.dataForType_(NSStringPboardType)
- if ns_data:
- return ns_data.bytes().tobytes()
-
- def set_clipboard(self, data):
- ns_data = NSData.dataWithBytes_length_(data, len(data))
- pb = self._ns_pasteboard
- pb.clearContents()
- pb.setData_forType_(ns_data, NSStringPboardType)
-
- def setup_menus(self, m):
- m.hide_app_cmd.enabled = True
- m.hide_other_apps_cmd.enabled = True
- m.show_all_apps_cmd.enabled = True
- if not self._ns_app.modalWindow():
- GApplication.setup_menus(self, m)
-
- def process_args(self, args):
- # Note: When using py2app, argv_emulation should be disabled.
- if args and args[0].startswith("-psn"):
- # Launched from MacOSX Finder -- wait for file open/app launch messages
- pass
- else:
- # Not launched from Finder or using argv emulation
- self._ns_using_clargs = True
- GApplication.process_args(self, args)
-
- def run(self, fast_exit = True):
- try:
- GApplication.run(self)
- except (KeyboardInterrupt, SystemExit):
- pass
- except:
- traceback.print_exc()
- # A py2app bundled application seems to crash on exit if we don't
- # bail out really quickly here (Python 2.3, PyObjC 1.3.7, py2app 0.2.1,
- # MacOSX 10.4.4)
- if fast_exit:
- os._exit(0)
-
- def event_loop(self):
- self._ns_app.run()
-
- def _quit(self):
- self._quit_flag = True
- self._ns_app.stop_(self._ns_app)
-
- def hide_app_cmd(self):
- self._ns_app.hide_(self)
-
- def hide_other_apps_cmd(self):
- self._ns_app.hideOtherApplications_(self)
-
- def show_all_apps_cmd(self):
- self._ns_app.unhideAllApplications_(self)
-
- def ns_process_key_event(self, ns_event):
- # Perform menu setup before command-key events.
- # Send non-command key events to associated window if any,
- # otherwise pass them to the pygui application. This is necessary
- # because otherwise there is no way of receiving key events when
- # there are no windows.
- if ns_event.modifierFlags() & NSCommandKeyMask:
- NSApplication.sendEvent_(self._ns_app, ns_event)
- else:
- ns_window = ns_event.window()
- if ns_window:
- ns_window.sendEvent_(ns_event)
- else:
- event = Event(ns_event)
- self.handle(event.kind, event)
-
- def ns_menu_needs_update(self, ns_menu):
- try:
- if not self._ns_menus_updated:
- self._perform_menu_setup()
- self._ns_menus_updated = True
- except Exception:
- self.report_exception()
-
- def ns_init_application_name(self):
- # Arrange for the application name to be used as the title
- # of the application menu.
- ns_bundle = NSBundle.mainBundle()
- if ns_bundle:
- ns_info = ns_bundle.localizedInfoDictionary()
- if not ns_info:
- ns_info = ns_bundle.infoDictionary()
- if ns_info:
- if ns_info['CFBundleName'] == "Python":
- #print "GUI.Application: NSBundle infoDictionary =", ns_info ###
- ns_info['CFBundleName'] = Globals.application_name
- return
-
-#------------------------------------------------------------------------------
-
-_ns_key_event_mask = AppKit.NSKeyDownMask | AppKit.NSKeyUpMask
-
-#------------------------------------------------------------------------------
-
-class _PyGui_NSApplication(NSApplication):
-
- pygui_app = None
-
- def sendEvent_(self, ns_event):
- # Perform special processing of key events.
- # Perform menu setup when menu bar is clicked.
- # Remember the most recent mouse-moved event to use as the
- # location of event types which do not have a location themselves.
- if Globals.pending_exception:
- raise_pending_exception()
- ns_type = ns_event.type()
- self.pygui_app._ns_menus_updated = False
- if (1 << ns_type) & _ns_key_event_mask:
- self.pygui_app.ns_process_key_event(ns_event)
- else:
- if ns_type == NSMouseMoved:
- Globals.ns_last_mouse_moved_event = ns_event
- ns_window = ns_event.window()
- if ns_window:
- ns_view = ns_window.contentView().hitTest_(ns_event.locationInWindow())
- if ns_view:
- ns_view.mouseMoved_(ns_event)
- else:
- NSApplication.sendEvent_(self, ns_event)
-
- def menuNeedsUpdate_(self, ns_menu):
- self.pygui_app.ns_menu_needs_update(ns_menu)
-
- def menuSelection_(self, ns_menu_item):
- try:
- command = ns_menu_item.representedObject()
- index = ns_menu_item.tag()
- if index >= 0:
- dispatch_to_app(self, command, index)
- else:
- dispatch_to_app(self, command)
- except:
- self.pygui_app.report_error()
-
- def validateMenuItem_(self, item):
- return False
-
- def undo_(self, sender):
- dispatch_to_app(self, 'undo_cmd')
-
- def redo_(self, sender):
- dispatch_to_app(self, 'redo_cmd')
-
- def cut_(self, sender):
- dispatch_to_app(self, 'cut_cmd')
-
- def copy_(self, sender):
- dispatch_to_app(self, 'copy_cmd')
-
- def paste_(self, sender):
- dispatch_to_app(self, 'paste_cmd')
-
- def clear_(self, sender):
- dispatch_to_app(self, 'clear_cmd')
-
- def selectAll_(self, sender):
- dispatch_to_app(self, 'select_all_cmd')
-
- def application_openFile_(self, ns_app, path):
- app = self.pygui_app
- if app._ns_using_clargs:
- return True
- # Bizarrely, argv[0] gets passed to application_openFile_ under
- # some circumstances. We don't want to try to open it!
- if path == sys.argv[0]:
- return True
- app._ns_files_opened = True
- try:
- app.open_path(path)
- return True
- except Exception, e:
- app.report_error()
- return False
-
- def applicationDidFinishLaunching_(self, notification):
- app = self.pygui_app
- if app._ns_using_clargs:
- return
- try:
- if not app._ns_files_opened:
- app.open_app()
- except Exception, e:
- app.report_error()
- return False
-
-export(Application)
-
-#------------------------------------------------------------------------------
-
-def raise_pending_exception():
- exc_type, exc_value, exc_tb = Globals.pending_exception
- Globals.pending_exception = None
- raise exc_type, exc_value, exc_tb
-
-def create_ns_application():
- ns_app = _PyGui_NSApplication.sharedApplication()
- ns_app.setDelegate_(ns_app)
- Globals.ns_application = ns_app
-
-def dispatch_to_app(ns_app, *args):
- app = ns_app.pygui_app
- if app:
- app.dispatch(*args)
-
-Globals.ns_screen_height = NSScreen.mainScreen().frame().size.height
-
-create_ns_application()
-
-#------------------------------------------------------------------------------
-
-# Disable this for now, since MachSignals.signal segfaults. :-(
-#
-#def _install_sigint_handler():
-# print "_install_sigint_handler" ###
-# from Foundation import NSRunLoop
-# run_loop = NSRunLoop.currentRunLoop()
-# if not run_loop:
-# print "...No current run loop" ###
-# sys.exit(1) ###
-# MachSignals.signal(signal.SIGINT, _sigint_handler)
-# #from PyObjCTools.AppHelper import installMachInterrupt
-# #installMachInterrupt()
-# print "...done" ###
-#
-#def _sigint_handler(signum):
-# print "_sigint_handler" ###
-# raise KeyboardInterrupt
-
-#def _install_sigint_handler():
-# import signal
-# signal.signal(signal.SIGINT, _raise_keyboard_interrupt)
-#
-#def _raise_keyboard_interrupt(signum, frame):
-# raise KeyboardInterrupt
-
-#_install_sigint_handler()
diff --git a/PyGUI-2.5.3/GUI/Cocoa/BaseAlertFunctions.py b/PyGUI-2.5.3/GUI/Cocoa/BaseAlertFunctions.py
deleted file mode 100644
index 07c9efe..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/BaseAlertFunctions.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Python GUI - Basic alert functions - Cocoa
-#
-
-from AppKit import \
- NSRunAlertPanel, NSRunCriticalAlertPanel, NSRunInformationalAlertPanel
-
-def alert(kind, prompt, ok_label, **kwds):
- alert_n(kind, prompt, ok_label, None, None)
-
-def alert2(kind, prompt, yes_label, no_label, **kwds):
- return alert_n(kind, prompt, yes_label, no_label, None)
-
-def alert3(kind, prompt, yes_label, no_label, other_label, **kwds):
- return alert_n(kind, prompt, yes_label, no_label, other_label)
-
-def alert_n(kind, prompt, label1, label2, label3):
- splat = prompt.split("\n", 1)
- title = splat[0]
- if len(splat) > 1:
- msg = splat[1]
- else:
- msg = ""
- if kind == 'caution':
- return NSRunCriticalAlertPanel(title, msg, label1, label2, label3)
- elif kind == 'note':
- return NSRunInformationalAlertPanel(title, msg, label1, label2, label3)
- else:
- return NSRunAlertPanel(title, msg, label1, label2, label3)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/BaseFileDialogs.py b/PyGUI-2.5.3/GUI/Cocoa/BaseFileDialogs.py
deleted file mode 100644
index 600f19b..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/BaseFileDialogs.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Python GUI - File selection dialogs - Cocoa
-#
-
-from AppKit import NSOpenPanel, NSSavePanel, NSOKButton
-from GUI.Files import FileRef
-from GUI import application
-
-#------------------------------------------------------------------
-
-def _request_old(prompt, default_dir, file_types, dir, multiple):
- ns_panel = NSOpenPanel.openPanel()
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- ns_panel.setTitle_(prompt)
- ns_panel.setCanChooseFiles_(not dir)
- ns_panel.setCanChooseDirectories_(dir)
- ns_panel.setAllowsMultipleSelection_(multiple)
- if default_dir:
- ns_dir = default_dir.path
- else:
- ns_dir = None
- if file_types:
- ns_types = []
- for type in file_types:
- ns_types.extend(type._ns_file_types())
- else:
- ns_types = None
- result = ns_panel.runModalForDirectory_file_types_(ns_dir, None, ns_types)
- if result == NSOKButton:
- if multiple:
- return [FileRef(path = path) for path in ns_panel.filenames()]
- else:
- return FileRef(path = ns_panel.filename())
- else:
- return None
-
-#------------------------------------------------------------------
-
-def _request_new(prompt, default_dir, default_name, file_type, dir):
- ns_panel = NSSavePanel.savePanel()
- #if prompt.endswith(":"):
- # prompt = prompt[:-1]
- #if prompt.lower().endswith(" as"):
- # prompt = prompt[:-3]
- #ns_panel.setTitle_(prompt)
- #print "_request_new: setting label to", repr(prompt) ###
- ns_panel.setNameFieldLabel_(prompt)
- if default_dir:
- ns_dir = default_dir.path
- else:
- ns_dir = None
- if file_type:
- suffix = file_type.suffix
- if suffix:
- ns_panel.setCanSelectHiddenExtension_(True)
- if not file_type.mac_type or file_type.mac_force_suffix:
- ns_panel.setRequiredFileType_(suffix)
- result = ns_panel.runModalForDirectory_file_(ns_dir, default_name)
- if result == NSOKButton:
- return FileRef(path = ns_panel.filename())
- else:
- return None
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Button.py b/PyGUI-2.5.3/GUI/Cocoa/Button.py
deleted file mode 100644
index d12deae..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Button.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Python GUI - Buttons - PyObjC version
-#
-
-import AppKit
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.ButtonBasedControls import ButtonBasedControl
-from GUI.GButtons import Button as GButton
-
-_style_to_ns_key_equivalent = {
- 'default': "\x0d",
- 'cancel': "\x1b",
-}
-
-_ns_key_equivalent_to_style = {
- "\x0d": 'default',
- "\x1b": 'cancel',
-}
-
-class Button(ButtonBasedControl, GButton):
-
- def __init__(self, title = "New Button", font = system_font, **kwds):
- ns_button = self._create_ns_button(title = title, font = font,
- ns_button_type = AppKit.NSMomentaryLight,
- ns_bezel_style = AppKit.NSRoundedBezelStyle,
- padding = (10, 2)
- )
- GButton.__init__(self, _ns_view = ns_button, **kwds)
-
- def get_style(self):
- ns_key = self._ns_view.getKeyEquivalent()
- return _ns_key_equivalent_to_style.get(ns_key, 'normal')
-
- def set_style(self, style):
- ns_key = _style_to_ns_key_equivalent.get(style, "")
- self._ns_view.setKeyEquivalent_(ns_key)
-
- def activate(self):
- self._ns_view.performClick_(None)
-
-# def key_down(self, e): ###
-# print "Button.key_down:", e ###
-
-export(Button)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/ButtonBasedControls.py b/PyGUI-2.5.3/GUI/Cocoa/ButtonBasedControls.py
deleted file mode 100644
index fee4a95..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/ButtonBasedControls.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - PyObjC version
-#
-# Mixin class for controls based on NSButton
-#
-#------------------------------------------------------------------------------
-
-from Foundation import NSMutableDictionary, NSAttributedString
-from AppKit import NSMutableParagraphStyle, NSFontAttributeName, \
- NSForegroundColorAttributeName, NSParagraphStyleAttributeName, \
- NSButton
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, \
- ns_set_action, ns_size_to_fit
-from GUI import Control
-from GUI.StdColors import black
-
-#------------------------------------------------------------------------------
-
-class ButtonBasedControl(object):
-
- _ns_handle_mouse = True
-
- _color = None
-
- def _create_ns_button(self, title, font, ns_button_type, ns_bezel_style,
- padding = (0, 0)):
- ns_button = PyGUI_NSButton.alloc().init()
- ns_button.pygui_component = self
- ns_button.setButtonType_(ns_button_type)
- ns_button.setBezelStyle_(ns_bezel_style)
- ns_button.setTitle_(title)
- ns_button.setFont_(font._ns_font)
- num_lines = title.count("\n") + 1
- ns_size_to_fit(ns_button, padding = padding,
- height = font.line_height * num_lines + 5)
- ns_set_action(ns_button, 'doAction:')
- return ns_button
-
- def set_title(self, title):
- Control.set_title(self, title)
- self._ns_update_attributed_title()
-
- def set_font(self, font):
- Control.set_font(self, font)
- self._ns_update_attributed_title()
-
- def set_just(self, just):
- Control.set_just(self, just)
- self._ns_update_attributed_title()
-
- def get_color(self):
- if self._color:
- return self._color
- else:
- return black
-
- def set_color(self, color):
- self._color = color
- self._ns_update_attributed_title()
-
- # There is no direct way of setting the text colour of the title;
- # it must be done using an attributed string. But when doing
- # this, the attributes must include the font and alignment
- # as well. So when using a custom color, we construct a new
- # attributed string whenever the title, font, alignment or color
- # is changed.
-
- def _ns_update_attributed_title(self):
- if self._color:
- ns_button = self._ns_view
- ns_attrs = NSMutableDictionary.alloc().init()
- ns_attrs[NSFontAttributeName] = ns_button.font()
- ns_attrs[NSForegroundColorAttributeName] = self._color._ns_color
- ns_parstyle = NSMutableParagraphStyle.alloc().init()
- ns_parstyle.setAlignment_(ns_button.alignment())
- ns_attrs[NSParagraphStyleAttributeName] = ns_parstyle
- ns_attstr = NSAttributedString.alloc().initWithString_attributes_(
- ns_button.title(), ns_attrs)
- ns_button.setAttributedTitle_(ns_attstr)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSButton(NSButton, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Canvas.py b/PyGUI-2.5.3/GUI/Cocoa/Canvas.py
deleted file mode 100644
index e65d6b4..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Canvas.py
+++ /dev/null
@@ -1,321 +0,0 @@
-#
-# Python GUI - Drawing - PyObjC
-#
-
-from array import array
-from Foundation import NSPoint, NSMakeRect, NSString
-from AppKit import NSGraphicsContext, NSBezierPath, NSEvenOddWindingRule, \
- NSFontAttributeName, NSForegroundColorAttributeName, \
- NSCompositeCopy, NSCompositeSourceOver, NSAffineTransform
-from GUI import export
-from GUI.StdColors import black, white
-from GUI.GCanvases import Canvas as GCanvas
-import math
-
-class Canvas(GCanvas):
-
- def __init__(self):
- self._ns_path = NSBezierPath.bezierPath()
- self._ns_path.setWindingRule_(NSEvenOddWindingRule)
- self._stack = []
- ctx = NSGraphicsContext.currentContext()
- ctx.setCompositingOperation_(NSCompositeSourceOver)
- GCanvas.__init__(self)
- self._printing = not ctx.isDrawingToScreen()
- self.initgraphics()
- self.transformstack = [[]]
-
- def get_pencolor(self):
- return self._pencolor
-
- def set_pencolor(self, c):
- self._pencolor = c
-
- def get_fillcolor(self):
- return self._fillcolor
-
- def set_fillcolor(self, c):
- self._fillcolor = c
-
- def get_textcolor(self):
- return self._textcolor
-
- def set_textcolor(self, c):
- self._textcolor = c
-
- def get_backcolor(self):
- return self._backcolor
-
- def set_backcolor(self, c):
- self._backcolor = c
-
- def get_pensize(self):
- return self._pensize
-
- def set_pensize(self, d):
- self._pensize = d
- self._ns_path.setLineWidth_(d)
-
- def get_font(self):
- return self._font
-
- def set_font(self, f):
- self._font = f
-
- def get_current_point(self):
- return self._ns_path.currentPoint()
-
- def newpath(self):
- self._ns_path.removeAllPoints()
- #for i in range(len(self.transformstack)):
- #j = self.transformstack.pop()
- #transforms = {"translate":self.translate,"rotate":self.rotate,"scale":self.scale}
- #transforms[j[0]](*j[1:])
-
- def moveto(self, x, y):
- x, y = self._transform(x, y)
- self._ns_path.moveToPoint_((x, y))
-
- def rmoveto(self, dx, dy):
- self._ns_path.relativeMoveToPoint_((dx, dy))
-
- def lineto(self, x, y):
- x, y = self._transform(x, y)
- self._ns_path.lineToPoint_((x, y))
-
- def rlineto(self, dx, dy):
- self._ns_path.relativeLineToPoint_((dx, dy))
-
- def curveto(self, cp1, cp2, ep):
- cp1 = self._transform(*cp1)
- cp2 = self._transform(*cp2)
- ep = self._transform(*ep)
- self._ns_path.curveToPoint_controlPoint1_controlPoint2_(
- ep, cp1, cp2)
-
- def rcurveto(self, cp1, cp2, ep):
- self._ns_path.relativeCurveToPoint_controlPoint1_controlPoint2_(
- ep, cp1, cp2)
-
- def arc(self, c, r, a0, a1):
- c = self._transform(*c)
- self._ns_path.appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_(
- c, r, a0, a1)
-
- def rect(self, rect):
- try:
- rect = self._transform(rect[0],rect[1]) + self._transform(rect[2], rect[3])
- except:
- print "Error here - line 113"
- self._ns_path.appendBezierPathWithRect_(_ns_rect(rect))
-
- def oval(self, rect):
- rect = (self._transform(*rect[0]), self._transform(*rect[1]))
- self._ns_path.appendBezierPathWithOvalInRect(_ns_rect(rect))
-
- def lines(self, points):
- # Due to a memory leak in PyObjC 2.3, we need to be very careful
- # about the type of object that we pass to appendBezierPathWithPoints_count_.
- # If 'points' is a numpy array, we convert it to an array.array of type 'f',
- # else we fall back on iterating over the points in Python.
-# ns = self._ns_path
-# ns.moveToPoint_(points[0])
-# ns.appendBezierPathWithPoints_count_(points, len(points))
- try:
- p = points.flat
- except AttributeError:
- GCanvas.lines(self, points)
- else:
- a = array('f', p)
- ns = self._ns_path
- ns.moveToPoint_(points[0])
- ns.appendBezierPathWithPoints_count_(a, len(points))
-
-
- def poly(self, points):
-# ns = self._ns_path
-# ns.moveToPoint_(points[0])
-# ns.appendBezierPathWithPoints_count_(points, len(points))
-# ns.closePath()
- self.lines(points)
- self.closepath()
-
- def closepath(self):
- self._ns_path.closePath()
-
- def clip(self):
- ns = self._ns_path
- ns.addClip()
-
- def rectclip(self, (l, t, r, b)):
- ns_rect = NSMakeRect(l, t, r - l, b - t)
- NSBezierPath.clipRect_(ns_rect)
-
- def gsave(self):
- self._stack.append((
- self._pencolor, self._fillcolor, self._textcolor, self._backcolor,
- self._pensize, self._font))
- self.transformstack.append([])
- NSGraphicsContext.currentContext().saveGraphicsState()
-
- def grestore(self):
- (self._pencolor, self._fillcolor, self._textcolor, self._backcolor,
- self._pensize, self._font) = self._stack.pop()
- self.transformstack.pop()
- NSGraphicsContext.currentContext().restoreGraphicsState()
-
- def stroke(self):
- ns = self._ns_path
- self._pencolor._ns_color.set()
- ns.stroke()
-
- def fill(self):
- ns = self._ns_path
- self._fillcolor._ns_color.set()
- ns.fill()
-
- def erase(self):
- ns = self._ns_path
- self._backcolor._ns_color.set()
- ctx = NSGraphicsContext.currentContext()
- ctx.setCompositingOperation_(NSCompositeCopy)
- ns.fill()
- ctx.setCompositingOperation_(NSCompositeSourceOver)
-
- def fill_stroke(self):
- ns = self._ns_path
- self._pencolor._ns_color.set()
- ns.stroke()
- self._fillcolor._ns_color.set()
- ns.fill()
-
- def show_text(self, text):
- x, y = self._ns_path.currentPoint()
- font = self._font
- ns_font = font._ns_font
- ns_color = self._textcolor._ns_color
- ns_string = NSString.stringWithString_(text)
- ns_attrs = {
- NSFontAttributeName: ns_font,
- NSForegroundColorAttributeName: ns_color,
- }
-# print "Canvas.show_text:", repr(text) ###
-# print "family:", ns_font.familyName() ###
-# print "size:", ns_font.pointSize() ###
-# print "ascender:", ns_font.ascender() ###
-# print "descender:", ns_font.descender() ###
-# print "capHeight:", ns_font.capHeight() ###
-# print "leading:", ns_font.leading() ###
-# print "matrix:", ns_font.matrix() ###
-# print "defaultLineHeightForFont:", ns_font.defaultLineHeightForFont() ###
- h = ns_font.defaultLineHeightForFont()
- d = -ns_font.descender()
- dy = h - d
- if ns_font.familyName() == "Courier New":
- dy += ns_font.pointSize() * 0.229167
- ns_point = NSPoint(x, y - dy)
- #print "drawing at:", ns_point ###
- ns_string.drawAtPoint_withAttributes_(ns_point, ns_attrs)
- dx = ns_font.widthOfString_(ns_string)
- #self._ns_path.relativeMoveToPoint_(NSPoint(x + dx, y))
- self._ns_path.relativeMoveToPoint_((dx, 0))
-
- def _ns_frame_rect(self, (l, t, r, b)):
- p = self._pensize
- q = 0.5 * p
- return NSMakeRect(l + q, t + q, r - l - p, b - t - p)
-
- def stroke_rect(self, r):
- self._pencolor._ns_color.set()
- NSBezierPath.setDefaultLineWidth_(self._pensize)
- NSBezierPath.strokeRect_(_ns_rect(r))
-
- def frame_rect(self, r):
- self._pencolor._ns_color.set()
- NSBezierPath.setDefaultLineWidth_(self._pensize)
- NSBezierPath.strokeRect_(self._ns_frame_rect(r))
-
- def fill_rect(self, r):
- self._fillcolor._ns_color.set()
- NSBezierPath.fillRect_(_ns_rect(r))
-
- def erase_rect(self, r):
- self._backcolor._ns_color.set()
- NSBezierPath.fillRect_(_ns_rect(r))
-
- def _ns_oval_path(self, ns_rect):
- ns_path = NSBezierPath.bezierPathWithOvalInRect_(ns_rect)
- ns_path.setLineWidth_(self._pensize)
- return ns_path
-
- def stroke_oval(self, r):
- self._pencolor._ns_color.set()
- self._ns_oval_path(_ns_rect(r)).stroke()
-
- def frame_oval(self, r):
- self._pencolor._ns_color.set()
- self._ns_oval_path(self._ns_frame_rect(r)).stroke()
-
- def fill_oval(self, r):
- self._fillcolor._ns_color.set()
- self._ns_oval_path(_ns_rect(r)).fill()
-
- def erase_oval(self, r):
- self._backcolor._ns_color.set()
- self._ns_oval_path(_ns_rect(r)).fill()
-
- def _ns_arc_path(self, c, r, sa, ea):
- ns_path = NSBezierPath.bezierPath()
- ns_path.setLineWidth_(self._pensize)
- ns_path.\
- appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_(
- c, r, sa, ea)
- return ns_path
-
- def stroke_arc(self, center, radius, start_angle, arc_angle):
- ns_path = self._ns_arc_path(center, radius, start_angle, arc_angle)
- self._pencolor._ns_color.set()
- ns_path.stroke()
-
- def frame_arc(self, center, radius, start_angle, arc_angle):
- r = radius - 0.5 * self._pensize
- ns_path = self._ns_arc_path(center, r, start_angle, arc_angle)
- self._pencolor._ns_color.set()
- ns_path.stroke()
-
- def translate(self, dx, dy):
- matrix = NSAffineTransform.transform()
- matrix.translateXBy_yBy_(dx, dy)
- self._ns_path.transformUsingAffineTransform_(matrix)
- self.transformstack[-1].append(["translate",dx,dy])
-
- def rotate(self, rotation):
- matrix = NSAffineTransform.transform()
- matrix.rotateByDegrees_(rotation)
- self._ns_path.transformUsingAffineTransform_(matrix)
- self.transformstack[-1].append(["rotate",rotation])
-
- def scale(self, sx, sy):
- matrix = NSAffineTransform.transform()
- matrix.scaleXBy_yBy_(sx, sy)
- self._ns_path.transformUsingAffineTransform_(matrix)
- self.transformstack[-1].append(["scale",sx,sy])
- def _transform(self, x, y):
- for i in self.transformstack: #reversed(self.transformstack):
- for j in i: # reversed(i):
- if j[0]=="translate":
- x = x+j[1]
- y = y+j[2]
- elif j[0]=="rotate":
- x = x*math.cos(j[1])-y*math.sin(j[1])
- y = x*math.sin(j[1])+y*math.cos(j[1])
- elif j[0]=="scale":
- x = x*j[1]
- y = y*j[2]
- return x, y
-
-def _ns_rect((l, t, r, b)):
- return NSMakeRect(l, t, r - l, b - t)
-
-export(Canvas)
-
diff --git a/PyGUI-2.5.3/GUI/Cocoa/CheckBox.py b/PyGUI-2.5.3/GUI/Cocoa/CheckBox.py
deleted file mode 100644
index bc0732e..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/CheckBox.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Python GUI - Check boxes - PyObjC
-#
-
-import AppKit
-from AppKit import NSOnState, NSOffState, NSMixedState
-from GUI import export
-from GUI.Actions import Action
-from GUI.StdFonts import system_font
-from GUI.ButtonBasedControls import ButtonBasedControl
-from GUI.GCheckBoxes import CheckBox as GCheckBox
-
-class CheckBox(ButtonBasedControl, GCheckBox):
-
- _ns_mixed = False
-
- def __init__(self, title = "New Check Box", font = system_font, **kwds):
- ns_button = self._create_ns_button(title = title, font = font,
- ns_button_type = AppKit.NSSwitchButton,
- ns_bezel_style = AppKit.NSRoundedBezelStyle)
- #if mixed:
- # self._ns_mixed = True
- # ns_button.setAllowsMixedState_(True)
- GCheckBox.__init__(self, _ns_view = ns_button, **kwds)
-
- def get_mixed(self):
- return self._ns_view.allowsMixedState()
-
- def set_mixed(self, x):
- self._ns_view.setAllowsMixedState_(x)
-
- def get_on(self):
- state = self._ns_view.state()
- if state == NSMixedState:
- return 'mixed'
- else:
- return state <> NSOffState
-
- def set_on(self, v):
- if v == 'mixed' and self.mixed:
- state = NSMixedState
- elif v:
- state = NSOnState
- else:
- state = NSOffState
- self._ns_view.setState_(state)
-
- def do_action(self):
- if not self._auto_toggle:
- self.on = not self.on
- Action.do_action(self)
-
-export(CheckBox)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Color.py b/PyGUI-2.5.3/GUI/Cocoa/Color.py
deleted file mode 100644
index a756d38..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Color.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Python GUI - Colors - PyObjC
-#
-
-from AppKit import NSColor, NSCalibratedRGBColorSpace
-from GUI import export
-from GUI.GColors import Color as GColor
-
-NSColor.setIgnoresAlpha_(False)
-
-class Color(GColor):
-
- def _from_ns_color(cls, ns_color):
- color = cls.__new__(cls)
- color._ns_color = ns_color.colorUsingColorSpaceName_(
- NSCalibratedRGBColorSpace)
- return color
-
- _from_ns_color = classmethod(_from_ns_color)
-
- def __init__(self, red, green, blue, alpha = 1.0):
- self._ns_color = NSColor.colorWithCalibratedRed_green_blue_alpha_(
- red, green, blue, alpha)
-
- def get_red(self):
- return self._ns_color.redComponent()
-
- def get_green(self):
- return self._ns_color.greenComponent()
-
- def get_blue(self):
- return self._ns_color.blueComponent()
-
- def get_alpha(self):
- return self._ns_color.alphaComponent()
-
- def get_rgb(self):
- return self.get_rgba()[:3]
-
- def get_rgba(self):
- m = self._ns_color.getRed_green_blue_alpha_
- try:
- return m()
- except TypeError:
- return m(None, None, None, None)
-
-export(Color)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Colors.py b/PyGUI-2.5.3/GUI/Cocoa/Colors.py
deleted file mode 100644
index cf159f4..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Colors.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# Python GUI - Color constants and functions - Cocoa
-#
-
-from AppKit import NSColor
-from GUI import Color
-
-rgb = Color
-
-selection_forecolor = Color._from_ns_color(NSColor.selectedTextColor())
-selection_backcolor = Color._from_ns_color(NSColor.selectedTextBackgroundColor())
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Component.py b/PyGUI-2.5.3/GUI/Cocoa/Component.py
deleted file mode 100644
index 895a9c2..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Component.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#
-# Python GUI - Components - PyObjC
-#
-
-from Foundation import NSRect, NSPoint, NSSize, NSObject
-from GUI import export
-from GUI import Globals, application
-from GUI import Event
-from GUI.GComponents import Component as GComponent
-
-#------------------------------------------------------------------------------
-
-Globals._ns_view_to_component = {} # Mapping from NSView to corresponding Component
-
-#------------------------------------------------------------------------------
-
-class Component(GComponent):
-
- _has_local_coords = True
- _generic_tabbing = False
- _ns_pass_mouse_events_to_platform = False
- _ns_handle_mouse = False
- _ns_accept_first_responder = False
-
- def __init__(self, _ns_view, _ns_inner_view = None, _ns_responder = None,
- _ns_set_autoresizing_mask = True, **kwds):
- self._ns_view = _ns_view
- if not _ns_inner_view:
- _ns_inner_view = _ns_view
- self._ns_inner_view = _ns_inner_view
- self._ns_responder = _ns_responder or _ns_inner_view
- Globals._ns_view_to_component[_ns_view] = self
- GComponent.__init__(self, **kwds)
-
- def destroy(self):
- #print "Component.destroy:", self ###
- GComponent.destroy(self)
- _ns_view = self._ns_view
- if _ns_view in Globals._ns_view_to_component:
- #print "Component.destroy: removing", _ns_view, "from mapping" ###
- del Globals._ns_view_to_component[_ns_view]
- #print "Component.destroy: breaking link to", self._ns_view ###
- self._ns_view = None
- #if self._ns_inner_view: print "Component.destroy: breaking inner link to", self._ns_inner_view ###
- self._ns_inner_view = None
- self._ns_responder = None
-
- def get_bounds(self):
- (l, t), (w, h) = self._ns_view.frame()
- return (l, t, l + w, t + h)
-
- def set_bounds(self, (l, t, r, b)):
- ns = self._ns_view
- w0, h0 = ns.frame().size
- w1 = r - l
- h1 = b - t
- ns_frame = ((l, t), (w1, h1))
- old_ns_frame = ns.frame()
- ns.setFrame_(ns_frame)
- sv = ns.superview()
- if sv:
- sv.setNeedsDisplayInRect_(old_ns_frame)
- sv.setNeedsDisplayInRect_(ns_frame)
- if w0 != w1 or h0 != h1:
- self._resized((w1 - w0, h1 - h0))
-
- def become_target(self):
- ns_view = self._ns_view
- ns_window = ns_view.window()
- if ns_window:
- self._ns_accept_first_responder = True
- ns_window.makeFirstResponder_(ns_view)
- self._ns_accept_first_responder = False
-
- def _ns_pass_to_platform(self, event, method_name):
- #print "Component._ns_pass_to_platform:", self ###
- h = self._ns_responder
- b = h.__class__.__bases__[0]
- m = getattr(b, method_name)
- #print "...ns responder =", object.__repr__(h) ###
- #print "...ns base class =", b ###
- #print "...ns method =", m ###
- m(h, event._ns_event)
-
- def mouse_down(self, event):
- if self._ns_handle_mouse:
- self._ns_pass_to_platform(event, ns_mouse_down_methods[event.button])
-
- def mouse_drag(self, event):
- if self._ns_handle_mouse:
- self._ns_pass_to_platform(event, 'mouseDragged_')
-
- def mouse_up(self, event):
- if self._ns_handle_mouse:
- self._ns_pass_to_platform(event, ns_mouse_up_methods[event.button])
-
- def mouse_move(self, event):
- #self._ns_pass_to_platform(event, 'mouseMoved_')
- pass
-
- def mouse_enter(self, event):
- #self._ns_pass_to_platform(event, 'mouseEntered_')
- pass
-
- def mouse_leave(self, event):
- #self._ns_pass_to_platform(event, 'mouseExited_')
- pass
-
- def key_down(self, event):
- #print "Component.key_down:", repr(event.char), "for", self ###
- self._ns_pass_to_platform(event, 'keyDown_')
-
- def key_up(self, event):
- self._ns_pass_to_platform(event, 'keyUp_')
-
-#------------------------------------------------------------------------------
-
-ns_mouse_down_methods = {
- 'left': 'mouseDown_', 'middle': 'otherMouseDown_', 'right': 'rightMouseDown_'
-}
-
-ns_mouse_up_methods = {
- 'left': 'mouseUp_', 'middle': 'otherMouseUp_', 'right': 'rightMouseUp_'
-}
-
-#------------------------------------------------------------------------------
-
-export(Component)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Container.py b/PyGUI-2.5.3/GUI/Cocoa/Container.py
deleted file mode 100644
index e578481..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Container.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Python GUI - Containers - PyObjC version
-#
-
-from AppKit import NSView
-from GUI.Utils import PyGUI_Flipped_NSView
-from GUI import export
-from GUI.GContainers import Container as GContainer
-
-class Container(GContainer):
- # _ns_inner_view NSView Containing NSView for subcomponents
-
-# def __init__(self, _ns_view, **kwds):
-# GContainer.__init__(self, _ns_view = _ns_view, **kwds)
-
-# def destroy(self):
-# #print "Container.destroy:", self ###
-# GContainer.destroy(self)
-# #print "Container.destroy: breaking inner link to", self._ns_inner_view ###
-
- def _add(self, comp):
- GContainer._add(self, comp)
- self._ns_inner_view.addSubview_(comp._ns_view)
-
- def _remove(self, comp):
- GContainer._remove(self, comp)
- comp._ns_view.removeFromSuperview()
-
-#------------------------------------------------------------------------------
-
-export(Container)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Control.py b/PyGUI-2.5.3/GUI/Cocoa/Control.py
deleted file mode 100644
index 17bc4a0..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Control.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# Python GUI - Controls - PyObjC
-#
-
-from math import ceil
-from Foundation import NSSize
-import AppKit
-from GUI import export
-from GUI import StdColors
-from GUI import Color
-from GUI import Font
-from GUI.GControls import Control as GControl
-
-_ns_alignment_from_just = {
- 'left': AppKit.NSLeftTextAlignment,
- 'center': AppKit.NSCenterTextAlignment,
- 'centre': AppKit.NSCenterTextAlignment,
- 'right': AppKit.NSRightTextAlignment,
- 'flush': AppKit.NSJustifiedTextAlignment,
- '': AppKit.NSNaturalTextAlignment,
-}
-
-_ns_alignment_to_just = {
- AppKit.NSLeftTextAlignment: 'left',
- AppKit.NSCenterTextAlignment: 'center',
- AppKit.NSRightTextAlignment: 'right',
- AppKit.NSJustifiedTextAlignment: 'flush',
- AppKit.NSNaturalTextAlignment: '',
-}
-
-class Control(GControl):
-
- #_vertical_padding = 5
-
- def get_title(self):
- return self._ns_cell().title()
-
- def set_title(self, v):
- self._ns_cell().setTitle_(v)
-
- def get_enabled(self):
- return self._ns_cell().enabled()
-
- def set_enabled(self, v):
- self._ns_cell().setEnabled_(v)
-
- def get_color(self):
- return StdColors.black
-
- def set_color(self, v):
- pass
-
- def get_font(self):
- return Font._from_ns_font(self._ns_cell().font())
-
- def set_font(self, f):
- self._ns_cell().setFont_(f._ns_font)
-
- def get_just(self):
- return _ns_alignment_to_just[self._ns_cell().alignment()]
-
- def set_just(self, v):
- self._ns_cell().setAlignment_(_ns_alignment_from_just[v])
-
- def _ns_cell(self):
- return self._ns_inner_view.cell()
-
-export(Control)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Cursor.py b/PyGUI-2.5.3/GUI/Cocoa/Cursor.py
deleted file mode 100644
index 48a86f0..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Cursor.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Python GUI - Cursors - Cocoa
-#
-
-from AppKit import NSCursor
-from GUI import export
-from GUI.GCursors import Cursor as GCursor
-
-class Cursor(GCursor):
- #
- # _ns_cursor NSCursor
-
- def _from_ns_cursor(cls, ns_cursor):
- cursor = cls.__new__(cls)
- cursor._ns_cursor = ns_cursor
- return cursor
-
- _from_ns_cursor = classmethod(_from_ns_cursor)
-
- def _init_from_image_and_hotspot(self, image, hotspot):
- #print "Cursor._init_from_image_and_hotspot:", image, hotspot ###
- ns_image = image._ns_image.copy()
- ns_image.setFlipped_(False)
- self._ns_cursor = NSCursor.alloc().initWithImage_hotSpot_(
- ns_image, hotspot)
-
-export(Cursor)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Dialog.py b/PyGUI-2.5.3/GUI/Cocoa/Dialog.py
deleted file mode 100644
index 92016a6..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Dialog.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Python GUI - Dialogs - Cocoa
-#
-
-from GUI import export
-from GUI.GDialogs import Dialog #as GDialog
-
-#class Dialog(GDialog):
-#
-# _default_keys = ['\r']
-# _cancel_keys = ['\x1b']
-#
-# def key_down(self, event):
-# # Cocoa already takes care of default/cancel button activation
-# self.pass_to_next_handler('key_down', event)
-
-export(Dialog)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/DrawableContainer.py b/PyGUI-2.5.3/GUI/Cocoa/DrawableContainer.py
deleted file mode 100644
index 5ddb84f..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/DrawableContainer.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# Python GUI - DrawableContainers - PyObjC
-#
-
-from Foundation import NSMakeRect
-from AppKit import NSView, NSScrollView, NSColor
-from GUI import export
-from GUI.Utils import PyGUI_Flipped_NSView
-from GUI import Canvas
-from GUI.Geometry import rect_to_ns_rect
-from GUI.Utils import NSMultiClass, PyGUI_NS_ViewBase
-from GUI.GDrawableContainers import default_size, \
- DrawableContainer as GDrawableContainer
-
-ns_gray = NSColor.grayColor()
-
-class DrawableContainer(GDrawableContainer):
-
- def __init__(self, **kwds):
- width, height = default_size
- ns_frame = NSMakeRect(0, 0, width, height)
- ns_inner_view = PyGUI_User_NSView.alloc().initWithFrame_(ns_frame)
- if self._ns_scrollable:
- ns_view = NSScrollView.alloc().initWithFrame_(ns_frame)
- ns_view.setDocumentView_(ns_inner_view)
- ns_view.setBackgroundColor_(ns_gray)
- else:
- ns_view = ns_inner_view
- ns_inner_view.pygui_component = self
- GDrawableContainer.__init__(self, _ns_view = ns_view, _ns_inner_view = ns_inner_view)
- self.set(**kwds)
-
- def destroy(self):
- #print "View.destroy:", self ###
- ns_inner_view = self._ns_inner_view
- GDrawableContainer.destroy(self)
- if ns_inner_view:
- #print "View.destroy: breaking back link from", ns_inner_view ###
- ns_inner_view.pygui_component = None
-
- def get_background_color(self):
- ns_view = self._ns_inner_view
- if ns_view.drawsBackground():
- return Color._from_ns_color(ns_view.backgroundColor())
-
- def set_background_color(self, x):
- ns_view = self._ns_inner_view
- if x:
- ns_view.setBackgroundColor_(x._ns_color)
- ns_view.setDrawsBackground_(True)
- else:
- ns_view.setDrawsBackground_(False)
-
- def invalidate(self):
- self._ns_inner_view.setNeedsDisplay_(True)
-
- def invalidate_rect(self, r):
- self._ns_inner_view.setNeedsDisplayInRect_(rect_to_ns_rect(r))
-
- def with_canvas(self, proc):
- ns_view = self._ns_view
- ns_view.lockFocus()
- proc(Canvas())
- ns_view.unlockFocus()
-
- def update(self):
- self._ns_view.displayIfNeeded()
-
- def track_mouse(self):
- return self._ns_track_mouse(self._ns_inner_view)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_User_NSView(PyGUI_Flipped_NSView, PyGUI_NS_ViewBase):
- #
- # pygui_component View
-
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
- def drawRect_(self, ns_rect):
- (l, t), (w, h) = ns_rect
- rect = (l, t, l + w, t + h)
- self.pygui_component.draw(Canvas(), rect)
-
-export(DrawableContainer)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/EditCmdHandler.py b/PyGUI-2.5.3/GUI/Cocoa/EditCmdHandler.py
deleted file mode 100644
index 876a752..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/EditCmdHandler.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# PyGUI - Edit command handling - Cocoa
-#
-
-from AppKit import NSMenuItem
-from GUI import export
-
-class EditCmdHandler(object):
- # Mixin for Components whose _ns_responder handles the
- # standard editing commands.
-
- def setup_menus(self, m):
- def validate(cmd_name, ns_selector):
- ns_menu_item = NSMenuItem.alloc().\
- initWithTitle_action_keyEquivalent_("", ns_selector, "")
- m[cmd_name].enabled = ns_target.validateMenuItem_(ns_menu_item)
- ns_target = self.window._ns_window
- if ns_target:
- validate('undo_cmd', 'undo:')
- validate('redo_cmd', 'redo:')
- ns_target = self._ns_edit_cmd_target()
- if ns_target:
- validate('cut_cmd', 'cut:')
- validate('copy_cmd', 'copy:')
- validate('paste_cmd', 'paste:')
- validate('clear_cmd', 'delete:')
- validate('select_all_cmd', 'selectAll:')
-
- def undo_cmd(self):
- ns_window = self.window._ns_window
- if ns_window:
- ns_window.undo_(None)
-
- def redo_cmd(self):
- ns_window = self.window._ns_window
- if ns_window:
- ns_window.redo_(None)
-
- def cut_cmd(self):
- self._ns_edit_cmd('cut_')
-
- def copy_cmd(self):
- self._ns_edit_cmd('copy_')
-
- def paste_cmd(self):
- self._ns_edit_cmd('paste_')
-
- def clear_cmd(self):
- self._ns_edit_cmd('delete_')
-
- def select_all_cmd(self):
- self._ns_edit_cmd('selectAll_')
-
- def _ns_edit_cmd(self, ns_method_name):
- ns_target = self._ns_edit_cmd_target()
- if ns_target:
- getattr(ns_target, ns_method_name)(None)
-
- def _ns_edit_cmd_target(self):
- return self._ns_responder
-
-export(EditCmdHandler)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Event.py b/PyGUI-2.5.3/GUI/Cocoa/Event.py
deleted file mode 100644
index 6941271..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Event.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#
-# Python GUI - Events - PyObjC version
-#
-
-import AppKit
-from AppKit import NSEvent, \
- NSShiftKeyMask, NSControlKeyMask, NSCommandKeyMask, NSAlternateKeyMask
-from GUI import export
-from GUI import Globals
-from GUI.GEvents import Event as GEvent
-
-_ns_event_type_to_kind = {
- AppKit.NSLeftMouseDown: 'mouse_down',
- AppKit.NSLeftMouseUp: 'mouse_up',
- AppKit.NSRightMouseDown: 'mouse_down',
- AppKit.NSRightMouseUp: 'mouse_up',
- AppKit.NSOtherMouseDown: 'mouse_down',
- AppKit.NSOtherMouseUp: 'mouse_up',
- AppKit.NSMouseMoved: 'mouse_move',
- AppKit.NSLeftMouseDragged: 'mouse_drag',
- AppKit.NSRightMouseDragged: 'mouse_drag',
- AppKit.NSOtherMouseDragged: 'mouse_drag',
- AppKit.NSMouseEntered: 'mouse_enter',
- AppKit.NSMouseExited: 'mouse_leave',
- AppKit.NSKeyDown: 'key_down',
- AppKit.NSKeyUp: 'key_up',
- AppKit.NSFlagsChanged: 'flags_changed',
- AppKit.NSAppKitDefined: 'app_kit_defined',
- AppKit.NSSystemDefined: 'system_defined',
- AppKit.NSApplicationDefined: 'application_defined',
- AppKit.NSPeriodic: 'periodic',
- AppKit.NSCursorUpdate: 'cursor_update',
-}
-
-_ns_event_type_to_button = {
- AppKit.NSLeftMouseDown: 'left',
- AppKit.NSLeftMouseUp: 'left',
- AppKit.NSRightMouseDown: 'right',
- AppKit.NSRightMouseUp: 'right',
- AppKit.NSOtherMouseDown: 'middle',
- AppKit.NSOtherMouseUp: 'middle',
- AppKit.NSLeftMouseDragged: 'left',
- AppKit.NSRightMouseDragged: 'right',
- AppKit.NSOtherMouseDragged: 'middle',
-}
-
-_ns_keycode_to_keyname = {
- AppKit.NSUpArrowFunctionKey: 'up_arrow',
- AppKit.NSDownArrowFunctionKey: 'down_arrow',
- AppKit.NSLeftArrowFunctionKey: 'left_arrow',
- AppKit.NSRightArrowFunctionKey: 'right_arrow',
- AppKit.NSF1FunctionKey: 'f1',
- AppKit.NSF2FunctionKey: 'f2',
- AppKit.NSF3FunctionKey: 'f3',
- AppKit.NSF4FunctionKey: 'f4',
- AppKit.NSF5FunctionKey: 'f5',
- AppKit.NSF6FunctionKey: 'f6',
- AppKit.NSF7FunctionKey: 'f7',
- AppKit.NSF8FunctionKey: 'f8',
- AppKit.NSF9FunctionKey: 'f9',
- AppKit.NSF10FunctionKey: 'f10',
- AppKit.NSF11FunctionKey: 'f11',
- AppKit.NSF12FunctionKey: 'f12',
- AppKit.NSF13FunctionKey: 'f13',
- AppKit.NSF14FunctionKey: 'f14',
- AppKit.NSF15FunctionKey : 'f15',
- AppKit.NSDeleteFunctionKey: 'delete',
- AppKit.NSHomeFunctionKey: 'home',
- AppKit.NSEndFunctionKey: 'end',
- AppKit.NSPageUpFunctionKey: 'page_up',
- AppKit.NSPageDownFunctionKey: 'page_down',
- AppKit.NSClearLineFunctionKey: 'clear',
- #AppKit.NSHelpFunctionKey: 'help',
- AppKit.NSHelpFunctionKey: 'insert',
- "\r": 'return',
- "\x03": 'enter',
-}
-
-_mouse_events = [
- 'mouse_down', 'mouse_drag', 'mouse_up',
- 'mouse_move', 'mouse_enter', 'mouse_exit'
-]
-
-_key_events = [
- 'key_down', 'key_up'
-]
-
-_ns_screen_height = None
-
-class Event(GEvent):
- """Platform-dependent modifiers (boolean):
- command The Macintosh Command key.
- option The Macintosh Option key.
- """
-
- global_position = (0, 0)
- position = (0, 0)
- button = ''
- num_clicks = 0
- char = ""
- unichars = ""
- key = ''
- auto = False
- delta = (0, 0)
-
- def __init__(self, ns_event):
- self._ns_event = ns_event
- _ns_type = ns_event.type()
- kind = _ns_event_type_to_kind[_ns_type]
- self.kind = kind
- self.time = ns_event.timestamp()
- ns_window = ns_event.window()
- is_mouse_event = kind in _mouse_events
- if is_mouse_event:
- ns_win_pos = ns_event.locationInWindow()
- x, y = ns_window.convertBaseToScreen_(ns_win_pos)
- else:
- ns_last_mouse = Globals.ns_last_mouse_moved_event
- if ns_last_mouse:
- ns_window = ns_last_mouse.window()
- if ns_window:
- ns_win_pos = ns_last_mouse.locationInWindow()
- x, y = ns_window.convertBaseToScreen_(ns_win_pos)
- else:
- x, y = ns_last_mouse.locationInWindow()
- else:
- x, y = NSEvent.mouseLocation()
- h = Globals.ns_screen_height
- self.global_position = (x, h - y)
- if is_mouse_event:
- self.button = _ns_event_type_to_button.get(_ns_type, '')
- if kind == 'mouse_down':
- self.num_clicks = ns_event.clickCount()
- self.delta = (ns_event.deltaX(), ns_event.deltaY())
- ns_flags = ns_event.modifierFlags()
- self.shift = self.extend_contig = (ns_flags & NSShiftKeyMask) <> 0
- self.control = (ns_flags & NSControlKeyMask) <> 0
- self.command = self.extend_noncontig = (ns_flags & NSCommandKeyMask) <> 0
- self.option = (ns_flags & NSAlternateKeyMask) <> 0
- if kind in _key_events:
- self.auto = ns_event.isARepeat()
- ns_chars = ns_event.characters()
- #print "Event.__init__: ns_chars =", repr(ns_chars) ###
- self.unichars = ns_chars
- if len(ns_chars) == 1:
- if ns_chars == "\x19" and ns_event.keyCode() == 48:
- self.char = "\t"
- elif ns_chars == "\x7f":
- self.char = "\x08"
- elif ns_chars <= "\x7e":
- self.char = str(ns_chars)
- #else:
- # self.char = ns_chars
- ns_unmod = ns_event.charactersIgnoringModifiers()
- key = _ns_keycode_to_keyname.get(ns_chars, '')
- if not key and u"\x20" <= ns_unmod <= u"\x7e":
- key = str(ns_unmod)
- self.key = key
- if key == 'enter':
- self.char = "\r"
- elif key == 'delete':
- self.char = "\x7f"
-
- def _platform_modifiers_str(self):
- return " command:%s option:%s" % (self.command, self.option)
-
-export(Event)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Files.py b/PyGUI-2.5.3/GUI/Cocoa/Files.py
deleted file mode 100644
index 3d78a3f..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Files.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Python GUI - File references and types - Cocoa
-#
-
-from struct import unpack
-from Foundation import NSFileTypeForHFSTypeCode, \
- NSFileManager, NSFileHFSCreatorCode, NSFileHFSTypeCode
-from GUI.GFiles import FileRef as GFileRef, DirRef, FileType as GFileType
-
-class FileType(GFileType):
-
- def _ns_file_types(self):
- # Return list of Cocoa file type specifications matched
- # by this file type.
- result = []
- mac_type = self._mac_type
- if mac_type:
- result.append(NSFileTypeForHFSTypeCode(mac_type))
- suffix = self._suffix
- if suffix:
- result.append(suffix)
- return result
-
-
-class FileRef(GFileRef):
-
- def _set_type(self, file_type):
- creator = file_type.mac_creator
- type = file_type.mac_type
- if creator is not None or type is not None:
- fm = NSFileManager.defaultManager()
- attrs = {}
- if creator is not None:
- attrs[NSFileHFSCreatorCode] = four_char_code(creator)
- if type is not None:
- attrs[NSFileHFSTypeCode] = four_char_code(type)
- #print "FileRef: Setting attributes of %r to %s" % ( ###
- # self.path, attrs) ###
- fm.changeFileAttributes_atPath_(attrs, self.path)
-
-
-def four_char_code(chars):
- return unpack(">L", chars)[0]
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Font.py b/PyGUI-2.5.3/GUI/Cocoa/Font.py
deleted file mode 100644
index 586ee46..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Font.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# Python GUI - Fonts - PyObjC
-#
-
-import sys
-from AppKit import NSFont, NSFontManager, NSBoldFontMask, NSItalicFontMask, \
- NSLayoutManager
-from GUI import export
-from GUI.GFonts import Font as GFont
-
-_ns_font_manager = NSFontManager.sharedFontManager()
-_ns_layout_manager = NSLayoutManager.alloc().init()
-
-class Font(GFont):
- # _ns_font NSFont
-
- def _from_ns_font(cls, ns_font):
- font = cls.__new__(cls)
- font._ns_font = ns_font
- return font
-
- _from_ns_font = classmethod(_from_ns_font)
-
- def __init__(self, family, size = 12, style = []):
- traits = 0
- if 'bold' in style:
- traits |= NSBoldFontMask
- if 'italic' in style:
- traits |= NSItalicFontMask
- self._ns_font = _ns_font_manager.fontWithFamily_traits_weight_size_(
- family, traits, 5, size)
- if not self._ns_font:
- import StdFonts
- self._ns_font = StdFonts.application_font._ns_font
-
- def get_family(self):
- return self._ns_font.familyName()
-
- def get_size(self):
- return self._ns_font.pointSize()
-
- def get_style(self):
- style = []
- traits = _ns_font_manager.traitsOfFont_(self._ns_font)
- if traits & NSBoldFontMask:
- style.append('bold')
- if traits & NSItalicFontMask:
- style.append('italic')
- return style
-
- def get_ascent(self):
- return self._ns_font.ascender()
-
- def get_descent(self):
- return -self._ns_font.descender()
-
- def get_height(self):
- ns_font = self._ns_font
- a = ns_font.ascender()
- d = ns_font.descender()
- return a - d
-
- def get_cap_height(self):
- return self._ns_font.capHeight()
-
- def get_x_height(self):
- return self._ns_font.xHeight()
-
- def get_line_height(self):
- # Adding 1 here to match what NSTextField seems to do
- return _ns_layout_manager.defaultLineHeightForFont_(self._ns_font) + 1
-
- def width(self, s, start = 0, end = sys.maxint):
- return self._ns_font.widthOfString_(s[start:end])
-
-export(Font)
-
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Frame.py b/PyGUI-2.5.3/GUI/Cocoa/Frame.py
deleted file mode 100644
index 3c8e510..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Frame.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Frames - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from GUI.GFrames import Frame as GFrame
-from GUI import export
-from GUI.Utils import NSMultiClass
-from GUI.Utils import PyGUI_NS_EventHandler, PyGUI_Flipped_NSView
-
-class Frame(GFrame):
-
- def __init__(self, **kwds):
- ns_view = PyGUI_Frame.alloc().initWithFrame_(((0, 0), (100, 100)))
- ns_view.pygui_component = self
- GFrame.__init__(self, _ns_view = ns_view, **kwds)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_Frame(PyGUI_Flipped_NSView, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(Frame)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/GL.py b/PyGUI-2.5.3/GUI/Cocoa/GL.py
deleted file mode 100644
index da2453c..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/GL.py
+++ /dev/null
@@ -1,185 +0,0 @@
-#
-# PyGUI - OpenGL View - Cocoa
-#
-
-__all__ = ['GLConfig', 'GLView', 'GLPixmap']
-
-import AppKit
-from Foundation import NSSize
-from AppKit import NSOpenGLPixelFormat, NSOpenGLView, \
- NSBitmapImageRep, NSCachedImageRep, NSImage, NSAlphaFirstBitmapFormat, \
- NSFloatingPointSamplesBitmapFormat
-from Foundation import NSMakeRect
-from OpenGL.GL import glViewport, glFlush, glFinish, glReadPixels, \
- GL_RGB, GL_RGBA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, \
- GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, GL_FLOAT, \
- glReadPixelsub, glTexImage2D, glPixelStorei, GL_UNPACK_ALIGNMENT
-from OpenGL.GLU import gluBuild2DMipmaps
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.GGLConfig import GLConfig as GGLConfig
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-from GUI.GLDisplayLists import DisplayList
-from GUI.Utils import NSMultiClass, PyGUI_NS_ViewBase
-
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
- # _ns_pixel_format NSOpenGLPixelFormat
-
- def _ns_get_pixel_format(self, offscreen = False):
- attrs = [AppKit.NSOpenGLPFAColorSize, self._color_size]
- if self._double_buffer:
- attrs += [AppKit.NSOpenGLPFADoubleBuffer]
- if self._alpha:
- attrs += [AppKit.NSOpenGLPFAAlphaSize, self._alpha_size]
- if self._stereo:
- attrs += [AppKit.NSOpenGLPFAStereo]
- if self._aux_buffers:
- attrs += [AppKit.NSOpenGLPFAAuxBuffers, self._aux_buffers]
- if self._depth_buffer:
- attrs += [AppKit.NSOpenGLPFADepthSize, self._depth_size]
- if self._stencil_buffer:
- attrs += [AppKit.NSOpenGLPFAStencilSize, self._stencil_size]
- if self._accum_buffer:
- attrs += [AppKit.NSOpenGLPFAAccumSize, self._accum_size]
- if self._multisample:
- attrs += [AppKit.NSOpenGLPFASampleBuffers, 1]
- attrs += [AppKit.NSOpenGLPFASamples, self._samples_per_pixel]
- if offscreen:
- attrs += [AppKit.NSOpenGLPFAOffScreen]
- attrs.append(0)
- ns_pf = NSOpenGLPixelFormat.alloc().initWithAttributes_(attrs)
- if not ns_pf and self._double_buffer:
- attrs.remove(AppKit.NSOpenGLPFADoubleBuffer)
- ns_pf = NSOpenGLPixelFormat.alloc().initWithAttributes_(attrs)
- if not ns_pf:
- raise GLConfigError
- return ns_pf
-
- def _ns_set_pixel_format(self, ns_pf):
- def ns_attr(attr):
- return ns_pf.getValues_forAttribute_forVirtualScreen_(attr, 0)[0]
- self._ns_pixel_format = ns_pf
- self._double_buffer = ns_attr(AppKit.NSOpenGLPFADoubleBuffer)
- self._color_size = ns_attr(AppKit.NSOpenGLPFAColorSize)
- self._alpha_size = ns_attr(AppKit.NSOpenGLPFAAlphaSize)
- self._alpha = self._alpha_size > 0
- self._stereo = ns_attr(AppKit.NSOpenGLPFAStereo)
- self._aux_buffers = ns_attr(AppKit.NSOpenGLPFAAuxBuffers)
- self._depth_size = ns_attr(AppKit.NSOpenGLPFADepthSize)
- self._depth_buffer = self._depth_size > 0
- self._stencil_size = ns_attr(AppKit.NSOpenGLPFAStencilSize)
- self._stencil_buffer = self._stencil_size > 0
- self._accum_size = ns_attr(AppKit.NSOpenGLPFAAccumSize)
- self._accum_buffer = self._accum_size > 0
- self._multisample = ns_attr(AppKit.NSOpenGLPFASampleBuffers) > 0
- self._samples_per_pixel = ns_attr(AppKit.NSOpenGLPFASamples)
-
- def supported(self, mode = 'both'):
- try:
- ns_pf = self._ns_get_pixel_format()
- pf = GLConfig.__new__()
- pf._ns_set_pixel_format(ns_pf)
- return pf
- except GLConfigError:
- return None
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
- # _ns_view NSOpenGLView
- # _ns_context NSOpenGLContext
- # _ns_flush function for flushing/swapping buffers
-
- def __init__(self, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- ns_pf = pf._ns_get_pixel_format()
- width, height = GGLView._default_size
- ns_rect = NSMakeRect(0, 0, width, height)
- ns_view = _PyGUI_NSOpenGLView.alloc().initWithFrame_pixelFormat_(
- ns_rect, ns_pf)
- ns_view.pygui_component = self
- GGLView.__init__(self, _ns_view = ns_view)
- GLContext.__init__(self, share_group = share_group, _ns_pixel_format = ns_pf)
- ns_context = self._ns_context
- ns_view.setOpenGLContext_(ns_context)
- #ns_context.setView_(ns_view) # Docs say this is needed, but
- # prints warning and seems to work without.
- if pf.double_buffer:
- self._ns_flush = ns_context.flushBuffer
- else:
- self._ns_flush = glFlush
- self.set(**kwds)
- self.with_context(self._init_context)
-
- def destroy(self):
- #print "GLView.destroy:", self ###
- ns_view = self._ns_view
- GGLView.destroy(self)
- #print "GLView.destroy: breaking back link from", ns_view ###
- ns_view.pygui_component = None
-
- def invalidate(self):
- self._ns_view.setNeedsDisplay_(True)
-
- def update(self):
- self._ns_view.displayIfNeeded()
-
- def track_mouse(self):
- return self._ns_track_mouse(self._ns_view)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- ns_pf = pf._ns_get_pixel_format()
- ns_size = NSSize(width, height)
- ns_cache = NSCachedImageRep.alloc().initWithSize_depth_separate_alpha_(
- ns_size, 0, True, True)
- ns_image = NSImage.alloc().initWithSize_(ns_size)
- GLContext.__init__(self, share_group = share_group, _ns_pixel_format = ns_pf)
- self._ns_context.setView_(ns_cache.window().contentView())
- self._init_with_ns_image(ns_image, flipped = False)
- self._ns_cache = ns_cache
- self.with_context(self._init_context)
-
- def _ns_flush(self):
- glFlush()
- width, height = self.size
- pixels = glReadPixels(0, 0, int(width), int(height), GL_RGBA, GL_UNSIGNED_BYTE)
- bytes_per_row = int(width) * 4
- ns_new_bitmap = NSBitmapImageRep.alloc().\
- initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(
- (pixels, "", "", "", ""), int(width), int(height), 8, 4, True, False, AppKit.NSDeviceRGBColorSpace, bytes_per_row, 0)
- ns_image = NSImage.alloc().initWithSize_(NSSize(width, height))
- ns_image.addRepresentation_(ns_new_bitmap)
- ns_image.lockFocus()
- ns_image.unlockFocus()
- self._ns_image = ns_image
- self._ns_bitmap_image_rep = ns_new_bitmap
-
-#------------------------------------------------------------------------------
-
-class _PyGUI_NSOpenGLView(NSOpenGLView, PyGUI_NS_ViewBase):
- __metaclass__ = NSMultiClass
- #
- # pygui_component GLView
-
- __slots__ = ['pygui_component']
-
- def isFlipped(self):
- return True
-
- def reshape(self):
- comp = self.pygui_component
- if comp.window:
- comp.with_context(comp._update_viewport)
-
- def drawRect_(self, rect):
- comp = self.pygui_component
- comp.with_context(comp._render, flush = True)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/GLContexts.py b/PyGUI-2.5.3/GUI/Cocoa/GLContexts.py
deleted file mode 100644
index ec0f154..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/GLContexts.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# PyGUI - OpenGL Contexts - Cocoa
-#
-
-from AppKit import NSOpenGLContext
-from GUI.GGLContexts import GLContext as GGLContext
-
-class GLContext(GGLContext):
- # _ns_context NSOpenGLContext
-
- def __init__(self, share_group, _ns_pixel_format):
- GGLContext.__init__(self, share_group)
- shared_context = self._get_shared_context()
- if shared_context:
- ns_share = shared_context._ns_context
- else:
- ns_share = None
- ns_context = NSOpenGLContext.alloc().initWithFormat_shareContext_(
- _ns_pixel_format, ns_share)
- self._ns_context = ns_context
-
- def _with_context(self, proc, flush):
- #print "GLContext._with_context: Entering context", self._ns_context ###
- old_context = NSOpenGLContext.currentContext()
- self._ns_context.makeCurrentContext()
- try:
- self._with_share_group(proc)
- if flush:
- self._ns_flush()
- finally:
- #print "GL: Restoring previous context" ###
- if old_context:
- old_context.makeCurrentContext()
- else:
- NSOpenGLContext.clearCurrentContext()
diff --git a/PyGUI-2.5.3/GUI/Cocoa/GLTextures.py b/PyGUI-2.5.3/GUI/Cocoa/GLTextures.py
deleted file mode 100644
index aa7c054..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/GLTextures.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Cocoa
-#
-
-from AppKit import NSAlphaFirstBitmapFormat, NSFloatingPointSamplesBitmapFormat
-from OpenGL import GL
-from GUI.GGLTextures import Texture as GTexture
-
-class Texture(GTexture):
-
- def _gl_get_texture_data(self, image):
- ns_rep = image._ns_bitmap_image_rep
- if ns_rep.numberOfPlanes() <> 1:
- raise ValueError("Cannot use planar image data as GL texture")
- ns_format = ns_rep.bitmapFormat()
- if ns_format & NSAlphaFirstBitmapFormat:
- raise ValueError("Cannot use alpha-first image data as GL texture")
- fp_samples = ns_format & NSFloatingPointSamplesBitmapFormat <> 0
- bits_per_pixel = ns_rep.bitsPerPixel()
- bytes_per_row = ns_rep.bytesPerRow()
- samples_per_pixel = ns_rep.samplesPerPixel()
- if bits_per_pixel % samples_per_pixel <> 0:
- raise ValueError("Image data format not usable as GL texture")
- bits_per_sample = bits_per_pixel / samples_per_pixel
- try:
- gl_format = format_map[samples_per_pixel]
- gl_type = type_map[bits_per_sample, fp_samples]
- except KeyError:
- raise ValueError("Image data format not usable as GL texture")
- data = ns_rep.bitmapData()
- if 0:
- print "GUI.GLTexture._gl_get_texture_data_and_format:" ###
- print "format =", gl_format_map.get(gl_format) ###
- print "type =", gl_type_map.get(gl_type) ###
- print "data length =", len(data) ###
- print repr(data[:16]) ###
- GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
- return gl_format, gl_type, str(data)
-
-#------------------------------------------------------------------------------
-
-format_map = {
- 3: GL.GL_RGB,
- 4: GL.GL_RGBA,
- 1: GL.GL_LUMINANCE,
- 2: GL.GL_LUMINANCE_ALPHA,
-}
-
-type_map = {
- (8, 0): GL.GL_UNSIGNED_BYTE,
- (16, 0): GL.GL_UNSIGNED_SHORT,
- (32, 0): GL.GL_UNSIGNED_INT,
- (32, 1): GL.GL_FLOAT,
-}
-
-gl_format_map = {
- GL.GL_RGB: 'GL_RGB',
- GL.GL_RGBA: 'GL_RGBA',
- GL.GL_LUMINANCE: 'GL_LUMINANCE',
- GL.GL_LUMINANCE_ALPHA: 'GL_LUMINANCE_ALPHA',
-}
-
-gl_type_map = {
- GL.GL_UNSIGNED_BYTE: 'GL_UNSIGNED_BYTE',
- GL.GL_UNSIGNED_SHORT: 'GL_UNSIGNED_SHORT',
- GL.GL_UNSIGNED_INT: 'GL_UNSIGNED_INT',
- GL.GL_FLOAT: 'GL_FLOAT',
-}
-
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Geometry.py b/PyGUI-2.5.3/GUI/Cocoa/Geometry.py
deleted file mode 100644
index 3a9bd54..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Geometry.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Python GUI - Points and Rectangles - PyObjC
-#
-
-from Foundation import NSMakeRect
-from GUI.GGeometry import *
-
-def rect_to_ns_rect((l, t, r, b)):
- return NSMakeRect(l, t, r - l, b - t)
-
-def ns_rect_to_rect(((l, t), (w, h))):
- return (l, t, l + w, t + h)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Image.py b/PyGUI-2.5.3/GUI/Cocoa/Image.py
deleted file mode 100644
index a40ab1e..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Image.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Python GUI - Images - Cocoa
-#
-
-from Foundation import NSData
-from AppKit import NSImage, NSBitmapImageRep
-from GUI import export
-from GUI.GImages import Image as GImage
-
-class Image(GImage):
- # _ns_bitmap_image_rep
-
- def _init_from_file(self, file):
- #ns_image = NSImage.alloc().initWithContentsOfFile_(file)
- #if not ns_image:
- ns_data = NSData.dataWithContentsOfFile_(file)
- if not ns_data:
- raise EnvironmentError("Unable to read image file: %s" % file)
- ns_rep = NSBitmapImageRep.imageRepWithData_(ns_data)
- if not ns_rep:
- raise ValueError("Unrecognised image file type: %s" % file)
- ns_rep.setSize_((ns_rep.pixelsWide(), ns_rep.pixelsHigh()))
- self._init_from_ns_rep(ns_rep)
-
- def _init_from_ns_rep(self, ns_rep):
- ns_image = NSImage.alloc().init()
- ns_image.addRepresentation_(ns_rep)
- self._ns_bitmap_image_rep = ns_rep
- self._init_with_ns_image(ns_image, flipped = True)
-
-export(Image)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/ImageBase.py b/PyGUI-2.5.3/GUI/Cocoa/ImageBase.py
deleted file mode 100644
index 4405648..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/ImageBase.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Python GUI - Common Image/Pixmap code - Cocoa
-#
-
-from AppKit import NSCompositeSourceOver
-from GUI import export
-from GUI.Geometry import rect_to_ns_rect
-from GUI.GImageBases import ImageBase as GImageBase
-
-class ImageBase(GImageBase):
- #
- # Code common to Image, Pixmap and GLPixmap classes
-
- def _init_with_ns_image(self, ns_image, flipped):
- ns_image.setFlipped_(flipped)
- self._ns_image = ns_image
-
- def get_size(self):
- return tuple(self._ns_image.size())
-
- def get_width(self):
- return self._ns_image.size()[0]
-
- def get_height(self):
- return self._ns_image.size()[1]
-
- def draw(self, canvas, src_rect, dst_rect):
- ns_src_rect = rect_to_ns_rect(src_rect)
- ns_dst_rect = rect_to_ns_rect(dst_rect)
- self._ns_image.drawInRect_fromRect_operation_fraction_(
- ns_dst_rect, ns_src_rect, NSCompositeSourceOver, 1.0)
-
-export(ImageBase)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Label.py b/PyGUI-2.5.3/GUI/Cocoa/Label.py
deleted file mode 100644
index 082f69e..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Label.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Python GUI - Labels - PyObjC
-#
-
-import AppKit
-from AppKit import NSView
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.TextFieldBasedControls import TextFieldBasedControl
-from GUI.GLabels import Label as GLabel
-
-ns_label_autoresizing_mask = (AppKit.NSViewWidthSizable
- | AppKit.NSViewHeightSizable)
-
-class Label(TextFieldBasedControl, GLabel):
-
- def __init__(self, text = "New Label", font = system_font, **kwds):
- ns_textfield = self._create_ns_textfield(editable = False,
- text = text, font = font)
-# width, height = ns_textfield.frame().size
-# ns_view = NSView.alloc().initWithFrame_(((0, 0), (width, height + 5)))
-# ns_view.addSubview_(ns_textfield)
-# ns_textfield.setFrameOrigin_((0, 2))
-# ns_textfield.setAutoresizingMask_(ns_label_autoresizing_mask)
- ns_view = ns_textfield
- GLabel.__init__(self, _ns_view = ns_view, _ns_inner_view = ns_textfield, **kwds)
-
-export(Label)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/ListButton.py b/PyGUI-2.5.3/GUI/Cocoa/ListButton.py
deleted file mode 100644
index 671a8a8..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/ListButton.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - Pop-up list control - Cocoa
-#
-#--------------------------------------------------------------
-
-from AppKit import NSPopUpButton
-from GUI import export
-from GUI.GListButtons import ListButton as GListButton
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, \
- ns_set_action, ns_size_to_fit
-
-class ListButton(GListButton):
-
- _ns_handle_mouse = True
-
- def __init__(self, **kwds):
- titles, values = self._extract_initial_items(kwds)
- self._titles = titles
- self._values = values
- frame = ((0, 0), (100, 20))
- ns = PyGUI_NSPopUpButton.alloc().initWithFrame_pullsDown_(frame, False)
- ns.pygui_component = self
- ns_set_action(ns, 'doAction:')
- self._ns_update_items(ns)
- ns_size_to_fit(ns)
- GListButton.__init__(self, _ns_view = ns, **kwds)
-
- def _update_items(self):
- self._ns_update_items(self._ns_view)
-
- def _ns_update_items(self, ns):
- ns.removeAllItems()
- ns.addItemsWithTitles_(self._titles)
-
- def _get_selected_index(self):
- return self._ns_view.indexOfSelectedItem()
-
- def _set_selected_index(self, i):
- self._ns_view.selectItemAtIndex_(i)
-
-#--------------------------------------------------------------
-
-class PyGUI_NSPopUpButton(NSPopUpButton, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(ListButton)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Menu.py b/PyGUI-2.5.3/GUI/Cocoa/Menu.py
deleted file mode 100644
index 6a82454..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Menu.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Python GUI - Menus - PyObjC
-#
-
-from AppKit import NSMenu, NSMenuItem, NSOnState, \
- NSCommandKeyMask, NSShiftKeyMask, NSAlternateKeyMask
-from GUI import export
-from GUI import Globals
-from GUI.GMenus import Menu as GMenu, MenuItem
-
-#_ns_standard_actions = {
-# 'undo_cmd': 'undo:',
-# 'redo_cmd': 'redo:',
-# 'cut_cmd': 'cut:',
-# 'copy_cmd': 'copy:',
-# 'paste_cmd': 'paste:',
-# 'clear_cmd': 'clear:',
-# 'select_all_cmd': 'selectAll:',
-#}
-
-class Menu(GMenu):
-
- def __init__(self, title, items, **kwds):
- #print "Menu: creating with items", items ###
- GMenu.__init__(self, title, items, **kwds)
- ns_menu = NSMenu.alloc().initWithTitle_(title)
- ns_menu.setAutoenablesItems_(False)
- ns_menu.setDelegate_(Globals.ns_application)
- self._ns_menu = ns_menu
-
- def _clear_platform_menu(self):
- ns_menu = self._ns_menu
- n = ns_menu.numberOfItems()
- while n:
- n -= 1
- ns_menu.removeItemAtIndex_(n)
-
- def _add_separator_to_platform_menu(self):
- ns_item = NSMenuItem.separatorItem()
- self._ns_menu.addItem_(ns_item)
-
- def _add_item_to_platform_menu(self, item, name, command = None, index = None):
- key = item._key or ""
- if item._shift:
- key = key.upper()
- else:
- key = key.lower()
- ns_item = NSMenuItem.alloc()
- #ns_action = _ns_standard_actions.get(command, 'menuSelection:')
- ns_action = 'menuSelection:'
- ns_item.initWithTitle_action_keyEquivalent_(name, ns_action, key)
- ns_item.setEnabled_(item.enabled)
- if item.checked:
- ns_item.setState_(NSOnState)
- ns_modifiers = NSCommandKeyMask
- if item._option:
- ns_modifiers |= NSAlternateKeyMask
- ns_item.setKeyEquivalentModifierMask_(ns_modifiers)
- ns_item.setRepresentedObject_(command)
- if index is not None:
- ns_tag = index
- else:
- ns_tag = -1
- ns_item.setTag_(ns_tag)
- self._ns_menu.addItem_(ns_item)
-
-export(Menu)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Numerical.py b/PyGUI-2.5.3/GUI/Cocoa/Numerical.py
deleted file mode 100644
index f53f3ba..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Numerical.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - NumPy interface - Cocoa
-#
-#--------------------------------------------------------------
-
-from AppKit import NSBitmapImageRep, \
- NSAlphaNonpremultipliedBitmapFormat, NSCalibratedRGBColorSpace
-from GUI import Image
-
-# HACK! PyObjC 2.3 incorrectly wraps the following method, so we change the
-# signature and pass the bitmap data in using ctypes.
-NSBitmapImageRep.__dict__['initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_'].signature = '@52@0:4^v8i12i16i20i24c28c32@36I40i44i48'
-import ctypes
-planes_t = ctypes.c_void_p * 5
-
-def image_from_ndarray(array, format, size = None):
- """
- Creates an Image from a numpy ndarray object. The format
- may be 'RGB' or 'RGBA'. If a size is specified, the array
- will be implicitly reshaped to that size, otherwise the size
- is inferred from the first two dimensions of the array.
- """
- if array.itemsize <> 1:
- raise ValueError("Color component size must be 1 byte")
- if size is not None:
- width, height = size
- data_size = array.size
- pixel_size = data_size // (width * height)
- if pixel_size <> len(format):
- raise ValueError("Array has wrong shape for specified size and format")
- else:
- height, width, pixel_size = array.shape
- if pixel_size <> len(format):
- raise ValueError("Array has wrong shape for specified format")
- bps = 8
- spp = pixel_size
- alpha = format.endswith("A")
- csp = NSCalibratedRGBColorSpace
- bpp = bps * spp
- bpr = width * pixel_size
- fmt = NSAlphaNonpremultipliedBitmapFormat
- ns_rep = NSBitmapImageRep.alloc()
- planes = planes_t(array.ctypes.data, 0, 0, 0, 0)
- ns_rep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(
- ctypes.addressof(planes), width, height, bps, spp, alpha, False, csp, fmt, bpr, bpp)
- image = Image.__new__(Image)
- image._init_from_ns_rep(ns_rep)
- image._data = array
- return image
diff --git a/PyGUI-2.5.3/GUI/Cocoa/PIL.py b/PyGUI-2.5.3/GUI/Cocoa/PIL.py
deleted file mode 100644
index 31f223b..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/PIL.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - PIL interface - Cocoa
-#
-#--------------------------------------------------------------
-
-import ctypes
-from AppKit import NSBitmapImageRep, \
- NSAlphaNonpremultipliedBitmapFormat, NSFloatingPointSamplesBitmapFormat, \
- NSDeviceCMYKColorSpace, NSCalibratedRGBColorSpace
-from GUI import Image
-
-def hack_objc_sig():
- #print "GUI[Cocoa].PIL: Hacking objc method signature" ###
- # HACK! PyObjC 2.3 incorrectly wraps the following method, so we change the
- # signature and pass the bitmap data in using ctypes.
- NSBitmapImageRep.__dict__['initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_'].signature = '@52@0:4^v8i12i16i20i24c28c32@36I40i44i48'
-
-planes_t = ctypes.c_char_p * 5
-
-debug_pil = False
-
-def image_from_pil_image(pil_image):
- """Creates an Image from a Python Imaging Library (PIL)
- Image object."""
- mode = pil_image.mode
- w, h = pil_image.size
- data = pil_image.tostring()
- alpha = False
- cmyk = False
- floating = False
- if mode == "1":
- bps = 1; spp = 1
- elif mode == "L":
- bps = 8; spp = 1
- elif mode == "RGB":
- bps = 8; spp = 3
- elif mode == "RGBA":
- bps = 8; spp = 4; alpha = True
- elif mode == "CMYK":
- bps = 8; spp = 4; cmyk = True
- elif mode == "I":
- bps = 32; spp = 1
- elif mode == "F":
- bps = 32; spp = 1; floating = True
- else:
- raise ValueError("Unsupported PIL image mode '%s'" % mode)
- if cmyk:
- csp = NSDeviceCMYKColorSpace
- else:
- csp = NSCalibratedRGBColorSpace
- fmt = NSAlphaNonpremultipliedBitmapFormat
- if floating:
- fmt |= NSFloatingPointSamplesBitmapFormat
- bpp = bps * spp
- bpr = w * ((bpp + 7) // 8)
- if debug_pil:
- print "GUI.PIL:"
- print "image size =", (w, h)
- print "data size =", len(data)
- print "bits per sample =", bps
- print "samples per pixel =", spp
- print "bits per pixel =", bpp
- print "bytes per row =", bpr
- hack_objc_sig()
- ns_rep = NSBitmapImageRep.alloc()
- planes = planes_t(data, "", "", "", "")
- ns_rep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(
- ctypes.addressof(planes), w, h, bps, spp, alpha, False, csp, fmt, bpr, bpp)
-# planes = (data, "", "", "", "")
-# ns_rep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(
-# planes, w, h, bps, spp, alpha, False, csp, bpr, bpp)
- image = Image.__new__(Image)
- image._init_from_ns_rep(ns_rep)
- image._data = data
- return image
-
-
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Pixmap.py b/PyGUI-2.5.3/GUI/Cocoa/Pixmap.py
deleted file mode 100644
index 3b3a4a2..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Pixmap.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Python GUI - Pixmaps - Cocoa
-#
-
-from Foundation import NSSize
-from AppKit import NSImage, NSCachedImageRep, NSBitmapImageRep, \
- NSCalibratedRGBColorSpace, NSImageCacheNever, NSGraphicsContext, \
- NSAffineTransform
-from GUI import export
-from GUI import Canvas
-from GUI.GPixmaps import Pixmap as GPixmap
-
-class Pixmap(GPixmap):
- # _ns_bitmap_image_rep NSBitmapImageRep
-
- def __init__(self, width, height):
- GPixmap.__init__(self)
- #ns_size = NSSize(width, height)
- #ns_image = NSImage.alloc().initWithSize_(ns_size)
- ns_image = NSImage.alloc().init()
- ns_image.setCacheMode_(NSImageCacheNever)
- row_bytes = 4 * width
- ns_bitmap = NSBitmapImageRep.alloc().\
- initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(
- None, width, height, 8, 4, True, False, NSCalibratedRGBColorSpace, row_bytes, 32)
- ns_image.addRepresentation_(ns_bitmap)
- ns_bitmap_context = NSGraphicsContext.graphicsContextWithBitmapImageRep_(ns_bitmap)
- ns_graphics_context = FlippedNSGraphicsContext.alloc().initWithBase_(ns_bitmap_context)
- ns_tr = NSAffineTransform.transform()
- ns_tr.translateXBy_yBy_(0.0, height)
- ns_tr.scaleXBy_yBy_(1.0, -1.0)
- # Using __class__ to get +saveGraphicsState instead of -saveGraphicsState
- NSGraphicsContext.__class__.saveGraphicsState()
- try:
- NSGraphicsContext.setCurrentContext_(ns_graphics_context)
- ns_tr.concat()
- finally:
- NSGraphicsContext.__class__.restoreGraphicsState()
- self._init_with_ns_image(ns_image, flipped = True) #False)
- self._ns_bitmap_image_rep = ns_bitmap
- self._ns_graphics_context = ns_graphics_context
-
- def with_canvas(self, proc):
- NSGraphicsContext.__class__.saveGraphicsState()
- NSGraphicsContext.setCurrentContext_(self._ns_graphics_context)
- try:
- canvas = Canvas()
- proc(canvas)
- finally:
- NSGraphicsContext.__class__.restoreGraphicsState()
-
-class FlippedNSGraphicsContext(NSGraphicsContext):
-
- def initWithBase_(self, base):
- self.base = base
- self.graphics_port = base.graphicsPort()
- return self
-
- def isFlipped(self):
- return True
-
- def graphicsPort(self):
- return self.graphics_port
-
- def isDrawingToScreen(self):
- return self.base.isDrawingToScreen()
-
- def setCompositingOperation_(self, x):
- self.base.setCompositingOperation_(x)
-
- def focusStack(self):
- return self.base.focusStack()
-
- def saveGraphicsState(self):
- return self.base.saveGraphicsState()
-
- def restoreGraphicsState(self):
- return self.base.restoreGraphicsState()
-
-export(Pixmap)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Printing.py b/PyGUI-2.5.3/GUI/Cocoa/Printing.py
deleted file mode 100644
index 21aba9f..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Printing.py
+++ /dev/null
@@ -1,132 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from AppKit import NSPrintInfo, NSPageLayout, NSPrintOperation, \
- NSKeyedArchiver, NSKeyedUnarchiver, NSData, NSAutoPagination, \
- NSPortraitOrientation, NSLandscapeOrientation, NSOKButton
-from GUI.GPrinting import PageSetup as GPageSetup, Printable as GPrintable
-
-ns_to_generic_orientation = {
- NSPortraitOrientation: 'portrait',
- NSLandscapeOrientation: 'landscape',
-}
-
-generic_to_ns_orientation = {
- 'portrait': NSPortraitOrientation,
- 'landscape': NSLandscapeOrientation,
-}
-
-#------------------------------------------------------------------------------
-
-class PageSetup(GPageSetup):
-
- def __init__(self):
- ns_pi = NSPrintInfo.sharedPrintInfo().copy()
- ns_pi.setLeftMargin_(36)
- ns_pi.setTopMargin_(36)
- ns_pi.setRightMargin_(36)
- ns_pi.setBottomMargin_(36)
- ns_pi.setHorizontalPagination_(NSAutoPagination)
- self._ns_print_info = ns_pi
-
- def __getstate__(self):
- state = GPageSetup.__getstate__(self)
- data = NSKeyedArchiver.archivedDataWithRootObject_(self._ns_print_info)
- state['_ns_print_info'] = data.bytes()
- return state
-
- def __setstate__(self, state):
- bytes = state.pop('_ns_print_info', None)
- if bytes:
- data = NSData.dataWithBytes_length_(bytes, len(bytes))
- self._ns_print_info = NSKeyedArchiver.unarchiveObjectWithData_(data)
- else:
- GPageSetup.__setstate__(self, state)
-
- def copy(self, other):
- result = PageSetup.__new__()
- result._ns_print_info = other._ns_print_info.copy()
-
- def get_paper_name(self):
- return self._ns_print_info.paperName()
-
- def set_paper_name(self, x):
- self._ns_print_info.setPaperName_(x)
-
- def get_paper_size(self):
- return tuple(self._ns_print_info.paperSize())
-
- def set_paper_size(self, x):
- self._ns_print_info.setPaperSize_(x)
-
- def get_paper_width(self):
- return self.paper_size[0]
-
- def set_paper_width(self, x):
- self.paper_size = x, self.paper_height
-
- def get_paper_height(self):
- return self.paper_size[1]
-
- def set_paper_height(self, x):
- self.paper_size = self.paper_width, x
-
- def get_left_margin(self):
- return self._ns_print_info.leftMargin()
-
- def set_get_left_margin(self, x):
- self._ns_print_info.setLefMargin_(x)
-
- def get_right_margin(self):
- return self._ns_print_info.rightMargin()
-
- def set_get_right_margin(self, x):
- self._ns_print_info.setRightMargin_(x)
-
- def get_top_margin(self):
- return self._ns_print_info.topMargin()
-
- def set_get_top_margin(self, x):
- self._ns_print_info.setTopMargin_(x)
-
- def get_bottom_margin(self):
- return self._ns_print_info.bottomMargin()
-
- def set_get_bottom_margin(self, x):
- self._ns_print_info.setBottomMargin_(x)
-
- def get_orientation(self):
- return ns_to_generic_orientation[self._ns_print_info.orientation()]
-
- def set_orientation(self, x):
- nso = generic_to_ns_orientation.get(x, 'portrait')
- self._ns_print_info.setOrientation_(nso)
-
- def get_printable_rect(self):
- l, b, w, h = self._ns_print_info.imageablePageBounds()
- return (l, b - h, l + w, b)
-
- def get_printer_name(self):
- return self._ns_print_info.printer().name()
-
- def set_printer_name(self, x):
- self._ns_print_info.setPrinter_(NSPrinter.printerWithName_(x))
-
-#------------------------------------------------------------------------------
-
-class Printable(GPrintable):
-
- def print_view(self, page_setup, prompt = True):
- ns_op = NSPrintOperation.printOperationWithView_printInfo_(
- self._ns_inner_view, page_setup._ns_print_info)
- ns_op.setShowsPrintPanel_(prompt)
- ns_op.runOperation()
-
-#------------------------------------------------------------------------------
-
-def present_page_setup_dialog(page_setup):
- result = NSPageLayout.pageLayout().runModalWithPrintInfo_(page_setup._ns_print_info)
- return result == NSOKButton
diff --git a/PyGUI-2.5.3/GUI/Cocoa/RadioButton.py b/PyGUI-2.5.3/GUI/Cocoa/RadioButton.py
deleted file mode 100644
index 4b77a54..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/RadioButton.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Python GUI - Radio buttons - PyObjC
-#
-
-import AppKit
-from AppKit import NSOnState, NSOffState
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.ButtonBasedControls import ButtonBasedControl
-from GUI.GRadioButtons import RadioButton as GRadioButton
-
-class RadioButton(ButtonBasedControl, GRadioButton):
-
- def __init__(self, title = "New Radio Button", font = system_font, **kwds):
- ns_button = self._create_ns_button(title = title, font = font,
- ns_button_type = AppKit.NSRadioButton,
- ns_bezel_style = AppKit.NSRoundedBezelStyle)
- GRadioButton.__init__(self, _ns_view = ns_button, **kwds)
-
- def do_action(self):
- if self._group:
- self._group.value = self._value
- else:
- self._ns_view.setState_(NSOffState)
-
- def _value_changed(self):
- self._update()
-
- def _update(self):
- if self._group and self._value == self._group._value:
- state = NSOnState
- else:
- state = NSOffState
- self._ns_view.setState_(state)
-
-export(RadioButton)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/RadioGroup.py b/PyGUI-2.5.3/GUI/Cocoa/RadioGroup.py
deleted file mode 100644
index 985990b..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/RadioGroup.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Radio groups - PyObjC
-#
-
-from GUI import export
-from GUI.GRadioGroups import RadioGroup as GRadioGroup
-
-class RadioGroup(GRadioGroup):
-
- def __init__(self, items = [], **kwds):
- GRadioGroup.__init__(self, items, **kwds)
-
- def _item_added(self, item):
- item._update()
-
- def _item_removed(self, item):
- pass
-
- def _value_changed(self):
- for item in self._items:
- item._update()
-
-export(RadioGroup)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/ScrollableView.py b/PyGUI-2.5.3/GUI/Cocoa/ScrollableView.py
deleted file mode 100644
index c6bdd83..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/ScrollableView.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Python GUI - Scrollable Views - PyObjC
-#
-
-from Foundation import NSPoint, NSMakeRect
-from AppKit import NSScrollView
-from GUI import export
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount, default_scrolling
-from GUI.Geometry import ns_rect_to_rect
-
-class ScrollableView(GScrollableView):
-
- _ns_scrollable = True
-
- def __init__(self, extent = default_extent,
- line_scroll_amount = default_line_scroll_amount,
- scrolling = default_scrolling,
- **kwds):
- GScrollableView.__init__(self,
- extent = extent, line_scroll_amount = line_scroll_amount,
- scrolling = scrolling, **kwds)
-
- def get_hscrolling(self):
- return self._ns_view.hasHorizontalScroller()
-
- def set_hscrolling(self, value):
- self._ns_view.setHasHorizontalScroller_(value)
-
- def get_vscrolling(self):
- return self._ns_view.hasVerticalScroller()
-
- def set_vscrolling(self, value):
- self._ns_view.setHasVerticalScroller_(value)
-
-# def get_extent(self):
-# (l, t), (w, h) = self._ns_inner_view.bounds()
-# return (l, t, l + w, t + h)
-
- def get_extent(self):
- return self._ns_inner_view.bounds().size
-
-# def set_extent(self, (l, t, r, b)):
-# w = r - l
-# h = b - t
-# ns_docview = self._ns_inner_view
-# ns_docview.setFrame_(NSMakeRect(0, 0, w, h))
-# ns_docview.setBounds_(NSMakeRect(l, t, w, h))
-# self.invalidate()
-
- def set_extent(self, (w, h)):
- r = NSMakeRect(0, 0, w, h)
- ns_docview = self._ns_inner_view
- ns_docview.setFrame_(r)
- ns_docview.setBounds_(r)
- self.invalidate()
-
- def get_content_size(self):
- return self._ns_view.contentSize()
-
- def set_content_size(self, size):
- ns = self._ns_view
- self.size = NSScrollView.\
- frameSizeForContentSize_hasHorizontalScroller_hasVerticalScroller_borderType_(
- size, ns.hasHorizontalScroller(), ns.hasVerticalScroller(), ns.borderType())
-
- def get_scroll_offset(self):
- ns_clip_view = self._ns_view.contentView()
- x, y = ns_clip_view.bounds().origin
- return x, y
-
- def set_scroll_offset(self, (x, y)):
- ns_view = self._ns_view
- ns_clip_view = ns_view.contentView()
- new_pt = ns_clip_view.constrainScrollPoint_(NSPoint(x, y))
- ns_clip_view.scrollToPoint_(new_pt)
- ns_view.reflectScrolledClipView_(ns_clip_view)
-
- def get_line_scroll_amount(self):
- ns_view = self._ns_view
- x = ns_view.horizontalLineScroll()
- y = ns_view.verticalLineScroll()
- return x, y
-
- def set_line_scroll_amount(self, (x, y)):
- ns_view = self._ns_view
- ns_view.setHorizontalLineScroll_(x)
- ns_view.setVerticalLineScroll_(y)
- ns_view.setHorizontalPageScroll_(x)
- ns_view.setVerticalPageScroll_(y)
-
- def viewed_rect(self):
- ns_rect = self._ns_view.contentView().documentVisibleRect()
- return ns_rect_to_rect(ns_rect)
-
-export(ScrollableView)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Slider.py b/PyGUI-2.5.3/GUI/Cocoa/Slider.py
deleted file mode 100644
index d8c1ad2..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Slider.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Slider - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from AppKit import NSSlider
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, \
- ns_set_action, ns_size_to_fit
-from GUI.GSliders import Slider as GSlider
-
-class Slider(GSlider):
-
- _ns_handle_mouse = True
-
- def __init__(self, orient = 'h', ticks = 0, **kwds):
- length = 100
- if ticks:
- breadth = 30
- else:
- breadth = 22 # Same as default height of a text-containing control
- if orient == 'h':
- ns_frame = ((0, 0), (length, breadth))
- elif orient == 'v':
- ns_frame = ((0, 0), (breadth, length))
- else:
- raise ValueError("Invalid orientation, should be 'h' or 'v'")
- ns_slider = PyGUI_NSSlider.alloc().initWithFrame_(ns_frame)
- ns_slider.pygui_component = self
- ns_set_action(ns_slider, 'doAction:')
- GSlider.__init__(self, _ns_view = ns_slider, **kwds)
- self.set_ticks(ticks)
- self._last_value = None
-
- def get_min_value(self):
- return self._ns_view.minValue()
-
- def set_min_value(self, x):
- self._ns_view.setMinValue_(x)
-
- def get_max_value(self):
- return self._ns_view.maxValue()
-
- def set_max_value(self, x):
- self._ns_view.setMaxValue_(x)
-
- def get_value(self):
- return self._ns_view.doubleValue()
-
- def set_value(self, x):
- self._ns_view.setDoubleValue_(x)
-
- def get_ticks(self):
- return self._ns_view.numberOfTickMarks()
-
- def set_ticks(self, x):
- self._ns_view.setNumberOfTickMarks_(x)
-
- def get_discrete(self):
- return self._ns_view.allowsTickMarkValuesOnly()
-
- def set_discrete(self, x):
- self._ns_view.setAllowsTickMarkValuesOnly_(x)
-
- def get_live(self):
- return self._ns_view.isContinuous()
-
- def set_live(self, x):
- self._ns_view.setContinuous_(x)
-
- def do_action(self):
- value = self._ns_view.doubleValue()
- if value <> self._last_value:
- self._last_value = value
- GSlider.do_action(self)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSSlider(NSSlider, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(Slider)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/StdCursors.py b/PyGUI-2.5.3/GUI/Cocoa/StdCursors.py
deleted file mode 100644
index e26c851..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/StdCursors.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - Standard Cursors - Cocoa
-#
-
-from AppKit import NSCursor
-from GUI import Cursor
-
-__all__ = [
- 'arrow',
- 'ibeam',
- 'crosshair',
- 'fist',
- 'hand',
- 'finger',
- 'invisible',
-]
-
-_empty_cursor = None
-
-def _make_empty_cursor():
- global _empty_cursor
- if not _empty_cursor:
- from AppKit import NSCursor, NSImage, NSBitmapImageRep, NSDeviceRGBColorSpace
- from GUI import Cursor
- import sys
- if sys.version_info >= (3, 0):
- b = bytes([0])
- else:
- b = "\x00"
- d = b * 1024
- ns_bitmap = NSBitmapImageRep.alloc().\
- initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_\
- ((d, d, d, d, d), 16, 16, 8, 4, True, False, NSDeviceRGBColorSpace, 64, 32)
- ns_image = NSImage.alloc().initWithSize_((16, 16))
- ns_image.addRepresentation_(ns_bitmap)
- ns_cursor = NSCursor.alloc().initWithImage_hotSpot_(ns_image, (0, 0))
- _empty_cursor = Cursor._from_ns_cursor(ns_cursor)
- _empty_cursor._data = d
- return _empty_cursor
-
-arrow = Cursor._from_ns_cursor(NSCursor.arrowCursor())
-ibeam = Cursor._from_ns_cursor(NSCursor.IBeamCursor())
-crosshair = Cursor._from_ns_cursor(NSCursor.crosshairCursor())
-fist = Cursor._from_ns_cursor(NSCursor.closedHandCursor())
-hand = Cursor._from_ns_cursor(NSCursor.openHandCursor())
-finger = Cursor._from_ns_cursor(NSCursor.pointingHandCursor())
-invisible = _make_empty_cursor()
-
-mac_poof = Cursor._from_ns_cursor(NSCursor.disappearingItemCursor())
-
-del NSCursor
-del Cursor
-del _make_empty_cursor
-
-def empty_cursor():
- return invisible
diff --git a/PyGUI-2.5.3/GUI/Cocoa/StdFonts.py b/PyGUI-2.5.3/GUI/Cocoa/StdFonts.py
deleted file mode 100644
index 91aa2ca..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/StdFonts.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Python GUI - Standard Fonts - PyObjC
-#
-
-from AppKit import NSFont
-from GUI import Font
-
-system_font = Font._from_ns_font(NSFont.systemFontOfSize_(0))
-application_font = Font._from_ns_font(NSFont.userFontOfSize_(0))
diff --git a/PyGUI-2.5.3/GUI/Cocoa/StdMenus.py b/PyGUI-2.5.3/GUI/Cocoa/StdMenus.py
deleted file mode 100644
index 1b1fe3f..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/StdMenus.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# Python GUI - Standard Menus - PyObjC
-#
-
-from GUI.GStdMenus import build_menus, \
- fundamental_cmds, help_cmds, pref_cmds, file_cmds, print_cmds, edit_cmds
-
-fundamental_cmds += ['hide_app_cmd', 'hide_other_apps_cmd', 'show_all_apps_cmd']
-
-_appl_menu_items = [
- ("About ", 'about_cmd'),
- "-",
- ("Preferences...", 'preferences_cmd'),
- "-",
- ("Hide /H", 'hide_app_cmd'),
- ("Hide Others", 'hide_other_apps_cmd'),
- ("Show All", 'show_all_apps_cmd'),
- "-",
- ("Quit /Q", 'quit_cmd'),
-]
-
-_file_menu_items = [
- ("New/N", 'new_cmd'),
- ("Open.../O", 'open_cmd'),
- ("Close/W", 'close_cmd'),
- "-",
- ("Save/S", 'save_cmd'),
- ("Save As...", 'save_as_cmd'),
- ("Revert", 'revert_cmd'),
- "-",
- ("Page Setup...", 'page_setup_cmd'),
- ("Print.../P", 'print_cmd'),
-]
-
-_edit_menu_items = [
- ("Undo/Z", 'undo_cmd'),
- ("Redo/^Z", 'redo_cmd'),
- "-",
- ("Cut/X", 'cut_cmd'),
- ("Copy/C", 'copy_cmd'),
- ("Paste/V", 'paste_cmd'),
- ("Delete", 'clear_cmd'),
- "-",
- ("Select All/A", 'select_all_cmd'),
-]
-
-_help_menu_items = [
- ("Help", 'help_cmd'),
-]
-
-#------------------------------------------------------------------------------
-
-def basic_menus(substitutions = {}, include = None, exclude = None):
- return build_menus([
- ("@", _appl_menu_items, False),
- ("File", _file_menu_items, False),
- ("Edit", _edit_menu_items, False),
- ("Help", _help_menu_items, True),
- ],
- substitutions = substitutions,
- include = include,
- exclude = exclude)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Task.py b/PyGUI-2.5.3/GUI/Cocoa/Task.py
deleted file mode 100644
index 9ad5a3e..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Task.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# PyGUI - Tasks - Cocoa
-#
-
-import sys
-from weakref import WeakValueDictionary
-from Foundation import NSTimer, NSRunLoop, NSDefaultRunLoopMode
-from AppKit import NSEventTrackingRunLoopMode, NSModalPanelRunLoopMode
-from GUI import export
-from GUI import Globals
-from GUI.GTasks import Task as GTask
-
-#----------------------------------------------------------------------
-#
-# Doing things this convoluted way to work around a memory
-# leak in PyObjC. Need to avoid having the NSTimer trigger
-# creation of a bound method each time it fires or the bound
-# methods leak. Also can't use the userInfo of the NSTimer as
-# it seems to leak too.
-
-ns_timer_to_task = WeakValueDictionary()
-
-class TaskTrigger(object):
- pass
-
-def fire_(ns_timer):
- ns_timer_to_task[ns_timer]._ns_fire()
-
-trigger = TaskTrigger()
-trigger.fire_ = fire_
-
-#----------------------------------------------------------------------
-
-class Task(GTask):
-
- def __init__(self, proc, interval, repeat = 0, start = 1):
- self._proc = proc
- self._interval = interval
- self._repeat = repeat
- self._ns_timer = None
- if start:
- self.start()
-
- def destroy(self):
- #print "Task.destroy:", self ###
- self.stop()
-
- def get_scheduled(self):
- return self._ns_timer is not None
-
- def get_interval(self):
- return self._interval
-
- def get_repeat(self):
- return self._repeat
-
- def start(self):
- self.stop()
- #ns_timer = \
- # NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
- # self._interval, self._target, '_ns_fire', None, self._repeat)
- ns_timer = \
- NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
- self._interval, trigger, 'fire:', None, self._repeat)
- self._ns_timer = ns_timer
- ns_timer_to_task[ns_timer] = self
- ns_run_loop = NSRunLoop.currentRunLoop()
- ns_run_loop.addTimer_forMode_(
- ns_timer, NSDefaultRunLoopMode)
- ns_run_loop.addTimer_forMode_(
- ns_timer, NSEventTrackingRunLoopMode)
- ns_run_loop.addTimer_forMode_(
- ns_timer, NSModalPanelRunLoopMode)
-
- def stop(self):
- ns_timer = self._ns_timer
- if ns_timer:
- ns_timer.invalidate()
- del ns_timer_to_task[ns_timer]
- self._ns_timer = None
-
- def _ns_fire(self):
- try:
- self._proc()
- except:
- Globals.pending_exception = sys.exc_info()
- self.stop()
-
-export(Task)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/TextEditor.py b/PyGUI-2.5.3/GUI/Cocoa/TextEditor.py
deleted file mode 100644
index 501e260..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/TextEditor.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Text Editor - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from AppKit import NSTextView, NSScrollView, NSViewWidthSizable, \
- NSMutableParagraphStyle
-from GUI import export
-from GUI import StdFonts
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler
-from GUI.GTextEditors import TextEditor as GTextEditor
-
-NUM_TAB_STOPS = 32
-
-class TextEditor(GTextEditor):
-
- _ns_handle_mouse = True
-
- def __init__(self, scrolling = 'hv', **kwds):
- width = 100
- height = 100
- frame = ((0, 0), (width, height))
- ns_outer = NSScrollView.alloc().initWithFrame_(frame)
- ns_outer.setHasHorizontalScroller_('h' in scrolling)
- ns_outer.setHasVerticalScroller_('v' in scrolling)
- if 'h' in scrolling:
- cwidth = 2000
- else:
- cwidth = ns_outer.contentSize()[0]
- frame = ((0, 0), (cwidth, height))
- ns_inner = PyGUI_NSTextView.alloc().initWithFrame_(frame)
- ns_inner.pygui_component = self
- ps = NSMutableParagraphStyle.alloc().init()
- ps.setDefaultTabInterval_(ps.tabStops()[0].location())
- ps.setTabStops_([])
- ns_inner.setDefaultParagraphStyle_(ps)
- ns_inner.setAllowsUndo_(True)
- ns_outer.setDocumentView_(ns_inner)
- if 'h' not in scrolling:
- ns_inner.setAutoresizingMask_(NSViewWidthSizable)
- if 'font' not in kwds:
- kwds['font'] = StdFonts.application_font
- GTextEditor.__init__(self, ns_outer,
- _ns_inner_view = ns_inner, **kwds)
-
- def get_text(self):
- return self._ns_inner_view.string()
-
- def set_text(self, value):
- self._ns_inner_view.setString_(value)
- self._ns_apply_style()
-
- def get_text_length(self):
- return self._ns_inner_view.textStorage().length()
-
- def get_selection(self):
- start, length = self._ns_inner_view.selectedRanges()[0].rangeValue()
- return (start, start + length)
-
- def set_selection(self, value):
- start, stop = value
- self._ns_inner_view.setSelectedRange_((start, stop - start))
-
- def get_font(self):
- return self._font
-
- def set_font(self, font):
- self._font = font
- self._ns_inner_view.setFont_(font._ns_font)
-
- def get_tab_spacing(self):
- #ns_storage = self._ns_inner_view.textStorage()
- #ps, _ = ns_storage.attribute_atIndex_effectiveRange_("NSParagraphStyle", 0)
- ps = self._ns_inner_view.defaultParagraphStyle()
- return ps.defaultTabInterval()
-
- def set_tab_spacing(self, x):
- ps = NSMutableParagraphStyle.alloc().init()
- ps.setTabStops_([])
- ps.setDefaultTabInterval_(x)
- self._ns_inner_view.setDefaultParagraphStyle_(ps)
- self._ns_apply_style()
-
- def paste_cmd(self):
- GTextEditor.paste_cmd(self)
- self._ns_apply_style()
-
- def _ns_apply_style(self):
- ns_textview = self._ns_inner_view
- ps = ns_textview.defaultParagraphStyle()
- font = ns_textview.font()
- ns_storage = self._ns_inner_view.textStorage()
- ns_storage.setAttributes_range_(
- {"NSParagraphStyle": ps, "NSFont": font},
- (0, self.text_length))
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSTextView(NSTextView, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(TextEditor)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/TextField.py b/PyGUI-2.5.3/GUI/Cocoa/TextField.py
deleted file mode 100644
index bfc4587..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/TextField.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Python GUI - Text Fields - PyObjC
-#
-
-from Foundation import NSRange
-from GUI import export
-from GUI.StdFonts import system_font #application_font
-from GUI import EditCmdHandler
-from GUI.TextFieldBasedControls import TextFieldBasedControl
-from GUI.GTextFields import TextField as GTextField
-
-class TextField(TextFieldBasedControl, GTextField):
-
- #_vertical_padding = 5
- _intercept_tab_key = False
-
- def __init__(self, text = "", font = system_font,
- multiline = False, password = False, border = True, **kwds):
- ns_textfield = self._create_ns_textfield(editable = True,
- multiline = multiline, password = password,
- text = text, font = font, border = border)
- GTextField.__init__(self, _ns_view = ns_textfield,
- multiline = multiline, **kwds)
-
- def get_selection(self):
- ns_editor = self._ns_editor()
- if ns_editor:
- start, length = ns_editor.selectedRange()
- return (start, start + length)
- else:
- return (0, 0)
-
- def set_selection(self, (start, end)):
- self.become_target()
- ns_editor = self._ns_editor()
- if ns_editor:
- ns_editor.setSelectedRange_(NSRange(start, end - start))
-
- def select_all(self):
- self.become_target()
- self._ns_view.selectText_(None)
-
- def _ns_editor(self):
- return self._ns_view.currentEditor()
-
- def _ns_edit_cmd_target(self):
- return self._ns_editor()
-
-export(TextField)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/TextFieldBasedControls.py b/PyGUI-2.5.3/GUI/Cocoa/TextFieldBasedControls.py
deleted file mode 100644
index 9bafabf..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/TextFieldBasedControls.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# Python GUI - PyObjC
-#
-# Base class for controls based on an NSTextField
-#
-
-from Foundation import NSRect, NSPoint, NSSize
-from AppKit import NSTextField, NSSecureTextField, NSTextFieldCell
-from GUI.Utils import NSMultiClass
-from GUI import Color
-from GUI.Utils import ns_size_to_fit, PyGUI_NS_EventHandler
-from GUI.StdFonts import system_font
-
-class TextFieldBasedControl(object):
-
- _ns_handle_mouse = True
-
- def _create_ns_textfield(self, editable, text, font,
- multiline = False, password = False, border = False,
- padding = (0, 0)):
- self._ns_is_password = password
- if password:
- ns_class = PyGUI_NSSecureTextField
- else:
- ns_class = PyGUI_NSTextField
- ns_frame = NSRect(NSPoint(0, 0), NSSize(20, 10))
- ns_textfield = ns_class.alloc().initWithFrame_(ns_frame)
- ns_textfield.pygui_component = self
- if multiline and not password:
- ns_textfield.pygui_multiline = True
- # Be careful here -- calling setBordered_ seems to affect isBezeled as well
- if editable:
- ns_textfield.setBezeled_(border)
- else:
- ns_textfield.setBordered_(border)
- if not editable:
- ns_textfield.setDrawsBackground_(False)
- ns_textfield.setEditable_(editable)
- ns_textfield.setSelectable_(editable)
- ns_textfield.setFont_(font._ns_font)
- ns_textfield.setStringValue_(text)
- ns_size_to_fit(ns_textfield, padding = padding)
- return ns_textfield
-
- def get_border(self):
- ns_textfield = self._ns_inner_view
- if ns_textfield.isEditable():
- return ns_textfield.isBezeled()
- else:
- return ns_textfield.isBordered()
-
- def set_border(self, border):
- ns_textfield = self._ns_inner_view
- if ns_textfield.isEditable():
- ns_textfield.setBezeled_(border)
- else:
- ns_textfield.setBordered_(border)
-
- def get_text(self):
- return self._ns_inner_view.stringValue()
-
- def set_text(self, v):
- self._ns_inner_view.setStringValue_(v)
-
- def get_color(self):
- return Color._from_ns_color(self._ns_inner_view.textColor())
-
- def set_color(self, v):
- self._ns_inner_view.setTextColor_(v._ns_color)
-
- def _get_vertical_padding(self):
- if self.border:
- return 5
- else:
- return 0
-
- _vertical_padding = property(_get_vertical_padding)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSTextField(NSTextField): #, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
-
- pygui_multiline = False
-
-class PyGUI_NSSecureTextField(NSSecureTextField): #, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
-
- pygui_multiline = False
-
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Utils.py b/PyGUI-2.5.3/GUI/Cocoa/Utils.py
deleted file mode 100644
index c83e90c..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Utils.py
+++ /dev/null
@@ -1,198 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Utilities - PyObjC
-#
-#------------------------------------------------------------------------------
-
-from math import ceil
-from inspect import getmro
-from Foundation import NSObject
-from AppKit import NSView
-from GUI import Event, Globals
-
-def NSMultiClass(name, bases, dic):
- # Workaround for PyObjC classes not supporting
- # multiple inheritance properly. Note: MRO is
- # right to left across the bases.
- main = bases[0]
- slots = list(dic.get('__slots__', ()))
- dic2 = {}
- for mix in bases[1:]:
- for cls in getmro(mix)[::-1]:
- slots2 = cls.__dict__.get('__slots__')
- if slots2:
- for slot in slots2:
- if slot not in slots:
- slots.append(slot)
- dic2.update(cls.__dict__)
- dic2.update(dic)
- if slots:
- dic2['__slots__'] = slots
- cls = type(main)(name, (main,), dic2)
- return cls
-
-#------------------------------------------------------------------------------
-
-class PyGUI_Flipped_NSView(NSView):
- # An NSView with a flipped coordinate system.
-
- def isFlipped(self):
- return True
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSActionTarget(NSObject):
- # A shared instance of this class is used as the target of
- # all action messages from the NSViews of Components. It
- # performs the action by calling the similarly-named method of
- # the corresponding Component.
-
- def doAction_(self, ns_sender):
- self.call_method('do_action', ns_sender)
-
- def call_method(self, method_name, ns_sender):
- component = Globals._ns_view_to_component.get(ns_sender)
- if component:
- getattr(component, method_name)()
-
-_ns_action_target = PyGUI_NSActionTarget.alloc().init()
-
-def ns_set_action(ns_control, method_name):
- # Arrange for the 'action' message of the NSControl to
- # invoke the indicated method of its associated Component.
- ns_control.setAction_(method_name)
- ns_control.setTarget_(_ns_action_target)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NS_EventHandler:
- # Methods to be mixed in with NSView subclasses that are
- # to relay mouse and keyboard events to a Component.
- #
- # pygui_component Component
-
- def mouseDown_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseUp_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseDragged_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def rightMouseDown_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def rightMouseUp_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def rightMouseDragged_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def otherMouseDown_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def otherMouseUp_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def otherMouseDragged_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseMoved_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseEntered_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseExited_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def keyDown_(self, ns_event):
- #print "PyGUI_NS_EventHandler.keyDown_:", repr(ns_event.characters()), \
- # "for", object.__repr__(self) ###
- self._ns_other_event(ns_event)
-
- def keyUp_(self, ns_event):
- #print "PyGUI_NS_EventHandler.keyUp_ for", self ###
- self._ns_other_event(ns_event)
-
- def _ns_mouse_event(self, ns_event):
- #print "PyGUI_NS_EventHandler._ns_mouse_event" ###
- event = self._ns_mouse_event_to_event(ns_event)
- #print "...sending to", self.pygui_component ###
- component = self.pygui_component
- if component:
- component.handle_event_here(event)
-
- def _ns_mouse_event_to_event(self, ns_event):
- event = Event(ns_event)
- event.position = tuple(self._ns_event_position(ns_event))
- return event
-
- def _ns_event_position(self, ns_event):
- #print "PyGUI_NS_EventHandler._ns_event_position:", self ###
- #print "...mro =", self.__class__.__mro__ ###
- ns_win_pos = ns_event.locationInWindow()
- return self.convertPoint_fromView_(ns_win_pos, None)
-
- def _ns_other_event(self, ns_event):
- #print "PyGUI_NS_EventHandler._ns_other_event for", self ###
- event = Event(ns_event)
- component = self.pygui_component
- if component:
- #print "...passing", event.kind, "to", component ###
- component.handle_event(event)
-
- def acceptsFirstResponder(self):
- ###return True
- return self.pygui_component._ns_accept_first_responder
-
-# def canBecomeKeyView(self):
-# return self.pygui_component._tab_stop
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NS_ViewBase(PyGUI_NS_EventHandler):
- # Methods to be mixed in with PyGUI_NSView classes.
- #
- # pygui_component ViewBase
-
- __slots__ = ['tracking_rect']
-
-# tracking_rect = None
-
- def becomeFirstResponder(self):
- self.pygui_component.targeted()
- return True
-
- def resignFirstResponder(self):
- self.pygui_component.untargeted()
- return True
-
- def resetCursorRects(self):
- #print "PyGUI_NS_ViewBase: resetCursorRects" ###
- self.removeCursorRects()
- self.tracking_rect = self.addTrackingRect_owner_userData_assumeInside_(
- self.visibleRect(), self, 0, False)
- self.pygui_component._ns_reset_cursor_rects()
-
- def removeCursorRects(self):
- #print "PyGUI_NS_ViewBase: removeCursorRects" ###
- tag = getattr(self, 'tracking_rect', None)
- if tag:
- self.removeTrackingRect_(tag)
- self.tracking_rect = None
-
-#------------------------------------------------------------------------------
-
-def ns_size_to_fit(ns_control, padding = (0, 0), height = None):
- # Set size of control to fit its contents, plus the given padding.
- # Height may be overridden, because some controls don't seem to
- # calculate it properly.
- # Auto sizing can result in fractional sizes, which seems to cause
- # problems when NS autoresizing occurs later. So we round the size up
- # to whole numbers of pixels.
- ns_control.sizeToFit()
- w, h = ns_control.frame().size
- pw, ph = padding
- ns_control.setFrameSize_((ceil(w + pw), ceil((height or h) + ph)))
diff --git a/PyGUI-2.5.3/GUI/Cocoa/View.py b/PyGUI-2.5.3/GUI/Cocoa/View.py
deleted file mode 100644
index 74a13e8..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/View.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Python GUI - Views - PyObjC
-#
-
-from GUI import export
-from GUI.GViews import View as GView
-
-class View(GView):
-
- _ns_scrollable = False
-
-export(View)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/ViewBase.py b/PyGUI-2.5.3/GUI/Cocoa/ViewBase.py
deleted file mode 100644
index 0cf6d05..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/ViewBase.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Python GUI - View Base - PyObjC
-#
-
-import Foundation
-import AppKit
-from GUI import Globals, export
-from GUI.Properties import overridable_property
-from GUI import Event
-from GUI.Utils import PyGUI_NS_EventHandler
-from GUI.GViewBases import ViewBase as GViewBase
-
-ns_tracking_mask = (
- AppKit.NSLeftMouseDraggedMask |
- AppKit.NSRightMouseDraggedMask |
- AppKit.NSOtherMouseDraggedMask |
- AppKit.NSLeftMouseUpMask |
- AppKit.NSRightMouseUpMask |
- AppKit.NSOtherMouseUpMask)
-
-# Need to use NSDefaultRunLoopMode here otherwise timers don't fire.
-ns_tracking_mode = Foundation.NSDefaultRunLoopMode # AppKit.NSEventTrackingRunLoopMode
-
-ns_distant_future = Foundation.NSDate.distantFuture()
-
-
-class ViewBase(GViewBase):
-
- def _change_container(self, new_container):
- self._ns_inner_view.removeCursorRects()
- super(ViewBase, self)._change_container(new_container)
-
- def _ns_track_mouse(self, ns_view):
- ns_app = Globals.ns_application
- tracking = True
- while tracking:
- ns_event = ns_app.nextEventMatchingMask_untilDate_inMode_dequeue_(
- ns_tracking_mask, ns_distant_future, ns_tracking_mode, True)
- event = ns_view._ns_mouse_event_to_event(ns_event)
- yield event
- tracking = event.kind <> 'mouse_up'
-
- def _cursor_changed(self):
- #print "ViewBase._cursor_changed:", self ###
- ns_view = self._ns_view
- ns_window = ns_view.window()
- if ns_window:
- # invalidateCursorRectsForView_ doesn't seem to trigger
- # resetCursorRects on the view.
- #ns_window.invalidateCursorRectsForView_(ns_view)
- ns_window.resetCursorRects()
-
- def _ns_reset_cursor_rects(self):
- #print "ViewBase._ns_reset_cursor_rects:", self ###
- cursor = self._cursor
- if cursor:
- ns_view = self._ns_inner_view
- ns_rect = ns_view.visibleRect()
- ns_view.addCursorRect_cursor_(ns_rect, cursor._ns_cursor)
-
-export(ViewBase)
diff --git a/PyGUI-2.5.3/GUI/Cocoa/Window.py b/PyGUI-2.5.3/GUI/Cocoa/Window.py
deleted file mode 100644
index 62d4037..0000000
--- a/PyGUI-2.5.3/GUI/Cocoa/Window.py
+++ /dev/null
@@ -1,292 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Windows - PyObjC version
-#
-#------------------------------------------------------------------------------
-
-from Foundation import NSRect, NSPoint, NSSize, NSObject
-import AppKit
-from AppKit import NSWindow, NSScreen, NSTextView, NSMenu
-from GUI import export
-from GUI import Globals
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, PyGUI_Flipped_NSView
-from GUI import application
-from GUI import Event
-from GUI.GWindows import Window as GWindow
-
-_default_options_for_style = {
- 'standard':
- {'movable': 1, 'closable': 1, 'hidable': 1, 'resizable': 1},
- 'nonmodal_dialog':
- {'movable': 1, 'closable': 0, 'hidable': 1, 'resizable': 0},
- 'modal_dialog':
- {'movable': 1, 'closable': 0, 'hidable': 0, 'resizable': 0},
- 'alert':
- {'movable': 1, 'closable': 0, 'hidable': 0, 'resizable': 0},
- 'fullscreen':
- {'movable': 0, 'closable': 0, 'hidable': 0, 'resizable': 0},
- #{'movable': 1, 'closable': 1, 'hidable': 1, 'resizable': 1},
-}
-
-#------------------------------------------------------------------------------
-
-class Window(GWindow):
- # _ns_window PyGUI_NSWindow
- # _ns_style_mask int
-
- def __init__(self, style = 'standard', zoomable = None, **kwds):
- # We ignore zoomable, since it's the same as resizable.
- self._style = style
- options = dict(_default_options_for_style[style])
- for option in ['movable', 'closable', 'hidable', 'resizable']:
- if option in kwds:
- options[option] = kwds.pop(option)
- self._ns_style_mask = self._ns_window_style_mask(**options)
- if style == 'fullscreen':
- ns_rect = NSScreen.mainScreen().frame()
- else:
- ns_rect = NSRect(NSPoint(0, 0), NSSize(self._default_width, self._default_height))
- ns_window = PyGUI_NSWindow.alloc()
- ns_window.initWithContentRect_styleMask_backing_defer_(
- ns_rect, self._ns_style_mask, AppKit.NSBackingStoreBuffered, True)
- ns_content = PyGUI_NS_ContentView.alloc()
- ns_content.initWithFrame_(NSRect(NSPoint(0, 0), NSSize(0, 0)))
- ns_content.pygui_component = self
- ns_window.setContentView_(ns_content)
- ns_window.setAcceptsMouseMovedEvents_(True)
- ns_window.setDelegate_(ns_window)
- ns_window.pygui_component = self
- self._ns_window = ns_window
- GWindow.__init__(self, style = style, closable = options['closable'],
- _ns_view = ns_window.contentView(), _ns_responder = ns_window,
- _ns_set_autoresizing_mask = False,
- **kwds)
-
- def _ns_window_style_mask(self, movable, closable, hidable, resizable):
- if movable or closable or hidable or resizable:
- mask = AppKit.NSTitledWindowMask
- if closable:
- mask |= AppKit.NSClosableWindowMask
- if hidable:
- mask |= AppKit.NSMiniaturizableWindowMask
- if resizable:
- mask |= AppKit.NSResizableWindowMask
- else:
- mask = AppKit.NSBorderlessWindowMask
- return mask
-
- def destroy(self):
- #print "Window.destroy:", self ###
- self.hide()
- app = application()
- if app._ns_key_window is self:
- app._ns_key_window = None
- GWindow.destroy(self)
- # We can't drop all references to the NSWindow yet, because this method
- # can be called from its windowShouldClose: method, and allowing an
- # NSWindow to be released while executing one of its own methods seems
- # to be a very bad idea (Cocoa hangs). So we hide the NSWindow and store
- # a reference to it in a global. It will be released the next time a
- # window is closed and the global is re-used.
- global _ns_zombie_window
- _ns_zombie_window = self._ns_window
- self._ns_window.pygui_component = None
- #self._ns_window = None
-
- def get_bounds(self):
- ns_window = self._ns_window
- ns_frame = ns_window.frame()
- (l, y), (w, h) = ns_window.contentRectForFrameRect_styleMask_(
- ns_frame, self._ns_style_mask)
- b = Globals.ns_screen_height - y
- result = (l, b - h, l + w, b)
- return result
-
- def set_bounds(self, (l, t, r, b)):
- y = Globals.ns_screen_height - b
- ns_rect = NSRect(NSPoint(l, y), NSSize(r - l, b - t))
- ns_window = self._ns_window
- ns_frame = ns_window.frameRectForContentRect_styleMask_(
- ns_rect, self._ns_style_mask)
- ns_window.setFrame_display_(ns_frame, False)
-
- def get_title(self):
- return self._ns_window.title()
-
- def set_title(self, v):
- self._ns_window.setTitle_(v)
-
- def get_visible(self):
- return self._ns_window.isVisible()
-
- def set_visible(self, v):
- # At some mysterious time between creating a window and showing
- # it for the first time, Cocoa adjusts its position so that it
- # doesn't extend above the menu bar. This is a nuisance for
- # our fullscreen windows, so we need to readjust the position
- # before showing.
- if v:
- if self._style == 'fullscreen':
- self._ns_window.setFrameOrigin_(NSPoint(0, 0))
- self._ns_window.orderFront_(None)
- else:
- self._ns_window.orderOut_(None)
-
- def _show(self):
- self.visible = True
- self._ns_window.makeKeyWindow()
-
- def get_target(self):
- ns_window = self._ns_window
- ns_view = ns_window.firstResponder()
- while ns_view and ns_view is not ns_window:
- component = Globals._ns_view_to_component.get(ns_view)
- if component:
- return component
- ns_view = ns_view.superview()
- return self
-
- def center(self):
- self._ns_window.center()
-
- def _stagger(self):
- key_win = application()._ns_key_window
- if key_win:
- (x, y), (w, h) = key_win._ns_window.frame()
- p = self._ns_window.cascadeTopLeftFromPoint_(NSPoint(x, y + h))
- self._ns_window.setFrameTopLeftPoint_(p)
- else:
- (x, y), (w, h) = NSScreen.mainScreen().visibleFrame()
- ns_vis_topleft = NSPoint(x, y + h)
- self._ns_window.setFrameTopLeftPoint_(ns_vis_topleft)
-
- def _document_needs_saving(self, state):
- self._ns_window.setDocumentEdited_(state)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSWindow(NSWindow, PyGUI_NS_EventHandler):
- # pygui_component Window
- # resize_delta point or None
-
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component', 'resize_delta', 'pygui_field_editor']
-
-# pygui_component = None
-# resize_delta = None
-# pygui_field_editor = None
-
- def _ns_event_position(self, ns_event):
- return ns_event.locationInWindow()
-
- def windowShouldClose_(self, sender):
- # We use this to detect when the Aqua window closing button
- # is pressed, and do the closing ourselves.
- self.pygui_component.close_cmd()
- return False
-
- # The NSWindow is made its own delegate.
-
- def windowWillResize_toSize_(self, ns_win, new_ns_size):
- w0, h0 = self.frame().size
- w1, h1 = new_ns_size
- self.resize_delta = (w1 - w0, h1 - h0)
- return new_ns_size
-
- def windowDidResize_(self, notification):
- delta = getattr(self, 'resize_delta', None)
- if delta:
- self.pygui_component._resized(delta)
- self.resize_delta = None
-
- def windowDidBecomeKey_(self, notification):
- app = application()
- app._ns_key_window = self.pygui_component
- app._update_menubar()
-
- def windowDidResignKey_(self, notification):
- app = application()
- app._ns_key_window = None
- app._update_menubar()
-
- def windowWillReturnFieldEditor_toObject_(self, ns_window, ns_obj):
- # Return special field editor for newline handling in text fields.
- #print "Window: Field editor requested for", object.__repr__(ns_obj) ###
- #editor = self.pygui_field_editor
- #if not editor:
- try:
- editor = self.pygui_field_editor
- except AttributeError:
- #print "...creating new field editor" ###
- editor = PyGUI_FieldEditor.alloc().initWithFrame_(
- NSRect(NSPoint(0, 0), NSSize(0, 0)))
- editor.setFieldEditor_(True)
- editor.setDrawsBackground_(False)
- self.pygui_field_editor = editor
- return editor
-
- # Need the following two methods so that a fullscreen window can become
- # the main window. Otherwise it can't, because it has no title bar.
-
- def canBecomeKeyWindow(self):
- return self.isVisible()
-
- def canBecomeMainWindow(self):
- #print "PyGUI_NSWindow.canBecomeMainWindow"
- return self.isVisible()
-
- def windowDidBecomeMain_(self, notification):
- #print "PyGUI_NSWindow.windowDidBecomeMain_:", self.pygui_component.title ###
- comp = self.pygui_component
- if comp and comp._style == 'fullscreen':
- #print "...hiding menu bar" ###
- NSMenu.setMenuBarVisible_(False)
- #self.setFrameOrigin_(NSPoint(0, 0))
-
- def windowDidResignMain_(self, notification):
- #print "PyGUI_NSWindow.windowDidResignMain_:", self.pygui_component.title ###
- comp = self.pygui_component
- if comp and comp._style == 'fullscreen':
- #print "...showing menu bar" ###
- NSMenu.setMenuBarVisible_(True)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NS_ContentView(PyGUI_Flipped_NSView, PyGUI_NS_EventHandler):
- # pygui_component Window
-
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
- def acceptsFirstResponder(self):
- return False
-
-#------------------------------------------------------------------------------
-
-class PyGUI_FieldEditorBase(NSTextView):
- # Special field editor for use by TextFields. Intercepts
- # return key events and handles them our own way.
-
- def keyDown_(self, ns_event):
- #print "PyGUI_FieldEditorBase.keyDown_ for", self.pygui_component ###
- if ns_event.characters() == "\r":
- if self.pygui_component._multiline:
- self.insertText_("\n")
- return
- NSTextView.keyDown_(self, ns_event)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_FieldEditor(PyGUI_FieldEditorBase, PyGUI_NS_EventHandler):
-
- __metaclass__ = NSMultiClass
-
- def get_pygui_component(self):
- pygui_nstextfield = self.superview().superview()
- component = pygui_nstextfield.pygui_component
- component._ns_responder = self
- return component
-
- pygui_component = property(get_pygui_component)
-
-export(Window)
diff --git a/PyGUI-2.5.3/GUI/Generic/Actions.py b/PyGUI-2.5.3/GUI/Generic/Actions.py
deleted file mode 100644
index 7f2ea48..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Actions.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Actions - Generic
-#
-#------------------------------------------------------------------------------
-
-from GUI.Properties import overridable_property
-from GUI.Exceptions import ApplicationError
-
-#------------------------------------------------------------------------------
-
-def action_property(name, doc):
- attr = intern('_' + name)
- def getter(self):
- return getattr(self, attr)
- def setter(self, value):
- setattr(self, attr, value)
- return property(getter, setter, None, doc)
-
-#------------------------------------------------------------------------------
-
-class ActionBase(object):
- """Mixin class providing base support for action properties."""
-
- def do_named_action(self, name):
- #print "ActionBase.do_named_action:", repr(name) ###
- action = getattr(self, name)
- #print "...action =", repr(action) ###
- if action:
- try:
- if isinstance(action, tuple):
- args = action[1:]
- action = action[0]
- else:
- args = ()
- if isinstance(action, str):
- #print "...handling", action ###
- self.handle(action, *args)
- else:
- action(*args)
- except ApplicationError:
- raise
- except:
- import sys
- et, ev, tb = sys.exc_info()
- raise et, et("%s (while doing action %r%r)" % (ev, action, args)), tb
-
-#------------------------------------------------------------------------------
-
-class Action(ActionBase):
- """Mixin class providing a single action property called 'action'."""
-
- action = action_property('action', """Action to be performed.
- May be or (, ...) where is either
- a message name or a callable object.""")
-
- _action = None
-
- def do_action(self):
- "Invoke the action."
- self.do_named_action('action')
-
diff --git a/PyGUI-2.5.3/GUI/Generic/Alerts.py b/PyGUI-2.5.3/GUI/Generic/Alerts.py
deleted file mode 100644
index efc5351..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Alerts.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#-----------------------------------------------------------------------
-#
-# PyGUI - Alert functions - Generic
-#
-#-----------------------------------------------------------------------
-
-from GUI import BaseAlertFunctions
-
-def alert(kind, prompt, ok_label = "OK", **kwds):
- """Displays an alert box with one button. Does not return a value.
- Kind may be 'stop' for conditions preventing continuation,
- 'caution' for warning messages, 'note' for informational
- messages, and 'query' for asking a question of the user."""
-
- BaseAlertFunctions.alert(kind, prompt, ok_label, **kwds)
-
-
-def alert2(kind, prompt, yes_label = "Yes", no_label = "No",
- **kwds):
- """Displays an alert with two buttons. Returns 1 if the
- first button is pressed, 0 if the second button is pressed.
- The 'default' and 'cancel' arguments specify which buttons,
- if any, are activated by the standard keyboard equivalents,
- and take the values 1, 0 or None."""
-
- return BaseAlertFunctions.alert2(kind, prompt, yes_label, no_label,**kwds)
-
-
-def alert3(kind, prompt,
- yes_label = "Yes", no_label = "No", other_label = "Cancel",
- **kwds):
- """Displays an alert with 3 buttons. Returns 1 if the
- first button is pressed, 0 if the second button is pressed,
- and -1 if the third button is pressed. The 'default' and 'cancel'
- arguments specify which buttons, if any, are activated by the
- standard keyboard equivalents, and take the values 1, 0, -1 or None."""
-
- return BaseAlertFunctions.alert3(kind, prompt, yes_label, no_label, other_label, **kwds)
-
-
-def stop_alert(*args, **kwds):
- """Displays a 1-button alert of type 'stop'. See alert()."""
- alert('stop', *args, **kwds)
-
-def note_alert(*args, **kwds):
- """Displays a 1-button alert of type 'note'. See alert()."""
- alert('note', *args, **kwds)
-
-def confirm(*args, **kwds):
- """Displays a 2-button alert of type 'caution'. See alert2()."""
- return alert2('caution', *args, **kwds)
-
-def ask(*args, **kwds):
- """Displays a 2-button alert of type 'query'. See alert2()."""
- return alert2('query', *args, **kwds)
-
-def confirm_or_cancel(*args, **kwds):
- """Displays a 3-button alert of type 'caution'. See alert3()."""
- return alert3('caution', *args, **kwds)
-
-def ask_or_cancel(*args, **kwds):
- """Displays a 3-button alert of type 'query'. See alert3()."""
- return alert3('query', *args, **kwds)
diff --git a/PyGUI-2.5.3/GUI/Generic/BaseAlertFunctions.py b/PyGUI-2.5.3/GUI/Generic/BaseAlertFunctions.py
deleted file mode 100644
index 84a0b38..0000000
--- a/PyGUI-2.5.3/GUI/Generic/BaseAlertFunctions.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Python GUI - Basic alert functions - Generic
-#
-
-from GUI.AlertClasses import Alert, Alert2, Alert3
-
-def present_and_destroy(dlog):
- dlog.center()
- try:
- return dlog.present()
- finally:
- dlog.destroy()
-
-
-def alert(kind, prompt, ok_label, **kwds):
- present_and_destroy(Alert(kind, prompt, ok_label))
-
-
-def alert2(kind, prompt, yes_label, no_label, **kwds):
- return present_and_destroy(
- Alert2(kind, prompt, yes_label, no_label, **kwds))
-
-
-def alert3(kind, prompt, yes_label, no_label, other_label, **kwds):
- return present_and_destroy(
- Alert3(kind, prompt, yes_label, no_label, other_label, **kwds))
diff --git a/PyGUI-2.5.3/GUI/Generic/Column.py b/PyGUI-2.5.3/GUI/Generic/Column.py
deleted file mode 100644
index 715d666..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Column.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Column layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Column(Frame):
-
- def __init__(self, items, spacing = 10, align = 'l', equalize = '',
- expand = None, padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- if expand is not None and not isinstance(expand, int):
- expand = items.index(expand)
- equalize_components(items, equalize)
- width = 0
- for item in items:
- if item:
- width = max(width, item.width)
- y = vpad
- gap = 0
- vanchor = 't'
- hanchor = align
- for i, item in enumerate(items):
- if item:
- y += gap
- if 'l' in align:
- x = 0
- if 'r' in align:
- item.width = width
- elif align == 'r':
- x = width - item.width
- else:
- x = (width - item.width) // 2
- item.position = (x + hpad, y)
- if i == expand:
- item.anchor = 'tb' + hanchor
- vanchor = 'b'
- else:
- item.anchor = vanchor + hanchor
- y += item.height
- if i == expand:
- vanchor = 'b'
- gap = spacing
- self.size = (width + 2 * hpad, y + vpad)
- self.add(items)
- self.set(**kwds)
-
-export(Column)
diff --git a/PyGUI-2.5.3/GUI/Generic/Compatibility.py b/PyGUI-2.5.3/GUI/Generic/Compatibility.py
deleted file mode 100644
index 87eda05..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Compatibility.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#-------------------------------------------------------------------------------
-#
-# PyGUI - Facilities for compatibility across Python versions
-#
-#-------------------------------------------------------------------------------
-
-try:
- from __builtin__ import set
-except ImportError:
- from sets import Set as set
diff --git a/PyGUI-2.5.3/GUI/Generic/Document.py b/PyGUI-2.5.3/GUI/Generic/Document.py
deleted file mode 100644
index 1ff797c..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Document.py
+++ /dev/null
@@ -1,321 +0,0 @@
-#
-# Python GUI - Documents - Generic
-#
-
-import os, tempfile
-from GUI import export
-from GUI.Alerts import confirm, confirm_or_cancel
-from GUI.Properties import overridable_property
-from GUI import Model
-from GUI import MessageHandler
-from GUI.Files import FileRef, DirRef
-from GUI.FileDialogs import request_new_file
-from GUI import application
-from GUI.Exceptions import Cancel, UnimplementedMethod, ApplicationError
-from GUI.Printing import PageSetup, present_page_setup_dialog
-
-_next_doc_number = 1 # Counter for generating default titles
-
-class Document(Model, MessageHandler):
- """A Document represents an
- application data structure that can be stored in a file. It
- implements the standard parts of asking the user for file names and
- reading and writing files.
-
- Each Document can have one or more windows associated with it. When
- the last window belonging to a document is closed, the document itself
- is closed.
-
- A Document provides support for keeping track of whether it has been
- edited, and asking the user whether to save changes when it is
- closed."""
-
- # The following attribute prevents a Document that is the parent
- # of a Model from being pickled along with that Model.
- pickle_as_parent_model = False
-
- needs_saving = overridable_property('needs_saving',
- "True if the document has been edited and needs to be saved.")
-
- file = overridable_property('file',
- """FileRef of the file that the document was read from or last written
- to, or None. Changing this causes update_title to be called.""")
-
- file_type = overridable_property('file_type',
- """FileType specifying the type of file handled by this document.""")
-
- title = overridable_property('title',
- """The title of the document. Changing this causes update_title of each
- associated window to be called.""")
-
- windows = overridable_property('windows',
- "List of windows associated with the document. Do not modify directly.")
-
- page_setup = overridable_property('page_setup',
- "The PageSetup to be used for printing this document.")
-
- binary = True # True if files are to be opened in binary mode
-
- _file_type = None # Type of file to create when saving
- _needs_saving = 0 # True if has been edited
- _file = None # FileRef of associated file, if any
- _title = None # Title for use in window banners, etc.
- _windows = None # List of associated windows
- _page_setup = None # Document-specific PageSetup instance
-
- #
- # Initialisation and destruction
- #
-
- def __init__(self, **kwds):
- self._windows = []
- Model.__init__(self, **kwds)
- application()._add_document(self)
-
- def destroy(self):
- """Destroy any associated windows, then destroy document contents."""
- #print "Document.destroy:", self ###
- for win in self._windows[:]:
- win.destroy()
- application()._remove_document(self)
- self.destroy_contents()
- Model.destroy(self)
-
- #
- # Properties
- #
-
- def get_needs_saving(self):
- return self._needs_saving
-
- def set_needs_saving(self, x):
- if self._needs_saving <> x:
- self._needs_saving = x
- for window in self._windows:
- window._document_needs_saving(x)
-
- def get_file(self):
- return self._file
-
- def set_file(self, x):
- self._file = x
- if x is not None:
- application()._last_directory = x.dir
- self.update_title()
-
- def get_file_type(self):
- return self._file_type
-
- def set_file_type(self, x):
- self._file_type = x
-
- def get_title(self):
- t = self._title
- if t == None:
- t = self.make_title()
- self._title = t
- return t
-
- def set_title(self, x):
- self._title = x
- for win in self._windows:
- win.update_title()
-
- def get_windows(self):
- return self._windows
-
- def get_page_setup(self):
- ps = self._page_setup
- if not ps:
- ps = PageSetup()
- self._page_setup = ps
- return ps
-
- def set_page_setup(self, ps):
- self._page_setup = ps
-
- #
- # Methods
- #
-
- def changed(self):
- "Set the needs_saving property to true."
- self.needs_saving = 1
-
- def new_contents(self):
- """Should initialise the document to the appropriate state following a New
- command."""
- pass
-
- def read_contents(self, file):
- """Should initialise the document's contents by reading it from the given
- file object."""
- raise UnimplementedMethod(self, 'read_contents')
-
- def write_contents(self, file):
- """Should write the document's contents to the given file object."""
- raise UnimplementedMethod(self, 'write_contents')
-
- def destroy_contents(self):
- """Called when the contents of the document are about to be discarded.
- If the contents contains any Model objects, they should be destroyed."""
-
- def save_changes(self):
- """If the document has been edited, ask the user whether to save changes,
- and do so if requested."""
- if self._needs_saving:
- result = confirm_or_cancel('Save changes to "%s"?' % self.title,
- "Save", "Don't Save", "Cancel")
- if result < 0:
- raise Cancel
- if result:
- self.save_cmd()
-
- def save_cmd(self):
- """Implements the standard Save command. Writes the document to its
- associated file, asking the user for one first if necessary."""
- if self._file == None:
- self.get_new_file_name()
- try:
- self.write()
- except EnvironmentError, e:
- raise ApplicationError("Unable to save '%s'." % self._file.name, e)
-
- def save_as_cmd(self):
- """Implements the standard Save As... command. Asks the user for a new file
- and writes the document to it."""
- self.get_new_file_name()
- self.save_cmd()
-
- def revert_cmd(self):
- """Implements the standard Revert command. Discards the current contents
- of the document and re-reads it from the associated file."""
- if self._file != None:
- if confirm(
- 'Revert to the last saved version of "%s"?' % self.title,
- "Revert", "Cancel"):
- self.destroy_contents()
- self.read()
-
- def close_cmd(self):
- """Implements the standard Close command. Asks whether to save any
- changes, then destroys the document."""
- self.save_changes()
- self.destroy()
-
- def page_setup_cmd(self):
- if present_page_setup_dialog(self.page_setup):
- self.changed()
-
- def make_title(self):
- """Generates a title for the document. If associated with a file,
- uses its last pathname component, else generates 'Untitled-n'."""
- global _next_doc_number
- if self._file != None:
- return os.path.basename(self._file)
- else:
- n = _next_doc_number
- _next_doc_number = n + 1
- return "Untitled-%d" % n
-
- def update_title(self):
- """Called when the file property changes, to update the
- title property appropriately."""
- file = self._file
- if file:
- self.title = file.name
-
- def get_default_save_directory(self):
- """Called when the user is about to be asked for a location in which
- to save a document that has not been saved before, to find a default
- directory for request_new_file(). Should return a DirRef or FileRef,
- or None if there is no particular preferred location."""
- return None
-
- def get_default_save_filename(self):
- """Called when the user is about to be asked for a location in which
- to save a document that has not been saved before, to find a default
- file name for request_new_file(). Should return a suggested file name,
- or an empty string to require the user to enter a file name."""
- return ""
-
- #
- # Internal methods
- #
-
- def get_new_file_name(self):
- """Ask the user for a new file and associate the document with it."""
- old_file = self.file
- if old_file:
- old_name = old_file.name
- old_dir = old_file.dir
- else:
- old_name = self.get_default_save_filename()
- old_dir = self.get_default_save_directory()
- #print "Document.get_new_file_name: old_dir =", old_dir, "old_name =", old_name ###
- new_file = request_new_file(
- #'Save "%s" as:' % self.title,
- default_dir = old_dir,
- default_name = old_name,
- file_type = self.file_type or application().save_file_type)
- if new_file is None:
- raise Cancel()
- self.file = new_file
-
- def read(self):
- """Read the document from its currently associated file. The
- document must be associated with a file and not have any existing
- contents when this is called."""
- if self.binary:
- mode = "rb"
- else:
- mode = "rU"
- file = self.file.open(mode)
- try:
- self.read_contents(file)
- finally:
- file.close()
- self.needs_saving = 0
-
- def write(self):
- """Write the document to its currently associated file. The
- document must be associated with a file when this is called.
- The document is initially written to a temporary file which
- is then renamed, so if writing fails part way through, the
- original file is undisturbed."""
- if self.binary:
- mode = "wb"
- else:
- mode = "w"
- dir_path = self.file.dir.path
- fd, temp_path = tempfile.mkstemp(dir = dir_path, text = not self.binary)
- file = os.fdopen(fd, mode)
- try:
- try:
- self.write_contents(file)
- finally:
- file.close()
- except EnvironmentError:
- os.unlink(fd)
- raise
- path = self.file.path
- try:
- os.unlink(path)
- except EnvironmentError:
- pass
- os.rename(temp_path, path)
- self.needs_saving = 0
-
- def setup_menus(self, m):
- #print "Document.setup_menus" ###
- if self._needs_saving or not self._file:
- m.save_cmd.enabled = 1
- if self._needs_saving and self._file:
- m.revert_cmd.enabled = 1
- m.save_as_cmd.enabled = 1
- m.page_setup_cmd.enabled = 1
-
- def next_handler(self):
- return application()
-
-export(Document)
diff --git a/PyGUI-2.5.3/GUI/Generic/Enumerations.py b/PyGUI-2.5.3/GUI/Generic/Enumerations.py
deleted file mode 100644
index 310168f..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Enumerations.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# PyGUI - Enumerated type facilities
-#
-
-class EnumMap(dict):
-
- def __init__(self, __name__, *args, **kwds):
- self.name = __name__
- dict.__init__(self, *args, **kwds)
-
- def __getitem__(self, key):
- try:
- return dict.__getitem__(self, key)
- except KeyError:
- raise ValueError("Invalid %s '%s', should be one of %s" %
- (self.name, key, ", ".join(["'%s'" % val for val in self.keys()])))
diff --git a/PyGUI-2.5.3/GUI/Generic/Exceptions.py b/PyGUI-2.5.3/GUI/Generic/Exceptions.py
deleted file mode 100644
index 470a80d..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Exceptions.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Exceptions.py - GUI exception classes
-#
-
-class Cancel(Exception):
- """Exception raised when user cancels an operation."""
- pass
-
-
-#class Quit(Exception):
-# """Exception raised to exit the main event loop."""
-# pass
-
-
-class Error(StandardError):
-
- def __init__(self, obj, mess):
- self.obj = obj
- self.mess = mess
- Exception.__init__(self, "%s: %s" % (obj, mess))
-
-
-class ApplicationError(StandardError):
- """Exception used for reporting errors to the user."""
-
- def __init__(self, message, detail = None):
- self.message = message
- self.detail = detail
- if detail:
- message = "%s\n\n%s" % (message, detail)
- StandardError.__init__(self, message)
-
-
-class InternalError(Exception):
- pass
-
-
-class UnimplementedMethod(NotImplementedError):
-
- def __init__(self, obj, meth_name):
- self.obj = obj
- StandardError.__init__(self, "%s.%s not implemented" % \
- (obj.__class__.__name__, meth_name))
-
-
-class ArgumentError(TypeError):
-
- def __init__(self, obj, meth_name, arg_name, value):
- self.obj = obj
- self.meth_name = meth_name
- self.arg_name = arg_name
- self.value = value
- TypeError.__init__(self,
- "%s: Invalid value %s for argument %s of method %s",
- (obj, value, arg_name, meth_name))
-
-
-class SetAttributeError(AttributeError):
-
- def __init__(self, obj, attr):
- self.obj = obj
- self.attr = attr
- AttributeError.__init__(self, "Attribute '%s' of %s cannot be set" % (attr, obj))
-
-
-class UsageError(StandardError):
- pass
diff --git a/PyGUI-2.5.3/GUI/Generic/FileDialogs.py b/PyGUI-2.5.3/GUI/Generic/FileDialogs.py
deleted file mode 100644
index ced310a..0000000
--- a/PyGUI-2.5.3/GUI/Generic/FileDialogs.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - File selection dialogs - Generic
-#
-
-from GUI.BaseFileDialogs import _request_old, _request_new
-
-
-def request_old_file(prompt = "Open File", default_dir = None, file_types = None):
- """Present a dialog for selecting an existing file.
- Returns a FileRef, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types,
- dir = False, multiple = False)
-
-
-def request_old_files(prompt = "Choose Files", default_dir = None, file_types = None):
- """Present a dialog for selecting a set of existing files.
- Returns a list of FileRefs, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types,
- dir = False, multiple = True)
-
-
-def request_old_directory(prompt = "Choose Folder", default_dir = None):
- """Present a dialog for selecting an existing directory.
- Returns a FileRef, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types = None,
- dir = True, multiple = False)
-
-
-def request_old_directories(prompt = "Choose Folders", default_dir = None,
- multiple = False):
- """Present a dialog for selecting a set of existing directories.
- Returns a list of FileRefs, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types = None,
- dir = True, multiple = True)
-
-
-def request_new_file(prompt = "Save As:", default_dir = None,
- default_name = "", file_type = None):
- """Present a dialog requesting a name and location for a new file.
- Returns a FileRef, or None if cancelled."""
-
- return _request_new(prompt, default_dir, default_name, file_type,
- dir = False)
-
-
-def request_new_directory(prompt = "Create Folder:", default_dir = None,
- default_name = ""):
- """Present a dialog requesting a name and location for a new directory.
- Returns a FileRef, or None if cancelled."""
-
- return _request_new(prompt, default_dir, default_name, file_type = None,
- dir = True)
diff --git a/PyGUI-2.5.3/GUI/Generic/GAlertClasses.py b/PyGUI-2.5.3/GUI/Generic/GAlertClasses.py
deleted file mode 100644
index d8eba49..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GAlertClasses.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Python GUI - Alerts - Generic
-#
-
-from GUI import BaseAlert
-from GUI import Button
-from GUI.StdButtons import DefaultButton, CancelButton
-
-
-class Alert(BaseAlert):
-
- def __init__(self, kind, prompt,
- ok_label = "OK", default = 1, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [ok_label], default = default, **kwds)
-
- def _create_buttons(self, ok_label):
- self.yes_button = DefaultButton(title = ok_label, action = self.yes)
- #self.default_button = self.ok_button
-
- def _layout_buttons(self):
- self.place(self.yes_button,
- right = self.label.right,
- top = self.label + self._label_button_spacing)
-
-
-class Alert2(BaseAlert):
-
- def __init__(self, kind, prompt,
- yes_label = "Yes", no_label = "No",
- default = 1, cancel = 0, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [yes_label, no_label],
- default = default, cancel = cancel, **kwds)
-
- def _create_buttons(self, yes_label, no_label):
- self.yes_button = DefaultButton(title = yes_label, action = self.yes)
- self.no_button = CancelButton(title = no_label, action = self.no)
-
- def _layout_buttons(self):
- self.place_row([self.no_button, self.yes_button],
- right = self.label.right,
- top = self.label + self._label_button_spacing)
-
-
-class Alert3(BaseAlert):
-
- _minimum_width = 300
-
- def __init__(self, kind, prompt,
- yes_label = "Yes", no_label = "No", other_label = "Cancel",
- default = 1, cancel = -1, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [yes_label, no_label, other_label],
- default = default, cancel = cancel, **kwds)
-
- def _create_buttons(self, yes_label, no_label, cancel_label):
- self.yes_button = DefaultButton(title = yes_label, action = self.yes)
- self.no_button = CancelButton(title = no_label, action = self.no)
- self.other_button = Button(title = cancel_label, action = self.other)
-
- def _layout_buttons(self):
- self.place_row([self.other_button, self.yes_button],
- right = self.label.right,
- top = self.label + self._label_button_spacing)
- self.place(self.no_button,
- left = self._left_margin, top = self.label + self._label_button_spacing)
diff --git a/PyGUI-2.5.3/GUI/Generic/GApplications.py b/PyGUI-2.5.3/GUI/Generic/GApplications.py
deleted file mode 100644
index fa7b2d6..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GApplications.py
+++ /dev/null
@@ -1,547 +0,0 @@
-#
-# Python GUI - Application class - Generic
-#
-
-import os, sys, traceback
-from GUI import Globals
-from GUI.Properties import Properties, overridable_property
-from GUI import MessageHandler
-from GUI.Exceptions import Cancel, UnimplementedMethod, UsageError, \
- ApplicationError #, Quit
-from GUI.StdMenus import basic_menus
-from GUI.GMenus import MenuState
-from GUI.Files import FileRef
-from GUI.Printing import PageSetup, present_page_setup_dialog
-
-class Application(Properties, MessageHandler):
- """The user should create exactly one Application object,
- or subclass thereof. It implements the main event loop
- and other application-wide behaviour."""
-
- _windows = None # List of all existing Windows
- _documents = None # List of all existing Documents
- _menus = None # Menus to appear in all Windows
- _clipboard = None
- _save_file_type = None
- _exit_event_loop_flag = False
- _last_directory = None
-
- windows = overridable_property('windows',
- """A list of all existing Windows.""")
-
- documents = overridable_property('documents',
- """A list of all existing documents.""")
-
- menus = overridable_property('menus',
- """A list of Menus that are to be available from all Windows.""")
-
- open_file_types = overridable_property('open_file_types',
- """List of FileTypes openable by the default Open... command.""")
-
- save_file_type = overridable_property('save_file_type',
- """Default FileType for Documents that do not specify their own.""")
-
- file_type = overridable_property('file_type',
- """Write only. Sets open_file_types and save_file_type.""")
-
- target = overridable_property('target',
- """Current target for key events and menu messages.""")
-
- target_window = overridable_property('target_window',
- """Window containing the current target, or None if there are no windows.""")
-
- page_setup = overridable_property('page_setup',
- """Default PageSetup instance.""")
-
- def __init__(self, title = None):
- if Globals._application is not None:
- raise UsageError("More than one Application instance created")
- if title:
- Globals.application_name = title
- self._open_file_types = []
- self._windows = []
- self._documents = []
- self._update_list = []
- self._idle_tasks = []
- self._page_setup = None
- Globals._application = self
- self._quit_flag = False
-
- def destroy(self):
- Globals._application = None
-
- #
- # Constants
- #
-
-# def get_std_menus(self):
-# """Returns a list of Menus containing the standard
-# framework-defined menu commands in their standard
-# positions."""
-# return basic_menus()
-#
-# std_menus = property(get_std_menus)
-
- #
- # Properties
- #
-
- def get_windows(self):
- return self._windows
-
- def get_documents(self):
- return self._documents
-
- def get_menus(self):
- menus = self._menus
- if menus is None:
- menus = []
- return menus
-
- def set_menus(self, menus):
- self._menus = menus
-
- def get_open_file_types(self):
- return self._open_file_types
-
- def set_open_file_types(self, x):
- self._open_file_types = x
-
- def get_save_file_type(self):
- return self._save_file_type
-
- def set_save_file_type(self, x):
- self._save_file_type = x
-
- def set_file_type(self, x):
- self._open_file_types = [x]
- self._save_file_type = x
-
- def get_page_setup(self):
- # This property is initialised lazily, because on Windows it turn out
- # that calling PageSetupDlg() before the application's first window is
- # created causes the app not to be brought to the foreground initially.
- ps = self._page_setup
- if not ps:
- ps = PageSetup()
- self._page_setup = ps
- return ps
-
- def set_page_setup(self, x):
- self._page_setup = x
-
- #
- # Event loop
- #
-
- def run(self):
- """The main event loop. Runs until _quit() is called, or
- KeyboardInterrupt or SystemExit is raised."""
- # Implementations may override this together with _quit() to use
- # a different means of causing the main event loop to exit.
- self.process_args(sys.argv[1:])
- if self._menus is None:
- self.menus = basic_menus()
- while not self._quit_flag:
- try:
- self.event_loop()
- #except (KeyboardInterrupt, Quit), e:
- except KeyboardInterrupt:
- return
- except SystemExit:
- raise
- except:
- self.report_error()
-
- def _quit(self):
- # Causes the main event loop to exit.
- self._quit_flag = True
- self._exit_event_loop()
-
- def event_loop(self):
- """Loop reading and handling events until exit_event_loop() is called."""
- # Implementations may override this together with exit_event_loop() to
- # implement non-modal event loops in a different way.
- self._event_loop(None)
-
- def _event_loop(self, modal_window):
- # Generic modal and non-modal event loop.
- # Loop reading and handling events for the given window, or for all
- # windows if window is None, until exit_event_loop() is called.
- # Enabled application-wide menu items should be selectable in any case.
- # If an exception other than Cancel is raised, it should either be
- # reported using report_error() or propagated. Implementations may
- # override this together with _exit_event_loop() if handling events
- # individually is not desirable.
- save = self._exit_event_loop_flag
- self._exit_event_loop_flag = False
- try:
- while not self._exit_event_loop_flag:
- try:
- self.handle_next_event(modal_window)
- except Cancel:
- pass
- finally:
- self._exit_event_loop_flag = save
-
- def exit_event_loop(self):
- """Cause the current call to event_loop() or modal_event_loop()
- to exit."""
- self._exit_event_loop()
-
- def _exit_event_loop(self):
- # Exit the generic _event_loop implementation.
- self._exit_event_loop_flag = True
-
-# def event_loop_until(self, exit):
-# """Loop reading and handling events until exit() returns
-# true, _quit_flag is set or an exception other than Cancel
-# is raised."""
-# while not exit() and not self._quit_flag:
-# try:
-# self.handle_next_event()
-# except Cancel:
-# pass
-
-# def handle_events(self):
-# """Handle events until an exception occurs. Waits for at least one event;
-# may handle more, at the discretion of the implementation."""
-# self.handle_next_event()
-
- def handle_next_event(self, modal_window):
- # Wait for the next event to arrive and handle it. Transparently handles
- # any internal events such as window updates, etc., and executes any idle
- # tasks that become due while waiting for an event. If modal_window is
- # not None, restrict interaction to that window (but allow use of enabled
- # application-wide menu items).
- #
- # This only needs to be implemented if the generic _event_loop() is being
- # used.
- raise UnimplementedMethod(self, "handle_next_event")
-
- #
- # Menu commands
- #
-
- def setup_menus(self, m):
- m.new_cmd.enabled = 1
- m.open_cmd.enabled = 1
- m.page_setup_cmd.enabled = 1
- m.quit_cmd.enabled = 1
-
- def new_cmd(self):
- "Handle the New menu command."
- doc = self.make_new_document()
- if not doc:
- raise UsageError(
- "Application.make_document(None) did not return a Document.")
- doc.new_contents()
- self.make_window(doc)
-
- def open_cmd(self):
- "Handle the Open... menu command."
- from FileDialogs import request_old_file
- dir = self.get_default_open_directory()
- fileref = request_old_file(default_dir = dir,
- file_types = self._open_file_types)
- if fileref:
- self.open_fileref(fileref)
- else:
- raise Cancel
-
- def get_default_open_directory(self):
- """Called by the default implementation of open_cmd() to find an initial
- directory for request_old_file(). Should return a DirRef or FileRef, or
- None if there is no preferred location. By default it returns the last
- directory in which a document was opened or saved during this session,
- if any."""
- return self._last_directory
-
- def page_setup_cmd(self):
- present_page_setup_dialog(self.page_setup)
-
- def quit_cmd(self):
- """Handle the Quit menu command."""
- while self._documents:
- self._documents[0].close_cmd()
- windows = self._windows
- while windows:
- window = windows[-1]
- window.destroy()
- assert not (windows and windows[-1] is window), \
- "%r failed to remove itself from application on destruction" % window
- self._quit()
-
- #
- # Opening files
- #
-
- def process_args(self, args):
- """Process command line arguments. Called by run() when the application
- is starting up."""
- if not args:
- self.open_app()
- else:
- for arg in args:
- if os.path.exists(arg):
- arg = os.path.abspath(arg)
- self.open_path(arg)
-
- def open_app(self):
- """Called by run() when the application is opened with no arguments."""
- pass
-
- def open_path(self, path):
- """Open document specified by a pathname. Called for each command line
- argument when the application is starting up."""
- self.open_fileref(FileRef(path = path))
-
- def open_fileref(self, fileref):
- """Open document specified by a FileRef."""
- doc = self.make_file_document(fileref)
- if not doc:
- raise ApplicationError("The file '%s' is not recognised by %s." % (
- fileref.name, Globals.application_name))
- doc.set_file(fileref)
- try:
- doc.read()
- except EnvironmentError, e:
- raise ApplicationError("Unable to open '%s'." % fileref.name, e)
- self.make_window(doc)
-
- #
- # Message dispatching
- #
-
-# def dispatch(self, message, *args):
-# target_window = self._find_target_window()
-# if target_window:
-# target_window.dispatch(message, *args)
-# else:
-# self.handle(message, *args)
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
- def dispatch_menu_command(self, command):
- if isinstance(command, tuple):
- name, index = command
- self.dispatch(name, index)
- else:
- self.dispatch(command)
-
- def get_target(self):
- # Implementations may override this to locate the target in a
- # different way if they choose not to implement the Window.target
- # property. Should return self if no other target can be found.
- window = self.target_window
- if window:
- return window.target
- else:
- return self
-
- def get_target_window(self):
- """Return the window to which messages should be dispatched, or None."""
- raise NotImplementedError
-
- #
- # Abstract
- #
-
- def make_new_document(self):
- """Create a new Document object of the appropriate
- class in response to a New command."""
- return self.make_document(None)
-
- def make_file_document(self, fileref):
- """Create a new Document object of the appropriate
- class for the given FileRef."""
- return self.make_document(fileref)
-
- def make_document(self, fileref):
- """Should create a new Document object of the appropriate
- class for the given FileRef, or if FileRef is None, a new
- empty Document of the appropriate class for the New command."""
- return None
-
- def make_window(self, document):
- """Should create a Window set up appropriately for viewing
- the given Document."""
- raise UnimplementedMethod(self, 'make_window')
-
- #
- # Clipboard
- #
-
- def query_clipboard(self):
- "Tests whether the clipboard contains any data."
- return not not self._clipboard
-
- def get_clipboard(self):
- return self._clipboard
-
- def set_clipboard(self, x):
- self._clipboard = x
-
- #
- # Window list management
- #
-
- def _add_window(self, window):
- if window not in self._windows:
- self._windows.append(window)
-
- def _remove_window(self, window):
- if window in self._windows:
- self._windows.remove(window)
-
- #
- # Document list management
- #
-
- def _add_document(self, doc):
- if doc not in self._documents:
- self._documents.append(doc)
-
- def _remove_document(self, doc):
- if doc in self._documents:
- self._documents.remove(doc)
-
- #
- # Exception reporting
- #
-
- def report_error(self):
- """Display an appropriate error message for the most recent
- exception caught."""
- try:
- raise
- except Cancel:
- pass
- except ApplicationError, e:
- from GUI.Alerts import stop_alert
- stop_alert(str(e))
- except:
- self.report_exception()
-
- def report_exception(self):
- """Display an alert box describing the most recent exception, and
- giving the options Continue, Traceback or Abort. Traceback displays
- a traceback and continues; Abort raises SystemExit."""
- try:
- exc_type, exc_val, exc_tb = sys.exc_info()
- exc_desc = "%s: %s" % (exc_type.__name__, exc_val)
- self.print_traceback(exc_desc, exc_tb)
- from GUI.Alerts import alert3
- message = "Sorry, something went wrong."
- result = alert3('stop', "%s\n\n%s" % (message, exc_desc),
- "Continue", "Abort", "Traceback",
- default = 1, cancel = None, width = 450, lines = 5)
- if result == 1: # Continue
- return
- elif result == -1: # Traceback
- self.display_traceback(exc_desc, exc_tb)
- return
- else: # Abort
- raise SystemExit
- except (KeyboardInterrupt, SystemExit):
- os._exit(1)
- except:
- print >>sys.stderr, "---------- Exception while reporting exception ----------"
- traceback.print_exc()
- print >>sys.stderr, "------------------ Original exception -------------------"
- traceback.print_exception(exc_type, exc_val, exc_tb)
- #os._exit(1)
-
- def display_traceback(self, exc_desc, exc_tb):
- """Display an exception description and traceback.
- TODO: display this in a scrolling window."""
- self.print_traceback(exc_desc, exc_tb)
-
- def print_traceback(self, exc_desc, exc_tb):
- """Print exception description and traceback to standard error."""
- import traceback
- sys.stderr.write("\nTraceback (most recent call last):\n")
- traceback.print_tb(exc_tb)
- sys.stderr.write("%s\n\n" % exc_desc)
-
- #
- # Other
- #
-
- def zero_windows_allowed(self):
- """Platforms should implement this to return false if there
- must be at least one window open at all times. Returning false
- here forces the Quit command to be used instead of Close when
- there is only one window open."""
- # TODO: Move this somewhere more global.
- raise UnimplementedMethod(self, 'zero_windows_allowed')
-
- def _perform_menu_setup(self, menus = None):
- """Given a list of Menu objects, perform menu setup processing
- and update associated platform menus ready for popping up or
- pulling down."""
- if menus is None:
- menus = self._effective_menus()
- menu_state = MenuState(menus)
- menu_state.reset()
- self._dispatch_menu_setup(menu_state)
- for menu in menus:
- menu._update_platform_menu()
-
- def _dispatch_menu_setup(self, menu_state):
- self.dispatch('_setup_menus', menu_state)
-
- def _effective_menus(self):
- """Return a list of the menus in effect for the currently active
- window, including both application-wide and window-specific menus,
- in an appropriate order according to platform conventions."""
- window = self.target_window
- return self._effective_menus_for_window(window)
-
- def _effective_menus_for_window(self, window):
- """Return a list of the menus in effect for the specified
- window, including both application-wide and window-specific menus,
- in an appropriate order according to platform conventions."""
- menus = self.menus
- if window:
- menus = menus + window.menus
- regular_menus = []
- special_menus = []
- for menu in menus:
- if menu.special:
- special_menus.insert(0, menu)
- else:
- regular_menus.append(menu)
- return regular_menus + special_menus
-
-# def _may_close_a_window(self):
-# # On implementations where at least one window is needed in order to
-# # interact with the application, check whether closing a window would
-# # leave no more visible windows.
-# if self.zero_windows_allowed():
-# return True
-# count = 0
-# for window in self.windows:
-# if window.visible:
-# count += 1
-# if count >= 2:
-# return True
-# return False
-
- def _check_for_no_windows(self):
- # On implementations where at least one window is needed in order to
- # interact with the application, check whether there are no more visible
- # windows and take appropriate action.
- if not self.zero_windows_allowed():
- for window in self.windows:
- if window.visible:
- return
- self.no_visible_windows()
-
- def no_visible_windows(self):
- """On platforms that require a window in order to interact with the
- application, this is called when there are no more visible windows.
- The default action is to close the application; subclasses may override
- it to take some other action, such as creating a new window."""
- self.quit_cmd()
diff --git a/PyGUI-2.5.3/GUI/Generic/GBaseAlerts.py b/PyGUI-2.5.3/GUI/Generic/GBaseAlerts.py
deleted file mode 100644
index 36840da..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GBaseAlerts.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#
-# Python GUI - Alert base class - Generic
-#
-
-import textwrap
-from GUI import ModalDialog
-from GUI import Label
-
-class BaseAlert(ModalDialog):
-
- _wrapwidth = 50
- _minimum_width = 200
- _left_margin = 24
- _right_margin = 24
- _top_margin = 14
- _bottom_margin = 20
- _icon_spacing = 16
- _label_button_spacing = 20
- _default_width = 380
- _default_lines = 3
-
- yes_button = None
- no_button = None
- other_button = None
-
- def __init__(self, kind, prompt, width = None, lines = None,
- button_labels = None, default = None, cancel = None):
- #if width is None:
- # width = self._default_width
- #if lines is None:
- # lines = self._default_lines
- ModalDialog.__init__(self, style = 'alert')
- self.label = Label(text = self._wrap(prompt), lines = lines)
- if self.label.width < self._minimum_width:
- self.label.width = self._minimum_width
- self._create_buttons(*button_labels)
- #self.default_button = self._find_button(default)
- #self.cancel_button = self._find_button(cancel)
- self._layout(kind)
-
- def _layout(self, kind):
- icon_width, icon_height = self._layout_icon(kind)
- label_left = self._left_margin
- if icon_width:
- label_left += icon_width + self._icon_spacing
- if self.label.height < icon_height:
- self.label.height = icon_height
- self.place(self.label,
- left = label_left,
- top = self._top_margin)# + icon_height/4)
- #_wrap_text(self.label, self._default_width - label_left - self._right_margin)
- self._layout_buttons()
- self.shrink_wrap(padding = (self._right_margin, self._bottom_margin))
-
- def _layout_icon(self, kind):
- # Place icon for the given alert kind, if any, and return its size.
- # If there is no icon, return (0, 0).
- return (0, 0)
-
- def _wrap(self, text):
- width = self._wrapwidth
- return "\n\n".join(
- [textwrap.fill(para, width)
- for para in text.split("\n\n")])
-
- def _find_button(self, value):
- #print "BaseAlert._find_button:", value ###
- if value == 1:
- result = self.yes_button
- elif value == 0:
- result = self.no_button
- elif value == -1:
- result = self.other_button
- else:
- result = None
- #print "BaseAlert._find_button: result =", result ###
- return result
-
- def yes(self):
- self.dismiss(1)
-
- def no(self):
- self.dismiss(0)
-
- def other(self):
- self.dismiss(-1)
-
-#def _wrap_text(label, label_width):
-# hard_lines = [text.split()
-# for text in label.text.split("\n")]
-# words = hard_lines[0]
-# for hard_line in hard_lines[1:]:
-# words.append("\n")
-# words.extend(hard_line)
-# font = label.font
-# space_width = font.width(" ")
-# lines = []
-# line = []
-# line_width = 0
-# for word in words:
-# word_width = font.width(word)
-# if word == "\n" or (line_width > 0
-# and line_width + space_width + word_width > label_width):
-# lines.append(line)
-# line = []
-# line_width = 0
-# if word <> "\n":
-# line.append(word)
-# if line_width > 0:
-# line_width += space_width
-# line_width += word_width
-# if line:
-# lines.append(line)
-# label.text = "\n".join([" ".join(line) for line in lines])
-
-
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GButtons.py b/PyGUI-2.5.3/GUI/Generic/GButtons.py
deleted file mode 100644
index 7b24bcd..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GButtons.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Buttons - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control
-
-class Button(Control, Action):
- """ A pushbutton control."""
-
- style = overridable_property('style',
- "One of 'normal', 'default', 'cancel'")
-
- def activate(self):
- """Highlight the button momentarily and then perform its action."""
- self.flash()
- self.do_action()
-
- def flash(self):
- """Highlight the button momentarily as though it had been clicked,
- without performing the action."""
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/GUI/Generic/GCanvasPaths.py b/PyGUI-2.5.3/GUI/Generic/GCanvasPaths.py
deleted file mode 100644
index 8055411..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GCanvasPaths.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Python GUI - Canvas Paths - Generic
-#
-
-class CanvasPaths:
- # Mixin class providing generic implementations of
- # canvas path construction operators.
-
- def __init__(self):
- self.newpath()
-
- def newpath(self):
- self._path = []
- self._current_subpath = None
- self._current_point = (0, 0)
-
- def moveto(self, x, y):
- self._current_subpath = None
- self._current_point = self._coords(x, y)
-
- def rmoveto(self, dx, dy):
- x, y = self._current_point
- self.moveto(x + dx, y + dy)
-
- def lineto(self, x, y):
- subpath = self._current_subpath
- if subpath is None:
- subpath = [self._current_point]
- self._path.append(subpath)
- self._current_subpath = subpath
- p = self._coords(x, y)
- subpath.append(p)
- self._current_point = p
-
- def rlineto(self, dx, dy):
- x, y = self._current_point
- self.lineto(x + dx, y + dy)
-
- def closepath(self):
- subpath = self._current_subpath
- if subpath:
- subpath.append(subpath[0])
- self._current_subpath = None
-
- def get_current_point(self):
- return self._current_point
-
- # Implementations may set _coords to one of the following
-
- def _int_coords(self, x, y):
- return int(round(x)), int(round(y))
-
- def _float_coords(self, x, y):
- return x, y
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GCanvases.py b/PyGUI-2.5.3/GUI/Generic/GCanvases.py
deleted file mode 100644
index a1dbab0..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GCanvases.py
+++ /dev/null
@@ -1,282 +0,0 @@
-#
-# Python GUI - Drawing - Generic
-#
-
-from GUI.StdColors import black, white
-from GUI.StdFonts import application_font
-from GUI.Properties import Properties, overridable_property
-
-class Canvas(Properties):
-
- _default_forecolor = black
- _default_backcolor = white
- _printing = False
-
- pencolor = overridable_property('pencolor', "Current color for stroking paths.")
- fillcolor = overridable_property('fillcolor', "Current color for filling paths.")
- textcolor = overridable_property('textcolor', "Current color for drawint text.")
- forecolor = overridable_property('forecolor', "Sets pen, fill and text colors to the same color.")
- backcolor = overridable_property('backcolor', "Current color for erasing regions.")
- pensize = overridable_property('pensize', "Width of pen for framing and stroking.")
- font = overridable_property('font', "Font for drawing text.")
- current_point = overridable_property('current_point', "The current point, or None.")
- printing = overridable_property('printing', "True if drawing destination is a non-display device.")
-
- #forecolor = overridable_property('forecolor', "Sets both pencolor and fillcolor.")
-
- def __init__(self):
- self.newpath()
-
- def get_printing(self):
- return self._printing
-
- def initgraphics(self):
- self.set_forecolor(self._default_forecolor)
- self.set_backcolor(self._default_backcolor)
- self.set_pensize(1)
- self.set_font(application_font)
-
- def set_forecolor(self, c):
- self.pencolor = c
- self.fillcolor = c
- self.textcolor = c
-
- def rmoveto(self, dx, dy):
- x0, y0 = self._current_point()
- self.moveto(x0 + dx, y0 + dy)
-
- def rlineto(self, dx, dy):
- x0, y0 = self.current_point
- self.lineto(x0 + dx, y0 + dy)
-
- def curve(self, sp, cp1, cp2, ep):
- self.moveto(sp)
- self.curveto(cp1, cp2, ep)
-
- def rcurveto(self, cp1, cp2, ep):
- x0, y0 = self.current_point
- x1, y1 = cp1
- x2, y2 = cp2
- x3, y3 = ep
- self.curveto(
- (x0 + x1, y0 + y1),
- (x0 + x2, y0 + y2),
- (x0 + x3, y0 + y3))
-
- def fill_stroke(self):
- self.fill()
- self.stroke()
-
- # Rectangles
-
- def _pen_inset_rect(self, rect):
- l, t, r, b = rect
- p = 0.5 * self.pensize
- return (l + p, t + p, r - p, b - p)
-
- def rect(self, rect):
- l, t, r, b = rect
- self.moveto(l, t)
- self.lineto(r, t)
- self.lineto(r, b)
- self.lineto(l, b)
- self.closepath()
-
- def rect_frame(self, rect):
- self.rect(self._pen_inset_rect(rect))
-
- def fill_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.fill()
-
- def stroke_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.stroke()
-
- def frame_rect(self, rect):
- self.newpath()
- self.rect_frame(rect)
- self.stroke()
-
- def fill_stroke_rect(self, rect):
- self.rect_path(rect)
- self.fill_stroke()
-
- def fill_frame_rect(self, rect):
- self.fill_rect(rect)
- self.frame_rect(rect)
-
- def erase_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.erase()
-
- # Ovals
-
- def oval_frame(self, rect):
- self.oval(self._pen_inset_rect(rect))
-
- def fill_oval(self, rect):
- self.newpath()
- self.oval_frame(rect)
- self.fill()
-
- def stroke_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.stroke()
-
- def frame_oval(self, rect):
- self.newpath()
- self.oval_frame(rect)
- self.stroke()
-
- def fill_stroke_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.fill_stroke()
-
- def fill_frame_oval(self, rect):
- self.fill_oval(rect)
- self.frame_oval()
-
- def erase_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.erase()
-
- # Arcs
-
- def _arc_path(self, c, r, a0, a1):
-# x, y = c
-# a0r = a0 * deg
-# x0 = x + r * cos(a0r)
-# y0 = y + r * sin(a0r)
- self.newpath()
-# self.moveto(x0, y0)
- self.arc(c, r, a0, a1)
-
- def _arc_frame_path(self, c, r, a0, a1):
- self._arc_path(c, r - 0.5 * self.pensize, a0, a1)
-
- def stroke_arc(self, c, r, a0, a1):
- self._arc_path(c, r, a0, a1)
- self.stroke()
-
- def frame_arc(self, c, r, a0, a1):
- self._arc_frame_path(c, r, a0, a1)
- self.stroke()
-
- # Wedges
-
- def wedge(self, c, r, a0, a1):
- self.moveto(*c)
- self.arc(c, r, a0, a1)
- self.closepath()
-
- def fill_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.fill()
-
- def stroke_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.stroke()
-
- def fill_stroke_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.fill_stroke()
-
- def erase_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.erase()
-
- # Polylines
-
- def lines(self, points):
- point_iter = iter(points)
- self.moveto(*point_iter.next())
- for p in point_iter:
- self.lineto(*p)
-
- def linesto(self, points):
- for p in points:
- self.lineto(*p)
-
- def stroke_lines(self, points):
- self.newpath()
- self.lines(points)
- self.stroke()
-
- # Polycurves
-
- def curves(self, points):
- self.moveto(*points[0])
- for i in xrange(1, len(points), 3):
- self.curveto(*points[i:i+3])
-
- def curvesto(self, points):
- for i in xrange(0, len(points), 3):
- self.curveto(*points[i:i+3])
-
- def stroke_curves(self, points):
- self.newpath()
- self.curves(points)
- self.stroke()
-
- # Polygons
-
- def poly(self, points):
- self.lines(points)
- self.closepath()
-
- def fill_poly(self, points):
- self.newpath()
- self.poly(points)
- self.fill()
-
- def stroke_poly(self, points):
- self.newpath()
- self.poly(points)
- self.stroke()
-
- def fill_stroke_poly(self, points):
- self.newpath()
- self.poly(points)
- self.fill_stroke()
-
- def erase_poly(self, points):
- self.newpath()
- self.poly(points)
- self.erase()
-
- # Loops
-
- def loop(self, points):
- self.curves(points)
- self.closepath()
-
- def fill_loop(self, points):
- self.newpath()
- self.loop(points)
- self.fill()
-
- def stroke_loop(self, points):
- self.newpath()
- self.loop(points)
- self.stroke()
-
- def fill_stroke_loop(self, points):
- self.newpath()
- self.loop(points)
- self.fill_stroke()
-
- def erase_loop(self, points):
- self.newpath()
- self.loop(points)
- self.erase()
diff --git a/PyGUI-2.5.3/GUI/Generic/GCheckBoxes.py b/PyGUI-2.5.3/GUI/Generic/GCheckBoxes.py
deleted file mode 100644
index 2860744..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GCheckBoxes.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Python GUI - Check boxes - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-from GUI.Actions import Action
-
-class CheckBox(Control, Action):
- """A CheckBox is a control used to represent a binary choice."""
-
- def __init__(self, **kwds):
- Control.__init__(self, **kwds)
-
- on = overridable_property('on', "Boolean value of the check box.")
-
- auto_toggle = overridable_property('auto_toggle', """If true,
- the check box's 'on' property will automatically be toggled
- before performing the action, if any.""")
-
- mixed = overridable_property('mixed', """If true, the check box
- is capable of displaying a mixed state.""")
-
- _auto_toggle = True
- _mixed = False
-
- def get_auto_toggle(self):
- return self._auto_toggle
-
- def set_auto_toggle(self, v):
- self._auto_toggle = v
-
- def get_mixed(self):
- return self._mixed
-
- def set_mixed(self, v):
- self._mixed = v
-
- def get_value(self):
- return self.on
-
- def set_value(self, x):
- self.on = x
diff --git a/PyGUI-2.5.3/GUI/Generic/GColors.py b/PyGUI-2.5.3/GUI/Generic/GColors.py
deleted file mode 100644
index 07799c9..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GColors.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Python GUI - Colors - Generic
-#
-
-from GUI.Properties import overridable_property
-
-class Color(object):
- """A drawing color.
-
- Constructors:
- rgb(red, green, blue, alpha = 1.0)
- where red, green, blue, alpha are in the range 0.0 to 1.0
-
- Properties:
- red --> float
- green --> float
- blue --> float
- rgb --> (red, green, blue)
- rgba --> (red, green, blue, alpha)
- """
-
- red = overridable_property('red', "Red component (0.0 to 1.0)")
- green = overridable_property('green', "Blue component (0.0 to 1.0)")
- blue = overridable_property('blue', "Blue component (0.0 to 1.0)")
- alpha = overridable_property('alpha', "Alpha (opacity) component")
- rgb = overridable_property('rgb', "Tuple of (red, green, blue) (0.0 to 1.0)")
- rgba = overridable_property('rgba',
- "Tuple of (red, green, blue, alpha) (0.0 to 1.0)")
-
- def get_alpha(self):
- return 1.0
-
- def get_rgb(self):
- return (self.red, self.green, self.blue)
-
- def set_rgb(self, x):
- self.red, self.green, self.blue = x
-
- def get_rgba(self):
- return (self.red, self.green, self.blue, self.alpha)
-
- def set_rgba(self, x):
- self.red, self.green, self.blue, self.alpha = x
-
- def __str__(self):
- return "Color(%g,%g,%g,%g)" % self.rgba
diff --git a/PyGUI-2.5.3/GUI/Generic/GComponents.py b/PyGUI-2.5.3/GUI/Generic/GComponents.py
deleted file mode 100644
index a516955..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GComponents.py
+++ /dev/null
@@ -1,477 +0,0 @@
-#
-# Python GUI - Components - Generic
-#
-
-import os
-from GUI.Properties import Properties, overridable_property
-from GUI import MessageHandler
-from GUI.Geometry import add_pt, sub_pt, rect_size, rect_sized, rect_topleft
-from GUI import application
-
-_user_tab_stop = os.environ.get("PYGUI_KEYBOARD_NAVIGATION") or None
-# Allow "False", "True", "0", "1"
-if _user_tab_stop is not None:
- _user_tab_stop = _user_tab_stop.strip().capitalize()
- try:
- _user_tab_stop = {"False": False, "True": True}[_user_tab_stop]
- except KeyError:
- try:
- _user_tab_stop = int(_user_tab_stop)
- except ValueError:
- sys.stderr.write("PYGUI_KEYBOARD_NAVIGATION: Unrecognized value %r"
- % _user_tab_stop)
- _user_tab_stop = None
-
-class Component(Properties, MessageHandler):
- """Component is an abstract class representing a user
- interface component."""
-
- left = overridable_property('left', "Position of left edge relative to container.")
- top = overridable_property('top', "Position of top edge relative to container.")
- right = overridable_property('right', "Position of right edge relative to container.")
- bottom = overridable_property('bottom', "Position of bottom edge relative to container.")
-
- x = overridable_property('x', "Horizontal position relative to container.")
- y = overridable_property('y', "Vertical position relative to container.")
- width = overridable_property('width')
- height = overridable_property('height')
-
- position = overridable_property('position', "Position relative to container.")
- size = overridable_property('size')
-
- bounds = overridable_property('bounds', "Bounding rectangle in container's coordinates.")
-
- container = overridable_property('container',
- "Container which contains this Component. Setting this property has the "
- "effect of removing the component from its previous container, if any, "
- "and adding it to the new one, if any.")
-
-# visible = overridable_property('visible',
-# "Whether the component is currently shown.")
-
- tab_stop = overridable_property('tab_stop',
- "Whether tab key can navigate into this control.")
-
- anchor = overridable_property('anchor', "A string of 'ltrb' controlling behaviour when container is resized.")
-
- border = overridable_property('border', "True if the component should have a border.")
-
- _is_scrollable = False # Overridden by scrollable subclasses
- _generic_tabbing = True # Whether to use generic tab navigation code
- _default_tab_stop = False
- _user_tab_stop_override = False # Whether user preference overrides _default_tab_stop
- _tab_stop = None
-
- #
- # Class variables defined by implementations:
- #
- # _has_local_coords bool True if component has a local coordinate system
- #
-
- _container = None
- _border = False
- hmove = 0
- vmove = 0
- hstretch = 0
- vstretch = 0
-
- def __init__(self, tab_stop = None, **kwds):
- Properties.__init__(self, **kwds)
- if tab_stop is None:
- tab_stop = self._get_default_tab_stop()
- self.tab_stop = tab_stop
-
- def destroy(self):
- self.container = None
-
- #
- # Geometry properties
- #
- # Default implementations of position and size properties
- # in terms of the bounds property. A minimal implementation
- # need only implement get_bounds and set_bounds.
- #
- # It is the implementation's responsibility to call _resized()
- # whenever the size of the component changes, either by
- # explicit assignment to geometry properties or by the user
- # resizing the containing window. It should not be called if
- # setting a geometry property does not cause the size to change.
- #
-
- def get_left(self):
- return self.position[0]
-
- def set_left(self, v):
- l, t, r, b = self.bounds
- self.bounds = (v, t, r, b)
-
- def get_top(self):
- return self.bounds[1]
-
- def set_top(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, v, r, b)
-
- def get_right(self):
- return self.bounds[2]
-
- def set_right(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, v, b)
-
- def get_bottom(self):
- return self.bounds[3]
-
- def set_bottom(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, r, v)
-
- def get_x(self):
- return self.bounds[0]
-
- def set_x(self, v):
- l, t, r, b = self.bounds
- self.bounds = (v, t, v + r - l, b)
-
- def get_y(self):
- return self.bounds[1]
-
- def set_y(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, v, r, v + b - t)
-
- def get_position(self):
- l, t, r, b = self.bounds
- return (l, t)
-
- def set_position(self, (x, y)):
- l, t, r, b = self.bounds
- self.bounds = (x, y, x + r - l, y + b - t)
-
- def get_width(self):
- l, t, r, b = self.bounds
- return r - l
-
- def set_width(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, l + v, b)
-
- def get_height(self):
- l, t, r, b = self.bounds
- return b - t
-
- def set_height(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, r, t + v)
-
- def get_size(self):
- l, t, r, b = self.bounds
- return (r - l, b - t)
-
- def set_size(self, (w, h)):
- l, t, r, b = self.bounds
- self.bounds = (l, t, l + w, t + h)
-
- #
- # Container management
- #
-
- def get_container(self):
- return self._container
-
- def set_container(self, new_container):
- if self._container != new_container:
- self._change_container(new_container)
-
- def _change_container(self, new_container):
- old_container = self._container
- if old_container:
- self._container = None
- old_container._remove(self)
- if new_container:
- self._container = new_container
- new_container._add(self)
-
- #
- # Message dispatching
- #
-
- def become_target(self):
- """Arrange for this object to be the first to handle messages
- dispatched to the containing Window. If the component is not
- contained in a Window, the effect is undefined."""
- raise NotImplementedError
-
- def is_target(self):
- """Return true if this is the current target within the containing
- Window. If the component is not contained in a Window, the result
- is undefined."""
- return self.window and self.window.target is self
-
- #
- # Message handling
- #
-
- def next_handler(self):
- return self._container
-
- #
- # Visibility control
- #
-
-# def show(self):
-# """Make the Component visible (provided its container is visible)."""
-# self.visible = 1
-#
-# def hide(self):
-# """Make the Component invisible."""
-# self.visible = 0
-
- #
- # Border
- #
-
- def get_border(self):
- return self._border
-
- def set_border(self, x):
- self._border = x
-
- #
- # Resizing
- #
-
- def get_anchor(self):
- if self.hmove:
- s1 = 'r'
- elif self.hstretch:
- s1 = 'lr'
- else:
- s1 = 'l'
- if self.vmove:
- s2 = 'b'
- elif self.vstretch:
- s2 = 'tb'
- else:
- s2 = 't'
- return s1 + s2
-
- def set_anchor(self, s):
- if 'r' in s:
- if 'l' in s:
- self.hstretch = True
- self.hmove = False
- else:
- self.hstretch = False
- self.hmove = True
- else:
- self.hstretch = False
- self.hmove = False
- if 'b' in s:
- if 't' in s:
- self.vstretch = True
- self.vmove = False
- else:
- self.vstretch = False
- self.vmove = True
- else:
- self.vstretch = False
- self.vmove = False
-
- def get_auto_layout(self):
- return self._auto_layout
-
- def set_auto_layout(self, x):
- self._auto_layout = x
-
- def _resized(self, delta):
- # Called whenever the size of the component changes for
- # any reason.
- pass
-
- def container_resized(self, delta):
- """Called whenever the component's container changes size and the
- container's auto_layout property is true. The default implementation
- repositions and resizes this component according to its resizing
- options."""
- dw, dh = delta
- left, top, right, bottom = self.bounds
- if self.hmove:
- left += dw
- right += dw
- elif self.hstretch:
- right += dw
- if self.vmove:
- top += dh
- bottom += dh
- elif self.vstretch:
- bottom += dh
- self.bounds = (left, top, right, bottom)
-
- #
- # Update region maintenance
- #
-
- def invalidate(self):
- """Mark the whole Component as needing to be redrawn."""
- self.invalidate_rect(self.viewed_rect())
-
-# def invalidate_rect(self, r):
-# print "GComponent.invalidate_rect:", self, r ###
-# container = self._container
-# if container:
-# container.invalidate_rect(r)
-
-# def _invalidate_in_container(self):
-# container = self._container
-# if container:
-# container._invalidate_subcomponent(self)
-
- #
- # Coordinate transformation
- #
-
- def local_to_global(self, p):
- p = self.local_to_container(p)
- parent = self._container
- if parent:
- return parent.local_to_global(p)
- else:
- return p
-
- def global_to_local(self, p):
- parent = self._container
- if parent:
- p = parent.global_to_local(p)
- return self.container_to_local(p)
-
- def local_to_container(self, p):
- if self._has_local_coords:
- return add_pt(p, self.local_to_container_offset())
- else:
- return p
-
- def container_to_local(self, p):
- if self._has_local_coords:
- return sub_pt(p, self.local_to_container_offset())
- else:
- return p
-
- def local_to_container_offset(self):
- if self._has_local_coords:
- return self.position
- else:
- return (0, 0)
-
- def transform_from(self, other, p):
- return transform_coords(other, self, p)
-
- def transform_to(self, other, p):
- return transform_coords(self, other, p)
-
- #
- # Placement specification support
- #
-
- def __add__(self, offset):
- return (self, offset)
-
- def __sub__(self, offset):
- return (self, -offset)
-
- #
- # Tabbing
- #
-
-# def get_tabbable(self):
-# return self._tabbable
-#
-# def set_tabbable(self, value):
-# if self._tabbable <> value:
-# self._tabbable = value
-# self._invalidate_tab_chain()
-
- def get_tab_stop(self):
- return self._tab_stop
-
- def set_tab_stop(self, x):
- if self._tab_stop <> x:
- self._tab_stop = x
- self._invalidate_tab_chain()
-
- def _get_default_tab_stop(self):
- if self._user_tab_stop_override:
- result = _user_tab_stop
- else:
- result = None
- if result is None:
- result = self._default_tab_stop
- return result
-
- def _tab_out(self):
- pass
-
- def _tab_in(self):
- self.become_target()
-
- def _build_tab_chain(self, chain):
- if self._tab_stop:
- chain.append(self)
-
- def _invalidate_tab_chain(self):
- window = self.window
- if window:
- window._invalidate_tab_chain()
-
- def _is_targetable(self):
- return True
-
- #
- # Other
- #
-
- window = overridable_property('window', """The Window ultimately containing
- this Component, or None.""")
-
- def get_window(self):
- container = self._container
- if container:
- return container.window
- else:
- return None
-
- def reset_blink(self):
- application().reset_blink()
-
- def viewed_rect(self):
- """Returns the rectangle in local coordinates that is
- currently visible within the component."""
- if self._has_local_coords:
- width, height = self.size
- return (0, 0, width, height)
- else:
- return self.bounds
-
- def broadcast(self, message, *args):
- """Traverse the component hierarchy, calling each component's handler for
- the given message, if any."""
- method = getattr(self, message, None)
- if method:
- method(*args)
-
- def _dispatch_mouse_event(self, event):
- self._handle_mouse_event(event)
-
- def _handle_mouse_event(self, event):
- self.handle(event.kind, event)
-
-
-def transform_coords(from_component, to_component, p):
- if from_component:
- g = from_component.local_to_global(p)
- else:
- g = p
- if to_component:
- return to_component.global_to_local(g)
- else:
- return g
diff --git a/PyGUI-2.5.3/GUI/Generic/GContainers.py b/PyGUI-2.5.3/GUI/Generic/GContainers.py
deleted file mode 100644
index fb6714f..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GContainers.py
+++ /dev/null
@@ -1,382 +0,0 @@
-#
-# Python GUI - Containers - Generic
-#
-
-try:
- maketrans = str.maketrans
-except AttributeError:
- from string import maketrans
-from GUI.Properties import overridable_property
-from GUI.Exceptions import ArgumentError
-from GUI.Geometry import pt_in_rect
-from GUI import Component
-
-anchor_to_sticky = maketrans("ltrb", "wnes")
-
-class Container(Component):
- """A Container is a Component that can contain other Components.
- The sub-components are clipped to the boundary of their container."""
-
- contents = overridable_property('contents',
- "List of subcomponents. Do not modify directly.")
-
- content_width = overridable_property('content_width', "Width of the content area.")
- content_height = overridable_property('content_height', "Height of the content area.")
- content_size = overridable_property('content_size', "Size of the content area.")
-
- auto_layout = overridable_property('auto_layout',
- "Automatically adjust layout of subcomponents when resized.")
-
- _auto_layout = True
-
- # _contents [Component]
-
- def __init__(self, **kw):
- self._contents = []
- Component.__init__(self, **kw)
-
- def destroy(self):
- """Destroy this Container and all of its contents."""
- contents = self._contents
- while contents:
- comp = contents[-1]
- comp.destroy()
- assert not contents or contents[-1] is not comp, \
- "%r failed to remove itself from container on destruction" % comp
- Component.destroy(self)
-
- #
- # Content area
- #
-
- def get_content_width(self):
- return self.content_size[0]
-
- def set_content_width(self, w):
- self.content_size = w, self.content_height
-
- def get_content_height(self):
- return self.content_size[1]
-
- def set_content_height(self, h):
- self.content_size = self.content_width, h
-
- get_content_size = Component.get_size
- set_content_size = Component.set_size
-
- #
- # Subcomponent Management
- #
-
- def get_contents(self):
- return self._contents
-
- def add(self, comp):
- """Add the given Component as a subcomponent."""
- if comp:
- if isinstance(comp, Component):
- comp.container = self
- else:
- for item in comp:
- self.add(item)
-
- def remove(self, comp):
- """Remove subcomponent, if present."""
- if isinstance(comp, Component):
- if comp in self._contents:
- comp.container = None
- else:
- for item in comp:
- self.remove(item)
-
- def _add(self, comp):
- # Called by comp.set_container() to implement subcomponent addition.
- self._contents.append(comp)
- self._invalidate_tab_chain()
- self.added(comp)
-
- def _remove(self, comp):
- # Called by comp.set_container() to implement subcomponent removal.
- self._contents.remove(comp)
- self._invalidate_tab_chain()
- self.removed(comp)
-
- def added(self, comp):
- """Called after a subcomponent has been added."""
- pass
-
- def removed(self, comp):
- """Called after a subcomponent has been removed."""
- pass
-
- #
- # The infamous 'place' method and friends.
- #
-
- _place_default_spacing = 8
-
- def place(self, item,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, anchor = None):
- """Add a component to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- self._place([item], left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border, anchor = anchor)
-
- def place_row(self, items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, spacing = None,
- anchor = None):
- """Add a row of components to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- if left is not None and right is not None:
- raise ValueError("Cannot specify both left and right to place_row")
- elif left is None and right is not None:
- direction = 'left'
- items = items[:]
- items.reverse()
- else:
- direction = 'right'
- self._place(items, left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border,
- direction = direction, spacing = spacing, anchor = anchor)
-
- def place_column(self, items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, spacing = None,
- anchor = None):
- """Add a column of components to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- if top is not None and bottom is not None:
- raise ValueError("Cannot specify both top and bottom to place_column")
- elif top is None and bottom is not None:
- direction = 'up'
- items = items[:]
- items.reverse()
- else:
- direction = 'down'
- self._place(items, left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border,
- direction = direction, spacing = spacing, anchor = anchor)
-
- def _place(self, items,
- left = None,
- right = None,
- top = None,
- bottom = None,
- sticky = 'nw',
- scrolling = '',
- direction = 'right',
- spacing = None,
- border = None,
- anchor = None):
-
- def side(spec, name):
- # Process a side specification taking the form of either
- # (1) an offset, (2) a reference component, or (3) a
- # tuple (component, offset). Returns a tuple (ref, offset)
- # where ref is the reference component or None (representing
- # the Frame being placed into). Checks that the reference
- # component, if any, is directly contained by this Frame.
- ref = None
- offset = None
- if spec is not None:
- if isinstance(spec, tuple):
- ref, offset = spec
- elif isinstance(spec, Component):
- ref = spec
- offset = 0
- elif isinstance(spec, (int, float)):
- offset = spec
- else:
- raise ArgumentError(self, 'place', name, spec)
- if ref is self:
- ref = None
- elif ref:
- con = ref.container
- #if con is not self and isinstance(con, ScrollFrame):
- # ref = con
- # con = ref.container
- if con is not self:
- raise ValueError("Reference component for place() is not"
- " directly contained by the frame being placed into.")
- return ref, offset
-
- if spacing is None:
- spacing = self._place_default_spacing
-
- # Decode the sticky options
- if anchor is not None:
- sticky = anchor.translate(anchor_to_sticky)
- hmove = vmove = hstretch = vstretch = 0
- if 'e' in sticky:
- if 'w' in sticky:
- hstretch = 1
- else:
- hmove = 1
- if 's' in sticky:
- if 'n' in sticky:
- vstretch = 1
- else:
- vmove = 1
-
- # Translate the direction argument
- try:
- dir = {'right':0, 'down':1, 'left':2, 'up':3}[direction]
- except KeyError:
- raise ArgumentError(self, 'place', 'direction', direction)
-
- # Unpack the side arguments
- left_obj, left_off = side(left, 'left')
- right_obj, right_off = side(right, 'right')
- top_obj, top_off = side(top, 'top')
- bottom_obj, bottom_off = side(bottom, 'bottom')
-
- # Process the items
- #if not isinstance(items, list):
- # items = [items]
- for item in items:
- x, y = item.position
- w, h = item.size
- # Calculate left edge position
- if left_obj:
- l = left_obj.left + left_obj.width + left_off
- elif left_off is not None:
- if left_off < 0:
- l = self.width + left_off
- else:
- l = left_off
- else:
- l = None
- # Calculate top edge position
- if top_obj:
- t = top_obj.top + top_obj.height + top_off
- elif top_off is not None:
- if top_off < 0:
- t = self.height + top_off
- else:
- t = top_off
- else:
- t = None
- # Calculate right edge position
- if right_obj:
- r = right_obj.left + right_off
- elif right_off is not None:
- if right_off <= 0:
- r = self.width + right_off
- else:
- r = right_off
- else:
- r = None
- # Calculate bottom edge position
- if bottom_obj:
- b = bottom_obj.top + bottom_off
- elif bottom_off is not None:
- if bottom_off <= 0:
- b = self.height + bottom_off
- else:
- b = bottom_off
- else:
- b = None
- # Fill in unspecified positions
- if l is None:
- if r is not None:
- l = r - w
- else:
- l = x
- if r is None:
- r = l + w
- if t is None:
- if b is not None:
- t = b - h
- else:
- t = y
- if b is None:
- b = t + h
- if scrolling:
- item.scrolling = scrolling
- # Position, resize and add the item
- item.bounds = (l, t, r, b)
- self.add(item)
- # Record resizing and border options
- item.hmove = hmove
- item.vmove = vmove
- item.hstretch = hstretch
- item.vstretch = vstretch
- if border is not None:
- item.border = border
- # Step to the next item
- if dir == 0:
- left_obj = item
- left_off = spacing
- elif dir == 1:
- top_obj = item
- top_off = spacing
- elif dir == 2:
- right_obj = item
- right_off = -spacing
- else:
- bottom_obj = item
- bottom_off = -spacing
-
- #
- # Resizing
- #
-
- def _resized(self, delta):
- if self._auto_layout:
- self.resized(delta)
-
- def resized(self, delta):
- for c in self._contents:
- c.container_resized(delta)
-
- def resize(self, auto_layout = False, **kwds):
- """Change the geometry of the component, with control over whether
- the layout of subcomponents is updated. The default is not to do so.
- Keyword arguments to this method may be any of the properties
- affecting position and size (i.e. left, top, right, bottom, x, y,
- width, height, position, size, bounds)."""
- old_auto_layout = self.auto_layout
- try:
- self.auto_layout = auto_layout
- self.set(**kwds)
- finally:
- self.auto_layout = old_auto_layout
-
- #
- # Tabbing
- #
-
- def _build_tab_chain(self, chain):
- Component._build_tab_chain(self, chain)
- for c in self._contents:
- c._build_tab_chain(chain)
-
- #
- # Other
- #
-
- def shrink_wrap(self, padding = None):
- """Adjust the size of the component so that it neatly encloses its
- contents. If padding is specified, it specifies the amount of space
- to leave at right and bottom, otherwise the minimum distance from the
- left and top sides to the nearest components is used."""
- contents = self.contents
- if not contents:
- return
- if padding:
- hpad, vpad = padding
- else:
- hpad = min([item.left for item in contents])
- vpad = min([item.top for item in contents])
- rights = [item.right for item in contents]
- bottoms = [item.bottom for item in contents]
- self.resize(size = (max(rights) + hpad, max(bottoms) + vpad))
-
- def broadcast(self, message, *args):
- """Traverse the component hierarchy, calling each component's handler for
- the given message, if any."""
- Component.broadcast(self, message, *args)
- for comp in self._contents:
- comp.broadcast(message, *args)
diff --git a/PyGUI-2.5.3/GUI/Generic/GControls.py b/PyGUI-2.5.3/GUI/Generic/GControls.py
deleted file mode 100644
index 47f0a81..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GControls.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Python GUI - Controls - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Component
-
-class Control(Component):
- """Abstract base class for components such as buttons, check
- boxes and text entry boxes."""
-
- title = overridable_property('title', "Title of the control.")
- value = overridable_property('value', "Value of the control.")
- enabled = overridable_property('enabled', "True if user can manipulate the control.")
- font = overridable_property('font')
- color = overridable_property('color')
- just = overridable_property('just', "Justification ('left', 'center' or 'right').")
- lines = overridable_property('lines',
- "Height of the control measured in lines of the current font.")
- tab_stop = overridable_property('tab_stop',
- "Whether tab key can navigate into this control.")
-
- _vertical_padding = 0 # Extra height to add when setting 'lines' property
- _default_tab_stop = True
- _user_tab_stop_override = True
-
- def __init__(self, font = None, lines = None, **kwds):
- Component.__init__(self, **kwds)
- # If font and lines are both specified, must set font first.
- if font:
- self.font = font
- if lines is not None:
- self.lines = lines
-
- def get_lines(self):
- return int(round((self.height - self._vertical_padding) / self.font.line_height))
-
- def set_lines(self, num_lines):
- self.height = self._calc_height(self.font, num_lines)
-
- def _calc_height(self, font, num_lines = 1):
- return num_lines * font.line_height + self._vertical_padding
-
- def _is_targetable(self):
- return self.enabled
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Generic/GCursors.py b/PyGUI-2.5.3/GUI/Generic/GCursors.py
deleted file mode 100644
index a5982f0..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GCursors.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# Python GUI - Cursors - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI.Properties import Properties
-from GUI.Resources import lookup_resource, find_resource, get_resource
-from GUI import Image
-
-def _hotspot_for_resource(resource_name):
- path = lookup_resource(resource_name, "hot")
- if path:
- f = open(path, "rU")
- xs, ys = f.readline().split()
- return int(xs), int(ys)
- else:
- return None
-
-class Cursor(Properties):
- """A Cursor is an image representing the mouse pointer.
-
- Constructors:
- Cursor(resource_name, hotspot)
- Cursor(image, hotspot)
- """
-
- def from_resource(cls, name, hotspot = None, **kwds):
- def load(path):
- image = Image.from_resource(name, **kwds)
- return cls(image, hotspot or _hotspot_for_resource(name))
- return get_resource(load, name)
-
- from_resource = classmethod(from_resource)
-
- def __init__(self, spec, hotspot = None):
- """Construct a Cursor from a resource or Image and a hotspot point.
- The hotspot defaults to the centre of the image."""
- if isinstance(spec, basestring):
- self._init_from_resource(spec, hotspot)
- else:
- self._init_from_image(spec, hotspot)
-
- def _init_from_resource(self, resource_name, hotspot):
- image = Image(file = find_resource(resource_name))
- if not hotspot:
- hotspot = _hotspot_for_resource(resource_name)
- self._init_from_image(image, hotspot)
-
- def _init_from_image(self, image, hotspot):
- if not hotspot:
- width, height = image.size
- hotspot = (width // 2, height // 2)
- self._init_from_image_and_hotspot(image, hotspot)
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GDialogs.py b/PyGUI-2.5.3/GUI/Generic/GDialogs.py
deleted file mode 100644
index ab9116e..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GDialogs.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# Python GUI - Dialogs - Generic
-#
-
-from GUI import Globals
-from GUI.Properties import overridable_property
-from GUI.Actions import ActionBase, action_property
-from GUI import Window
-
-class Dialog(Window, ActionBase):
-
- _default_keys = "\r"
- _cancel_keys = "\x1b"
-
-# default_button = overridable_property('default_button',
-# "Button to be activated by the default key.")
-#
-# cancel_button = overridable_property('cancel_button',
-# "Button to be activated by the cancel key.")
-#
-# _default_button = None
-# _cancel_button = None
-
- default_action = action_property('default_action',
- "Action to perform when Return or Enter is pressed.")
-
- cancel_action = action_property('cancel_action',
- "Action to perform when Escape is pressed.")
-
- _default_action = 'ok'
- _cancel_action ='cancel'
-
- def __init__(self, style = 'nonmodal_dialog',
- closable = 0, zoomable = 0, resizable = 0, **kwds):
- if 'title' not in kwds:
- kwds['title'] = Globals.application_name
- Window.__init__(self, style = style,
- closable = closable, zoomable = zoomable, resizable = resizable,
- **kwds)
-
-# def get_default_button(self):
-# return self._default_button
-#
-# def set_default_button(self, button):
-# self._default_button = button
-# if button:
-# button.style = 'default'
-#
-# def get_cancel_button(self):
-# return self._cancel_button
-#
-# def set_cancel_button(self, button):
-# self._cancel_button = button
-# if button:
-# button.style = 'cancel'
-
- def key_down(self, event):
- #print "GDialog.key_down:", repr(event.char) ###
- c = event.char
- if c:
- if c in self._default_keys:
- self.do_default_action()
- return
- elif c in self._cancel_keys:
- self.do_cancel_action()
- return
- Window.key_down(self, event)
-
- def do_default_action(self):
- self.do_named_action('default_action')
-
- def do_cancel_action(self):
- self.do_named_action('cancel_action')
-
-# def _activate_button(self, button):
-# if button:
-# button.activate()
diff --git a/PyGUI-2.5.3/GUI/Generic/GDrawableContainers.py b/PyGUI-2.5.3/GUI/Generic/GDrawableContainers.py
deleted file mode 100644
index f060b18..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GDrawableContainers.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - DrawableContainer - Generic
-#
-#--------------------------------------------------------------------
-
-from GUI.Geometry import rect_sized
-from GUI import Container
-from GUI import ViewBase
-from GUI.Printing import Printable
-
-default_size = (100, 100)
-
-class DrawableContainer(ViewBase, Container, Printable):
-
- #
- # Construction and destruction
- #
-
- def __init__(self, **kwds):
- Container.__init__(self, **kwds)
- ViewBase.__init__(self)
-
- def destroy(self):
- ViewBase.destroy(self)
- Container.destroy(self)
-
- def setup_menus(self, m):
- ViewBase.setup_menus(self, m)
- Container.setup_menus(self, m)
-
- def viewed_rect(self):
- """Return the rectangle in local coordinates bounding the currently
- visible part of the extent."""
- return rect_sized((0, 0), self.size)
-
- def with_canvas(self, proc):
- """Call the procedure with a canvas suitable for drawing in this
- view. The canvas is only valid for the duration of the call, and
- should not be retained beyond it."""
- raise NotImplementedError
-
- def update(self):
- """Redraw invalidated regions immediately, without waiting for a
- return to the event loop."""
- raise NotImplementedError
-
- def get_print_extent(self):
- return self.content_size
-
- def _draw_background(self, canvas, clip_rect):
- return clip_rect
-
- #
- # Callbacks
- #
-
- def draw(self, canvas, rect):
- """Called when the view needs to be drawn. The rect is the bounding
- rectangle of the region needing to be drawn. The default implementation
- does nothing."""
- pass
diff --git a/PyGUI-2.5.3/GUI/Generic/GEditCmdHandlers.py b/PyGUI-2.5.3/GUI/Generic/GEditCmdHandlers.py
deleted file mode 100644
index eac1bbe..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GEditCmdHandlers.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# PyGUI - Edit command handling - Generic
-#
-
-from GUI import application
-
-class EditCmdHandler(object):
- # Mixin for objects that implement the standard editing commands.
-
- _may_be_password = False
-
- def setup_menus(self, m):
- selbeg, selend = self.selection
- anysel = selbeg < selend
- anyscrap = application().query_clipboard()
- passwd = self._may_be_password and self.password
- m.cut_cmd.enabled = anysel and not passwd
- m.copy_cmd.enabled = anysel and not passwd
- m.paste_cmd.enabled = anyscrap
- m.clear_cmd.enabled = anysel
- m.select_all_cmd.enabled = True
-
- def select_all_cmd(self):
- self.select_all()
-
- def select_all(self):
- self.selection = (0, self.get_text_length())
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GEvents.py b/PyGUI-2.5.3/GUI/Generic/GEvents.py
deleted file mode 100644
index d4522ea..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GEvents.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# Python GUI - Events - Generic
-#
-
-class Event(object):
-
- """An input event.
-
- Attributes:
-
- kind Type of event. One of 'mouse_down', 'mouse_up', 'key_down',
- 'key_up'.
-
- global_position Position of mouse in screen coordinates at the time of the event.
-
- position For mouse events, position in local coordinates of the View that
- was the target of this event. Undefined for other event types.
-
- time Time of event, in platform-dependent units.
-
- button Button identifier for mouse down/up events.
-
- num_clicks Number of consecutive clicks within double-click time.
-
- char For key events, an ASCII character. Undefined for other event types.
-
- key For non-printing keys, a value identifying the key. Undefined for other event types.
-
- auto True if key-down event is an autorepeat (not supported on all platforms).
-
- Platform-independent modifiers (boolean):
-
- shift The Shift key.
- control The Control key.
- option The additional modifier key.
- extend_contig The contiguous selection extension modifier key.
- extend_noncontig The noncontiguous selection extension modifier key.
- """
-
- kind = None
- global_position = None
- position = None
- time = None
- button = None
- num_clicks = 0
- char = None
- key = None
- auto = False
- shift = False
- control = False
- option = False
- extend_contig = False
- extend_noncontig = False
- delta = (0, 0)
- _keycode = 0 # Platform-dependent key code
- _originator = None # Component to which originally delivered by platform
- _not_handled = False # Reached default event method of originating component
-
- def position_in(self, view):
- """Return the position of this event in the coordinate system
- of the specified view."""
- return view.global_to_local(self.global_position)
-
- def __str__(self):
- return "" \
- % (self.kind, self.global_position, self.position, self.time,
- self.num_clicks, self.char, self.key, self.shift, self.control,
- self.option, self.extend_contig, self.extend_noncontig, self.auto,
- self._platform_modifiers_str())
diff --git a/PyGUI-2.5.3/GUI/Generic/GFiles.py b/PyGUI-2.5.3/GUI/Generic/GFiles.py
deleted file mode 100644
index 585d9af..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GFiles.py
+++ /dev/null
@@ -1,193 +0,0 @@
-#
-# Python GUI - File references and types - Generic
-#
-# Classes for dealing with file references and file types
-# in as platform-independent a manner as possible.
-#
-# In this view of things, a file reference consists
-# of two parts:
-#
-# 1) A directory reference, whose nature is
-# platform-dependent,
-#
-# 2) A name.
-#
-
-import os
-from GUI.Properties import Properties, overridable_property
-
-class FileRef(Properties):
- """A FileRef represents a file system object in a platform-independent way.
- It consists of two parts, a directory specification and the name of an
- object within that directory. The directory specification always refers
- to an existing directory, but the named object may or may not exist.
-
- Constructors:
- FileRef(dir = DirRef or path, name = string)
- FileRef(path = string)
- """
-
- dir = overridable_property('dir', "DirRef representing the parent directory.")
- name = overridable_property('name', "Name of the object within the parent directory.")
- path = overridable_property('path', "Full pathname of the object.")
-
- _dir = None # DirRef representing the parent directory
- _name = None # Name, including type suffix if any
-
- #
- # Constructor
- #
-
- def __init__(self, dir = None, name = None, path = None):
- if dir and name and not path:
- if not isinstance(dir, DirRef):
- dir = DirRef(dir)
- elif path and not (dir or name):
- dirpath, name = os.path.split(path)
- dir = DirRef(path = dirpath)
- else:
- raise TypeError("Invalid argument combination to FileRef constructor")
- self._dir = dir
- self._name = name
-
- #
- # Properties
- #
-
- def get_dir(self):
- return self._dir
-
- def get_name(self):
- "Return the name of the file."
- return self._name
-
- def get_path(self):
- return os.path.join(self._dir.path, self._name)
-
- #
- # Methods
- #
-
- def open(self, mode, file_type = None):
- """Open as a file with the given mode and return a file object. On
- platforms which have file-type metadata (e.g. Macintosh), if the
- mode contains 'w' and a file_type is specified, the newly-created
- file will be given the specified type."""
- f = open(self.path, mode)
- if "w" in mode and file_type:
- self._set_type(file_type)
- return f
-
- def mkdir(self):
- """Create a directory with the name and parent directory specified
- by this FileRef. Returns a DirRef for the created directory."""
- return DirRef(os.mkdir(self.path))
-
- def _set_type(self, file_type):
- # Platforms which have file-type metadata (e.g. Macintosh) use this
- # to set the type of a file.
- pass
-
- def __str__(self):
- return "FileRef(%r,%r)" % (self.dir.path, self.name)
-
-#-------------------------------------------------------------------------
-
-class DirRef(Properties):
- """A DirRef is an object representing a directory in the
- file system. Its representation is completely platform
- dependent.
-
- Constructor:
- DirRef(path = string)
- """
-
- _path = None
-
- path = overridable_property('path', "Full pathname of the directory.")
-
- def __init__(self, path):
- self._path = path
-
- def get_path(self):
- return self._path
-
- def __str__(self):
- return "DirRef(%r)" % self.path
-
-#-------------------------------------------------------------------------
-
-class FileType(Properties):
- """A FileType is a multi-platform representation of a file type."""
-
- _name = None
- _suffix = None
- _mac_creator = None
- _mac_type = None
- _mac_force_suffix = True
-
- name = overridable_property('name', "Human-readable description of the file type")
- suffix = overridable_property('suffix', "Filename suffix (without dot)")
- mac_creator = overridable_property('mac_creator', "Macintosh 4-character creator code")
- mac_type = overridable_property('mac_type', "Macintosh 4-character type code")
- mac_force_suffix = overridable_property('mac_force_suffix', "Enforce filename suffix on MacOSX")
-
- def get_name(self):
- return self._name
-
- def set_name(self, x):
- self._name = x
-
- def get_suffix(self):
- return self._suffix
-
- def set_suffix(self, x):
- self._suffix = x
-
- def get_mac_creator(self):
- return self._mac_creator
-
- def set_mac_creator(self, x):
- self._mac_creator = x
-
- def get_mac_type(self):
- return self._mac_type
-
- def set_mac_type(self, x):
- self._mac_type = x
-
- def get_mac_force_suffix(self):
- return self._mac_force_suffix
-
- def set_mac_force_suffix(self, x):
- self._mac_force_suffix = x
-
- def _matches(self, name, mac_type):
- # Return true if the given name or type code matches that of
- # this file type.
- this_mac_type = self._mac_type
- this_suffix = self._suffix
- if this_mac_type and mac_type == this_mac_type:
- return True
- # Allow generic text files to match typeless files for MacOSX
- if not this_suffix and this_mac_type == "TEXT" and mac_type == "\0\0\0\0":
- return True
- if this_suffix and _matches_suffix(name, this_suffix):
- return True
- return False
-
- def _add_suffix(self, name):
- # Force the given name to have the appropriate suffix for this file
- # type. Platforms which have other means of representing file types
- # (e.g. Macintosh) may override this.
- suffix = self._suffix
- if suffix and not _matches_suffix(name, suffix):
- name = "%s.%s" % (name, suffix)
- return name
-
-#-------------------------------------------------------------------------
-
-def _matches_suffix(name, suffix):
- # Test case-insensitively whether the given filename has
- # the given suffix.
- return name.lower().endswith("." + suffix.lower())
diff --git a/PyGUI-2.5.3/GUI/Generic/GFonts.py b/PyGUI-2.5.3/GUI/Generic/GFonts.py
deleted file mode 100644
index 80ccc29..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GFonts.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#
-# Python GUI - Fonts - Generic
-#
-
-import sys
-from GUI.Properties import overridable_property
-
-class Font(object):
- """A Font object represents a set of characters of a particular
- typeface, style and size. Font objects are immutable.
-
- Constructors:
- Font(family, size, style)
- family = family name
- size = size in points
- style = a list of 'bold', 'italic'
-
- Properties:
- family --> string
- size --> number
- style --> ['bold', 'italic']
- ascent --> number
- descent --> number
- leading --> number
- height --> number
- cap_height --> number
- x_height --> number
- line_height --> number
- """
-
- family = overridable_property('family', "Family name ('Times', 'Helvetica', etc.)")
- size = overridable_property('size', "Size in points")
- style = overridable_property('style', "A list of 'bold', 'italic'")
- ascent = overridable_property('ascent', "Distance from baseline to top of highest character")
- descent = overridable_property('descent', "Distance from baseline to bottom of lowest character")
- height = overridable_property('height', "Sum of ascent and descent")
- cap_height = overridable_property('cap_height', "Height above baseline of capital letters")
- x_height = overridable_property('x_height', "Height above baseline of lowercase letters without ascenders")
- leading = overridable_property('leading', "Recommended extra space between lines")
- line_height = overridable_property('line_height', "Recommended distance between baselines")
-
- def get_cap_height(self):
- # Approximation for platforms not supporting this
- return self.ascent
-
- def get_x_height(self):
- # Approximation for platforms not supporting this
- return self.ascent - self.descent
-
- def get_leading(self):
- return self.line_height - self.height
-
- def but(self, family = None, size = None, style = None,
- style_includes = None, style_excludes = None):
- """Return a new Font that is the same as this one except for the
- specified characteristics."""
- if not family:
- family = self.family
- if not size:
- size = self.size
- if style is None:
- style = self.style
- style = style[:]
- if style_includes:
- for item in style_includes:
- style.append(item)
- if style_excludes:
- for item in style_excludes:
- if item in style:
- style.remove(item)
- return self.__class__(family, size, style)
-
- def width(self, s, start = 0, end = None):
- """width(s [,start [,end ]])
- The width of the specified part of the given string in this font."""
- if start or end is not None:
- if end is None:
- end = len(s)
- s = s[start:end]
- return self._width(s)
-
- def _width(self, s):
- raise NotImplementedError
-
- def x_to_pos(self, s, x):
- """Given a number of pixels measured from the left of
- the given string, returns the nearest inter-character position.
- Returns 0 if x is negative, and len(string) if x is beyond the
- right end of the string."""
- raise NotImplementedError
-
- def __str__(self):
- return "Font(%r,%g,%s)" % (self.family, self.size, self.style)
diff --git a/PyGUI-2.5.3/GUI/Generic/GFrames.py b/PyGUI-2.5.3/GUI/Generic/GFrames.py
deleted file mode 100644
index 503bb6d..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GFrames.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Python GUI - Frames - Generic
-#
-
-from GUI import Container
-
-class Frame(Container):
- """A Frame is a general-purpose instantiable subclass of Container."""
-
- _default_size = (100, 100)
diff --git a/PyGUI-2.5.3/GUI/Generic/GGLConfig.py b/PyGUI-2.5.3/GUI/Generic/GGLConfig.py
deleted file mode 100644
index 3a92da2..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GGLConfig.py
+++ /dev/null
@@ -1,162 +0,0 @@
-#
-# PyGUI - OpenGL Pixel Formats - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class GLConfig(Properties):
- """Class holding the attributes of an OpenGL context configuration."""
-
- # NOTE: When adding a property here, also add it to
- # _pixel_format_attribute_names below.
-
- double_buffer = overridable_property("double_buffer", "True if context is to be double-buffered.")
- alpha = overridable_property("alpha", "True if there is to be an alpha channel.")
- color_size = overridable_property("color_size", "Number of bits per colour buffer component.")
- alpha_size = overridable_property("alpha_size", "Number of bits per alpha channel component.")
- stereo = overridable_property("stereo", "True if stereoscopic context is required.")
- aux_buffers = overridable_property("aux_buffers", "Number of auxiliary colour buffers to allocate.")
- depth_buffer = overridable_property("depth_buffer", "True if a depth buffer is required.")
- depth_size = overridable_property("depth_size", "Number of bits per depth buffer element.")
- stencil_buffer = overridable_property("stencil_buffer", "True if a stencil buffer is required.")
- stencil_size = overridable_property("stencil_size", "Number of bits per stencil buffer element.")
- accum_buffer = overridable_property("accum_buffer", "True if an accumulation buffer is required.")
- accum_size = overridable_property("accum_size", "Number of bits per accumulation buffer component.")
- multisample = overridable_property("multisample", "True if a multisampled context is required.")
- samples_per_pixel = overridable_property("samples_per_pixel", "Number of samples per multisampled pixel.")
-
- _double_buffer = True
- _alpha = True
- _color_size = 8
- _alpha_size = 8
- _stereo = False
- _aux_buffers = 0
- _depth_buffer = True
- _depth_size = 32
- _stencil_buffer = False
- _stencil_size = 8
- _accum_buffer = False
- _accum_size = 8
- _multisample = False
- _samples_per_pixel = 4
-
- _pixel_format_attribute_names = (
- 'double_buffer', 'alpha', 'color_size', 'alpha_size',
- 'stereo', 'aux_buffers', 'depth_buffer', 'depth_size',
- 'stencil_buffer', 'stencil_size', 'accum_buffer', 'accum_size',
- 'multisample', 'samples_per_pixel',
- )
-
- def _from_args(cls, config, kwds):
- # Extract pixel format arguments from arguments of GLView.__init__
- # or GLPixmap.__init__ and return a GLConfig. Used keyword
- # arguments are removed from kwds.
- pf_kwds = {}
- for name in cls._pixel_format_attribute_names:
- if name in kwds:
- pf_kwds[name] = kwds.pop(name)
- if config and pf_kwds:
- raise TypeError("Explicit config cannot be used with other configuration keyword arguments")
- if not config:
- config = cls(**pf_kwds)
- return config
-
- _from_args = classmethod(_from_args)
-
- def get_double_buffer(self):
- return self._double_buffer
-
- def set_double_buffer(self, x):
- self._double_buffer = x
-
- def get_alpha(self):
- return self._alpha
-
- def set_alpha(self, x):
- self._alpha = x
-
- def get_color_size(self):
- return self._color_size
-
- def set_color_size(self, x):
- self._color_size = x
-
- def get_alpha_size(self):
- return self._alpha_size
-
- def set_alpha_size(self, x):
- self._alpha_size = x
-
- def get_stereo(self):
- return self._stereo
-
- def set_stereo(self, x):
- self._stereo = x
-
- def get_aux_buffers(self):
- return self._aux_buffers
-
- def set_aux_buffers(self, x):
- self._aux_buffers = x
-
- def get_depth_buffer(self):
- return self._depth_buffer
-
- def set_depth_buffer(self, x):
- self._depth_buffer = x
-
- def get_depth_size(self):
- return self._depth_size
-
- def set_depth_size(self, x):
- self._depth_size = x
-
- def get_stencil_buffer(self):
- return self._stencil_buffer
-
- def set_stencil_buffer(self, x):
- self._stencil_buffer = x
-
- def get_stencil_size(self):
- return self._stencil_size
-
- def set_stencil_size(self, x):
- self._stencil_size = x
-
- def get_accum_buffer(self):
- return self._accum_buffer
-
- def set_accum_buffer(self, x):
- self._accum_buffer = x
-
- def get_accum_size(self):
- return self._accum_size
-
- def set_accum_size(self, x):
- self._accum_size = x
-
- def get_multisample(self):
- return self._multisample
-
- def set_multisample(self, x):
- self._multisample = x
-
- def get_samples_per_pixel(self):
- return self._samples_per_pixel
-
- def set_samples_per_pixel(self, x):
- self._samples_per_pixel = x
-
- def supported(self):
- """Determine whether the combination of attributes requested by this configuration
- can be satisfied. If successful, a new GLConfig object is returned whose
- attributes reflect those actually allocated. Otherwise, a GLConfigError is
- raised."""
- raise NotImplementedError
-
-#------------------------------------------------------------------------------
-
-class GLConfigError(ValueError):
-
- def __init__(self, msg = "OpenGL configuration not available"):
- ValueError.__init__(self, msg)
diff --git a/PyGUI-2.5.3/GUI/Generic/GGLContexts.py b/PyGUI-2.5.3/GUI/Generic/GGLContexts.py
deleted file mode 100644
index 82ed632..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GGLContexts.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# PyGUI - OpenGL Contexts - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.GLShareGroups import ShareGroup
-
-_current_share_group = None
-
-class GLContext(object):
- """Abstract base class for objects having an OpenGL context."""
- #
- # _share_group ShareGroup
- #
-
- share_group = overridable_property('share_group',
- "ShareGroup to which this context should belong, or None.")
-
- def __init__(self, share_group):
- if not share_group:
- share_group = ShareGroup()
- self._share_group = share_group
- if share_group:
- share_group._add(self)
-
- def destroy(self):
- pass
-
- def init_context(self):
- """This method is called once after the associated OpenGL context
- is created. When called, this object's OpenGL context is the current
- context and the viewport is set to (0, 0, width, height). This method
- may be used to establish any desired initial OpenGL state."""
- pass
-
- def get_share_group(self):
- return self._share_group
-
- def _get_shared_context(self):
- """Return another arbitrarily-chosen member of the share group of this
- context, or None if this context has no share group or there are no
- other members."""
- return self._share_group._some_member(exclude = self)
-
- def with_context(self, proc, flush = False):
- """The proc should be a callable object of no arguments. Calls
- the proc with the associated OpenGL context as the current context.
- If flush is true, after calling proc, a glFlush followed by a
- buffer flush or swap is performed as appropriate."""
- self._with_context(proc, flush)
-
- def _with_context(self, proc, flush):
- # Subclasses override this to implement with_context.
- # Should call _with_share_group(proc).
- # Signature can be changed if with_context is overridden to match.
- raise NotImplementedError
-
- def _with_share_group(self, proc):
- global _current_share_group
- old_share_group = _current_share_group
- _current_share_group = self._share_group
- try:
- proc()
- finally:
- _current_share_group = old_share_group
-
-
-def current_share_group():
- group = _current_share_group
- if not group:
- raise ValueError("No current PyGUI OpenGL context")
- return group
diff --git a/PyGUI-2.5.3/GUI/Generic/GGLPixelFormats.py b/PyGUI-2.5.3/GUI/Generic/GGLPixelFormats.py
deleted file mode 100644
index 1f20cc8..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GGLPixelFormats.py
+++ /dev/null
@@ -1,163 +0,0 @@
-#
-# PyGUI - OpenGL Pixel Formats - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class GLPixelFormat(Properties):
- """Class holding the attributes of an OpenGL pixel format."""
-
- # NOTE: When adding a property here, also add it to
- # _pixel_format_attribute_names below.
-
- double_buffer = overridable_property("double_buffer", "True if context is to be double-buffered.")
- alpha = overridable_property("alpha", "True if there is to be an alpha channel.")
- color_size = overridable_property("color_size", "Number of bits per colour buffer component.")
- alpha_size = overridable_property("alpha_size", "Number of bits per alpha channel component.")
- stereo = overridable_property("stereo", "True if stereoscopic context is required.")
- aux_buffers = overridable_property("aux_buffers", "Number of auxiliary colour buffers to allocate.")
- depth_buffer = overridable_property("depth_buffer", "True if a depth buffer is required.")
- depth_size = overridable_property("depth_size", "Number of bits per depth buffer element.")
- stencil_buffer = overridable_property("stencil_buffer", "True if a stencil buffer is required.")
- stencil_size = overridable_property("stencil_size", "Number of bits per stencil buffer element.")
- accum_buffer = overridable_property("accum_buffer", "True if an accumulation buffer is required.")
- accum_size = overridable_property("accum_size", "Number of bits per accumulation buffer component.")
- multisample = overridable_property("multisample", "True if a multisampled context is required.")
- samples_per_pixel = overridable_property("samples_per_pixel", "Number of samples per multisampled pixel.")
-
- _double_buffer = True
- _alpha = True
- _color_size = 8
- _alpha_size = 8
- _stereo = False
- _aux_buffers = 0
- _depth_buffer = True
- _depth_size = 32
- _stencil_buffer = False
- _stencil_size = 8
- _accum_buffer = False
- _accum_size = 8
- _multisample = False
- _samples_per_pixel = False
-
- _pixel_format_attribute_names = (
- 'double_buffer', 'alpha', 'color_size', 'alpha_size',
- 'stereo', 'aux_buffers', 'depth_buffer', 'depth_size',
- 'stencil_buffer', 'stencil_size', 'accum_buffer', 'accum_size',
- 'multisample', 'samples_per_pixel',
- )
-
- def _from_args(cls, pixel_format, kwds):
- # Extract pixel format arguments from arguments of GLView.__init__
- # or GLPixmap.__init__ and return a GLPixelFormat. Used keyword
- # arguments are removed from kwds.
- pf_kwds = {}
- for name in cls._pixel_format_attribute_names:
- if name in kwds:
- pf_kwds[name] = kwds.pop(name)
- if pixel_format and pf_kwds:
- raise TypeError("Explicit pixel_format cannot be used with other pixel format keyword arguments")
- if not pixel_format:
- pixel_format = cls(**pf_kwds)
- return pixel_format
-
- _from_args = classmethod(_from_args)
-
- def get_double_buffer(self):
- return self._double_buffer
-
- def set_double_buffer(self, x):
- self._double_buffer = x
-
- def get_alpha(self):
- return self._alpha
-
- def set_alpha(self, x):
- self._alpha = x
-
- def get_color_size(self):
- return self._color_size
-
- def set_color_size(self, x):
- self._color_size = x
-
- def get_alpha_size(self):
- return self._alpha_size
-
- def set_alpha_size(self, x):
- self._alpha_size = x
-
- def get_stereo(self):
- return self._stereo
-
- def set_stereo(self, x):
- self._stereo = x
-
- def get_aux_buffers(self):
- return self._aux_buffers
-
- def set_aux_buffers(self, x):
- self._aux_buffers = x
-
- def get_depth_buffer(self):
- return self._depth_buffer
-
- def set_depth_buffer(self, x):
- self._depth_buffer = x
-
- def get_depth_size(self):
- return self._depth_size
-
- def set_depth_size(self, x):
- self._depth_size = x
-
- def get_stencil_buffer(self):
- return self._stencil_buffer
-
- def set_stencil_buffer(self, x):
- self._stencil_buffer = x
-
- def get_stencil_size(self):
- return self._stencil_size
-
- def set_stencil_size(self, x):
- self._stencil_size = x
-
- def get_accum_buffer(self):
- return self._accum_buffer
-
- def set_accum_buffer(self, x):
- self._accum_buffer = x
-
- def get_accum_size(self):
- return self._accum_size
-
- def set_accum_size(self, x):
- self._accum_size = x
-
- def get_multisample(self):
- return self._multisample
-
- def set_multisample(self, x):
- self._multisample = x
-
- def get_samples_per_pixel(self):
- return self._samples_per_pixel
-
- def set_samples_per_pixel(self, x):
- self._samples_per_pixel = x
-
- def supported(self):
- """Determine whether the combination of attributes requested by this pixel format
- can be satisfied. If successful, a new GLPixelFormat object is returned whose
- attributes reflect those actually allocated. Otherwise, a GLPixelFormatError is
- raised."""
- raise NotImplementedError
-
-#------------------------------------------------------------------------------
-
-class GLPixelFormatError(ValueError):
-
- def __init__(self):
- ValueError.__init__(self,
- "OpenGL pixel format attribute request cannot be satisfied")
diff --git a/PyGUI-2.5.3/GUI/Generic/GGLPixmaps.py b/PyGUI-2.5.3/GUI/Generic/GGLPixmaps.py
deleted file mode 100644
index 8f07090..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GGLPixmaps.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# PyGUI - OpenGL Pixmap - Generic
-#
-
-from OpenGL.GL import glViewport
-from GUI import ImageBase
-from GUI.GLContexts import GLContext
-
-class GLPixmap(ImageBase, GLContext):
- """An offscreen OpenGL drawing area.
-
- Constructors:
- GLPixmap(width, height, share = None, config_attr = value...)
- GLPixmap(width, height, config, share = None)
- """
-
- def destroy(self):
- GLContext.destroy(self)
-
- def _init_context(self):
- width, height = self.size
- glViewport(0, 0, int(width), int(height))
- self.init_context()
diff --git a/PyGUI-2.5.3/GUI/Generic/GGLTextures.py b/PyGUI-2.5.3/GUI/Generic/GGLTextures.py
deleted file mode 100644
index 0a56f85..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GGLTextures.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Generic
-#
-
-from weakref import WeakKeyDictionary
-from OpenGL.GL import glGenTextures, glBindTexture, glDeleteTextures, \
- glTexImage2D, GL_TEXTURE_2D, GL_RGBA
-from OpenGL.GLU import gluBuild2DMipmaps
-from GUI.GGLContexts import current_share_group
-from GUI.GLDisplayLists import call_when_not_compiling_display_list
-
-#----------------------------------------------------------------------
-
-class TextureIdMap(WeakKeyDictionary):
-
- def __del__(self):
- #print "GL.TextureIdMap.__del__:", self ###
- def free_texture():
- glDeleteTextures([gl_id])
- for share_group, gl_id in self.items():
- context = share_group._some_member()
- if context:
- #print "...freeing texture id", gl_id, "for", share_group, "using", context ###
- context.with_context(free_texture)
-
-#----------------------------------------------------------------------
-
-class Texture(object):
- """This class encapsulates an OpenGL texture and maintains a
- representation of it for each OpenGL context with which it is used.
- Allocation and maintentance of texture numbers is handled automatically.
-
- Constructor:
- Texture(texture_type)
- where texture_type is the appropriate GL constant for the type
- of texture (GL_TEXTURE_2D etc.)
- """
- #
- # _gl_type int GL_TEXTURE_2D, etc.
- # _gl_id ShareGroup -> int Mapping from OpenGL share group to texture number
-
- def __init__(self, texture_type):
- self._gl_type = texture_type
- self._gl_id = TextureIdMap()
-
- def deallocate(self):
- """Deallocate any OpenGL resources that have been allocated for this
- texture in any context."""
- self._gl_id.__del__()
-
- def bind(self):
- """Makes this texture the current texture for the current context
- by calling glBindTexture. If this texture has not previously been
- used with the current context, do_setup() is called to allocate
- and initialise a representation of the texture."""
- gl_id = self.gl_id()
- glBindTexture(self._gl_type, gl_id)
-
- def gl_id(self):
- """Returns the OpenGL texture number corresponding to this texture
- in the current context. May trigger allocation of a new texture and
- a call to do_setup(). Does not bind the texture, unless a new texture
- is allocated, in which case the current texture binding may be changed
- as a side effect."""
- share_group = current_share_group()
- gl_id = self._gl_id.get(share_group)
- if gl_id is None:
- gl_id = glGenTextures(1)
- #print "GLTexture: assigned id %d for %s in share group %s" % (
- # gl_id, self, share_group) ###
- self._gl_id[share_group] = gl_id
- call_when_not_compiling_display_list(lambda: self._setup(gl_id))
- return gl_id
-
- def _setup(self, gl_id):
- glBindTexture(self._gl_type, gl_id)
- self.do_setup()
-
- def do_setup(self):
- """Subclasses should override this to make the necessary OpenGL
- calls to initialise the texture, assuming that glBindTexture has
- already been called."""
- raise NotImplementedError
-
- def gl_tex_image_2d(self, image, target = GL_TEXTURE_2D, internal_format = GL_RGBA,
- border = False, with_mipmaps = False):
- """Load the currently bound texture with data from an image, with automatic
- scaling to power-of-2 size and optional mipmap generation."""
- border = bool(border)
- if border and with_mipmaps:
- raise ValueError("Bordered texture cannot have mipmaps")
- b2 = 2 * border
- width, height = image.size
- twidth = pow2up(width - b2) + b2
- theight = pow2up(height - b2) + b2
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: before scaling: size =", (width, height) ###
- if width <> twidth or height <> theight:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: scaling image to size", (twidth, theight) ###
- from Pixmaps import Pixmap
- image2 = Pixmap(twidth, theight)
- def scale(canvas):
- image.draw(canvas, (0, 0, width, height), (0, 0, twidth, theight))
- image2.with_canvas(scale)
- image = image2
- format, type, data = self._gl_get_texture_data(image)
- if with_mipmaps:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: loading mipmaps" ###
- gluBuild2DMipmaps(target, internal_format, twidth, theight,
- format, type, data)
- else:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: loading texture" ###
- glTexImage2D(target, 0, internal_format, twidth, theight, border,
- format, type, data)
-
-#----------------------------------------------------------------------
-
-def pow2up(size):
- # Round size up to a power of 2
- psize = 1
- while psize < size:
- psize <<= 1
- return psize
diff --git a/PyGUI-2.5.3/GUI/Generic/GGLViews.py b/PyGUI-2.5.3/GUI/Generic/GGLViews.py
deleted file mode 100644
index 368970d..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GGLViews.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# PyGUI - OpenGL View - Generic
-#
-
-from OpenGL.GL import glViewport, glMatrixMode, glLoadIdentity, \
- GL_PROJECTION, GL_MODELVIEW
-from GUI import Component
-from GUI import ViewBase
-from GUI.GLContexts import GLContext
-
-class GLError(StandardError):
- pass
-
-class GLView(ViewBase, Component, GLContext):
- """A GLView is a Component providing an OpenGL 3D display area.
-
- Constructors:
- GLView(config_attr = value..., share = None)
- GLView(config, share = None)
- """
-
- _default_size = (100, 100)
-
- def __init__(self, **kwds):
- Component.__init__(self, **kwds)
- ViewBase.__init__(self)
-
- def destroy(self):
- ViewBase.destroy(self)
- Component.destroy(self)
-
- def _render(self):
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity()
- self.render()
-
- def render(self):
- """This method is called when the contents of the view needs to
- be redrawn, with the view's OpenGL context as the current context.
- The modelview matrix has been selected as the current matrix and
- set to an identity matrix. After calling this method, buffers will
- be automatically swapped or drawing flushed as appropriate."""
- pass
-
- def viewport_changed(self):
- """This method is called when the view's size has changed, with
- the view's OpenGL context as the current context, and the OpenGL
- viewport set to (0, 0, width, height). The default implementation
- loads an identity projection matrix and calls init_projection()."""
- glMatrixMode(GL_PROJECTION)
- glLoadIdentity()
- self.init_projection()
-
- def init_projection(self):
- """This method is called to establish the projection whenever the
- viewport changes. The projection matrix has been selected as the
- current matrix and set to an identity matrix."""
- pass
-
- def update(self):
- """Redraws the contents of the view immediately, without waiting
- for a return to the event loop."""
- self.with_context(self.render, flush = True)
-
- def _init_context(self):
- self.init_context()
- self._update_viewport()
-
- def _update_viewport(self):
- width, height = self.size
- glViewport(0, 0, int(width), int(height))
- self.viewport_changed()
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GGeometry.py b/PyGUI-2.5.3/GUI/Generic/GGeometry.py
deleted file mode 100644
index 0a5bb8a..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GGeometry.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Python GUI - Point and rectangle utilities - Generic
-#
-
-def add_pt((x1, y1), (x2, y2)):
- return (x1 + x2), (y1 + y2)
-
-def sub_pt((x1, y1), (x2, y2)):
- return (x1 - x2), (y1 - y2)
-
-def rect_sized((l, t), (w, h)):
- return (l, t, l + w, t + h)
-
-def rect_left(r):
- return r[0]
-
-def rect_top(r):
- return r[1]
-
-def rect_right(r):
- return r[2]
-
-def rect_bottom(r):
- return r[3]
-
-def rect_width(r):
- return r[2] - r[0]
-
-def rect_height(r):
- return r[3] - r[1]
-
-def rect_topleft(r):
- return r[:2]
-
-def rect_botright(r):
- return r[2:]
-
-def rect_center((l, t, r, b)):
- return ((l + r) // 2, (t + b) // 2)
-
-def rect_size((l, t, r, b)):
- return (r - l, b - t)
-
-def union_rect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return (min(l1, l2), min(t1, t2), max(r1, r2), max(b1, b2))
-
-def sect_rect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return (max(l1, l2), max(t1, t2), min(r1, r2), min(b1, b2))
-
-def inset_rect((l, t, r, b), (dx, dy)):
- return (l + dx, t + dy, r - dx, b - dy)
-
-def offset_rect((l, t, r, b), (dx, dy)):
- return (l + dx, t + dy, r + dx, b + dy)
-
-def offset_rect_neg((l, t, r, b), (dx, dy)):
- return (l - dx, t - dy, r - dx, b - dy)
-
-def empty_rect((l, t, r, b)):
- return r <= l or b <= t
-
-def pt_in_rect((x, y), (l, t, r, b)):
- return l <= x < r and t <= y < b
-
-def rects_intersect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return l1 < r2 and l2 < r1 and t1 < b2 and t2 < b1
-
-def rect_with_center((l, t, r, b), (x, y)):
- w = r - l
- h = b - t
- rl = x - w // 2
- rt = y - h // 2
- return (rl, rt, rl + w, rt + h)
diff --git a/PyGUI-2.5.3/GUI/Generic/GImageBases.py b/PyGUI-2.5.3/GUI/Generic/GImageBases.py
deleted file mode 100644
index 5762234..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GImageBases.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Python GUI - Image Base - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-from GUI.Geometry import rect_sized
-
-class ImageBase(Properties):
- """Abstract base class for Image, Pixmap and GLPixmap."""
-
- width = overridable_property('width', "Width of the image in pixels (read only).")
- height = overridable_property('height', "Height of the image in pixels (read only).")
- size = overridable_property('size', "Size of the image in pixels (read only).")
- bounds = overridable_property('bounds', "Bounding rectangle of the image in pixels (read only).")
-
- def get_size(self):
- return (self.width, self.height)
-
- def get_bounds(self):
- return rect_sized((0, 0), self.size)
-
- def draw(self, canvas, src_rect, dst_rect):
- """Draw the part of the image specified by src_rect on the given canvas,
- scaled to fit within dst_rect."""
- raise NotImplementedError
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GImages.py b/PyGUI-2.5.3/GUI/Generic/GImages.py
deleted file mode 100644
index 21fb9bb..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GImages.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Python GUI - Images - Generic
-#
-
-from GUI.Files import FileRef
-from GUI.Resources import get_resource
-from GUI import ImageBase
-
-class Image(ImageBase):
- """Class Image represents an RGB or RGBA image.
-
- Constructors:
- Image(file = FileRef or pathname)
- """
-
- def from_resource(cls, name, **kwds):
- return get_resource(cls, name, **kwds)
-
- from_resource = classmethod(from_resource)
-
- def __init__(self, file):
- if isinstance(file, FileRef):
- file = file.path
- self._init_from_file(file)
diff --git a/PyGUI-2.5.3/GUI/Generic/GLDisplayLists.py b/PyGUI-2.5.3/GUI/Generic/GLDisplayLists.py
deleted file mode 100644
index e6ed682..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GLDisplayLists.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# PyGUI - OpenGL Display Lists - Generic
-#
-
-from weakref import WeakKeyDictionary
-from OpenGL.GL import glGenLists, glNewList, glEndList, glCallList, \
- glDeleteLists, GL_COMPILE
-from GUI.Properties import Properties, overridable_property
-from GUI.GGLContexts import current_share_group
-
-#----------------------------------------------------------------------
-
-class DisplayListIdMap(WeakKeyDictionary):
-
- def __del__(self):
- # Delete any display lists that have been allocated for this map.
- #print "GL.DisplayListIdMap.__del__:", self ###
- def free_display_list():
- glDeleteLists(gl_id, 1)
- for share_group, gl_id in self.items():
- context = share_group._some_member()
- if context:
- #print "...freeing display list id", gl_id, "for", share_group, "using", context ###
- context.with_context(free_display_list)
-
-#----------------------------------------------------------------------
-
-class DisplayList(Properties):
- """This class encapsulates an OpenGL display list and maintains a
- representation of it for each OpenGL context with which it is used.
- Allocation and maintentance of display list numbers is handled
- automatically."""
- #
- # _gl_id ShareGroup -> int Mapping from OpenGL share group to
- # display list number
-
- setup = overridable_property('setup',
- """Function to set up the display list by making the necessary
- OpenGL calls, excluding glNewList and glEndList.""")
-
- def __init__(self, setup = None):
- self._gl_id = DisplayListIdMap()
- self._setup = setup
-
- def deallocate(self):
- """Deallocate any OpenGL resources that have been allocated for this
- display list in any context."""
- self._gl_id.__del__()
-
- def get_setup(self):
- return self._setup
-
- def set_setup(self, x):
- self._setup = x
-
- def call(self):
- """Calls the display list using glCallList(). If this display list
- has not previously been used with the current context, allocates
- a display list number and arranges for do_setup() to be called
- to compile a representation of the display list."""
- share_group = current_share_group()
- gl_id = self._gl_id.get(share_group)
- if gl_id is None:
- gl_id = glGenLists(1)
- #print "GLDisplayList: assigned id %d for %s in share group %s" % (
- # gl_id, self, share_group) ###
- self._gl_id[share_group] = gl_id
- call_when_not_compiling_display_list(lambda: self._compile(gl_id))
- glCallList(gl_id)
-
- def _compile(self, gl_id):
- global compiling_display_list
- compiling_display_list = True
- glNewList(gl_id, GL_COMPILE)
- try:
- self.do_setup()
- finally:
- glEndList()
- compiling_display_list = False
-
- def do_setup(self):
- """Make all the necessary OpenGL calls to compile the display list,
- except for glNewList() and glEndList() which will be called automatically
- before and after. The default implementation calls the 'setup' property."""
- setup = self._setup
- if setup:
- setup()
- else:
- raise NotImplementedError(
- "No setup function or do_setup method for GL.DisplayList")
-
-
-compiling_display_list = False
-pending_functions = []
-
-def call_when_not_compiling_display_list(func):
- #print "GLDisplayLists: entering call_when_not_compiling_display_list" ###
- if compiling_display_list:
- #print "GLDisplayLists: deferring", func ###
- pending_functions.append(func)
- else:
- #print "GLDisplayLists: immediately calling", func ###
- func()
- while pending_functions:
- #print "GLDisplayLists: calling deferred", func ###
- pending_functions.pop()()
- #print "GLDisplayLists: exiting call_when_not_compiling_display_list" ###
diff --git a/PyGUI-2.5.3/GUI/Generic/GLShareGroups.py b/PyGUI-2.5.3/GUI/Generic/GLShareGroups.py
deleted file mode 100644
index 8bb2cfc..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GLShareGroups.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# PyGUI - OpenGL Context Sharing - Generic
-#
-
-from weakref import WeakKeyDictionary
-
-class ShareGroup(object):
- """Object representing a shared texture and display list
- namespace for OpenGL contexts."""
-
- def __init__(self):
- self.contexts = WeakKeyDictionary()
-
- def __contains__(self, context):
- "Test whether a GLView or GLPixmap is a member of this share group."
- return context in self.contexts
-
- def __iter__(self):
- "Return an iterator over the members of this share group."
- return iter(self.contexts)
-
- def _add(self, context):
- self.contexts[context] = 1
-
- def _some_member(self, exclude = None):
- for member in self.contexts:
- if member is not exclude:
- return member
- return None
diff --git a/PyGUI-2.5.3/GUI/Generic/GLabels.py b/PyGUI-2.5.3/GUI/Generic/GLabels.py
deleted file mode 100644
index db84870..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GLabels.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Python GUI - Labels - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-
-class Label(Control):
- """A piece of static text for labelling items in a window."""
-
- _default_tab_stop = False
-
- text = overridable_property('text')
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GListButtons.py b/PyGUI-2.5.3/GUI/Generic/GListButtons.py
deleted file mode 100644
index a811401..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GListButtons.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - Pop-up list control - Generic
-#
-#--------------------------------------------------------------
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control, application
-
-class ListButton(Control, Action):
- """A button that displays a value and provides a pop-up or
- pull-down list of choices."""
-
- titles = overridable_property('titles',
- "List of item title strings")
-
- values = overridable_property('values',
- "List of values corresponding to tiles, or None to use item index as value")
-
- def _extract_initial_items(self, kwds):
- titles = kwds.pop('titles', None) or []
- values = kwds.pop('values', None)
- return titles, values
-
- def get_titles(self):
- return self._titles
-
- def set_titles(self, x):
- self._titles = x
- self._update_items()
-
- def get_values(self):
- return self._values
-
- def set_values(self, x):
- self._values = x
-
- def get_value(self):
- i = self._get_selected_index()
- if i >= 0:
- values = self.values
- if values:
- return values[i]
- else:
- return i
-
- def set_value(self, value):
- values = self.values
- if values:
- try:
- i = values.index(value)
- except ValueError:
- i = -1
- else:
- if value is None:
- i = -1
- else:
- i = value
- self._set_selected_index(i)
-
- def do_action(self):
- try:
- Action.do_action(self)
- except:
- application().report_error()
diff --git a/PyGUI-2.5.3/GUI/Generic/GMenus.py b/PyGUI-2.5.3/GUI/Generic/GMenus.py
deleted file mode 100644
index 13fd7ef..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GMenus.py
+++ /dev/null
@@ -1,335 +0,0 @@
-#----------------------------------------------------------------------
-#
-# Python GUI - Menus - Generic
-#
-#----------------------------------------------------------------------
-
-from GUI import Globals
-from GUI.Properties import Properties, overridable_property
-
-#----------------------------------------------------------------------
-
-def search_list_for_key(items, char, shift, option):
- for i in xrange(len(items)-1, -1, -1):
- result = items[i]._search_for_key(char, shift, option)
- if result:
- return result
-
-#----------------------------------------------------------------------
-
-class Menu(Properties):
- """Pull-down or pop-up menu class.
-
- Menu(title, item_descriptors)
- constructs a menu with the given title and items. Each
- item_descriptor is of the form
-
- "-"
-
- for a separator,
-
- ("text/key", 'command_name')
-
- for a single menu item, or
-
- (["text/key", ...], 'command_name')
-
- for an indexed item group. An indexed group is a group
- of items sharing the same command name and distinguished
- by an integer index. Items can be added to and removed
- from the group dynamically, to implement e.g. a font
- menu or windows menu.
-
- The "key" part of the item descriptor (which is optional)
- specifies the keyboard equivalent. It should consist of
- a single character together with the following optional
- modifiers:
-
- ^ representing the Shift key
- @ representing the Alt or Option key
- """
-
- title = overridable_property('title', "Title string appearing in menu bar")
- special = overridable_property('special', "Menu appears at right end of menu bar")
-
- _flat_items = None
-
- def __init__(self, title, items, special = False, substitutions = {}, **kwds):
- self._title = title
- self._items = []
- self._special = special
- Properties.__init__(self, **kwds)
- self.extend(items, substitutions)
-
- def get_title(self):
- return self._title
-
- def get_special(self):
- return self._special
-
- def item_with_command(self, cmd):
- for item in self._items:
- if item._command_name == cmd:
- return item
- return None
-
- def append(self, item, substitutions = {}):
- items = self._items
- item = self._make_item(item, substitutions)
- if not (items and isinstance(item, MenuSeparator)
- and isinstance(items[-1], MenuSeparator)):
- items.append(item)
-
- def extend(self, items, substitutions = {}):
- for item in items:
- self.append(item, substitutions)
-
- def _make_item(self, item, substitutions):
- if isinstance(item, MenuItem):
- return item
- elif item == "-":
- return _menu_separator
- else:
- (text, cmd) = item
- if isinstance(text, basestring):
- return SingleMenuItem(text, cmd, substitutions)
- else:
- return MenuItemGroup(text, cmd)
-
- def _command_and_args_for_item(self, item_num):
- i = 1
- for item in self._items:
- n = item._num_subitems()
- if item_num < i + n:
- return item._command_and_args_for_subitem(item_num - i)
- i += n
- return '', ()
-
- def _update_platform_menu(self):
- # Called during menu setup after items have been enabled/checked.
- # Generic implementation rebuilds the whole menu from scratch.
- # Implementations may override this to be more elegant.
- self._rebuild_platform_menu()
-
- def _rebuild_platform_menu(self):
- self._clear_platform_menu()
- for item in self._items:
- item._add_to_platform_menu(self)
-
- def _search_for_key(self, char, shift, option):
- return search_list_for_key(self._items, char, shift, option)
-
- def _get_flat_items(self):
- flat = self._flat_items
- if flat is None:
- flat = []
- for item in self._items:
- item._collect_flat_items(flat)
- self._flat_items = flat
- return flat
-
- def _get_flat_item(self, i):
- return self._get_flat_items()[i]
-
-#----------------------------------------------------------------------
-
-class MenuItem(Properties):
- # Internal class representing a menu item, group or separator.
- #
- # _command_name string Internal command name
-
- def _num_subitems(self):
- return 1
-
- def _split_text(self, text):
- # Split menu text into label and key combination.
- if "/" in text:
- return text.split("/")
- else:
- return text, ""
-
- def _name(self):
- return self._label.replace("", Globals.application_name)
-
- def _collect_flat_items(self, result):
- result.append(self)
-
-#----------------------------------------------------------------------
-
-class MenuSeparator(MenuItem):
- # Internal class representing a menu separator.
-
- _command_name = ''
-
- def _add_to_platform_menu(self, menu):
- menu._add_separator_to_platform_menu()
-
- def _search_for_key(self, char, shift, option):
- pass
-
-#----------------------------------------------------------------------
-
-class SingleMenuItem(MenuItem):
- """Class representing a menu item.
-
- Properties:
- enabled boolean
- checked boolean
- """
-
- enabled = 0
- checked = 0
- _key = None
- _shift = 0
- _option = 0
- #_index = None
-
- def __init__(self, text, cmd, substitutions = {}):
- label1, keycomb1 = self._split_text(text)
- label2, keycomb2 = self._split_text(substitutions.get(cmd, ""))
- self._label = label2 or label1
- keycomb = keycomb2 or keycomb1
- for c in keycomb:
- if c == '^':
- self._shift = 1
- elif c == '@':
- self._option = 1
- else:
- self._key = c.upper()
- self._command_name = cmd
-
- def __str__(self):
- return "" % (
- self._label, self._key, self._shift, self._option, self.enabled)
-
- def _add_to_platform_menu(self, menu):
- menu._add_item_to_platform_menu(self, self._name(), self._command_name)
-
- def _command_and_args_for_subitem(self, i):
- return self._command_name, ()
-
- def _search_for_key(self, char, shift, option):
- if self._matches_key(char, shift, option):
- return self._command_name
-
- def _matches_key(self, char, shift, option):
- return self._key == char and self._shift == shift \
- and self._option == option and self.enabled
-
-#----------------------------------------------------------------------
-
-class MenuItemGroup(MenuItem):
- """Class representing a menu item group.
-
- Properties:
- enabled <- boolean Assigning to these changes the corresponding
- checked <- boolean property of all the group's items.
-
- Operators:
- group[index] -> MenuItem
-
- Methods:
- set_items(["text/key", ...])
- Replaces all the items in the group by the specified items.
- """
-
- enabled = overridable_property('enabled')
- checked = overridable_property('checked')
-
- def __init__(self, text_list, cmd):
- self.set_items(text_list)
- self._command_name = cmd
-
- def _num_subitems(self):
- return len(self._items)
-
- def _command_and_args_for_subitem(self, i):
- return self._command_name, (i,)
-
- def get_enabled(self):
- raise AttributeError("'enabled' property of MenuItemGroup is write-only")
-
- def set_enabled(self, state):
- for item in self._items:
- item.enabled = state
-
- def get_checked(self):
- raise AttributeError("'checked' property of MenuItemGroup is write-only")
-
- def set_checked(self, state):
- for item in self._items:
- item.checked = state
-
- def __getitem__(self, index):
- return self._items[index]
-
- def set_items(self, text_list):
- self._items = [SingleMenuItem(text, '') for text in text_list]
-
- def _add_to_platform_menu(self, menu):
- #for item in self._items:
- # item._add_to_platform_menu(menu)
- cmd = self._command_name
- for index, item in enumerate(self._items):
- menu._add_item_to_platform_menu(item, item._name(), cmd, index)
-
- def _search_for_key(self, char, shift, option):
- items = self._items
- for i in xrange(len(items)-1, -1, -1):
- if items[i]._matches_key(char, shift, option):
- return (self._command_name, i)
-
- def _collect_flat_items(self, result):
- for item in self._items:
- item._collect_flat_items(result)
-
-#----------------------------------------------------------------------
-
-_menu_separator = MenuSeparator()
-_dummy_menu_item = SingleMenuItem("", '')
-
-#----------------------------------------------------------------------
-
-class MenuState:
- """A MenuState object is used to enable/disable and check/uncheck
- menu items, and to add or remove items of indexed groups,
- during the menu setup phase of menu command handling.
-
- Each single menu item or item group appears as an attribute of
- the MenuState object, with the command name as the attribute name,
- allowing operations such as
-
- menu_state.copy_cmd.enabled = 1
- menu_state.font_cmd[current_font].checked = 1
-
- The command name may also be used as a mapping index.
-
- Operators:
- menu_state.command_name -> MenuItem
- menu_state['command_name'] -> MenuItem
- """
-
- def __init__(self, menu_list):
- mapping = {}
- for menu in menu_list:
- for item in menu._items:
- cmd = item._command_name
- if cmd:
- mapping[cmd] = item
- self._mapping = mapping
-
- def __getattr__(self, name):
- try:
- return self._mapping[name]
- except KeyError:
- if name.startswith("__"):
- raise AttributeError, name
- return _dummy_menu_item
-
- __getitem__ = __getattr__
-
- def reset(self):
- """Disable and uncheck all items."""
- for item in self._mapping.values():
- item.enabled = 0
- item.checked = None
diff --git a/PyGUI-2.5.3/GUI/Generic/GMouseTrackers.py b/PyGUI-2.5.3/GUI/Generic/GMouseTrackers.py
deleted file mode 100644
index 6644dba..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GMouseTrackers.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Python GUI - Mouse trackers - Generic
-#
-
-from GUI import application
-
-class MouseTracker(object):
- """Iterator used to track movements of the mouse following a mouse_down
- event in a Views. Each call to the next() method returns a mouse_drag
- event, except for the last one, which returns a mouse_up event."""
-
- def __init__(self, view):
- self._view = view
- self._finished = 0
-
- def __iter__(self):
- return self
-
- def next(self):
- if not self._finished:
- event = self._next_mouse_event()
- event.position = event.position_in(self._view)
- if event.kind == 'mouse_up':
- self._finished = 1
- return event
- else:
- raise StopIteration
diff --git a/PyGUI-2.5.3/GUI/Generic/GPixmaps.py b/PyGUI-2.5.3/GUI/Generic/GPixmaps.py
deleted file mode 100644
index af13c33..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GPixmaps.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Python GUI - Pixmap - Generic
-#
-
-from GUI import ImageBase
-
-class Pixmap(ImageBase):
- """A Pixmap is an offscreen area that can be used both as a
- destination for drawing and a source of image data for drawing
- in a View or another Pixmap.
-
- Constructor:
- Pixmap(width, height)
- """
-
- def with_canvas(self, proc):
- """Call the given procedure with a canvas suitable for drawing on
- this Pixmap. The canvas is valid only for the duration of the call,
- and should not be retained beyond it."""
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/GUI/Generic/GPrinting.py b/PyGUI-2.5.3/GUI/Generic/GPrinting.py
deleted file mode 100644
index 28b8ea2..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GPrinting.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Generic
-#
-#------------------------------------------------------------------------------
-
-from __future__ import division
-from math import ceil
-import cPickle as pickle
-from GUI.Properties import overridable_property
-from GUI import application
-
-class PageSetup(object):
- """Holder of information specified by the "Page Setup" command."""
-
- paper_name = overridable_property('paper_name')
- paper_width = overridable_property('paper_width')
- paper_height = overridable_property('paper_height')
- left_margin = overridable_property('left_margin')
- top_margin = overridable_property('top_margin')
- right_margin = overridable_property('right_margin')
- bottom_margin = overridable_property('bottom_margin')
- orientation = overridable_property('orientation')
-
- paper_size = overridable_property('paper_size')
- margins = overridable_property('margins')
- page_width = overridable_property('page_width')
- page_height = overridable_property('page_height')
- page_size = overridable_property('page_size')
- page_rect = overridable_property('page_rect')
- printable_rect = overridable_property('printable_rect') # May not work
- printer_name = overridable_property('printer_name')
-
- _pickle_attributes = ['paper_name', 'paper_size', 'margins',
- 'printer_name', 'orientation']
-
- def __getstate__(self):
- state = {}
- for name in self._pickle_attributes:
- state[name] = getattr(self, name)
- return state
-
- def __setstate__(self, state):
- for name, value in state.iteritems():
- setattr(self, name, value)
-
- def from_string(s):
- """Restore a pickled PageSetup object from a string."""
- return pickle.loads(s)
-
- from_string = staticmethod(from_string)
-
- def to_string(self):
- """Pickle the PageSetup object and return it as a string."""
- return pickle.dumps(self, 2)
-
- def get_paper_size(self):
- return self.paper_width, self.paper_height
-
- def set_paper_size(self, x):
- self.paper_width, self.paper_height = x
-
- def get_margins(self):
- return self.left_margin, self.top_margin, self.right_margin, self.bottom_margin
-
- def set_margins(self, x):
- self.left_margin, self.top_margin, self.right_margin, self.bottom_margin = x
-
- def get_page_width(self):
- return self.paper_width - self.left_margin - self.right_margin
-
- def get_page_height(self):
- return self.paper_height - self.top_margin - self.bottom_margin
-
- def get_page_size(self):
- return (self.page_width, self.page_height)
-
- def get_page_rect(self):
- lm, tm, rm, bm = self.margins
- pw, ph = self.paper_size
- return (lm, tm, pw - rm, ph - bm)
-
-#------------------------------------------------------------------------------
-
-class Printable(object):
- """Mixin class for components implementing the "Print" command."""
-
- printable = overridable_property('printable', "Whether this component should handle the 'Print' command.")
- page_setup = overridable_property('page_setup', "The PageSetup object to use for printing.")
- print_title = overridable_property('print_title', "Title for print job.")
-
- _printable = True
-
- def get_printable(self):
- return self._printable
-
- def set_printable(self, x):
- self._printable = x
-
- def get_print_title(self):
- window = self.window
- if window:
- return window.title
- else:
- return ""
-
- def get_page_setup(self):
- result = None
- model = getattr(self, 'model', None)
- if model:
- result = getattr(model, 'page_setup', None)
- if not result:
- result = application().page_setup
- return result
-
- def setup_menus(self, m):
- if self.printable:
- m.print_cmd.enabled = True
-
- def print_cmd(self):
- if self.printable:
- page_setup = self.page_setup
- if page_setup:
- self.print_view(page_setup)
- else:
- self.pass_to_next_handler('print_cmd')
-
-#------------------------------------------------------------------------------
-
-class Paginator(object):
- """Used internally. A generic pagination algorithm for printing."""
-
- def __init__(self, view, page_setup):
- self.view = view
- extent_width, extent_height = view.get_print_extent()
- #paper_width, paper_height = page_setup.paper_size
- #lm, tm, rm, bm = page_setup.margins
- #page_width = int(paper_width - lm - rm)
- #page_height = int(paper_height - tm - bm)
- page_width, page_height = page_setup.page_size
- if page_width <= 0 or page_height <= 0:
- from AlertFunctions import stop_alert
- stop_alert("Margins are too large for the page size.")
- return
- self.extent_rect = (0, 0, extent_width, extent_height)
- self.page_width = page_width
- self.page_height = page_height
- self.left_margin = page_setup.left_margin
- self.top_margin = page_setup.top_margin
- self.pages_wide = int(ceil(extent_width / page_width))
- self.pages_high = int(ceil(extent_height / page_height))
- self.num_pages = self.pages_wide * self.pages_high
-
- def draw_page(self, canvas, page_num):
- row, col = divmod(page_num, self.pages_wide)
- view_left = col * self.page_width
- view_top = row * self.page_height
- view_right = view_left + self.page_width
- view_bottom = view_top + self.page_height
- view_rect = (view_left, view_top, view_right, view_bottom)
- dx = self.left_margin - view_left
- dy = self.top_margin - view_top
- canvas.translate(dx, dy)
- canvas.rectclip(self.extent_rect)
- canvas.rectclip(view_rect)
- canvas._printing = True
- self.view.draw(canvas, view_rect)
diff --git a/PyGUI-2.5.3/GUI/Generic/GRadioButtons.py b/PyGUI-2.5.3/GUI/Generic/GRadioButtons.py
deleted file mode 100644
index 952f6d0..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GRadioButtons.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Python GUI - Radio buttons - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-
-class RadioButton(Control):
- """RadioButtons are used in groups to represent a 1-of-N
- choice. A group of RadioButtons is coordinated by a
- RadioGroup object. The 'group' property indicates the
- RadioGroup to which it belongs, and the 'value' property
- is the value to which the RadioGroup's value is set
- when this RadioButton is selected."""
-
- group = overridable_property('group', """The RadioGroup to
- which this radio button belongs.""")
-
- value = overridable_property('value', """The value to which
- the associated radio group's 'value' property should be
- set when this radio button is selected.""")
-
- _group = None
- _value = None
-
- #
- # Properties
- #
-
- def get_group(self):
- return self._group
-
- def set_group(self, new_group):
- old_group = self._group
- if new_group is not old_group:
- if old_group:
- old_group._remove_item(self)
- self._group = new_group
- if new_group:
- new_group._add_item(self)
-
- def get_value(self):
- return self._value
-
- def set_value(self, new_value):
- old_value = self._value
- if new_value != old_value:
- self._value = new_value
- self._value_changed()
-
- def _value_changed(self):
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/GUI/Generic/GRadioGroups.py b/PyGUI-2.5.3/GUI/Generic/GRadioGroups.py
deleted file mode 100644
index a6fd792..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GRadioGroups.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# Python GUI - Radio groups - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-from GUI.Actions import Action
-
-class RadioGroup(Properties, Action):
- """A RadioGroup coordinates a group of RadioButtons.
- It has a 'value' property which is equal to the value
- of the currently selected RadioButton. It may be given
- an action procedure to execute when its value changes.
-
- Operations:
- iter(group)
- Returns an iterator over the items of the group.
- """
-
- value = overridable_property('value', """The value of the currently
- selected radio button.""")
-
- _items = None
- _value = None
-
- def __init__(self, items = [], **kwds):
- Properties.__init__(self, **kwds)
- self._items = []
- self.add_items(items)
-
- #
- # Operations
- #
-
- def __iter__(self):
- return iter(self._items)
-
- #
- # Properties
- #
-
- def get_value(self):
- return self._value
-
- def set_value(self, x):
- if self._value <> x:
- self._value = x
- self._value_changed()
- self.do_action()
-
- #
- # Adding and removing items
- #
-
- def add_items(self, items):
- "Add a sequence of RadioButtons to this group."
- for item in items:
- self.add_item(item)
-
- def add_item(self, item):
- "Add a RadioButton to this group."
- item.group = self
-
- def remove_items(self, items):
- "Remove a sequence of RadioButtons from this group."
- for item in items:
- item.group = None
-
- def remove_item(self, item):
- "Remove a RadioButton from this group."
- item.group = None
-
- def _add_item(self, item):
- self._items.append(item)
- self._item_added(item)
-
- def _remove_item(self, item):
- self._items.remove(item)
- self._item_removed(item)
-
- def _item_added(self, item):
- raise NotImplementedError
-
- def _item_removed(self, item):
- raise NotImplementedError
-
- def _value_changed(self):
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/GUI/Generic/GScrollableViews.py b/PyGUI-2.5.3/GUI/Generic/GScrollableViews.py
deleted file mode 100644
index a23f442..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GScrollableViews.py
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# Python GUI - Scrollable Views - Generic
-#
-
-from GUI.Geometry import rect_sized, add_pt, sub_pt
-from GUI.Properties import overridable_property
-from GUI.Geometry import sect_rect
-from GUI import DrawableContainer
-
-default_extent = (300, 300)
-default_line_scroll_amount = (16, 16)
-default_scrolling = 'hv'
-
-class ScrollableView(DrawableContainer):
- """A ScrollableView is a 2D drawing area having its own coordinate
- system and clipping area, with support for scrolling."""
-
- scrolling = overridable_property('scrolling',
- "String containing 'h' for horizontal and 'v' for vertical scrolling.")
-
- hscrolling = overridable_property('hscrolling',
- "True if horizontal scrolling is enabled.")
-
- vscrolling = overridable_property('vscrolling',
- "True if vertical scrolling is enabled.")
-
- extent = overridable_property('extent',
- "Size of scrollable area in local coordinates.")
-
- scroll_offset = overridable_property('scroll_offset',
- "Current scrolling position.")
-
- line_scroll_amount = overridable_property('line_scroll_amount',
- "Tuple specifying horizontal and vertical line scrolling increments.")
-
- background_color = overridable_property('background_color',
- "Color with which to fill areas outside the extent, or None")
-
- #scroll_bars = overridable_property('scroll_bars',
- # "Attached ScrollBar instances.")
- #
- ## _scroll_bars [ScrollBar]
-
- def set(self, **kwds):
- if 'scrolling' in kwds:
- self.scrolling = kwds.pop('scrolling')
- DrawableContainer.set(self, **kwds)
-
- def get_scrolling(self):
- chars = []
- if self.hscrolling:
- chars.append('h')
- if self.vscrolling:
- chars.append('v')
- return ''.join(chars)
-
- def set_scrolling(self, value):
- self.hscrolling = 'h' in value
- self.vscrolling = 'v' in value
-
- def viewed_rect(self):
- """Return the rectangle in local coordinates bounding the currently
- visible part of the extent."""
- return rect_sized(self.scroll_offset, self.size)
-
- def get_print_extent(self):
- return self.extent
-
- def get_background_color(self):
- return self._background_color
-
- def set_background_color(self, x):
- self._background_color = x
- self.invalidate()
-
- #
- # Coordinate transformation
- #
-
- def local_to_container_offset(self):
- return sub_pt(self.position, self.scroll_offset)
-
- #
- # Scrolling
- #
-
- def h_line_scroll_amount(self):
- """Return the horizontal line scroll increment."""
- return self.line_scroll_amount[0]
-
- def v_line_scroll_amount(self):
- """Return the vertical line scroll increment."""
- return self.line_scroll_amount[1]
-
- def h_page_scroll_amount(self):
- """Return the horizontal page scroll increment."""
- return self.width - self.h_line_scroll_amount()
-
- def v_page_scroll_amount(self):
- """Return the vertical page scroll increment."""
- return self.height - self.v_line_scroll_amount()
-
- def scroll_by(self, dx, dy):
- """Scroll by the given amount horizontally and vertically."""
- self.scroll_offset = add_pt(self.scroll_offset, (dx, dy))
-
- def scroll_line_left(self):
- """Called by horizontal scroll bar to scroll left by one line."""
- self.scroll_by(-self.h_line_scroll_amount(), 0)
-
- def scroll_line_right(self):
- """Called by horizontal scroll bar to scroll right by one line."""
- self.scroll_by(self.h_line_scroll_amount(), 0)
-
- def scroll_line_up(self):
- """Called by vertical scroll bar to scroll up by one line."""
- self.scroll_by(0, -self.v_line_scroll_amount())
-
- def scroll_line_down(self):
- """Called by vertical scroll bar to scroll down by one line."""
- self.scroll_by(0, self.v_line_scroll_amount())
-
- def scroll_page_left(self):
- """Called by horizontal scroll bar to scroll left by one page."""
- self.scroll_by(-self.h_page_scroll_amount(), 0)
-
- def scroll_page_right(self):
- """Called by horizontal scroll bar to scroll right by one page."""
- self.scroll_by(self.h_page_scroll_amount(), 0)
-
- def scroll_page_up(self):
- """Called by vertical scroll bar to scroll up by one page."""
- self.scroll_by(0, -self.v_page_scroll_amount())
-
- def scroll_page_down(self):
- """Called by vertical scroll bar to scroll down by one page."""
- self.scroll_by(0, self.v_page_scroll_amount())
-
- #
- # Background drawing
- #
-
- def _draw_background(self, canvas, clip_rect):
- # If the view has a background color, uses it to fill the parts of the
- # clip_rect that are outside the view's extent and returns the remaining
- # rectangle. Otherwise, returns the clip_rect unchanged.
- color = self._background_color
- if color:
- vl, vt, vr, vb = clip_rect
- ew, eh = self.extent
- if vr > ew or vb > eh:
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: old backcolor =", canvas.backcolor ###
- canvas.gsave()
- canvas.backcolor = color
- if ew < vr:
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: erasing", (ew, vt, vr, vb) ###
- canvas.erase_rect((ew, vt, vr, vb))
- if eh < vb:
- if getattr(self, "_debug_bg", False): ###
- print "ScrollableView: erasing", (vl, eh, ew, vb) ###
- canvas.erase_rect((vl, eh, ew, vb))
- canvas.grestore()
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: restored backcolor =", canvas.backcolor ###
- return sect_rect(clip_rect, (0, 0, ew, eh))
- return clip_rect
diff --git a/PyGUI-2.5.3/GUI/Generic/GSliders.py b/PyGUI-2.5.3/GUI/Generic/GSliders.py
deleted file mode 100644
index a1a9822..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GSliders.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Python GUI - Slider - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control
-
-class Slider(Control, Action):
- """A control for entering a value by moving a knob along a scale.
-
- Constructor:
- Slider(orient)
- where orient = 'h' for horizontal or 'v' for vertical.
- """
-
- _default_length = 100
-
- value = overridable_property('value', "The current value of the control")
- min_value = overridable_property('min_value', "Minimum value of the control")
- max_value = overridable_property('max_value', "Maximum value of the control")
- range = overridable_property('range', "Tuple (min_value, max_value)")
- ticks = overridable_property('ticks', "Number of tick marks")
- discrete = overridable_property('discrete', "Whether to constrain value to ticks")
- live = overridable_property('live', "Whether to invoke action continuously while dragging")
-
- def get_range(self):
- return (self.min_value, self.max_value)
-
- def set_range(self, x):
- self.min_value = x[0]
- self.max_value = x[1]
diff --git a/PyGUI-2.5.3/GUI/Generic/GStdMenus.py b/PyGUI-2.5.3/GUI/Generic/GStdMenus.py
deleted file mode 100644
index 005984a..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GStdMenus.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#-------------------------------------------------------------------------------
-#
-# PyGUI - Standard Menus - Generic
-#
-#-------------------------------------------------------------------------------
-
-from GUI.Compatibility import set
-from GUI import Menu
-from GUI import MenuList
-
-#-------------------------------------------------------------------------------
-
-class CommandSet(set):
- """A set of menu command names.
-
- Constructors:
- CommandSet(string)
- CommandSet(sequence of strings)
-
- Operations:
- string in CommandSet
- CommandSet + x
- CommmandSet - x
- x + CommandSet
- x - CommandSet
- CommandSet += x
- CommandSet -= x
- where x is a CommandSet, a string or a sequence of strings
- """
-
- def __init__(self, arg = None):
- if arg:
- if isinstance(arg, basestring):
- arg = [arg]
- set.__init__(self, arg)
-
- def __or__(self, other):
- return set.__or__(self, as_command_set(other))
-
- __ror__ = __add__ = __radd__ = __or__
-
- def __ior__(self, other):
- return set.__ior__(self, as_command_set(other))
-
- __iadd__ = __ior__
-
- def __sub__(self, other):
- return set.__sub__(self, as_command_set(other))
-
- def __rsub__(self, other):
- return as_command_set(other) - self
-
- def __isub__(self, other):
- return set.__isub__(self, as_command_set(other))
-
-#-------------------------------------------------------------------------------
-
-def as_command_set(x):
- if not isinstance(x, CommandSet):
- if isinstance(x, basestring):
- x = [x]
- x = CommandSet(x)
- return x
-
-def filter_menu_items(items, include):
- result = []
- sep = False
- for item in items:
- if item == "-":
- sep = True
- elif item[1] in include:
- if sep:
- result.append("-")
- sep = False
- result.append(item)
- return result
-
-def build_menus(spec_list, substitutions = {}, include = None, exclude = None):
- if include is None:
- include = sum(default_includes)
- include = include + sum(always_include)
- if exclude is not None:
- include = include - exclude
- menus = []
- for title, items, special in spec_list:
- items = filter_menu_items(items, include)
- if items:
- menus.append(Menu(title, items, special = special, substitutions = substitutions))
- return MenuList(menus)
-
-#-------------------------------------------------------------------------------
-
-fundamental_cmds = CommandSet(['quit_cmd'])
-help_cmds = CommandSet(['about_cmd', 'help_cmd'])
-pref_cmds = CommandSet(['preferences_cmd'])
-file_cmds = CommandSet(['new_cmd', 'open_cmd', 'close_cmd', 'save_cmd', 'save_as_cmd', 'revert_cmd'])
-print_cmds = CommandSet(['page_setup_cmd', 'print_cmd'])
-edit_cmds = CommandSet(['undo_cmd', 'redo_cmd', 'cut_cmd', 'copy_cmd', 'paste_cmd', 'clear_cmd', 'select_all_cmd'])
-
-always_include = [fundamental_cmds, edit_cmds]
-default_includes = [help_cmds, pref_cmds, file_cmds, print_cmds]
-
-#-------------------------------------------------------------------------------
-
-if __name__ == "__main__":
- s1 = CommandSet('a')
- print "s1 =", s1
- s2 = CommandSet(['a', 'b'])
- print "s2 =", s2
- s3 = s2 + 'c'
- print "s3 =", s3
- s4 = 'd' + s3
- print "s4 =", s4
- s5 = s4 - 'b'
- print "s5 =", s5
- s6 = ['a', 'b', 'c', 'd', 'e', 'f'] - s5
- print "s6 =", s6
diff --git a/PyGUI-2.5.3/GUI/Generic/GTasks.py b/PyGUI-2.5.3/GUI/Generic/GTasks.py
deleted file mode 100644
index 2582c77..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GTasks.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# PyGUI - Tasks - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class Task(Properties):
- """A Task represents an action to be performed after a specified
- time interval, either once or repeatedly.
-
- Constructor:
- Task(proc, interval, repeat = False, start = True)
- Creates a task to call the given proc, which should be
- a callable object of no arguments, after the specified
- interval in seconds from the time the task is scheduled.
- If repeat is true, the task will be automatically re-scheduled
- each time the proc is called. If start is true, the task will be
- automatically scheduled upon creation; otherwise the start()
- method must be called to schedule the task.
- """
-
- interval = overridable_property('interval', "Time in seconds between firings")
- repeat = overridable_property('repeat', "Whether to fire repeatedly or once only")
-
- def __del__(self):
- self.stop()
-
- scheduled = overridable_property('scheduled',
- "True if the task is currently scheduled. Read-only.")
-
- def start(self):
- """Schedule the task if it is not already scheduled."""
- raise NotImplementedError("GUI.Task.start")
-
- def stop(self):
- """Unschedules the task if it is currently scheduled."""
- raise NotImplementedError("GUI.Task.stop")
diff --git a/PyGUI-2.5.3/GUI/Generic/GTextEditors.py b/PyGUI-2.5.3/GUI/Generic/GTextEditors.py
deleted file mode 100644
index 58ec145..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GTextEditors.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Python GUI - Text Editor - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Component
-from GUI import EditCmdHandler
-from GUI.Printing import Printable
-
-class TextEditor(Component, EditCmdHandler, Printable):
- """A component for editing substantial amounts of text. The text is
- kept internally to the component and cannot be shared between views."""
-
- text = overridable_property('text', "The contents as a string.")
- text_length = overridable_property('text_length', "Number of characters in the text.")
- selection = overridable_property('selection', "Range of text selected.")
- font = overridable_property('font')
- tab_spacing = overridable_property('tab_spacing', "Distance between tab stops")
-
- def setup_menus(self, m):
- Component.setup_menus(self, m)
- EditCmdHandler.setup_menus(self, m)
- Printable.setup_menus(self, m)
-
- def key_down(self, e):
- if e.key == 'enter':
- self.pass_to_next_handler('key_down', e)
- else:
- Component.key_down(self, e)
-
- def print_view(self, page_setup):
- from TextEditorPrinting import TextEditorPrintView
- view = TextEditorPrintView(self, page_setup)
- view.print_view(page_setup)
diff --git a/PyGUI-2.5.3/GUI/Generic/GTextFields.py b/PyGUI-2.5.3/GUI/Generic/GTextFields.py
deleted file mode 100644
index 8314920..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GTextFields.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# Python GUI - Text fields - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import ActionBase, action_property
-from GUI import application
-from GUI import Control
-from GUI import EditCmdHandler
-
-class TextField(Control, ActionBase, EditCmdHandler):
- """A control for entering and editing small amounts of text."""
-
- text = overridable_property('text')
- selection = overridable_property('selection', "Range of text selected.")
- multiline = overridable_property('multiline', "Multiple text lines allowed.")
- password = overridable_property('password', "Display characters obfuscated.")
- enter_action = action_property('enter_action', "Action to be performed "
- "when the Return or Enter key is pressed.")
- escape_action = action_property('escape_action', "Action to be performed "
- "when the Escape key is pressed.")
-
- _may_be_password = True
-
- #_tabbable = True
- _default_tab_stop = True
- _user_tab_stop_override = False
- _enter_action = 'do_default_action'
- _escape_action = 'do_cancel_action'
-
- _intercept_tab_key = True
-
- def __init__(self, **kwds):
- self._multiline = kwds.pop('multiline')
- Control.__init__(self, **kwds)
-
- def get_multiline(self):
- return self._multiline
-
- def key_down(self, event):
- #print "GTextField.key_down for", self ###
- c = event.char
- if c == '\r':
- if event.key == 'enter' or not self._multiline:
- self.do_enter_action()
- return
- if c == '\x1b':
- self.do_escape_action()
- return
- if c == '\t':
- if self._intercept_tab_key:
- self.pass_event_to_next_handler(event)
- return
- Control.key_down(self, event)
-
- def setup_menus(self, m):
- Control.setup_menus(self, m)
- EditCmdHandler.setup_menus(self, m)
-
- def do_enter_action(self):
- self.do_named_action('enter_action')
-
- def do_escape_action(self):
- self.do_named_action('escape_action')
-
- def get_text_length(self):
- # Implementations can override this if they have a more
- # efficient way of getting the text length.
- return len(self.text)
-
- def get_value(self):
- return self.text
-
- def set_value(self, x):
- self.text = x
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GUtils.py b/PyGUI-2.5.3/GUI/Generic/GUtils.py
deleted file mode 100644
index 768eab7..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GUtils.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Utilities - Generic
-#
-#--------------------------------------------------------------------------
-
-def splitdict(src, *names, **defaults):
- result = {}
- for name in names:
- if name in src:
- result[name] = src.pop(name)
- for name, default in defaults.iteritems():
- result[name] = src.pop(name, default)
- return result
diff --git a/PyGUI-2.5.3/GUI/Generic/GViewBases.py b/PyGUI-2.5.3/GUI/Generic/GViewBases.py
deleted file mode 100644
index 0274840..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GViewBases.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#
-# Python GUI - View Base - Generic
-#
-
-from GUI.Properties import overridable_property
-
-class ViewBase(object):
- """ViewBase is an abstract base class for user-defined views.
- It provides facilities for handling mouse and keyboard events
- and associating the view with one or more models, and default
- behaviour for responding to changes in the models."""
-
- models = overridable_property('models',
- "List of Models being observed. Do not modify directly.")
-
- model = overridable_property('model',
- "Convenience property for views which observe only one Model.")
-
- cursor = overridable_property('cursor',
- "The cursor to display over the view.")
-
- # _models [Model]
-
- _cursor = None
-
- def __init__(self):
- self._models = []
-
- def destroy(self):
- #print "GViewBase.destroy:", self ###
- for m in self._models[:]:
- #print "GViewBase.destroy: removing model", m ###
- self.remove_model(m)
-
- def setup_menus(self, m):
- pass
-
- #
- # Getting properties
- #
-
- def get_model(self):
- models = self._models
- if models:
- return self._models[0]
- else:
- return None
-
- def get_models(self):
- return self._models
-
- #
- # Setting properties
- #
-
- def set_model(self, new_model):
- models = self._models
- if not (len(models) == 1 and models[0] == new_model):
- for old_model in models[:]:
- self.remove_model(old_model)
- if new_model:
- self.add_model(new_model)
-
- #
- # Model association
- #
-
- def add_model(self, model):
- """Add the given Model to the set of models being observed."""
- if model not in self._models:
- self._models.append(model)
- model.add_view(self)
- self.model_added(model)
-
- def remove_model(self, model):
- """Remove the given Model from the set of models being observed."""
- if model in self._models:
- self._models.remove(model)
- model.remove_view(self)
- self.model_removed(model)
-
- def model_added(self, model):
- """Called after a model has been added to the view."""
- pass
-
- def model_removed(self, model):
- """Called after a model has been removed from the view."""
- pass
-
- #
- # Input event handling
- #
-
- def track_mouse(self):
- """Following a mouse_down event, returns an iterator which can be used
- to track the movements of the mouse until the mouse is released.
- Each call to the iterator's next() method returns a mouse_drag
- event, except for the last one, which returns a mouse_up event."""
- raise NotImplementedError
-
- def targeted(self):
- """Called when the component becomes the target within its Window."""
- pass
-
- def untargeted(self):
- """Called when the component ceases to be the target within its Window."""
- pass
-
- #
- # Cursors
- #
-
- def get_cursor(self, x):
- return self._cursor
-
- def set_cursor(self, x):
- self._cursor = x
- self._cursor_changed()
-
- #
- # Callbacks
- #
-
- def model_changed(self, model, *args, **kwds):
- """Default method called by the attached Model's notify_views
- method. Default is to invalidate the whole view."""
- self.invalidate()
-
- def model_destroyed(self, model):
- """Called when an attached model is destroyed. Default is to
- destroy the window containing this view."""
- win = self.window
- if win:
- win.destroy()
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GViews.py b/PyGUI-2.5.3/GUI/Generic/GViews.py
deleted file mode 100644
index 87e136c..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GViews.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Python GUI - Views - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Geometry import add_pt, sub_pt, rect_sized
-from GUI import DrawableContainer
-
-class View(DrawableContainer):
- """A View is a 2D drawing area having its own coordinate
- system and clipping area."""
-
- _default_size = (100, 100)
-
diff --git a/PyGUI-2.5.3/GUI/Generic/GWindows.py b/PyGUI-2.5.3/GUI/Generic/GWindows.py
deleted file mode 100644
index cf03f79..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GWindows.py
+++ /dev/null
@@ -1,257 +0,0 @@
-#
-# Python GUI - Windows - Generic
-#
-
-import Exceptions
-from GUI.Properties import overridable_property
-from GUI import Container
-from GUI import application
-
-class Window(Container):
- """Top-level Container."""
-
- menus = overridable_property('menus', "Menus to be available when this window is active.")
- document = overridable_property('document', "Document with which this window is associated.")
- title = overridable_property('title', "Title of the window.")
- auto_position = overridable_property('auto_position', "Whether to position automatically when first shown.")
- target = overridable_property('target', "Current target for key events and menu messages.")
- tab_chain = overridable_property('tab_chain', "List of subcomponents in tabbing order.")
- visible = overridable_property('visible', "Whether the window is currently shown.")
-
- keeps_document_open = True
-
- _default_width = 200
- _default_height = 200
- _modal_styles = ('modal_dialog', 'alert')
- _dialog_styles = ('nonmodal_dialog', 'modal_dialog', 'alert')
-
- _menus = []
- _document = None
- _closable = 0
- _auto_position = True
- _tab_chain = None
-
- def __init__(self, style = 'standard', closable = None, **kwds):
- if closable is None:
- raise Exceptions.InternalError(
- "'closable' parameter unspecified in call to generic Window.__init__")
- Container.__init__(self, **kwds)
- self._style = style
- self._dialog_style = style.find('dialog') >= 0
- self._closable = closable
- application()._add_window(self)
-
- def destroy(self):
- """Detaches the window from document and application and removes it
- from the screen."""
- self.set_document(None)
- application()._remove_window(self)
- Container.destroy(self)
-
- #
- # Message handling
- #
-
- def next_handler(self):
- if self._document:
- return self._document
- else:
- return application()
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
- #
- # Menus
- #
-
- def get_menus(self):
- return self._menus
-
- def set_menus(self, x):
- self._menus = x
-
- #
- # Document association
- #
-
- def get_document(self):
- return self._document
-
- def set_document(self, x):
- if self._document != x:
- if self._document:
- self._document._windows.remove(self)
- self._document = x
- if self._document:
- self._document._windows.append(self)
- self.update_title()
-
- #
- # Title
- #
-
- def update_title(self):
- """Update the window's title after a change in its document's title."""
- doc = self._document
- if doc:
- self.set_title(doc.title)
-
- #
- # Showing and Positioning
- #
-
- def get_auto_position(self):
- return self._auto_position
-
- def set_auto_position(self, v):
- self._auto_position = v
-
- def center(self):
- """Position the window in the centre of the screen."""
- print "GWindow.center" ###
- sl, st, sr, sb = self._screen_rect()
- w, h = self.size
- l = (sr - sl - w) // 2
- t = (sb - st - h) // 2
- self.position = (l, t)
-
- def centre(self):
- self.center()
-
- def show(self):
- if self._auto_position:
- if self._style == 'standard':
- self._stagger()
- else:
- self.center()
- self._auto_position = False
- self._show()
-
- def _stagger(self):
- pass
-
- def _show(self):
- self.visible = True
-
- def hide(self):
- self.visible = False
-
- #
- # Menu commands
- #
-
- def setup_menus(self, m):
- Container.setup_menus(self, m)
- app = application()
- if self._closable:
- m.close_cmd.enabled = 1
-
- def close_cmd(self):
- """If this window is the only window belonging to a document
- whose keeps_document_open attribute is true, then close the
- document, else destroy the window."""
-# app = application()
-# if not app._may_close_a_window():
-# #print "GWindow.close_cmd: Quitting the application" ###
-# app.quit_cmd()
-# else:
- doc = self._document
- n = 0
- if doc:
- for win in doc._windows:
- if win is not self and win.keeps_document_open:
- n += 1
- if doc and n == 0:
- doc.close_cmd()
- else:
- self.destroy()
-
- #
- # Tabbing
- #
-
- def get_tab_chain(self):
- chain = self._tab_chain
- if chain is None:
- chain = []
- self._build_tab_chain(chain)
- self._tab_chain = chain
- #print "Window.get_tab_chain:", chain ###
- return chain
-
- def _invalidate_tab_chain(self):
- self._tab_chain = None
-
- def _tab_to_next(self):
- self._tab_to(1)
-
- def _tab_to_prev(self):
- self._tab_to(-1)
-
- def _tab_to(self, direction):
- #print "GWindow._tab_to:", direction ###
- chain = self.tab_chain
- if chain:
- old_target = application().target
- new_target = None
- n = len(chain)
- try:
- i = chain.index(old_target)
- except ValueError:
- if direction > 0:
- i = -1
- else:
- i = n
- k = n
- while k:
- k -= 1
- i = (i + direction) % n
- comp = chain[i]
- if comp._is_targetable():
- new_target = comp
- break
- if new_target:
- if old_target:
- old_target._tab_out()
- new_target._tab_in()
-
- def key_down(self, event):
- #print "GWindow.key_down:", event ###
- if self._generic_tabbing and event.char == '\t':
- #print "GWindow.key_down: doing generic tabbing" ###
- if event.shift:
- self._tab_to_prev()
- else:
- self._tab_to_next()
- else:
- Container.key_down(self, event)
-
-# def _default_key_event(self, event):
-# #print "GWindow._default_key_event" ###
-# self.pass_event_to_next_handler(event)
-
- #
- # Other
- #
-
- def get_window(self):
- return self
-
- def first_dispatcher(self):
- return self
-
- def _document_needs_saving(self, state):
- pass
-
- def modal_event_loop(self):
- """Loop reading and handling events for the given window until
- exit_event_loop() is called. Interaction with other windows is prevented
- (although enabled application-wide menu commands can be used)."""
- # Implementations can override this together with exit_modal_event_loop()
- # to implement modal event loops in a different way.
- application()._event_loop(self)
-
- def exit_modal_event_loop(self):
- # Cause the current call to modal_event_loop() to exit.
- application()._exit_event_loop()
diff --git a/PyGUI-2.5.3/GUI/Generic/Globals.py b/PyGUI-2.5.3/GUI/Generic/Globals.py
deleted file mode 100644
index e822339..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Globals.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Generic - Global variables and functions
-#
-#--------------------------------------------------------------------
-
-import os, sys
-
-_main_file_name = os.path.basename(sys.argv[0])
-application_name = os.path.splitext(_main_file_name)[0]
-
-_application = None
-
-def application():
- """Returns the global Application object. Creates a default one if needed."""
- global _application
- print _application
- if not _application:
- from GUI import Application
- _application = Application()
- return _application
-
-def run():
- """Runs the application, retaining control until the application is quit."""
- application().run()
-
diff --git a/PyGUI-2.5.3/GUI/Generic/Grid.py b/PyGUI-2.5.3/GUI/Generic/Grid.py
deleted file mode 100644
index 67bdb92..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Grid.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Grid layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Grid(Frame):
-
- def __init__(self, items, row_spacing = 5, column_spacing = 10,
- align = 'l', equalize = '', expand_row = None, expand_column = None,
- padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- num_rows = len(items)
- num_cols = max([len(row) for row in items])
- col_widths = [0] * num_cols
- row_heights = [0] * num_rows
- for i, row in enumerate(items):
- for j, item in enumerate(row):
- if item:
- row_heights[i] = max(row_heights[i], item.height)
- col_widths[j] = max(col_widths[j], item.width)
- tot_width = 0
- row_top = 0
- row_gap = 0
- vanchor = 't'
- for i, row in enumerate(items):
- row_height = row_heights[i]
- row_top += row_gap
- col_left = 0
- col_gap = 0
- hanchor = 'l'
- if i == expand_row:
- vanchor = 'tb'
- for j, item in enumerate(row):
- col_width = col_widths[j]
- col_left += col_gap
- if item:
- if 'l' in align:
- x = 0
- elif 'r' in align:
- x = col_width - item.width
- else:
- x = (col_width - item.width) // 2
- if 't' in align:
- y = 0
- elif 'b' in align:
- y = row_height - item.height
- else:
- y = (row_height - item.height) // 2
- item.position = (hpad + col_left + x, vpad + row_top + y)
- if j == expand_column:
- item.anchor = 'lr' + vanchor
- else:
- item.anchor = hanchor + vanchor
- self.add(item)
- if j == expand_column:
- hanchor = 'r'
- col_left += col_width
- col_gap = column_spacing
- tot_width = max(tot_width, col_left)
- if i == expand_row:
- vanchor = 'b'
- row_top += row_height
- row_gap = row_spacing
- tot_height = row_top
- self.size = (tot_width + 2 * hpad, tot_height + 2 * vpad)
- self.set(**kwds)
-
-export(Grid)
diff --git a/PyGUI-2.5.3/GUI/Generic/GridView.py b/PyGUI-2.5.3/GUI/Generic/GridView.py
deleted file mode 100644
index c201f90..0000000
--- a/PyGUI-2.5.3/GUI/Generic/GridView.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Grid View - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import ScrollableView, rgb
-
-class GridView(ScrollableView):
- """A ScrollableView consisting of a grid of equal-sized cells."""
-
- num_columns = overridable_property('num_columns',
- "Width of the view in columns")
-
- num_rows = overridable_property('num_rows',
- "Height of the view in rows")
-
- cell_size = overridable_property('cell_size',
- "Size of each cell")
-
- backcolor = overridable_property('backcolor',
- "Background fill colour")
-
- _cell_size = (32, 32)
- _num_rows = 0
- _num_columns = 0
- _backcolor = rgb(1, 1, 1, 1)
-
- def __init__(self, num_rows, num_columns, cell_size, **kwds):
- ScrollableView.__init__(self)
- self._num_rows = num_rows
- self._num_columns = num_columns
- self._cell_size = cell_size
- self._update_extent()
- self.set(**kwds)
-
- def get_cell_size(self):
- return self._cell_size
-
- def set_cell_size(self, x):
- self._cell_size = x
- self._update_extent()
-
- def get_num_rows(self):
- return self._num_rows
-
- def set_num_rows(self, x):
- self._num_rows = x
- self._update_extent()
-
- def get_num_columns(self):
- return self._num_columns
-
- def set_num_columns(self, x):
- self._num_columns = x
- self._update_extent()
-
- def _update_extent(self):
- cw, ch = self._cell_size
- nr = self._num_rows
- nc = self._num_columns
- self.extent = (cw * nc, ch * nr)
-
- def cell_rect(self, row, col):
- w, h = self._cell_size
- l = col * w
- t = row * h
- return (l, t, l + w, t + h)
-
- def get_backcolor(self):
- return self._backcolor
-
- def set_backcolor(self, x):
- self._backcolor = x
-
- def cell_containing_point(self, p):
- x, y = p
- cw, ch = self.cell_size
- return (int(y // ch), int(x // cw))
-
- def draw(self, canvas, update_rect):
- canvas.backcolor = self.backcolor
- canvas.erase_rect(update_rect)
- ul, ut, ur, ub = update_rect
- nr = self._num_rows
- nc = self._num_columns
- cw, ch = self.cell_size
- row0 = max(0, int(ut // ch))
- row1 = min(nr, int(ub // ch) + 1)
- col0 = max(0, int(ul // cw))
- col1 = min(nc, int(ur // cw) + 1)
- row_range = xrange(row0, row1)
- col_range = xrange(col0, col1)
- for row in row_range:
- for col in col_range:
- rect = self.cell_rect(row, col)
- self.draw_cell(canvas, row, col, rect)
-
- def draw_cell(self, canvas, row, col, rect):
- """Should draw the cell at the given row and colum inside the given rect."""
- pass
-
- def mouse_down(self, event):
- row, col = self.cell_containing_point(event.position)
- nr = self._num_rows
- nc = self._num_columns
- if 0 <= row < nr and 0 <= col < nc:
- self.click_cell(row, col, event)
-
- def click_cell(self, row, col, event):
- """Called when a mouse_down event has occured in the indicated cell."""
- pass
-
-export(GridView)
diff --git a/PyGUI-2.5.3/GUI/Generic/LayoutUtils.py b/PyGUI-2.5.3/GUI/Generic/LayoutUtils.py
deleted file mode 100644
index 6b49662..0000000
--- a/PyGUI-2.5.3/GUI/Generic/LayoutUtils.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Utilities for use by layout components - Generic
-#
-#---------------------------------------------------------------------------
-
-def equalize_components(items, flags):
- if items:
- if 'w' in flags:
- width = max([item.width for item in items if item])
- for item in items:
- if item:
- item.width = width
- if 'h' in flags:
- height = max([item.height for item in items if item])
- for item in items:
- if item:
- item.height = height
diff --git a/PyGUI-2.5.3/GUI/Generic/MenuList.py b/PyGUI-2.5.3/GUI/Generic/MenuList.py
deleted file mode 100644
index 16892c3..0000000
--- a/PyGUI-2.5.3/GUI/Generic/MenuList.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Python GUI - Menu Lists - Generic
-#
-
-from GUI import export
-
-class MenuList(list):
- """A MenuList is a sequence of Menus with methods for finding
- menus and menu items by command."""
-
- def menu_with_command(self, cmd):
- """Returns the menu containing the given command, or None
- if there is no such menu in the list."""
- for menu in self:
- if menu.item_with_command(cmd):
- return menu
- return None
-
- def item_with_command(self, cmd):
- """Returns the menu item having the given command, or None
- if there is no such item."""
- for menu in self:
- item = menu.item_with_command(cmd)
- if item:
- return item
- return None
-
-export(MenuList)
diff --git a/PyGUI-2.5.3/GUI/Generic/MessageHandler.py b/PyGUI-2.5.3/GUI/Generic/MessageHandler.py
deleted file mode 100644
index 2407b90..0000000
--- a/PyGUI-2.5.3/GUI/Generic/MessageHandler.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#
-# Python GUI - Message handlers - Generic
-#
-
-from GUI import export
-
-class MessageHandler(object):
- """A MessageHandler is an object which can form part of the
- message handling hierarchy. This hierarchy is used to handle
- keyboard events, menu commands, and action messages generated
- by buttons or other components.
-
- At any given moment, one of the application's windows is the
- 'target window' for messages. Within the target window, some
- component is designated as the 'target object', or just 'target'.
-
- Messages are initially delivered to the target object, and
- passed up the hierarchy using the handle() method. At each step,
- if the object has a method with the same name as the message, it
- is called with the message's arguments. Otherwise the message is
- passed on to the object determined by the next_handler() method.
- Usually this is the object's container, but need not be.
-
- The become_target() method is used to make a component the target
- within its window. The targeted() and untargeted() methods are
- called to notify a component when it has become or ceased to be
- the target. The is_target() method can be used to test whether a
- component is currently the target."""
-
- #----- Event handling -----
-
- def handle_event_here(self, event):
- """Send an event message to this object, ignoring the event if
- there is no method to handle it."""
- self.handle_here(event.kind, event)
-
- def handle_event(self, event):
- """Send an event message up the message path until a method
- is found to handle it."""
- self.handle(event.kind, event)
-
- #----- Message handling -----
-
- def handle_here(self, message, *args):
- """If there is a method with the same name as the message, call
- it with the given args. Otherwise, ignore the message."""
- method = getattr(self, message, None)
- if method:
- method(*args)
-
- def handle(self, message, *args):
- """If there is a method with the same name as the message, call
- it with the given args. Otherwise, pass the message up to the
- next handler."""
- #print "MessageHandler: handling", message, "for", self ###
- method = getattr(self, message, None)
- if method:
- #print "MessageHandler: calling method from", method.im_func.func_code.co_filename ###
- method(*args)
- else:
- #print "MessageHandler: passing to next handler" ###
- self.pass_to_next_handler(message, *args)
-
- def pass_event_to_next_handler(self, event):
- """Pass the given event on to the next handler, if any."""
- self.pass_to_next_handler(event.kind, event)
-
- def pass_to_next_handler(self, message, *args):
- """Pass the given message on to the next handler, if any."""
- next = self.next_handler()
- if next:
- next.handle(message, *args)
-
- def next_handler(self):
- """Return the object, if any, to which messages not handled
- by this object should be passed on."""
- return None
-
- #----- Default handlers and callbacks -----
-
- def _setup_menus(self, m):
- self.pass_to_next_handler('_setup_menus', m)
- #print "MessageHandler._setup_menus: calling setup_menus for", self ###
- self.setup_menus(m)
-
- def setup_menus(self, m):
- """Called before a menu is pulled down, to allow the Component to
- enable menu commands that it responds to."""
- pass
-
- _pass_key_events_to_platform = False
-
- def _default_key_event(self, event):
- #print "MessageHandler._default_key_event for", self ###
- #print "...originator =", event._originator ###
- if event._originator is self and self._pass_key_events_to_platform:
- #print "...passing to platform" ###
- event._not_handled = True
- else:
- self.pass_event_to_next_handler(event)
-
- def _default_mouse_event(self, event):
- event._not_handled = True
-
- def _event_custom_handled(self, event):
- # Give custom event handlers of this component a chance to handle
- # the event. If it reaches a default event method of this component,
- # the event is not passed to the next handler and false is returned.
- # If it is handled by an overridden method or explicitly passed to
- # the next handler, true is returned.
- event._originator = self
- self.handle_event(event)
- return not event._not_handled
-
- def key_down(self, event):
- #print "MessageHandler.key_down for", self ###
- self._default_key_event(event)
-
- def key_up(self, event):
- self._default_key_event(event)
-
- def mouse_down(self, event):
- self._default_mouse_event(event)
-
- def mouse_drag(self, event):
- self._default_mouse_event(event)
-
- def mouse_up(self, event):
- self._default_mouse_event(event)
-
- def mouse_move(self, event):
- self._default_mouse_event(event)
-
- def mouse_enter(self, event):
- self._default_mouse_event(event)
-
- def mouse_leave(self, event):
- self._default_mouse_event(event)
-
-export(MessageHandler)
diff --git a/PyGUI-2.5.3/GUI/Generic/ModalDialog.py b/PyGUI-2.5.3/GUI/Generic/ModalDialog.py
deleted file mode 100644
index c0d7922..0000000
--- a/PyGUI-2.5.3/GUI/Generic/ModalDialog.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Python GUI - Modal Dialogs - Generic
-#
-
-from GUI import application, export
-from GUI import Dialog
-
-class ModalDialog(Dialog):
-
- def __init__(self, style = 'modal_dialog', **kwds):
- Dialog.__init__(self, style = style, **kwds)
-
- def present(self):
- self._result = None
- self._dismissed = 0
- self.show()
- app = application()
- try:
- while not self._dismissed:
- self.modal_event_loop()
- finally:
- self.hide()
- return self._result
-
- def dismiss(self, result = 0):
- self._result = result
- self._dismissed = 1
- self.exit_modal_event_loop()
-
- def close_cmd(self):
- self.dismiss()
-
- def next_handler(self):
- return None
-
- def ok(self):
- self.dismiss(True)
-
- def cancel(self):
- self.dismiss(False)
-
-export(ModalDialog)
diff --git a/PyGUI-2.5.3/GUI/Generic/Model.py b/PyGUI-2.5.3/GUI/Generic/Model.py
deleted file mode 100644
index ff69691..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Model.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# Python GUI - Models - Generic
-#
-
-import weakref
-from GUI import export
-from GUI.Properties import Properties, overridable_property
-
-# List of views for a model is kept separately so that models
-# can be pickled without fear of accidentally trying to pickle
-# the user interface.
-
-_model_views = weakref.WeakKeyDictionary() # {Model: [object]}
-
-class Model(Properties):
- """A Model represents an application object which can appear in a View.
- Each Model can have any number of Views attached to it. When a Model is
- changed, it should notify all of its Views so that they can update
- themselves.
-
- The 'parent' attribute of a Model is treated specially when pickling.
- If it refers to an object having a 'pickle_as_parent_model' attribute
- whose value is false, the 'parent' attribute is not pickled. This allows
- a Model to have a Document as a parent without the Document being pickled
- along with the Model.
- """
-
- views = overridable_property('views',
- "List of objects observing this model. Do not modify directly.")
-
- parent = None # Model
-
- def __init__(self, parent = None, **kwds):
- Properties.__init__(self, **kwds)
- if parent:
- self.parent = parent
-
- def destroy(self):
- """All views currently observing this model are removed, and their
- 'model_destroyed' methods, if any, are called with the model as
- an argument."""
- for view in self.views[:]:
- self.remove_view(view)
- self._call_if_present(view, 'model_destroyed', self)
-
- #
- # Properties
- #
-
- def get_views(self):
- views = _model_views.get(self)
- if views is None:
- views = []
- _model_views[self] = views
- return views
-
- #
- # Pickling behaviour
- #
-
- def __getstate__(self):
- state = self.__dict__
- parent = self.parent
- if not getattr(parent, 'pickle_as_parent_model', True):
- state = state.copy()
- del state['parent']
- return state
-
- def __setstate__(self, state):
- self.__dict__.update(state)
-
- #
- # Adding and removing views
- #
-
- def add_view(self, view):
- """Add the given object as an observer of this model. The view will
- typically be a View subclass, but need not be. If the view is not
- already an observer of this model and defines an 'add_model' method,
- this method is called with the model as an argument."""
- views = self.views
- if view not in views:
- views.append(view)
- self._call_if_present(view, 'add_model', self)
-
- def remove_view(self, view):
- """If the given object is currently an observer of this model, it
- is removed, and if it defines a 'remove_model' method, this method
- is called with the model as an argument."""
- views = self.views
- if view in views:
- views.remove(view)
- self._call_if_present(view, 'remove_model', self)
-
- #
- # View notification
- #
-
- def notify_views(self, message = 'model_changed', *args, **kwds):
- """For each observer, if the observer defines a method with the name of the
- message, call it with the given arguments. Otherwise, if it defines a
- method called 'model_changed', call it with no arguments. Otherwise,
- do nothing for that observer."""
- for view in self.views:
- if not self._call_if_present(view, message, self, *args, **kwds):
- self._call_if_present(view, 'model_changed', self)
-
- def _call_if_present(self, obj, method_name, *args, **kwds):
- method = getattr(obj, method_name, None)
- if method:
- method(*args, **kwds)
- return 1
- else:
- return 0
-
- #
- # Marking as changed
- #
-
- def changed(self):
- "Mark the containing Document as changed."
- parent = self.parent
- if parent:
- parent.changed()
-
-export(Model)
diff --git a/PyGUI-2.5.3/GUI/Generic/PaletteView.py b/PyGUI-2.5.3/GUI/Generic/PaletteView.py
deleted file mode 100644
index 9387afa..0000000
--- a/PyGUI-2.5.3/GUI/Generic/PaletteView.py
+++ /dev/null
@@ -1,144 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Palette View - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import StdColors, GridView
-from GUI.GUtils import splitdict
-
-class PaletteView(GridView):
- """A GridView whose cells are identified by a linear index from
- left to right and top to bottom. Also provides support for
- highlighting one or more selected cells."""
-
- num_items = overridable_property('num_items',
- "Total number of items")
-
- items_per_row = overridable_property('items_per_row',
- "Number of items displayed in one row")
-
- highlight_style = overridable_property('highlight_style',
- "Style of selection highlighting")
-
- highlight_color = overridable_property('highlight_color',
- "Color of selection highlighting")
-
- highlight_thickness = overridable_property('highlight_thickness',
- "Width of selection highlighting for 'frame' highlight mode")
-
- _highlight_style = 'fill'
- _highlight_color = StdColors.selection_backcolor
- _highlight_thickness = 4
-
- def __init__(self, num_items, items_per_row, cell_size,
- scrolling = '', **kwds):
- base_kwds = splitdict(kwds, 'border', scrolling = '')
- GridView.__init__(self, num_rows = 0, num_columns = 0,
- cell_size = cell_size, **base_kwds)
- self._num_items = num_items
- self._items_per_row = items_per_row
- self._update_num_rows_and_columns()
- ew, eh = self.extent
- if not self.hscrolling:
- self.content_width = ew
- if not self.vscrolling:
- self.content_height = eh
- self.set(**kwds)
-
- def get_num_items(self):
- return self._num_items
-
- def set_num_items(self, n):
- self._num_items = n
- self._update_num_rows_and_columns()
-
- def get_items_per_row(self):
- return self.num_columns
-
- def set_items_per_row(self, n):
- self._items_per_row = n
- self._update_num_rows_and_columns()
-
- def _update_num_rows_and_columns(self):
- nc = self._items_per_row
- nr = (self._num_items + nc - 1) // nc
- self._num_columns = nc
- self._num_rows = nr
- self._update_extent()
-
- def get_highlight_style(self):
- return self._highlight_style
-
- def set_highlight_style(self, x):
- self._highlight_style = x
-
- def get_highlight_color(self):
- return self._highlight_color
-
- def set_highlight_color(self, x):
- self._highlight_color = x
-
- def get_highlight_color(self):
- return self._highlight_color
-
- def set_highlight_color(self, x):
- self._highlight_color = x
-
- def item_no_of_cell(self, row, col):
- i = row * self._items_per_row + col
- if 0 <= i < self._num_items:
- return i
-
- def cell_of_item_no(self, item_no):
- if 0 <= item_no < self._num_items:
- return divmod(item_no, self._items_per_row)
-
- def item_rect(self, item_no):
- cell = self.cell_of_item_no(item_no)
- if cell:
- return self.cell_rect(*cell)
-
- def draw_cell(self, canvas, row, col, rect):
- i = self.item_no_of_cell(row, col)
- if i is not None:
- highlight = self.item_is_selected(i)
- self.draw_item_and_highlight(canvas, i, rect, highlight)
-
- def draw_item_and_highlight(self, canvas, item_no, rect, highlight):
- """Draw the specified item, with selection highlighting if highlight
- is true."""
- if highlight:
- style = self.highlight_style
- if style:
- canvas.gsave()
- if style == 'fill':
- canvas.fillcolor = self.highlight_color
- canvas.fill_rect(rect)
- else:
- canvas.pencolor = self.highlight_color
- canvas.pensize = self.highlight_thickness
- canvas.frame_rect(rect)
- canvas.grestore()
- self.draw_item(canvas, item_no, rect)
-
- def draw_item(self, canvas, item_no, rect):
- """Should draw the specified item in the given rect."""
- pass
-
- def click_cell(self, row, col, event):
- i = self.item_no_of_cell(row, col)
- if i is not None:
- self.click_item(i, event)
-
- def click_item(self, item_no, event):
- """Called when a mouse_down event has occurred in the indicated item."""
- pass
-
- def item_is_selected(self, item_no):
- """Should return true if the indicated item is to be drawn highlighted."""
- return False
-
-export(PaletteView)
diff --git a/PyGUI-2.5.3/GUI/Generic/Picture.py b/PyGUI-2.5.3/GUI/Generic/Picture.py
deleted file mode 100644
index 2a58b65..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Picture.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Python GUI - Picture class - Generic
-#
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import View
-
-class Picture(View):
-
- image = overridable_property('image', "The image to display")
-
- _image = None
-
- def __init__(self, image = None, file = None, **kwds):
- if file:
- from Images import Image
- image = Image(file)
- View.__init__(self, **kwds)
- if image:
- self.size = image.size
- self._image = image
-
- def get_image(self):
- return self._image
-
- def set_image(self, x):
- self._image = x
- self.invalidate()
-
- def draw(self, canvas, rect):
- image = self._image
- if image:
- w, h = self.size
- image.draw(canvas, image.bounds, (0, 0, w, h))
-
-export(Picture)
diff --git a/PyGUI-2.5.3/GUI/Generic/Properties.py b/PyGUI-2.5.3/GUI/Generic/Properties.py
deleted file mode 100644
index 5fa0811..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Properties.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Properties - Generic
-#
-#------------------------------------------------------------------------------
-
-class Properties(object):
- """
- This class implements the standard interface for initialising
- properties using keyword arguments.
- """
-
- def __init__(self, **kw):
- "Properties(name=value, ...) passes the given arguments to the set() method."
- self.set(**kw)
-
- def set(self, **kw):
- """set(name=value, ...) sets property values according to the given
- keyword arguments. Will only set attributes for which a descriptor exists."""
- cls = self.__class__
- for name, value in kw.iteritems():
- try:
- s = getattr(cls, name).__set__
- except AttributeError:
- raise TypeError("%s object has no writable property %r" % (
- self.__class__.__name__, name))
- s(self, value)
-
-#------------------------------------------------------------------------------
-
-def overridable_property(name, doc = None):
- """Creates a property which calls methods get_xxx and set_xxx of
- the underlying object to get and set the property value, so that
- the property's behaviour may be easily overridden by subclasses."""
-
- getter_name = intern('get_' + name)
- setter_name = intern('set_' + name)
- return property(
- lambda self: getattr(self, getter_name)(),
- lambda self, value: getattr(self, setter_name)(value),
- None,
- doc)
diff --git a/PyGUI-2.5.3/GUI/Generic/Resources.py b/PyGUI-2.5.3/GUI/Generic/Resources.py
deleted file mode 100644
index 91d570d..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Resources.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# PyGUI - Resources - Generic
-#
-
-import os
-
-resource_path = []
-resource_cache = {}
-
-class ResourceNotFoundError(ValueError):
-
- def __init__(self, name, type, path):
- name = _append_type(name, type)
- ValueError.__init__(self, "Resource %r not found in %s" % (name, path))
-
-def _append_type(name, type):
- if type:
- name = "%s.%s" % (os.path.splitext(name)[0], type)
- return name
-
-def _add_directory_path(dir, up = 0):
- # Add the given directory to the resource path if it exists.
- dir = os.path.abspath(dir)
- while up > 0:
- dir = os.path.dirname(dir)
- up -= 1
- resdir = os.path.join(dir, "Resources")
- #print "GUI.Resources: Checking for directory", repr(resdir) ###
- if os.path.isdir(resdir):
- resource_path.insert(0, resdir)
-
-def _add_file_path(file, up = 0):
- # Add the directory containing the given file to the resource path.
- #print "GUI.Resources: Adding path for file", repr(file) ###
- dir = os.path.dirname(os.path.abspath(file))
- _add_directory_path(dir, up)
-
-def _add_module_path(module, up = 0):
- # Add the directory containing the given module to the resource path.
- if hasattr(module, '__file__'):
- _add_file_path(module.__file__, up)
-
-def lookup_resource(name, type = None):
- """
- Return the full pathname of a resource given its relative name
- using '/' as a directory separator. If a type is specified, any
- dot-suffix on the name is replaced with '.type'. Returns None if
- no matching file is found on the resource search path.
- """
- name = _append_type(name, type)
- relpath = os.path.join(*name.split("/"))
- for dir in resource_path:
- path = os.path.join(dir, relpath)
- if os.path.exists(path):
- return path
- return None
-
-def find_resource(name, type = None):
- """
- Returns the full pathname of a resource as per lookup_resource(), but
- raises ResourceNotFoundError if the resource is not found.
- """
- path = lookup_resource(name, type)
- if not path:
- raise ResourceNotFoundError(name, type, resource_path)
- return path
-
-def get_resource(loader, name, type = None, default = None, **kwds):
- """
- Find a resource and load it using the specified loader function.
- The loader is called as: loader(path, **kwds) where path is the full
- pathname of the resource. The loaded resource is cached, and subsequent
- calls referencing the same resource will return the cached value.
- If the resource is not found, the specified default is returned if any,
- otherwise ResourceNotFoundError is raised.
- """
- path = lookup_resource(name, type)
- if path:
- result = resource_cache.get(path)
- if result is None:
- result = loader(path, **kwds)
- resource_cache[path] = result
- else:
- if default is not None:
- result = default
- else:
- raise ResourceNotFoundError(name, type, resource_path)
- return result
diff --git a/PyGUI-2.5.3/GUI/Generic/Row.py b/PyGUI-2.5.3/GUI/Generic/Row.py
deleted file mode 100644
index 25b6fc3..0000000
--- a/PyGUI-2.5.3/GUI/Generic/Row.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Row layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Row(Frame):
-
- def __init__(self, items, spacing = 10, align = 'c', equalize = '',
- expand = None, padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- if expand is not None and not isinstance(expand, int):
- expand = items.index(expand)
- equalize_components(items, equalize)
- height = 0
- for item in items:
- if item:
- height = max(height, item.height)
- x = hpad
- gap = 0
- hanchor = 'l'
- vanchor = align
- for i, item in enumerate(items):
- x += gap;
- if item:
- if 't' in align:
- y = 0
- if 'b' in align:
- item.height = height
- elif align == 'b':
- y = height - item.height
- else:
- y = (height - item.height) // 2
- item.position = (x, y + vpad)
- if i == expand:
- item.anchor = 'lr' + vanchor
- else:
- item.anchor = hanchor + vanchor
- x += item.width;
- if i == expand:
- hanchor = 'r'
- gap = spacing
- self.size = (x + hpad, height + 2 * vpad)
- self.add(items)
- self.set(**kwds)
-
-export(Row)
diff --git a/PyGUI-2.5.3/GUI/Generic/StdButtons.py b/PyGUI-2.5.3/GUI/Generic/StdButtons.py
deleted file mode 100644
index f448461..0000000
--- a/PyGUI-2.5.3/GUI/Generic/StdButtons.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Python GUI - Standard Buttons
-#
-
-from GUI import Button
-
-class DefaultButton(Button):
-
- def __init__(self, title = "OK", **kwds):
- kwds.setdefault('style', 'default')
- kwds.setdefault('action', 'do_default_action')
- Button.__init__(self, title = title, **kwds)
-
-class CancelButton(Button):
-
- def __init__(self, title = "Cancel", **kwds):
- kwds.setdefault('style', 'cancel')
- kwds.setdefault('action', 'do_cancel_action')
- Button.__init__(self, title = title, **kwds)
diff --git a/PyGUI-2.5.3/GUI/Generic/StdColors.py b/PyGUI-2.5.3/GUI/Generic/StdColors.py
deleted file mode 100644
index f7701b4..0000000
--- a/PyGUI-2.5.3/GUI/Generic/StdColors.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Python GUI - Standard Colors - Generic
-#
-
-from GUI.Colors import rgb, selection_forecolor, selection_backcolor
-
-black = rgb(0, 0, 0)
-dark_grey = rgb(0.25, 0.25, 0.25)
-grey = rgb(0.5, 0.5, 0.5)
-light_grey = rgb(0.75, 0.75, 0.75)
-white = rgb(1, 1, 1)
-red = rgb(1, 0, 0)
-green = rgb(0, 1, 0)
-blue = rgb(0, 0, 1)
-yellow = rgb(1, 1, 0)
-cyan = rgb(0, 1, 1)
-magenta = rgb(1, 0, 1)
-clear = rgb(0, 0, 0, 0)
diff --git a/PyGUI-2.5.3/GUI/Generic/TextEditorPrinting.py b/PyGUI-2.5.3/GUI/Generic/TextEditorPrinting.py
deleted file mode 100644
index d3afe19..0000000
--- a/PyGUI-2.5.3/GUI/Generic/TextEditorPrinting.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - TextEditor Printing - Generic
-#
-#------------------------------------------------------------------------------
-
-import re
-from GUI import View
-
-class TextEditorPrintView(View):
-
- def __init__(self, base_view, page_setup):
- print "TextEditorPrintView:" ###
- print "...paper_size =", page_setup.paper_size ###
- print "...margins =", page_setup.margins ###
- print "...page_size =", page_setup.page_size ###
- View.__init__(self)
- self.base_view = base_view
- self.width = page_setup.page_width
- self.page_height = page_setup.page_height
- self.lay_out_text()
- lines_per_page = int(page_setup.page_height / base_view.font.line_height)
- self.lines_per_page = lines_per_page
- num_lines = len(self.lines)
- self.num_pages = (num_lines + lines_per_page - 1) // lines_per_page
- self.height = self.num_pages * self.page_height
-
- def lay_out_text(self):
- base_view = self.base_view
- font = base_view.font
- space_width = font.width(" ")
- tab_spacing = base_view.tab_spacing
- page_width = self.width
- pat = re.compile(r"[ \t]|[^ \t]+")
- lines = []
- line = []
- x = 0
- for text_line in base_view.text.splitlines():
- for match in pat.finditer(text_line):
- item = match.group()
- if item == " ":
- item_width = space_width
- item = ""
- elif item == "\t":
- item_width = tab_spacing - x % tab_spacing
- item = ""
- else:
- item_width = font.width(item)
- if x + item_width > page_width and x > 0:
- lines.append(line); line = []; x = 0
- line.append((x, item))
- x += item_width
- lines.append(line); line = []; x = 0
- self.lines = lines
-
- def draw(self, canvas, page_rect):
- l, t, r, b = page_rect
- page_no = int(t / self.page_height)
- n = self.lines_per_page
- i = page_no * n
- font = self.base_view.font
- y = t + font.ascent
- dy = font.line_height
- for line in self.lines[i : i + n]:
- for x, item in line:
- canvas.moveto(x, y)
- canvas.show_text(item)
- y += dy
diff --git a/PyGUI-2.5.3/GUI/Gtk/AlertClasses.py b/PyGUI-2.5.3/GUI/Gtk/AlertClasses.py
deleted file mode 100644
index 806fb0d..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/AlertClasses.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - Alerts - Gtk
-#
-
-from GUI.GAlertClasses import Alert, Alert2, Alert3
diff --git a/PyGUI-2.5.3/GUI/Gtk/Application.py b/PyGUI-2.5.3/GUI/Gtk/Application.py
deleted file mode 100644
index 2fb46d2..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Application.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#
-# Python GUI - Application class - Gtk
-#
-
-import sys
-import gtk
-from GUI import export
-from GUI import application
-from GUI.GApplications import Application as GApplication
-
-class Application(GApplication):
-
- _in_gtk_main = 0
-
- def run(self):
- GApplication.run(self)
-
- def set_menus(self, menu_list):
- GApplication.set_menus(self, menu_list)
- for window in self._windows:
- window._gtk_update_menubar()
-
-# def handle_events(self):
-# #print "Application.handle_events: entering gtk.main" ###
-# _call_with_excepthook(gtk.main, gtk.main_quit)
-# #print "Application.handle_events: returned from gtk.main" ###
-
- def handle_next_event(self, modal_window = None):
- _call_with_excepthook(gtk.main_iteration)
- self._check_for_no_windows()
-
-# def _quit(self):
-# self._quit_flag = True
-# gtk.main_quit()
-
-# def _exit_event_loop(self):
-# gtk.main_quit()
-
- def get_target_window(self):
- for window in self._windows:
- if window._gtk_outer_widget.has_focus:
- return window
- return None
-
- def zero_windows_allowed(self):
- return 0
-
- def query_clipboard(self):
- return _gtk_clipboard.available()
-
- def get_clipboard(self):
- return _gtk_clipboard.get()
-
- def set_clipboard(self, data):
- _gtk_clipboard.set(data)
-
-#------------------------------------------------------------------------------
-
-class GtkClipboard(gtk.Window):
-
- data = ""
-
- def __init__(self):
- gtk.Window.__init__(self)
- self.realize()
- self.connect('selection_get', self.selection_get_signalled)
- self.connect('selection_received', self.selection_received_signalled)
- self.selection_add_target("CLIPBOARD", "STRING", 0)
-
- def selection_get_signalled(self, w, selection_data, info, time_stamp):
- #print "Clipboard.selection_get_signalled" ###
- selection_data.set_text(self.data, len(self.data))
-
- def selection_received_signalled(self, w, selection_data, info):
- #print "Clipboard.selection_received_signalled:", selection_data ###
- type = str(selection_data.type)
- if type == "STRING":
- data = selection_data.get_text()
- elif type == "ATOM":
- data = selection_data.get_targets()
- else:
- #print "Clipboard.selection_received_signalled: Unknown type: %r" % type
- data = None
- #print "...data =", repr(data) ###
- self.received_data = data
-
- def request(self, target, default):
- # Get the contents of the clipboard.
- #print "Clipboard.request:", target ###
- self.received_data = -1
- self.selection_convert("CLIPBOARD", target)
- while self.received_data == -1:
- gtk.main_iteration()
- data = self.received_data
- self.received_data = None
- if data is None:
- data = default
- #print "Clipboard.request ->", repr(data) ###
- return data
-
- def available(self):
- targets = self.request("TARGETS", ())
- #print "Clipboard.available: targets =", repr(targets) ###
- return "STRING" in map(str, targets)
-
- def get(self):
- # Get the contents of the clipboard.
- text = self.request("STRING", "")
- #print "Clipboard.get ->", repr(text) ###
- return text
-
- def set(self, text):
- # Put the given text on the clipboard.
- #print "Clipboard.set:", text ###
- self.data = text
- result = self.selection_owner_set("CLIPBOARD")
- #print "...result =", result ###
-
-#------------------------------------------------------------------------------
-
-_gtk_clipboard = GtkClipboard()
-
-#------------------------------------------------------------------------------
-
-def _call_with_excepthook(proc, breakout = None):
- # This function arranges for exceptions to be propagated
- # across calls to the Gtk event loop functions.
- exc_info = []
- def excepthook(*args):
- exc_info[:] = args
- if breakout:
- breakout()
- old_excepthook = sys.excepthook
- try:
- sys.excepthook = excepthook
- proc()
- finally:
- sys.excepthook = old_excepthook
- if exc_info:
- #print "_call_with_excepthook: raising", exc_info ###
- raise exc_info[0], exc_info[1], exc_info[2]
-
-export(Application)
diff --git a/PyGUI-2.5.3/GUI/Gtk/BaseAlert.py b/PyGUI-2.5.3/GUI/Gtk/BaseAlert.py
deleted file mode 100644
index d845ef8..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/BaseAlert.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Python GUI - Alert base class - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GBaseAlerts import BaseAlert as GBaseAlert
-
-_kind_to_gtk_stock_id = {
- 'stop': gtk.STOCK_DIALOG_ERROR,
- 'caution': gtk.STOCK_DIALOG_WARNING,
- 'note': gtk.STOCK_DIALOG_INFO,
- 'query': gtk.STOCK_DIALOG_QUESTION,
-}
-
-class BaseAlert(GBaseAlert):
-
- def _layout_icon(self, kind):
- gtk_stock_id = _kind_to_gtk_stock_id[kind]
- gtk_icon = gtk.image_new_from_stock(gtk_stock_id, gtk.ICON_SIZE_DIALOG)
- gtk_icon.show()
- icon_size = gtk_icon.size_request()
- icon_width, icon_height = icon_size
- self._gtk_inner_widget.put(gtk_icon, self._left_margin, self._top_margin)
- return icon_size
-
-export(BaseAlert)
diff --git a/PyGUI-2.5.3/GUI/Gtk/BaseFileDialogs.py b/PyGUI-2.5.3/GUI/Gtk/BaseFileDialogs.py
deleted file mode 100644
index fef6f86..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/BaseFileDialogs.py
+++ /dev/null
@@ -1,214 +0,0 @@
-#
-# Python GUI - File selection dialogs - Gtk
-#
-
-import os
-import gtk
-from GUI.Files import FileRef
-from GUI.Alerts import confirm
-from GUI import application
-
-#------------------------------------------------------------------
-
-class _FileDialog(gtk.FileChooserDialog):
-
- def __init__(self, ok_label, **kwds):
- gtk.FileChooserDialog.__init__(self, **kwds)
- self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
- self.add_button(ok_label, gtk.RESPONSE_ACCEPT)
- self.connect('response', self.response)
- self.set_default_size(600, 600)
- self.set_position(gtk.WIN_POS_CENTER)
-
- def add_file_type(self, file_type):
- suffix = file_type.suffix
- if suffix:
- filter = gtk.FileFilter()
- name = file_type.name
- if name:
- filter.set_name(name)
- filter.add_pattern("*.%s" % suffix)
- self.add_filter(filter)
-
- def present_modally(self):
- return self.run() == gtk.RESPONSE_ACCEPT
-
- def response(self, _, id):
- #print "_FileDialog.response:", id ###
- if id == gtk.RESPONSE_ACCEPT:
- if not self.check():
- self.stop_emission('response')
-
- def check(self):
- return True
-
-#------------------------------------------------------------------
-
-class _SaveFileDialog(_FileDialog):
-
- def check(self):
- path = self.get_filename()
- #print "_SaveFileDialog.ok: checking path %r" % path ###
- #if path is None:
- # return False
- if not os.path.exists(path):
- return True
- else:
- result = confirm("Replace existing '%s'?" % os.path.basename(path),
- "Cancel", "Replace", cancel = None)
- return result == 0
-
-#------------------------------------------------------------------
-
-def _request_old(prompt, default_dir, file_types, dir, multiple):
-
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- if dir:
- action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER
- else:
- action = gtk.FILE_CHOOSER_ACTION_OPEN
- dlog = _FileDialog(title = prompt, action = action,
- ok_label = gtk.STOCK_OPEN)
- dlog.set_select_multiple(multiple)
- if file_types:
- for file_type in file_types:
- dlog.add_file_type(file_type)
- if default_dir:
- dlog.set_current_folder(default_dir.path)
- if dlog.present_modally():
- if multiple:
- result = [FileRef(path = path) for path in dlog.get_filenames()]
- else:
- result = FileRef(path = dlog.get_filename())
- else:
- result = None
- dlog.destroy()
- return result
-
-#------------------------------------------------------------------
-
-#def request_old_file(prompt = "Open File", default_dir = None,
-# file_types = None, multiple = False):
-# """Present a dialog for selecting an existing file or set of files.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _FileDialog(title = prompt, ok_label = gtk.STOCK_OPEN)
-# dlog.set_select_multiple(multiple)
-# if file_types:
-# for file_type in file_types:
-# dlog.add_file_type(file_type)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if dlog.present_modally():
-# if multiple:
-# result = [FileRef(path = path) for path in dlog.get_filenames()]
-# else:
-# result = FileRef(path = dlog.get_filename())
-# else:
-# result = None
-# dlog.destroy()
-# return result
-
-#------------------------------------------------------------------
-
-#def request_old_directory(prompt = "Choose Folder", default_dir = None,
-# multiple = False):
-# """Present a dialog for selecting an existing directory or set of directories.
-# Returns a DirRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _FileDialog(title = prompt, ok_label = gtk.STOCK_OPEN,
-# action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
-# dlog.set_select_multiple(multiple)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if dlog.present_modally():
-# if multiple:
-# result = [DirRef(path = path) for path in dlog.get_filenames()]
-# else:
-# result = DirRef(path = dlog.get_filename())
-# else:
-# result = None
-# dlog.destroy()
-# return result
-
-#------------------------------------------------------------------
-
-def _request_new(prompt, default_dir, default_name, file_type, dir):
- if dir:
- action = gtk.FILE_CHOOSER_ACTION_CREATE_FOLDER
- else:
- action = gtk.FILE_CHOOSER_ACTION_SAVE
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- dlog = _SaveFileDialog(title = prompt, action = action,
- ok_label = gtk.STOCK_SAVE)
- if file_type:
- dlog.add_file_type(file_type)
- if default_dir:
- dlog.set_current_folder(default_dir.path)
- if default_name:
- dlog.set_current_name(default_name)
- if dlog.present_modally():
- path = dlog.get_filename()
- if file_type:
- path = file_type._add_suffix(path)
- result = FileRef(path = path)
- else:
- result = None
- dlog.destroy()
- return result
-
-#------------------------------------------------------------------
-
-#def request_new_file(prompt = "Save File", default_dir = None,
-# default_name = "", file_type = None):
-# """Present a dialog requesting a name and location for a new file.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _SaveFileDialog(title = prompt, ok_label = gtk.STOCK_SAVE,
-# action = gtk.FILE_CHOOSER_ACTION_SAVE)
-# if file_type:
-# dlog.add_file_type(file_type)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if default_name:
-# dlog.set_current_name(default_name)
-# if dlog.present_modally():
-# path = dlog.get_filename()
-# if file_type:
-# path = file_type._add_suffix(path)
-# result = FileRef(path = path)
-# else:
-# result = None
-# dlog.destroy()
-# return result
-
-#------------------------------------------------------------------
-
-#def request_new_directory(prompt = "Create Folder", default_dir = None,
-# default_name = ""):
-# """Present a dialog requesting a name and location for a new directory.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _SaveFileDialog(title = prompt, ok_label = gtk.STOCK_SAVE,
-# action = gtk.FILE_CHOOSER_ACTION_CREATE_FOLDER)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if default_name:
-# dlog.set_current_name(default_name)
-# if dlog.present_modally():
-# path = dlog.get_filename()
-# result = FileRef(path = path)
-# else:
-# result = None
-# dlog.destroy()
-# return result
diff --git a/PyGUI-2.5.3/GUI/Gtk/Button.py b/PyGUI-2.5.3/GUI/Gtk/Button.py
deleted file mode 100644
index 2c0f62e..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Button.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# Python GUI - Buttons - Gtk version
-#
-
-import gtk
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.GButtons import Button as GButton
-
-_gtk_extra_hpad = 5 # Amount to add to default width at each end
-_gtk_icon_spacing = 2 # Space to leave between icon and label
-
-class Button(GButton):
-
- _gtk_icon = None # Icon, when we have one
- _style = 'normal' # or 'default' or 'cancel'
-
- def __init__(self, title = "Button", #style = 'normal',
- font = system_font, **kwds):
- gtk_label = gtk.Label(title)
- gtk_box = gtk.HBox(spacing = _gtk_icon_spacing)
- gtk_box.pack_end(gtk_label, fill = True, expand = True)
- gtk_alignment = gtk.Alignment(0.5, 0.5, 0.0, 0.0)
- hp = _gtk_extra_hpad
- gtk_alignment.set_padding(0, 0, hp, hp)
- gtk_alignment.add(gtk_box)
- gtk_button = gtk.Button()
- gtk_button.add(gtk_alignment)
- gtk_button.set_focus_on_click(False)
- gtk_button.show_all()
- w, h = font.text_size(title)
- w2 = w + 2 * _gtk_button_hpad + _gtk_icon_width + _gtk_icon_spacing
- h2 = max(h + 2 * _gtk_button_vpad, _gtk_default_button_height)
- gtk_button.set_size_request(int(round(w2)), int(round(h2)))
- self._gtk_box = gtk_box
- self._gtk_alignment = gtk_alignment
- self._gtk_connect(gtk_button, 'clicked', self._gtk_clicked_signal)
- GButton.__init__(self, _gtk_outer = gtk_button, _gtk_title = gtk_label,
- font = font, **kwds)
-
- def _gtk_get_alignment(self):
- return self._gtk_alignment.get_property('xalign')
-
- def _gtk_set_alignment(self, fraction, just):
- self._gtk_alignment.set_property('xalign', fraction)
- self._gtk_title_widget.set_justify(just)
-
- def get_style(self):
- return self._style
-
- def set_style(self, new_style):
- if self._style <> new_style:
- if new_style == 'default':
- self._gtk_add_icon(gtk.STOCK_OK)
- elif new_style == 'cancel':
- self._gtk_add_icon(gtk.STOCK_CANCEL)
- else:
- self._gtk_remove_icon()
- self._style = new_style
-
- def _gtk_add_icon(self, gtk_stock_id):
- gtk_icon = gtk.image_new_from_stock(gtk_stock_id, gtk.ICON_SIZE_BUTTON)
- gtk_icon.show()
- self._gtk_box.pack_start(gtk_icon)
- self._gtk_icon = gtk_icon
-
- def _gtk_remove_icon(self):
- gtk_icon = self._gtk_icon
- if gtk_icon:
- gtk_icon.destroy()
- self._gtk_icon = None
-
- def activate(self):
- """Highlight the button momentarily and then perform its action."""
- self._gtk_outer_widget.activate()
-
- def _gtk_clicked_signal(self):
- self.do_action()
-
-
-def _calc_size_constants():
- global _gtk_icon_width, _gtk_default_button_height
- global _gtk_button_hpad, _gtk_button_vpad
- gtk_icon = gtk.image_new_from_stock(gtk.STOCK_OK, gtk.ICON_SIZE_BUTTON)
- gtk_button = gtk.Button()
- gtk_button.add(gtk_icon)
- gtk_button.show_all()
- icon_width, icon_height = gtk_icon.size_request()
- butn_width, butn_height = gtk_button.size_request()
- _gtk_icon_width = icon_width
- _gtk_default_button_height = butn_height
- _gtk_button_hpad = (butn_width - icon_width) / 2 + _gtk_extra_hpad
- _gtk_button_vpad = (butn_height - icon_height) / 2
- gtk_button.destroy()
-
-_calc_size_constants()
-del _calc_size_constants
-
-export(Button)
-
diff --git a/PyGUI-2.5.3/GUI/Gtk/Canvas.py b/PyGUI-2.5.3/GUI/Gtk/Canvas.py
deleted file mode 100644
index f83f3ec..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Canvas.py
+++ /dev/null
@@ -1,255 +0,0 @@
-#--------------------------------------------------------------------
-#
-# Python GUI - Canvas - Gtk
-#
-#--------------------------------------------------------------------
-
-from math import sin, cos, pi, floor
-from cairo import OPERATOR_OVER, OPERATOR_SOURCE, FILL_RULE_EVEN_ODD
-from GUI import export
-from GUI.Geometry import sect_rect
-from GUI.StdFonts import application_font
-from GUI.StdColors import black, white
-from GUI.GCanvases import Canvas as GCanvas
-from GUI.GCanvasPaths import CanvasPaths as GCanvasPaths
-
-deg = pi / 180
-twopi = 2 * pi
-
-#--------------------------------------------------------------------
-
-class GState(object):
-
- pencolor = black
- fillcolor = black
- textcolor = black
- backcolor = white
- pensize = 1
- font = application_font
-
- def __init__(self, clone = None):
- if clone:
- self.__dict__.update(clone.__dict__)
-
-#--------------------------------------------------------------------
-
-class Canvas(GCanvas, GCanvasPaths):
-
- def _from_gdk_drawable(cls, gdk_drawable):
- return cls(gdk_drawable.cairo_create())
-
- _from_gdk_drawable = classmethod(_from_gdk_drawable)
-
- def _from_cairo_context(cls, ctx):
- return cls(ctx)
-
- _from_cairo_context = classmethod(_from_cairo_context)
-
- def __init__(self, ctx):
- ctx.set_fill_rule(FILL_RULE_EVEN_ODD)
- self._gtk_ctx = ctx
- self._gstack = []
- self._state = GState()
- GCanvas.__init__(self)
- GCanvasPaths.__init__(self)
-
- def get_pencolor(self):
- return self._state.pencolor
-
- def set_pencolor(self, c):
- self._state.pencolor = c
-
- def get_fillcolor(self):
- return self._state.fillcolor
-
- def set_fillcolor(self, c):
- self._state.fillcolor = c
-
- def get_textcolor(self):
- return self._state.textcolor
-
- def set_textcolor(self, c):
- self._state.textcolor = c
-
- def get_backcolor(self):
- return self._state.backcolor
-
- def set_backcolor(self, c):
- self._state.backcolor = c
-
- def get_pensize(self):
- return self._state.pensize
-
- def set_pensize(self, d):
- self._state.pensize = d
-
- def get_font(self):
- return self._state.font
-
- def set_font(self, f):
- self._state.font = f
-
- def get_current_point(self):
- return self._gtk_ctx.get_current_point()
-
- def rectclip(self, r):
- l, t, r, b = r
- ctx = self._gtk_ctx
- ctx.new_path()
- ctx.rectangle(l, t, r - l, b - t)
- ctx.clip()
-
- def gsave(self):
- old_state = self._state
- self._gstack.append(old_state)
- self._state = GState(old_state)
- self._gtk_ctx.save()
-
- def grestore(self):
- self._state = self._gstack.pop()
- self._gtk_ctx.restore()
-
- def newpath(self):
- self._gtk_ctx.new_path()
-
- def moveto(self, x, y):
- self._gtk_ctx.move_to(x, y)
-
- def rmoveto(self, x, y):
- self._gtk_ctx.rel_move_to(x, y)
-
- def lineto(self, x, y):
- self._gtk_ctx.line_to(x, y)
-
- def rlineto(self, x, y):
- self._gtk_ctx.rel_line_to(x, y)
-
- def curveto(self, p1, p2, p3):
- self._gtk_ctx.curve_to(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1])
-
- def rcurveto(self, p1, p2, p3):
- self._gtk_ctx.rel_curve_to(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1])
-
- def arc(self, c, r, a0, a1):
- self._gtk_ctx.arc(c[0], c[1], r, a0 * deg, a1 * deg)
-
- def closepath(self):
- ctx = self._gtk_ctx
- ctx.close_path()
- ctx.new_sub_path()
-
- def clip(self):
- self._gtk_ctx.clip_preserve()
-
- def stroke(self):
- state = self._state
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*state.pencolor._rgba)
- ctx.set_source_color(state.pencolor._gdk_color)
- ctx.set_line_width(state.pensize)
- ctx.stroke_preserve()
-
- def fill(self):
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*self._state.fillcolor._rgba)
- ctx.set_source_color(self._state.fillcolor._gdk_color)
- ctx.fill_preserve()
-
- def erase(self):
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*self._state.backcolor._rgba)
- ctx.set_source_color(self._state.backcolor._gdk_color)
- ctx.set_operator(OPERATOR_SOURCE)
- ctx.fill_preserve()
- ctx.set_operator(OPERATOR_OVER)
-
- def show_text(self, text):
- font = self._state.font
- layout = font._get_pango_layout(text, True)
- dx = layout.get_pixel_size()[0]
- dy = font.ascent
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*self._state.textcolor._rgba)
- ctx.set_source_color(self._state.textcolor._gdk_color)
- ctx.rel_move_to(0, -dy)
- ctx.show_layout(layout)
- ctx.rel_move_to(dx, dy)
-
- def rect(self, rect):
- l, t, r, b = rect
- self._gtk_ctx.rectangle(l, t, r - l, b - t)
-
- def oval(self, rect):
- l, t, r, b = rect
- a = 0.5 * (r - l)
- b = 0.5 * (b - t)
- ctx = self._gtk_ctx
- ctx.new_sub_path()
- ctx.save()
- ctx.translate(l + a, t + b)
- ctx.scale(a, b)
- ctx.arc(0, 0, 1, 0, twopi)
- ctx.close_path()
- ctx.restore()
-
- def translate(self, dx, dy):
- self._gtk_ctx.translate(dx, dy)
- return
-
- def rotate(self, degrees):
- self._gtk_ctx.rotate(degrees*pi/180)
- return
-
- def scale(self, xscale, yscale):
- self._gtk_ctx.scale(xscale, yscale)
- return
-
-# def _coords(self, x, y):
-# x0, y0 = self._origin
-# return int(round(x0 + x)), int(round(y0 + y))
-
-# def _coords(self, x, y):
-# return int(round(x)), int(round(y))
-
-# def _rect_coords(self, (l, t, r, b)):
-# x0, y0 = self._origin
-# l = int(round(x0 + l))
-# t = int(round(y0 + t))
-# r = int(round(x0 + r))
-# b = int(round(y0 + b))
-# return l, t, r - l, b - t
-
-# def _rect_coords(self, (l, t, r, b)):
-# l = int(round(l))
-# t = int(round(t))
-# r = int(round(r))
-# b = int(round(b))
-# return l, t, r - l, b - t
-
-# def _frame_coords(self, r):
-# l, t, w, h = self._rect_coords(r)
-# p = self._gdk_gc.line_width
-# d = p // 2
-# return (
-# int(floor(l + d)),
-# int(floor(t + d)),
-# int(floor(w - p)),
-# int(floor(h - p)))
-
-#def _gdk_angles(start_angle, end_angle):
-# arc_angle = (end_angle - start_angle) % 360
-# start = int(round(start_angle * 64))
-# arc = int(round((arc_angle) * 64))
-# return -start, -arc
-
-#def _arc_rect((cx, cy), r):
-# return (cx - r, cy - r, cx + r, cy + r)
-
-#def _arc_endpoint(center, r, a):
-# cx, cy = center
-# ar = a * deg
-# x = int(round(cx + r * cos(ar)))
-# y = int(round(cy + r * sin(ar)))
-# return x, y
-
-export(Canvas)
diff --git a/PyGUI-2.5.3/GUI/Gtk/CheckBox.py b/PyGUI-2.5.3/GUI/Gtk/CheckBox.py
deleted file mode 100644
index ef3a74b..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/CheckBox.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - Check boxes - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GCheckBoxes import CheckBox as GCheckBox
-
-class CheckBox(GCheckBox):
-
- def __init__(self, title = "New Control", **kwds):
- gtk_checkbox = gtk.CheckButton(title)
- gtk_checkbox.show()
- self._gtk_connect(gtk_checkbox, 'clicked', self._gtk_clicked_signal)
- self._gtk_inhibit_action = 0
- GCheckBox.__init__(self, _gtk_outer = gtk_checkbox, **kwds)
-
- def get_on(self):
- gtk_checkbox = self._gtk_outer_widget
- if gtk_checkbox.get_inconsistent():
- return 'mixed'
- else:
- return gtk_checkbox.get_active()
-
- def set_on(self, state):
- mixed = state == 'mixed'
- if mixed:
- if not self._mixed:
- raise ValueError("CheckBox state cannot be 'mixed'")
- active = False
- else:
- active = bool(state)
- save = self._gtk_inhibit_action
- self._gtk_inhibit_action = 1
- try:
- gtk_checkbox = self._gtk_outer_widget
- gtk_checkbox.set_active(active)
- gtk_checkbox.set_inconsistent(mixed)
- finally:
- self._gtk_inhibit_action = save
-
- def _gtk_clicked_signal(self):
- gtk_checkbox = self._gtk_outer_widget
- if not self._gtk_inhibit_action:
- if self._auto_toggle:
- gtk_checkbox.set_inconsistent(False)
- else:
- save = self._gtk_inhibit_action
- self._gtk_inhibit_action = 1
- try:
- gtk_checkbox.set_active(not gtk_checkbox.get_active())
- finally:
- self._gtk_inhibit_action = save
- self.do_action()
-
-export(CheckBox)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Color.py b/PyGUI-2.5.3/GUI/Gtk/Color.py
deleted file mode 100644
index 39b15e3..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Color.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Python GUI - Colors - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GColors import Color as GColor
-
-class Color(GColor):
-
- _alpha = 1.0
-
- def _from_gdk_color(cls, _gdk_color):
- c = cls.__new__(cls)
- c._gdk_color = _gdk_color
- return c
-
- _from_gdk_color = classmethod(_from_gdk_color)
-
- def __init__(self, red, green, blue, alpha = 1.0):
- self._rgba = (red, green, blue, alpha)
- gdk_color = gdk.Color()
- gdk_color.red = int(red * 65535)
- gdk_color.green = int(green * 65535)
- gdk_color.blue = int(blue * 65535)
- self._gdk_color = gdk_color
- self._alpha = alpha
-
- def get_red(self):
- return self._gdk_color.red / 65535.0
-
- def get_green(self):
- return self._gdk_color.green / 65535.0
-
- def get_blue(self):
- return self._gdk_color.blue / 65535.0
-
- def get_alpha(self):
- return self._alpha
-
-export(Color)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Colors.py b/PyGUI-2.5.3/GUI/Gtk/Colors.py
deleted file mode 100644
index 9fa29dd..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Colors.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Python GUI - Color constants and functions - Gtk
-#
-
-from gtk import Style
-from GUI import Color
-
-rgb = Color
-
-s = Style()
-selection_forecolor = Color._from_gdk_color(s.fg[3])
-selection_backcolor = Color._from_gdk_color(s.bg[3])
-
diff --git a/PyGUI-2.5.3/GUI/Gtk/Component.py b/PyGUI-2.5.3/GUI/Gtk/Component.py
deleted file mode 100644
index 36e76b8..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Component.py
+++ /dev/null
@@ -1,252 +0,0 @@
-#
-# Python GUI - Components - Gtk
-#
-
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI import Event
-from GUI.Geometry import sub_pt
-from GUI.GComponents import Component as GComponent
-
-_gdk_events_of_interest = (
- gdk.POINTER_MOTION_MASK |
- gdk.BUTTON_MOTION_MASK |
- gdk.BUTTON_PRESS_MASK |
- gdk.BUTTON_RELEASE_MASK |
- gdk.KEY_PRESS_MASK |
- gdk.KEY_RELEASE_MASK |
- gdk.ENTER_NOTIFY_MASK |
- gdk.LEAVE_NOTIFY_MASK |
- 0
-)
-
-_gtk_widget_to_component = {}
-_gtk_last_keyval_down = None
-
-#------------------------------------------------------------------------------
-
-class Component(GComponent):
-
- _pass_key_events_to_platform = True
-
- def _gtk_find_component(gtk_widget):
- while gtk_widget:
- component = _gtk_widget_to_component.get(gtk_widget)
- if component:
- return component
- gtk_widget = gtk_widget.get_parent()
- return None
-
- _gtk_find_component = staticmethod(_gtk_find_component)
-
- def __init__(self, _gtk_outer, _gtk_inner = None,
- _gtk_focus = None, _gtk_input = None, **kwds):
- self._position = (0, 0)
- self._size = _gtk_outer.size_request()
- _gtk_inner = _gtk_inner or _gtk_outer
- self._gtk_outer_widget = _gtk_outer
- self._gtk_inner_widget = _gtk_inner
- self._gtk_focus_widget = _gtk_focus
- _gtk_widget_to_component[_gtk_outer] = self
- self._gtk_connect_input_events(_gtk_input or _gtk_inner)
- if _gtk_focus:
- _gtk_focus.set_property('can-focus', True)
- self._gtk_connect(_gtk_focus, 'focus-in-event', self._gtk_focus_in)
- GComponent.__init__(self, **kwds)
-
- def destroy(self):
- gtk_widget = self._gtk_outer_widget
- if gtk_widget in _gtk_widget_to_component:
- del _gtk_widget_to_component[gtk_widget]
- GComponent.destroy(self)
-
- #
- # Properties
- #
-
- def set_width(self, v):
- w, h = self.size
- self.size = (v, h)
-
- def set_height(self, v):
- w, h = self.size
- self.size = (w, v)
-
- def get_position(self):
- return self._position
-
- def set_position(self, v):
- self._position = v
- widget = self._gtk_outer_widget
- parent = widget.get_parent()
- if parent:
- parent.move(widget, *v)
-
- def get_size(self):
- return self._size
-
- def set_size(self, new_size):
- w0, h0 = self._size
- w1, h1 = new_size
- self._gtk_outer_widget.set_size_request(max(int(w1), 1), max(int(h1), 1))
- self._size = new_size
- if w0 != w1 or h0 != h1:
- self._resized((w1 - w0, h1 - h0))
-
- def get_bounds(self):
- x, y = self._position
- w, h = self.size
- return (x, y, x + w, y + h)
-
- def set_bounds(self, (l, t, r, b)):
- self.position = (l, t)
- self.size = (r - l, b - t)
-
-# def get_visible(self):
-# return self._gtk_outer_widget.get_property('visible')
-#
-# def set_visible(self, v):
-# self._gtk_outer_widget.set_property('visible', v)
-
- #
- # Message dispatching
- #
-
- def become_target(self):
- gtk_focus = self._gtk_focus_widget
- if gtk_focus:
- gtk_focus.grab_focus()
- else:
- raise ValueError("%r cannot be targeted" % self)
-
-# def current_target(self):
-# """Find the current target object within the Window containing
-# this component. If the component is not contained in a Window,
-# the result is undefined."""
-# target = _gtk_find_component(self._gtk_outer_widget.get_focus())
-# if not target:
-# target = self.window
-# return target
-
- def is_target(self):
- """Return true if this is the current target within the containing
- Window. If the component is not contained in a Window, the result
- is undefined."""
- gtk_focus = self._gtk_focus_widget
- if gtk_focus:
- return gtk_focus.get_property('has-focus')
- else:
- return False
-
- #
- # Internal
- #
-
- def _gtk_connect(self, gtk_widget, signal, handler):
- def catch(widget, *args):
- try:
- handler(*args)
- except:
- _gtk_exception_in_signal_handler()
- gtk_widget.connect(signal, lambda widget, *args: handler(*args))
-
- def _gtk_connect_after(self, gtk_widget, signal, handler):
- def catch(widget, *args):
- try:
- handler(*args)
- except:
- _gtk_exception_in_signal_handler()
- gtk_widget.connect_after(signal, lambda widget, *args: handler(*args))
-
- def _gtk_focus_in(self, gtk_event):
- window = self.window
- if window:
- old_target = window._target
- window._target = self
- if old_target and old_target is not self:
- old_target._untargeted()
- self._targeted()
-
- def _targeted(self):
- pass
-
- def _untargeted(self):
- pass
-
- def _gtk_connect_input_events(self, gtk_widget):
- self._last_mouse_down_time = 0
- self._click_count = 0
- gtk_widget.add_events(_gdk_events_of_interest)
- self._gtk_connect(gtk_widget, 'button-press-event',
- self._gtk_button_press_event_signal)
- self._gtk_connect(gtk_widget, 'motion-notify-event',
- self._gtk_motion_notify_event_signal)
- self._gtk_connect(gtk_widget, 'button-release-event',
- self._gtk_button_release_event_signal)
- self._gtk_connect(gtk_widget, 'enter-notify-event',
- self._gtk_enter_leave_event_signal)
- self._gtk_connect(gtk_widget, 'leave-notify-event',
- self._gtk_enter_leave_event_signal)
- self._gtk_connect(gtk_widget, 'key-press-event',
- self._handle_gtk_key_event)
- self._gtk_connect(gtk_widget, 'key-release-event',
- self._handle_gtk_key_event)
-
- def _gtk_button_press_event_signal(self, gtk_event):
- if gtk_event.type == gdk.BUTTON_PRESS: # don't want 2BUTTON or 3BUTTON
- event = Event._from_gtk_mouse_event(gtk_event)
- last_time = self._last_mouse_down_time
- this_time = event.time
- num_clicks = self._click_count
- if this_time - last_time <= 0.25:
- num_clicks += 1
- else:
- num_clicks = 1
- event.num_clicks = num_clicks
- self._click_count = num_clicks
- self._last_mouse_down_time = this_time
- #print "Component._gtk_button_press_event_signal:" ###
- #print event ###
- return self._event_custom_handled(event)
-
- def _gtk_motion_notify_event_signal(self, gtk_event):
- event = Event._from_gtk_mouse_event(gtk_event)
- self._mouse_event = event
- return self._event_custom_handled(event)
-
- def _gtk_button_release_event_signal(self, gtk_event):
- event = Event._from_gtk_mouse_event(gtk_event)
- self._mouse_event = event
- return self._event_custom_handled(event)
-
- def _gtk_enter_leave_event_signal(self, gtk_event):
- #print "Component._gtk_enter_leave_event_signal:" ###
- event = Event._from_gtk_mouse_event(gtk_event)
- return self._event_custom_handled(event)
-
- def _handle_gtk_key_event(self, gtk_event):
- """Convert a Gtk key-press or key-release event into an Event
- object and pass it up the message path."""
- #print "Component._handle_gtk_key_event for", self ###
- global _gtk_last_keyval_down
- if Event._gtk_key_event_of_interest(gtk_event):
- event = Event._from_gtk_key_event(gtk_event)
- if event.kind == 'key_down':
- this_keyval = gtk_event.keyval
- if _gtk_last_keyval_down == this_keyval:
- event.auto = 1
- _gtk_last_keyval_down = this_keyval
- else:
- _gtk_last_keyval_down = None
- #if event.kind == 'key_down': ###
- # print event ###
- return self._event_custom_handled(event)
-
-#------------------------------------------------------------------------------
-
-def _gtk_exception_in_signal_handler():
- print >>sys.stderr, "---------- Exception in gtk signal handler ----------"
- traceback.print_exc()
-
-export(Component)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Container.py b/PyGUI-2.5.3/GUI/Gtk/Container.py
deleted file mode 100644
index eac37ed..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Container.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Containers - Gtk version
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.Geometry import inset_rect
-from GUI.GContainers import Container as GContainer
-
-class Container(GContainer):
- # Subclasses must set the inner widget to be a Fixed or Layout
- # widget.
-
- def _add(self, comp):
- GContainer._add(self, comp)
- x, y = comp._position
- self._gtk_inner_widget.put(comp._gtk_outer_widget, int(x), int(y))
-
- def _remove(self, comp):
- self._gtk_inner_widget.remove(comp._gtk_outer_widget)
- GContainer._remove(self, comp)
-
-export(Container)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Control.py b/PyGUI-2.5.3/GUI/Gtk/Control.py
deleted file mode 100644
index 7d1a2f3..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Control.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Python GUI - Controls - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.Enumerations import EnumMap
-from GUI import Color
-from GUI import Font
-from GUI.GControls import Control as GControl
-
-_justs = ['left', 'center', 'right']
-
-_just_to_gtk_alignment = EnumMap("justification",
- left = (0.0, gtk.JUSTIFY_LEFT),
- centre = (0.5, gtk.JUSTIFY_CENTER),
- center = (0.5, gtk.JUSTIFY_CENTER),
- right = (1.0, gtk.JUSTIFY_RIGHT),
-)
-
-class Control(GControl):
- # A component which encapsulates a Gtk control widget.
-
- _font = None
-
- def __init__(self, _gtk_outer = None, _gtk_title = None, **kwds):
- self._gtk_title_widget = _gtk_title or _gtk_outer
- GControl.__init__(self, _gtk_outer = _gtk_outer,
- _gtk_focus = kwds.pop('_gtk_focus', _gtk_outer),
- **kwds)
-
- def get_title(self):
- return self._gtk_title_widget.get_label()
-
- def set_title(self, v):
- self._gtk_title_widget.set_label(v)
-
- def get_enabled(self):
- #return self._gtk_outer_widget.get_sensitive()
- return self._gtk_outer_widget.get_property('sensitive')
-
- def set_enabled(self, v):
- self._gtk_outer_widget.set_sensitive(v)
-
- def get_color(self):
- gdk_color = self._gtk_title_widget.style.fg[gtk.STATE_NORMAL]
- return Color._from_gdk_color(gdk_color)
-
- def set_color(self, v):
- self._gtk_title_widget.modify_fg(gtk.STATE_NORMAL, v._gdk_color)
-
- def get_font(self):
- font = self._font
- if not font:
- font = Font._from_pango_description(self._gtk_title_widget.style.font_desc)
- return font
-
- def set_font(self, f):
- self._font = f
- gtk_title = self._gtk_title_widget
- gtk_title.modify_font(f._pango_description)
- gtk_title.queue_resize()
-
- def get_just(self):
- h = self._gtk_get_alignment()
- return _justs[int(round(2.0 * h))]
-
- def set_just(self, v):
- fraction, just = _just_to_gtk_alignment[v]
- self._gtk_set_alignment(fraction, just)
-
- def set_lines(self, num_lines):
- line_height = self.font.text_size("X")[1]
- #print "Control.set_lines: line_height =", line_height ###
- self.height = num_lines * line_height + self._vertical_padding
-
- def _gtk_get_alignment(self):
- raise NotImplementedError
-
- def _gtk_set_alignment(self, h):
- raise NotImplementedError
-
-export(Control)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Cursor.py b/PyGUI-2.5.3/GUI/Gtk/Cursor.py
deleted file mode 100644
index cfee65f..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Cursor.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Python GUI - Cursors - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GCursors import Cursor as GCursor
-
-class Cursor(GCursor):
- #
- # _gtk_cursor gtk.gdk.Cursor
-
- def _from_gtk_std_cursor(cls, id):
- cursor = cls.__new__(cls)
- cursor._gtk_cursor = gdk.Cursor(id)
- return cursor
-
- _from_gtk_std_cursor = classmethod(_from_gtk_std_cursor)
-
- def _from_nothing(cls):
- cursor = cls.__new__(cls)
- pixmap = gdk.Pixmap(None, 1, 1, 1)
- color = gdk.Color()
- cursor._gtk_cursor = gdk.Cursor(pixmap, pixmap, color, color, 0, 0)
- return cursor
-
- _from_nothing = classmethod(_from_nothing)
-
- def _init_from_image_and_hotspot(self, image, hotspot):
- #print "Cursor._init_from_image_and_hotspot:", image, hotspot ###
- x, y = hotspot
- gdk_display = gdk.display_get_default()
- self._gtk_cursor = gdk.Cursor(gdk_display, image._gdk_pixbuf, x, y)
-
-export(Cursor)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Dialog.py b/PyGUI-2.5.3/GUI/Gtk/Dialog.py
deleted file mode 100644
index 46ea57d..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Dialog.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Python GUI - Dialogs - Gtk
-#
-
-from GUI import export
-from GUI.GDialogs import Dialog as GDialog
-
-class Dialog(GDialog):
-
- _default_keys = ['\r']
- _cancel_keys = ['\x1b']
-
-export(Dialog)
diff --git a/PyGUI-2.5.3/GUI/Gtk/DrawableContainer.py b/PyGUI-2.5.3/GUI/Gtk/DrawableContainer.py
deleted file mode 100644
index ca9893b..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/DrawableContainer.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# Python GUI - DrawableViews - Gtk
-#
-
-import os, traceback
-from math import floor, ceil
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI import Canvas, Event, rgb
-from GUI.StdColors import grey
-from GUI.GDrawableContainers import DrawableContainer as GDrawableContainer
-
-class DrawableContainer(GDrawableContainer):
-
- _background_color = grey
-
- def __init__(self, _gtk_outer = None, **kwds):
- gtk_layout = gtk.Layout()
- gtk_layout.add_events(gdk.EXPOSURE_MASK)
- gtk_layout.show()
- self._gtk_connect(gtk_layout, 'expose-event',
- self._gtk_expose_event_signal)
- if _gtk_outer:
- _gtk_outer.add(gtk_layout)
- else:
- _gtk_outer = gtk_layout
- GDrawableContainer.__init__(self, _gtk_outer = _gtk_outer, _gtk_inner = gtk_layout,
- _gtk_focus = gtk_layout, _gtk_input = gtk_layout)
- self.set(**kwds)
-
- #
- # Other methods
- #
-
- def with_canvas(self, proc):
- hadj, vadj = self._gtk_adjustments()
- clip = rect_sized((hadj.value, vadj.value), self.size)
- canvas = Canvas._from_gdk_drawable(self._gtk_inner_widget.bin_window)
- proc(canvas)
-
- def invalidate_rect(self, (l, t, r, b)):
- gdk_window = self._gtk_inner_widget.bin_window
- if gdk_window:
- gdk_rect = (int(floor(l)), int(floor(t)),
- int(ceil(r - l)), int(ceil(b - t)))
- #print "View.invalidate_rect: gdk_rect =", gdk_rect ###
- gdk_window.invalidate_rect(gdk_rect, 0)
-
- def update(self):
- gdk_window = self._gtk_inner_widget.bin_window
- gdk_window.process_updates()
-
- #
- # Internal
- #
-
- def _gtk_expose_event_signal(self, gtk_event):
- try:
- #print "View._gtk_expose_event_signal:", self ###
- l, t, w, h = gtk_event.area
- clip = (l, t, l + w, t + h)
- #print "...clip =", clip ###
- gtk_layout = self._gtk_inner_widget
- canvas = Canvas._from_gdk_drawable(gtk_layout.bin_window)
- update = self._draw_background(canvas, clip)
- self.draw(canvas, update)
- except:
- print "------------------ Exception while drawing ------------------"
- traceback.print_exc()
-
-export(DrawableContainer)
diff --git a/PyGUI-2.5.3/GUI/Gtk/EditCmdHandler.py b/PyGUI-2.5.3/GUI/Gtk/EditCmdHandler.py
deleted file mode 100644
index d068331..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/EditCmdHandler.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# PyGUI - Edit command handling - Gtk
-#
-
-from GUI import export
-from GUI.GEditCmdHandlers import EditCmdHandler
-
-export(EditCmdHandler)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Event.py b/PyGUI-2.5.3/GUI/Gtk/Event.py
deleted file mode 100644
index bbbf74e..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Event.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#
-# Python GUI - Events - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GEvents import Event as GEvent
-
-_gdk_button_mask = (
- gdk.BUTTON1_MASK |
- gdk.BUTTON2_MASK |
- gdk.BUTTON3_MASK |
- gdk.BUTTON4_MASK |
- gdk.BUTTON5_MASK
-)
-
-_gdk_event_type_to_kind = {
- gdk.BUTTON_PRESS: 'mouse_down',
- gdk._2BUTTON_PRESS: 'mouse_down',
- gdk._3BUTTON_PRESS: 'mouse_down',
- gdk.MOTION_NOTIFY: 'mouse_move',
- gdk.BUTTON_RELEASE: 'mouse_up',
- gdk.KEY_PRESS: 'key_down',
- gdk.KEY_RELEASE: 'key_up',
- gdk.ENTER_NOTIFY: 'mouse_enter',
- gdk.LEAVE_NOTIFY: 'mouse_leave',
-}
-
-_gtk_button_to_button = {
- 1: 'left',
- 2: 'middle',
- 3: 'right',
- 4: 'fourth',
- 5: 'fifth',
-}
-
-_gdk_keyval_to_keyname = {
- 0xFF50: 'home',
- 0xFF51: 'left_arrow',
- 0xFF52: 'up_arrow',
- 0xFF53: 'right_arrow',
- 0xFF54: 'down_arrow',
- 0xFF55: 'page_up',
- 0xFF56: 'page_down',
- 0xFF57: 'end',
- #0xFF6A: 'help',
- 0xFF6A: 'insert',
- 0xFF0D: 'return',
- 0xFF8D: 'enter',
- 0xFFBE: 'f1',
- 0xFFBF: 'f2',
- 0xFFC0: 'f3',
- 0xFFC1: 'f4',
- 0xFFC2: 'f5',
- 0xFFC3: 'f6',
- 0xFFC4: 'f7',
- 0xFFC5: 'f8',
- 0xFFC6: 'f9',
- 0xFFC7: 'f10',
- 0xFFC8: 'f11',
- 0xFFC9: 'f12',
- 0xFFCA: 'f13',
- 0xFFCB: 'f14',
- 0xFFCC: 'f15',
- 0xFFFF: 'delete',
-}
-
-class Event(GEvent):
- """Platform-dependent modifiers (boolean):
- mod1 The X11 MOD1 key.
- """
-
- button = None
- position = None
- global_position = None
- num_clicks = 0
- char = None
- key = None
- auto = 0
-
- def _gtk_key_event_of_interest(gtk_event):
- keyval = gtk_event.keyval
- return (keyval <= 0xFF
- or 0xFF00 <= keyval <= 0xFF1F
- or 0xFF80 <= keyval <= 0xFFBD
- or keyval == 0xFE20 # shift-tab
- or keyval == 0xFFFF
- or keyval in _gdk_keyval_to_keyname)
-
- _gtk_key_event_of_interest = staticmethod(_gtk_key_event_of_interest)
-
- def _from_gtk_key_event(cls, gtk_event):
- event = cls.__new__(cls)
- event._set_from_gtk_event(gtk_event)
- keyval = gtk_event.keyval
- event._keycode = keyval
- #print "Event._from_gtk_key_event: keyval = 0x%04X" % keyval ###
- key = _gdk_keyval_to_keyname.get(keyval, "")
- if keyval == 0xFFFF: # GDK_Delete
- char = "\x7F"
- elif keyval == 0xFF8D:
- char = "\r"
- elif keyval == 0xFE20: # shift-tab
- char = "\t"
- elif keyval <= 0xFF1F:
- if event.control:
- char = chr(keyval & 0x1F)
- else:
- char = chr(keyval & 0x7F)
- else:
- char = ""
- if not key and "\x20" <= char <= "\x7e":
- key = char
- event.char = char
- event.key = key
- event.unichars = unicode(char)
- return event
-
- _from_gtk_key_event = classmethod(_from_gtk_key_event)
-
- def _from_gtk_mouse_event(cls, gtk_event):
- event = cls.__new__(cls)
- event._set_from_gtk_event(gtk_event)
- if event.kind in ('mouse_down', 'mouse_up'):
- event.button = _gtk_button_to_button[gtk_event.button]
- event.position = (gtk_event.x, gtk_event.y)
- event.global_position = (gtk_event.x_root, gtk_event.y_root)
- return event
-
- _from_gtk_mouse_event = classmethod(_from_gtk_mouse_event)
-
- def _set_from_gtk_event(self, gtk_event):
- typ = gtk_event.type
- state = gtk_event.state
- if typ == gdk.MOTION_NOTIFY and state & _gdk_button_mask:
- self.kind = 'mouse_drag'
- else:
- self.kind = _gdk_event_type_to_kind[gtk_event.type]
- self.time = gtk_event.time / 1000.0
- self.shift = self.extend_contig = (state & gdk.SHIFT_MASK) <> 0
- self.control = self.extend_noncontig = (state & gdk.CONTROL_MASK) <> 0
- self.option = self.mod1 = (state & gdk.MOD1_MASK) <> 0
-
- def _platform_modifiers_str(self):
- return " mod1:%s" % (self.mod1)
-
-export(Event)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Files.py b/PyGUI-2.5.3/GUI/Gtk/Files.py
deleted file mode 100644
index 2807408..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Files.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - File references and types - Gtk
-#
-
-from GUI.GFiles import *
diff --git a/PyGUI-2.5.3/GUI/Gtk/Font.py b/PyGUI-2.5.3/GUI/Gtk/Font.py
deleted file mode 100644
index e9c3f7d..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Font.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#
-# Python GUI - Fonts - Gtk
-#
-
-from __future__ import division
-
-import sys
-import pango, gtk
-from gtk import gdk
-from GUI import export
-from GUI.GFonts import Font as GFont
-
-class Font(GFont):
-
- #_gdk_font = None
- _pango_font = None
- _pango_metrics = None
- _pango_layout = None
-
-# def _from_gdk_font(cls, gdk_font):
-# font = cls.__new__(cls)
-# font._gdk_font = gdk_font
-# return font
-#
-# _from_gdk_font = classmethod(_from_gdk_font)
-
- def _from_pango_description(cls, pango_description):
- font = cls.__new__(cls)
- font._pango_description = pango_description
- return font
-
- _from_pango_description = classmethod(_from_pango_description)
-
- def __init__(self, family, size = 12, style = []):
- if 'italic' in style:
- pango_style = pango.STYLE_ITALIC
- else:
- pango_style = pango.STYLE_NORMAL
- if 'bold' in style:
- pango_weight = pango.WEIGHT_BOLD
- else:
- pango_weight = pango.WEIGHT_NORMAL
- jigger = _find_size_correction_factor(family, pango_style, pango_weight)
- pfd = pango.FontDescription()
- pfd.set_family(family)
- pfd.set_size(int(round(jigger * size * pango.SCALE)))
- pfd.set_style(pango_style)
- pfd.set_weight(pango_weight)
- self._pango_description = pfd
-
- def get_family(self):
- return self._pango_description.get_family()
-
- def get_size(self):
- return self._pango_description.get_size() / pango.SCALE
-
- def get_style(self):
- style = []
- pfd = self._pango_description
- if pfd.get_weight() > pango.WEIGHT_NORMAL:
- style.append('bold')
- if pfd.get_style() <> pango.STYLE_NORMAL:
- style.append('italic')
- return style
-
- def get_ascent(self):
- self._get_pango_metrics()
- result = self._ascent
- return result
-
- def get_descent(self):
- self._get_pango_metrics()
- return self._descent
-
- def get_height(self):
- self._get_pango_metrics()
- return self._ascent + self._descent
-
- def get_line_height(self):
- return self.get_height()
-
- def _get_pango_metrics(self):
- #print "Font._get_pango_metrics: enter" ###
- pfm = self._pango_metrics
- if not pfm:
- pf = self._get_pango_font()
- pfm = pf.get_metrics()
- self._pango_metrics = pfm
- self._ascent = pfm.get_ascent() / pango.SCALE
- self._descent = pfm.get_descent() / pango.SCALE
- return pfm
-
- def _get_pango_font(self):
- pf = self._pango_font
- if not pf:
- pf = _pango_context.load_font(self._pango_description)
- if not pf:
- raise ValueError("Unable to load Pango font for %s" % self)
- self._pango_font = pf
- return pf
-
- def width(self, s, start = 0, end = sys.maxint):
- layout = self._get_pango_layout(s[start:end], True)
- return layout.get_pixel_size()[0]
-
- def text_size(self, text):
- layout = self._get_pango_layout(text, False)
- return layout.get_pixel_size()
- #w, h = layout.get_size()
- #u = pango.SCALE
- #return (w / u, h / u)
-
- def x_to_pos(self, s, x):
- layout = self._get_pango_layout(s, True)
- return pango_layout.xy_to_index(x, 0)
-
- def _get_pango_layout(self, text, single_paragraph_mode):
- layout = self._pango_layout
- if not layout:
- layout = pango.Layout(_pango_context)
- layout.set_font_description(self._pango_description)
- self._pango_layout = layout
- layout.set_single_paragraph_mode(single_paragraph_mode)
- layout.set_text(text)
- return layout
-
-
-_pango_context = gtk.Label().create_pango_context()
-
-_jigger_cache = {}
-
-def _find_size_correction_factor(family, pango_style, pango_weight):
- # Unlike the rest of the world, Pango seems to consider the point
- # size of a font to only include the ascent. So we first ask for
- # a 1-point font, find the ratio of its ascent to its descent,
- # and use that to adjust the size requested by the user.
- key = (family, pango_style, pango_weight)
- result = _jigger_cache.get(key)
- if result is None:
- pd = pango.FontDescription()
- pd.set_family(family)
- pd.set_size(pango.SCALE)
- pd.set_style(pango_style)
- pd.set_weight(pango_weight)
- pf = _pango_context.load_font(pd)
- pm = pf.get_metrics()
- a = pm.get_ascent()
- d = pm.get_descent()
- result = a / (a + d)
- #print "Jigger factor for font:", family, pango_style, pango_weight ###
- #print "ascent =", a, "descent =", d, "factor =", result ###
- _jigger_cache[key] = result
- return result
-
-export(Font)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Frame.py b/PyGUI-2.5.3/GUI/Gtk/Frame.py
deleted file mode 100644
index 2723a15..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Frame.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Python GUI - Frames - Gtk
-#
-
-from gtk import Fixed
-from GUI import export
-from GUI.GFrames import Frame as GFrame
-
-class Frame(GFrame):
-
- def __init__(self, **kwds):
- gtk_widget = Fixed()
- gtk_widget.show()
- GFrame.__init__(self, _gtk_outer = gtk_widget)
-
-export(Frame)
diff --git a/PyGUI-2.5.3/GUI/Gtk/GL.py b/PyGUI-2.5.3/GUI/Gtk/GL.py
deleted file mode 100644
index df93e8e..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/GL.py
+++ /dev/null
@@ -1,212 +0,0 @@
-#
-# PyGUI - OpenGL View - Gtk/GtkGLExt
-#
-
-try:
- from gtk import gdkgl, gtkgl
- from OpenGL.GL import glViewport
-except ImportError, e:
- raise ImportError("OpenGL support is not available (%s)" % e)
-
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI import ImageBase
-from GUI.GtkPixmaps import GtkPixmap
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-from GUI.GLDisplayLists import DisplayList
-
-#------------------------------------------------------------------------------
-
-def gtk_find_config_default(attr, mode_bit):
- try:
- cfg = gdkgl.Config(mode = mode_bit)
- value = cfg.get_attrib(attr)[0]
- except gdkgl.NoMatches:
- value = 0
- print "default for attr", attr, "=", value
- return value
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- _alpha = False
- _color_size = 1
- _alpha_size = 1
- _depth_size = 1
- _stencil_size = 1
- _accum_size = 1
-
- def _gtk_get_config(self):
- csize = self._color_size
- asize = 0
- dsize = 0
- ssize = 0
- acsize = 0
- aasize = 0
- if self._alpha:
- asize = self._alpha_size
- if self._depth_buffer:
- dsize = self._depth_size
- if self._stencil_buffer:
- ssize = self._stencil_size
- if self._accum_buffer:
- acsize = self._accum_size
- if self._alpha:
- aasize = acsize
- attrs = [
- gdkgl.RGBA,
- gdkgl.RED_SIZE, csize,
- gdkgl.GREEN_SIZE, csize,
- gdkgl.BLUE_SIZE, csize,
- gdkgl.ALPHA_SIZE, asize,
- gdkgl.AUX_BUFFERS, self._aux_buffers,
- gdkgl.DEPTH_SIZE, dsize,
- gdkgl.STENCIL_SIZE, ssize,
- gdkgl.ACCUM_RED_SIZE, acsize,
- gdkgl.ACCUM_GREEN_SIZE, acsize,
- gdkgl.ACCUM_BLUE_SIZE, acsize,
- gdkgl.ACCUM_ALPHA_SIZE, aasize,
- ]
- if self._double_buffer:
- attrs += [gdkgl.DOUBLEBUFFER]
- if self._stereo:
- attrs += [gdkgl.STEREO]
- if self._multisample:
- attrs += [
- gdkgl.SAMPLE_BUFFERS, 1,
- gdkgl.SAMPLES, self._samples_per_pixel
- ]
- result = self._gdkgl_config(attrs)
- if not result and self._double_buffer:
- attrs.remove(gdkgl.DOUBLEBUFFER)
- result = self._gdkgl_config(attrs)
- if not result:
- raise GLConfigError
- return result
-
- def _gdkgl_config(self, attrs):
- try:
- return gdkgl.Config(attrib_list = attrs)
- except gdkgl.NoMatches:
- return None
-
- def _gtk_set_config(self, gtk_config):
- def attr(key):
- return gtk_config.get_attrib(key)[0]
- self._color_size = attr(gdkgl.RED_SIZE)
- self._alpha_size = attr(gdkgl.ALPHA_SIZE)
- self._alpha = gtk_config.has_alpha()
- self._double_buffer = gtk_config.is_double_buffered()
- self._stereo = gtk_config.is_stereo()
- self._aux_buffers = attr(gdkgl.AUX_BUFFERS)
- self._depth_size = attr(gdkgl.DEPTH_SIZE)
- self._depth_buffer = gtk_config.has_depth_buffer()
- self._stencil_size = attr(gdkgl.STENCIL_SIZE)
- self._stencil_buffer = gtk_config.has_stencil_buffer()
- self._accum_size = attr(gdkgl.ACCUM_RED_SIZE)
- self._accum_buffer = gtk_config.has_accum_buffer()
- self._multisample = attr(gdkgl.SAMPLE_BUFFERS) <> 0
- self._samples_per_pixel = attr(gdkgl.SAMPLES)
-
- def supported(self, mode = 'both'):
- try:
- gtk_config = self._gtk_get_config()
- pf = GLConfig.__new__(GLConfig)
- pf._gtk_set_config(gtk_config)
- return pf
- except GLConfigError:
- return None
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- _first_expose = 0
-
- def __init__(self, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- GLContext.__init__(self, share_group, pf, kwds)
- gtk_share = self._gtk_get_share()
- area = gtkgl.DrawingArea(glconfig = self._gl_config, share_list = gtk_share,
- render_type = gdkgl.RGBA_TYPE)
- area.show()
- self._gtk_connect_after(area, "realize", self._gtk_realize_signal)
- self._gtk_connect(area, "expose-event", self._gtk_expose_event_signal)
- GGLView.__init__(self, _gtk_outer = area, _gtk_input = area,
- _gtk_focus = area)
- self.set(**kwds)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
- def _gtk_get_gl_context(self):
- if not self._gl_context:
- self._gtk_inner_widget.realize()
- return self._gl_context
-
- def _gtk_realize_signal(self):
- #print "GLView._gtk_realize_signal" ###
- area = self._gtk_inner_widget
- self._gl_drawable = area.get_gl_drawable()
- self._gl_context = area.get_gl_context()
- self.with_context(self.init_context)
-
- def _gtk_expose_event_signal(self, gtk_event):
- #print "GLView._gtk_expose_event_signal" ###
- if not self._first_expose:
- self.with_context(self._update_viewport)
- self._first_expose = 1
- try:
- self.with_context(self._render, flush = True)
- except:
- import sys, traceback
- sys.stderr.write("\n<<<<<<<<<< Exception while rendering a GLView\n")
- traceback.print_exc()
- sys.stderr.write(">>>>>>>>>>\n\n")
-
- def invalidate(self):
- gtk_window = self._gtk_outer_widget.window
- if gtk_window:
- width, height = self.size
- gtk_window.invalidate_rect((0, 0, width, height), 0)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GtkPixmap, GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- GLContext.__init__(self, share_group, pf, kwds)
- gl_config = pf._gtk_get_config()
- self._gl_config = gl_config
-# if share:
-# gtk_share = share.shared_context._gtk_get_gl_context()
-# else:
-# gtk_share = None
- gtk_share = self._gtk_get_share()
- GtkPixmap.__init__(self, width, height)
- gdk_pixmap = self._gdk_pixmap
- gdkgl.ext(gdk_pixmap)
- self._gl_drawable = gdk_pixmap.set_gl_capability(glconfig = gl_config)
- print "GLPixmap: self._gl_drawable =", self._gl_drawable ###
- self._gl_context = gdkgl.Context(
- self._gl_drawable,
- direct = False,
- share_list = gtk_share,
- render_type = gdkgl.RGBA_TYPE
- )
- print "GLPixmap: self._gl_context =", self._gl_context ###
- ImageBase.__init__(self, **kwds)
- self.with_context(self._init_context)
- print "GLPixmap: initialised context" ###
-
-# def _init_context(self):
-# width, height = self.size
-# glViewport(0, 0, int(width), int(height))
-# print "GLPixmap: Set viewport to", width, height ###
-# self.init_context()
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Gtk/GLContexts.py b/PyGUI-2.5.3/GUI/Gtk/GLContexts.py
deleted file mode 100644
index 1765565..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/GLContexts.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# PyGUI - GL Context - Gtk
-#
-
-from GUI.GGLContexts import GLContext as GGLContext
-
-try:
- from OpenGL.GL import glFlush
-except ImportError, e:
- raise ImportError("OpenGL support is not available (%s)" % e)
-
-class GLContext(GGLContext):
-
- _gl_drawable = None
- _gl_context = None
-
- def __init__(self, share_group, config, kwds):
- GGLContext.__init__(self, share_group)
- self._gl_config = config._gtk_get_config()
-
- def _gtk_get_share(self):
- shared_context = self._get_shared_context()
- if shared_context:
- return shared_context._gtk_get_gl_context()
- else:
- return None
-
- def _with_context(self, proc, flush):
- drawable = self._gl_drawable
- if drawable:
- if not drawable.gl_begin(self._gl_context):
- raise ValueError(
- "Unable to make %s the current OpenGL context (gl_begin failed)" % self)
- try:
- self._with_share_group(proc)
- if flush:
- if drawable.is_double_buffered():
- #print "GLContext.with_context: swapping buffers" ###
- drawable.swap_buffers()
- else:
- #print "GLContext.with_context: flushing" ###
- glFlush()
- finally:
- drawable.gl_end()
- #return result
-
diff --git a/PyGUI-2.5.3/GUI/Gtk/GLTextures.py b/PyGUI-2.5.3/GUI/Gtk/GLTextures.py
deleted file mode 100644
index d1fb55e..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/GLTextures.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Gtk
-#
-
-from GUI.GGLTextures import Texture as GTexture
-
-class Texture(GTexture):
-
- def _gl_get_texture_data(self, image):
- raise NotImplementedError("Loading texture from image not yet implemented for Gtk")
diff --git a/PyGUI-2.5.3/GUI/Gtk/Geometry.py b/PyGUI-2.5.3/GUI/Gtk/Geometry.py
deleted file mode 100644
index 2ebbd95..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Geometry.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - Points and Rectangles - Gtk
-#
-
-from GUI.GGeometry import *
diff --git a/PyGUI-2.5.3/GUI/Gtk/GtkImageScaling.py b/PyGUI-2.5.3/GUI/Gtk/GtkImageScaling.py
deleted file mode 100644
index 119ddb5..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/GtkImageScaling.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Python GUI - Image scaling utilities - Gtk
-#
-
-from gtk import gdk
-
-def gtk_scale_pixbuf(src_pixbuf, sx, sy, sw, sh, dw, dh):
- """Return a new pixbuf containing the specified part of
- the given pixbuf scaled to the specified size."""
- dst_pixbuf = gdk.Pixbuf(
- src_pixbuf.get_colorspace(), src_pixbuf.get_has_alpha(),
- src_pixbuf.get_bits_per_sample(), dw, dh)
- xscale = float(dw) / sw
- yscale = float(dh) / sh
- xoffset = - xscale * sx
- yoffset = - yscale * sy
- src_pixbuf.scale(dst_pixbuf, 0, 0, dw, dh,
- xoffset, yoffset, xscale, yscale, gdk.INTERP_BILINEAR)
- return dst_pixbuf
diff --git a/PyGUI-2.5.3/GUI/Gtk/GtkPixmaps.py b/PyGUI-2.5.3/GUI/Gtk/GtkPixmaps.py
deleted file mode 100644
index e7908e5..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/GtkPixmaps.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Python GUI - Gtk - Common pixmap code
-#
-
-from gtk import gdk
-from GUI.StdColors import clear
-from GUI.GtkImageScaling import gtk_scale_pixbuf
-from GUI import Canvas
-
-class GtkPixmap:
-
- def __init__(self, width, height):
- gdk_root = gdk.get_default_root_window()
- self._gdk_pixmap = gdk.Pixmap(gdk_root, width, height)
- #ctx = self._gdk_pixmap.cairo_create()
- #self._gtk_surface = ctx.get_target()
-
- def _gtk_set_source(self, ctx, x, y):
- ctx.set_source_pixmap(self._gdk_pixmap, x, y)
-
- def get_width(self):
- return self._gdk_pixmap.get_size()[0]
-
- def get_height(self):
- return self._gdk_pixmap.get_size()[1]
-
- def get_size(self):
- return self._gdk_pixmap.get_size()
-
- def with_canvas(self, proc):
- canvas = Canvas._from_gdk_drawable(self._gdk_pixmap)
- canvas.backcolor = clear
- proc(canvas)
-
diff --git a/PyGUI-2.5.3/GUI/Gtk/Image.py b/PyGUI-2.5.3/GUI/Gtk/Image.py
deleted file mode 100644
index 1bd4017..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Image.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Python GUI - Images - Gtk
-#
-
-from __future__ import division
-from array import array
-import cairo
-from gtk import gdk
-from GUI import export
-from GUI.GImages import Image as GImage
-
-class Image(GImage):
-
- def _init_from_file(self, file):
- self._gdk_pixbuf = gdk.pixbuf_new_from_file(file)
-
- def _from_gdk_pixbuf(cls, gdk_pixbuf):
- self = cls.__new__(cls)
- self._gdk_pixbuf = gdk_pixbuf
- return self
-
- _from_gdk_pixbuf = classmethod(_from_gdk_pixbuf)
-
- def _gtk_set_source(self, ctx, x, y):
- ctx.set_source_pixbuf(self._gdk_pixbuf, x, y)
-
- def get_width(self):
- return self._gdk_pixbuf.get_width()
-
- def get_height(self):
- return self._gdk_pixbuf.get_height()
-
-export(Image)
diff --git a/PyGUI-2.5.3/GUI/Gtk/ImageBase.py b/PyGUI-2.5.3/GUI/Gtk/ImageBase.py
deleted file mode 100644
index 873c51f..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/ImageBase.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# PyGUI - Image Base - Gtk
-#
-
-from __future__ import division
-from GUI import export
-from GUI.GImageBases import ImageBase as GImageBase
-
-class ImageBase(GImageBase):
-
-# def get_width(self):
-# return self._gtk_surface.get_width()
-#
-# def get_height(self):
-# return self._gtk_surface.get_height()
-
- def draw(self, canvas, src_rect, dst_rect):
- sx, sy, sr, sb = src_rect
- dx, dy, dr, db = dst_rect
- sw = sr - sx
- sh = sb - sy
- dw = dr - dx
- dh = db - dy
- ctx = canvas._gtk_ctx
- ctx.save()
- ctx.translate(dx, dy)
- ctx.new_path()
- ctx.rectangle(0, 0, dw, dh)
- ctx.clip()
- ctx.scale(dw / sw, dh / sh)
- self._gtk_set_source(canvas._gtk_ctx, -sx, -sy)
- ctx.paint()
- ctx.restore()
-
-export(ImageBase)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Label.py b/PyGUI-2.5.3/GUI/Gtk/Label.py
deleted file mode 100644
index 9699177..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Label.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Python GUI - Labels - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.GLabels import Label as GLabel
-
-class Label(GLabel):
-
- _vertical_padding = 6
-
- def __init__(self, text = "New Label", font = system_font, **kwds):
- width, height = font.text_size(text)
- gtk_label = gtk.Label(text)
- gtk_label.set_alignment(0.0, 0.5)
- gtk_label.set_size_request(width, height + self._vertical_padding)
- gtk_label.show()
- GLabel.__init__(self, _gtk_outer = gtk_label, font = font, **kwds)
-
- def get_text(self):
- return self._gtk_outer_widget.get_text()
-
- def set_text(self, text):
- self._gtk_outer_widget.set_text(text)
-
- def _gtk_get_alignment(self):
- return self._gtk_outer_widget.get_alignment()[0]
-
- def _gtk_set_alignment(self, fraction, just):
- gtk_label = self._gtk_outer_widget
- gtk_label.set_alignment(fraction, 0.0)
- gtk_label.set_justify(just)
-
-export(Label)
diff --git a/PyGUI-2.5.3/GUI/Gtk/ListButton.py b/PyGUI-2.5.3/GUI/Gtk/ListButton.py
deleted file mode 100644
index 7d3d75c..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/ListButton.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - Pop-up list control - Gtk
-#
-#--------------------------------------------------------------
-
-import gtk
-from GUI import export
-from GUI.GListButtons import ListButton as GListButton
-
-class ListButton(GListButton):
-
- _gtk_suppress_action = False
-
- def __init__(self, **kwds):
- titles, values = self._extract_initial_items(kwds)
- self._titles = titles
- self._values = values
- gtk_widget = gtk.combo_box_new_text()
- gtk_widget.connect('changed', self._gtk_changed_signalled)
- gtk_widget.set_property('focus_on_click', False)
- gtk_widget.show()
- self._gtk_update_items(gtk_widget)
- GListButton.__init__(self, _gtk_outer = gtk_widget, **kwds)
-
- def _update_items(self):
- self._gtk_update_items(self._gtk_outer_widget)
-
- def _gtk_update_items(self, gtk_widget):
- self._gtk_suppress_action = True
- n = gtk_widget.get_model().iter_n_children(None)
- for i in xrange(n - 1, -1, -1):
- gtk_widget.remove_text(i)
- for title in self._titles:
- gtk_widget.append_text(title)
- self._gtk_suppress_action = False
-
- def _get_selected_index(self):
- return self._gtk_outer_widget.get_active()
-
- def _set_selected_index(self, i):
- self._gtk_suppress_action = True
- self._gtk_outer_widget.set_active(i)
- self._gtk_suppress_action = False
-
- def _gtk_changed_signalled(self, _):
- if not self._gtk_suppress_action:
- self.do_action()
-
-export(ListButton)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Menu.py b/PyGUI-2.5.3/GUI/Gtk/Menu.py
deleted file mode 100644
index 05b9e65..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Menu.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Python GUI - Menus - Gtk version
-#
-
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI.Globals import application
-from GUI.GMenus import Menu as GMenu, MenuItem
-
-def _report_accel_changed_(*args):
- print "Menus: accel_changed:", args
-
-class Menu(GMenu):
-
- def __init__(self, title, items, **kwds):
- GMenu.__init__(self, title, items, **kwds)
- self._gtk_menu = gtk.Menu()
- self._gtk_accel_group = gtk.AccelGroup()
- #self._gtk_accel_group.connect('accel_changed', _report_accel_changed_) ###
-
- def _clear_platform_menu(self):
- gtk_menu = self._gtk_menu
- for gtk_item in gtk_menu.get_children():
- gtk_item.destroy()
-
- def _add_separator_to_platform_menu(self):
- gtk_item = gtk.MenuItem()
- gtk_item.set_sensitive(0)
- gtk_separator = gtk.HSeparator()
- gtk_item.add(gtk_separator)
- self._gtk_add_item(gtk_item)
-
- def _gtk_add_item(self, gtk_item):
- gtk_item.show_all()
- self._gtk_menu.append(gtk_item)
-
- def _add_item_to_platform_menu(self, item, name, command = None, index = None):
- checked = item.checked
- if checked is None:
- gtk_item = gtk.MenuItem(name)
- else:
- gtk_item = gtk.CheckMenuItem(name)
- self._gtk_add_item(gtk_item)
- if not item.enabled:
- gtk_item.set_sensitive(0)
- if checked:
- gtk_item.set_active(1)
- if command:
- app = application()
- if index is not None:
- action = lambda widget: app.dispatch(command, index)
- else:
- action = lambda widget: app.dispatch(command)
- gtk_item.connect('activate', action)
- key = item._key
- if key:
- gtk_modifiers = gdk.CONTROL_MASK
- if item._shift:
- gtk_modifiers |= gdk.SHIFT_MASK
- if item._option:
- gtk_modifiers |= gdk.MOD1_MASK
- gtk_item.add_accelerator('activate', self._gtk_accel_group,
- ord(key), gtk_modifiers, gtk.ACCEL_VISIBLE)
-
-export(Menu)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Numerical.py b/PyGUI-2.5.3/GUI/Gtk/Numerical.py
deleted file mode 100644
index 8cec11b..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Numerical.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - NumPy interface - Gtk
-#
-#--------------------------------------------------------------
-
-from gtk import gdk
-from GUI import Image
-
-def image_from_ndarray(array, format, size = None):
- """
- Creates an Image from a numpy ndarray object. The format
- may be 'RGB' or 'RGBA'. If a size is specified, the array
- will be implicitly reshaped to that size, otherwise the size
- is inferred from the first two dimensions of the array.
- """
- if array.itemsize <> 1:
- raise ValueError("Color component size must be 1 byte")
- if size is None:
- shape = array.shape
- if len(shape) <> 3:
- raise ValueError("Array has wrong number of dimensions")
- width, height, pixel_size = shape
- if pixel_size <> len(format):
- raise ValueError("Last dimension of array does not match format")
- else:
- width, height = size
- pixel_size = len(format)
- data_size = array.size
- if data_size <> width * height * pixel_size:
- raise ValueError("Array has wrong shape for specified size and format")
- alpha = pixel_size == 4
- gdk_pixbuf = gdk.pixbuf_new_from_data(array, gdk.COLORSPACE_RGB, alpha,
- 8, width, height, width * pixel_size)
- image = Image._from_gdk_pixbuf(gdk_pixbuf)
- #image._data = array ###
- return image
diff --git a/PyGUI-2.5.3/GUI/Gtk/PIL.py b/PyGUI-2.5.3/GUI/Gtk/PIL.py
deleted file mode 100644
index 2c09c3e..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/PIL.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - PIL interface - Gtk
-#
-#--------------------------------------------------------------
-
-from gtk import gdk
-from gtk.gdk import COLORSPACE_RGB
-from GUI import Image
-
-def image_from_pil_image(pil_image):
- """Creates an Image from a Python Imaging Library (PIL)
- Image object."""
- mode = pil_image.mode
- w, h = pil_image.size
- data = pil_image.tostring()
- if mode == "RGB":
- bps = 3; alpha = False
- elif mode == "RGBA":
- bps = 4; alpha = True
- else:
- raise ValueError("Unsupported PIL image mode '%s'" % mode)
- bpr = w * bps
- image = Image.__new__(Image)
- image._gdk_pixbuf = gdk.pixbuf_new_from_data(data, COLORSPACE_RGB,
- alpha, 8, w, h, bpr)
- return image
diff --git a/PyGUI-2.5.3/GUI/Gtk/Pixmap.py b/PyGUI-2.5.3/GUI/Gtk/Pixmap.py
deleted file mode 100644
index 1a0c452..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Pixmap.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Python GUI - Pixmap - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GtkPixmaps import GtkPixmap
-from GUI.GPixmaps import Pixmap as GPixmap
-
-class Pixmap(GtkPixmap, GPixmap):
-
- def __init__(self, width, height):
- GtkPixmap.__init__(self, width, height)
-
-export(Pixmap)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Printing.py b/PyGUI-2.5.3/GUI/Gtk/Printing.py
deleted file mode 100644
index 5ee9da3..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Printing.py
+++ /dev/null
@@ -1,188 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Gtk
-#
-#------------------------------------------------------------------------------
-
-import gtk, gtkunixprint
-from gtk import UNIT_POINTS
-from GUI import Canvas
-from GUI.GPrinting import PageSetup as GPageSetup, Printable as GPrintable, \
- Paginator
-
-gtk_paper_names = [
- gtk.PAPER_NAME_A3,
- gtk.PAPER_NAME_A4,
- gtk.PAPER_NAME_A5,
- gtk.PAPER_NAME_B5,
- gtk.PAPER_NAME_LETTER,
- gtk.PAPER_NAME_EXECUTIVE,
- gtk.PAPER_NAME_LEGAL,
-]
-
-gtk_paper_formats = {}
-
-gtk_print_settings = gtk.PrintSettings()
-
-def init_gtk_paper_formats():
- for gtk_name in gtk_paper_names:
- display_name = gtk.PaperSize(gtk_name).get_display_name()
- gtk_paper_formats[display_name] = gtk_name
-
-init_gtk_paper_formats()
-
-def gtk_default_page_setup():
- pset = gtk.PageSetup()
- pset.set_paper_size(gtk.PaperSize())
- return pset
-
-def get_gtk_state(gtk_page_setup):
- state = {}
- state['orientation'] = gtk_page_setup.get_orientation()
- state['paper_size'] = gtk_page_setup.get_paper_size().get_name()
- state['top_margin'] = gtk_page_setup.get_top_margin(UNIT_POINTS)
- state['bottom_margin'] = gtk_page_setup.get_bottom_margin(UNIT_POINTS)
- state['left_margin'] = gtk_page_setup.get_left_margin(UNIT_POINTS)
- state['right_margin'] = gtk_page_setup.get_right_margin(UNIT_POINTS)
- return state
-
-def set_gtk_state(gtk_page_setup, state):
- gtk_page_setup.set_orientation(state['orientation'])
- gtk_page_setup.set_paper_size(gtk.PaperSize(state['paper_size']))
- gtk_page_setup.set_top_margin(state['top_margin'], UNIT_POINTS)
- gtk_page_setup.set_bottom_margin(state['bottom_margin'], UNIT_POINTS)
- gtk_page_setup.set_left_margin(state['left_margin'], UNIT_POINTS)
- gtk_page_setup.set_right_margin(state['right_margin'], UNIT_POINTS)
-
-#------------------------------------------------------------------------------
-
-class PageSetup(GPageSetup):
-
- _printer_name = ""
- _left_margin = 36
- _top_margin = 36
- _right_margin = 36
- _bottom_margin = 36
-
- def __init__(self):
- self._gtk_page_setup = gtk_default_page_setup()
-
- def __getstate__(self):
- state = GPageSetup.__getstate__(self)
- state['_gtk_page_setup'] = get_gtk_state(self._gtk_page_setup)
- return state
-
- def __setstate__(self, state):
- gtk_setup = gtk_default_page_setup()
- self._gtk_page_setup = gtk_setup
- gtk_state = state.pop('_gtk_page_setup', None)
- if gtk_state:
- set_gtk_state(gtk_setup, gtk_state)
- self.margins = state['margins']
- self.printer_name = state['printer_name']
- else:
- GPageSetup.__setstate__(state)
-
- def get_paper_name(self):
- return self._gtk_page_setup.get_paper_size().get_display_name()
-
- def set_paper_name(self, x):
- psize = gtk.PaperSize(gtk_paper_formats.get(x) or x)
- self._gtk_page_setup.set_paper_size(psize)
-
- def get_paper_width(self):
- return self._gtk_page_setup.get_paper_width(UNIT_POINTS)
-
- def set_paper_width(self, x):
- self._gtk_page_setup.set_paper_width(x, UNIT_POINTS)
-
- def get_paper_height(self):
- return self._gtk_page_setup.get_paper_height(UNIT_POINTS)
-
- def set_paper_height(self, x):
- self._gtk_page_setup.set_paper_height(x, UNIT_POINTS)
-
- def get_orientation(self):
- o = self._gtk_page_setup.get_orientation()
- if o in (gtk.PAGE_ORIENTATION_LANDSCAPE,
- gtk.PAGE_ORIENTATION_REVERSE_LANDSCAPE):
- return 'landscape'
- else:
- return 'portrait'
-
- def set_orientation(self, x):
- if x == 'landscape':
- o = gtk.PAGE_ORIENTATION_LANDSCAPE
- else:
- o = gtk.PAGE_ORIENTATION_PORTRAIT
- self._gtk_page_setup.set_orientation(o)
-
- def get_left_margin(self):
- return self._left_margin
-
- def get_top_margin(self):
- return self._top_margin
-
- def get_right_margin(self):
- return self._right_margin
-
- def get_bottom_margin(self):
- return self._bottom_margin
-
- def set_left_margin(self, x):
- self._left_margin = x
-
- def set_top_margin(self, x):
- self._top_margin = x
-
- def set_right_margin(self, x):
- self._right_margin = x
-
- def set_bottom_margin(self, x):
- self._bottom_margin = x
-
- def get_printer_name(self):
- return self._printer_name
-
- def set_printer_name(self, x):
- self._printer_name = x
-
-#------------------------------------------------------------------------------
-
-class Printable(GPrintable):
-
- def print_view(self, page_setup, prompt = True):
- global gtk_print_settings
- paginator = Paginator(self, page_setup)
-
- def draw_page(_, gtk_print_context, page_num):
- cairo_context = gtk_print_context.get_cairo_context()
- canvas = Canvas._from_cairo_context(cairo_context)
- paginator.draw_page(canvas, page_num)
-
- gtk_op = gtk.PrintOperation()
- gtk_op.set_print_settings(gtk_print_settings)
- gtk_op.set_default_page_setup(page_setup._gtk_page_setup)
- gtk_op.set_n_pages(paginator.num_pages)
- gtk_op.set_use_full_page(True)
- gtk_op.set_unit(UNIT_POINTS)
- gtk_op.connect('draw-page', draw_page)
- if prompt:
- action = gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG
- else:
- action = gtk.PRINT_OPERATION_ACTION_PRINT
- result = gtk_op.run(action)
- if result == gtk.PRINT_OPERATION_RESULT_APPLY:
- gtk_print_settings = gtk_op.get_print_settings()
-
-#------------------------------------------------------------------------------
-
-def present_page_setup_dialog(page_setup):
- old_setup = page_setup._gtk_page_setup
- ps = gtk.PrintSettings()
- new_setup = gtk.print_run_page_setup_dialog(None, old_setup, ps)
- if get_gtk_state(old_setup) <> get_gtk_state(new_setup):
- page_setup._gtk_page_setup = new_setup
- return True
- else:
- return False
diff --git a/PyGUI-2.5.3/GUI/Gtk/RadioButton.py b/PyGUI-2.5.3/GUI/Gtk/RadioButton.py
deleted file mode 100644
index 3db37a1..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/RadioButton.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Python GUI - Radio buttons - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GRadioButtons import RadioButton as GRadioButton
-
-class RadioButton(GRadioButton):
-
- def __init__(self, title = "New Control", **kwds):
- gtk_radiobutton = gtk.RadioButton(None, title)
- gtk_radiobutton.show()
- self._gtk_connect(gtk_radiobutton, 'toggled', self._gtk_toggled_signal)
- GRadioButton.__init__(self, _gtk_outer = gtk_radiobutton, **kwds)
-
- def _value_changed(self):
- group = self._group
- if group:
- if self._value == group._value:
- self._turn_on()
- else:
- group._turn_all_off()
-
- def _turn_on(self):
- self._gtk_outer_widget.set_active(1)
-
- def _is_on(self):
- return self._gtk_outer_widget.get_active()
-
- def _gtk_toggled_signal(self):
- if self._is_on():
- group = self._group
- if group and group._value <> self._value:
- group._value = self._value
- group.do_action()
-
-export(RadioButton)
diff --git a/PyGUI-2.5.3/GUI/Gtk/RadioGroup.py b/PyGUI-2.5.3/GUI/Gtk/RadioGroup.py
deleted file mode 100644
index 92b0e80..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/RadioGroup.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Python GUI - Radio groups - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GRadioGroups import RadioGroup as GRadioGroup
-
-class RadioGroup(GRadioGroup):
-
- def __init__(self, items = [], **kwds):
- self._gtk_dummy_radiobutton = gtk.RadioButton()
- GRadioGroup.__init__(self, items, **kwds)
-
- def _item_added(self, item):
- old_value = self._value
- item._gtk_outer_widget.set_group(self._gtk_dummy_radiobutton)
- self.value = old_value
-
- def _item_removed(self, item):
- item._gtk_outer_widget.set_group(None)
- if item._value == self._value:
- self._value = None
- self._turn_all_off()
-
- def _value_changed(self):
- new_value = self._value
- for item in self._items:
- if item._value == new_value:
- item._turn_on()
- return
- self._turn_all_off()
-
- def _turn_all_off(self):
- self._gtk_dummy_radiobutton.set_active(1)
-
-export(RadioGroup)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Scrollable.py b/PyGUI-2.5.3/GUI/Gtk/Scrollable.py
deleted file mode 100644
index dccb3dd..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Scrollable.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Python GUI - Common code for scrollable components - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI import Globals
-
-gtk_scroll_policies = [gtk.POLICY_NEVER, gtk.POLICY_ALWAYS]
-
-
-class Scrollable(object):
-
- gtk_scrollbar_breadth = gtk.VScrollbar().size_request()[0] + 3
- s = gtk.ScrolledWindow().get_style()
- gtk_border_thickness = (s.xthickness, s.ythickness)
- del s
-
- def get_hscrolling(self):
- return self._gtk_outer_widget.get_property('hscrollbar-policy') <> gtk.POLICY_NEVER
-
- def set_hscrolling(self, value):
- self._gtk_outer_widget.set_property('hscrollbar-policy', gtk_scroll_policies[value])
-
- def get_vscrolling(self):
- return self._gtk_outer_widget.get_property('vscrollbar-policy') <> gtk.POLICY_NEVER
-
- def set_vscrolling(self, value):
- self._gtk_outer_widget.set_property('vscrollbar-policy', gtk_scroll_policies[value])
-
-export(Scrollable)
diff --git a/PyGUI-2.5.3/GUI/Gtk/ScrollableView.py b/PyGUI-2.5.3/GUI/Gtk/ScrollableView.py
deleted file mode 100644
index 8712d62..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/ScrollableView.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# Python GUI - Scrollable Views - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI import Scrollable
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount, default_scrolling
-
-class ScrollableView(GScrollableView, Scrollable):
-
- def __init__(self, extent = default_extent,
- line_scroll_amount = default_line_scroll_amount,
- scrolling = default_scrolling,
- **kwds):
- gtk_scrolled_window = gtk.ScrolledWindow()
- gtk_scrolled_window.show()
- GScrollableView.__init__(self, _gtk_outer = gtk_scrolled_window,
- extent = extent, line_scroll_amount = line_scroll_amount,
- scrolling = scrolling)
- self.set(**kwds)
-
- #
- # Properties
- #
-
- def get_border(self):
- return self._gtk_outer_widget.get_shadow_type() <> gtk.SHADOW_NONE
-
- def set_border(self, x):
- if x:
- s = gtk.SHADOW_IN
- else:
- s = gtk.SHADOW_NONE
- self._gtk_outer_widget.set_shadow_type(s)
-
- def get_content_width(self):
- w = self._size[0]
- if self.hscrolling:
- w -= self.gtk_scrollbar_breadth
- if self.border:
- w -= 2 * self.gtk_border_thickness[0]
- return w
-
- def get_content_height(self):
- h = self._size[1]
- if self.vscrolling:
- h -= self.gtk_scrollbar_breadth
- if self.border:
- h -= 2 * self.gtk_border_thickness[1]
- return h
-
- def get_content_size(self):
- return self.content_width, self.content_height
-
- def set_content_size(self, size):
- w, h = size
- d = self.gtk_scrollbar_breadth
- if self.hscrolling:
- w += d
- if self.vscrolling:
- h += d
- if self.border:
- b = self.gtk_border_thickness
- w += 2 * b[0]
- h += 2 * b[1]
- self.size = (w, h)
-
- def get_extent(self):
- return self._gtk_inner_widget.get_size()
-
- def set_extent(self, (w, h)):
- self._gtk_inner_widget.set_size(int(round(w)), int(round(h)))
-
- def get_scroll_offset(self):
- hadj, vadj = self._gtk_adjustments()
- return int(hadj.value), int(vadj.value)
-
- def set_scroll_offset(self, (x, y)):
- hadj, vadj = self._gtk_adjustments()
- hadj.set_value(min(float(x), hadj.upper - hadj.page_size))
- vadj.set_value(min(float(y), vadj.upper - vadj.page_size))
-
- def get_line_scroll_amount(self):
- hadj, vadj = self._gtk_adjustments()
- return hadj.step_increment, vadj.step_increment
-
- def set_line_scroll_amount(self, (dx, dy)):
- hadj, vadj = self._gtk_adjustments()
- hadj.step_increment = float(dx) # Amazingly, ints are not
- vadj.step_increment = float(dy) # acceptable here.
-
- #
- # Internal
- #
-
- def _gtk_adjustments(self):
- gtk_widget = self._gtk_inner_widget
- hadj = gtk_widget.get_hadjustment()
- vadj = gtk_widget.get_vadjustment()
- return hadj, vadj
-
-export(ScrollableView)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Slider.py b/PyGUI-2.5.3/GUI/Gtk/Slider.py
deleted file mode 100644
index 015d177..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Slider.py
+++ /dev/null
@@ -1,157 +0,0 @@
-#
-# Python GUI - Slider - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GSliders import Slider as GSlider
-
-class Slider(GSlider):
-
- _gtk_tick_length = 8
- _gtk_tick_inset = 18
-
- def __init__(self, orient = 'h', ticks = 0, **kwds):
- self._orient = orient
- self._ticks = ticks
- self._discrete = False
- self._live = True
- self._gtk_ticks = None
- length = 100
- gtk_adjustment = gtk.Adjustment(upper = 1.0)
- xs = 0.0
- ys = 0.0
- if orient == 'h':
- gtk_scale = gtk.HScale(gtk_adjustment)
- gtk_scale.set_size_request(length, -1)
- gtk_box = gtk.VBox()
- xs = 1.0
- elif orient == 'v':
- gtk_scale = gtk.VScale(gtk_adjustment)
- gtk_scale.set_size_request(-1, length)
- gtk_box = gtk.HBox()
- ys = 1.0
- else:
- raise ValueError("Invalid orientation, should be 'h' or 'v'")
- gtk_scale.set_draw_value(False)
- self._gtk_scale = gtk_scale
- gtk_box.pack_start(gtk_scale)
- self._gtk_box = gtk_box
- if ticks:
- self._gtk_create_ticks()
- gtk_alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
- xscale = xs, yscale = ys)
- gtk_alignment.add(gtk_box)
- gtk_alignment.show_all()
- self._gtk_connect(gtk_adjustment, 'value-changed', self._gtk_value_changed)
- self._gtk_connect(gtk_scale, 'change-value', self._gtk_change_value)
- self._gtk_connect(gtk_scale, 'button-release-event', self._gtk_button_release)
- self._gtk_scale = gtk_scale
- self._gtk_adjustment = gtk_adjustment
- self._gtk_enable_action = True
- GSlider.__init__(self, _gtk_outer = gtk_alignment, **kwds)
-
- def get_min_value(self):
- return self._min_value
-
- def set_min_value(self, x):
- self._gtk_adjustment.lower = x
-
- def get_max_value(self):
- return self._max_value
-
- def set_max_value(self, x):
- self._gtk_adjustment.upper = x
-
- def get_value(self):
- return self._gtk_adjustment.value
-
- def set_value(self, x):
- self._gtk_enable_action = False
- self._gtk_adjustment.value = x
- self._gtk_enable_action = True
-
- def get_ticks(self):
- return self._ticks
-
- def set_ticks(self, x):
- self._ticks = x
- if x:
- self._gtk_create_ticks()
- else:
- self._gtk_destroy_ticks()
-
- def get_discrete(self):
- return self._discrete
-
- def set_discrete(self, x):
- self._discrete = x
-
- def get_live(self):
- return self._live
-
- def set_live(self, x):
- self._live = x
-
- def _gtk_create_ticks(self):
- if not self._gtk_ticks:
- gtk_ticks = gtk.DrawingArea()
- length = self._gtk_tick_length
- if self._orient == 'h':
- gtk_ticks.set_size_request(-1, length)
- else:
- gtk_ticks.set_size_request(length, -1)
- self._gtk_ticks = gtk_ticks
- self._gtk_connect(gtk_ticks, 'expose-event', self._gtk_draw_ticks)
- self._gtk_box.pack_start(gtk_ticks)
-
- def _gtk_destroy_ticks(self):
- gtk_ticks = self._gtk_ticks
- if gtk_ticks:
- gtk_ticks.destroy()
- self._gtk_ticks = None
-
- def _gtk_draw_ticks(self, event):
- gtk_ticks = self._gtk_ticks
- gdk_win = gtk_ticks.window
- gtk_style = gtk_ticks.style
- orient = self._orient
- steps = self._ticks - 1
- _, _, w, h = gtk_ticks.allocation
- u0 = self._gtk_tick_inset
- v0 = 0
- if orient == 'h':
- draw_line = gtk_style.paint_vline
- u1 = w - u0
- v1 = h
- else:
- draw_line = gtk_style.paint_hline
- u1 = h - u0
- v1 = w
- state = gtk.STATE_NORMAL
- for i in xrange(steps + 1):
- u = u0 + i * (u1 - u0) / steps
- draw_line(gdk_win, state, None, gtk_ticks, "", v0, v1, u)
-
- def _gtk_value_changed(self):
- if self._live and self._gtk_enable_action:
- self.do_action()
-
- def _gtk_change_value(self, event_type, value):
- gtk_adjustment = self._gtk_adjustment
- vmin = gtk_adjustment.lower
- vmax = gtk_adjustment.upper
- value = min(max(vmin, value), vmax)
- if self._discrete:
- steps = self._ticks - 1
- if steps > 0:
- q = round(steps * (value - vmin) / (vmax - vmin))
- value = vmin + q * (vmax - vmin) / steps
- if gtk_adjustment.value <> value:
- gtk_adjustment.value = value
- return True
-
- def _gtk_button_release(self, gtk_event):
- self.do_action()
-
-export(Slider)
diff --git a/PyGUI-2.5.3/GUI/Gtk/StdCursors.py b/PyGUI-2.5.3/GUI/Gtk/StdCursors.py
deleted file mode 100644
index be943e9..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/StdCursors.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Python GUI - Standard Cursors - Gtk
-#
-
-from gtk import gdk
-from GUI import Cursor
-
-__all__ = [
- 'arrow',
- 'ibeam',
- 'crosshair',
- 'fist',
- 'hand',
- 'finger',
- 'invisible',
-]
-
-arrow = Cursor._from_gtk_std_cursor(gdk.LEFT_PTR)
-ibeam = Cursor._from_gtk_std_cursor(gdk.XTERM)
-crosshair = Cursor._from_gtk_std_cursor(gdk.TCROSS)
-fist = Cursor("cursors/fist.tiff")
-hand = Cursor("cursors/hand.tiff")
-finger = Cursor("cursors/finger.tiff")
-invisible = Cursor._from_nothing()
-
-del gdk
-del Cursor
-
-def empty_cursor():
- return invisible
diff --git a/PyGUI-2.5.3/GUI/Gtk/StdFonts.py b/PyGUI-2.5.3/GUI/Gtk/StdFonts.py
deleted file mode 100644
index 9281638..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/StdFonts.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Python GUI - Standard Fonts - Gtk
-#
-
-import gtk
-from GUI import Font
-
-system_font = Font._from_pango_description(gtk.Label().style.font_desc)
-application_font = Font._from_pango_description(gtk.Entry().style.font_desc)
diff --git a/PyGUI-2.5.3/GUI/Gtk/StdMenus.py b/PyGUI-2.5.3/GUI/Gtk/StdMenus.py
deleted file mode 100644
index c60f653..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/StdMenus.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Python GUI - Standard Menus - Gtk
-#
-
-from GUI.GStdMenus import build_menus, \
- fundamental_cmds, help_cmds, pref_cmds, file_cmds, print_cmds, edit_cmds
-
-_file_menu_items = [
- ("New/N", 'new_cmd'),
- ("Open.../O", 'open_cmd'),
- ("Close/W", 'close_cmd'),
- "-",
- ("Save/S", 'save_cmd'),
- ("Save As...", 'save_as_cmd'),
- ("Revert", 'revert_cmd'),
- "-",
- ("Page Setup...", 'page_setup_cmd'),
- ("Print.../P", 'print_cmd'),
- "-",
- ("Quit/Q", 'quit_cmd'),
-]
-
-_edit_menu_items = [
- ("Undo/Z", 'undo_cmd'),
- ("Redo/^Z", 'redo_cmd'),
- "-",
- ("Cut/X", 'cut_cmd'),
- ("Copy/C", 'copy_cmd'),
- ("Paste/V", 'paste_cmd'),
- ("Clear", 'clear_cmd'),
- "-",
- ("Select All/A", 'select_all_cmd'),
- "-",
- ("Preferences...", 'preferences_cmd'),
-]
-
-_help_menu_items = [
- ("About ", 'about_cmd'),
-]
-
-#------------------------------------------------------------------------------
-
-def basic_menus(substitutions = {}, include = None, exclude = None):
- return build_menus([
- ("File", _file_menu_items, False),
- ("Edit", _edit_menu_items, False),
- ("Help", _help_menu_items, True),
- ],
- substitutions = substitutions,
- include = include,
- exclude = exclude)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Task.py b/PyGUI-2.5.3/GUI/Gtk/Task.py
deleted file mode 100644
index ae2a791..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Task.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# PyGUI - Tasks - Gtk
-#
-
-import gobject
-from GUI import export
-from GUI.GTasks import Task as GTask
-
-class Task(GTask):
-
- def __init__(self, proc, interval, repeat = 0, start = 1):
- self._proc = proc
- self._gtk_interval = int(interval * 1000)
- self._repeat = repeat
- self._gtk_timeout_id = None
- if start:
- self.start()
-
- def get_scheduled(self):
- return self._gtk_timeout_id is not None
-
- def get_interval(self):
- return self._gtk_interval / 1000.0
-
- def get_repeat(self):
- return self._repeat
-
- def start(self):
- if self._gtk_timeout_id is None:
- self._gtk_timeout_id = gobject.timeout_add(self._gtk_interval,
- self._gtk_fire)
-
- def stop(self):
- id = self._gtk_timeout_id
- if id is not None:
- gobject.source_remove(id)
- self._gtk_timeout_id = None
-
- def _gtk_fire(self):
- self._proc()
- if self._repeat:
- return 1
- else:
- self._gtk_timeout_id = None
-
-export(Task)
diff --git a/PyGUI-2.5.3/GUI/Gtk/TextEditor.py b/PyGUI-2.5.3/GUI/Gtk/TextEditor.py
deleted file mode 100644
index 5a82cad..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/TextEditor.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# Python GUI - Text Editor - Gtk
-#
-
-import pango, gtk
-from GUI import export
-from GUI import application
-from GUI import Scrollable
-from GUI import Font
-from GUI.GTextEditors import TextEditor as GTextEditor
-
-class TextEditor(GTextEditor, Scrollable):
-
- _font = None
-
- def __init__(self, scrolling = 'hv', **kwds):
- gtk_sw = gtk.ScrolledWindow()
- gtk_sw.show()
- gtk_tv = gtk.TextView()
- gtk_tv.show()
- gtk_sw.add(gtk_tv)
- gtk_tb = gtk.TextBuffer()
- self._gtk_textbuffer = gtk_tb
- gtk_tv.set_buffer(self._gtk_textbuffer)
- tag = gtk.TextTag()
- tabs = pango.TabArray(1, True)
- tabs.set_tab(0, pango.TAB_LEFT, 28)
- tag.set_property('tabs', tabs)
- tag.set_property('tabs-set', True)
- self._gtk_tag = tag
- gtk_tb.get_tag_table().add(tag)
- GTextEditor.__init__(self, _gtk_outer = gtk_sw, _gtk_inner = gtk_tv,
- _gtk_focus = gtk_tv, **kwds)
- self.set_hscrolling('h' in scrolling)
- self.set_vscrolling('v' in scrolling)
- if 'h' not in scrolling:
- gtk_tv.set_wrap_mode(gtk.WRAP_WORD)
- self._gtk_apply_tag()
-
- def _gtk_get_sel_iters(self):
- gtk_textbuffer = self._gtk_textbuffer
- sel_iters = gtk_textbuffer.get_selection_bounds()
- if not sel_iters:
- insert_mark = gtk_textbuffer.get_insert()
- insert_iter = gtk_textbuffer.get_iter_at_mark(insert_mark)
- sel_iters = (insert_iter, insert_iter)
- return sel_iters
-
- def _gtk_apply_tag(self):
- tb = self._gtk_textbuffer
- tb.apply_tag(self._gtk_tag, tb.get_start_iter(), tb.get_end_iter())
-
- def get_selection(self):
- tb = self._gtk_textbuffer
- bounds = tb.get_selection_bounds()
- if bounds:
- return (bounds[0].get_offset(), bounds[1].get_offset())
- else:
- i = tb.get_property('cursor-position')
- return (i, i)
-
- def set_selection(self, value):
- tb = self._gtk_textbuffer
- start = tb.get_iter_at_offset(value[0])
- end = tb.get_iter_at_offset(value[1])
- tb.select_range(start, end)
-
- def get_text(self):
- tb = self._gtk_textbuffer
- start = tb.get_start_iter()
- end = tb.get_end_iter()
- return tb.get_slice(start, end)
-
- def set_text(self, text):
- self._gtk_textbuffer.set_text(text)
- self._gtk_apply_tag()
-
- def get_text_length(self):
- return self._gtk_textbuffer.get_end_iter().get_offset()
-
- def get_font(self):
- font = self._font
- if not font:
- font = Font._from_pango_description(self._gtk_inner_widget.style.font_desc)
- return font
-
- def set_font(self, f):
- self._font = f
- tv = self._gtk_inner_widget
- tv.modify_font(f._pango_description)
-
- def get_tab_spacing(self):
- tabs = self._gtk_tag.get_property('tabs')
- return tabs.get_tab(0)[1]
-
- def set_tab_spacing(self, x):
- tabs = pango.TabArray(1, True)
- tabs.set_tab(0, pango.TAB_LEFT, x)
- self._gtk_tag.set_property('tabs', tabs)
-
- def cut_cmd(self):
- self.copy_cmd()
- self.clear_cmd()
-
- def copy_cmd(self):
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- text = gtk_textbuffer.get_text(start_iter, end_iter, 1)
- if text:
- application().set_clipboard(text)
-
- def paste_cmd(self):
- text = application().get_clipboard()
- self.clear_cmd()
- self._gtk_textbuffer.insert_at_cursor(text)
-
- def clear_cmd(self):
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- gtk_textbuffer.delete(start_iter, end_iter)
-
-export(TextEditor)
diff --git a/PyGUI-2.5.3/GUI/Gtk/TextField.py b/PyGUI-2.5.3/GUI/Gtk/TextField.py
deleted file mode 100644
index 8ad6bc4..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/TextField.py
+++ /dev/null
@@ -1,188 +0,0 @@
-#
-# Python GUI - Text fields - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import application
-from GUI.StdFonts import application_font
-from GUI.GTextFields import TextField as GTextField
-
-gtk_margins = (2, 2, 0, 0)
-
-class TextField(GTextField):
-
- _pass_key_events_to_platform = True
-
- _multiline = 0
-
- def __init__(self, font = application_font, lines = 1,
- multiline = 0, password = 0, **kwds):
- self._multiline = multiline
- lm, tm, rm, bm = gtk_margins
- if multiline:
- gtk_textbuffer = gtk.TextBuffer()
- gtk_textview = gtk.TextView(gtk_textbuffer)
- #gtk_textview.set_accepts_tab(False) #^%$#^%$!!! moves the focus itself.
- #self._gtk_connect(gtk_textview, 'key-press-event', self._gtk_key_press_event)
- gtk_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
- gtk_alignment.set_padding(tm, bm, lm, rm)
- gtk_alignment.add(gtk_textview)
- gtk_box = gtk.EventBox()
- gtk_box.add(gtk_alignment)
- gtk_box.modify_bg(gtk.STATE_NORMAL,
- gtk_textview.style.base[gtk.STATE_NORMAL])
- gtk_frame = gtk.Frame()
- gtk_frame.set_shadow_type(gtk.SHADOW_IN)
- gtk_frame.add(gtk_box)
- self._gtk_textbuffer = gtk_textbuffer
- gtk_text_widget = gtk_textview
- gtk_outer = gtk_frame
- else:
- gtk_entry = gtk.Entry()
- #self._gtk_connect(gtk_entry, 'key-press-event', self._gtk_key_press_event)
- self._gtk_entry = gtk_entry
- gtk_text_widget = gtk_entry
- gtk_outer = gtk_entry
- self._font = font
- gtk_text_widget.modify_font(font._pango_description)
- self._vertical_padding = tm + 2 * gtk_outer.style.ythickness + bm
- height = self._vertical_padding + lines * font.text_size("X")[1]
- gtk_outer.set_size_request(-1, height)
- self._password = password
- if password:
- if not multiline:
- self._gtk_entry.set_visibility(0)
- self._gtk_entry.set_invisible_char("*")
- else:
- raise ValueError("The password option is not supported for multiline"
- " TextFields on this platform")
- gtk_outer.show_all()
- GTextField.__init__(self,
- _gtk_outer = gtk_outer,
- _gtk_title = gtk_text_widget,
- _gtk_focus = gtk_text_widget,
- _gtk_input = gtk_text_widget,
- multiline = multiline, **kwds)
-
- def get_text(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start = gtk_textbuffer.get_start_iter()
- end = gtk_textbuffer.get_end_iter()
- return self._gtk_textbuffer.get_text(start, end, 1)
- else:
- return self._gtk_entry.get_text()
-
- def set_text(self, text):
- if self._multiline:
- self._gtk_textbuffer.set_text(text)
- else:
- self._gtk_entry.set_text(text)
-
- def get_selection(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- start = start_iter.get_offset()
- end = end_iter.get_offset()
- sel = (start, end)
- else:
- sel = self._gtk_get_sel_positions()
- return sel
-
- def _gtk_get_sel_iters(self):
- gtk_textbuffer = self._gtk_textbuffer
- sel_iters = gtk_textbuffer.get_selection_bounds()
- if not sel_iters:
- insert_mark = gtk_textbuffer.get_insert()
- insert_iter = gtk_textbuffer.get_iter_at_mark(insert_mark)
- sel_iters = (insert_iter, insert_iter)
- return sel_iters
-
- def _gtk_get_sel_positions(self):
- gtk_entry = self._gtk_entry
- sel = gtk_entry.get_selection_bounds()
- if not sel:
- pos = gtk_entry.get_position()
- sel = (pos, pos)
- return sel
-
- def _set_selection(self, start, end):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter = gtk_textbuffer.get_iter_at_offset(start)
- end_iter = gtk_textbuffer.get_iter_at_offset(end)
- gtk_textbuffer.select_range(start_iter, end_iter)
- else:
- self._gtk_entry.select_region(start, end)
-
- def set_selection(self, (start, end)):
- self._set_selection(start, end)
- self.become_target()
-
- def get_multiline(self):
- return self._multiline
-
- def get_password(self):
- return self._password
-
- def _select_all(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start = gtk_textbuffer.get_start_iter()
- end = gtk_textbuffer.get_end_iter()
- gtk_textbuffer.select_range(start, end)
- else:
- self._gtk_entry.select_region(0, -1)
-
- def select_all(self):
- self._select_all()
- self.become_target()
-
- def cut_cmd(self):
- self.copy_cmd()
- self.clear_cmd()
-
- def copy_cmd(self):
- if self._password:
- return
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- text = gtk_textbuffer.get_text(start_iter, end_iter, 1)
- else:
- start, end = self._gtk_get_sel_positions()
- text = self._gtk_entry.get_chars(start, end)
- if text:
- application().set_clipboard(text)
-
- def paste_cmd(self):
- text = application().get_clipboard()
- self.clear_cmd()
- if self._multiline:
- self._gtk_textbuffer.insert_at_cursor(text)
- else:
- gtk_entry = self._gtk_entry
- pos = gtk_entry.get_position()
- gtk_entry.insert_text(text, pos)
- gtk_entry.set_position(pos + len(text))
-
- def clear_cmd(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- gtk_textbuffer.delete(start_iter, end_iter)
- else:
- start, end = self._gtk_get_sel_positions()
- self._gtk_entry.delete_text(start, end)
-
- def _untargeted(self):
- self._set_selection(0, 0)
-
- def _tab_in(self):
- self._select_all()
- GTextField._tab_in(self)
-
-export(TextField)
diff --git a/PyGUI-2.5.3/GUI/Gtk/View.py b/PyGUI-2.5.3/GUI/Gtk/View.py
deleted file mode 100644
index b507db7..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/View.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Python GUI - Views - Gtk
-#
-
-from GUI import export
-from GUI.GViews import View
-
-export(View)
diff --git a/PyGUI-2.5.3/GUI/Gtk/ViewBase.py b/PyGUI-2.5.3/GUI/Gtk/ViewBase.py
deleted file mode 100644
index 8cea9e2..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/ViewBase.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Python GUI - View Base - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GViewBases import ViewBase as GViewBase
-
-class ViewBase(GViewBase):
-
- def __init__(self, **kwds):
- GViewBase.__init__(self, **kwds)
- self._gtk_connect(self._gtk_inner_widget, 'realize', self._gtk_realize)
-
- def track_mouse(self):
- finished = 0
- while not finished:
- self._mouse_event = None
- while not self._mouse_event:
- gtk.main_iteration()
- event = self._mouse_event
- if event.kind == 'mouse_up':
- finished = 1
- yield event
-
- def _cursor_changed(self):
- gtk_widget = self._gtk_inner_widget
- gdk_window = gtk_widget.window
- if gdk_window:
- cursor = self._cursor
- if cursor:
- gdk_window.set_cursor(self._cursor._gtk_cursor)
- else:
- gdk_window.set_cursor(None)
-
- def _gtk_realize(self):
- self._cursor_changed()
-
- def _targeted(self):
- self.targeted()
-
- def _untargeted(self):
- self.untargeted()
-
-export(ViewBase)
diff --git a/PyGUI-2.5.3/GUI/Gtk/Window.py b/PyGUI-2.5.3/GUI/Gtk/Window.py
deleted file mode 100644
index 15da4ff..0000000
--- a/PyGUI-2.5.3/GUI/Gtk/Window.py
+++ /dev/null
@@ -1,263 +0,0 @@
-#
-# Python GUI - Windows - Gtk version
-#
-
-import sys
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI import export
-from GUI.GGeometry import sub_pt
-from GUI import Component
-from GUI import Container
-from GUI import application
-from GUI.GWindows import Window as GWindow
-
-_default_width = 200
-_default_height = 200
-
-_modal_styles = ('modal_dialog', 'alert')
-_dialog_styles = ('nonmodal_dialog', 'modal_dialog', 'alert')
-
-class Window(GWindow):
-
- #_pass_key_events_to_platform = False
-
- _size = (_default_width, _default_height)
- _gtk_menubar = None
- _need_menubar_update = 0
- _target = None
-
- def __init__(self, style = 'standard', title = "New Window",
- movable = 1, closable = 1, hidable = None, resizable = 1,
- zoomable = 1, **kwds):
- self._all_menus = []
- modal = style in _modal_styles
- if hidable is None:
- hidable = not modal
- self._resizable = resizable
- gtk_win = gtk.Window(gtk.WINDOW_TOPLEVEL)
- gtk_win.set_gravity(gdk.GRAVITY_STATIC)
- gtk_win.set_decorated(style <> 'fullscreen'
- and (movable or closable or hidable or zoomable))
- gtk_win.set_resizable(resizable)
- gtk_win.set_modal(style in _modal_styles)
- gtk_content = gtk.Layout()
- gtk_content.show()
- if style in _dialog_styles:
- gtk_win.set_type_hint(gdk.WINDOW_TYPE_HINT_DIALOG)
- gtk_win.add(gtk_content)
- else:
- self._gtk_create_menubar()
- gtk_box = gtk.VBox()
- gtk_box.show()
- gtk_box.pack_start(self._gtk_menubar, expand = 0, fill = 0)
- gtk_box.pack_end(gtk_content, expand = 1, fill = 1)
- gtk_win.add(gtk_box)
- self._need_menubar_update = 1
- self._gtk_connect(gtk_win, 'configure-event', self._gtk_configure_event)
- self._gtk_connect(gtk_win, 'key-press-event', self._gtk_key_press_event)
- self._gtk_connect(gtk_win, 'delete-event', self._gtk_delete_event)
- GWindow.__init__(self, _gtk_outer = gtk_win, _gtk_inner = gtk_content,
- _gtk_focus = gtk_content, _gtk_input = gtk_content,
- style = style, title = title, closable = closable)
- if style == 'fullscreen':
- size = (gdk.screen_width(), gdk.screen_height())
- else:
- size = (_default_width, _default_height)
- self.set_size(size)
- self.set(**kwds)
- self.become_target()
-
- def _gtk_create_menubar(self):
- gtk_menubar = gtk.MenuBar()
- gtk_dummy_item = gtk.MenuItem("")
- gtk_menubar.append(gtk_dummy_item)
- gtk_menubar.show_all()
- h = gtk_menubar.size_request()[1]
- gtk_menubar.set_size_request(-1, h)
- gtk_dummy_item.remove_submenu()
- self._gtk_menubar = gtk_menubar
- self._gtk_connect(gtk_menubar, 'button-press-event',
- self._gtk_menubar_button_press_event)
-
- def destroy(self):
- self.hide()
- GWindow.destroy(self)
-
- def set_menus(self, x):
- GWindow.set_menus(self, x)
- self._need_menubar_update = 1
- if self.visible:
- self._gtk_update_menubar()
-
- def get_title(self):
- return self._gtk_outer_widget.get_title()
-
- def set_title(self, new_title):
- self._gtk_outer_widget.set_title(new_title)
-
- def set_position(self, v):
- self._position = v
- self._gtk_outer_widget.move(*v)
-
- def set_size(self, new_size):
- w, h = new_size
- if self._resizable:
- h += self._gtk_menubar_height()
- gtk_resize = self._gtk_outer_widget.resize
- else:
- gtk_resize = self._gtk_inner_widget.set_size_request
- gtk_resize(max(w, 1), max(h, 1))
- self._size = new_size
-
- def _gtk_configure_event(self, gtk_event):
- gtk_win = self._gtk_outer_widget
- self._position = gtk_win.get_position()
- #self._update_size(gtk_win.get_size())
- w, h = gtk_win.get_size()
- #w, h = self._gtk_inner_widget.get_size()
- #w, h = self._gtk_inner_widget.size_request()
- old_size = self._size
- new_size = (w, h - self._gtk_menubar_height())
- #new_size = (w, h)
- #print "Window._gtk_configure_event:", old_size, "->", new_size ###
- self._size = new_size
- if old_size <> new_size:
- self._resized(sub_pt(new_size, old_size))
-
- def get_visible(self):
- return self._gtk_outer_widget.get_property('visible')
-
- def set_visible(self, new_v):
- old_v = self.visible
- self._gtk_outer_widget.set_property('visible', new_v)
- if new_v and not old_v and self._need_menubar_update:
- self._gtk_update_menubar()
-
- def _show(self):
- self.set_visible(1)
- self._gtk_outer_widget.present()
-
-# def key_down(self, event):
-# if event.char == '\t':
-# if event.shift:
-# self._tab_to_prev()
-# else:
-# self._tab_to_next()
-# else:
-# self.pass_to_next_handler('key_down', event)
-
- def get_target(self):
- target = Component._gtk_find_component(self._gtk_outer_widget.get_focus())
- return target or self
-
- def _screen_rect(self):
- w = gdk.screen_width()
- h = gdk.screen_height()
- return (0, 0, w, h)
-
- def _gtk_menubar_height(self):
- mb = self._gtk_menubar
- if mb:
- h = mb.size_request()[1]
- else:
- h = 0
- #print "Window._gtk_menubar_height -->", h ###
- return h
-
- def _gtk_delete_event(self, event):
- try:
- self.close_cmd()
- except:
- sys.excepthook(*sys.exc_info())
- return 1
-
- def _gtk_update_menubar(self):
- #
- # Update the contents of the menubar after either the application
- # menu list or this window's menu list has changed. We only add
- # the menu titles at this stage; the menus themselves are attached
- # during menu setup. We also attach the accel groups associated
- # with the new menus.
- #
- # Things would be simpler if we could attach the menus here,
- # but attempting to share menus between menubar items provokes
- # a warning from Gtk, even though it otherwise appears to work.
- #
- gtk_menubar = self._gtk_menubar
- gtk_window = self._gtk_outer_widget
- # Remove old accel groups
- for menu in self._all_menus:
- gtk_window.remove_accel_group(menu._gtk_accel_group)
- # Detach any existing menus and remove old menu titles
- if gtk_menubar:
- for gtk_menubar_item in gtk_menubar.get_children():
- gtk_menubar_item.remove_submenu()
- gtk_menubar_item.destroy()
- # Install new menu list
- #all_menus = application().menus + self.menus
- all_menus = application()._effective_menus_for_window(self)
- self._all_menus = all_menus
- # Create new menu titles and attach accel groups
- for menu in all_menus:
- if gtk_menubar:
- gtk_menubar_item = gtk.MenuItem(menu._title)
- gtk_menubar_item.show()
- gtk_menubar.append(gtk_menubar_item)
- gtk_window.add_accel_group(menu._gtk_accel_group)
- self._need_menubar_update = 0
-
- def _gtk_menubar_button_press_event(self, event):
- # A button press has occurred in the menu bar. Before pulling
- # down the menu, perform menu setup and attach the menus to
- # the menubar items.
- self._gtk_menu_setup()
- for (gtk_menubar_item, menu) in \
- zip(self._gtk_menubar.get_children(), self._all_menus):
- gtk_menu = menu._gtk_menu
- attached_widget = gtk_menu.get_attach_widget()
- if attached_widget and attached_widget is not gtk_menubar_item:
- attached_widget.remove_submenu()
- gtk_menubar_item.set_submenu(gtk_menu)
-
- def _gtk_key_press_event(self, gtk_event):
- # Intercept key presses with the Control key down and update
- # menus, in case this is a keyboard equivalent for a menu command.
- if gtk_event.state & gdk.CONTROL_MASK:
- #print "Window._gtk_key_press_event: doing menu setup"
- self._gtk_menu_setup()
- # It appears that GtkWindow caches accelerators, and updates
- # the cache in an idle task after accelerators change. This
- # would be too late for us, so we force it to be done now.
- self._gtk_outer_widget.emit("keys-changed")
- #print "Window._gtk_key_press_event: done menu setup"
-
- def _gtk_menu_setup(self):
- application()._perform_menu_setup(self._all_menus)
-
- def _default_key_event(self, event):
- self.pass_event_to_next_handler(event)
- if event._originator is self:
- event._not_handled = True
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
-
-_gtk_menubar_height = None
-
-def _gtk_find_menubar_height():
- global _gtk_menubar_height
- if _gtk_menubar_height is None:
- print "Windows: Finding menubar height"
- item = gtk.MenuItem("X")
- bar = gtk.MenuBar()
- bar.append(item)
- bar.show_all()
- w, h = bar.size_request()
- _gtk_menubar_height = h
- print "...done"
- return _gtk_menubar_height
-
-export(Window)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/AlertClasses.py b/PyGUI-2.5.3/GUI/GtkGI/AlertClasses.py
deleted file mode 100644
index 806fb0d..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/AlertClasses.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - Alerts - Gtk
-#
-
-from GUI.GAlertClasses import Alert, Alert2, Alert3
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Applications.py b/PyGUI-2.5.3/GUI/GtkGI/Applications.py
deleted file mode 100644
index 1e0c9d4..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Applications.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# Python GUI - Application class - Gtk
-#
-
-import sys
-from gi.repository import Gtk, Gdk
-from GUI.Globals import application
-from GUI.GApplications import Application as GApplication
-
-class Application(GApplication):
-
- _in_gtk_main = 0
-
- def run(self):
- GApplication.run(self)
-
- def set_menus(self, menu_list):
- GApplication.set_menus(self, menu_list)
- for window in self._windows:
- window._gtk_update_menubar()
-
-# def handle_events(self):
-# #print "Application.handle_events: entering Gtk.main" ###
-# _call_with_excepthook(Gtk.main, Gtk.main_quit)
-# #print "Application.handle_events: returned from Gtk.main" ###
-
- def handle_next_event(self, modal_window = None):
- _call_with_excepthook(Gtk.main_iteration)
-
-# def _quit(self):
-# self._quit_flag = True
-# Gtk.main_quit()
-
-# def _exit_event_loop(self):
-# Gtk.main_quit()
-
- def get_target_window(self):
- for window in self._windows:
- if window._gtk_outer_widget.has_toplevel_focus():
- return window
- return None
-
- def zero_windows_allowed(self):
- return 0
-
- def query_clipboard(self):
- return _gtk_clipboard.wait_is_text_available()
-
- def get_clipboard(self):
- return _gtk_clipboard.wait_for_text()
-
- def set_clipboard(self, data):
- _gtk_clipboard.set_text(data, len(data))
-
-#------------------------------------------------------------------------------
-
-CLIPBOARD = Gdk.atom_intern("CLIPBOARD", False)
-
-_gtk_clipboard = Gtk.Clipboard.get(CLIPBOARD)
-
-#------------------------------------------------------------------------------
-
-def _call_with_excepthook(proc, breakout = None):
- # This function arranges for exceptions to be propagated
- # across calls to the Gtk event loop functions.
- exc_info = []
- def excepthook(*args):
- exc_info[:] = args
- if breakout:
- breakout()
- old_excepthook = sys.excepthook
- try:
- sys.excepthook = excepthook
- proc()
- finally:
- sys.excepthook = old_excepthook
- if exc_info:
- #print "_call_with_excepthook: raising", exc_info ###
- raise exc_info[0], exc_info[1], exc_info[2]
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/GtkGI/BaseAlerts.py b/PyGUI-2.5.3/GUI/GtkGI/BaseAlerts.py
deleted file mode 100644
index 6846267..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/BaseAlerts.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Python GUI - Alert base class - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.GBaseAlerts import BaseAlert as GBaseAlert
-
-_kind_to_gtk_stock_id = {
- 'stop': Gtk.STOCK_DIALOG_ERROR,
- 'caution': Gtk.STOCK_DIALOG_WARNING,
- 'note': Gtk.STOCK_DIALOG_INFO,
- 'query': Gtk.STOCK_DIALOG_QUESTION,
-}
-
-class BaseAlert(GBaseAlert):
-
- def _layout_icon(self, kind):
- gtk_stock_id = _kind_to_gtk_stock_id[kind]
- gtk_icon = Gtk.Image.new_from_stock(gtk_stock_id, Gtk.IconSize.DIALOG)
- gtk_icon.show()
- icon_size = gtk_icon.size_request()
- self._gtk_inner_widget.put(gtk_icon, self._left_margin, self._top_margin)
- return icon_size.width, icon_size.height
-
diff --git a/PyGUI-2.5.3/GUI/GtkGI/BaseFileDialogs.py b/PyGUI-2.5.3/GUI/GtkGI/BaseFileDialogs.py
deleted file mode 100644
index d8d4f52..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/BaseFileDialogs.py
+++ /dev/null
@@ -1,164 +0,0 @@
-#
-# Python GUI - File selection dialogs - Gtk
-#
-
-import os
-from gi.repository import Gtk
-from GUI.Files import FileRef
-from GUI.AlertFunctions import confirm
-from GUI.Applications import application
-
-#------------------------------------------------------------------
-
-class _FileDialog(Gtk.FileChooserDialog):
-
- def __init__(self, ok_label, **kwds):
- Gtk.FileChooserDialog.__init__(self, **kwds)
- self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
- self.add_button(ok_label, Gtk.ResponseType.ACCEPT)
- self.connect('response', self.response)
- self.set_default_size(600, 600)
- self.set_position(Gtk.WindowPosition.CENTER)
-
- def add_file_type(self, file_type):
- suffix = file_type.suffix
- if suffix:
- filter = Gtk.FileFilter()
- name = file_type.name
- if name:
- filter.set_name(name)
- filter.add_pattern("*.%s" % suffix)
- self.add_filter(filter)
-
- def present_modally(self):
- return self.run() == Gtk.ResponseType.ACCEPT
-
- def response(self, _, id):
- #print "_FileDialog.response:", id ###
- if id == Gtk.ResponseType.ACCEPT:
- if not self.check():
- self.stop_emission('response')
-
- def check(self):
- return True
-
-#------------------------------------------------------------------
-
-class _SaveFileDialog(_FileDialog):
-
- def check(self):
- path = self.get_filename()
- print "_SaveFileDialog.ok: checking path %r" % path ###
- #if path is None:
- # return False
- if not os.path.exists(path):
- return True
- else:
- result = confirm("Replace existing '%s'?" % os.path.basename(path),
- "Cancel", "Replace", cancel = None)
- return result == 0
-
-#------------------------------------------------------------------
-
-def _request_old(prompt, default_dir, file_types, dir, multiple):
-
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- if dir:
- action = Gtk.FileChooserAction.SELECT_FOLDER
- else:
- action = Gtk.FileChooserAction.OPEN
- dlog = _FileDialog(title = prompt, action = action,
- ok_label = Gtk.STOCK_OPEN)
- dlog.set_select_multiple(multiple)
- if file_types:
- for file_type in file_types:
- dlog.add_file_type(file_type)
- if default_dir:
- dlog.set_current_folder(default_dir.path)
- if dlog.present_modally():
- if multiple:
- result = [FileRef(path = path) for path in dlog.get_filenames()]
- else:
- result = FileRef(path = dlog.get_filename())
- else:
- result = None
- dlog.destroy()
- return result
-
-#------------------------------------------------------------------
-
-def _request_new(prompt, default_dir, default_name, file_type, dir):
-# if dir:
-# action = Gtk.FileChooserAction.CREATE_FOLDER
-# else:
- action = Gtk.FileChooserAction.SAVE
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- dlog = _SaveFileDialog(title = prompt, action = action,
- ok_label = Gtk.STOCK_SAVE)
- if file_type:
- dlog.add_file_type(file_type)
- if default_dir:
- dlog.set_current_folder(default_dir.path)
- if default_name:
- dlog.set_current_name(default_name)
- if dlog.present_modally():
- path = dlog.get_filename()
- if file_type:
- path = file_type._add_suffix(path)
- result = FileRef(path = path)
- else:
- result = None
- dlog.destroy()
- return result
-
-#------------------------------------------------------------------
-
-#def request_new_file(prompt = "Save File", default_dir = None,
-# default_name = "", file_type = None):
-# """Present a dialog requesting a name and location for a new file.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _SaveFileDialog(title = prompt, ok_label = Gtk.STOCK_SAVE,
-# action = Gtk.FileChooserAction.SAVE)
-# if file_type:
-# dlog.add_file_type(file_type)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if default_name:
-# dlog.set_current_name(default_name)
-# if dlog.present_modally():
-# path = dlog.get_filename()
-# if file_type:
-# path = file_type._add_suffix(path)
-# result = FileRef(path = path)
-# else:
-# result = None
-# dlog.destroy()
-# return result
-
-#------------------------------------------------------------------
-
-#def request_new_directory(prompt = "Create Folder", default_dir = None,
-# default_name = ""):
-# """Present a dialog requesting a name and location for a new directory.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _SaveFileDialog(title = prompt, ok_label = Gtk.STOCK_SAVE,
-# action = Gtk.FileChooserAction.CREATE_FOLDER)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if default_name:
-# dlog.set_current_name(default_name)
-# if dlog.present_modally():
-# path = dlog.get_filename()
-# result = FileRef(path = path)
-# else:
-# result = None
-# dlog.destroy()
-# return result
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Buttons.py b/PyGUI-2.5.3/GUI/GtkGI/Buttons.py
deleted file mode 100644
index 7318d2a..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Buttons.py
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Python GUI - Buttons - Gtk version
-#
-
-from gi.repository import Gtk
-from GUI.StdFonts import system_font
-from GUI.GButtons import Button as GButton
-
-_gtk_extra_hpad = 5 # Amount to add to default width at each end
-_gtk_icon_spacing = 2 # Space to leave between icon and label
-
-class Button(GButton):
-
- _gtk_icon = None # Icon, when we have one
- _style = 'normal' # or 'default' or 'cancel'
-
- def __init__(self, title = "Button", #style = 'normal',
- font = system_font, **kwds):
- gtk_label = Gtk.Label(label=title)
- gtk_box = Gtk.HBox(spacing = _gtk_icon_spacing)
- gtk_box.pack_end(gtk_label, True, True, 0)
- gtk_alignment = Gtk.Alignment.new(0.5, 0.5, 0.0, 0.0)
- hp = _gtk_extra_hpad
- gtk_alignment.set_padding(0, 0, hp, hp)
- gtk_alignment.add(gtk_box)
- gtk_button = Gtk.Button()
- gtk_button.add(gtk_alignment)
- gtk_button.set_focus_on_click(False)
- gtk_button.show_all()
- w, h = font.text_size(title)
- w2 = w + 2 * _gtk_button_hpad + _gtk_icon_width + _gtk_icon_spacing
- h2 = max(h + 2 * _gtk_button_vpad, _gtk_default_button_height)
- gtk_button.set_size_request(w2, h2)
- self._gtk_box = gtk_box
- self._gtk_alignment = gtk_alignment
- self._gtk_connect(gtk_button, 'clicked', self._gtk_clicked_signal)
- GButton.__init__(self, _gtk_outer = gtk_button, _gtk_title = gtk_label,
- font = font, **kwds)
-
- def _gtk_get_alignment(self):
- return self._gtk_alignment.get_property('xalign')
-
- def _gtk_set_alignment(self, fraction, just):
- self._gtk_alignment.set_property('xalign', fraction)
- self._gtk_title_widget.set_justify(just)
-
- def get_style(self):
- return self._style
-
- def set_style(self, new_style):
- if self._style <> new_style:
- if new_style == 'default':
- self._gtk_add_icon(Gtk.STOCK_OK)
- elif new_style == 'cancel':
- self._gtk_add_icon(Gtk.STOCK_CANCEL)
- else:
- self._gtk_remove_icon()
- self._style = new_style
-
- def _gtk_add_icon(self, gtk_stock_id):
- gtk_icon = Gtk.Image.new_from_stock(gtk_stock_id, Gtk.IconSize.BUTTON)
- gtk_icon.show()
- self._gtk_box.pack_start(gtk_icon, True, True, 0)
- self._gtk_icon = gtk_icon
-
- def _gtk_remove_icon(self):
- gtk_icon = self._gtk_icon
- if gtk_icon:
- gtk_icon.destroy()
- self._gtk_icon = None
-
- def activate(self):
- """Highlight the button momentarily and then perform its action."""
- self._gtk_outer_widget.activate()
-
- def _gtk_clicked_signal(self):
- self.do_action()
-
-
-def _calc_size_constants():
- global _gtk_icon_width, _gtk_default_button_height
- global _gtk_button_hpad, _gtk_button_vpad
- gtk_icon = Gtk.Image.new_from_stock(Gtk.STOCK_OK, Gtk.IconSize.BUTTON)
- gtk_button = Gtk.Button()
- gtk_button.add(gtk_icon)
- gtk_button.show_all()
- icon = gtk_icon.size_request()
- butn = gtk_button.size_request()
- _gtk_icon_width = icon.width
- _gtk_default_button_height = butn.height
- _gtk_button_hpad = (butn.width - icon.width) / 2 + _gtk_extra_hpad
- _gtk_button_vpad = (butn.height - icon.height) / 2
- gtk_button.destroy()
-
-_calc_size_constants()
-del _calc_size_constants
-
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Canvases.py b/PyGUI-2.5.3/GUI/GtkGI/Canvases.py
deleted file mode 100644
index 5f5d59e..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Canvases.py
+++ /dev/null
@@ -1,253 +0,0 @@
-#--------------------------------------------------------------------
-#
-# Python GUI - Canvas - Gtk
-#
-#--------------------------------------------------------------------
-
-from math import sin, cos, pi, floor
-from gi.repository import cairo, PangoCairo
-print "GUI.Canvases (GtkGI): TODO: Import cairo from gi.repository"
-from cairo import OPERATOR_OVER, OPERATOR_SOURCE, FILL_RULE_EVEN_ODD
-from GUI.Geometry import sect_rect
-from GUI.StdFonts import application_font
-from GUI.StdColors import black, white
-from GUI.GCanvases import Canvas as GCanvas
-from GUI.GCanvasPaths import CanvasPaths as GCanvasPaths
-
-deg = pi / 180
-twopi = 2 * pi
-
-show_layout = PangoCairo.show_layout
-
-#--------------------------------------------------------------------
-
-class GState(object):
-
- pencolor = black
- fillcolor = black
- textcolor = black
- backcolor = white
- pensize = 1
- font = application_font
-
- def __init__(self, clone = None):
- if clone:
- self.__dict__.update(clone.__dict__)
-
-#--------------------------------------------------------------------
-
-class Canvas(GCanvas, GCanvasPaths):
-
- def _from_gdk_drawable(cls, gdk_drawable):
- return cls(gdk_drawable.cairo_create())
-
- _from_gdk_drawable = classmethod(_from_gdk_drawable)
-
- def _from_cairo_context(cls, ctx):
- return cls(ctx)
-
- _from_cairo_context = classmethod(_from_cairo_context)
-
- def __init__(self, ctx):
- ctx.set_fill_rule(FILL_RULE_EVEN_ODD)
- self._gtk_ctx = ctx
- self._gstack = []
- self._state = GState()
- GCanvas.__init__(self)
- GCanvasPaths.__init__(self)
-
- def get_pencolor(self):
- return self._state.pencolor
-
- def set_pencolor(self, c):
- self._state.pencolor = c
-
- def get_fillcolor(self):
- return self._state.fillcolor
-
- def set_fillcolor(self, c):
- self._state.fillcolor = c
-
- def get_textcolor(self):
- return self._state.textcolor
-
- def set_textcolor(self, c):
- self._state.textcolor = c
-
- def get_backcolor(self):
- return self._state.backcolor
-
- def set_backcolor(self, c):
- self._state.backcolor = c
-
- def get_pensize(self):
- return self._state.pensize
-
- def set_pensize(self, d):
- self._state.pensize = d
-
- def get_font(self):
- return self._state.font
-
- def set_font(self, f):
- self._state.font = f
-
- def get_current_point(self):
- return self._gtk_ctx.get_current_point()
-
- def rectclip(self, r):
- l, t, r, b = r
- ctx = self._gtk_ctx
- ctx.new_path()
- ctx.rectangle(l, t, r - l, b - t)
- ctx.clip()
-
- def gsave(self):
- old_state = self._state
- self._gstack.append(old_state)
- old_state = GState(old_state)
- self._gtk_ctx.save()
-
- def grestore(self):
- self._state = self._gstack.pop()
- self._gtk_ctx.restore()
-
- def newpath(self):
- self._gtk_ctx.new_path()
-
- def moveto(self, x, y):
- self._gtk_ctx.move_to(x, y)
-
- def rmoveto(self, x, y):
- self._gtk_ctx.rel_move_to(x, y)
-
- def lineto(self, x, y):
- self._gtk_ctx.line_to(x, y)
-
- def rlineto(self, x, y):
- self._gtk_ctx.rel_line_to(x, y)
-
- def curveto(self, p1, p2, p3):
- self._gtk_ctx.curve_to(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1])
-
- def rcurveto(self, p1, p2, p3):
- self._gtk_ctx.rel_curve_to(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1])
-
- def arc(self, c, r, a0, a1):
- self._gtk_ctx.arc(c[0], c[1], r, a0 * deg, a1 * deg)
-
- def closepath(self):
- ctx = self._gtk_ctx
- ctx.close_path()
- ctx.new_sub_path()
-
- def clip(self):
- self._gtk_ctx.clip_preserve()
-
- def stroke(self):
- state = self._state
- ctx = self._gtk_ctx
- ctx.set_source_rgba(*state.pencolor._rgba)
- #ctx.set_source_color(state.pencolor._gdk_color)
- ctx.set_line_width(state.pensize)
- ctx.stroke_preserve()
-
- def fill(self):
- ctx = self._gtk_ctx
- ctx.set_source_rgba(*self._state.fillcolor._rgba)
- #ctx.set_source_color(self._state.fillcolor._gdk_color)
- ctx.fill_preserve()
-
- def erase(self):
- ctx = self._gtk_ctx
- ctx.set_source_rgba(*self._state.backcolor._rgba)
- #ctx.set_source_color(self._state.backcolor._gdk_color)
- ctx.set_operator(OPERATOR_SOURCE)
- ctx.fill_preserve()
- ctx.set_operator(OPERATOR_OVER)
-
- def show_text(self, text):
- font = self._state.font
- layout = font._get_pango_layout(text, True)
- dx = layout.get_pixel_size()[0]
- dy = font.ascent
- ctx = self._gtk_ctx
- ctx.set_source_rgba(*self._state.textcolor._rgba)
- #ctx.set_source_color(self._state.textcolor._gdk_color)
- ctx.rel_move_to(0, -dy)
- show_layout(ctx, layout)
- ctx.rel_move_to(dx, dy)
-
- def rect(self, rect):
- l, t, r, b = rect
- self._gtk_ctx.rectangle(l, t, r - l, b - t)
-
- def oval(self, rect):
- l, t, r, b = rect
- a = 0.5 * (r - l)
- b = 0.5 * (b - t)
- ctx = self._gtk_ctx
- ctx.new_sub_path()
- ctx.save()
- ctx.translate(l + a, t + b)
- ctx.scale(a, b)
- ctx.arc(0, 0, 1, 0, twopi)
- ctx.close_path()
- ctx.restore()
-
- def translate(self, dx, dy):
- self._gtk_ctx.translate(dx, dy)
-
- def rotate(self, degrees):
- self._gtk_ctx.rotate(degrees*math.pi/180)
-
- def scale(self, xscale, yscale):
- self._gtk_ctx.scale(xscale, yscale)
-
-# def _coords(self, x, y):
-# x0, y0 = self._origin
-# return int(round(x0 + x)), int(round(y0 + y))
-
-# def _coords(self, x, y):
-# return int(round(x)), int(round(y))
-
-# def _rect_coords(self, (l, t, r, b)):
-# x0, y0 = self._origin
-# l = int(round(x0 + l))
-# t = int(round(y0 + t))
-# r = int(round(x0 + r))
-# b = int(round(y0 + b))
-# return l, t, r - l, b - t
-
-# def _rect_coords(self, (l, t, r, b)):
-# l = int(round(l))
-# t = int(round(t))
-# r = int(round(r))
-# b = int(round(b))
-# return l, t, r - l, b - t
-
-# def _frame_coords(self, r):
-# l, t, w, h = self._rect_coords(r)
-# p = self._gdk_gc.line_width
-# d = p // 2
-# return (
-# int(floor(l + d)),
-# int(floor(t + d)),
-# int(floor(w - p)),
-# int(floor(h - p)))
-
-#def _gdk_angles(start_angle, end_angle):
-# arc_angle = (end_angle - start_angle) % 360
-# start = int(round(start_angle * 64))
-# arc = int(round((arc_angle) * 64))
-# return -start, -arc
-
-#def _arc_rect((cx, cy), r):
-# return (cx - r, cy - r, cx + r, cy + r)
-
-#def _arc_endpoint(center, r, a):
-# cx, cy = center
-# ar = a * deg
-# x = int(round(cx + r * cos(ar)))
-# y = int(round(cy + r * sin(ar)))
-# return x, y
diff --git a/PyGUI-2.5.3/GUI/GtkGI/CheckBoxes.py b/PyGUI-2.5.3/GUI/GtkGI/CheckBoxes.py
deleted file mode 100644
index 6a3e1d9..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/CheckBoxes.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Python GUI - Check boxes - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.GCheckBoxes import CheckBox as GCheckBox
-
-class CheckBox(GCheckBox):
-
- def __init__(self, title = "New Control", **kwds):
- gtk_checkbox = Gtk.CheckButton(title)
- gtk_checkbox.show()
- self._gtk_connect(gtk_checkbox, 'clicked', self._gtk_clicked_signal)
- self._gtk_inhibit_action = 0
- GCheckBox.__init__(self, _gtk_outer = gtk_checkbox, **kwds)
-
- def get_on(self):
- gtk_checkbox = self._gtk_outer_widget
- if gtk_checkbox.get_inconsistent():
- return 'mixed'
- else:
- return gtk_checkbox.get_active()
-
- def set_on(self, state):
- mixed = state == 'mixed'
- if mixed:
- if not self._mixed:
- raise ValueError("CheckBox state cannot be 'mixed'")
- active = False
- else:
- active = bool(state)
- save = self._gtk_inhibit_action
- self._gtk_inhibit_action = 1
- try:
- gtk_checkbox = self._gtk_outer_widget
- gtk_checkbox.set_active(active)
- gtk_checkbox.set_inconsistent(mixed)
- finally:
- self._gtk_inhibit_action = save
-
- def _gtk_clicked_signal(self):
- gtk_checkbox = self._gtk_outer_widget
- if not self._gtk_inhibit_action:
- if self._auto_toggle:
- gtk_checkbox.set_inconsistent(False)
- else:
- save = self._gtk_inhibit_action
- self._gtk_inhibit_action = 1
- try:
- gtk_checkbox.set_active(not gtk_checkbox.get_active())
- finally:
- self._gtk_inhibit_action = save
- self.do_action()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Colors.py b/PyGUI-2.5.3/GUI/GtkGI/Colors.py
deleted file mode 100644
index 6059f6f..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Colors.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Python GUI - Colors - Gtk
-#
-
-from gi.repository import Gdk
-from gi.repository.Gtk import Style
-from GUI.GColors import Color as GColor
-
-class Color(GColor):
-
- _alpha = 1.0
-
- def _from_gdk_color(cls, _gdk_color):
- c = cls.__new__(cls)
- c._gdk_color = _gdk_color
- return c
-
- _from_gdk_color = classmethod(_from_gdk_color)
-
- def __init__(self, red, green, blue, alpha = 1.0):
- self._rgba = (red, green, blue, alpha)
- self._gdk_rgba = Gdk.RGBA(red, green, blue, alpha)
- gdk_color = Gdk.Color(
- int(red * 65535),
- int(green * 65535),
- int(blue * 65535))
- self._gdk_color = gdk_color
- self._alpha = alpha
-
- def get_red(self):
- return self._gdk_color.red / 65535.0
-
- def get_green(self):
- return self._gdk_color.green / 65535.0
-
- def get_blue(self):
- return self._gdk_color.blue / 65535.0
-
- def get_alpha(self):
- return self._alpha
-
-
-rgb = Color
-
-s = Style()
-selection_forecolor = Color._from_gdk_color(s.fg[3])
-selection_backcolor = Color._from_gdk_color(s.bg[3])
-
-#selection_forecolor = rgb(1, 1, 1)
-#selection_backcolor = rgb(0, 0, 0)
-
-#s = GtkStyleContext()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Components.py b/PyGUI-2.5.3/GUI/GtkGI/Components.py
deleted file mode 100644
index d93fa8d..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Components.py
+++ /dev/null
@@ -1,249 +0,0 @@
-#
-# Python GUI - Components - Gtk
-#
-
-from gi.repository import Gtk
-from gi.repository import Gdk
-import GUI.Globals
-from GUI.Geometry import sub_pt
-from GUI.GComponents import Component as GComponent
-from GUI.Events import Event, _gtk_key_event_of_interest
-
-_gdk_events_of_interest = (
- Gdk.EventMask.POINTER_MOTION_MASK |
- Gdk.EventMask.BUTTON_MOTION_MASK |
- Gdk.EventMask.BUTTON_PRESS_MASK |
- Gdk.EventMask.BUTTON_RELEASE_MASK |
- Gdk.EventMask.KEY_PRESS_MASK |
- Gdk.EventMask.KEY_RELEASE_MASK |
- Gdk.EventMask.ENTER_NOTIFY_MASK |
- Gdk.EventMask.LEAVE_NOTIFY_MASK |
- 0
-)
-
-_gtk_widget_to_component = {}
-_gtk_last_keyval_down = None
-
-#------------------------------------------------------------------------------
-
-class Component(GComponent):
-
- _pass_key_events_to_platform = True
-
- def __init__(self, _gtk_outer, _gtk_inner = None,
- _gtk_focus = None, _gtk_input = None, **kwds):
- self._position = (0, 0)
- req = _gtk_outer.size_request()
- self._size = (req.width, req.height)
- _gtk_inner = _gtk_inner or _gtk_outer
- self._gtk_outer_widget = _gtk_outer
- self._gtk_inner_widget = _gtk_inner
- self._gtk_focus_widget = _gtk_focus
- _gtk_widget_to_component[_gtk_outer] = self
- self._gtk_connect_input_events(_gtk_input or _gtk_inner)
- if _gtk_focus:
- _gtk_focus.set_property('can-focus', True)
- self._gtk_connect(_gtk_focus, 'focus-in-event', self._gtk_focus_in)
- GComponent.__init__(self, **kwds)
-
- def destroy(self):
- gtk_widget = self._gtk_outer_widget
- if gtk_widget in _gtk_widget_to_component:
- del _gtk_widget_to_component[gtk_widget]
- GComponent.destroy(self)
-
- #
- # Properties
- #
-
- def set_width(self, v):
- w, h = self.size
- self.size = (v, h)
-
- def set_height(self, v):
- w, h = self.size
- self.size = (w, v)
-
- def get_position(self):
- return self._position
-
- def set_position(self, v):
- self._position = v
- widget = self._gtk_outer_widget
- parent = widget.get_parent()
- if parent:
- parent.move(widget, *v)
-
- def get_size(self):
- return self._size
-
- def set_size(self, new_size):
- w0, h0 = self._size
- w1, h1 = new_size
- self._gtk_outer_widget.set_size_request(max(int(w1), 1), max(int(h1), 1))
- self._size = new_size
- if w0 != w1 or h0 != h1:
- self._resized((w1 - w0, h1 - h0))
-
- def get_bounds(self):
- x, y = self._position
- w, h = self.size
- return (x, y, x + w, y + h)
-
- def set_bounds(self, (l, t, r, b)):
- self.position = (l, t)
- self.size = (r - l, b - t)
-
-# def get_visible(self):
-# return self._gtk_outer_widget.get_property('visible')
-#
-# def set_visible(self, v):
-# self._gtk_outer_widget.set_property('visible', v)
-
- #
- # Message dispatching
- #
-
- def become_target(self):
- gtk_focus = self._gtk_focus_widget
- if gtk_focus:
- gtk_focus.grab_focus()
- else:
- raise ValueError("%r cannot be targeted" % self)
-
-# def current_target(self):
-# """Find the current target object within the Window containing
-# this component. If the component is not contained in a Window,
-# the result is undefined."""
-# target = _gtk_find_component(self._gtk_outer_widget.get_focus())
-# if not target:
-# target = self.window
-# return target
-
- def is_target(self):
- """Return true if this is the current target within the containing
- Window. If the component is not contained in a Window, the result
- is undefined."""
- gtk_focus = self._gtk_focus_widget
- if gtk_focus:
- return gtk_focus.get_property('has-focus')
- else:
- return False
-
- #
- # Internal
- #
-
- def _gtk_connect(self, gtk_widget, signal, handler):
- def catch(widget, *args):
- try:
- handler(*args)
- except:
- _gtk_exception_in_signal_handler()
- gtk_widget.connect(signal, lambda widget, *args: handler(*args))
-
- def _gtk_connect_after(self, gtk_widget, signal, handler):
- def catch(widget, *args):
- try:
- handler(*args)
- except:
- _gtk_exception_in_signal_handler()
- gtk_widget.connect_after(signal, lambda widget, *args: handler(*args))
-
- def _gtk_focus_in(self, gtk_event):
- window = self.window
- if window:
- old_target = window._target
- window._target = self
- if old_target and old_target is not self:
- old_target._untargeted()
- self._targeted()
-
- def _targeted(self):
- pass
-
- def _untargeted(self):
- pass
-
- def _gtk_connect_input_events(self, gtk_widget):
- self._last_mouse_down_time = 0
- self._click_count = 0
- gtk_widget.add_events(_gdk_events_of_interest)
- self._gtk_connect(gtk_widget, 'button-press-event',
- self._gtk_button_press_event_signal)
- self._gtk_connect(gtk_widget, 'motion-notify-event',
- self._gtk_motion_notify_event_signal)
- self._gtk_connect(gtk_widget, 'button-release-event',
- self._gtk_button_release_event_signal)
- self._gtk_connect(gtk_widget, 'enter-notify-event',
- self._gtk_enter_leave_event_signal)
- self._gtk_connect(gtk_widget, 'leave-notify-event',
- self._gtk_enter_leave_event_signal)
- self._gtk_connect(gtk_widget, 'key-press-event',
- self._handle_gtk_key_event)
- self._gtk_connect(gtk_widget, 'key-release-event',
- self._handle_gtk_key_event)
-
- def _gtk_button_press_event_signal(self, gtk_event):
- if gtk_event.type == Gdk.EventType.BUTTON_PRESS: # don't want 2BUTTON or 3BUTTON
- event = Event._from_gtk_mouse_event(gtk_event)
- last_time = self._last_mouse_down_time
- this_time = event.time
- num_clicks = self._click_count
- if this_time - last_time <= 0.25:
- num_clicks += 1
- else:
- num_clicks = 1
- event.num_clicks = num_clicks
- self._click_count = num_clicks
- self._last_mouse_down_time = this_time
- #print "Component._gtk_button_press_event_signal:" ###
- #print event ###
- return self._event_custom_handled(event)
-
- def _gtk_motion_notify_event_signal(self, gtk_event):
- event = Event._from_gtk_mouse_event(gtk_event)
- self._mouse_event = event
- return self._event_custom_handled(event)
-
- def _gtk_button_release_event_signal(self, gtk_event):
- event = Event._from_gtk_mouse_event(gtk_event)
- self._mouse_event = event
- return self._event_custom_handled(event)
-
- def _gtk_enter_leave_event_signal(self, gtk_event):
- #print "Component._gtk_enter_leave_event_signal:" ###
- event = Event._from_gtk_mouse_event(gtk_event)
- return self._event_custom_handled(event)
-
- def _handle_gtk_key_event(self, gtk_event):
- """Convert a Gtk key-press or key-release event into an Event
- object and pass it up the message path."""
- #print "Component._handle_gtk_key_event for", self ###
- global _gtk_last_keyval_down
- if _gtk_key_event_of_interest(gtk_event):
- event = Event._from_gtk_key_event(gtk_event)
- if event.kind == 'key_down':
- this_keyval = gtk_event.keyval
- if _gtk_last_keyval_down == this_keyval:
- event.auto = 1
- _gtk_last_keyval_down = this_keyval
- else:
- _gtk_last_keyval_down = None
- #if event.kind == 'key_down': ###
- # print event ###
- return self._event_custom_handled(event)
-
-#------------------------------------------------------------------------------
-
-def _gtk_find_component(gtk_widget):
- while gtk_widget:
- component = _gtk_widget_to_component.get(gtk_widget)
- if component:
- return component
- gtk_widget = gtk_widget.get_parent()
- return None
-
-def _gtk_exception_in_signal_handler():
- print >>sys.stderr, "---------- Exception in gtk signal handler ----------"
- traceback.print_exc()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Containers.py b/PyGUI-2.5.3/GUI/GtkGI/Containers.py
deleted file mode 100644
index 5cdd631..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Containers.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Python GUI - Containers - Gtk version
-#
-
-from gi.repository import Gdk
-from GUI.Geometry import inset_rect
-from GUI.GContainers import Container as GContainer
-
-class Container(GContainer):
- # Subclasses must set the inner widget to be a Fixed or Layout
- # widget.
-
- def _add(self, comp):
- GContainer._add(self, comp)
- x, y = comp._position
- self._gtk_inner_widget.put(comp._gtk_outer_widget, int(x), int(y))
-
- def _remove(self, comp):
- self._gtk_inner_widget.remove(comp._gtk_outer_widget)
- GContainer._remove(self, comp)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Controls.py b/PyGUI-2.5.3/GUI/GtkGI/Controls.py
deleted file mode 100644
index 7e877d5..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Controls.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Python GUI - Controls - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.Enumerations import EnumMap
-from GUI.Colors import Color
-from GUI.Fonts import Font
-from GUI.GControls import Control as GControl
-
-_justs = ['left', 'center', 'right']
-
-_just_to_gtk_alignment = EnumMap("justification",
- left = (0.0, Gtk.Justification.LEFT),
- centre = (0.5, Gtk.Justification.CENTER),
- center = (0.5, Gtk.Justification.CENTER),
- right = (1.0, Gtk.Justification.RIGHT),
-)
-
-class Control(GControl):
- # A component which encapsulates a Gtk control widget.
-
- _font = None
- _color = None
-
- def __init__(self, _gtk_outer = None, _gtk_title = None, **kwds):
- self._gtk_title_widget = _gtk_title or _gtk_outer
- GControl.__init__(self, _gtk_outer = _gtk_outer,
- _gtk_focus = kwds.pop('_gtk_focus', _gtk_outer),
- **kwds)
-
- def get_title(self):
- return self._gtk_title_widget.get_label()
-
- def set_title(self, v):
- self._gtk_title_widget.set_label(v)
-
- def get_enabled(self):
- #return self._gtk_outer_widget.get_sensitive()
- return self._gtk_outer_widget.get_property('sensitive')
-
- def set_enabled(self, v):
- self._gtk_outer_widget.set_sensitive(v)
-
- def get_color(self):
- return self._color
-# gdk_color = self._gtk_title_widget.get_style().fg[Gtk.StateType.NORMAL]
-# return Color._from_gdk_color(gdk_color)
-
- def set_color(self, v):
- #self._gtk_title_widget.modify_fg(Gtk.StateType.NORMAL, v._gdk_color)
- self._color = v
- self._gtk_title_widget.override_color(Gtk.StateType.NORMAL, v._gdk_rgba)
-
- def get_font(self):
- font = self._font
- if not font:
- font = Font._from_pango_description(self._gtk_title_widget.style.font_desc)
- return font
-
- def set_font(self, f):
- self._font = f
- gtk_title = self._gtk_title_widget
-# print "Control.set_font: gtk_title =", gtk_title ###
-# pd = f._pango_description ###
-# print "...family =", pd.get_family() ###
-# print "...size =", pd.get_size() ###
- #gtk_title.modify_font(f._pango_description)
- gtk_title.override_font(f._pango_description)
- gtk_title.queue_resize()
-
- def get_just(self):
- h = self._gtk_get_alignment()
- return _justs[int(round(2.0 * h))]
-
- def set_just(self, v):
- fraction, just = _just_to_gtk_alignment[v]
- self._gtk_set_alignment(fraction, just)
-
- def set_lines(self, num_lines):
- line_height = self.font.text_size("X")[1]
- #print "Control.set_lines: line_height =", line_height ###
- self.height = num_lines * line_height + self._vertical_padding
-
- def _gtk_get_alignment(self):
- raise NotImplementedError
-
- def _gtk_set_alignment(self, h):
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Cursors.py b/PyGUI-2.5.3/GUI/GtkGI/Cursors.py
deleted file mode 100644
index 0d35082..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Cursors.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Python GUI - Cursors - Gtk
-#
-
-from gi.repository import Gdk
-from GUI.GCursors import Cursor as GCursor
-
-class Cursor(GCursor):
- #
- # _gtk_cursor Gdk.Cursor
-
- def _from_gtk_std_cursor(cls, id):
- cursor = cls.__new__(cls)
- cursor._gtk_cursor = Gdk.Cursor.new(id)
- return cursor
-
- _from_gtk_std_cursor = classmethod(_from_gtk_std_cursor)
-
- def _from_nothing(cls):
-# cursor = cls.__new__(cls)
-# pixmap = GdkPixmap.Pixmap(None, 1, 1, 1)
-# color = Gdk.Color()
-# cursor._gtk_cursor = Gdk.Cursor.new(pixmap, pixmap, color, color, 0, 0)
-# return cursor
- return cls._from_gtk_std_cursor(Gdk.CursorType.BLANK_CURSOR)
-
- _from_nothing = classmethod(_from_nothing)
-
- def _init_from_image_and_hotspot(self, image, hotspot):
- #print "Cursor._init_from_image_and_hotspot:", image, hotspot ###
- x, y = hotspot
- gdk_display = Gdk.Display.get_default()
- self._gtk_cursor = Gdk.Cursor.new_from_pixbuf(gdk_display,
- image._gdk_pixbuf, x, y)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Dialogs.py b/PyGUI-2.5.3/GUI/GtkGI/Dialogs.py
deleted file mode 100644
index 7d665b2..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Dialogs.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Python GUI - Dialogs - Gtk
-#
-
-from GUI.GDialogs import Dialog as GDialog
-
-class Dialog(GDialog):
-
- _default_keys = ['\r']
- _cancel_keys = ['\x1b']
diff --git a/PyGUI-2.5.3/GUI/GtkGI/DrawableContainers.py b/PyGUI-2.5.3/GUI/GtkGI/DrawableContainers.py
deleted file mode 100644
index fa66b80..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/DrawableContainers.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Python GUI - DrawableViews - Gtk
-#
-
-import os, traceback
-from math import floor, ceil
-from gi.repository import Gtk, Gdk, cairo
-from GUI.Canvases import Canvas
-from GUI.Events import Event
-from GUI.GDrawableContainers import DrawableContainer as GDrawableContainer
-
-class DrawableContainer(GDrawableContainer):
-
- #_extent_origin = (0, 0)
-
- def __init__(self, _gtk_outer = None, **kwds):
- gtk_layout = Gtk.Layout()
- gtk_layout.add_events(Gdk.EventMask.EXPOSURE_MASK)
- gtk_layout.show()
- self._gtk_connect(gtk_layout, 'draw', self._gtk_draw_signal)
- if _gtk_outer:
- _gtk_outer.add(gtk_layout)
- else:
- _gtk_outer = gtk_layout
- GDrawableContainer.__init__(self,
- _gtk_outer = _gtk_outer, _gtk_inner = gtk_layout,
- _gtk_focus = gtk_layout, _gtk_input = gtk_layout)
- self.set(**kwds)
-
- #
- # Other methods
- #
-
- def with_canvas(self, proc):
- hadj, vadj = self._gtk_adjustments()
- clip = rect_sized((hadj.value, vadj.value), self.size)
-# canvas = Canvas._from_gdk_drawable(self._gtk_inner_widget.bin_window)
- context = Gdk.cairo_create(self._gtk_inner_widget.get_bin_window())
- self._gtk_prepare_cairo_context(context)
- canvas = Canvas._from_cairo_context(context)
- proc(canvas)
-
- def invalidate_rect(self, (l, t, r, b)):
- x = int(floor(l))
- y = int(floor(t))
- w = int(ceil(r - l))
- h = int(ceil(b - t))
- self._gtk_inner_widget.queue_draw_area(x, y, w, h)
-
- def update(self):
- gdk_window = self._gtk_inner_widget.bin_window
- gdk_window.process_updates()
-
- #
- # Internal
- #
-
- def _gtk_draw_signal(self, context):
- try:
- self._gtk_prepare_cairo_context(context)
- clip = context.clip_extents()
- canvas = Canvas._from_cairo_context(context)
- self.draw(canvas, clip)
- except:
- print "------------------ Exception while drawing ------------------"
- traceback.print_exc()
-
- def _gtk_prepare_cairo_context(self, context):
- pass
diff --git a/PyGUI-2.5.3/GUI/GtkGI/EditCmdHandlers.py b/PyGUI-2.5.3/GUI/GtkGI/EditCmdHandlers.py
deleted file mode 100644
index 3891c01..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/EditCmdHandlers.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# PyGUI - Edit command handling - Gtk
-#
-
-from GUI.GEditCmdHandlers import EditCmdHandler
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Events.py b/PyGUI-2.5.3/GUI/GtkGI/Events.py
deleted file mode 100644
index 349629d..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Events.py
+++ /dev/null
@@ -1,161 +0,0 @@
-#
-# Python GUI - Events - Gtk
-#
-
-from gi.repository import Gdk
-from GUI.GEvents import Event as GEvent
-
-MOTION_NOTIFY = Gdk.EventType.MOTION_NOTIFY
-
-SHIFT_MASK = Gdk.ModifierType.SHIFT_MASK
-CONTROL_MASK = Gdk.ModifierType.CONTROL_MASK
-MOD1_MASK = Gdk.ModifierType.MOD1_MASK
-MOD2_MASK = Gdk.ModifierType.MOD2_MASK
-MOD3_MASK = Gdk.ModifierType.MOD3_MASK
-MOD4_MASK = Gdk.ModifierType.MOD4_MASK
-MOD5_MASK = Gdk.ModifierType.MOD5_MASK
-BIT13_MASK = 0x2000
-SUPER_MASK = Gdk.ModifierType.SUPER_MASK
-HYPER_MASK = Gdk.ModifierType.HYPER_MASK
-META_MASK = Gdk.ModifierType.META_MASK
-
-_gdk_button_mask = (
- Gdk.ModifierType.BUTTON1_MASK |
- Gdk.ModifierType.BUTTON2_MASK |
- Gdk.ModifierType.BUTTON3_MASK |
- Gdk.ModifierType.BUTTON4_MASK |
- Gdk.ModifierType.BUTTON5_MASK
-)
-
-_gdk_event_type_to_kind = {
- Gdk.EventType.BUTTON_PRESS: 'mouse_down',
- Gdk.EventType._2BUTTON_PRESS: 'mouse_down',
- Gdk.EventType._3BUTTON_PRESS: 'mouse_down',
- Gdk.EventType.MOTION_NOTIFY: 'mouse_move',
- Gdk.EventType.BUTTON_RELEASE: 'mouse_up',
- Gdk.EventType.KEY_PRESS: 'key_down',
- Gdk.EventType.KEY_RELEASE: 'key_up',
- Gdk.EventType.ENTER_NOTIFY: 'mouse_enter',
- Gdk.EventType.LEAVE_NOTIFY: 'mouse_leave',
-}
-
-_gtk_button_to_button = {
- 1: 'left',
- 2: 'middle',
- 3: 'right',
- 4: 'fourth',
- 5: 'fifth',
-}
-
-_gdk_keyval_to_keyname = {
- 0xFF50: 'home',
- 0xFF51: 'left_arrow',
- 0xFF52: 'up_arrow',
- 0xFF53: 'right_arrow',
- 0xFF54: 'down_arrow',
- 0xFF55: 'page_up',
- 0xFF56: 'page_down',
- 0xFF57: 'end',
- #0xFF6A: 'help',
- 0xFF6A: 'insert',
- 0xFF8D: 'enter',
- 0xFFBE: 'f1',
- 0xFFBF: 'f2',
- 0xFFC0: 'f3',
- 0xFFC1: 'f4',
- 0xFFC2: 'f5',
- 0xFFC3: 'f6',
- 0xFFC4: 'f7',
- 0xFFC5: 'f8',
- 0xFFC6: 'f9',
- 0xFFC7: 'f10',
- 0xFFC8: 'f11',
- 0xFFC9: 'f12',
- 0xFFCA: 'f13',
- 0xFFCB: 'f14',
- 0xFFCC: 'f15',
- 0xFFFF: 'delete',
-}
-
-def _gtk_key_event_of_interest(gtk_event):
- keyval = gtk_event.keyval
- return (keyval <= 0xFF
- or 0xFF00 <= keyval <= 0xFF1F
- or 0xFF80 <= keyval <= 0xFFBD
- or keyval == 0xFE20 # shift-tab
- or keyval == 0xFFFF
- or keyval in _gdk_keyval_to_keyname)
-
-class Event(GEvent):
- """Platform-dependent modifiers (boolean):
- mod1 The X11 MOD1 key.
- """
-
- button = None
- position = None
- global_position = None
- num_clicks = 0
- char = None
- key = None
- auto = 0
-
- def _from_gtk_key_event(cls, gtk_event):
- event = cls.__new__(cls)
- event._set_from_gtk_event(gtk_event)
- keyval = gtk_event.keyval
- #print "Event._from_gtk_key_event: keyval = 0x%04X" % keyval ###
- event.key = _gdk_keyval_to_keyname.get(keyval, "")
- if keyval == 0xFFFF: # GDK_Delete
- event.char = chr(0x7F)
- elif keyval == 0xFF8D:
- event.char = "\r"
- elif keyval == 0xFE20: # shift-tab
- event.char = "\t"
- elif keyval <= 0xFF1F:
- if event.control:
- event.char = chr(keyval & 0x1F)
- else:
- event.char = chr(keyval & 0x7F)
- else:
- event.char = ""
- return event
-
- _from_gtk_key_event = classmethod(_from_gtk_key_event)
-
- def _from_gtk_mouse_event(cls, gtk_event):
- event = cls.__new__(cls)
- event._set_from_gtk_event(gtk_event)
- if event.kind in ('mouse_down', 'mouse_up'):
- event.button = _gtk_button_to_button[gtk_event.button]
- event.position = (gtk_event.x, gtk_event.y)
- event.global_position = (gtk_event.x_root, gtk_event.y_root)
- return event
-
- _from_gtk_mouse_event = classmethod(_from_gtk_mouse_event)
-
- def _set_from_gtk_event(self, gtk_event):
- typ = gtk_event.type
- state = gtk_event.get_state()
- #print "Event: gtk state = 0x%x" % state ###
- if typ == MOTION_NOTIFY and state & _gdk_button_mask:
- self.kind = 'mouse_drag'
- else:
- self.kind = _gdk_event_type_to_kind[gtk_event.type]
- self.time = gtk_event.time / 1000.0
- self.shift = self.extend_contig = (state & SHIFT_MASK) <> 0
- self.control = self.extend_noncontig = (state & CONTROL_MASK) <> 0
- self.mod1 = (state & MOD1_MASK) <> 0
- self.mod2 = (state & MOD2_MASK) <> 0
- self.mod3 = (state & MOD3_MASK) <> 0
- self.mod4 = (state & MOD4_MASK) <> 0
- self.mod5 = (state & MOD5_MASK) <> 0
- self.super = (state & SUPER_MASK) <> 0
- self.hyper = (state & HYPER_MASK) <> 0
- self.meta = (state & META_MASK) <> 0
- bit13 = (state & BIT13_MASK) <> 0 # X server on MacOSX maps Option to this
- self.option = self.mod1 or bit13
-
- def _platform_modifiers_str(self):
- return " mod1:%s mod2:%s mod3:%s mod4:%s mod5:%s super:%s hyper:%s meta:%s" % (
- self.mod1, self.mod2, self.mod3, self.mod4, self.mod5,
- self.super, self.hyper, self.meta)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Files.py b/PyGUI-2.5.3/GUI/GtkGI/Files.py
deleted file mode 100644
index 2807408..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Files.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - File references and types - Gtk
-#
-
-from GUI.GFiles import *
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Fonts.py b/PyGUI-2.5.3/GUI/GtkGI/Fonts.py
deleted file mode 100644
index b554514..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Fonts.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# Python GUI - Fonts - Gtk
-#
-
-import sys
-from gi.repository import Pango
-from gi.repository import Gtk
-from gi.repository import Gdk
-from GUI.GFonts import Font as GFont
-
-class Font(GFont):
-
- #_gdk_font = None
- _pango_font = None
- _pango_metrics = None
- _pango_layout = None
-
-# def _from_gdk_font(cls, gdk_font):
-# font = cls.__new__(cls)
-# font._gdk_font = gdk_font
-# return font
-#
-# _from_gdk_font = classmethod(_from_gdk_font)
-
- def _from_pango_description(cls, pango_description):
- font = cls.__new__(cls)
- font._pango_description = pango_description
- return font
-
- _from_pango_description = classmethod(_from_pango_description)
-
- def __init__(self, family, size = 12, style = []):
- if 'italic' in style:
- pango_style = Pango.Style.ITALIC
- else:
- pango_style = Pango.Style.NORMAL
- if 'bold' in style:
- pango_weight = Pango.Weight.BOLD
- else:
- pango_weight = Pango.Weight.NORMAL
- pfd = Pango.FontDescription()
- pfd.set_family(family)
- pfd.set_size(int(round(size * Pango.SCALE)))
- pfd.set_style(pango_style)
- pfd.set_weight(pango_weight)
- self._pango_description = pfd
-
- def get_family(self):
- return self._pango_description.get_family()
-
- def get_size(self):
- return self._pango_description.get_size() / Pango.SCALE
-
- def get_style(self):
- style = []
- pfd = self._pango_description
- if pfd.get_weight() > Pango.Weight.NORMAL:
- style.append('bold')
- if pfd.get_style() <> Pango.Style.NORMAL:
- style.append('italic')
- return style
-
- def get_ascent(self):
- self._get_pango_metrics()
- result = self._ascent
- return result
-
- def get_descent(self):
- self._get_pango_metrics()
- return self._descent
-
- def get_height(self):
- self._get_pango_metrics()
- return self._ascent + self._descent
-
- def get_line_height(self):
- return self.get_height()
-
- def _get_pango_metrics(self):
- #print "Font._get_pango_metrics: enter" ###
- pfm = self._pango_metrics
- if not pfm:
- pf = self._get_pango_font()
- pfm = pf.get_metrics(None)
- self._pango_metrics = pfm
- self._ascent = pfm.get_ascent() / Pango.SCALE
- self._descent = pfm.get_descent() / Pango.SCALE
- return pfm
-
- def _get_pango_font(self):
- pf = self._pango_font
- if not pf:
- pf = _pango_context.load_font(self._pango_description)
- if not pf:
- raise ValueError("Unable to load Pango font for %s" % self)
- self._pango_font = pf
- return pf
-
- def width(self, s, start = 0, end = sys.maxint):
- layout = self._get_pango_layout(s[start:end], True)
- return layout.get_pixel_size()[0]
-
- def text_size(self, text):
- layout = self._get_pango_layout(text, False)
- return layout.get_pixel_size()
-
- def x_to_pos(self, s, x):
- layout = self._get_pango_layout(s, True)
- return pango_layout.xy_to_index(x, 0)
-
- def _get_pango_layout(self, text, single_paragraph_mode):
- layout = self._pango_layout
- if not layout:
- layout = Pango.Layout(_pango_context)
- layout.set_font_description(self._pango_description)
- self._pango_layout = layout
- layout.set_single_paragraph_mode(single_paragraph_mode)
- layout.set_text(text, len(text))
- return layout
-
-
-_pango_context = Gtk.Label().create_pango_context()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Frames.py b/PyGUI-2.5.3/GUI/GtkGI/Frames.py
deleted file mode 100644
index 4a0bc11..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Frames.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Python GUI - Frames - Gtk
-#
-
-from gtk import Fixed
-from GUI.GFrames import Frame as GFrame
-
-class Frame(GFrame):
-
- def __init__(self, **kwds):
- gtk_widget = Fixed()
- gtk_widget.show()
- GFrame.__init__(self, _gtk_outer = gtk_widget)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/GL.py b/PyGUI-2.5.3/GUI/GtkGI/GL.py
deleted file mode 100644
index 0ffc017..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/GL.py
+++ /dev/null
@@ -1,212 +0,0 @@
-#
-# PyGUI - OpenGL View - Gtk/GtkGLExt
-#
-
-try:
- from gtk import gdkgl, gtkgl
- from OpenGL.GL import glViewport
-except ImportError, e:
- raise ImportError("OpenGL support is not available (%s)" % e)
-
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.ImageBases import ImageBase
-from GUI.GtkPixmaps import GtkPixmap
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-from GUI.GLDisplayLists import DisplayList
-
-#------------------------------------------------------------------------------
-
-def gtk_find_config_default(attr, mode_bit):
- try:
- cfg = gdkgl.Config(mode = mode_bit)
- value = cfg.get_attrib(attr)[0]
- except gdkgl.NoMatches:
- value = 0
- print "default for attr", attr, "=", value
- return value
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- _alpha = False
- _color_size = 1
- _alpha_size = 1
- _depth_size = 1
- _stencil_size = 1
- _accum_size = 1
-
- def _gtk_get_config(self):
- csize = self._color_size
- asize = 0
- dsize = 0
- ssize = 0
- acsize = 0
- aasize = 0
- if self._alpha:
- asize = self._alpha_size
- if self._depth_buffer:
- dsize = self._depth_size
- if self._stencil_buffer:
- ssize = self._stencil_size
- if self._accum_buffer:
- acsize = self._accum_size
- if self._alpha:
- aasize = acsize
- attrs = [
- gdkgl.RGBA,
- gdkgl.RED_SIZE, csize,
- gdkgl.GREEN_SIZE, csize,
- gdkgl.BLUE_SIZE, csize,
- gdkgl.ALPHA_SIZE, asize,
- gdkgl.AUX_BUFFERS, self._aux_buffers,
- gdkgl.DEPTH_SIZE, dsize,
- gdkgl.STENCIL_SIZE, ssize,
- gdkgl.ACCUM_RED_SIZE, acsize,
- gdkgl.ACCUM_GREEN_SIZE, acsize,
- gdkgl.ACCUM_BLUE_SIZE, acsize,
- gdkgl.ACCUM_ALPHA_SIZE, aasize,
- ]
- if self._double_buffer:
- attrs += [gdkgl.DOUBLEBUFFER]
- if self._stereo:
- attrs += [gdkgl.STEREO]
- if self._multisample:
- attrs += [
- gdkgl.SAMPLE_BUFFERS, 1,
- gdkgl.SAMPLES, self._samples_per_pixel
- ]
- result = self._gdkgl_config(attrs)
- if not result and self._double_buffer:
- attrs.remove(gdkgl.DOUBLEBUFFER)
- result = self._gdkgl_config(attrs)
- if not result:
- raise GLConfigError
- return result
-
- def _gdkgl_config(self, attrs):
- try:
- return gdkgl.Config(attrib_list = attrs)
- except gdkgl.NoMatches:
- return None
-
- def _gtk_set_config(self, gtk_config):
- def attr(key):
- return gtk_config.get_attrib(key)[0]
- self._color_size = attr(gdkgl.RED_SIZE)
- self._alpha_size = attr(gdkgl.ALPHA_SIZE)
- self._alpha = gtk_config.has_alpha()
- self._double_buffer = gtk_config.is_double_buffered()
- self._stereo = gtk_config.is_stereo()
- self._aux_buffers = attr(gdkgl.AUX_BUFFERS)
- self._depth_size = attr(gdkgl.DEPTH_SIZE)
- self._depth_buffer = gtk_config.has_depth_buffer()
- self._stencil_size = attr(gdkgl.STENCIL_SIZE)
- self._stencil_buffer = gtk_config.has_stencil_buffer()
- self._accum_size = attr(gdkgl.ACCUM_RED_SIZE)
- self._accum_buffer = gtk_config.has_accum_buffer()
- self._multisample = attr(gdkgl.SAMPLE_BUFFERS) <> 0
- self._samples_per_pixel = attr(gdkgl.SAMPLES)
-
- def supported(self, mode = 'both'):
- try:
- gtk_config = self._gtk_get_config()
- pf = GLConfig.__new__(GLConfig)
- pf._gtk_set_config(gtk_config)
- return pf
- except GLConfigError:
- return None
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- _first_expose = 0
-
- def __init__(self, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- GLContext.__init__(self, share_group, pf, kwds)
- gtk_share = self._gtk_get_share()
- area = gtkgl.DrawingArea(glconfig = self._gl_config, share_list = gtk_share,
- render_type = gdkgl.RGBA_TYPE)
- area.show()
- self._gtk_connect_after(area, "realize", self._gtk_realize_signal)
- self._gtk_connect(area, "expose-event", self._gtk_expose_event_signal)
- GGLView.__init__(self, _gtk_outer = area, _gtk_input = area,
- _gtk_focus = area)
- self.set(**kwds)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
- def _gtk_get_gl_context(self):
- if not self._gl_context:
- self._gtk_inner_widget.realize()
- return self._gl_context
-
- def _gtk_realize_signal(self):
- #print "GLView._gtk_realize_signal" ###
- area = self._gtk_inner_widget
- self._gl_drawable = area.get_gl_drawable()
- self._gl_context = area.get_gl_context()
- self.with_context(self.init_context)
-
- def _gtk_expose_event_signal(self, gtk_event):
- #print "GLView._gtk_expose_event_signal" ###
- if not self._first_expose:
- self.with_context(self._update_viewport)
- self._first_expose = 1
- try:
- self.with_context(self._render, flush = True)
- except:
- import sys, traceback
- sys.stderr.write("\n<<<<<<<<<< Exception while rendering a GLView\n")
- traceback.print_exc()
- sys.stderr.write(">>>>>>>>>>\n\n")
-
- def invalidate(self):
- gtk_window = self._gtk_outer_widget.window
- if gtk_window:
- width, height = self.size
- gtk_window.invalidate_rect((0, 0, width, height), 0)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GtkPixmap, GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- GLContext.__init__(self, share_group, pf, kwds)
- gl_config = pf._gtk_get_config()
- self._gl_config = gl_config
-# if share:
-# gtk_share = share.shared_context._gtk_get_gl_context()
-# else:
-# gtk_share = None
- gtk_share = self._gtk_get_share()
- GtkPixmap.__init__(self, width, height)
- gdk_pixmap = self._gdk_pixmap
- gdkgl.ext(gdk_pixmap)
- self._gl_drawable = gdk_pixmap.set_gl_capability(glconfig = gl_config)
- print "GLPixmap: self._gl_drawable =", self._gl_drawable ###
- self._gl_context = gdkgl.Context(
- self._gl_drawable,
- direct = False,
- share_list = gtk_share,
- render_type = gdkgl.RGBA_TYPE
- )
- print "GLPixmap: self._gl_context =", self._gl_context ###
- ImageBase.__init__(self, **kwds)
- self.with_context(self._init_context)
- print "GLPixmap: initialised context" ###
-
-# def _init_context(self):
-# width, height = self.size
-# glViewport(0, 0, int(width), int(height))
-# print "GLPixmap: Set viewport to", width, height ###
-# self.init_context()
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/GtkGI/GLContexts.py b/PyGUI-2.5.3/GUI/GtkGI/GLContexts.py
deleted file mode 100644
index 1765565..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/GLContexts.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# PyGUI - GL Context - Gtk
-#
-
-from GUI.GGLContexts import GLContext as GGLContext
-
-try:
- from OpenGL.GL import glFlush
-except ImportError, e:
- raise ImportError("OpenGL support is not available (%s)" % e)
-
-class GLContext(GGLContext):
-
- _gl_drawable = None
- _gl_context = None
-
- def __init__(self, share_group, config, kwds):
- GGLContext.__init__(self, share_group)
- self._gl_config = config._gtk_get_config()
-
- def _gtk_get_share(self):
- shared_context = self._get_shared_context()
- if shared_context:
- return shared_context._gtk_get_gl_context()
- else:
- return None
-
- def _with_context(self, proc, flush):
- drawable = self._gl_drawable
- if drawable:
- if not drawable.gl_begin(self._gl_context):
- raise ValueError(
- "Unable to make %s the current OpenGL context (gl_begin failed)" % self)
- try:
- self._with_share_group(proc)
- if flush:
- if drawable.is_double_buffered():
- #print "GLContext.with_context: swapping buffers" ###
- drawable.swap_buffers()
- else:
- #print "GLContext.with_context: flushing" ###
- glFlush()
- finally:
- drawable.gl_end()
- #return result
-
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Geometry.py b/PyGUI-2.5.3/GUI/GtkGI/Geometry.py
deleted file mode 100644
index 2ebbd95..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Geometry.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - Points and Rectangles - Gtk
-#
-
-from GUI.GGeometry import *
diff --git a/PyGUI-2.5.3/GUI/GtkGI/GtkImageScaling.py b/PyGUI-2.5.3/GUI/GtkGI/GtkImageScaling.py
deleted file mode 100644
index 3900ae3..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/GtkImageScaling.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Python GUI - Image scaling utilities - Gtk
-#
-
-from gi.repository import Gdk
-
-def gtk_scale_pixbuf(src_pixbuf, sx, sy, sw, sh, dw, dh):
- """Return a new pixbuf containing the specified part of
- the given pixbuf scaled to the specified size."""
- dst_pixbuf = GdkPixbuf.Pixbuf(
- src_pixbuf.get_colorspace(), src_pixbuf.get_has_alpha(),
- src_pixbuf.get_bits_per_sample(), dw, dh)
- xscale = float(dw) / sw
- yscale = float(dh) / sh
- xoffset = - xscale * sx
- yoffset = - yscale * sy
- src_pixbuf.scale(dst_pixbuf, 0, 0, dw, dh,
- xoffset, yoffset, xscale, yscale, GdkPixbuf.InterpType.BILINEAR)
- return dst_pixbuf
diff --git a/PyGUI-2.5.3/GUI/GtkGI/GtkPixmaps.py b/PyGUI-2.5.3/GUI/GtkGI/GtkPixmaps.py
deleted file mode 100644
index dec798b..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/GtkPixmaps.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Python GUI - Gtk - Common pixmap code
-#
-
-from gi.repository import Gdk
-from GUI.StdColors import clear
-from GUI.GtkImageScaling import gtk_scale_pixbuf
-from GUI.Canvases import Canvas
-
-class GtkPixmap:
-
- def __init__(self, width, height):
- gdk_root = Gdk.get_default_root_window()
- self._gdk_pixmap = Gdk.Pixmap(gdk_root, width, height)
- #ctx = self._gdk_pixmap.cairo_create()
- #self._gtk_surface = ctx.get_target()
-
- def _gtk_set_source(self, ctx, x, y):
- ctx.set_source_pixmap(self._gdk_pixmap, x, y)
-
- def get_width(self):
- return self._gdk_pixmap.get_size()[0]
-
- def get_height(self):
- return self._gdk_pixmap.get_size()[1]
-
- def get_size(self):
- return self._gdk_pixmap.get_size()
-
- def with_canvas(self, proc):
- canvas = Canvas._from_gdk_drawable(self._gdk_pixmap)
- canvas.backcolor = clear
- proc(canvas)
-
diff --git a/PyGUI-2.5.3/GUI/GtkGI/GtkUtils.py b/PyGUI-2.5.3/GUI/GtkGI/GtkUtils.py
deleted file mode 100644
index 39c2b5b..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/GtkUtils.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#-----------------------------------------------------------------------------
-#
-# Python GUI - Gtk - Utilities
-#
-#-----------------------------------------------------------------------------
-
-class GtkFixedSize(object):
- # Mixin for Gtk widgets to force them to always request exactly the
- # size set using set_size_request().
-
- def do_get_preferred_width(self):
- w = self.get_size_request()[0]
- #print "GtkFixedSize.do_get_preferred_width:", w ###
- return w, w
-
- def do_get_preferred_height(self):
- h = self.get_size_request()[1]
- #print "GtkFixedSize.do_get_preferred_height:", h ###
- return h, h
-
- def do_get_preferred_height_for_width(self, width):
- #print "GtkFixedSize.do_get_preferred_height_for_width:", width ###
- return self.do_get_preferred_height()
-
- def do_get_preferred_width_for_height(self, height):
- #print "GtkFixedSize.do_get_preferred_width_for_height:", height ###
- return self.do_get_preferred_width()
-
-#-----------------------------------------------------------------------------
-
-def mix_in(*src_classes):
- # Workaround for do_xxx method overrides not working properly
- # with multiple inheritance.
- #
- # Usage:
- #
- # class MyClass(Gtk.SomeBaseClass):
- # mix_in(Class1, Class2, ...)
- #
- import sys
- frame = sys._getframe(1)
- dst_dict = frame.f_locals
- for src_class in src_classes:
- for name, value in src_class.__dict__.iteritems():
- if name not in dst_dict:
- dst_dict[name] = value
diff --git a/PyGUI-2.5.3/GUI/GtkGI/ImageBases.py b/PyGUI-2.5.3/GUI/GtkGI/ImageBases.py
deleted file mode 100644
index 1d19af4..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/ImageBases.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# PyGUI - Image Base - Gtk
-#
-
-from __future__ import division
-from GUI.GImageBases import ImageBase as GImageBase
-
-class ImageBase(GImageBase):
-
-# def get_width(self):
-# return self._gtk_surface.get_width()
-#
-# def get_height(self):
-# return self._gtk_surface.get_height()
-
- def draw(self, canvas, src_rect, dst_rect):
- sx, sy, sr, sb = src_rect
- dx, dy, dr, db = dst_rect
- sw = sr - sx
- sh = sb - sy
- dw = dr - dx
- dh = db - dy
- ctx = canvas._gtk_ctx
- ctx.save()
- ctx.translate(dx, dy)
- ctx.new_path()
- ctx.rectangle(0, 0, dw, dh)
- ctx.clip()
- ctx.scale(dw / sw, dh / sh)
- self._gtk_set_source(canvas._gtk_ctx, -sx, -sy)
- ctx.paint()
- ctx.restore()
-
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Images.py b/PyGUI-2.5.3/GUI/GtkGI/Images.py
deleted file mode 100644
index ccb7396..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Images.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Images - Gtk
-#
-
-from __future__ import division
-from array import array
-import cairo
-from gi.repository import Gdk, GdkPixbuf
-from GUI.GImages import Image as GImage
-
-class Image(GImage):
-
- def _init_from_file(self, file):
- self._gdk_pixbuf = GdkPixbuf.Pixbuf.new_from_file(file)
-
- def _gtk_set_source(self, ctx, x, y):
- ctx.set_source_pixbuf(self._gdk_pixbuf, x, y)
-
- def get_width(self):
- return self._gdk_pixbuf.get_width()
-
- def get_height(self):
- return self._gdk_pixbuf.get_height()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Images_xlib.py b/PyGUI-2.5.3/GUI/GtkGI/Images_xlib.py
deleted file mode 100644
index b30291f..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Images_xlib.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Python GUI - Images - Gtk
-#
-
-from gi.repository import Gdk
-from GtkImageScaling import gtk_scale_pixbuf
-from GImages import Image as GImage
-
-class Image(GImage):
-
- def _init_from_file(self, file):
- self._gdk_pixbuf = GdkPixbuf.Pixbuf.new_from_file(file)
-
- def get_width(self):
- return self._gdk_pixbuf.get_width()
-
- def get_height(self):
- return self._gdk_pixbuf.get_height()
-
- def draw(self, canvas, src_rect, dst_rect):
- sx, sy, sr, sb = src_rect
- dx, dy, dr, db = dst_rect
- sw = sr - sx
- sh = sb - sy
- dw = dr - dx
- dh = db - dy
- gdk_pixbuf = self._gdk_pixbuf
- if sw <> dw or sh <> dh:
- gdk_scaled_pixbuf = gtk_scale_pixbuf(gdk_pixbuf, sx, sy, sw, sh, dw, dh)
- canvas._gdk_drawable.draw_pixbuf(
- canvas._gdk_gc, gdk_scaled_pixbuf,
- 0, 0, dx, dy, dw, dh, Gdk.RGB_DITHER_NORMAL, 0, 0)
- else:
- canvas._gdk_drawable.draw_pixbuf(
- canvas._gdk_gc, self._gdk_pixbuf,
- sx, sy, dx, dy, sw, sh, Gdk.RGB_DITHER_NORMAL, 0, 0)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Labels.py b/PyGUI-2.5.3/GUI/GtkGI/Labels.py
deleted file mode 100644
index e0a2e96..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Labels.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Python GUI - Labels - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.StdFonts import system_font
-from GUI.GLabels import Label as GLabel
-
-class Label(GLabel):
-
- _vertical_padding = 6
-
- def __init__(self, text = "New Label", font = system_font, **kwds):
- width, height = font.text_size(text)
- gtk_label = Gtk.Label(label=text)
- gtk_label.set_alignment(0.0, 0.5)
- gtk_label.set_size_request(width, height + self._vertical_padding)
- gtk_label.show()
- GLabel.__init__(self, _gtk_outer = gtk_label, font = font, **kwds)
-
- def get_text(self):
- return self._gtk_outer_widget.get_text()
-
- def set_text(self, text):
- self._gtk_outer_widget.set_text(text)
-
- def _gtk_get_alignment(self):
- return self._gtk_outer_widget.get_alignment()[0]
-
- def _gtk_set_alignment(self, fraction, just):
- gtk_label = self._gtk_outer_widget
- gtk_label.set_alignment(fraction, 0.0)
- gtk_label.set_justify(just)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Menus.py b/PyGUI-2.5.3/GUI/GtkGI/Menus.py
deleted file mode 100644
index 978345a..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Menus.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Python GUI - Menus - Gtk version
-#
-
-from gi.repository import Gtk
-from gi.repository import Gdk
-from GUI.Globals import application
-from GUI.GMenus import Menu as GMenu, MenuItem
-
-def _report_accel_changed_(*args):
- print "Menus: accel_changed:", args
-
-class Menu(GMenu):
-
- def __init__(self, title, items, **kwds):
- GMenu.__init__(self, title, items, **kwds)
- self._gtk_menu = Gtk.Menu()
- self._gtk_accel_group = Gtk.AccelGroup()
- #self._gtk_accel_group.connect('accel_changed', _report_accel_changed_) ###
-
- def _clear_platform_menu(self):
- gtk_menu = self._gtk_menu
- for gtk_item in gtk_menu.get_children():
- gtk_item.destroy()
-
- def _add_separator_to_platform_menu(self):
- gtk_item = Gtk.MenuItem()
- gtk_item.set_sensitive(0)
- gtk_separator = Gtk.HSeparator()
- gtk_item.add(gtk_separator)
- self._gtk_add_item(gtk_item)
-
- def _gtk_add_item(self, gtk_item):
- gtk_item.show_all()
- self._gtk_menu.append(gtk_item)
-
- def _add_item_to_platform_menu(self, item, name, command = None, index = None):
- checked = item.checked
- if checked is None:
- gtk_item = Gtk.MenuItem.new_with_label(name)
- else:
- gtk_item = Gtk.CheckMenuItem.new_with_label(name)
- self._gtk_add_item(gtk_item)
- if not item.enabled:
- gtk_item.set_sensitive(0)
- if checked:
- gtk_item.set_active(1)
- if command:
- app = application()
- if index is not None:
- action = lambda widget: app.dispatch(command, index)
- else:
- action = lambda widget: app.dispatch(command)
- gtk_item.connect('activate', action)
- key = item._key
- if key:
- gtk_modifiers = Gdk.ModifierType.CONTROL_MASK
- if item._shift:
- gtk_modifiers |= Gdk.ModifierType.SHIFT_MASK
- if item._option:
- gtk_modifiers |= Gdk.ModifierType.MOD1_MASK
- gtk_item.add_accelerator('activate', self._gtk_accel_group,
- ord(key), gtk_modifiers, Gtk.AccelFlags.VISIBLE)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Pixmaps.py b/PyGUI-2.5.3/GUI/GtkGI/Pixmaps.py
deleted file mode 100644
index ed3bbd7..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Pixmaps.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Python GUI - Pixmap - Gtk
-#
-
-from gi.repository import Gdk
-from GUI.GtkPixmaps import GtkPixmap
-from GUI.GPixmaps import Pixmap as GPixmap
-
-class Pixmap(GtkPixmap, GPixmap):
-
- def __init__(self, width, height):
- GtkPixmap.__init__(self, width, height)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Printing.py b/PyGUI-2.5.3/GUI/GtkGI/Printing.py
deleted file mode 100644
index e712cf7..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Printing.py
+++ /dev/null
@@ -1,190 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Gtk
-#
-#------------------------------------------------------------------------------
-
-from gi.repository import Gtk
-#from gi.repository.Gtk import UNIT_POINTS
-from GUI.Canvases import Canvas
-from GUI.GPrinting import PageSetup as GPageSetup, Printable as GPrintable, \
- Paginator
-
-UNIT_POINTS = Gtk.Unit.POINTS
-
-gtk_paper_names = [
- Gtk.PAPER_NAME_A3,
- Gtk.PAPER_NAME_A4,
- Gtk.PAPER_NAME_A5,
- Gtk.PAPER_NAME_B5,
- Gtk.PAPER_NAME_LETTER,
- Gtk.PAPER_NAME_EXECUTIVE,
- Gtk.PAPER_NAME_LEGAL,
-]
-
-gtk_paper_formats = {}
-
-gtk_print_settings = Gtk.PrintSettings()
-
-def init_gtk_paper_formats():
- for gtk_name in gtk_paper_names:
- display_name = Gtk.PaperSize.new(gtk_name).get_display_name()
- gtk_paper_formats[display_name] = gtk_name
-
-init_gtk_paper_formats()
-
-def gtk_default_page_setup():
- pset = Gtk.PageSetup()
- pset.set_paper_size(Gtk.PaperSize.new(Gtk.paper_size_get_default()))
- return pset
-
-def get_gtk_state(gtk_page_setup):
- state = {}
- state['orientation'] = gtk_page_setup.get_orientation()
- state['paper_size'] = gtk_page_setup.get_paper_size().get_name()
- state['top_margin'] = gtk_page_setup.get_top_margin(UNIT_POINTS)
- state['bottom_margin'] = gtk_page_setup.get_bottom_margin(UNIT_POINTS)
- state['left_margin'] = gtk_page_setup.get_left_margin(UNIT_POINTS)
- state['right_margin'] = gtk_page_setup.get_right_margin(UNIT_POINTS)
- return state
-
-def set_gtk_state(gtk_page_setup, state):
- gtk_page_setup.set_orientation(state['orientation'])
- gtk_page_setup.set_paper_size(Gtk.PaperSize(state['paper_size']))
- gtk_page_setup.set_top_margin(state['top_margin'], UNIT_POINTS)
- gtk_page_setup.set_bottom_margin(state['bottom_margin'], UNIT_POINTS)
- gtk_page_setup.set_left_margin(state['left_margin'], UNIT_POINTS)
- gtk_page_setup.set_right_margin(state['right_margin'], UNIT_POINTS)
-
-#------------------------------------------------------------------------------
-
-class PageSetup(GPageSetup):
-
- _printer_name = ""
- _left_margin = 36
- _top_margin = 36
- _right_margin = 36
- _bottom_margin = 36
-
- def __init__(self):
- self._gtk_page_setup = gtk_default_page_setup()
-
- def __getstate__(self):
- state = GPageSetup.__getstate__(self)
- state['_gtk_page_setup'] = get_gtk_state(self._gtk_page_setup)
- return state
-
- def __setstate__(self, state):
- gtk_setup = gtk_default_page_setup()
- self._gtk_page_setup = gtk_setup
- gtk_state = state.pop('_gtk_page_setup', None)
- if gtk_state:
- set_gtk_state(gtk_setup, gtk_state)
- self.margins = state['margins']
- self.printer_name = state['printer_name']
- else:
- GPageSetup.__setstate__(state)
-
- def get_paper_name(self):
- return self._gtk_page_setup.get_paper_size().get_display_name()
-
- def set_paper_name(self, x):
- psize = Gtk.PaperSize(gtk_paper_formats.get(x) or x)
- self._gtk_page_setup.set_paper_size(psize)
-
- def get_paper_width(self):
- return self._gtk_page_setup.get_paper_width(UNIT_POINTS)
-
- def set_paper_width(self, x):
- self._gtk_page_setup.set_paper_width(x, UNIT_POINTS)
-
- def get_paper_height(self):
- return self._gtk_page_setup.get_paper_height(UNIT_POINTS)
-
- def set_paper_height(self, x):
- self._gtk_page_setup.set_paper_height(x, UNIT_POINTS)
-
- def get_orientation(self):
- o = self._gtk_page_setup.get_orientation()
- if o in (Gtk.PAGE_ORIENTATION_LANDSCAPE,
- Gtk.PAGE_ORIENTATION_REVERSE_LANDSCAPE):
- return 'landscape'
- else:
- return 'portrait'
-
- def set_orientation(self, x):
- if x == 'landscape':
- o = Gtk.PAGE_ORIENTATION_LANDSCAPE
- else:
- o = Gtk.PAGE_ORIENTATION_PORTRAIT
- self._gtk_page_setup.set_orientation(o)
-
- def get_left_margin(self):
- return self._left_margin
-
- def get_top_margin(self):
- return self._top_margin
-
- def get_right_margin(self):
- return self._right_margin
-
- def get_bottom_margin(self):
- return self._bottom_margin
-
- def set_left_margin(self, x):
- self._left_margin = x
-
- def set_top_margin(self, x):
- self._top_margin = x
-
- def set_right_margin(self, x):
- self._right_margin = x
-
- def set_bottom_margin(self, x):
- self._bottom_margin = x
-
- def get_printer_name(self):
- return self._printer_name
-
- def set_printer_name(self, x):
- self._printer_name = x
-
-#------------------------------------------------------------------------------
-
-class Printable(GPrintable):
-
- def print_view(self, page_setup, prompt = True):
- global gtk_print_settings
- paginator = Paginator(self, page_setup)
-
- def draw_page(_, gtk_print_context, page_num):
- cairo_context = gtk_print_context.get_cairo_context()
- canvas = Canvas._from_cairo_context(cairo_context)
- paginator.draw_page(canvas, page_num)
-
- gtk_op = Gtk.PrintOperation()
- gtk_op.set_print_settings(gtk_print_settings)
- gtk_op.set_default_page_setup(page_setup._gtk_page_setup)
- gtk_op.set_n_pages(paginator.num_pages)
- gtk_op.set_use_full_page(True)
- gtk_op.set_unit(UNIT_POINTS)
- gtk_op.connect('draw-page', draw_page)
- if prompt:
- action = Gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG
- else:
- action = Gtk.PRINT_OPERATION_ACTION_PRINT
- result = gtk_op.run(action)
- if result == Gtk.PRINT_OPERATION_RESULT_APPLY:
- gtk_print_settings = gtk_op.get_print_settings()
-
-#------------------------------------------------------------------------------
-
-def present_page_setup_dialog(page_setup):
- old_setup = page_setup._gtk_page_setup
- ps = Gtk.PrintSettings()
- new_setup = Gtk.print_run_page_setup_dialog(None, old_setup, ps)
- if get_gtk_state(old_setup) <> get_gtk_state(new_setup):
- page_setup._gtk_page_setup = new_setup
- return True
- else:
- return False
diff --git a/PyGUI-2.5.3/GUI/GtkGI/RadioButtons.py b/PyGUI-2.5.3/GUI/GtkGI/RadioButtons.py
deleted file mode 100644
index ca51dc9..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/RadioButtons.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Python GUI - Radio buttons - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.GRadioButtons import RadioButton as GRadioButton
-
-class RadioButton(GRadioButton):
-
- def __init__(self, title = "New Control", **kwds):
- gtk_radiobutton = Gtk.RadioButton(None, title)
- gtk_radiobutton.show()
- self._gtk_connect(gtk_radiobutton, 'toggled', self._gtk_toggled_signal)
- GRadioButton.__init__(self, _gtk_outer = gtk_radiobutton, **kwds)
-
- def _value_changed(self):
- group = self._group
- if group:
- if self._value == group._value:
- self._turn_on()
- else:
- group._turn_all_off()
-
- def _turn_on(self):
- self._gtk_outer_widget.set_active(1)
-
- def _is_on(self):
- return self._gtk_outer_widget.get_active()
-
- def _gtk_toggled_signal(self):
- if self._is_on():
- group = self._group
- if group and group._value <> self._value:
- group._value = self._value
- group.do_action()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/RadioGroups.py b/PyGUI-2.5.3/GUI/GtkGI/RadioGroups.py
deleted file mode 100644
index 385e311..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/RadioGroups.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Python GUI - Radio groups - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.GRadioGroups import RadioGroup as GRadioGroup
-
-class RadioGroup(GRadioGroup):
-
- def __init__(self, items = [], **kwds):
- self._gtk_dummy_radiobutton = Gtk.RadioButton()
- GRadioGroup.__init__(self, items, **kwds)
-
- def _item_added(self, item):
- old_value = self._value
- #item._gtk_outer_widget.set_group(self._gtk_dummy_radiobutton)
- item._gtk_outer_widget.join_group(self._gtk_dummy_radiobutton)
- self.value = old_value
-
- def _item_removed(self, item):
- item._gtk_outer_widget.set_group(None)
- if item._value == self._value:
- self._value = None
- self._turn_all_off()
-
- def _value_changed(self):
- new_value = self._value
- for item in self._items:
- if item._value == new_value:
- item._turn_on()
- return
- self._turn_all_off()
-
- def _turn_all_off(self):
- self._gtk_dummy_radiobutton.set_active(1)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/ScrollableViews.py b/PyGUI-2.5.3/GUI/GtkGI/ScrollableViews.py
deleted file mode 100644
index f0929c5..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/ScrollableViews.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Python GUI - Scrollable Views - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.Scrollables import Scrollable, gtk_scrollbar_breadth
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount
-from GUI.Geometry import offset_rect_neg
-
-class ScrollableView(GScrollableView, Scrollable):
-
- def __init__(self, extent = default_extent,
- line_scroll_amount = default_line_scroll_amount,
- **kwds):
- gtk_scrolled_window = Gtk.ScrolledWindow()
- gtk_scrolled_window.show()
- GScrollableView.__init__(self, _gtk_outer = gtk_scrolled_window,
- extent = extent, line_scroll_amount = line_scroll_amount, **kwds)
-
- #
- # Properties
- #
-
- def get_content_width(self):
- w = self._size[0]
- if self.hscrolling:
- w -= gtk_scrollbar_breadth
- return w
-
- def get_content_height(self):
- h = self._size[1]
- if self.vscrolling:
- h -= gtk_scrollbar_breadth
- return h
-
- def get_content_size(self):
- return self.content_width, self.content_height
-
- def set_content_size(self, size):
- w, h = size
- d = gtk_scrollbar_breadth
- if self.hscrolling:
- w += d
- if self.vscrolling:
- h += d
- self.size = (w, h)
-
- def get_extent(self):
- return self._gtk_inner_widget.get_size()
-
- def set_extent(self, (w, h)):
- self._gtk_inner_widget.set_size(w, h)
-
- def get_scroll_offset(self):
- hadj, vadj = self._gtk_adjustments()
- return int(hadj.get_value()), int(vadj.get_value())
-
- def set_scroll_offset(self, (x, y)):
- hadj, vadj = self._gtk_adjustments()
- hadj.set_value(min(float(x), hadj.get_upper() - hadj.get_page_size()))
- vadj.set_value(min(float(y), vadj.get_upper() - vadj.get_page_size()))
-
- def get_line_scroll_amount(self):
- hadj, vadj = self._gtk_adjustments()
- return hadj.get_step_increment(), vadj.get_step_increment()
-
- def set_line_scroll_amount(self, (dx, dy)):
- hadj, vadj = self._gtk_adjustments()
- hadj.set_step_increment(float(dx)) # Amazingly, ints are not
- vadj.set_step_increment(float(dy)) # acceptable here.
-
- def invalidate_rect(self, rect):
- GScrollableView.invalidate_rect(self,
- offset_rect_neg(rect, self.scroll_offset))
-
- #
- # Internal
- #
-
- def _gtk_adjustments(self):
- gtk_widget = self._gtk_inner_widget
- hadj = gtk_widget.get_hadjustment()
- vadj = gtk_widget.get_vadjustment()
- return hadj, vadj
-
- def _gtk_prepare_cairo_context(self, context):
- x, y = self.scroll_offset
- context.translate(-x, -y)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Scrollables.py b/PyGUI-2.5.3/GUI/GtkGI/Scrollables.py
deleted file mode 100644
index 35335a2..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Scrollables.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Python GUI - Common code for scrollable components - Gtk
-#
-
-from gi.repository import Gtk
-
-gtk_scroll_policies = [Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS]
-
-gtk_dummybar = Gtk.VScrollbar()
-gtk_scrollbar_breadth = gtk_dummybar.get_preferred_width()
-del gtk_dummybar
-
-class Scrollable(object):
-
- def get_hscrolling(self):
- return self._gtk_outer_widget.get_property('hscrollbar-policy') <> Gtk.PolicyType.NEVER
-
- def set_hscrolling(self, value):
- self._gtk_outer_widget.set_property('hscrollbar-policy', gtk_scroll_policies[value])
-
- def get_vscrolling(self):
- return self._gtk_outer_widget.get_property('vscrollbar-policy') <> Gtk.PolicyType.NEVER
-
- def set_vscrolling(self, value):
- self._gtk_outer_widget.set_property('vscrollbar-policy', gtk_scroll_policies[value])
-
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Sliders.py b/PyGUI-2.5.3/GUI/GtkGI/Sliders.py
deleted file mode 100644
index 35a9255..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Sliders.py
+++ /dev/null
@@ -1,154 +0,0 @@
-#
-# Python GUI - Slider - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.GSliders import Slider as GSlider
-
-class Slider(GSlider):
-
- _gtk_tick_length = 8
- _gtk_tick_inset = 18
-
- def __init__(self, orient = 'h', ticks = 0, **kwds):
- self._orient = orient
- self._ticks = ticks
- self._discrete = False
- self._live = True
- self._gtk_ticks = None
- length = 100
- gtk_adjustment = Gtk.Adjustment(upper = 1.0)
- xs = 0.0
- ys = 0.0
- if orient == 'h':
- gtk_scale = Gtk.HScale(gtk_adjustment)
- gtk_scale.set_size_request(length, -1)
- gtk_box = Gtk.VBox()
- xs = 1.0
- elif orient == 'v':
- gtk_scale = Gtk.VScale(gtk_adjustment)
- gtk_scale.set_size_request(-1, length)
- gtk_box = Gtk.HBox()
- ys = 1.0
- else:
- raise ValueError("Invalid orientation, should be 'h' or 'v'")
- gtk_scale.set_draw_value(False)
- self._gtk_scale = gtk_scale
- gtk_box.pack_start(gtk_scale, True, True, 0)
- self._gtk_box = gtk_box
- if ticks:
- self._gtk_create_ticks()
- gtk_alignment = Gtk.Alignment.new(xalign = 0.5, yalign = 0.5,
- xscale = xs, yscale = ys)
- gtk_alignment.add(gtk_box)
- gtk_alignment.show_all()
- self._gtk_connect(gtk_adjustment, 'value-changed', self._gtk_value_changed)
- self._gtk_connect(gtk_scale, 'change-value', self._gtk_change_value)
- self._gtk_connect(gtk_scale, 'button-release-event', self._gtk_button_release)
- self._gtk_scale = gtk_scale
- self._gtk_adjustment = gtk_adjustment
- self._gtk_enable_action = True
- GSlider.__init__(self, _gtk_outer = gtk_alignment, **kwds)
-
- def get_min_value(self):
- return self._min_value
-
- def set_min_value(self, x):
- self._gtk_adjustment.lower = x
-
- def get_max_value(self):
- return self._max_value
-
- def set_max_value(self, x):
- self._gtk_adjustment.upper = x
-
- def get_value(self):
- return self._gtk_adjustment.value
-
- def set_value(self, x):
- self._gtk_enable_action = False
- self._gtk_adjustment.value = x
- self._gtk_enable_action = True
-
- def get_ticks(self):
- return self._ticks
-
- def set_ticks(self, x):
- self._ticks = x
- if x:
- self._gtk_create_ticks()
- else:
- self._gtk_destroy_ticks()
-
- def get_discrete(self):
- return self._discrete
-
- def set_discrete(self, x):
- self._discrete = x
-
- def get_live(self):
- return self._live
-
- def set_live(self, x):
- self._live = x
-
- def _gtk_create_ticks(self):
- if not self._gtk_ticks:
- gtk_ticks = Gtk.DrawingArea()
- length = self._gtk_tick_length
- if self._orient == 'h':
- gtk_ticks.set_size_request(-1, length)
- else:
- gtk_ticks.set_size_request(length, -1)
- self._gtk_ticks = gtk_ticks
- self._gtk_connect(gtk_ticks, 'expose-event', self._gtk_draw_ticks)
- self._gtk_box.pack_start(gtk_ticks, True, True, 0)
-
- def _gtk_destroy_ticks(self):
- gtk_ticks = self._gtk_ticks
- if gtk_ticks:
- gtk_ticks.destroy()
- self._gtk_ticks = None
-
- def _gtk_draw_ticks(self, event):
- gtk_ticks = self._gtk_ticks
- gdk_win = gtk_ticks.window
- gtk_style = gtk_ticks.style
- orient = self._orient
- steps = self._ticks - 1
- _, _, w, h = gtk_ticks.allocation
- u0 = self._gtk_tick_inset
- v0 = 0
- if orient == 'h':
- draw_line = gtk_style.paint_vline
- u1 = w - u0
- v1 = h
- else:
- draw_line = gtk_style.paint_hline
- u1 = h - u0
- v1 = w
- state = Gtk.StateType.NORMAL
- for i in xrange(steps + 1):
- u = u0 + i * (u1 - u0) / steps
- draw_line(gdk_win, state, None, gtk_ticks, "", v0, v1, u)
-
- def _gtk_value_changed(self):
- if self._live and self._gtk_enable_action:
- self.do_action()
-
- def _gtk_change_value(self, event_type, value):
- gtk_adjustment = self._gtk_adjustment
- vmin = gtk_adjustment.lower
- vmax = gtk_adjustment.upper
- value = min(max(vmin, value), vmax)
- if self._discrete:
- steps = self._ticks - 1
- if steps > 0:
- q = round(steps * (value - vmin) / (vmax - vmin))
- value = vmin + q * (vmax - vmin) / steps
- if gtk_adjustment.value <> value:
- gtk_adjustment.value = value
- return True
-
- def _gtk_button_release(self, gtk_event):
- self.do_action()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/StdCursors.py b/PyGUI-2.5.3/GUI/GtkGI/StdCursors.py
deleted file mode 100644
index 0b45984..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/StdCursors.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Python GUI - Standard Cursors - Gtk
-#
-
-from gi.repository import Gdk
-from GUI.Cursors import Cursor
-
-__all__ = [
- 'arrow',
- 'ibeam',
- 'crosshair',
- 'fist',
- 'hand',
- 'finger',
- 'invisible',
-]
-
-arrow = Cursor._from_gtk_std_cursor(Gdk.CursorType.LEFT_PTR)
-ibeam = Cursor._from_gtk_std_cursor(Gdk.CursorType.XTERM)
-crosshair = Cursor._from_gtk_std_cursor(Gdk.CursorType.TCROSS)
-fist = Cursor("cursors/fist.tiff")
-hand = Cursor("cursors/hand.tiff")
-finger = Cursor("cursors/finger.tiff")
-invisible = Cursor._from_nothing()
-
-del Cursor
-
-def empty_cursor():
- return invisible
diff --git a/PyGUI-2.5.3/GUI/GtkGI/StdFonts.py b/PyGUI-2.5.3/GUI/GtkGI/StdFonts.py
deleted file mode 100644
index 6f5c1a5..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/StdFonts.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Python GUI - Standard Fonts - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.Fonts import Font
-
-system_font = Font._from_pango_description(Gtk.Label().get_style().font_desc)
-application_font = Font._from_pango_description(Gtk.Entry().get_style().font_desc)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/StdMenus.py b/PyGUI-2.5.3/GUI/GtkGI/StdMenus.py
deleted file mode 100644
index 70264a3..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/StdMenus.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# Python GUI - Standard Menus - Gtk
-#
-
-from GUI.Menus import Menu
-from GUI.MenuLists import MenuList
-
-_file_menu_items = [
- ("New/N", 'new_cmd'),
- ("Open.../O", 'open_cmd'),
- ("Close/W", 'close_cmd'),
- "-",
- ("Save/S", 'save_cmd'),
- ("Save As...", 'save_as_cmd'),
- ("Revert", 'revert_cmd'),
- "-",
- ("Page Setup...", 'page_setup_cmd'),
- ("Print.../P", 'print_cmd'),
- "-",
- ("Quit/Q", 'quit_cmd'),
-]
-
-_edit_menu_items = [
- ("Undo/Z", 'undo_cmd'),
- ("Redo/^Z", 'redo_cmd'),
- "-",
- ("Cut/X", 'cut_cmd'),
- ("Copy/C", 'copy_cmd'),
- ("Paste/V", 'paste_cmd'),
- ("Clear", 'clear_cmd'),
- "-",
- ("Select All/A", 'select_all_cmd'),
- "-",
- ("Preferences...", 'preferences_cmd'),
-]
-
-_help_menu_items = [
- ("About ", 'about_cmd'),
-]
-
-#------------------------------------------------------------------------------
-
-def basic_menus(substitutions = {}):
- return MenuList([
- Menu("File", _file_menu_items, substitutions = substitutions),
- Menu("Edit", _edit_menu_items, substitutions = substitutions),
- Menu("Help", _help_menu_items, special = True, substitutions = substitutions),
- ])
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Tasks.py b/PyGUI-2.5.3/GUI/GtkGI/Tasks.py
deleted file mode 100644
index 6d71038..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Tasks.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# PyGUI - Tasks - Gtk
-#
-
-import gobject
-from GUI.GTasks import Task as GTask
-
-class Task(GTask):
-
- def __init__(self, proc, interval, repeat = 0, start = 1):
- self._proc = proc
- self._gtk_interval = int(interval * 1000)
- self._repeat = repeat
- self._gtk_timeout_id = None
- if start:
- self.start()
-
- def get_scheduled(self):
- return self._gtk_timeout_id is not None
-
- def start(self):
- if self._gtk_timeout_id is None:
- self._gtk_timeout_id = GObject.timeout_add(self._gtk_interval,
- self._gtk_fire)
-
- def stop(self):
- id = self._gtk_timeout_id
- if id is not None:
- GObject.source_remove(id)
- self._gtk_timeout_id = None
-
- def _gtk_fire(self):
- self._proc()
- if self._repeat:
- return 1
- else:
- self._gtk_timeout_id = None
diff --git a/PyGUI-2.5.3/GUI/GtkGI/TextEditors.py b/PyGUI-2.5.3/GUI/GtkGI/TextEditors.py
deleted file mode 100644
index 1ab4f5c..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/TextEditors.py
+++ /dev/null
@@ -1,119 +0,0 @@
-#
-# Python GUI - Text Editor - Gtk
-#
-
-import pango, gtk
-from GUI.Globals import application
-from GUI.GTextEditors import TextEditor as GTextEditor
-from GUI.Scrollables import Scrollable
-from GUI.Fonts import Font
-
-class TextEditor(GTextEditor, Scrollable):
-
- _font = None
-
- def __init__(self, scrolling = 'hv', **kwds):
- gtk_sw = Gtk.ScrolledWindow()
- gtk_sw.show()
- gtk_tv = Gtk.TextView()
- gtk_tv.show()
- gtk_sw.add(gtk_tv)
- gtk_tb = Gtk.TextBuffer()
- self._gtk_textbuffer = gtk_tb
- gtk_tv.set_buffer(self._gtk_textbuffer)
- tag = Gtk.TextTag()
- tabs = Pango.TabArray(1, True)
- tabs.set_tab(0, Pango.TabAlign.LEFT, 28)
- tag.set_property('tabs', tabs)
- tag.set_property('tabs-set', True)
- self._gtk_tag = tag
- gtk_tb.get_tag_table().add(tag)
- GTextEditor.__init__(self, _gtk_outer = gtk_sw, _gtk_inner = gtk_tv,
- _gtk_focus = gtk_tv, **kwds)
- self.set_hscrolling('h' in scrolling)
- self.set_vscrolling('v' in scrolling)
- if 'h' not in scrolling:
- gtk_tv.set_wrap_mode(Gtk.WrapMode.WORD)
- self._gtk_apply_tag()
-
- def _gtk_get_sel_iters(self):
- gtk_textbuffer = self._gtk_textbuffer
- sel_iters = gtk_textbuffer.get_selection_bounds()
- if not sel_iters:
- insert_mark = gtk_textbuffer.get_insert()
- insert_iter = gtk_textbuffer.get_iter_at_mark(insert_mark)
- sel_iters = (insert_iter, insert_iter)
- return sel_iters
-
- def _gtk_apply_tag(self):
- tb = self._gtk_textbuffer
- tb.apply_tag(self._gtk_tag, tb.get_start_iter(), tb.get_end_iter())
-
- def get_selection(self):
- tb = self._gtk_textbuffer
- bounds = tb.get_selection_bounds()
- if bounds:
- return (bounds[0].get_offset(), bounds[1].get_offset())
- else:
- i = tb.get_property('cursor-position')
- return (i, i)
-
- def set_selection(self, value):
- tb = self._gtk_textbuffer
- start = tb.get_iter_at_offset(value[0])
- end = tb.get_iter_at_offset(value[1])
- tb.select_range(start, end)
-
- def get_text(self):
- tb = self._gtk_textbuffer
- start = tb.get_start_iter()
- end = tb.get_end_iter()
- return tb.get_slice(start, end)
-
- def set_text(self, text):
- self._gtk_textbuffer.set_text(text)
- self._gtk_apply_tag()
-
- def get_text_length(self):
- return self._gtk_textbuffer.get_end_iter().get_offset()
-
- def get_font(self):
- font = self._font
- if not font:
- font = Font._from_pango_description(self._gtk_inner_widget.style.font_desc)
- return font
-
- def set_font(self, f):
- self._font = f
- tv = self._gtk_inner_widget
- tv.modify_font(f._pango_description)
-
- def get_tab_spacing(self):
- tabs = self._gtk_tag.get_property('tabs')
- return tabs.get_tab(0)[1]
-
- def set_tab_spacing(self, x):
- tabs = Pango.TabArray(1, True)
- tabs.set_tab(0, Pango.TabAlign.LEFT, x)
- self._gtk_tag.set_property('tabs', tabs)
-
- def cut_cmd(self):
- self.copy_cmd()
- self.clear_cmd()
-
- def copy_cmd(self):
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- text = gtk_textbuffer.get_text(start_iter, end_iter, 1)
- if text:
- application().set_clipboard(text)
-
- def paste_cmd(self):
- text = application().get_clipboard()
- self.clear_cmd()
- self._gtk_textbuffer.insert_at_cursor(text)
-
- def clear_cmd(self):
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- gtk_textbuffer.delete(start_iter, end_iter)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/TextFields.py b/PyGUI-2.5.3/GUI/GtkGI/TextFields.py
deleted file mode 100644
index 00c8035..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/TextFields.py
+++ /dev/null
@@ -1,209 +0,0 @@
-#-----------------------------------------------------------------------------
-#
-# Python GUI - Text fields - Gtk
-#
-#-----------------------------------------------------------------------------
-
-from gi.repository import Gtk, Gdk
-from GUI.Properties import overridable_property
-from GUI.Applications import application
-from GUI.StdFonts import application_font
-from GUI.GTextFields import TextField as GTextField
-from GUI.GtkUtils import GtkFixedSize, mix_in
-
-gtk_margins = (2, 2, 0, 2)
-gtk_border_size = 2
-gtk_white = Gdk.RGBA(1.0, 1.0, 1.0, 1.0)
-
-class TextField(GTextField):
-
- _pass_key_events_to_platform = True
-
- _multiline = 0
-
- def __init__(self, font = application_font, lines = 1,
- multiline = 0, password = 0, **kwds):
- self._multiline = multiline
- lm, tm, rm, bm = gtk_margins
- if multiline:
- gtk_textbuffer = Gtk.TextBuffer()
- gtk_textview = Gtk.TextView.new_with_buffer(gtk_textbuffer)
- gtk_textview.set_margin_left(lm)
- gtk_textview.set_margin_top(tm)
- gtk_textview.set_margin_right(rm)
- gtk_textview.set_margin_bottom(bm)
- gtk_box = Gtk.EventBox()
- gtk_box.add(gtk_textview)
- state = Gtk.StateFlags.NORMAL
- #bg = gtk_textview.get_style_context().get_background_color(state) # doesn't work
- #print "TextField: bg =", bg ###
- bg = gtk_white
- gtk_box.override_background_color(state, bg)
- gtk_outer = PyGUI_GtkFrame()
- gtk_outer.add(gtk_box)
-# gtk_alignment = Gtk.Alignment.new(0.5, 0.5, 1.0, 1.0)
-# gtk_alignment.set_padding(tm, bm, lm, rm)
-# gtk_alignment.add(gtk_textview)
-# gtk_box = Gtk.EventBox()
-# gtk_box.add(gtk_alignment)
-# gtk_box.modify_bg(Gtk.StateType.NORMAL,
-# gtk_textview.get_style().base[Gtk.StateType.NORMAL])
-# gtk_frame = Gtk.Frame()
-# gtk_frame.set_shadow_type(Gtk.ShadowType.IN)
-# gtk_frame.add(gtk_box)
- self._gtk_textbuffer = gtk_textbuffer
- gtk_text_widget = gtk_textview
-# gtk_outer = gtk_frame
- else:
- gtk_entry = Gtk.Entry()
- self._gtk_entry = gtk_entry
- gtk_text_widget = gtk_entry
- gtk_outer = gtk_entry
- self._font = font
- #gtk_text_widget.modify_font(font._pango_description)
- gtk_text_widget.override_font(font._pango_description)
- #border_size = gtk_outer.get_style().ythickness # not working
- #print "TextFields: border size =", border_size ###
- self._vertical_padding = tm + 2 * gtk_border_size + bm
- #line_height = font.text_size("X")[1]
- line_height = font.line_height
- height = self._vertical_padding + lines * line_height
- gtk_outer.set_size_request(-1, height)
- self._password = password
- if password:
- if not multiline:
- self._gtk_entry.set_visibility(0)
- else:
- raise ValueError("The password option is not supported for multiline"
- " TextFields on this platform")
- gtk_outer.show_all()
- GTextField.__init__(self,
- _gtk_outer = gtk_outer,
- _gtk_title = gtk_text_widget,
- _gtk_focus = gtk_text_widget,
- _gtk_input = gtk_text_widget,
- multiline = multiline, **kwds)
-
- def get_text(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start = gtk_textbuffer.get_start_iter()
- end = gtk_textbuffer.get_end_iter()
- return self._gtk_textbuffer.get_text(start, end, 1)
- else:
- return self._gtk_entry.get_text()
-
- def set_text(self, text):
- if self._multiline:
- self._gtk_textbuffer.set_text(text)
- else:
- self._gtk_entry.set_text(text)
-
- def get_selection(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- start = start_iter.get_offset()
- end = end_iter.get_offset()
- sel = (start, end)
- else:
- sel = self._gtk_get_sel_positions()
- return sel
-
- def _gtk_get_sel_iters(self):
- gtk_textbuffer = self._gtk_textbuffer
- sel_iters = gtk_textbuffer.get_selection_bounds()
- if not sel_iters:
- insert_mark = gtk_textbuffer.get_insert()
- insert_iter = gtk_textbuffer.get_iter_at_mark(insert_mark)
- sel_iters = (insert_iter, insert_iter)
- return sel_iters
-
- def _gtk_get_sel_positions(self):
- gtk_entry = self._gtk_entry
- sel = gtk_entry.get_selection_bounds()
- if not sel:
- pos = gtk_entry.get_position()
- sel = (pos, pos)
- return sel
-
- def _set_selection(self, start, end):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter = gtk_textbuffer.get_iter_at_offset(start)
- end_iter = gtk_textbuffer.get_iter_at_offset(end)
- gtk_textbuffer.select_range(start_iter, end_iter)
- else:
- self._gtk_entry.select_region(start, end)
-
- def set_selection(self, (start, end)):
- self._set_selection(start, end)
- self.become_target()
-
- def get_multiline(self):
- return self._multiline
-
- def get_password(self):
- return self._password
-
- def _select_all(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start = gtk_textbuffer.get_start_iter()
- end = gtk_textbuffer.get_end_iter()
- gtk_textbuffer.select_range(start, end)
- else:
- self._gtk_entry.select_region(0, -1)
-
- def select_all(self):
- self._select_all()
- self.become_target()
-
- def cut_cmd(self):
- self.copy_cmd()
- self.clear_cmd()
-
- def copy_cmd(self):
- if self._password:
- return
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- text = gtk_textbuffer.get_text(start_iter, end_iter, 1)
- else:
- start, end = self._gtk_get_sel_positions()
- text = self._gtk_entry.get_chars(start, end)
- if text:
- application().set_clipboard(text)
-
- def paste_cmd(self):
- text = application().get_clipboard()
- self.clear_cmd()
- if self._multiline:
- self._gtk_textbuffer.insert_at_cursor(text)
- else:
- gtk_entry = self._gtk_entry
- pos = gtk_entry.get_position()
- gtk_entry.insert_text(text, pos)
- gtk_entry.set_position(pos + len(text))
-
- def clear_cmd(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- gtk_textbuffer.delete(start_iter, end_iter)
- else:
- start, end = self._gtk_get_sel_positions()
- self._gtk_entry.delete_text(start, end)
-
- def _untargeted(self):
- self._set_selection(0, 0)
-
- def _tab_in(self):
- self._select_all()
- GTextField._tab_in(self)
-
-#-----------------------------------------------------------------------------
-
-class PyGUI_GtkFrame(Gtk.Frame):
- mix_in(GtkFixedSize)
diff --git a/PyGUI-2.5.3/GUI/GtkGI/ViewBases.py b/PyGUI-2.5.3/GUI/GtkGI/ViewBases.py
deleted file mode 100644
index 7c58c8b..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/ViewBases.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Python GUI - View Base - Gtk
-#
-
-from gi.repository import Gtk
-from GUI.GViewBases import ViewBase as GViewBase
-
-class ViewBase(GViewBase):
-
- def __init__(self, **kwds):
- GViewBase.__init__(self, **kwds)
- self._gtk_connect(self._gtk_inner_widget, 'realize', self._gtk_realize)
-
- def track_mouse(self):
- finished = 0
- while not finished:
- self._mouse_event = None
- while not self._mouse_event:
- Gtk.main_iteration()
- event = self._mouse_event
- if event.kind == 'mouse_up':
- finished = 1
- yield event
-
- def _cursor_changed(self):
- gtk_widget = self._gtk_inner_widget
- gdk_window = gtk_widget.get_window()
- if gdk_window:
- cursor = self._cursor
- if cursor:
- gdk_window.set_cursor(self._cursor._gtk_cursor)
- else:
- gdk_window.set_cursor(None)
-
- def _gtk_realize(self):
- self._cursor_changed()
-
- def _targeted(self):
- self.targeted()
-
- def _untargeted(self):
- self.untargeted()
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Views.py b/PyGUI-2.5.3/GUI/GtkGI/Views.py
deleted file mode 100644
index 36b1f6b..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Views.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - Views - Gtk
-#
-
-from GUI.GViews import View
diff --git a/PyGUI-2.5.3/GUI/GtkGI/Windows.py b/PyGUI-2.5.3/GUI/GtkGI/Windows.py
deleted file mode 100644
index 333bc96..0000000
--- a/PyGUI-2.5.3/GUI/GtkGI/Windows.py
+++ /dev/null
@@ -1,259 +0,0 @@
-#
-# Python GUI - Windows - Gtk version
-#
-
-import sys
-from gi.repository import Gtk
-from gi.repository import Gdk
-from GUI.GGeometry import sub_pt
-from GUI.Components import _gtk_find_component
-from GUI.Containers import Container
-from GUI.Applications import application
-from GUI.GWindows import Window as GWindow
-
-_default_width = 200
-_default_height = 200
-
-_modal_styles = ('modal_dialog', 'alert')
-_dialog_styles = ('nonmodal_dialog', 'modal_dialog', 'alert')
-
-class Window(GWindow):
-
- #_pass_key_events_to_platform = False
-
- _size = (_default_width, _default_height)
- _gtk_menubar = None
- _need_menubar_update = 0
- _target = None
-
- def __init__(self, style = 'standard', title = "New Window",
- movable = 1, closable = 1, hidable = None, resizable = 1,
- zoomable = 1, **kwds):
- self._all_menus = []
- modal = style in _modal_styles
- if hidable is None:
- hidable = not modal
- self._resizable = resizable
- gtk_win = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
- gtk_win.set_gravity(Gdk.Gravity.STATIC)
- gtk_win.set_decorated(movable or closable or hidable or zoomable)
- gtk_win.set_resizable(resizable)
- gtk_win.set_modal(style in _modal_styles)
- gtk_content = Gtk.Layout()
- gtk_content.show()
- if style in _dialog_styles:
- gtk_win.set_type_hint(Gdk.WindowTypeHint.DIALOG)
- gtk_win.add(gtk_content)
- else:
- self._gtk_create_menubar()
- gtk_box = Gtk.VBox()
- gtk_box.show()
- gtk_box.pack_start(self._gtk_menubar, 0, 0, 0)
- gtk_box.pack_end(gtk_content, 1, 1, 0)
- gtk_win.add(gtk_box)
- self._need_menubar_update = 1
- self._gtk_connect(gtk_win, 'configure-event', self._gtk_configure_event)
- self._gtk_connect(gtk_win, 'key-press-event', self._gtk_key_press_event)
- self._gtk_connect(gtk_win, 'delete-event', self._gtk_delete_event)
- #GtkInput.__init__(self, gtk_content)
- GWindow.__init__(self, _gtk_outer = gtk_win, _gtk_inner = gtk_content,
- _gtk_focus = gtk_content, _gtk_input = gtk_content,
- title = title, closable = closable)
- self.set_size((_default_width, _default_height))
- self.set(**kwds)
- self.become_target()
-
- def _gtk_create_menubar(self):
- gtk_menubar = Gtk.MenuBar()
- gtk_dummy_item = Gtk.MenuItem.new_with_label("")
- gtk_menubar.append(gtk_dummy_item)
- gtk_menubar.show_all()
- h = gtk_menubar.size_request().height
- gtk_menubar.set_size_request(-1, h)
- gtk_dummy_item.set_submenu(None)
- self._gtk_menubar = gtk_menubar
- self._gtk_connect(gtk_menubar, 'button-press-event',
- self._gtk_menubar_button_press_event)
-
- def destroy(self):
- self.hide()
- GWindow.destroy(self)
-
- def set_menus(self, x):
- GWindow.set_menus(self, x)
- self._need_menubar_update = 1
- if self.visible:
- self._gtk_update_menubar()
-
- def get_title(self):
- return self._gtk_outer_widget.get_title()
-
- def set_title(self, new_title):
- self._gtk_outer_widget.set_title(new_title)
-
- def set_position(self, v):
- self._position = v
- self._gtk_outer_widget.move(*v)
-
- def set_size(self, new_size):
- w, h = new_size
- if self._resizable:
- h += self._gtk_menubar_height()
- gtk_resize = self._gtk_outer_widget.resize
- else:
- gtk_resize = self._gtk_inner_widget.set_size_request
- gtk_resize(max(w, 1), max(h, 1))
- self._size = new_size
-
- def _gtk_configure_event(self, gtk_event):
- gtk_win = self._gtk_outer_widget
- self._position = gtk_win.get_position()
- #self._update_size(gtk_win.get_size())
- w, h = gtk_win.get_size()
- #w, h = self._gtk_inner_widget.get_size()
- #w, h = self._gtk_inner_widget.size_request()
- old_size = self._size
- new_size = (w, h - self._gtk_menubar_height())
- #new_size = (w, h)
- #print "Window._gtk_configure_event:", old_size, "->", new_size ###
- self._size = new_size
- if old_size <> new_size:
- self._resized(sub_pt(new_size, old_size))
-
- def get_visible(self):
- return self._gtk_outer_widget.get_property('visible')
-
- def set_visible(self, new_v):
- old_v = self.visible
- self._gtk_outer_widget.set_property('visible', new_v)
- if new_v and not old_v and self._need_menubar_update:
- self._gtk_update_menubar()
-
- def show(self):
- self.set_visible(1)
- self._gtk_outer_widget.present()
-
-# def key_down(self, event):
-# if event.char == '\t':
-# if event.shift:
-# self._tab_to_prev()
-# else:
-# self._tab_to_next()
-# else:
-# self.pass_to_next_handler('key_down', event)
-
- def get_target(self):
- target = _gtk_find_component(self._gtk_outer_widget.get_focus())
- return target or self
-
- def _screen_rect(self):
- w = Gdk.Screen.width()
- h = Gdk.Screen.height()
- return (0, 0, w, h)
-
- def _gtk_menubar_height(self):
- mb = self._gtk_menubar
- if mb:
- h = mb.size_request().height
- else:
- h = 0
- #print "Window._gtk_menubar_height -->", h ###
- return h
-
- def _gtk_delete_event(self, event):
- try:
- self.close_cmd()
- except:
- sys.excepthook(*sys.exc_info())
- return 1
-
- def _gtk_update_menubar(self):
- #
- # Update the contents of the menubar after either the application
- # menu list or this window's menu list has changed. We only add
- # the menu titles at this stage; the menus themselves are attached
- # during menu setup. We also attach the accel groups associated
- # with the new menus.
- #
- # Things would be simpler if we could attach the menus here,
- # but attempting to share menus between menubar items provokes
- # a warning from Gtk, even though it otherwise appears to work.
- #
- gtk_menubar = self._gtk_menubar
- gtk_window = self._gtk_outer_widget
- # Remove old accel groups
- for menu in self._all_menus:
- gtk_window.remove_accel_group(menu._gtk_accel_group)
- # Detach any existing menus and remove old menu titles
- if gtk_menubar:
- for gtk_menubar_item in gtk_menubar.get_children():
- gtk_menubar_item.set_submenu(None)
- gtk_menubar_item.destroy()
- # Install new menu list
- #all_menus = application().menus + self.menus
- all_menus = application()._effective_menus_for_window(self)
- self._all_menus = all_menus
- # Create new menu titles and attach accel groups
- for menu in all_menus:
- if gtk_menubar:
- gtk_menubar_item = Gtk.MenuItem.new_with_label(menu._title)
- gtk_menubar_item.show()
- gtk_menubar.append(gtk_menubar_item)
- gtk_window.add_accel_group(menu._gtk_accel_group)
- self._need_menubar_update = 0
-
- def _gtk_menubar_button_press_event(self, event):
- # A button press has occurred in the menu bar. Before pulling
- # down the menu, perform menu setup and attach the menus to
- # the menubar items.
- self._gtk_menu_setup()
- for (gtk_menubar_item, menu) in \
- zip(self._gtk_menubar.get_children(), self._all_menus):
- gtk_menu = menu._gtk_menu
- attached_widget = gtk_menu.get_attach_widget()
- if attached_widget and attached_widget is not gtk_menubar_item:
- attached_widget.remove_submenu()
- gtk_menubar_item.set_submenu(gtk_menu)
-
- def _gtk_key_press_event(self, gtk_event):
- # Intercept key presses with the Control key down and update
- # menus, in case this is a keyboard equivalent for a menu command.
- if gtk_event.get_state() & Gdk.ModifierType.CONTROL_MASK:
- #print "Window._gtk_key_press_event: doing menu setup"
- self._gtk_menu_setup()
- # It appears that GtkWindow caches accelerators, and updates
- # the cache in an idle task after accelerators change. This
- # would be too late for us, so we force it to be done now.
- self._gtk_outer_widget.emit("keys-changed")
- #print "Window._gtk_key_press_event: done menu setup"
-
- def _gtk_menu_setup(self):
- #print "Windows: enter _gtk_menu_setup" ###
- application()._perform_menu_setup(self._all_menus)
- #print "Windows: exit _gtk_menu_setup" ###
-
- def _default_key_event(self, event):
- self.pass_event_to_next_handler(event)
- if event._originator is self:
- event._not_handled = True
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
-
-_gtk_menubar_height = None
-
-def _gtk_find_menubar_height():
- global _gtk_menubar_height
- if _gtk_menubar_height is None:
- print "Windows: Finding menubar height"
- item = Gtk.MenuItem("X")
- bar = Gtk.MenuBar()
- bar.append(item)
- bar.show_all()
- w, h = bar.size_request()
- _gtk_menubar_height = h
- print "...done"
- return _gtk_menubar_height
-
-#_gtk_menubar_height = _gtk_find_menubar_height()
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/arrow.hot b/PyGUI-2.5.3/GUI/Resources/cursors/arrow.hot
deleted file mode 100644
index 8835c07..0000000
--- a/PyGUI-2.5.3/GUI/Resources/cursors/arrow.hot
+++ /dev/null
@@ -1 +0,0 @@
-4 4
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/arrow.tiff b/PyGUI-2.5.3/GUI/Resources/cursors/arrow.tiff
deleted file mode 100644
index 2232993..0000000
Binary files a/PyGUI-2.5.3/GUI/Resources/cursors/arrow.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/crosshair.hot b/PyGUI-2.5.3/GUI/Resources/cursors/crosshair.hot
deleted file mode 100644
index 11c8dd7..0000000
--- a/PyGUI-2.5.3/GUI/Resources/cursors/crosshair.hot
+++ /dev/null
@@ -1 +0,0 @@
-7 7
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/crosshair.tiff b/PyGUI-2.5.3/GUI/Resources/cursors/crosshair.tiff
deleted file mode 100644
index e15aa9d..0000000
Binary files a/PyGUI-2.5.3/GUI/Resources/cursors/crosshair.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/finger.hot b/PyGUI-2.5.3/GUI/Resources/cursors/finger.hot
deleted file mode 100644
index e846a7c..0000000
--- a/PyGUI-2.5.3/GUI/Resources/cursors/finger.hot
+++ /dev/null
@@ -1 +0,0 @@
-5 0
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/finger.tiff b/PyGUI-2.5.3/GUI/Resources/cursors/finger.tiff
deleted file mode 100644
index 55e059c..0000000
Binary files a/PyGUI-2.5.3/GUI/Resources/cursors/finger.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/fist.hot b/PyGUI-2.5.3/GUI/Resources/cursors/fist.hot
deleted file mode 100644
index 99ca153..0000000
--- a/PyGUI-2.5.3/GUI/Resources/cursors/fist.hot
+++ /dev/null
@@ -1 +0,0 @@
-8 8
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/fist.tiff b/PyGUI-2.5.3/GUI/Resources/cursors/fist.tiff
deleted file mode 100644
index 961b33d..0000000
Binary files a/PyGUI-2.5.3/GUI/Resources/cursors/fist.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/hand.hot b/PyGUI-2.5.3/GUI/Resources/cursors/hand.hot
deleted file mode 100644
index 99ca153..0000000
--- a/PyGUI-2.5.3/GUI/Resources/cursors/hand.hot
+++ /dev/null
@@ -1 +0,0 @@
-8 8
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/hand.tiff b/PyGUI-2.5.3/GUI/Resources/cursors/hand.tiff
deleted file mode 100644
index 2441917..0000000
Binary files a/PyGUI-2.5.3/GUI/Resources/cursors/hand.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/ibeam.hot b/PyGUI-2.5.3/GUI/Resources/cursors/ibeam.hot
deleted file mode 100644
index 1a99162..0000000
--- a/PyGUI-2.5.3/GUI/Resources/cursors/ibeam.hot
+++ /dev/null
@@ -1 +0,0 @@
-4 5
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/ibeam.tiff b/PyGUI-2.5.3/GUI/Resources/cursors/ibeam.tiff
deleted file mode 100644
index 70d7462..0000000
Binary files a/PyGUI-2.5.3/GUI/Resources/cursors/ibeam.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/poof.hot b/PyGUI-2.5.3/GUI/Resources/cursors/poof.hot
deleted file mode 100644
index b0597be..0000000
--- a/PyGUI-2.5.3/GUI/Resources/cursors/poof.hot
+++ /dev/null
@@ -1 +0,0 @@
-11 4
diff --git a/PyGUI-2.5.3/GUI/Resources/cursors/poof.tiff b/PyGUI-2.5.3/GUI/Resources/cursors/poof.tiff
deleted file mode 100644
index c8cc981..0000000
Binary files a/PyGUI-2.5.3/GUI/Resources/cursors/poof.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/GUI/ToDo/TODO.txt b/PyGUI-2.5.3/GUI/ToDo/TODO.txt
deleted file mode 100644
index 4dd15ed..0000000
--- a/PyGUI-2.5.3/GUI/ToDo/TODO.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-Fix TextView.selection_changed so that it only invalidates
-what is necessary.
-
-Check invalidation system and revamp if necessary to support
-regions.
diff --git a/PyGUI-2.5.3/GUI/ToDo/Tests/textview.py b/PyGUI-2.5.3/GUI/ToDo/Tests/textview.py
deleted file mode 100644
index 3a0d61a..0000000
--- a/PyGUI-2.5.3/GUI/ToDo/Tests/textview.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from GUI import Window, TextView, TextModel, Font, application
-from TestViews import TestView
-
-app = application()
-app.set_menus(app.std_menus())
-
-win = Window(width = 300, height = 200)
-text = TextModel()
-text.set_text("Hello\nWorld!")
-view = TextView(width = 300, height = 200, model = text)
-view.set_font(Font("Helvetica", 14, []))
-win.add(view)
-view.become_target()
-win.show()
-
-app.run()
diff --git a/PyGUI-2.5.3/GUI/ToDo/TextModels.py b/PyGUI-2.5.3/GUI/ToDo/TextModels.py
deleted file mode 100644
index f626e8f..0000000
--- a/PyGUI-2.5.3/GUI/ToDo/TextModels.py
+++ /dev/null
@@ -1,184 +0,0 @@
-#
-# TextModels
-#
-
-import string
-from array import array
-from Models import Model
-
-class TextModel(Model):
- """A TextModel is a Model holding a character string
- suitable for viewing and editing with a TextView."""
-
- _text = None
- _sel_start = (0, 0)
- _sel_end = (0, 0)
-
- #
- # The text is kept in a list of strings. There is an
- # implicit newline at the end of every string except the
- # last one. There is always at least one string in the
- # list; a completely empty text is represented by a
- # list containing one empty string.
- #
- # Positions in the text are represented by a tuple
- # (line, col), where line is the line number (0-based)
- # and col is the position within the line (0 to the
- # number of characters in the line).
- #
- # Pieces of text to be inserted or extracted are
- # represented as simple strings, with lines separated
- # by newlines.
- #
- # Views may be sent the messages:
- #
- # text_changed(start_pos, multiline)
- # where start_pos is the start of the affected text and
- # multiline is true if more than one line is affected.
- #
- # selection_changed(pos1, pos2)
- # where pos1 and pos2 are the extremes of the range
- # of text affected.
- #
-
- def __init__(self, *args, **kw):
- apply(Model.__init__, (self,)+args, kw)
- self._text = [""]
-
- def text(self):
- "Return the whole text as a string."
- return string.join(self._text, '\n')
-
- def set_text(self, s):
- "Replace the whole text with a string."
- return self.set_chars((0, 0), self.end(), s)
-
- def num_lines(self):
- "Return the number of lines."
- return len(self._text)
-
- def line(self, i):
- """Return the specified line as a string, without any trailing newline"""
- return self._text[i]
-
- def end(self):
- "Return the ending position of the text."
- lines = self._text
- return (len(lines) - 1, len(lines[-1]))
-
- def char(self, (line, col)):
- "Return the character at (line, col)."
- return self._text[line][col]
-
- def chars(self, (line1, col1), (line2, col2)):
- "Return the text between (line1, col1) and (line2, col2)."
- text = self._text
- if line1 == line2:
- return text[line1][col1:col2]
- else:
- a = text[line1][col1:]
- b = text[line1 + 1 : line2 - 1]
- c = text[line2][:col2]
- return string.joinfields([a] + b + [c], '\n')
-
-## def set_char(self, (line, col), c):
-## "Replace the character at (line, col)."
-## self._text[line][col] = c
-## self.notify_views('char_changed', (line, col))
-
- def set_chars(self, (line1, col1), (line2, col2), s):
- """Replace the text between (line1, col1) and (line2, col2).
- Returns the line and column of the new endpoint of the
- inserted text."""
- #print "TextModel.set_chars", (line1, col1), (line2, col2), repr(s) ###
- text = self._text
- #print "...old text =", repr(text) ###
-
- # Step 1: Delete old text
- if line1 == line2:
- line = text[line1]
- text[line1] = line[:col1] + line[col2:]
- else:
- text[line1 : line2 + 1] = [text[line1][:col1] + text[line2][col2:]]
- #a = text[line1][:col1]
- #b = text[line2][col2:]
- #text[line1 : line2 + 1] = [a + b]
-
- # Step 2: Insert new text
- ss = string.splitfields(s, '\n')
- line = text[line1]
- if len(ss) == 1:
- text[line1] = line[:col1] + ss[0] + line[col1:]
- else:
- text[line1 : line1 + 1] = (
- [line[:col1] + ss[0]] +
- ss[1:-1] +
- [ss[-1] + line[col1:]])
-
- # Step 3: Calculate new endpoint
- #print "...ss =", repr(ss) ###
- if len(ss) == 1:
- line3 = line1
- col3 = col1 + len(s)
- else:
- line3 = line1 + len(ss) - 1
- col3 = len(ss[-1])
- new_end = (line3, col3)
- #print "...new_end =", new_end
- #print "...new text:", self._text
- multiline = line2 <> line1 and line3 <> line1
- self.notify_views('text_changed', (line1, col1), multiline)
- self.set_selection(self._sel_start,
- self.min_pos(self._sel_end, new_end))
- return new_end
-
- def selection(self):
- "Return the endpoints of the current selection."
- return (self._sel_start, self._sel_end)
-
- def set_selection(self, new_start, new_end):
- "Set the endpoints of the current selection."
- new_start, new_end = self.normalise_range(new_start, new_end)
- old_start = self._sel_start
- old_end = self._sel_end
- if old_start <> new_start or old_end <> new_end:
- self._sel_start = new_start
- self._sel_end = new_end
- self.notify_views('selection_changed',
- self.min_pos(old_start, new_start),
- self.max_pos(old_end, new_end))
-
- def replace_selection(self, new_text):
- "Replace the selected text with the given string."
- new_end = self.set_chars(self._sel_start, self._sel_end, new_text)
- self.set_selection(self._sel_start, new_end)
- #print "TextModels.replace_selection: selection =", ( ###
- # self._sel_start, self._sel_end) ###
-
- def max_line_length(self):
- "Return the number of characters in the longest line."
- return max(map(len, self._text))
-
- #
- # Internal
- #
-
- def min_pos(self, pos1, pos2):
- line1, col1 = pos1
- line2, col2 = pos2
- if line1 < line2 or (line1 == line2 and col1 < col2):
- return pos1
- else:
- return pos2
-
- def max_pos(self, pos1, pos2):
- line1, col1 = pos1
- line2, col2 = pos2
- if line1 > line2 or (line1 == line2 and col1 > col2):
- return pos1
- else:
- return pos2
-
- def normalise_range(self, pos1, pos2):
- "Order two positions so that pos1 <= pos2."
- return self.min_pos(pos1, pos2), self.max_pos(pos1, pos2)
diff --git a/PyGUI-2.5.3/GUI/ToDo/TextViews.py b/PyGUI-2.5.3/GUI/ToDo/TextViews.py
deleted file mode 100644
index 4a46b7e..0000000
--- a/PyGUI-2.5.3/GUI/ToDo/TextViews.py
+++ /dev/null
@@ -1,373 +0,0 @@
-#
-# TextViews
-#
-
-from math import floor
-from Views import View
-from Colors import Color
-from Fonts import application_font
-from Applications import application
-
-class TextView(View):
- """A TextView provides an editable view of
- a TextModel."""
-
- _fg = Color(0, 0, 0)
- _bg = Color(1, 1, 1)
- _font = application_font()
- _line_height = _font.height()
- _ascent = _font.ascent()
- _left_margin = 5
- _right_margin = 5
- _top_margin = 5
- _bottom_margin = 5
- _caret_on = 1
- _caret_rect = None
-
- def __init__(self, *args, **kw):
- apply(View.__init__, (self,) + args, kw)
- self.update_caret_rect()
-
- #
- # Properties
- #
-
- def font(self):
- "Return the font property."
- return self._font
-
- def set_font(self, f):
- "Set the font property."
- self._font = f
- self._line_height = f.height()
- self._ascent = f.ascent()
- self.update_extent()
- self.update_caret_rect()
-
- def margins(self):
- "Return the text margins."
- return (self._left_margin, self._top_margin,
- self._right_margin, self._bottom_margin)
-
- def set_margins(self, l, t, r, b):
- "Set the text margins."
- self._left_margin = l
- self._top_margin = t
- self._right_margin = r
- self._bottom_margin = b
- self.update_extent()
- self.update_caret_rect()
- self.invalidate()
-
- #
- # Callbacks
- #
-
- def draw(self, c):
- debug = 0
- if debug:
- print "TextView.draw:" ###
- text = self.model()
- sel_start, sel_end = text.selection()
- sel_start_line, sel_start_col = sel_start
- sel_end_line, sel_end_col = sel_end
- text_end_line, text_end_col = text.end()
-## if sel_start == sel_end and self._caret_on:
-## caret_line = sel_start_line
-## else:
-## caret_line = None
- (minx, miny), (maxx, maxy) = self.viewed_rect()
- min_line = max(self.y_to_line(miny), 0)
- max_line = min(self.y_to_line(maxy) + 1, text_end_line)
- fg = self._fg
- bg = self._bg
- c.set_font(self._font)
- #ext_right = self.extent_right()
- #ext_bottom = self.extent_bottom()
- #hilite_right_edge = self.viewed_rect()[1][0]
- right, bottom = self.viewed_rect()[1]
- top_margin = self._top_margin
- left_margin = self._left_margin
- bottom_margin = self._bottom_margin
- line_height = self._line_height
- ascent = self._ascent
- if debug:
- print "...min_line =", min_line
- print "...max_line =", max_line
-## print "...caret_line =", caret_line
- print "...line_height =", line_height
- # Erase top and left margin area
- c.set_forecolor(bg)
- c.fill_rect(((0, 0), (right, top_margin)))
- c.fill_rect(((0, top_margin), (left_margin, bottom)))
- # Draw relevant lines
- y = top_margin
- for line in xrange(min_line, max_line + 1):
- if debug:
- print "...drawing line", line
- chars = text.line(line)
- line_end_col = len(chars)
- if line == sel_start_line:
- hilite_start_col = sel_start_col
- elif line > sel_start_line:
- hilite_start_col = 0
- else:
- hilite_start_col = line_end_col
- if line == sel_end_line:
- hilite_end_col = sel_end_col
- elif line < sel_end_line:
- hilite_end_col = line_end_col
- else:
- hilite_end_col = 0
- hilite_to_eol = line >= sel_start_line and line < sel_end_line
- if debug:
- print "......hilite_start_col =", hilite_start_col ###
- print "......hilite_end_col =", hilite_end_col ###
- print "......line_end_col =", line_end_col ###
- x = left_margin
- #base = y + ascent
- # Draw chars before hilite
- if hilite_start_col > 0:
- x = self.draw_chars(
- c, chars, x, y, 0, hilite_start_col, fg, bg)
-## if line == caret_line:
-## caret_x = x
-## if debug:
-## print "......caret_x =", caret_x
- # Draw hilited chars
- if hilite_start_col < hilite_end_col:
- x = self.draw_chars(
- c, chars, x, y, hilite_start_col, hilite_end_col, bg, fg)
- # Draw chars after hilite
- if hilite_end_col < line_end_col:
- x = self.draw_chars(
- c, chars, x, y, hilite_end_col, line_end_col, fg, bg)
-## # Draw caret
-## if line == caret_line:
-## if debug:
-## print "......drawing caret at", (caret_x, y)
-## c.set_forecolor(fg)
-## c.fill_rect(((caret_x, y), (caret_x + 1, y + line_height)))
- # Erase to end of line
- if x < right:
- if hilite_to_eol:
- c.set_forecolor(fg)
- else:
- c.set_forecolor(bg)
- r = ((x, y), (right, y + line_height))
- if debug:
- print "...erasing", r ###
- c.fill_rect(r)
- y = y + line_height
- # Erase to bottom of extent
- c.fill_rect(((0, y), (right, bottom)))
- # Draw caret
- if self._caret_on:
- r = self._caret_rect
- if r:
- c.set_forecolor(fg)
- c.fill_rect(r)
-
- def draw_chars(self, c, line, x, y, start_col, end_col, fg, bg):
- debug = 0
- if debug:
- print ".........TextView.draw_chars:", \
- repr(line), "at", (x, y), "col", start_col, "to", end_col ###
- print "............using", fg, "on", bg ###
- chars = line[start_col:end_col]
- w = self._font.width(chars)
- c.set_forecolor(bg)
- c.fill_rect(((x, y), (x + w, y + self._line_height)))
- c.set_forecolor(fg)
- c.set_backcolor(bg)
- c.moveto(x, y + self._ascent)
- c.show(chars)
- return x + w
-
-
- def line_to_y(self, line):
- return self._top_margin + line * self._line_height
-
- def col_to_x(self, line, col):
- return self._left_margin + self._font.width(self.model().line(line)[:col])
-
- def y_to_line(self, y):
- #print "TextView.y_to_line:", y
- #print "...self._top_margin =", self._top_margin
- #print "...self._line_height =", self._line_height
- return int((y - self._top_margin) / self._line_height)
-
- def x_to_col(self, line, x):
- chars = self.model().line(line)
- if chars is not None:
- return self._font.x_to_pos(chars, x - self._left_margin)
- else:
- return 0
-
- def pt_to_pos(self, (x, y)):
- text = self.model()
- line = self.y_to_line(y)
- if line < 0:
- return (0, 0)
- elif line < text.num_lines():
- col = self.x_to_col(line, x)
- return (line, col)
- else:
- return text.end()
-
- def selection_changed(self, (line1, col1), (line2, col2)):
- top = self.line_to_y(line1)
- if line1 == line2:
- left = self.col_to_x(line1, col1)
- right = self.col_to_x(line1, col2)
- bottom = top + self._line_height
- else:
- left = self.extent_left()
- right = self.extent_right()
- bottom = self.line_to_y(line2 + 1)
- self.invalidate_rect(((left, top), (right, bottom)))
- self.update_caret_rect()
-
- def text_changed(self, (line, col), multiline):
- self.update_extent()
- top = self.line_to_y(line)
- right = self.extent_right()
- if not multiline:
- left = self.col_to_x(line, col)
- bottom = top + self._line_height
- else:
- left = self.extent_left()
- bottom = self.viewed_rect()[1][1]
- if top < bottom:
- self.invalidate_rect(((left, top), (right, bottom)))
-
- def click(self, e):
- text = self.model()
- pos1 = self.pt_to_pos(e.where())
- #print "TextView.click: pos1=", pos1
- text.set_selection(pos1, pos1)
- while self.track_mouse():
- pos2 = self.pt_to_pos(self.get_mouse().where())
- #print "TextView.click: pos2=", pos2
- text.set_selection(pos1, pos2)
-
- def key(self, e):
- c = e.char
- if c == '\b' or c == '\177':
- self.backspace()
- else:
- if c == '\r':
- c = '\n'
- self.insert(c)
-
- def update_extent(self):
- text = self.model()
- max_line, _ = text.end()
- width = text.max_line_length() * self._font.width("m")
- height = (max_line + 1) * self._line_height
- self.set_extent(
- ((0, 0), (self._left_margin + width + self._right_margin,
- self._top_margin + height + self._bottom_margin)))
-
- #
- # Caret
- #
-
- def blink(self):
- #print "TextView.blink" ###
- self.set_caret(not self._caret_on)
-
- def set_caret(self, on):
- # print "TextView.set_caret:", on ###
- self._caret_on = on
- r = self._caret_rect
- if r:
- #print "...invalidating", r ###
- self.invalidate_rect(r)
-
- def update_caret_rect(self):
- old_r = self._caret_rect
- text = self.model()
- sel_start, sel_end = text.selection()
- if sel_start == sel_end:
- line, col = sel_start
- #print "TextView.update_caret_rect:" ###
- #print "...line =", line ###
- #print "...line_height =", self._line_height ###
- y = self.line_to_y(line)
- x = self.col_to_x(line, col)
- new_r = ((x - 1, y), (x, y + self._line_height))
- else:
- new_r = None
- if old_r <> new_r:
- if old_r:
- self.invalidate_rect(old_r)
- if new_r:
- self.invalidate_rect(new_r)
- self._caret_rect = new_r
- self.set_caret(1)
- self.reset_blink()
-
- #
- # Menu commands
- #
-
- def setup_menus(self, m):
- text = self.model()
- start, end = text.selection()
- if start <> end:
- m.enable('cut_cmd')
- m.enable('copy_cmd')
- m.enable('clear_cmd')
- if application().clipboard():
- m.enable('paste_cmd')
- View.setup_menus(self, m)
-
- def cut_cmd(self):
- self.copy_cmd()
- self.clear_cmd()
-
- def copy_cmd(self):
- text = self.model()
- start, end = text.selection()
- chars = text.chars(start, end)
- #print "TextView.copy_cmd: chars =", repr(chars) ###
- application().set_clipboard(chars)
-
- def paste_cmd(self):
- self.insert(str(application().clipboard()))
-
- def clear_cmd(self):
- self.insert("")
-
- #
- # Text modification
- #
-
- def insert(self, chars):
- """Replace selection with the given chars and position insertion
- point just after the inserted chars."""
- text = self.model()
- text.replace_selection(chars)
- _, end = text.selection()
- text.set_selection(end, end)
-
- def backspace(self):
- """Delete the selection, or if the selection is empty, delete
- the character just before the selection, if any."""
- text = self.model()
- start, end = text.selection()
- if start == end:
- if start <> (0, 0):
- line, col = start
- if col > 0:
- col = col - 1
- else:
- line = line - 1
- col = len(text.line(line))
- start = (line, col)
- text.set_chars(start, end, "")
- text.set_selection(start, start)
- else:
- self.clear_cmd()
-
diff --git a/PyGUI-2.5.3/GUI/Version.py b/PyGUI-2.5.3/GUI/Version.py
deleted file mode 100644
index 326513e..0000000
--- a/PyGUI-2.5.3/GUI/Version.py
+++ /dev/null
@@ -1 +0,0 @@
-version = '2.5.3'
diff --git a/PyGUI-2.5.3/GUI/Win32/AlertClasses.py b/PyGUI-2.5.3/GUI/Win32/AlertClasses.py
deleted file mode 100644
index 6157c34..0000000
--- a/PyGUI-2.5.3/GUI/Win32/AlertClasses.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Alert - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI.GAlertClasses import Alert, Alert2, Alert3
diff --git a/PyGUI-2.5.3/GUI/Win32/Application.py b/PyGUI-2.5.3/GUI/Win32/Application.py
deleted file mode 100755
index 3acd317..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Application.py
+++ /dev/null
@@ -1,115 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Application - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32clipboard as wcb, win32api as api, \
- win32gui as gui, win32process as wp
-from GUI import export
-from GUI import Component, Window, WinUtils
-from GUI.GApplications import Application as GApplication
-
-class Application(GApplication):
-
- def __init__(self, *args, **kwds):
- self._win_recycle_list = []
- self._win_app = ui.GetApp()
- self._win_app.AttachObject(self)
- self._win_app.SetMainFrame(WinUtils.win_none)
- GApplication.__init__(self, *args, **kwds)
-
- def set_menus(self, x):
- #print "Application.set_menus" ###
- GApplication.set_menus(self, x)
- for window in self.windows:
- window._win_menus_changed()
-
- def _event_loop(self, window):
- if window:
- window._begin_modal()
- try:
- self._win_app.Run()
- finally:
- if window:
- window._end_modal()
-
- def _exit_event_loop(self):
- api.PostQuitMessage(0)
-
- def zero_windows_allowed(self):
- return False
-
- def get_target(self):
- try:
- win = ui.GetFocus()
- except ui.error:
- win = None
- if isinstance(win, Component):
- return win
- else:
- return self
-
- def get_target_window(self):
- win = ui.GetActiveWindow()
- if isinstance(win, Window):
- return win
-
- def OnIdle(self, n):
- #print "Application.OnIdle" ###
- trash = self._win_recycle_list
- while trash:
- trash.pop().DestroyWindow()
- self._win_idle()
- return 0
-
- def _win_idle(self):
- self._check_for_no_windows()
-
- def _check_for_no_windows(self):
- #print "Application._check_for_no_windows" ###
- apid = wp.GetCurrentProcessId()
- #print "... apid =", apid ###
- htop = gui.GetDesktopWindow()
- hwin = gui.GetWindow(htop, wc.GW_CHILD)
- while hwin:
- wpid = wp.GetWindowThreadProcessId(hwin)[1]
- if wpid == apid:
- #print "... hwin", hwin ###
- if gui.GetWindowLong(hwin, wc.GWL_STYLE) & wc.WS_VISIBLE:
- #print "...... is visible" ###
- return
- hwin = gui.GetWindow(hwin, wc.GW_HWNDNEXT)
- #print "... none visible" ###
- self.no_visible_windows()
-
-# def PreTranslateMessage(self, msg):
-# print "Application.PreTranslateMessage:", msg ###
-
- def _win_recycle(self, win):
- # It's not safe to destroy a window inside code called from its
- # own OnCommand handler, so we use this method to delay it until
- # a better time.
- self._win_recycle_list.append(win)
-
- def query_clipboard(self):
- wcb.OpenClipboard()
- result = wcb.IsClipboardFormatAvailable(wc.CF_TEXT)
- wcb.CloseClipboard()
- return result
-
- def get_clipboard(self):
- wcb.OpenClipboard()
- try:
- result = wcb.GetClipboardData()
- except TypeError:
- result = None
- wcb.CloseClipboard()
- return result
-
- def set_clipboard(self, x):
- wcb.OpenClipboard()
- wcb.SetClipboardData(wc.CF_TEXT, x)
- wcb.CloseClipboard()
-
-export(Application)
diff --git a/PyGUI-2.5.3/GUI/Win32/BaseAlert.py b/PyGUI-2.5.3/GUI/Win32/BaseAlert.py
deleted file mode 100644
index aa59b41..0000000
--- a/PyGUI-2.5.3/GUI/Win32/BaseAlert.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - BaseAlert - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32gui as gui, win32api as api
-from GUI import export
-from GUI import application
-from GUI.WinUtils import win_bg_color
-from GUI import View
-from GUI.GBaseAlerts import BaseAlert as GBaseAlert
-
-win_icon_ids = {
- 'stop': wc.IDI_HAND,
- 'caution': wc.IDI_EXCLAMATION,
- 'note': wc.IDI_ASTERISK,
- 'query': wc.IDI_QUESTION,
-}
-
-win_icon_size = (
- api.GetSystemMetrics(wc.SM_CXICON),
- api.GetSystemMetrics(wc.SM_CYICON)
-)
-
-def win_load_icon(id):
- return gui.LoadIcon(0, id)
-
-class AlertIcon(View):
-
- _win_transparent = True
-
- def __init__(self, id, **kwds):
- View.__init__(self, size = win_icon_size, **kwds)
- #hwnd = self._win.GetSafeHwnd()
- self.win_icon = win_load_icon(id)
-
- def draw(self, c, r):
- gfx = c._win_graphics
- hdc = gfx.GetHDC()
- gui.DrawIcon(hdc, 0, 0, self.win_icon)
- gfx.ReleaseHDC(hdc)
-
-# def draw(self, c, r):
-# dc = c._win_dc
-# dc.DrawIcon((0, 0), self.win_icon)
-
-class BaseAlert(GBaseAlert):
-
- _win_icon = None
-
- def _layout_icon(self, kind):
- id = win_icon_ids.get(kind)
- if id:
- icon = AlertIcon(id, position = (self._left_margin, self._top_margin))
- self.add(icon)
- return icon.size
- else:
- return (0, 0)
-
-export(BaseAlert)
diff --git a/PyGUI-2.5.3/GUI/Win32/BaseFileDialogs.py b/PyGUI-2.5.3/GUI/Win32/BaseFileDialogs.py
deleted file mode 100644
index 8bfcb90..0000000
--- a/PyGUI-2.5.3/GUI/Win32/BaseFileDialogs.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - File Dialogs - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32api as api
-from GUI.Files import FileRef, DirRef
-
-win_ofn_flags = wc.OFN_FILEMUSTEXIST | wc.OFN_PATHMUSTEXIST | wc.OFN_HIDEREADONLY \
- | wc.OFN_NOCHANGEDIR | wc.OFN_OVERWRITEPROMPT
-
-def win_filter(file_types):
- filters = []
- if file_types:
- for ftype in file_types:
- suffix = ftype.suffix
- if suffix:
- pattern = "*.%s" % suffix
- filters.append("%s (%s)|%s" % (ftype.name, pattern, pattern))
- return "|".join(filters) + "||"
-
-def win_fix_prompt(prompt):
- for s in ("as:", ":"):
- if prompt.lower().endswith(s):
- prompt = prompt[:-len(s)]
- return prompt.strip()
-
-def win_set_prompt(dlog, prompt):
- dlog.SetOFNTitle(win_fix_prompt(prompt))
-
-def fileref(path, file_type = None):
- if file_type:
- suffix = file_type.suffix
- if suffix:
- ext = "." + suffix
- if not path.endswith(suffix):
- path += ext
- return FileRef(path = path)
-
-def _request_old_file(prompt, default_dir, file_types, multiple):
- flags = win_ofn_flags
- if multiple:
- flags |= wc.OFN_ALLOWMULTISELECT
- filter = win_filter(file_types)
- dlog = ui.CreateFileDialog(True, None, None, flags, filter)
- win_set_prompt(dlog, prompt)
- if default_dir:
- dlog.SetOFNInitialDir(default_dir.path)
- code = dlog.DoModal()
- if code == 1: # IDOK
- if multiple:
- return map(fileref, dlog.GetPathNames())
- else:
- return fileref(dlog.GetPathName())
-
-def _request_old_dir(prompt, default_dir):
- from win32com.shell import shell as sh
- import win32com.shell.shellcon as sc
- win_bif_flags = sc.BIF_RETURNONLYFSDIRS # | sc.BIF_EDITBOX | wc.BIF_VALIDATE
- if default_dir:
- def callback(hwnd, msg, lp, data):
- if msg == sc.BFFM_INITIALIZED:
- api.SendMessage(hwnd, sc.BFFM_SETSELECTION, True, default_dir.path)
- else:
- callback = None
- (idl, name, images) = sh.SHBrowseForFolder(None, None,
- win_fix_prompt(prompt), win_bif_flags, callback)
- if idl:
- return DirRef(sh.SHGetPathFromIDList(idl))
-
-def _request_old_dirs(prompt, default_dir):
- raise NotImplementedError("Requesting multiple directories")
-
-def _request_old(prompt, default_dir, file_types, dir, multiple):
- if dir:
- if multiple:
- return _request_old_dirs(prompt, default_dir)
- else:
- return _request_old_dir(prompt, default_dir)
- else:
- return _request_old_file(prompt, default_dir, file_types, multiple)
-
-def _request_new(prompt, default_dir, default_name, file_type, dir):
- if file_type:
- filter = win_filter([file_type])
- else:
- filter = "" # None
- dlog = ui.CreateFileDialog(False, None, default_name, win_ofn_flags, filter)
- win_set_prompt(dlog, prompt)
- if default_dir:
- dlog.SetOFNInitialDir(default_dir.path)
- code = dlog.DoModal()
- if code == 1: # IDOK
- return fileref(dlog.GetPathName(), file_type)
diff --git a/PyGUI-2.5.3/GUI/Win32/Button.py b/PyGUI-2.5.3/GUI/Win32/Button.py
deleted file mode 100644
index b5ebef0..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Button.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Button - Win32
-#
-#--------------------------------------------------------------------
-
-from time import sleep
-import win32con as wc, win32ui as ui, win32gui as gui
-from GUI import export
-from GUI.ButtonBases import ButtonBase
-from GUI.GButtons import Button as GButton
-
-win_hpad = 40
-
-win_style_map = {
- 'normal': wc.BS_PUSHBUTTON,
- 'default': wc.BS_DEFPUSHBUTTON,
- 'cancel': wc.BS_PUSHBUTTON,
-}
-
-def win_style(style):
- try:
- return win_style_map[style]
- except KeyError:
- raise ValueError("Invalid Button style %r" % style)
-
-#--------------------------------------------------------------------
-
-class Button(ButtonBase, GButton):
-
- _vertical_padding = 10
-
- _color = None
-
- def __init__(self, title = "New Button", **kwds):
- font = self._win_predict_font(kwds)
- style = kwds.pop('style', 'normal')
- self._style = style
- w = font.width(title) + win_hpad
- h = self._calc_height(font)
- win = self._win_create_button(title, win_style(style), w, h)
- GButton.__init__(self, _win = win, **kwds)
-
- def get_style(self):
- return self._style
-
- def set_style(self, x):
- self._style = x
- self._win.SetButtonStyle(win_style(x))
-
- def flash(self):
- win = self._win
- win.SetState(True)
- sleep(0.05)
- win.SetState(False)
-
- def _win_bn_clicked(self):
- self.do_action()
-
- def _win_activate(self):
- self.do_action()
-
-export(Button)
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Win32/ButtonBases.py b/PyGUI-2.5.3/GUI/Win32/ButtonBases.py
deleted file mode 100644
index 579899f..0000000
--- a/PyGUI-2.5.3/GUI/Win32/ButtonBases.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Button base - Win32
-#
-#--------------------------------------------------------------------
-
-class ButtonBase(object):
-
- def key_down(self, event):
- if not event.auto:
- c = event.char
- if c == ' ' or c == '\r':
- self._win.SetState(True)
- else:
- GControl.key_down(self, event)
-
- def key_up(self, event):
- c = event.char
- if c == ' ' or c == '\r':
- if self._win.GetState() & 4:
- self._win.SetState(False)
- self._win_activate()
- else:
- GControl.key_down(self, event)
-
diff --git a/PyGUI-2.5.3/GUI/Win32/Canvas.py b/PyGUI-2.5.3/GUI/Win32/Canvas.py
deleted file mode 100644
index ecdba0b..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Canvas.py
+++ /dev/null
@@ -1,336 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Canvas - Win32
-#
-#--------------------------------------------------------------------
-
-from math import sin, cos, pi
-import win32con as wc, win32ui as ui, win32gui as gui
-from win32con import PS_SOLID, BS_SOLID, RGN_AND
-#from win32ui import CreatePen, CreateBrush
-#from win32gui import CloseFigure, PathToRegion, AngleArc
-from GUI import export
-import GUI.GDIPlus as gdip
-from GUI.StdColors import black, white
-from GUI.StdFonts import application_font
-from GUI.WinUtils import win_null_brush
-from GUI.GCanvases import Canvas as GCanvas
-
-deg = pi / 180
-
-def ir(x, i = int, r = round):
- return i(r(x))
-
-def irr(rect, ir = ir):
- l, t, r, b = rect
- return (ir(l), ir(t), ir(r), ir(b))
-
-#--------------------------------------------------------------------
-
-class GState(object):
-
- pencolor = black
- fillcolor = black
- textcolor = black
- backcolor = white
- pensize = 1
- font = application_font
-
- win_pen = gdip.Pen(pencolor._win_argb, 1)
- win_fill_brush = gdip.SolidBrush(fillcolor._win_argb)
- win_text_brush = gdip.SolidBrush(textcolor._win_argb)
- win_bg_brush = gdip.SolidBrush(backcolor._win_argb)
-
- def __init__(self, clone = None):
- if clone:
- self.__dict__.update(clone.__dict__)
-
-#--------------------------------------------------------------------
-
-class Canvas(GCanvas):
-
- _current_point = None
-
-# def __init__(self, win_graphics, dc = None):
-# if not dc:
-# print "Canvas.__init__: before get dc: clip bounds =", win_graphics.GetClipBounds() ###
-# dc = ui.CreateDCFromHandle(win_graphics.GetHDC())
-# print "Canvas.__init__: after get dc: clip bounds =", win_graphics.GetClipBounds() ###
-# dc.SetBkMode(wc.TRANSPARENT)
-# dc.SetTextAlign(wc.TA_LEFT | wc.TA_BASELINE | wc.TA_UPDATECP)
-# print "Canvas.__init__: clip bounds =", win_graphics.GetClipBounds() ###
-# self._win_graphics = win_graphics
-# self._win_dc = dc
-# self._win_hdc = dc.GetHandleOutput()
-# self._win_path = gdip.GraphicsPath()
-# self._state = GState()
-# self._stack = []
-
- def __init__(self, win_graphics, for_printing = False):
- self._win_graphics = win_graphics
- self._win_path = gdip.GraphicsPath()
- self._state = GState()
- self._stack = []
- if for_printing:
- unit = gdip.UnitPoint
- win_graphics.SetPageUnit(unit)
- #else:
- # unit = gdip.UnitPixel
-
-# dpix = win_graphics.GetDpiX()
-# dpiy = win_graphics.GetDpiY()
-# print "Canvas: dpi =", dpix, dpiy ###
-# win_graphics.SetPageUnit(gdip.UnitPoint)
-# if not for_printing:
-# sx = 72.0 / dpix
-# sy = 72.0 / dpiy
-# self.scale(sx, sy)
-
- def _from_win_dc(cls, dc):
- return cls._from_win_hdc(dc.GetSafeHdc())
-
- _from_win_dc = classmethod(_from_win_dc)
-
- def _from_win_hdc(cls, hdc, **kwds):
- win_graphics = gdip.Graphics.from_hdc(hdc)
- return cls(win_graphics, **kwds)
-
- _from_win_hdc = classmethod(_from_win_hdc)
-
- def _from_win_image(cls, win_image):
- win_graphics = gdip.Graphics.from_image(win_image)
- #print "Canvas._from_win_image: win_graphics =", win_graphics ###
- #print "... clip bounds =", win_graphics.GetClipBounds() ###
- return cls(win_graphics)
-
- _from_win_image = classmethod(_from_win_image)
-
- def get_pencolor(self):
- return self._state.pencolor
-
- def set_pencolor(self, c):
- state = self._state
- state.pencolor = c
- state.win_pen = gdip.Pen(c._win_argb, state.pensize)
-
- def get_fillcolor(self):
- return self._state.fillcolor
-
- def set_fillcolor(self, c):
- state = self._state
- state.fillcolor = c
- state.win_fill_brush = gdip.SolidBrush(c._win_argb)
-
- def get_textcolor(self):
- return self._state.textcolor
-
- def set_textcolor(self, c):
- state = self._state
- state.textcolor = c
- state.win_text_brush = gdip.SolidBrush(c._win_argb)
-
- def get_backcolor(self):
- return self._state.backcolor
-
- def set_backcolor(self, c):
- state = self._state
- state.backcolor = c
- state.win_bg_brush = gdip.SolidBrush(c._win_argb)
-
- def get_pensize(self):
- return self._state.pensize
-
- def set_pensize(self, x):
- state = self._state
- state.pensize = x
- state.win_pen = gdip.Pen(state.pencolor._win_argb, x)
-
- def get_current_point(self):
- return self._current_point
-
- def get_font(self):
- return self._state.font
-
- def set_font(self, f):
- self._state.font = f
-
- def newpath(self):
- self._win_path.Reset()
-
- def moveto(self, x, y):
- p = (x, y)
- self._current_point = p
- self._win_path.StartFigure()
-
- def lineto(self, x, y):
- x0, y0 = self._current_point
- self._win_path.AddLine_4f(x0, y0, x, y)
- self._current_point = (x, y)
-
- def curveto(self, p1, p2, p3):
- p0 = self._current_point
- self._win_path.AddBezier_4p(p0, p1, p2, p3)
- self._current_point = p3
-
- def arc(self, c, r, a0, a1):
- g = self._win_path
- g.AddArc_p3f(c, r, a0, a1)
- self._current_point = g.GetLastPoint()
-
- def closepath(self):
- self._win_path.CloseFigure()
- self._current_point = None
-
- def fill(self):
- self._win_graphics.FillPath(self._state.win_fill_brush, self._win_path)
-
- def stroke(self):
- self._win_graphics.DrawPath(self._state.win_pen, self._win_path)
-
- def erase(self):
- g = self._win_graphics
- g.SetSourceCopyMode()
- g.FillPath(self._state.win_bg_brush, self._win_path)
- g.SetSourceOverMode()
-
- def show_text(self, text):
- font = self._state.font
- gf = font._win_gdip_font
- x, y = self._current_point
- brush = self._state.win_text_brush
- g = self._win_graphics
- w = g.DrawAndMeasureStringWidth_2f(text, gf, x, y, brush)
- self._current_point = x + w, y
-
-##
-## GDI+ screws up some fonts (e.g. Times) for some reason.
-## Using plain GDI to draw text for now.
-##
-# def show_text(self, text):
-# state = self._state
-# x, y = self._current_point
-# dc = self._win_dc
-# dc.SelectObject(state.font._win_font)
-# dc.SetTextColor(state.textcolor._win_color)
-# dc.MoveTo(ir(x), ir(y))
-# dc.TextOut(20, 20, text)
-# self._current_point = dc.GetCurrentPosition()
-
- def clip(self):
- self._win_graphics.SetClip_PI(self._win_path)
-
- def rectclip(self, rect):
- self._win_graphics.SetClip_rI(rect)
-
- def gsave(self):
- old_state = self._state
- old_state.win_state = self._win_graphics.Save()
- self._stack.append(old_state)
- self._state = GState(old_state)
-
- def grestore(self):
- old_state = self._stack.pop()
- self._win_graphics.Restore(old_state.win_state)
- self._state = old_state
-
- # Rectangles
-
- def rect(self, rect):
- self._win_path.AddRectangle_r(rect)
- self._current_point = None
-
- def fill_rect(self, rect):
- self._win_graphics.FillRectangle_r(self._state.win_fill_brush, rect)
-
- def stroke_rect(self, rect):
- self._win_graphics.DrawRectangle_r(self._state.win_pen, rect)
-
- def erase_rect(self, rect):
- self._win_graphics.FillRectangle_r(self._state.win_bg_brush, rect)
-
- # Ovals
-
- def oval(self, rect):
- self._win_path.AddEllipse_r(rect)
- self._current_point = None
-
- def fill_oval(self, rect):
- self._win_graphics.FillEllipse_r(self._state.win_fill_brush, rect)
-
- def stroke_oval(self, rect):
- self._win_graphics.DrawEllipse_r(self._state.win_pen, rect)
-
- def erase_oval(self, rect):
- self._win_graphics.FillEllipse_r(self._state.win_bg_brush, rect)
-
- # Arcs
-
- def stroke_arc(self, c, r, a0, a1):
- self._win_graphics.DrawArc_3pf(self._state.win_pen, c, r, a0, a1)
-
- # Wedges
-
- def wedge(self, c, r, a0, a1):
- self._win_path.AddPie_p3f(c, r, a0, a1)
- self._current_point = None
-
- def stroke_wedge(self, c, r, a0, a1):
- self._win_graphics.DrawPie_p3f(self._state.win_pen, c, r, a0, a1)
-
- def fill_wedge(self, c, r, a0, a1):
- self._win_graphics.FillPie_p3f(self._state.win_fill_brush, c, r, a0, a1)
-
- def erase_wedge(self, c, r, a0, a1):
- self._win_graphics.FillPie_p3f(self._state.win_bg_brush, c, r, a0, a1)
-
- # Polylines
-
- def lines(self, points):
- self._win_path.AddLines_pv(points)
- self._current_point = points[-1]
-
- def linesto(self, points):
- self.lines([self._current_point] + points)
-
- def stroke_lines(self, points):
- self._win_graphics.DrawLines_pv(self._state.win_pen, points)
-
- # Polygons
-
- def poly(self, points):
- self._win_path.AddPolygon_pv(points)
- self._current_point = None
-
- def stroke_poly(self, points):
- self._win_graphics.DrawPolygon_pv(self._state.win_pen, points)
-
- def fill_poly(self, points):
- self._win_graphics.FillPolygon_pv(self._state.win_fill_brush, points)
-
- def erase_poly(self, points):
- self._win_graphics.FillPolygon_pv(self._state.win_bg_brush, points)
-
- # Polycurves
-
- def curves(self, points):
- self._win_path.AddBeziers_pv(points)
- self._current_point = points[-1]
-
- def curvesto(self, points):
- self.curves([self._current_point] + points)
-
- def stroke_curves(self, points):
- self._win_graphics.DrawBeziers_pv(self._state.win_pen, points)
-
- # Transformations
-
- def translate(self, dx, dy):
- self._win_graphics.Translate_2f(dx, dy)
-
- def scale(self, sx, sy):
- self._win_graphics.Scale_2f(sx, sy)
-
- def rotate(self, rotation):
- self._win_graphics.Rotate_1f(rotation)
-
-export(Canvas)
diff --git a/PyGUI-2.5.3/GUI/Win32/CheckBox.py b/PyGUI-2.5.3/GUI/Win32/CheckBox.py
deleted file mode 100644
index 7a8f651..0000000
--- a/PyGUI-2.5.3/GUI/Win32/CheckBox.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - CheckBox - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.ButtonBases import ButtonBase
-from GUI.GCheckBoxes import CheckBox as GCheckBox
-
-win_check_size = 13
-win_hpad = 5
-
-win_styles = (
- [wc.BS_CHECKBOX, wc.BS_AUTOCHECKBOX],
- [wc.BS_3STATE, wc.BS_AUTO3STATE],
-)
-
-win_states = (
- [False, True],
- [False, True, 'mixed'],
-)
-
-class CheckBox(ButtonBase, GCheckBox):
-
- #_win_transparent = True
-
- def __init__(self, title = "New Checkbox", **kwds):
- font = self._win_predict_font(kwds)
- self._auto_toggle = kwds.pop('auto_toggle', True)
- self._mixed = kwds.get('mixed', False)
- w = font.width(title) + win_hpad + win_check_size
- h = max(self._calc_height(font), win_check_size)
- win_style = self._win_button_style()
- win = self._win_create_button(title, win_style, w, h)
- GCheckBox.__init__(self, _win = win, **kwds)
-
- def get_auto_toggle(self):
- return win_styles[self._mixed].index(self._win.GetButtonStyle()) != 0
-
- def set_auto_toggle(self, x):
- self._auto_toggle = bool(x)
- self._win_update_button_style()
-
- def set_mixed(self, v):
- GCheckBox.set_mixed(self, v)
- self._win_update_button_style()
-
- def get_on(self):
- return win_states[self._mixed][self._win.GetCheck() & 0x3]
-
- def set_on(self, x):
- try:
- state = win_states[self._mixed].index(x)
- except ValueError:
- raise ValueError("Invalid CheckBox state '%s'" % x)
- self._win.SetCheck(state)
-
- def _win_update_button_style(self):
- self._win.SetButtonStyle(self._win_button_style())
-
- def _win_button_style(self):
- return win_styles[self._mixed][self._auto_toggle]
-
- def _win_bn_clicked(self):
- #print "CheckBox._win_bn_clicked:", self ###
- self.do_action()
-
- def _win_activate(self):
- if self.auto_toggle:
- states = win_states[self._mixed]
- i = states.index(self.on)
- self.on = states[(i+1) % len(states)]
- self.do_action()
-
-export(CheckBox)
diff --git a/PyGUI-2.5.3/GUI/Win32/Color.py b/PyGUI-2.5.3/GUI/Win32/Color.py
deleted file mode 100644
index 08a7e63..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Color.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Color - Win32
-#
-#--------------------------------------------------------------------
-
-from __future__ import division
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.GColors import Color as GColor
-
-#--------------------------------------------------------------------
-
-class Color(GColor):
- # _win_color 00BBGGRR
- # _win_argb AARRGGBB
-
- _win_brush_cache = None
-
- def get_red(self):
- return self._red
-
- def get_green(self):
- return self._green
-
- def get_blue(self):
- return self._blue
-
- def get_alpha(self):
- return self._alpha
-
- def _get_win_brush(self):
- b = self._win_brush_cache
- if not b:
- b = ui.CreateBrush(wc.BS_SOLID, self._win_color, 0)
- self._win_brush_cache = b
- return b
-
- _win_brush = property(_get_win_brush)
-
- def _from_win_color(cls, c):
- self = cls.__new__(cls)
- self._win_color = c
- r = c & 0xff
- g = (c >> 8) & 0xff
- b = (c >> 16) & 0xff
- self._red = r / 255
- self._green = g / 255
- self._blue = b / 255
- self._alpha = 1.0
- self._win_argb = 0xff000000 | (r << 16) | (g << 8) | b
- return self
-
- _from_win_color = classmethod(_from_win_color)
-
- def _from_win_argb(cls, c):
- self = cls.__new__()
- self._win_argb = c
- a = (c >> 24) & 0xff
- r = (c >> 16) & 0xff
- g = (c >> 8) & 0xff
- b = c & 0xff
- self._red = r / 255
- self._green = g / 255
- self._blue = b / 255
- self._alpha = a / 255
- self._win_color = (b << 16) | (g << 8) | r
-
-export(Color)
diff --git a/PyGUI-2.5.3/GUI/Win32/Colors.py b/PyGUI-2.5.3/GUI/Win32/Colors.py
deleted file mode 100644
index 0adabb6..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Colors.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Color utilities - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32api as api
-from GUI import Color
-
-def rgb(red, green, blue, alpha = 1.0):
- color = Color()
- color._red = red
- color._green = green
- color._blue = blue
- color._alpha = alpha
- color._win_color = (
- int(red * 255) |
- int(green * 255) << 8 |
- int(blue * 255) << 16)
- color._win_argb = (
- int(blue * 255) |
- int(green * 255) << 8 |
- int(red * 255) << 16 |
- int(alpha * 255) << 24)
- return color
-
-selection_forecolor = Color._from_win_color(
- api.GetSysColor(wc.COLOR_HIGHLIGHTTEXT))
-
-selection_backcolor = Color._from_win_color(
- api.GetSysColor(wc.COLOR_HIGHLIGHT))
diff --git a/PyGUI-2.5.3/GUI/Win32/Component.py b/PyGUI-2.5.3/GUI/Win32/Component.py
deleted file mode 100755
index 0fa1212..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Component.py
+++ /dev/null
@@ -1,263 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Component - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui, win32api as api
-
-from GUI import export
-from GUI.Geometry import sub_pt
-from GUI import application
-from GUI.WinUtils import win_none, win_event_messages
-from GUI.WinEvents import win_message_to_event, win_prev_key_state
-from GUI.Exceptions import Cancel
-from GUI.GComponents import Component as GComponent, transform_coords
-
-win_swp_flags = wc.SWP_NOACTIVATE | wc.SWP_NOZORDER
-win_sws_flags = win_swp_flags | wc.SWP_NOMOVE
-
-# Virtual key code to menu key char
-win_menu_key_map = {
- 0xc0: '`',
- 0xbd: '-',
- 0xbb: '=',
- 0xdb: '[',
- 0xdd: ']',
- 0xba: ';',
- 0xde: "'",
- 0xbc: ',',
- 0xbe: '.',
- 0xbf: '/',
- 0xdc: '\\',
-}
-
-# Virtual key codes of modifier keys
-win_virt_modifiers = (0x10, 0x11, 0x12, 0x14, 0x90)
-
-# Translate virtual key code to menu key char
-def win_translate_virtual_menu_key(virt):
- if 0x41 <= virt <= 0x5a or 0x30 <= virt <= 0x39:
- return chr(virt)
- else:
- return win_menu_key_map.get(virt)
-
-#--------------------------------------------------------------------
-
-class Component(GComponent):
-
- _has_local_coords = True
- _win_hooks_events = False
- _win_transparent = False
- _win_captures_mouse = False
-
- _h_scroll_offset = 0
- _v_scroll_offset = 0
- _win_tracking_mouse = False
-
- def __init__(self, _win, **kwds):
- if self._win_transparent:
- _win.ModifyStyleEx(0, wc.WS_EX_TRANSPARENT, 0)
- self._win = _win
- self._bounds = self._win_get_actual_bounds()
- _win.AttachObject(self)
- self._win_install_event_hooks()
- GComponent.__init__(self, **kwds)
-
- def destroy(self):
- GComponent.destroy(self)
- wo = self._win
- if wo:
- wo.AttachObject(None)
- wo.ShowWindow(wc.SW_HIDE)
- application()._win_recycle(wo)
- #self._win = None
-
- def _win_get_flag(self, flag):
- return self._win.GetStyle() & flag != 0
-
- def _win_set_flag(self, b, flag, swp_flags = 0):
- if b:
- state = flag
- else:
- state = 0
- self._win.ModifyStyle(flag, state, swp_flags)
-
- def _win_set_ex_flag(self, b, flag, swp_flags = 0):
- if b:
- state = flag
- else:
- state = 0
- self._win.ModifyStyleEx(flag, state, swp_flags)
-
- def _change_container(self, new_container):
- GComponent._change_container(self, new_container)
- if new_container:
- win_new_parent = new_container._win
- else:
- win_new_parent = win_none
- hwnd = self._win.GetSafeHwnd()
- gui.SetParent(hwnd, win_new_parent.GetSafeHwnd())
- if new_container:
- self._win_move_window(self._bounds)
-
- def _win_install_event_hooks(self):
- def hook(message):
- return self._win_event_message(message)
- win = self._win
- for msg in win_event_messages:
- win.HookMessage(hook, msg)
- win.HookMessage(self._win_wm_setfocus, wc.WM_SETFOCUS)
- win.HookMessage(self._win_wm_killfocus, wc.WM_KILLFOCUS)
-
- def _win_wm_setfocus(self, msg):
- #print "Component._win_wm_setfocus:", self ###
- self.targeted()
- return True
-
- def targeted(self):
- pass
-
- def _win_wm_killfocus(self, msg):
- #print "Component._win_wm_killfocus:", self ###
- self.untargeted()
- return True
-
- def untargeted(self):
- pass
-
- def _win_on_ctlcolor(self, dc, typ):
- pass
-
-# def OnCtlColor(self, dc, comp, typ):
-# #print "Component.OnCtlColor" ###
-# meth = getattr(comp, '_win_on_ctlcolor', None)
-# if meth:
-# return meth(dc, typ)
-
- def get_bounds(self):
- return self._bounds
-
- def set_bounds(self, rect):
- self._win_move_window(rect)
- self._win_change_bounds(rect)
-
- def _win_change_bounds(self, rect):
- l0, t0, r0, b0 = self._bounds
- l1, t1, r1, b1 = rect
- w0 = r0 - l0
- h0 = b0 - t0
- w1 = r1 - l1
- h1 = b1 - t1
- self._bounds = rect
- if w0 != w1 or h0 != h1:
- self._resized((w1 - w0, h1 - h0))
-
- def _win_move_window(self, bounds):
- container = self.container
- if container:
- rect = container._win_adjust_bounds(bounds)
- self._win.MoveWindow(rect)
-
- def _win_adjust_bounds(self, bounds):
- # Scrollable views override this to adjust for the scroll offset.
- return bounds
-
- def _win_get_actual_bounds(self):
- win = self._win
- parent = win.GetParent()
- sbounds = win.GetWindowRect()
- return parent._win.ScreenToClient(sbounds)
-
- def become_target(self):
- #print "Component.become_target:", self ###
- window = self.window
- if window:
- if window._win_is_active():
- #print "...setting focus" ###
- self._win.SetFocus()
- else:
- #print "...saving focus in", window ###
- window._win_saved_target = self
-
- def invalidate_rect(self, r):
- #print "Component.invalidate_rect:", self, r ###
- self._invalidate_rect(r)
- if self._win_transparent:
- cont = self.container
- if cont:
- cont.invalidate_rect(self.local_to_container(r))
-
- def _invalidate_rect(self, r):
- self._win.InvalidateRect(r)
-
- def local_to_global(self, p):
- return self._win.ClientToScreen(p)
-
- def global_to_local(self, p):
- return self._win.ScreenToClient(p)
-
- def container_to_local(self, p):
- return transform_coords(self.container, self, p)
-
- def local_to_container(self, p):
- return transform_coords(self, self.container, p)
-
- def _win_event_message(self, message):
- try:
- if 0:
- from WinUtils import win_message_name ###
- print "Component._win_event_message: %s 0x%08x 0x%08x" % ( ###
- win_message_name(message[1]),
- message[2] & 0xffffffff,
- message[3] & 0xffffffff) ###
- event = win_message_to_event(message, self)
- kind = event.kind
- if kind.startswith('key') and message[2] in win_virt_modifiers:
- # Do not produce Events for modifier keys
- return True
- if kind == 'mouse_down' and self._win_captures_mouse:
- self._win.SetCapture()
- if self._win_tracking_mouse:
- if 'mouse' in kind:
- self._win_mouse_event = event
- api.PostQuitMessage(0)
- pass_message = False
- else:
- if kind == 'key_down' and event.control and event.char:
- key = win_translate_virtual_menu_key(message[2])
- top = self._win.GetTopLevelFrame()
- if top._win_possible_menu_key(key, event.shift, event.option):
- return False
- pass_message = not self._event_custom_handled(event)
- if kind == 'mouse_up' and self._win_captures_mouse:
- self._win.ReleaseCapture()
-# #<<<
-# if kind.startswith('key'):
-# if pass_message:
-# print "Component._win_event_message: passing", event ###
-# else:
-# print "Component._win_event_message: absorbing", event ###
-# #>>>
- return pass_message
- except Cancel:
- pass
- except:
- application().report_error()
-# print "Component._win_event_message: Posting quit message with 1" ###
-# api.PostQuitMessage(1)
-
- def _win_dump_flags(self):
- from WinUtils import win_deconstruct_style, win_deconstruct_style_ex
- print "%s.%s: style:" % (self.__class__.__module__, self.__class__.__name__)
- win_deconstruct_style(self._win.GetStyle())
- win_deconstruct_style_ex(self._win.GetExStyle())
-
-# def PreTranslateMessage(self, message):
-# print "Component.PreTranslateMessage:", self, \
-# message[0], win_message_name(message[1]), \
-# message[2]
-#
-#from WinUtils import win_message_name
-
-export(Component)
diff --git a/PyGUI-2.5.3/GUI/Win32/Container.py b/PyGUI-2.5.3/GUI/Win32/Container.py
deleted file mode 100755
index 91f6ba4..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Container.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Container - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc
-from win32api import HIWORD, LOWORD
-from GUI import export
-from GUI.Geometry import add_pt, sub_pt
-from GUI.WinUtils import WinMessageReflector
-from GUI.GContainers import Container as GContainer
-
-class Container(GContainer, WinMessageReflector):
-
- def get_content_size(self):
- return sub_pt(self.size, self._win_content_size_adjustment())
-
- def set_content_size(self, size):
- self.size = add_pt(size, self._win_content_size_adjustment())
-
- def _win_content_size_adjustment(self):
- win = self._win
- wl, wt, wr, wb = win.GetWindowRect()
- cl, ct, cr, cb = win.GetClientRect()
- return ((wr - wl) - (cr - cl), (wb - wt) - (cb - ct))
-
-export(Container)
-
diff --git a/PyGUI-2.5.3/GUI/Win32/Control.py b/PyGUI-2.5.3/GUI/Win32/Control.py
deleted file mode 100644
index a7d576f..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Control.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Control - Win32
-#
-#--------------------------------------------------------------------
-
-from math import ceil
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.StdColors import black
-from GUI.StdFonts import system_font
-from GUI.WinUtils import win_none, win_null_hbrush
-from GUI.GControls import Control as GControl
-
-class Control(GControl):
-
- _vertical_padding = 5 # Amount to add when calculating height from font size
-
- _color = black
- _just = 'left'
- _font = None
-
- def get_title(self):
- return self._win.GetWindowText()
-
- def set_title(self, x):
- self._win.SetWindowText(x)
-
- def get_enabled(self):
- return self._win.IsWindowEnabled()
-
- def set_enabled(self, x):
- self._win.EnableWindow(x)
-
-# def get_visible(self, x):
-# self._win.IsWindowVisible()
-#
-# def set_visible(self, x):
-# if x:
-# self._win.ShowWindow(wc.SW_SHOW)
-# else:
-# self._win.ShowWindow(wc.SW_HIDE)
-
- def get_font(self):
- return self._font
-
- def set_font(self, x):
- self._font = x
- self._win.SetFont(x._win_font)
- self.invalidate()
-
- def get_color(self):
- return self._color
-
- def set_color(self, x):
- self._color = x
- self.invalidate()
-
- def get_just(self):
- return self._just
-
- def set_just(self, x):
- self._just = x
- self.invalidate()
-
- def _win_create_button(self, title, style, w, h):
- w = int(ceil(w))
- win = ui.CreateButton()
- win.CreateWindow(title, style, (0, 0, w, h), win_none, 0)
- #if self._win_transparent:
- # win.ModifyStyleEx(0, wc.WS_EX_TRANSPARENT, 0)
- win.ShowWindow(wc.SW_SHOW)
- return win
-
- def _win_on_ctlcolor(self, dc, typ):
- #print "Control._win_on_ctlcolor:", self ###
- c = self._color
- if c:
- dc.SetTextColor(c._win_color)
- if self._win_transparent:
- dc.SetBkMode(wc.TRANSPARENT)
- return win_null_hbrush
-
- def _win_predict_font(self, kwds):
- return kwds.setdefault('font', system_font)
-
-export(Control)
diff --git a/PyGUI-2.5.3/GUI/Win32/Cursor.py b/PyGUI-2.5.3/GUI/Win32/Cursor.py
deleted file mode 100644
index a93ee1d..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Cursor.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# Python GUI - Cursors - Win32
-#
-#--------------------------------------------------------------------------
-
-import win32gui as gui
-from GUI import export
-from GUI.GCursors import Cursor as GCursor
-
-class Cursor(GCursor):
-
- def _from_win_cursor(cls, hcursor):
- cursor = cls.__new__(cls)
- cursor._win_cursor = hcursor
- return cursor
-
- _from_win_cursor = classmethod(_from_win_cursor)
-
- def __str__(self):
- return "" % self._win_cursor
-
- def _init_from_image_and_hotspot(self, image, hotspot):
- #print "Cursor._init_from_image_and_hotspot:" ###
- hicon = image._win_image.GetHICON()
- iconinfo = gui.GetIconInfo(hicon)
- gui.DestroyIcon(hicon)
- flag, xhot, yhot, hbmMask, hbmColor = iconinfo
- xhot, yhot = hotspot
- cursorinfo = (True, xhot, yhot, hbmMask, hbmColor)
- win_cursor = gui.CreateIconIndirect(cursorinfo)
- gui.DeleteObject(hbmMask)
- gui.DeleteObject(hbmColor)
- self._win_cursor = win_cursor
-
-export(Cursor)
diff --git a/PyGUI-2.5.3/GUI/Win32/Dialog.py b/PyGUI-2.5.3/GUI/Win32/Dialog.py
deleted file mode 100644
index a2ec5ad..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Dialog.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Dialog - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI import export
-from GUI.GDialogs import Dialog
-
-export(Dialog)
diff --git a/PyGUI-2.5.3/GUI/Win32/DrawableContainer.py b/PyGUI-2.5.3/GUI/Win32/DrawableContainer.py
deleted file mode 100644
index d4f1484..0000000
--- a/PyGUI-2.5.3/GUI/Win32/DrawableContainer.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - DrawableContainer - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI import export
-from GUI import Canvas
-from GUI.Geometry import rect_topleft, rect_size, offset_rect, empty_rect
-from GUI.GDrawableContainers import DrawableContainer as GDrawableContainer
-import GUI.GDIPlus as gdi
-
-class DrawableContainer(GDrawableContainer):
-
- _double_buffer = True
- _win_paint_broken = False
-
- def update(self):
- self._win.UpdateWindow()
-
- def with_canvas(self, body):
- win = self._win
- dc = win.GetDC()
- self._win_prepare_dc(dc)
- try:
- canvas = Canvas._from_win_dc(dc)
- body(canvas)
- finally:
- win.ReleaseDC(dc)
-
- def OnPaint(self):
- if not self._win_paint_broken:
- try:
- win = self._win
- dc, ps = win.BeginPaint()
- try:
- win_update_rect = ps[2]
- if not empty_rect(win_update_rect):
- #print "DrawableContainer.OnPaint: win_update_rect =", win_update_rect ###
- scroll_offset = self._win_scroll_offset()
- view_update_rect = offset_rect(win_update_rect, scroll_offset)
- if self._double_buffer:
- dx, dy = rect_topleft(view_update_rect)
- width, height = rect_size(view_update_rect)
- buffer = gdi.Bitmap(width, height)
- canvas = Canvas._from_win_image(buffer)
- canvas.translate(-dx, -dy)
- self.draw(canvas, view_update_rect)
- graphics = gdi.Graphics.from_dc(dc)
- src_rect = (0, 0, width, height)
- graphics.DrawImage_rr(buffer, win_update_rect, src_rect)
- else:
- self._win_prepare_dc(dc)
- canvas = Canvas._from_win_dc(dc)
- self.draw(canvas, view_update_rect)
- finally:
- win.EndPaint(ps)
- except Exception:
- self._win_paint_broken = True
- raise
-
- def _win_prepare_dc(self, dc):
- dc.SetWindowOrg(self._win_scroll_offset())
-
- def _win_scroll_offset(self):
- return (0, 0)
-
-export(DrawableContainer)
diff --git a/PyGUI-2.5.3/GUI/Win32/EditCmdHandler.py b/PyGUI-2.5.3/GUI/Win32/EditCmdHandler.py
deleted file mode 100644
index f778e13..0000000
--- a/PyGUI-2.5.3/GUI/Win32/EditCmdHandler.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# PyGUI - Edit command handling - Win32
-#
-
-from GUI import export
-from GUI.GEditCmdHandlers import EditCmdHandler as GEditCmdHandler
-
-class EditCmdHandler(GEditCmdHandler):
-
- def cut_cmd(self):
- self._win.Cut()
-
- def copy_cmd(self):
- self._win.Copy()
-
- def paste_cmd(self):
- self._win.Paste()
-
- def clear_cmd(self):
- self._win.Clear()
-
-export(EditCmdHandler)
diff --git a/PyGUI-2.5.3/GUI/Win32/Event.py b/PyGUI-2.5.3/GUI/Win32/Event.py
deleted file mode 100644
index f2fc337..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Event.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Event - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI import export
-from GUI.GEvents import Event as GEvent
-
-class Event(GEvent):
-
- def _platform_modifiers_str(self):
- return ""
-
-export(Event)
diff --git a/PyGUI-2.5.3/GUI/Win32/Files.py b/PyGUI-2.5.3/GUI/Win32/Files.py
deleted file mode 100755
index 253c947..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Files.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Files - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI.GFiles import FileRef, DirRef, FileType
diff --git a/PyGUI-2.5.3/GUI/Win32/Font.py b/PyGUI-2.5.3/GUI/Win32/Font.py
deleted file mode 100644
index 649d663..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Font.py
+++ /dev/null
@@ -1,219 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Font - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32gui as gui, win32ui as ui, win32api as api
-from GUI import export
-from WinUtils import win_none
-import GUI.GDI as gdi
-import GUI.GDIPlus as gdip
-from GUI.GFonts import Font as GFont
-
-#win_family_map = {
-# "Decorative": wc.FF_DECORATIVE | wc.DEFAULT_PITCH,
-# "Fixed": wc.FF_MODERN | wc.FIXED_PITCH,
-# "Courier": wc.FF_MODERN | wc.FIXED_PITCH,
-# "Modern": wc.FF_MODERN | wc.DEFAULT_PITCH,
-# "Serif": wc.FF_ROMAN | wc.VARIABLE_PITCH,
-# "Roman": wc.FF_ROMAN | wc.VARIABLE_PITCH,
-# "Times": wc.FF_ROMAN | wc.VARIABLE_PITCH,
-# "Sans": wc.FF_SWISS | wc.VARIABLE_PITCH,
-# "Helvetica": wc.FF_SWISS | wc.VARIABLE_PITCH,
-# "Script": wc.FF_SCRIPT | wc.DEFAULT_PITCH,
-# "Cursive": wc.FF_SCRIPT | wc.DEFAULT_PITCH,
-#}
-
-#win_default_pf = wc.FF_DONTCARE | wc.DEFAULT_PITCH
-
-def win_create_font(**kwds):
- # Work around bug in CreateFont
- for name in 'italic', 'underline':
- if name in kwds and not kwds[name]:
- del kwds[name]
- return ui.CreateFont(kwds)
-
-#def win_pf_to_name(pf):
-# if pf & 0x3 == wc.FIXED_PITCH:
-# return "Fixed"
-# for name, npf in win_family_map.iteritems():
-# if pf & 0xf0 == npf & 0xf0:
-# return name
-# return "Unknown"
-
-win_generic_family_map = {
- "Sans": "Arial",
- "Serif": "Times New Roman",
- "Fixed": "Courier New",
- "Times": "Times New Roman",
- "Courier": "Courier New",
-}
-
-# PyWin32 build 212 and earlier negate the value of the height
-# passed to CreateFont.
-
-pywin32_info = api.GetFileVersionInfo(api.__file__, '\\')
-pywin32_build = pywin32_info['FileVersionLS'] >> 16
-if pywin32_build <= 212:
- win_height_sign = 1
-else:
- win_height_sign = -1
-
-#--------------------------------------------------------------------
-
-class Font(GFont):
- # _win_font PyCFont
- # _win_gfont GDIPlus.Font
-
- def __init__(self, family = "Times", size = 12, style = []):
- win_family = win_generic_family_map.get(family, family)
- self._family = family
- self._win_family = win_family
- self._size = size
- self._style = style
- if 'bold' in style:
- win_weight = wc.FW_BOLD
- else:
- win_weight = wc.FW_NORMAL
- #print "Font: calling win_create_font" ###
- height = int(round(size))
- #print "Font: height =", height ###
- win_font = win_create_font(
- name = win_family,
- height = win_height_sign * height,
- weight = win_weight,
- italic = 'italic' in style)
- #pitch_and_family = 0) ###win_family_map.get(family, win_default_pf))
- self._win_font = win_font
- self._win_update_metrics()
- #global dc ###
- #dc = win_none.GetDC()
- #dc.SelectObject(win_font)
- #self._win_gfont = gdip.Font.from_hdc(dc.GetSafeHdc())
- #win_none.ReleaseDC(dc)
-
-# def __init__(self, family = "Times", size = 12, style = []):
-# self._family = family
-# self._size = size
-# self._style = style
-# hfont = gdi.create_hfont(family, size, style)
-# self._win_hfont = hfont
-# self._win_update_metrics()
-
- def get_family(self):
- return self._family
-
- def get_size(self):
- return self._size
-
- def get_style(self):
- return self._style
-
- def get_ascent(self):
- return self._ascent
-
- def get_descent(self):
- return self._descent
-
- def get_leading(self):
- return self._leading
-
- def get_cap_height(self):
- return self._ascent - self._internal_leading
-
- def get_x_height(self):
- return self._ascent - self._internal_leading - self._descent
-
- def get_height(self):
- return self._ascent + self._descent
-
- def get_line_height(self):
- return self._ascent + self._descent + self._leading
-
- def _win_update_metrics(self):
- dc = win_none.GetDC()
- dc.SelectObject(self._win_font)
- met = dc.GetTextMetrics()
- self._ascent = met['tmAscent']
- self._descent = met['tmDescent']
- self._internal_leading = met['tmInternalLeading']
- self._leading = met['tmExternalLeading']
- self._win_overhang = met['tmOverhang']
- #print "Font: tmOverhang =", self._win_overhang ###
- win_none.ReleaseDC(dc)
- self._win_gdip_font = gdip.Font(self._win_family, self._size, self._style)
-
- def _width(self, s):
- dc = win_none.GetDC()
- dc.SelectObject(self._win_font)
- w, h = dc.GetTextExtent(s)
- win_none.ReleaseDC(dc)
- return w
-
-# def _width(self, s):
-# dc = win_none.GetDC()
-# g = gdip.Graphics.from_hdc(dc.GetSafeHdc())
-# w = g.MeasureStringWidth(s, self._win_gdip_font)
-# win_none.ReleaseDC(dc)
-# return w
-
- def info(self):
- return "" % \
- (self.family, self.size, self.style, self.ascent, self.descent,
- self.leading, self.height, self.cap_height, self.x_height,
- self.line_height)
-
- def tm_info(self):
- win = ui.CreateWnd()
- dc = win.GetDC()
- dc.SelectObject(self._win_font)
- tm = dc.GetTextMetrics()
- win.ReleaseDC(dc)
- return tm
-
-# def _from_win_logfont(cls, lf):
-# #print "Font._from_win_logfont:", lf ###
-# #for name in dir(lf): ###
-# # print name, "=", getattr(lf, name) ###
-# font = cls.__new__(cls)
-# font._family = win_pf_to_name(lf.lfPitchAndFamily)
-# font._size = abs(lf.lfHeight)
-# style = []
-# if lf.lfWeight >= wc.FW_BOLD:
-# style.append('bold')
-# if lf.lfItalic:
-# style.append('italic')
-# font._style = style
-# font._win_font = win_create_font(
-# width = lf.lfWidth,
-# #height = abs(lf.lfHeight),
-# height = lf.lfHeight,
-# weight = lf.lfWeight,
-# italic = lf.lfItalic,
-# underline = lf.lfUnderline,
-# pitch_and_family = lf.lfPitchAndFamily,
-# charset = lf.lfCharSet)
-# font._win_update_metrics()
-# return font
-#
-# _from_win_logfont = classmethod(_from_win_logfont)
-
- def _from_win(cls, win):
- dc = win.GetDC()
- family = dc.GetTextFace()
- tm = dc.GetTextMetrics()
- #print family, tm
- size = tm['tmAscent'] - tm['tmInternalLeading'] + tm['tmDescent']
- style = []
- if tm['tmWeight'] >= wc.FW_BOLD:
- style.append('bold')
- if tm['tmItalic']:
- style.append('italic')
- win.ReleaseDC(dc)
- return Font(family, size, style)
-
- _from_win = classmethod(_from_win)
-
-export(Font)
diff --git a/PyGUI-2.5.3/GUI/Win32/Frame.py b/PyGUI-2.5.3/GUI/Win32/Frame.py
deleted file mode 100644
index ab70d2b..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Frame.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Frame - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.WinUtils import win_none
-from GUI.GFrames import Frame as GFrame
-
-win_flags = wc.WS_CHILD | wc.WS_VISIBLE
-
-class Frame(GFrame):
-
- _win_transparent = True
-
- def __init__(self, **kwds):
- w, h = self._default_size
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_flags, (0, 0, w, h), win_none, 0)
- GFrame.__init__(self, _win = win, **kwds)
-
-export(Frame)
diff --git a/PyGUI-2.5.3/GUI/Win32/GDI.py b/PyGUI-2.5.3/GUI/Win32/GDI.py
deleted file mode 100644
index bf5765e..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GDI.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - GDI
-#
-#--------------------------------------------------------------------
-
-LF_FACESIZE = 32
-
-from ctypes import *
-from ctypes.wintypes import *
-
-class LOGFONT(Structure):
- _fields_ = [ ('lfHeight', c_long),
- ('lfWidth', c_long),
- ('lfEscapement', c_long),
- ('lfOrientation', c_long),
- ('lfWeight', c_long),
- ('lfItalic', c_byte),
- ('lfUnderline', c_byte),
- ('lfStrikeOut', c_byte),
- ('lfCharSet', c_byte),
- ('lfOutPrecision', c_byte),
- ('lfClipPrecision', c_byte),
- ('lfQuality', c_byte),
- ('lfPitchAndFamily', c_byte),
- ('lfFaceName', c_char * LF_FACESIZE) ]
-
- def __init__(self):
- self.lfHeight = 10
- self.lfWidth = 0
- self.lfEscapement = 10
- self.lfOrientation = 0
- self.lfUnderline = 0
- self.lfStrikeOut = 0
- self.lfCharSet = 0 # ANSI_CHARSET
- #self.lfPitchAndFamily = 0
- self.lfOutPrecision = 0
- self.lfClipPrecision = 0
- self.lfQuality = 0
- self.lfPitchAndFamily = 2
-
-def create_hfont(family, size, style):
- lf = LOGFONT()
- lf.lfFaceName = family
- lf.lfHeight = size
- if 'italic' in style:
- lf.lfItalic = 1
- if 'bold' in style:
- lf.lfWeight = 10
- return windll.gdi32.CreateFontIndirectA(byref(lf))
diff --git a/PyGUI-2.5.3/GUI/Win32/GDIPlus.py b/PyGUI-2.5.3/GUI/Win32/GDIPlus.py
deleted file mode 100644
index 788bfa7..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GDIPlus.py
+++ /dev/null
@@ -1,494 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - GDI Plus
-#
-#--------------------------------------------------------------------
-
-from ctypes import *
-from ctypes.wintypes import BOOL
-try:
- from numpy import ndarray, float32
-except ImportError:
- class ndarray(object):
- pass
-
-#wg = windll.gdiplus
-wg = oledll.gdiplus
-
-#--------------------------------------------------------------------
-
-# enum Unit
-
-UnitWorld = 0
-UnitDisplay = 1
-UnitPixel = 2
-UnitPoint = 3
-
-# enum FillMode
-
-FillModeAlternate = 0
-
-# enum CombineMode
-
-CombineModeIntersect = 1
-
-# enum MatrixOrder
-
-MatrixOrderPrepend = 0
-MatrixOrderAppend = 1
-
-# Pixel Formats
-
-# In-memory pixel data formats:
-# bits 0-7 = format index
-# bits 8-15 = pixel size (in bits)
-# bits 16-23 = flags
-# bits 24-31 = reserved
-
-PixelFormatIndexed = 0x00010000 # Indexes into a palette
-PixelFormatGDI = 0x00020000 # Is a GDI-supported format
-PixelFormatAlpha = 0x00040000 # Has an alpha component
-PixelFormatPAlpha = 0x00080000 # Pre-multiplied alpha
-PixelFormatExtended = 0x00100000 # Extended color 16 bits/channel
-PixelFormatCanonical = 0x00200000
-
-PixelFormat1bppIndexed = (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI)
-PixelFormat4bppIndexed = (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI)
-PixelFormat8bppIndexed = (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI)
-PixelFormat16bppGrayScale = (4 | (16 << 8) | PixelFormatExtended)
-PixelFormat16bppRGB555 = (5 | (16 << 8) | PixelFormatGDI)
-PixelFormat16bppRGB565 = (6 | (16 << 8) | PixelFormatGDI)
-PixelFormat16bppARGB1555 = (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI)
-PixelFormat24bppRGB = (8 | (24 << 8) | PixelFormatGDI)
-PixelFormat32bppRGB = (9 | (32 << 8) | PixelFormatGDI)
-PixelFormat32bppARGB = (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical)
-PixelFormat32bppPARGB = (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI)
-PixelFormat48bppRGB = (12 | (48 << 8) | PixelFormatExtended)
-PixelFormat64bppARGB = (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended)
-PixelFormat64bppPARGB = (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended)
-
-# enum FontStyle
-
-FontStyleBold = 1
-FontStyleItalic = 2
-FontStyleUnderline = 4
-FontStyleStrikeout = 8
-
-class PointF(Structure):
- _fields_ = [("x", c_float), ("y", c_float)]
-
-class RectF(Structure):
- _fields_ = [
- ("x", c_float), ("y", c_float),
- ("width", c_float), ("height", c_float)]
-
-#--------------------------------------------------------------------
-
-def rect_args(rect):
- l, t, r, b = rect
- return c_float(l), c_float(t), c_float(r - l), c_float(b - t)
-
-def points_args(points):
- if isinstance(points, ndarray) and points.flags['C_CONTIGUOUS'] and points.dtype == float32:
- #print "GDIPlus.points_args: using ndarray" ###
- n = points.size // 2
- buf = points.ctypes.data
- else:
- n = len(points)
- buf = (PointF * n)()
- for i, p in enumerate(points):
- buf[i].x, buf[i].y = p
- return buf, n
-
-def arc_args(c, r, a0, a1):
- x, y = c
- d = c_float(2 * r)
- return c_float(x - r), c_float(y - r), d, d, \
- c_float(a0), c_float((a1 - a0) % 360.0)
-
-#--------------------------------------------------------------------
-
-class GdiplusStartupInput(Structure):
-
- _fields_ = [
- ('GdiplusVersion', c_uint),
- ('DebugEventCallback', c_void_p),
- ('SuppressBackgroundThread', BOOL),
- ('SuppressExternalCodecs', BOOL),
- ]
-
- def __init__(self):
- Structure.__init__(self)
- self.GdiplusVersion = 1
- self.DebugEventCallback = None
- self.SuppressBackgroundThread = 0
- self.SuppressExternalCodecs = 0
-
-StartupInput = GdiplusStartupInput()
-token = c_ulong()
-wg.GdiplusStartup(pointer(token), pointer(StartupInput), None)
-
-#--------------------------------------------------------------------
-
-class Pen(object):
-
- def __init__(self, argb, size):
- ptr = c_void_p()
- wg.GdipCreatePen1(argb, c_float(size), UnitWorld, byref(ptr))
- self.ptr = ptr
-
- def __del__(self, wg = wg):
- wg.GdipDeletePen(self.ptr)
-
-#--------------------------------------------------------------------
-
-class SolidBrush(object):
-
- def __init__(self, argb):
- ptr = c_void_p()
- wg.GdipCreateSolidFill(argb, byref(ptr))
- self.ptr = ptr
-
- def __del__(self, wg = wg):
- wg.GdipDeleteBrush(self.ptr)
-
- def __str__(self):
- argb = c_ulong()
- wg.GdipGetSolidFillColor(self.ptr, byref(argb))
- return "" % argb.value
-
-#--------------------------------------------------------------------
-
-class Font(object):
-
- def __init__(self, family, size, style):
- uname = create_unicode_buffer(family)
- fam = c_void_p()
- wg.GdipCreateFontFamilyFromName(uname, None, byref(fam))
- flags = 0
- if 'bold' in style:
- flags |= FontStyleBold
- if 'italic' in style:
- flags |= FontStyleItalic
- ptr = c_void_p()
- wg.GdipCreateFont(fam, c_float(size), flags, UnitWorld, byref(ptr))
- self.ptr = ptr
- wg.GdipDeleteFontFamily(fam)
-
- def from_hdc(cls, hdc):
- self = cls.__new__(cls)
- ptr = c_void_p()
- wg.GdipCreateFontFromDC(hdc, byref(ptr))
- self.ptr = ptr
- return self
-
- from_hdc = classmethod(from_hdc)
-
- def __del__(self, wg = wg):
- wg.GdipDeleteFont(self.ptr)
-
-#--------------------------------------------------------------------
-
-class Image(object):
-
- def __str__(self):
- return "" % self.ptr.value
-
- def from_file(cls, path):
- self = cls.__new__(cls)
- ptr = c_void_p()
- upath = create_unicode_buffer(path)
- self._create_from_file(upath, ptr)
- self.ptr = ptr
- return self
-
- from_file = classmethod(from_file)
-
- def _create_from_file(self, upath, ptr):
- wg.GdipLoadImageFromFile(upath, byref(ptr))
-
- def __del__(self, wg = wg):
- wg.GdipDisposeImage(self.ptr)
-
- def GetWidth(self):
- uint = c_uint()
- wg.GdipGetImageWidth(self.ptr, byref(uint))
- return uint.value
-
- def GetHeight(self):
- uint = c_uint()
- wg.GdipGetImageHeight(self.ptr, byref(uint))
- return uint.value
-
-#--------------------------------------------------------------------
-
-class Bitmap(Image):
-
- def __init__(self, width, height):
- ptr = c_void_p()
- format = PixelFormat32bppARGB
- wg.GdipCreateBitmapFromScan0(width, height, 0, format, None, byref(ptr))
- self.ptr = ptr
- #print "GDIPlus.Bitmap:", (width, height), repr(self), "ptr =", self.ptr ###
-
- def _create_from_file(self, upath, ptr):
- wg.GdipCreateBitmapFromFile(upath, byref(ptr))
-
- def from_data(cls, width, height, format, data):
- self = cls.__new__(cls)
- ptr = c_void_p()
- bits_per_pixel = (format >> 8) & 0xff
- row_stride = (width * bits_per_pixel) >> 3
- wg.GdipCreateBitmapFromScan0(width, height, row_stride, format, data, byref(ptr))
- self.ptr = ptr
- return self
-
- from_data = classmethod(from_data)
-
- def __str__(self):
- return "" % self.ptr.value
-
- def GetHICON(self):
- hicon = c_ulong()
- wg.GdipCreateHICONFromBitmap(self.ptr, byref(hicon))
- return hicon.value
-
- def GetPixel(self, x, y):
- c = c_ulong()
- wg.GdipBitmapGetPixel(self.ptr, x, y, byref(c))
- return c.value
-
- def SetPixel(self, x, y, c):
- wg.GdipBitmapSetPixel(self.ptr, x, y, c)
-
-#--------------------------------------------------------------------
-
-class GraphicsPath(object):
-
- def __init__(self):
- ptr = c_void_p()
- wg.GdipCreatePath(FillModeAlternate, byref(ptr))
- self.ptr = ptr
-
- def __del__(self, wg = wg):
- wg.GdipDeletePath(self.ptr)
-
- def Reset(self):
- wg.GdipResetPath(self.ptr)
-
- def StartFigure(self):
- wg.GdipStartPathFigure(self.ptr)
-
- def AddLine_4f(self, x0, y0, x1, y1):
- wg.GdipAddPathLine(self.ptr,
- c_float(x0), c_float(y0), c_float(x1), c_float(y1))
-
- def AddBezier_4p(self, p0, p1, p2, p3):
- x0, y0 = p0
- x1, y1 = p1
- x2, y2 = p2
- x3, y3 = p3
- wg.GdipAddPathBezier(self.ptr,
- c_float(x0), c_float(y0), c_float(x1), c_float(y1),
- c_float(x2), c_float(y2), c_float(x3), c_float(y3))
-
- def AddBeziers_pv(self, points):
- wg.GdipAddPathBeziers(self.ptr, *points_args(points))
-
- def AddRectangle_r(self, rect):
- wg.GdipAddPathRectangle(self.ptr, *rect_args(rect))
-
- def AddEllipse_r(self, rect):
- wg.GdipAddPathEllipse(self.ptr, *rect_args(rect))
-
- def AddArc_p3f(self, c, r, a0, a1):
- wg.GdipAddPathArc(self.ptr, *arc_args(c, r, a0, a1))
-
- def AddPie_p3f(self, c, r, a0, a1):
- wg.GdipAddPathPie(self.ptr, *arc_args(c, r, a0, a1))
-
- def AddLines_pv(self, points):
- wg.GdipAddPathLine2(self.ptr, *points_args(points))
-
- def AddPolygon_pv(self, points):
- wg.GdipAddPathPolygon(self.ptr, *points_args(points))
-
- def CloseFigure(self):
- wg.GdipClosePathFigure(self.ptr)
-
- def GetLastPoint(self):
- p = PointF()
- wg.GdipGetPathLastPoint(self.ptr, byref(p))
- return p.x, p.y
-
-#--------------------------------------------------------------------
-
-class Graphics(object):
-
- def from_hdc(cls, hdc):
- self = cls.__new__(cls)
- ptr = c_void_p()
- wg.GdipCreateFromHDC(c_ulong(hdc), byref(ptr))
- self.ptr = ptr
- return self
-
- from_hdc = classmethod(from_hdc)
-
- def from_dc(cls, dc):
- return cls.from_hdc(dc.GetSafeHdc())
-
- from_dc = classmethod(from_dc)
-
- def from_image(cls, image):
- #print "Graphics.from_image:", repr(image) ###
- #print "...", image ###
- self = cls.__new__(cls)
- ptr = c_void_p()
- wg.GdipGetImageGraphicsContext(image.ptr, byref(ptr))
- self.ptr = ptr
- return self
-
- from_image = classmethod(from_image)
-
- def __del__(self, wg = wg):
- wg.GdipDeleteGraphics(self.ptr)
-
- def __str__(self):
- return "" % self.ptr.value
-
- def GetHDC(self):
- hdc = c_long()
- wg.GdipGetDC(self.ptr, byref(hdc))
- return hdc.value
-
- def ReleaseHDC(self, hdc):
- wg.GdipReleaseDC(self.ptr, hdc)
-
- def GetDpiX(self):
- result = c_float()
- wg.GdipGetDpiX(self.ptr, byref(result))
- return result.value
-
- def GetDpiY(self):
- result = c_float()
- wg.GdipGetDpiY(self.ptr, byref(result))
- return result.value
-
- def SetPageUnit(self, unit):
- self.unit = unit
- wg.GdipSetPageUnit(self.ptr, unit)
-
- def GetClipBounds(self):
- r = RectF()
- wg.GdipGetClipBounds(self.ptr, byref(r))
- return (r.x, r.y, r.x + r.width, r.y + r.height)
-
- def Save(self):
- state = c_uint()
- wg.GdipSaveGraphics(self.ptr, byref(state))
- return state.value
-
- def Restore(self, state):
- wg.GdipRestoreGraphics(self.ptr, state)
-
- def DrawImage_rr(self, image, dst_rect, src_rect):
- sl, st, sr, sb = src_rect
- dl, dt, dr, db = dst_rect
- wg.GdipDrawImageRectRect(self.ptr, image.ptr,
- c_float(dl), c_float(dt), c_float(dr - dl), c_float(db - dt),
- c_float(sl), c_float(st), c_float(sr - sl), c_float(sb - st),
- UnitPixel, None, None, None)
-
- def DrawPath(self, pen, path):
- wg.GdipDrawPath(self.ptr, pen.ptr, path.ptr)
-
- def FillPath(self, brush, path):
- wg.GdipFillPath(self.ptr, brush.ptr, path.ptr)
-
- def DrawAndMeasureStringWidth_2f(self, text, font, x, y, brush):
- wtext = unicode(text)
- n = len(text)
- pos = PointF(x, y)
- flags = 5 # DriverStringOptions CmapLookup+RealizedAdvance
- b = RectF()
- wg.GdipDrawDriverString(self.ptr, wtext, n, font.ptr, brush.ptr,
- byref(pos), flags, None)
- wg.GdipMeasureDriverString(self.ptr, wtext, n, font.ptr, byref(pos),
- flags, None, byref(b))
- return b.width
-
- def MeasureStringWidth(self, text, font):
- wtext = unicode(text)
- n = len(text)
- pos = PointF(0, 0)
- flags = 5 # DriverStringOptions CmapLookup+RealizedAdvance
- b = RectF()
- wg.GdipMeasureDriverString(self.ptr, wtext, n, font.ptr, byref(pos),
- flags, None, byref(b))
- return b.width
-
- def SetClip_PI(self, path):
- wg.GdipSetClipPath(self.ptr, path.ptr, CombineModeIntersect)
-
- def SetClip_rI(self, rect):
- x, y, w, h = rect_args(rect)
- wg.GdipSetClipRect(self.ptr, x, y, w, h, CombineModeIntersect)
-
- def DrawRectangle_r(self, pen, rect):
- wg.GdipDrawRectangle(self.ptr, pen.ptr, *rect_args(rect))
-
- def FillRectangle_r(self, brush, rect):
- #print "Graphics.FillRectangle_r:", self, brush, rect ###
- #print "... clip bounds =", self.GetClipBounds() ###
- wg.GdipFillRectangle(self.ptr, brush.ptr, *rect_args(rect))
-
- def DrawEllipse_r(self, pen, rect):
- wg.GdipDrawEllipse(self.ptr, pen.ptr, *rect_args(rect))
-
- def FillEllipse_r(self, brush, rect):
- wg.GdipFillEllipse(self.ptr, brush.ptr, *rect_args(rect))
-
- def DrawArc_3pf(self, pen, c, r, a0, a1):
- wg.GdipDrawArc(self.ptr, pen.ptr, *arc_args(c, r, a0, a1))
-
- def DrawPie_p3f(self, pen, c, r, a0, a1):
- wg.GdipDrawPie(self.ptr, pen.ptr, *arc_args(c, r, a0, a1))
-
- def FillPie_p3f(self, brush, c, r, a0, a1):
- wg.GdipFillPie(self.ptr, brush.ptr, *arc_args(c, r, a0, a1))
-
- def DrawPolygon_pv(self, pen, points):
- wg.GdipDrawPolygon(self.ptr, pen.ptr, *points_args(points))
-
- def FillPolygon_pv(self, brush, points):
- buf, n = points_args(points)
- wg.GdipFillPolygon(self.ptr, brush.ptr, buf, n, FillModeAlternate)
-
- def DrawBeziers_pv(self, pen, points):
- wg.GdipDrawBeziers(self.ptr, pen.ptr, *points_args(points))
-
- def DrawLines_pv(self, pen, points):
- wg.GdipDrawLines(self.ptr, pen.ptr, *points_args(points))
-
- def Translate_2f(self, dx, dy):
- wg.GdipTranslateWorldTransform(self.ptr, c_float(dx), c_float(dy),
- MatrixOrderAppend)
-
- def Scale_2f(self, sx, sy):
- wg.GdipScaleWorldTransform(self.ptr, c_float(sx), c_float(sy),
- MatrixOrderAppend)
-
- def Rotate_1f(self, r):
- wg.GdipRotateWorldTransform(self.ptr, c_float(r),
- MatrixOrderAppend)
-
-
-
- def GetTransform(self):
- matrix = c_void_p()
- elems = (c_float * 6)()
- wg.GdipCreateMatrix(byref(matrix))
- wg.GdipGetWorldTransform(self.ptr, matrix)
- wg.GdipGetMatrixElements(matrix, elems)
- wg.GdipDeleteMatrix(matrix)
- return list(elems)
diff --git a/PyGUI-2.5.3/GUI/Win32/GL.py b/PyGUI-2.5.3/GUI/Win32/GL.py
deleted file mode 100644
index 6f51d5e..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GL.py
+++ /dev/null
@@ -1,270 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - OpenGL - Win32
-#
-#------------------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui
-#import OpenGL.GL as gl ###
-import GUI.GDIPlus as gdi
-from OpenGL import WGL as wgl
-from OpenGL.WGL import ChoosePixelFormat
-#print "Using ctypes ChoosePixelFormat"
-#from WGL import ChoosePixelFormat
-from GUI.WinUtils import win_none
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-
-win_style = wc.WS_VISIBLE | wc.WS_CLIPCHILDREN | wc.WS_CLIPSIBLINGS
-win_default_size = GGLView._default_size
-win_default_rect = (0, 0, win_default_size[0], win_default_size[1])
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- def _as_win_pixelformat(self, mode):
- #print "GLConfig._as_win_pixelformat: mode =", mode ###
- pf = wgl.PIXELFORMATDESCRIPTOR()
- flags = wgl.PFD_SUPPORT_OPENGL
- if mode == 'screen' or mode == 'both':
- #print "GLConfig: requesting screen drawing" ###
- flags |= wgl.PFD_DRAW_TO_WINDOW
- if self._double_buffer:
- flags |= wgl.PFD_DOUBLEBUFFER | wgl.PFD_SWAP_EXCHANGE
- else:
- flags |= wgl.PFD_DOUBLEBUFFER_DONTCARE
- if mode == 'pixmap' or mode == 'both':
- #print "GLConfig: requesting pixmap drawing" ###
- flags |= wgl.PFD_DRAW_TO_BITMAP | wgl.PFD_SUPPORT_GDI
- if not self._depth_buffer:
- flags |= wgl.PFD_DEPTH_DONTCARE
- if self._stereo:
- flags |= wgl.PFD_STEREO
- else:
- flags |= wgl.PFD_STEREO_DONTCARE
- pf.dwFlags = flags & 0xffffffff
- pf.iPixelType = wgl.PFD_TYPE_RGBA
- #pf.cColorBits = 3 * self._color_size
- #pf.cColorBits = 32 ###
- pf.cRedBits = pf.cGreenBits = pf.cBluedBits = self._color_size
- if self._alpha:
- pf.cAlphaBits = self._alpha_size
- pf.cAuxBuffers = self._aux_buffers
- if self._depth_buffer:
- pf.cDepthBits = self._depth_size
- if self._stencil_buffer:
- pf.cStencilBits = self._stencil_size
- if self._accum_buffer:
- pf.cAccumBits = 3 * self._accum_size
- pf.iLayerType = wgl.PFD_MAIN_PLANE
- return pf
-
- def _from_win_pixelformat(cls, pf):
- self = cls.__new__(cls)
- flags = pf.dwFlags
- self._double_buffer = flags & wgl.PFD_DOUBLEBUFFER != 0
- self._alpha = pf.cAlphaSize > 0
- self._color_size = pf.cColorBits
- self._alpha_size = pf.cAlphaSize
- self._stereo = flags & wgl.PFD_STEREO != 0
- self._aux_buffers = pf.cAuxBuffers
- self._depth_buffer = pf.cDepthBits > 0
- self._depth_size = pf.cDepthBits
- self._stencil_buffer = pf.cStencilBits > 0
- self._stencil_size = pf.cStencilBits
- self._accum_size = pf.cAccumBits
- self._accum_buffer = self._accum_size > 0
- self._multisample = False
- self._samples_per_pixel = 1
- return self
-
- def _check_win_pixelformat(self, pf, mode):
- flags = pf.dwFlags
- if mode == 'screen' or mode == 'both':
- if not flags & wgl.PFD_DRAW_TO_WINDOW:
- raise GLConfigError("Rendering to screen not supported")
- if mode == 'pixmap' or mode == 'both':
- if not flags & wgl.PFD_DRAW_TO_BITMAP:
- raise GLConfigError("Rendering to pixmap not supported")
- if self._alpha and pf.cAlphaBits == 0:
- raise GLConfigError("Alpha channel not available")
- if self._stereo and not flags & wgl.PFD_STEREO:
- raise GLConfigError("Stereo buffer not available")
- if self._aux_buffers and pf.cAuxBuffers == 0:
- raise GLConfigError("Auxiliary buffers not available")
- if self._depth_buffer and pf.cDepthBits == 0:
- raise GLConfigError("Depth buffer not available")
- if self._stencil_buffer and pf.cStencilBits == 0:
- raise GLConfigError("Stencil buffer not available")
- if self.accum_buffer and pf.cAccumBits == 0:
- raise GLConfigError("Accumulation buffer not available")
-
- def _win_supported_pixelformat(self, hdc, mode):
- reqpf = self._as_win_pixelformat(mode)
- #print "GLConfig._win_supported_pixelformat" ###
- #print "Requested format:" ###
- #win_dump_pixelformat(reqpf) ###
- #print "GLConfig: Choosing pixel format for hdc", hdc ###
- ipf = wgl.ChoosePixelFormat(hdc, reqpf)
- #print "... result =", ipf ###
- actpf = wgl.PIXELFORMATDESCRIPTOR()
- #print "GLConfig: Describing pixel format", ipf, "for hdc", hdc ###
- wgl.DescribePixelFormat(hdc, ipf, actpf.nSize, actpf)
- #print "Actual format:" ###
- #win_dump_pixelformat(actpf) ###
- return ipf, actpf
-
- def supported(self, mode = 'both'):
- dc = win_none.GetDC()
- hdc = dc.GetSafeHdc()
- ipf, actpf = self._win_supported_pixelformat(hdc, mode)
- win_none.ReleaseDC(dc)
- return GLConfig._from_win_pixelformat(actpf)
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- def __init__(self, config = None, share_group = None, **kwds):
- config = GLConfig._from_args(config, kwds)
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_style, win_default_rect,
- win_none, 0)
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- GLContext.__init__(self, share_group, config, hdc, 'screen')
- GGLView.__init__(self, _win = win)
- self.set(**kwds)
- self._with_context(hdc, self._init_context)
- win.ReleaseDC(dc)
-
-# def _init_context(self):
-# print "GL_VENDOR:", gl.glGetString(gl.GL_VENDOR)
-# print "GL_RENDERER:", gl.glGetString(gl.GL_RENDERER)
-# print "GL_VERSION:", gl.glGetString(gl.GL_VERSION)
-# print "GL_EXTENSIONS:"
-# for name in gl.glGetString(gl.GL_EXTENSIONS).split():
-# print " ", name
-# GGLView._init_context(self)
-
- def destroy(self):
- GLContext.destroy(self)
- GGLView.destroy(self)
-
- def with_context(self, proc, flush = False):
- win = self._win
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- try:
- self._with_context(hdc, proc, flush)
- finally:
- win.ReleaseDC(dc)
-
- def OnPaint(self):
- #print "GLView.OnPaint" ###
- win = self._win
- dc, ps = win.BeginPaint()
- try:
- hdc = dc.GetSafeHdc()
- self._with_context(hdc, self._render, True)
- finally:
- win.EndPaint(ps)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
-#------------------------------------------------------------------------------
-
-#class GLPixmap(GGLPixmap):
-#
-# def __init__(self, width, height, config = None, share_group = None, **kwds):
-# print "GLPixmap:", width, height, kwds ###
-# config = GLConfig._from_args(config, kwds)
-# image = gdi.Bitmap(width, height)
-# self._win_image = image
-# graphics = gdi.Graphics.from_image(image)
-# self._win_graphics = graphics
-# hdc = graphics.GetHDC()
-# self._win_hdc = hdc
-# GLContext.__init__(self, share_group, config, hdc, 'pixmap')
-# self._with_context(hdc, self._init_context)
-# print "GLPixmap: done" ###
-#
-# def __del__(self):
-# graphics = self._win_graphics
-# graphics.ReleaseHDC(self._win_hdc)
-#
-# def with_context(self, proc, flush = False):
-# try:
-# self._with_context(self._hdc, proc, flush)
-# finally:
-# graphics.ReleaseHDC(hdc)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- #print "GLPixmap:", width, height, kwds ###
- config = GLConfig._from_args(config, kwds)
- dc0 = win_none.GetDC()
- dc = dc0.CreateCompatibleDC(dc0)
- bm = ui.CreateBitmap()
- bm.CreateCompatibleBitmap(dc0, width, height)
- win_none.ReleaseDC(dc0)
- dc.SelectObject(bm)
- self._win_dc = dc
- self._win_bm = bm
- hdc = dc.GetSafeHdc()
- win_dump_bitmap(bm) ###
- GLContext.__init__(self, share_group, config, hdc, 'pixmap')
- self._with_context(hdc, self._init_context)
- #print "GLPixmap: done" ###
-
- def with_context(self, proc, flush = False):
- hdc = self._win_dc.GetSafeHdc()
- self._with_context(hdc, proc, flush)
-
-#------------------------------------------------------------------------------
-
-def win_dump_pixelformat(pf):
- print "nSize =", pf.nSize
- print "nVersion =", pf.nVersion
- print "dwFlags = 0x%08x" % pf.dwFlags
- print "iPixelType =", pf.iPixelType
- print "cColorBits =", pf.cColorBits
- print "cRedBits =", pf.cRedBits
- print "cRedShift =", pf.cRedShift
- print "cGreenBits =", pf.cGreenBits
- print "cGreenShift =", pf.cGreenShift
- print "cBlueBits =", pf.cBlueBits
- print "cBlueShift =", pf.cBlueShift
- print "cAlphaBits =", pf.cAlphaBits
- print "cAlphaShift =", pf.cAlphaShift
- print "cAccumBits =", pf.cAccumBits
- print "cAccumRedBits =", pf.cAccumRedBits
- print "cAccumGreenBits =", pf.cAccumGreenBits
- print "cAccumBlueBits =", pf.cAccumBlueBits
- print "cDepthBits =", pf.cDepthBits
- print "cStencilBits =", pf.cStencilBits
- print "cAuxBuffers =", pf.cAuxBuffers
- print "iLayerType =", pf.iLayerType
- print "bReserved =", pf.bReserved
- print "dwLayerMask =", pf.dwLayerMask
- print "dwVisibleMask =", pf.dwVisibleMask
- print "dwDamageMask =", pf.dwDamageMask
-
-def win_dump_bitmap(bm):
- info = bm.GetInfo()
- print "bmType =", info['bmType']
- print "bmWidth =", info['bmWidth']
- print "bmHeight =", info['bmHeight']
- print "bmWidthBytes =", info['bmWidthBytes']
- print "bmPlanes =", info['bmPlanes']
- print "bmBitsPixel =", info['bmBitsPixel']
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Win32/GLContexts.py b/PyGUI-2.5.3/GUI/Win32/GLContexts.py
deleted file mode 100644
index ca3ee26..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GLContexts.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - GLContext - Win32
-#
-#------------------------------------------------------------------------------
-
-import OpenGL as gl
-from OpenGL import WGL as wgl
-from GUI.GGLContexts import GLContext as GGLContext
-
-class GLContext(GGLContext):
- # _win_dc Device context
- # _win_context WGL context
- # _win_dblbuf Is double buffered
-
- def __init__(self, share_group, config, hdc, mode):
- #print "GLContext: mode =", mode ###
- GGLContext.__init__(self, share_group)
- shared_context = self._get_shared_context()
- if shared_context:
- share_ctx = shared_context._win_context
- else:
- share_ctx = None
- ipf, actpf = config._win_supported_pixelformat(hdc, mode)
- config._check_win_pixelformat(actpf, mode)
- #print "GLContext: Setting pixel format", ipf, "for hdc", hdc ###
- wgl.SetPixelFormat(hdc, ipf, actpf)
- #print "GLContext: Creating context for hdc", hdc ###
- ctx = wgl.wglCreateContext(hdc)
- if share_ctx:
- wgl.wglShareLists(share_ctx, ctx)
- self._win_context = ctx
- self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
-
- def destroy(self):
- wgl.wglDeleteContext(self._win_context)
-
- def _with_context(self, hdc, proc, flush = False):
- old_hdc = wgl.wglGetCurrentDC()
- old_ctx = wgl.wglGetCurrentContext()
- result = wgl.wglMakeCurrent(hdc, self._win_context)
- try:
- self._with_share_group(proc)
- if flush:
- if self._win_dblbuf:
- wgl.SwapBuffers(hdc)
- else:
- gl.glFlush()
- finally:
- wgl.wglMakeCurrent(old_hdc, old_ctx)
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Win32/GLContexts_arb.py b/PyGUI-2.5.3/GUI/Win32/GLContexts_arb.py
deleted file mode 100644
index 1b9d85a..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GLContexts_arb.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - GLContext - Win32
-#
-#------------------------------------------------------------------------------
-
-import OpenGL as gl
-from OpenGL import WGL as wgl
-import WGL
-from GUI.GGLContexts import GLContext as GGLContext
-
-class GLContext(GGLContext):
- # _win_context WGL context
- # _win_dblbuf Is double buffered
-
- def __init__(self, share_group, config, hdc, mode):
- print "GLContext: mode =", mode ###
- GGLContext.__init__(self, share_group)
- shared_context = self._get_shared_context()
- if shared_context:
- share_ctx = shared_context._win_context
- else:
- share_ctx = None
- ipf, act_attrs = config._win_supported_pixelformat(hdc, mode)
- if ipf is None:
- raise GLConfigError
- #config._check_win_pixelattrs(act_attrs, mode)
- print "GLContext: Setting pixel format", ipf, "for hdc", hdc ###
- WGL.SetPixelFormat(hdc, ipfs)
- ctx = wgl.wglCreateContext(hdc)
- if share_ctx:
- wgl.wglShareLists(share_ctx, ctx)
- self._win_context = ctx
- self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
-
- def destroy(self):
- wgl.wglDeleteContext(self._win_context)
-
- def _with_context(self, hdc, proc, flush = False):
- old_hdc = wgl.wglGetCurrentDC()
- old_ctx = wgl.wglGetCurrentContext()
- result = wgl.wglMakeCurrent(hdc, self._win_context)
- try:
- self._with_share_group(proc)
- if flush:
- if self._win_dblbuf:
- wgl.SwapBuffers(hdc)
- else:
- gl.glFlush()
- finally:
- wgl.wglMakeCurrent(old_hdc, old_ctx)
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Win32/GLContexts_nonarb.py b/PyGUI-2.5.3/GUI/Win32/GLContexts_nonarb.py
deleted file mode 100644
index 3db0d41..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GLContexts_nonarb.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - GLContext - Win32
-#
-#------------------------------------------------------------------------------
-
-import OpenGL as gl
-from OpenGL import WGL as wgl
-from GUI.GGLContexts import GLContext as GGLContext
-
-class GLContext(GGLContext):
- # _win_dc Device context
- # _win_context WGL context
- # _win_dblbuf Is double buffered
-
- def __init__(self, share_group, config, hdc, mode):
- print "GLContext: mode =", mode ###
- GGLContext.__init__(self, share_group)
- shared_context = self._get_shared_context()
- if shared_context:
- share_ctx = shared_context._win_context
- else:
- share_ctx = None
- ipf, actpf = config._win_supported_pixelformat(hdc, mode)
- config._check_win_pixelformat(actpf, mode)
- print "GLContext: Setting pixel format", ipf, "for hdc", hdc ###
- wgl.SetPixelFormat(hdc, ipf, actpf)
- print "GLContext: Creating context for hdc", hdc ###
- ctx = wgl.wglCreateContext(hdc)
- if share_ctx:
- wgl.wglShareLists(share_ctx, ctx)
- self._win_context = ctx
- self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
-
- def destroy(self):
- wgl.wglDeleteContext(self._win_context)
-
- def _with_context(self, hdc, proc, flush = False):
- old_hdc = wgl.wglGetCurrentDC()
- old_ctx = wgl.wglGetCurrentContext()
- result = wgl.wglMakeCurrent(hdc, self._win_context)
- try:
- self._with_share_group(proc)
- if flush:
- if self._win_dblbuf:
- wgl.SwapBuffers(hdc)
- else:
- gl.glFlush()
- finally:
- wgl.wglMakeCurrent(old_hdc, old_ctx)
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Win32/GLTextures.py b/PyGUI-2.5.3/GUI/Win32/GLTextures.py
deleted file mode 100644
index c3fb318..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GLTextures.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Win32
-#
-
-from GUI.GGLTextures import Texture as GTexture
-
-class Texture(GTexture):
-
- def _gl_get_texture_data(self, image):
- raise NotImplementedError("Loading texture from image not yet implemented for Win32")
diff --git a/PyGUI-2.5.3/GUI/Win32/GL_arb.py b/PyGUI-2.5.3/GUI/Win32/GL_arb.py
deleted file mode 100644
index 6a4d167..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GL_arb.py
+++ /dev/null
@@ -1,264 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - OpenGL - Win32
-#
-#------------------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui
-import GDIPlus as gdi
-import WGL
-from GUI.Components import win_none
-from GUI.OpenGL import WGL as wgl
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-
-win_style = wc.WS_VISIBLE | wc.WS_CLIPCHILDREN | wc.WS_CLIPSIBLINGS
-win_default_size = GGLView._default_size
-win_default_rect = (0, 0, win_default_size[0], win_default_size[1])
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- def _as_win_pixelattrs(self, mode):
- print "GLConfig._as_arb_pixelattrs: mode =", mode ###
- attrs = {}
- attrs[wgl.WGL_SUPPORT_OPENGL_ARB] = True
- if mode == 'screen' or mode == 'both':
- print "GLConfig: requesting screen drawing" ###
- attrs[wgl.WGL_DRAW_TO_WINDOW_ARB] = True
- if self._double_buffer:
- attrs[wgl.WGL_DOUBLE_BUFFER_ARB] = True
- if mode == 'pixmap' or mode == 'both':
- print "GLConfig: requesting pixmap drawing" ###
- attrs[wgl.WGL_DRAW_TO_PBUFFER_ARB] = True
- if self._stereo:
- attrs[wgl.WGL_STEREO_ARB] = True
- attrs[wgl.WGL_PIXEL_TYPE_ARB] = wgl.WGL_TYPE_RGBA_ARB
- bits = self._color_size
- attrs[wgl.WGL_RED_BITS_ARB] = bits
- attrs[wgl.WGL_GREEN_BITS_ARB] = bits
- attrs[wgl.WGL_BLUE_BITS_ARB] = bits
- if self._alpha:
- attrs[wgl.WGL_ALPHA_BITS_ARB] = self._alpha_size
- attrs[wgl.WGL_AUX_BUFFERS_ARB] = self._aux_buffers
- if self._depth_buffer:
- attrs[wgl.WGL_DEPTH_BITS_ARB] = self._depth_size
- if self._stencil_buffer:
- attrs[wgl.WGL_STENCIL_BITS_ARB] = self._stencil_size
- if self._accum_buffer:
- bits = self._accum_size
- attrs[wgl.WGL_ACCUM_RED_BITS_ARB] = bits
- attrs[wgl.WGL_ACCUM_GREEN_BITS_ARB] = bits
- attrs[wgl.WGL_ACCUM_BLUE_BITS_ARB] = bits
- return attrs
-
- def _from_win_pixelattrs(cls, attrs):
- self = cls.__new__(cls)
- self._double_buffer = attrs[wgl.WGL_DOUBLE_BUFFER_ARB]
- self._color_size = attrs[wgl.WGL_COLOR_BITS_ARB] // 3
- self._alpha_size = attrs[wgl.WGL_ALPHA_BITS_ARB]
- self._alpha = self._alpha_size > 0
- self._stereo = attrs[wgl.WGL_STEREO_ARB] #flags & wgl.PFD_STEREO != 0
- self._aux_buffers = attrs[wgl.WGL_AUX_BUFFERS_ARB] > 0
- self._depth_size = attrs[wgl.WGL_DEPTH_BITS_ARB]
- self._depth_buffer = self._depth_size > 0
- self._stencil_size = attrs[wgl.WGL_STENCIL_BITS_ARB]
- self._stencil_buffer = self._stencil_bits > 0
- self._accum_size = attrs[wgl.WGL_ACCUM_BITS_ARB] // 3
- self._accum_buffer = self._accum_size > 0
- self._multisample = False
- self._samples_per_pixel = 1
- return self
-
-# def _check_win_pixelattrs(self, attrs, mode):
-# if mode == 'screen' or mode == 'both':
-# if not attrs[wgl.WGL_DRAW_TO_WINDOW_ARB]:
-# raise GLConfigError("Rendering to screen not supported")
-# if mode == 'pixmap' or mode == 'both':
-# if not attrs[wgl.WGL_DRAW_TO_PBUFFER_ARB]:
-# raise GLConfigError("Rendering to pixmap not supported")
-# if self._alpha and attrs[wgl.WGL_ALPHA_BITS_ARB] == 0:
-# raise GLConfigError("Alpha channel not available")
-# if self._stereo and not attrs[wgl.WGL_STEREO_ARB]:
-# raise GLConfigError("Stereo buffer not available")
-# if self._aux_buffers and attrs]wgl.WGL_AUX_BUFFERS_ARB] == 0:
-# raise GLConfigError("Auxiliary buffers not available")
-# if self._depth_buffer and attrs[wgl.WGL_DEPTH_BITS_ARB] == 0:
-# raise GLConfigError("Depth buffer not available")
-# if self._stencil_buffer and attrs[wgl.WGL_STENCIL_BITS] == 0:
-# raise GLConfigError("Stencil buffer not available")
-# if self.accum_buffer and attrs[wgl.WGL_ACCUM_BITS] == 0:
-# raise GLConfigError("Accumulation buffer not available")
-
- _win_query_pixelattr_keys = [
- wgl.WGL_SUPPORT_OPENGL_ARB,
- wgl.WGL_DRAW_TO_WINDOW_ARB,
- wgl.WGL_DOUBLE_BUFFER_ARB,
- wgl.WGL_DRAW_TO_PBUFFER_ARB,
- wgl.WGL_STEREO_ARB,
- wgl.WGL_PIXEL_TYPE_ARB,
- wgl.WGL_COLOR_BITS_ARB,
- wgl.WGL_ALPHA_BITS_ARB,
- wgl.WGL_AUX_BUFFERS_ARB,
- wgl.WGL_DEPTH_BITS_ARB,
- wgl.WGL_STENCIL_BITS_ARB,
- wgl.WGL_ACCUM_BITS_ARB,
- ]
-
- def _win_supported_pixelformat(self, hdc, mode):
- req_attrs = self._as_win_pixelattrs(mode)
- print "GLConfig: Choosing pixel format for hdc", hdc ###
- print "Requested attributes:", req_attrs ###
- req_array = WGL.attr_array(req_attrs)
- print "Requested array:", req_array ###
- ipfs, nf = wgl.wglChoosePixelFormatEXT(hdc, req_array, None, 1)
- print "Pixel formats:", ipfs ###
- print "No. of formats:", nf ###
- if not ipfs:
- req_attrs[wgl.WGL_DOUBLE_BUFFER_ARB] = not self._double_buffer
- req_array = WGL.attr_array(req_attrs)
- ipfs, nf = wglChoosePixelFormatARB(hdc, req_array, None, 1)
- if not ipfs:
- return None, None
- print "GLConfig: Describing pixel format", ipf, "for hdc", hdc ###
- keys = _win_query_pixelattr_keys
- values = wglGetPixelFormatAttribivARB(hdc, ipf, 0, keys)
- print "Actual values:", values ###
- act_attrs = WGL.attr_dict(keys, values)
- print "Actual attrs:", act_attrs ###
- return ipfs[0], act_attrs
-
- def supported(self, mode = 'both'):
- dc = win_none.GetDC()
- hdc = dc.GetSafeHdc()
- ipf, act_attrs = self._win_supported_pixelformat(hdc, mode)
- win_none.ReleaseDC(dc)
- if ipf is None:
- return None
- return GLConfig._from_win_pixelattrs(act_attrs)
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- def __init__(self, config = None, share_group = None, **kwds):
- config = GLConfig._from_args(config, kwds)
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_style, win_default_rect,
- win_none, 0)
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- GLContext.__init__(self, share_group, config, hdc, 'screen')
- GGLView.__init__(self, _win = win, **kwds)
- self._with_context(hdc, self._init_context)
- win.ReleaseDC(dc)
-
- def destroy(self):
- GLContext.destroy(self)
- GGLView.destroy(self)
-
- def with_context(self, proc, flush = False):
- win = self._win
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- try:
- self._with_context(hdc, proc, flush)
- finally:
- win.ReleaseDC(dc)
-
- def OnPaint(self):
- #print "GLView.OnPaint" ###
- win = self._win
- dc, ps = win.BeginPaint()
- try:
- hdc = dc.GetSafeHdc()
- self._with_context(hdc, self.render, True)
- finally:
- win.EndPaint(ps)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
-#------------------------------------------------------------------------------
-
-#class GLPixmap(GGLPixmap):
-#
-# def __init__(self, width, height, config = None, share_group = None, **kwds):
-# print "GLPixmap:", width, height, kwds ###
-# config = GLConfig._from_args(config, kwds)
-# image = gdi.Bitmap(width, height)
-# self._win_image = image
-# graphics = gdi.Graphics.from_image(image)
-# self._win_graphics = graphics
-# hdc = graphics.GetHDC()
-# self._win_hdc = hdc
-# GLContext.__init__(self, share_group, config, hdc, 'pixmap')
-# self._with_context(hdc, self._init_context)
-# print "GLPixmap: done" ###
-#
-# def __del__(self):
-# graphics = self._win_graphics
-# graphics.ReleaseHDC(self._win_hdc)
-#
-# def with_context(self, proc, flush = False):
-# try:
-# self._with_context(self._hdc, proc, flush)
-# finally:
-# graphics.ReleaseHDC(hdc)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- print "GLPixmap:", width, height, kwds ###
- config = GLConfig._from_args(config, kwds)
- pyhdc = gui.CreateCompatibleDC(0)
- dc = ui.CreateDCFromHandle(pyhdc)
- hdc = dc.GetSafeHdc()
- hbm = gui.CreateCompatibleBitmap(hdc, width, height)
- bm = ui.CreateBitmapFromHandle(hbm)
- dc.SelectObject(bm)
- self._win_dc = dc
- self._win_hbm = hbm
- self._win_bm = bm
- GLContext.__init__(self, share_group, config, hdc, 'pixmap')
- self._with_context(hdc, self._init_context)
- print "GLPixmap: done" ###
-
- def with_context(self, proc, flush = False):
- hdc = self._win_dc.GetSafeHdc()
- self._with_context(hdc, proc, flush)
-
-#------------------------------------------------------------------------------
-
-def win_dump_pixelformat(pf):
- print "nSize =", pf.nSize
- print "nVersion =", pf.nVersion
- print "dwFlags = 0x%08x" % pf.dwFlags
- print "iPixelType =", pf.iPixelType
- print "cColorBits =", pf.cColorBits
- print "cRedBits =", pf.cRedBits
- print "cRedShift =", pf.cRedShift
- print "cGreenBits =", pf.cGreenBits
- print "cGreenShift =", pf.cGreenShift
- print "cBlueBits =", pf.cBlueBits
- print "cBlueShift =", pf.cBlueShift
- print "cAlphaBits =", pf.cAlphaBits
- print "cAlphaShift =", pf.cAlphaShift
- print "cAccumBits =", pf.cAccumBits
- print "cAccumRedBits =", pf.cAccumRedBits
- print "cAccumGreenBits =", pf.cAccumGreenBits
- print "cAccumBlueBits =", pf.cAccumBlueBits
- print "cDepthBits =", pf.cDepthBits
- print "cStencilBits =", pf.cStencilBits
- print "cAuxBuffers =", pf.cAuxBuffers
- print "iLayerType =", pf.iLayerType
- print "bReserved =", pf.bReserved
- print "dwLayerMask =", pf.dwLayerMask
- print "dwVisibleMask =", pf.dwVisibleMask
- print "dwDamageMask =", pf.dwDamageMask
diff --git a/PyGUI-2.5.3/GUI/Win32/GL_nonarb.py b/PyGUI-2.5.3/GUI/Win32/GL_nonarb.py
deleted file mode 100644
index 67ba5bc..0000000
--- a/PyGUI-2.5.3/GUI/Win32/GL_nonarb.py
+++ /dev/null
@@ -1,258 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - OpenGL - Win32
-#
-#------------------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui
-import GUI.GDIPlus as gdi
-from GUI.Components import win_none
-from GUI.OpenGL import WGL as wgl
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-
-win_style = wc.WS_VISIBLE | wc.WS_CLIPCHILDREN | wc.WS_CLIPSIBLINGS
-win_default_size = GGLView._default_size
-win_default_rect = (0, 0, win_default_size[0], win_default_size[1])
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- def _as_win_pixelformat(self, mode):
- print "GLConfig._as_win_pixelformat: mode =", mode ###
- pf = wgl.PIXELFORMATDESCRIPTOR()
- flags = wgl.PFD_SUPPORT_OPENGL
- if mode == 'screen' or mode == 'both':
- print "GLConfig: requesting screen drawing" ###
- flags |= wgl.PFD_DRAW_TO_WINDOW
- if self._double_buffer:
- flags |= wgl.PFD_DOUBLEBUFFER | wgl.PFD_SWAP_EXCHANGE
- else:
- flags |= wgl.PFD_DOUBLEBUFFER_DONTCARE
- if mode == 'pixmap' or mode == 'both':
- print "GLConfig: requesting pixmap drawing" ###
- flags |= wgl.PFD_DRAW_TO_BITMAP | wgl.PFD_SUPPORT_GDI
- if not self._depth_buffer:
- flags |= wgl.PFD_DEPTH_DONTCARE
- if self._stereo:
- flags |= wgl.PFD_STEREO
- else:
- flags |= wgl.PFD_STEREO_DONTCARE
- pf.dwFlags = flags & 0xffffffff
- pf.iPixelType = wgl.PFD_TYPE_RGBA
- #pf.cColorBits = 3 * self._color_size
- pf.cColorBits = 32 ###
- pf.cAlphaBits = 8 ###
- pf.cAlphaShift = 24 ###
- if self._alpha:
- pf.cAlphaBits = self._alpha_size
- pf.cAuxBuffers = self._aux_buffers
- if self._depth_buffer:
- pf.cDepthBits = self._depth_size
- if self._stencil_buffer:
- pf.cStencilBits = self._stencil_size
- if self._accum_buffer:
- pf.cAccumBits = 3 * self._accum_size
- pf.iLayerType = wgl.PFD_MAIN_PLANE
- return pf
-
- def _from_win_pixelformat(cls, pf):
- self = cls.__new__(cls)
- flags = pf.dwFlags
- self._double_buffer = flags & wgl.PFD_DOUBLEBUFFER != 0
- self._alpha = pf.cAlphaSize > 0
- self._color_size = pf.cColorBits
- self._alpha_size = pf.cAlphaSize
- self._stereo = flags & wgl.PFD_STEREO != 0
- self._aux_buffers = pf.cAuxBuffers
- self._depth_buffer = pf.cDepthBits > 0
- self._depth_size = pf.cDepthBits
- self._stencil_buffer = pf.cStencilBits > 0
- self._stencil_size = pf.cStencilBits
- self._accum_size = pf.cAccumBits
- self._accum_buffer = self._accum_size > 0
- self._multisample = False
- self._samples_per_pixel = 1
- return self
-
- def _check_win_pixelformat(self, pf, mode):
- flags = pf.dwFlags
- if mode == 'screen' or mode == 'both':
- if not flags & wgl.PFD_DRAW_TO_WINDOW:
- raise GLConfigError("Rendering to screen not supported")
- if mode == 'pixmap' or mode == 'both':
- if not flags & wgl.PFD_DRAW_TO_BITMAP:
- raise GLConfigError("Rendering to pixmap not supported")
- if self._alpha and pf.cAlphaBits == 0:
- raise GLConfigError("Alpha channel not available")
- if self._stereo and not flags & wgl.PFD_STEREO:
- raise GLConfigError("Stereo buffer not available")
- if self._aux_buffers and pf.cAuxBuffers == 0:
- raise GLConfigError("Auxiliary buffers not available")
- if self._depth_buffer and pf.cDepthBits == 0:
- raise GLConfigError("Depth buffer not available")
- if self._stencil_buffer and pf.cStencilBits == 0:
- raise GLConfigError("Stencil buffer not available")
- if self.accum_buffer and pf.cAccumBits == 0:
- raise GLConfigError("Accumulation buffer not available")
-
- def _win_supported_pixelformat(self, hdc, mode):
- reqpf = self._as_win_pixelformat(mode)
- print "GLConfig._win_supported_pixelformat" ###
- print "Requested format:" ###
- win_dump_pixelformat(reqpf) ###
- print "GLConfig: Choosing pixel format for hdc", hdc ###
- ipf = wgl.ChoosePixelFormat(hdc, reqpf)
- print "... result =", ipf ###
- actpf = wgl.PIXELFORMATDESCRIPTOR()
- print "GLConfig: Describing pixel format", ipf, "for hdc", hdc ###
- wgl.DescribePixelFormat(hdc, ipf, actpf.nSize, actpf)
- print "Actual format:" ###
- win_dump_pixelformat(actpf) ###
- return ipf, actpf
-
- def supported(self, mode = 'both'):
- dc = win_none.GetDC()
- hdc = dc.GetSafeHdc()
- ipf, actpf = self._win_supported_pixelformat(hdc, mode)
- win_none.ReleaseDC(dc)
- return GLConfig._from_win_pixelformat(actpf)
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- def __init__(self, config = None, share_group = None, **kwds):
- config = GLConfig._from_args(config, kwds)
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_style, win_default_rect,
- win_none, 0)
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- GLContext.__init__(self, share_group, config, hdc, 'screen')
- GGLView.__init__(self, _win = win, **kwds)
- self._with_context(hdc, self._init_context)
- win.ReleaseDC(dc)
-
- def destroy(self):
- GLContext.destroy(self)
- GGLView.destroy(self)
-
- def with_context(self, proc, flush = False):
- win = self._win
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- try:
- self._with_context(hdc, proc, flush)
- finally:
- win.ReleaseDC(dc)
-
- def OnPaint(self):
- #print "GLView.OnPaint" ###
- win = self._win
- dc, ps = win.BeginPaint()
- try:
- hdc = dc.GetSafeHdc()
- self._with_context(hdc, self.render, True)
- finally:
- win.EndPaint(ps)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- print "GLPixmap:", width, height, kwds ###
- config = GLConfig._from_args(config, kwds)
- image = gdi.Bitmap(width, height)
- self._win_image = image
- graphics = gdi.Graphics.from_image(image)
- self._win_graphics = graphics
- hdc = graphics.GetHDC()
- self._win_hdc = hdc
- GLContext.__init__(self, share_group, config, hdc, 'pixmap')
- self._with_context(hdc, self._init_context)
- print "GLPixmap: done" ###
-
- def __del__(self):
- graphics = self._win_graphics
- graphics.ReleaseHDC(self._win_hdc)
-
- def with_context(self, proc, flush = False):
- try:
- self._with_context(self._hdc, proc, flush)
- finally:
- graphics.ReleaseHDC(hdc)
-
-#------------------------------------------------------------------------------
-
-#class GLPixmap(GGLPixmap):
-#
-# def __init__(self, width, height, config = None, share_group = None, **kwds):
-# print "GLPixmap:", width, height, kwds ###
-# config = GLConfig._from_args(config, kwds)
-# dc0 = win_none.GetDC()
-# dc = dc0.CreateCompatibleDC(dc0)
-# bm = ui.CreateBitmap()
-# ###bm.CreateCompatibleBitmap(dc0, width, height)
-# bm.CreateCompatibleBitmap(dc0, 1, 1)
-# win_none.ReleaseDC(dc0)
-# dc.SelectObject(bm)
-# self._win_dc = dc
-# self._win_bm = bm
-# hdc = dc.GetSafeHdc()
-# win_dump_bitmap(bm) ###
-# GLContext.__init__(self, share_group, config, hdc, 'pixmap')
-# self._with_context(hdc, self._init_context)
-# print "GLPixmap: done" ###
-#
-# def with_context(self, proc, flush = False):
-# hdc = self._win_dc.GetSafeHdc()
-# self._with_context(hdc, proc, flush)
-
-#------------------------------------------------------------------------------
-
-def win_dump_pixelformat(pf):
- print "nSize =", pf.nSize
- print "nVersion =", pf.nVersion
- print "dwFlags = 0x%08x" % pf.dwFlags
- print "iPixelType =", pf.iPixelType
- print "cColorBits =", pf.cColorBits
- print "cRedBits =", pf.cRedBits
- print "cRedShift =", pf.cRedShift
- print "cGreenBits =", pf.cGreenBits
- print "cGreenShift =", pf.cGreenShift
- print "cBlueBits =", pf.cBlueBits
- print "cBlueShift =", pf.cBlueShift
- print "cAlphaBits =", pf.cAlphaBits
- print "cAlphaShift =", pf.cAlphaShift
- print "cAccumBits =", pf.cAccumBits
- print "cAccumRedBits =", pf.cAccumRedBits
- print "cAccumGreenBits =", pf.cAccumGreenBits
- print "cAccumBlueBits =", pf.cAccumBlueBits
- print "cDepthBits =", pf.cDepthBits
- print "cStencilBits =", pf.cStencilBits
- print "cAuxBuffers =", pf.cAuxBuffers
- print "iLayerType =", pf.iLayerType
- print "bReserved =", pf.bReserved
- print "dwLayerMask =", pf.dwLayerMask
- print "dwVisibleMask =", pf.dwVisibleMask
- print "dwDamageMask =", pf.dwDamageMask
-
-def win_dump_bitmap(bm):
- info = bm.GetInfo()
- print "bmType =", info['bmType']
- print "bmWidth =", info['bmWidth']
- print "bmHeight =", info['bmHeight']
- print "bmWidthBytes =", info['bmWidthBytes']
- print "bmPlanes =", info['bmPlanes']
- print "bmBitsPixel =", info['bmBitsPixel']
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/GUI/Win32/Geometry.py b/PyGUI-2.5.3/GUI/Win32/Geometry.py
deleted file mode 100755
index e81b148..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Geometry.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Geometry - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI.GGeometry import *
diff --git a/PyGUI-2.5.3/GUI/Win32/Image.py b/PyGUI-2.5.3/GUI/Win32/Image.py
deleted file mode 100644
index 0cf7b38..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Image.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Image - Win32
-#
-#--------------------------------------------------------------------
-
-import GDIPlus as gdi
-from GUI import export
-from GUI.GImages import Image as GImage
-
-class Image(GImage):
-
- def _init_from_file(self, path):
- self._win_image = gdi.Bitmap.from_file(path)
-
-export(Image)
diff --git a/PyGUI-2.5.3/GUI/Win32/ImageBase.py b/PyGUI-2.5.3/GUI/Win32/ImageBase.py
deleted file mode 100644
index 2f935c8..0000000
--- a/PyGUI-2.5.3/GUI/Win32/ImageBase.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - ImageBase - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI import export
-from GUI.GImageBases import ImageBase as GImageBase
-
-class ImageBase(GImageBase):
- # _win_image GdiPlus.Image
-
- def get_width(self):
- return self._win_image.GetWidth()
-
- def get_height(self):
- return self._win_image.GetHeight()
-
- def draw(self, canvas, src_rect, dst_rect):
- canvas._win_graphics.DrawImage_rr(self._win_image, dst_rect, src_rect)
-
-export(ImageBase)
diff --git a/PyGUI-2.5.3/GUI/Win32/Label.py b/PyGUI-2.5.3/GUI/Win32/Label.py
deleted file mode 100644
index a562e5b..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Label.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Label - Win32
-#
-#--------------------------------------------------------------------
-
-from math import ceil
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.StdColors import black
-from GUI.StdFonts import system_font
-from GUI.WinUtils import win_none
-from GUI.GLabels import Label as GLabel
-
-win_style = wc.WS_CLIPSIBLINGS | wc.WS_VISIBLE
-
-win_dt_format = wc.DT_NOPREFIX | wc.DT_SINGLELINE | wc.DT_NOCLIP
-
-win_dt_align_map = {
- 'l': wc.DT_LEFT | win_dt_format,
- 'c': wc.DT_CENTER | win_dt_format,
- 'r': wc.DT_RIGHT | win_dt_format,
-}
-
-#--------------------------------------------------------------------
-
-class Label(GLabel):
-
- _win_transparent = True
-
- _font = None
- _color = black
- _just = 'l'
-
- def __init__(self, text = "New Label", **kwds):
- self._set_lines(text)
- lines = self._lines
- font = self._win_predict_font(kwds)
- w = 0
- for line in lines:
- w = max(w, font.width(line))
- w = int(ceil(w))
- h = self._calc_height(font, len(lines))
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_style, (0, 0, w, h), win_none, 0)
- #win.ModifyStyleEx(0, wc.WS_EX_TRANSPARENT, 0)
- GLabel.__init__(self, _win = win, **kwds)
-
- def get_text(self):
- return "\n".join(self._lines)
-
- def set_text(self, x):
- self._set_lines(x)
- self.invalidate()
-
- def _set_lines(self, x):
- self._lines = x.split("\n")
-
- def OnPaint(self):
- win = self._win
- dc, paint_struct = win.BeginPaint()
- font = self._font
- win_font = font._win_font
- dc.SetBkMode(wc.TRANSPARENT)
- dc.SelectObject(win_font)
- c = self._color._win_color
- #print "Label.OnPaint: win color = 0x%08x" % c
- dc.SetTextColor(c)
- rm = self.width
- y = 0
- h = font.line_height
- just = self._just[:1]
- dt_format = win_dt_align_map[just]
- for line in self._lines:
- r = (0, y, rm, y + h)
- dc.DrawText(line, r, dt_format)
- y += h
- win.EndPaint(paint_struct)
-
-export(Label)
-
diff --git a/PyGUI-2.5.3/GUI/Win32/ListButton.py b/PyGUI-2.5.3/GUI/Win32/ListButton.py
deleted file mode 100644
index ce46d56..0000000
--- a/PyGUI-2.5.3/GUI/Win32/ListButton.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - ListButton - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui
-from GUI import export
-from GUI.WinUtils import win_none
-from GUI.WinComboBox import CreateComboBox
-from GUI.GListButtons import ListButton as GListButton
-
-class ListButton(GListButton):
-
- _pass_key_events_to_platform = True
-
- def __init__(self, **kwds):
- titles, values = self._extract_initial_items(kwds)
- self._titles = titles
- self._values = values
- win = CreateComboBox(win_none, (0, 0), (100, 320), wc.CBS_DROPDOWNLIST)
- win.ShowWindow()
- self._win_update_items(win)
- GListButton.__init__(self, _win = win, **kwds)
-
- def _update_items(self):
- self._win_update_items(self._win)
-
- def _win_update_items(self, win):
- win.ResetContent()
- for title in self._titles:
- win.AddString(title)
-
- def _get_selected_index(self):
- return self._win.GetCurSel()
-
- def _set_selected_index(self, x):
- try:
- self._win.SetCurSel(x)
- except ui.error:
- pass
-
- def _cbn_sel_change(self):
- self.do_action()
-
-
-export(ListButton)
diff --git a/PyGUI-2.5.3/GUI/Win32/Menu.py b/PyGUI-2.5.3/GUI/Win32/Menu.py
deleted file mode 100644
index 9db062a..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Menu.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Menu - Win32
-#
-#--------------------------------------------------------------------
-
-import win32ui as ui, win32con as wc
-from GUI import export
-from GUI.WinMenus import win_command_to_id
-from GUI.GMenus import Menu as GMenu
-
-class Menu(GMenu):
-
- def __init__(self, *args, **kwds):
- GMenu.__init__(self, *args, **kwds)
-
- def _update_platform_menu(self):
- # Don't need to do anything here because platform menu item
- # states are updated by HookCommandUpdate handlers.
- pass
-
- def _win_create_menu(self):
- # Create a fresh platform menu reflecting the current items. Need
- # to do this because it's not possible to share submenu handles
- # between windows.
- self._rebuild_platform_menu()
- win_menu = self._win_menu
- self._win_menu = None # So we don't accidentally try to reuse it
- return win_menu
-
- def _clear_platform_menu(self):
- self._win_menu = ui.CreatePopupMenu()
-
-# def _clear_platform_menu(self):
-# #print "Menu._clear_platform_menu:", self ###
-# bypos = wc.MF_BYPOSITION
-# win_menu = self._win_menu
-# n = win_menu.GetMenuItemCount()
-# for i in xrange(n-1, -1, -1):
-# win_menu.DeleteMenu(i, bypos)
-
- def _add_separator_to_platform_menu(self):
- #print "Menu._add_separator_to_platform_menu:", self ###
- self._win_menu.AppendMenu(wc.MF_SEPARATOR, 0)
-
- def _add_item_to_platform_menu(self, item, name, command_name, *args):
- #print "Menu._add_item_to_platform_menu:", self, item, name ###
- win_text = name.replace("&", "&&")
- key = item._key
- if key:
- win_text += "\tCtrl+"
- if item._shift:
- win_text += "Shift+"
- if item._option:
- win_text += "Alt+"
- win_text += key
- flags = wc.MF_STRING
- # These are done by HookCommandUpdate handler
- #if not item.enabled:
- # flags |= wc.MF_GRAYED
- #if item.checked:
- # flags |= wc.MF_CHECKED
- id = win_command_to_id(command_name, *args)
- self._win_menu.AppendMenu(flags, id, win_text)
-
-export(Menu)
diff --git a/PyGUI-2.5.3/GUI/Win32/Numerical.py b/PyGUI-2.5.3/GUI/Win32/Numerical.py
deleted file mode 100644
index 2f99f42..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Numerical.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - NumPy interface - Windows
-#
-#--------------------------------------------------------------
-
-from numpy import ndarray, uint8
-from GUI import GDIPlus as gdi
-from GUI import Image
-
-def image_from_ndarray(array, format, size = None):
- """
- Creates an Image from a numpy ndarray object. The format
- may be 'RGB' or 'RGBA'. If a size is specified, the array
- will be implicitly reshaped to that size, otherwise the size
- is inferred from the first two dimensions of the array.
- """
- if array.itemsize <> 1:
- raise ValueError("Color component size must be 1 byte")
- if size is None:
- shape = array.shape
- if len(shape) <> 3:
- raise ValueError("Array has wrong number of dimensions")
- height, width, pixel_size = shape
- if pixel_size <> len(format):
- raise ValueError("Last dimension of array does not match format")
- else:
- width, height = size
- pixel_size = len(format)
- data_size = array.size
- if data_size <> width * height * pixel_size:
- raise ValueError("Array has wrong shape for specified size and format")
- shape = (height, width, pixel_size)
- array = array.reshape(shape)
- swapped = ndarray(shape, uint8)
- swapped[..., 0] = array[..., 2]
- swapped[..., 1] = array[..., 1]
- swapped[..., 2] = array[..., 0]
- if pixel_size == 4:
- fmt = gdi.PixelFormat32bppARGB
- swapped[..., 3] = array[..., 3]
- else:
- fmt = gdi.PixelFormat24bppRGB
- data = swapped.tostring()
- bitmap = gdi.Bitmap.from_data(width, height, fmt, data)
- image = Image.__new__(Image)
- image._win_image = bitmap
- image._data = data
- return image
diff --git a/PyGUI-2.5.3/GUI/Win32/PIL.py b/PyGUI-2.5.3/GUI/Win32/PIL.py
deleted file mode 100644
index 67df552..0000000
--- a/PyGUI-2.5.3/GUI/Win32/PIL.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - PIL interface - Windows
-#
-#--------------------------------------------------------------
-
-from __future__ import absolute_import
-from GUI import GDIPlus as gdi
-from GUI import Image
-from Image import merge
-
-def image_from_pil_image(pil_image):
- """Creates an Image from a Python Imaging Library (PIL)
- Image object."""
- pil_image.load()
- mode = pil_image.mode
- w, h = pil_image.size
- if mode == "RGB":
- r, g, b = pil_image.split()
- pil_image = merge(mode, (b, g, r))
- fmt = gdi.PixelFormat24bppRGB
- elif mode == "RGBA":
- r, g, b, a = pil_image.split()
- pil_image = merge(mode, (b, g, r, a))
- fmt = gdi.PixelFormat32bppARGB
- else:
- raise ValueError("Unsupported PIL image mode '%s'" % mode)
- data = pil_image.tostring()
- bitmap = gdi.Bitmap.from_data(w, h, fmt, data)
- image = Image.__new__(Image)
- image._win_image = bitmap
- image._data = data
- return image
diff --git a/PyGUI-2.5.3/GUI/Win32/Pixmap.py b/PyGUI-2.5.3/GUI/Win32/Pixmap.py
deleted file mode 100644
index 1ed6390..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Pixmap.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# Python GUI - Pixmaps - Win32
-#
-#--------------------------------------------------------------------------
-
-import GDIPlus as gdi
-from GUI import export
-from GUI import Canvas
-from GUI.GPixmaps import Pixmap as GPixmap
-
-class Pixmap(GPixmap):
-
- def __init__(self, width, height):
- self._win_image = gdi.Bitmap(width, height)
-
- def with_canvas(self, proc):
- proc(Canvas._from_win_image(self._win_image))
-
-export(Pixmap)
diff --git a/PyGUI-2.5.3/GUI/Win32/Printing.py b/PyGUI-2.5.3/GUI/Win32/Printing.py
deleted file mode 100644
index 8e5b9db..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Printing.py
+++ /dev/null
@@ -1,255 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Win32
-#
-#------------------------------------------------------------------------------
-
-import WinPageSetup as wps, WinPrint as wp
-import win32print as wp2
-from GUI.GPrinting import PageSetup as GPageSetup, Printable as GPrintable, \
- Paginator
-from GUI import Canvas
-
-#------------------------------------------------------------------------------
-
-win_paper_names = {
- 1: "Letter", # Letter 8 1/2 x 11 in
- 2: "Letter Small", # Letter Small 8 1/2 x 11 in
- 3: "Tabloid", # Tabloid 11 x 17 in
- 4: "Ledger", # Ledger 17 x 11 in
- 5: "Legal", # Legal 8 1/2 x 14 in
- 6: "Statement", # Statement 5 1/2 x 8 1/2 in
- 7: "Executive", # Executive 7 1/4 x 10 1/2 in
- 8: "A3", # A3 297 x 420 mm
- 9: "A4", # A4 210 x 297 mm
- 10: "A4 Small", # A4 Small 210 x 297 mm
- 11: "A5", # A5 148 x 210 mm
- 12: "B4 (JIS)", # B4 (JIS) 250 x 354
- 13: "B5 (JIS)", # B5 (JIS) 182 x 257 mm
- 14: "Folio", # Folio 8 1/2 x 13 in
- 15: "Quarto", # Quarto 215 x 275 mm
- 16: "10x14", # 10x14 in
- 17: "11x17", # 11x17 in
- 18: "Note", # Note 8 1/2 x 11 in
- 19: "Envelope #9", # Envelope #9 3 7/8 x 8 7/8
- 20: "Envelope #10", # Envelope #10 4 1/8 x 9 1/2
- 21: "Envelope #11", # Envelope #11 4 1/2 x 10 3/8
- 22: "Envelope #12", # Envelope #12 4 \276 x 11
- 23: "Envelope #14", # Envelope #14 5 x 11 1/2
- 24: "C Sheet", # C size sheet
- 25: "D Sheet", # D size sheet
- 26: "E Sheet", # E size sheet
- 27: "Envelope DL", # Envelope DL 110 x 220mm
- 28: "Envelope C5", # Envelope C5 162 x 229 mm
- 29: "Envelope C3", # Envelope C3 324 x 458 mm
- 30: "Envelope C4", # Envelope C4 229 x 324 mm
- 31: "Envelope C6", # Envelope C6 114 x 162 mm
- 32: "Envelope C65", # Envelope C65 114 x 229 mm
- 33: "Envelope B4", # Envelope B4 250 x 353 mm
- 34: "Envelope B5", # Envelope B5 176 x 250 mm
- 35: "Envelope B6", # Envelope B6 176 x 125 mm
- 36: "Envelope", # Envelope 110 x 230 mm
- 37: "Envelope Monarch", # Envelope Monarch 3.875 x 7.5 in
- 38: "6 3/4 Envelope", # 6 3/4 Envelope 3 5/8 x 6 1/2 in
- 39: "US Std Fanfold", # US Std Fanfold 14 7/8 x 11 in
- 40: "German Std Fanfold", # German Std Fanfold 8 1/2 x 12 in
- 41: "German Legal Fanfold", # German Legal Fanfold 8 1/2 x 13 in
- 42: "B4", # B4 (ISO) 250 x 353 mm
- 43: "Japanese Postcard", # Japanese Postcard 100 x 148 mm
- 44: "9x11", # 9 x 11 in
- 45: "10x11", # 10 x 11 in
- 46: "15x11", # 15 x 11 in
- 47: "Envelope Invite", # Envelope Invite 220 x 220 mm
- #48: "", # RESERVED--DO NOT USE
- #49: "", # RESERVED--DO NOT USE
- 50: "Letter Extra", # Letter Extra 9 \275 x 12 in
- 51: "Legal Extra", # Legal Extra 9 \275 x 15 in
- 52: "Tabloid Extra", # Tabloid Extra 11.69 x 18 in
- 53: "A4 Extra", # A4 Extra 9.27 x 12.69 in
- 54: "Letter Transverse", # Letter Transverse 8 \275 x 11 in
- 55: "A4 Transverse", # A4 Transverse 210 x 297 mm
- 56: "Letter Extra Transverse", # Letter Extra Transverse 9\275 x 12 in
- 57: "SuperA", # SuperA/SuperA/A4 227 x 356 mm
- 58: "SuperB", # SuperB/SuperB/A3 305 x 487 mm
- 59: "Letter Plus", # Letter Plus 8.5 x 12.69 in
- 60: "A4 Plus", # A4 Plus 210 x 330 mm
- 61: "A5 Transverse", # A5 Transverse 148 x 210 mm
- 62: "B5 (JIS) Transverse", # B5 (JIS) Transverse 182 x 257 mm
- 63: "A3 Extra", # A3 Extra 322 x 445 mm
- 64: "A5 Extra", # A5 Extra 174 x 235 mm
- 65: "B5 (ISO) Extra", # B5 (ISO) Extra 201 x 276 mm
- 66: "A2", # A2 420 x 594 mm
- 67: "A3 Transverse", # A3 Transverse 297 x 420 mm
- 68: "A3 Extra Transverse", # A3 Extra Transverse 322 x 445 mm
-}
-
-win_paper_codes = dict([(name, code)
- for (code, name) in win_paper_names.iteritems()])
-
-def ti_to_pts(x):
- return x * 0.072
-
-def pts_to_ti(x):
- return int(round(x / 0.072))
-
-#------------------------------------------------------------------------------
-
-class PageSetup(GPageSetup):
-
- def __new__(cls):
- self = GPageSetup.__new__(cls)
- self._win_psd = wps.get_defaults()
- return self
-
- def __init__(self):
- self.margins = (36, 36, 36, 36)
-
- def __getstate__(self):
- psd = self._win_psd
- state = GPageSetup.__getstate__(self)
- state['_win_devmode'] = wps.get_handle_contents(psd.hDevMode)
- state['_win_devnames'] = wps.get_handle_contents(psd.hDevNames)
- return state
-
- def __setstate__(self, state):
- psd = self._win_psd
- dm = state.pop('_win_devmode', None)
- dn = state.pop('_win_devnames', None)
- GPageSetup.__setstate__(self, state)
- if dm:
- wps.GlobalFree(psd.hDevMode)
- psd.hDevMode = handle_with_contents(dm)
- if dn:
- wps.GlobalFree(psd.hDevNames)
- psd.hDevNames = handle_with_contents(dn)
-
- def _win_lock_devmode(self):
- return wps.lock_devmode_handle(self._win_psd.hDevMode)
-
- def _win_unlock_devmode(self):
- wps.GlobalUnlock(self._win_psd.hDevMode)
-
- def get_printable_rect(self):
- psd = self._win_psd
- pw, ph = self.paper_size
- mm = psd.rtMinMargin
- ml = ti_to_pts(mm.left)
- mt = ti_to_pts(mm.top)
- mr = ti_to_pts(mm.right)
- mb = ti_to_pts(mm.bottom)
- return (ml, mt, pw - mr, ph - mb)
-
- def get_paper_name(self):
- dm = self._win_lock_devmode()
- result = win_paper_names.get(dm.dmPaperSize, "Custom")
- self._win_unlock_devmode()
- return result
-
- def set_paper_name(self, name):
- dm = self._win_lock_devmode()
- dm.dmPaperSize = win_paper_codes.get(name, 0)
- self._win_unlock_devmode()
-
- def get_paper_width(self):
- return ti_to_pts(self._win_psd.ptPaperSize.x)
-
- def get_paper_height(self):
- return ti_to_pts(self._win_psd.ptPaperSize.y)
-
- def set_paper_width(self, v):
- self._win_psd.ptPaperSize.x = pts_to_ti(v)
-
- def set_paper_height(self, v):
- self._win_psd.ptPaperSize.y = pts_to_ti(v)
-
- def get_left_margin(self):
- return ti_to_pts(self._win_psd.rtMargin.left)
-
- def get_top_margin(self):
- return ti_to_pts(self._win_psd.rtMargin.top)
-
- def get_right_margin(self):
- return ti_to_pts(self._win_psd.rtMargin.right)
-
- def get_bottom_margin(self):
- return ti_to_pts(self._win_psd.rtMargin.bottom)
-
- def set_left_margin(self, v):
- self._win_psd.rtMargin.left = pts_to_ti(v)
-
- def set_top_margin(self, v):
- self._win_psd.rtMargin.top = pts_to_ti(v)
-
- def set_right_margin(self, v):
- self._win_psd.rtMargin.right = pts_to_ti(v)
-
- def set_bottom_margin(self, v):
- self._win_psd.rtMargin.bottom = pts_to_ti(v)
-
- def get_orientation(self):
- dm = self._win_lock_devmode()
- result = win_orientation_names.get(dm.dmOrientation, 'portrait')
- self._win_unlock_devmode()
- return result
-
- def set_orientation(self, v):
- dm = self._win_lock_devmode()
- dm.dmOrientation = win_orientation_codes.get(v, 1)
- self._win_unlock_devmode()
-
- def get_printer_name(self):
- dm = self._win_lock_devmode()
- result = dm.dmDeviceName
- self._win_unlock_devmode()
- return result
-
- def set_printer_name(self, v):
- dm = self._win_lock_devmode()
- dm.dmDeviceName = v
- self._win_unlock_devmode()
-
-#------------------------------------------------------------------------------
-
-class Printable(GPrintable):
-
- def print_view(self, page_setup, prompt = True):
- paginator = Paginator(self, page_setup)
- psd = page_setup._win_psd
- pd = wp.PRINTDLG()
- pd.hDevMode = psd.hDevMode
- pd.hDevNames = psd.hDevNames
- pd.nMinPage = 1
- pd.nMaxPage = paginator.num_pages
- pd.nCopies = 1
- if wp.PrintDlg(pd):
- title = self.print_title
- di = wp.DOCINFO()
- di.lpszDocName = title
- devnames = wps.DevNames(psd.hDevNames)
- if devnames.output == "FILE:":
- from FileDialogs import request_new_file
- f = request_new_file("Print '%s' to file:" % title)
- if not f:
- return
- output_path = f.path
- di.lpszOutput = output_path
- try:
- hdc = pd.hDC
- dx, dy = wp.GetPrintingOffset(hdc)
- print "TODO: Printable: Implement a Cancel dialog" ###
- #wp.install_abort_proc(hdc)
- wp.StartDoc(hdc, di)
- for page_num in xrange(pd.nFromPage - 1, pd.nToPage):
- wp.StartPage(hdc)
- canvas = Canvas._from_win_hdc(hdc, for_printing = True)
- canvas.translate(-dx, -dy)
- paginator.draw_page(canvas, page_num)
- wp.EndPage(hdc)
- wp.EndDoc(hdc)
- finally:
- wp.DeleteDC(hdc)
-
-#------------------------------------------------------------------------------
-
-def present_page_setup_dialog(page_setup):
- return wps.PageSetupDlg(page_setup._win_psd)
diff --git a/PyGUI-2.5.3/GUI/Win32/RadioButton.py b/PyGUI-2.5.3/GUI/Win32/RadioButton.py
deleted file mode 100644
index 308b87d..0000000
--- a/PyGUI-2.5.3/GUI/Win32/RadioButton.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - RadioButton - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.ButtonBases import ButtonBase
-from GUI.GRadioButtons import RadioButton as GRadioButton
-
-win_check_size = 13
-win_hpad = 5
-
-class RadioButton(ButtonBase, GRadioButton):
-
- #_win_transparent = True
-
- def __init__(self, title = "New Radio Button", **kwds):
- font = self._win_predict_font(kwds)
- w = font.width(title) + win_hpad + win_check_size
- h = max(self._calc_height(font), win_check_size)
- win_style = wc.BS_RADIOBUTTON
- win = self._win_create_button(title, win_style, w, h)
- GRadioButton.__init__(self, _win = win, **kwds)
-
- def _value_changed(self):
- self._win_update()
-
- def _win_update(self):
- group = self._group
- if group:
- state = self._value == group._value
- else:
- state = False
- self._win.SetCheck(state)
-
-# Unbelievably, a BN_CLICKED message is sent when the
-# button is focused, making it impossible to tell whether
-# it was clicked or tabbed into.
-#
-# def _win_bn_clicked(self):
-# print "RadioButton._win_bn_clicked" ###
-# self._win_activate()
-
- def _win_activate(self):
- group = self._group
- if group:
- group.value = self._value
-
- def mouse_up(self, event):
- if self._win.GetState() & 0x4: # highlight
- self._win_activate()
- GRadioButton.mouse_up(self, event)
-
-export(RadioButton)
diff --git a/PyGUI-2.5.3/GUI/Win32/RadioGroup.py b/PyGUI-2.5.3/GUI/Win32/RadioGroup.py
deleted file mode 100644
index e9a8e7d..0000000
--- a/PyGUI-2.5.3/GUI/Win32/RadioGroup.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - RadioGroup - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI import export
-from GUI.GRadioGroups import RadioGroup as GRadioGroup
-
-class RadioGroup(GRadioGroup):
-
- def _item_added(self, item):
- item._win_update()
-
- def _item_removed(self, item):
- item._win_update()
-
- def _value_changed(self):
- for item in self._items:
- item._win_update()
-
-export(RadioGroup)
diff --git a/PyGUI-2.5.3/GUI/Win32/ScrollableView.py b/PyGUI-2.5.3/GUI/Win32/ScrollableView.py
deleted file mode 100644
index a06fd67..0000000
--- a/PyGUI-2.5.3/GUI/Win32/ScrollableView.py
+++ /dev/null
@@ -1,178 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - ScrollableView - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui
-from GUI import export
-from GUI.WinUtils import win_plain_class, win_none
-from GUI import Canvas
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount, default_scrolling
-from GUI.Geometry import add_pt, sub_pt, offset_rect, offset_rect_neg
-from GUI.GDrawableContainers import default_size
-from GUI.Geometry import offset_rect_neg
-
-win_style = wc.WS_CHILD | wc.WS_CLIPCHILDREN | wc.WS_CLIPSIBLINGS | \
- wc.WS_VISIBLE ###| wc.WS_VSCROLL| wc.WS_HSCROLL
-win_ex_style = 0 # wc.WS_EX_CLIENTEDGE
-win_default_rect = (0, 0, default_size[0], default_size[1])
-win_scroll_flags = wc.SW_INVALIDATE | wc.SW_SCROLLCHILDREN
-win_swp_flags = wc.SWP_DRAWFRAME #| wc.SWP_FRAMECHANGED
-
-class ScrollableView(GScrollableView):
-
- _line_scroll_amount = default_line_scroll_amount
- _extent = (500, 500)
-
- def __init__(self, **kwds):
- kwds.setdefault('border', True)
- kwds.setdefault('extent', default_extent)
- kwds.setdefault('scrolling', default_scrolling)
- win = ui.CreateWnd()
- win.CreateWindowEx(win_ex_style, win_plain_class, None, win_style, win_default_rect, win_none, 0)
- win.HookMessage(self._win_wm_hscroll, wc.WM_HSCROLL)
- win.HookMessage(self._win_wm_vscroll, wc.WM_VSCROLL)
- GScrollableView.__init__(self, _win = win)
- self.set(**kwds)
-
- def get_hscrolling(self):
- return self._win_get_flag(wc.WS_HSCROLL)
-
- def get_vscrolling(self):
- return self._win_get_flag(wc.WS_VSCROLL)
-
- def set_hscrolling(self, x):
- #print "ScrollableView.set_hscrolling:", x ###
- self._win_set_flag(x, wc.WS_HSCROLL, win_swp_flags)
- self._win_update_h_scrollbar()
-
- def set_vscrolling(self, x):
- #print "ScrollableView.set_vscrolling:", x ###
- self._win_set_flag(x, wc.WS_VSCROLL, win_swp_flags)
- self._win_update_v_scrollbar()
-
- def set_border(self, x):
- self._border = x
- self._win_set_ex_flag(x, wc.WS_EX_CLIENTEDGE, win_swp_flags)
-
- def get_line_scroll_amount(self):
- return self._line_scroll_amount
-
- def get_extent(self):
- return self._extent
-
- def set_extent(self, extent):
- self._extent = extent
- self._win_update_scroll_sizes()
-
- def get_scroll_offset(self):
- return self._h_scroll_offset, self._v_scroll_offset
-
- def set_scroll_offset(self, p):
- px = int(round(p[0]))
- py = int(round(p[1]))
- if px <> self._h_scroll_offset or py <> self._v_scroll_offset:
- self._win_update_scroll_offset(px, py)
-
- def _win_update_scroll_sizes(self):
- self._win_update_scroll_offset(self._h_scroll_offset, self._v_scroll_offset)
-
- def _win_update_scroll_offset(self, px, py):
- ex, ey = self.extent
- vx, vy = self.content_size
- xmax = max(0, ex - vx)
- ymax = max(0, ey - vy)
- x = max(0, min(px, xmax))
- y = max(0, min(py, ymax))
- self._win_scroll_to(x, y)
- self._win_update_h_scrollbar()
- self._win_update_v_scrollbar()
-
- def _win_update_h_scrollbar(self):
- self._win_update_scrollbar(self.hscrolling, wc.SB_HORZ, 0)
-
- def _win_update_v_scrollbar(self):
- self._win_update_scrollbar(self.vscrolling, wc.SB_VERT, 1)
-
- def _win_update_scrollbar(self, enabled, nbar, i):
- # It is important not to update a disabled scrollbar, or
- # subtle problems occur.
- if enabled:
- #print "ScrollableView._win_update_scrollbar:", enabled, nbar, i ###
- f = wc.SIF_DISABLENOSCROLL
- info = (f, 0, self.extent[i], self.content_size[i], self.scroll_offset[i])
- self._win.SetScrollInfo(nbar, info, True)
-
- def _scroll_range(self):
- return (xmax, ymax)
-
- def _win_scroll_to(self, x, y):
- dx = self._h_scroll_offset - x
- dy = self._v_scroll_offset - y
- if dx or dy:
- hwnd = self._win.GetSafeHwnd()
- gui.ScrollWindowEx(hwnd, dx, dy, None, None, None, win_scroll_flags)
- self._h_scroll_offset = x
- self._v_scroll_offset = y
-
- def set_bounds(self, bounds):
- GScrollableView.set_bounds(self, bounds)
- self._win_update_scroll_sizes()
-
- def _invalidate_rect(self, r):
- win = self._win
- s = self.scroll_offset
- self._win.InvalidateRect(offset_rect_neg(r, s))
-
- def local_to_global(self, p):
- q = sub_pt(p, self.scroll_offset)
- return self._win.ClientToScreen(q)
-
- def global_to_local(self, g):
- q = self._win.ScreenToClient(g)
- return add_pt(q, self.scroll_offset)
-
-# def _win_prepare_dc(self, dc):
-# dc.SetWindowOrg(self.scroll_offset)
-
- def _win_scroll_offset(self):
- return self.scroll_offset
-
- def _win_wm_hscroll(self, message):
- code = message[2] & 0xffff
- if code == 0:
- self.scroll_line_left()
- elif code == 1:
- self.scroll_line_right()
- elif code == 2:
- self.scroll_page_left()
- elif code == 3:
- self.scroll_page_right()
- elif code == 5:
- x = self._win_thumb_track_pos(wc.SB_HORZ)
- self.scroll_offset = (x, self._v_scroll_offset)
-
- def _win_wm_vscroll(self, message):
- code = message[2] & 0xffff
- if code == 0:
- self.scroll_line_up()
- elif code == 1:
- self.scroll_line_down()
- elif code == 2:
- self.scroll_page_up()
- elif code == 3:
- self.scroll_page_down()
- elif code == 5:
- y = self._win_thumb_track_pos(wc.SB_VERT)
- self.scroll_offset = (self._h_scroll_offset, y)
-
- def _win_thumb_track_pos(self, nbar):
- info = self._win.GetScrollInfo(nbar)
- return info[5]
-
- def _win_adjust_bounds(self, bounds):
- return offset_rect_neg(bounds, self.scroll_offset)
-
-export(ScrollableView)
diff --git a/PyGUI-2.5.3/GUI/Win32/ScrollableView_mfc.py b/PyGUI-2.5.3/GUI/Win32/ScrollableView_mfc.py
deleted file mode 100644
index 07d1b16..0000000
--- a/PyGUI-2.5.3/GUI/Win32/ScrollableView_mfc.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - ScrollableView - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI.Components import win_none
-from GUI.Canvases import Canvas
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount
-from GUI.Geometry import add_pt, sub_pt, offset_rect, offset_rect_neg
-
-win_style = ui.AFX_WS_DEFAULT_VIEW
-
-#print "ScrollableViews: Creating dummy doc"
-# PyWin32 insists on being given a CDocument when creating a CScrollView,
-# and doesn't provide any way of creating a real one without using a resource.
-
-if 1:
- # The following uses a resource included in win32ui.pyd.
- import pywin.mfc.object
- win_dummy_doc_template = pywin.mfc.object.CmdTarget(
- ui.CreateDocTemplate(ui.IDR_PYTHONTYPE))
- ui.GetApp().AddDocTemplate(win_dummy_doc_template)
- def win_get_dummy_doc():
- return win_dummy_doc_template.DoCreateDoc()
-else:
- # The following hack creates something that looks enough
- # like a CDocument to keep it happy. But it doesn't work with
- # pywin32 builds later than 212.
- win_dummy_doc = ui.CreateRichEditView().GetDocument()
- def win_get_dummy_doc():
- return win_dummy_doc
-
-class ScrollableView(GScrollableView):
-
- _line_scroll_amount = default_line_scroll_amount
-
- def __init__(self, **kwds):
- kwds.setdefault('extent', default_extent)
- doc = win_get_dummy_doc()
- win = ui.CreateView(doc)
- #win.CreateWindow(win_none, 0, win_style, (0, 0, 100, 100))
- win.CreateWindow(win_none, ui.AFX_IDW_PANE_FIRST, win_style, (0, 0, 100, 100))
- GScrollableView.__init__(self, _win = win)
- self.set(**kwds)
-
- def get_hscrolling(self):
- return self._win.GetStyle() & wc.WS_HSCROLL != 0
-
- def get_vscrolling(self):
- return self._win.GetStyle() & wc.WS_VSCROLL != 0
-
- def set_hscrolling(self, x):
- self._win_set_flag(x, wc.WS_HSCROLL)
-
- def set_vscrolling(self, x):
- self._win_set_flag(x, wc.WS_VSCROLL)
-
- def get_line_scroll_amount(self):
- return self._line_scroll_amount
-
- def get_extent(self):
- return self._win.GetTotalSize()
-
- def set_extent(self, extent):
- self._win_update_scroll_sizes(extent)
-
- def get_scroll_offset(self):
- return self._win.GetScrollPosition()
-
- def set_scroll_offset(self, p):
- px, py = p
- ex, ey = self.extent
- vx, vy = self.content_size
- xmax = max(0, ex - vx)
- ymax = max(0, ey - vy)
- x = max(0, min(px, xmax))
- y = max(0, min(py, ymax))
- self._win.ScrollToPosition((x, y))
-
- def set_bounds(self, bounds):
- GScrollableView.set_bounds(self, bounds)
- extent = self._win.GetTotalSize()
- self._win_update_scroll_sizes(extent)
-
- def _invalidate_rect(self, r):
- win = self._win
- s = win.GetScrollPosition()
- self._win.InvalidateRect(offset_rect_neg(r, s))
-
- def local_to_global(self, p):
- win = self._win
- q = sub_pt(p, win.GetScrollPosition())
- return win.ClientToScreen(q)
-
- def global_to_local(self, g):
- win = self._win
- q = win.ScreenToClient(g)
- return add_pt(q, win.GetScrollPosition())
-
-# def global_to_local(self, g):
-# win = self._win
-# l = win.ScreenToClient(g)
-# s = win.GetScrollPosition()
-# q = add_pt(l, s)
-# print "ScrollableView.global_to_local: g =", g, "l =", l, "s =", s, "q =", q ###
-# return q
-
- def _win_update_scroll_sizes(self, extent):
- ph = self.h_page_scroll_amount()
- pv = self.v_page_scroll_amount()
- ls = self.line_scroll_amount
- self._win.SetScrollSizes(wc.MM_TEXT, extent, (ph, pv), ls)
-
- def OnDraw(self, dc):
- #print "ScrollableView.OnDraw" ###
- update_rect = dc.GetClipBox()
- canvas = Canvas._from_win_dc(dc)
- self.draw(canvas, update_rect)
-
- def _win_prepare_dc(self, dc, pinfo = None):
- self._win.OnPrepareDC(dc, None)
-
-
-
-
diff --git a/PyGUI-2.5.3/GUI/Win32/Slider.py b/PyGUI-2.5.3/GUI/Win32/Slider.py
deleted file mode 100644
index 187f948..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Slider.py
+++ /dev/null
@@ -1,157 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Slider - Win32
-#
-#--------------------------------------------------------------------
-
-from __future__ import division
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.WinUtils import win_none
-from GUI.GSliders import Slider as GSlider
-
-win_base_flags = wc.WS_CHILD | wc.WS_VISIBLE
-
-win_styles = {
- 'h': 0x0, # TBS_HORZ | TBS_BOTTOM
- #'v': 0x6, # TBS_VERT | TBS_LEFT
- 'v': 0x2, # TBS_VERT | TBS_RIGHT
-}
-
-win_no_ticks = 0x10 # TBS_NOTICKS
-win_continuous_range = 10000
-
-class Slider(GSlider):
-
- #_win_transparent = True
- _default_breadth = 20
-
- _min_value = 0.0
- _max_value = 1.0
- _discrete = False
- _ticks = 0
- _live = True
-
- def __init__(self, orient, **kwds):
- win = ui.CreateSliderCtrl()
- win_flags = win_base_flags | win_no_ticks
- try:
- style = win_styles[orient]
- except KeyError:
- raise ValueError("Invalid Slider orientation %r" % orient)
- l = self._default_length
- b = self._default_breadth
- if orient == 'h':
- rect = (0, 0, l, b)
- else:
- rect = (0, 0, b, l)
- win.CreateWindow(style | win_flags, rect, win_none, 0)
- win.SetRange(0, win_continuous_range)
- GSlider.__init__(self, _win = win, **kwds)
-
- def get_value(self):
- win = self._win
- p = win.GetPos()
- q = win.GetRangeMax()
- x0 = self._min_value
- x1 = self._max_value
- return x0 + (x1 - x0) * p / q
-
- def set_value(self, x):
- win = self._win
- x0 = self._min_value
- x1 = self._max_value
- q = win.GetRangeMax()
- p = int(round(q * (x - x0) / (x1 - x0)))
- self._win.SetPos(p)
-
- def get_min_value(self):
- return self._min_value
-
- def set_min_value(self, x):
- self._min_value = x
- self._win_update_range()
-
- def get_max_value(self):
- return self._max_value
-
- def set_max_value(self, x):
- self._max_value = x
- self._win_update_range()
-
- def get_ticks(self):
- return self._ticks
-
- def set_ticks(self, n):
- self._ticks = n
- self._win_update_ticks()
-
- def get_discrete(self):
- return self._discrete
-
- def set_discrete(self, d):
- if self._discrete != d:
- self._discrete = d
- self._win_update_range()
-
- def get_live(self):
- return self._live
-
- def set_live(self, x):
- self._live = x
-
- def _win_update_range(self):
- if self._discrete:
- x1 = max(0, self._ticks - 1)
- else:
- x1 = win_continuous_range
- self._win.SetRange(0, x1)
- self._win_update_ticks()
-
- def _win_update_ticks(self):
- #print "Slider._win_update_ticks" ###
- win = self._win
- n = self._ticks
- if n >= 2:
- if self._discrete:
- f = 1
- else:
- f = int(round(win_continuous_range / (n - 1)))
- win.ModifyStyle(win_no_ticks, 0)
- win.ClearTics(False)
- for i in xrange(n + 1):
- win.SetTic(int(round(i * f)))
- else:
- win.ModifyStyle(0, win_no_ticks)
-
- def _win_wm_scroll(self, code):
- #print "Slider._win_wm_scroll:", code ###
- if self._live:
- report = code != 8
- else:
- report = code == 8
- if report:
- self.do_action()
-
- def _win_on_ctlcolor(self, dc, typ):
- #print "Slider._win_on_ctlcolor:", self ###
- return self._win.OnCtlColor(dc, self._win, typ)
-
- def key_down(self, event):
- k = event.key
- if k == 'left_arrow' or k == 'up_arrow':
- self._nudge_value(-1)
- elif k == 'right_arrow' or k == 'down_arrow':
- self._nudge_value(1)
- else:
- GSlider.key_down(self, event)
-
- def _nudge_value(self, d):
- if not self.discrete:
- d *= (win_continuous_range // 100)
- win = self._win
- p = win.GetPos()
- win.SetPos(p + d)
- self.do_action()
-
-export(Slider)
diff --git a/PyGUI-2.5.3/GUI/Win32/StdCursors.py b/PyGUI-2.5.3/GUI/Win32/StdCursors.py
deleted file mode 100644
index 7031023..0000000
--- a/PyGUI-2.5.3/GUI/Win32/StdCursors.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# Python GUI - Standard Cursors - Win32
-#
-#--------------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI import Cursor
-
-__all__ = [
- 'arrow',
- 'ibeam',
- 'crosshair',
- 'fist',
- 'hand',
- 'finger',
- 'invisible',
-]
-
-def win_get_std_cursor(id):
- app = ui.GetApp()
- win_app = getattr(app, '_win_app', app)
- hcursor = win_app.LoadStandardCursor(id)
- return Cursor._from_win_cursor(hcursor)
-
-arrow = win_get_std_cursor(wc.IDC_ARROW)
-ibeam = win_get_std_cursor(wc.IDC_IBEAM)
-crosshair = win_get_std_cursor(wc.IDC_CROSS)
-fist = Cursor("cursors/fist.tiff")
-hand = Cursor("cursors/hand.tiff")
-finger = win_get_std_cursor(wc.IDC_HAND)
-invisible = Cursor._from_win_cursor(0)
-
-def empty_cursor():
- return invisible
-
-# Win32 only
-wait = win_get_std_cursor(wc.IDC_WAIT)
-up_arrow = win_get_std_cursor(wc.IDC_UPARROW)
-size_all = win_get_std_cursor(wc.IDC_SIZEALL)
-size_w_e = win_get_std_cursor(wc.IDC_SIZEWE)
-size_n_s = win_get_std_cursor(wc.IDC_SIZENS)
-size_nw_se = win_get_std_cursor(wc.IDC_SIZENWSE)
-size_ne_sw = win_get_std_cursor(wc.IDC_SIZENESW)
-
diff --git a/PyGUI-2.5.3/GUI/Win32/StdFonts.py b/PyGUI-2.5.3/GUI/Win32/StdFonts.py
deleted file mode 100644
index fc2255e..0000000
--- a/PyGUI-2.5.3/GUI/Win32/StdFonts.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Standard Fonts - Win32
-#
-#--------------------------------------------------------------------
-
-from __future__ import division
-import win32con as wc, win32gui as gui, win32ui as ui
-from GUI import Font
-from GUI.WinUtils import win_none
-
-def _get_win_ppi():
- dc = win_none.GetDC()
- ppi = dc.GetDeviceCaps(wc.LOGPIXELSY)
- win_none.ReleaseDC(dc)
- return ppi
-
-_win_ppi = _get_win_ppi()
-
-def _win_pts_to_pixels(x):
- return int(round(x * _win_ppi / 72))
-
-def _win_stock_font(id):
- h = gui.GetStockObject(id)
- lf = gui.GetObject(h)
- return Font._from_win_logfont(lf)
-
-#system_font = _win_stock_font(wc.SYSTEM_FONT)
-#system_font = _win_stock_font(17) # DEFAULT_GUI_FONT
-#system_font = Font._from_win(win_none)
-#system_font = Font("System", 13)
-#system_font = Font("Tahoma", 10)
-#system_font = Font("Tahoma", 11)
-system_font = Font("Tahoma", _win_pts_to_pixels(8))
-#print "StdFonts: System font ascent =", system_font.ascent
-#print "StdFonts: System font descent =", system_font.descent
-application_font = system_font
diff --git a/PyGUI-2.5.3/GUI/Win32/StdMenus.py b/PyGUI-2.5.3/GUI/Win32/StdMenus.py
deleted file mode 100755
index 17497e5..0000000
--- a/PyGUI-2.5.3/GUI/Win32/StdMenus.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Menus - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI.GStdMenus import build_menus, \
- fundamental_cmds, help_cmds, pref_cmds, file_cmds, print_cmds, edit_cmds
-
-_file_menu_items = [
- ("New/N", 'new_cmd'),
- ("Open.../O", 'open_cmd'),
- ("Close/W", 'close_cmd'),
- "-",
- ("Save/S", 'save_cmd'),
- ("Save As...", 'save_as_cmd'),
- ("Revert", 'revert_cmd'),
- "-",
- ("Page Setup...", 'page_setup_cmd'),
- ("Print.../P", 'print_cmd'),
- "-",
- ("Exit/Q", 'quit_cmd'),
-]
-
-_edit_menu_items = [
- ("Undo/Z", 'undo_cmd'),
- ("Redo/^Z", 'redo_cmd'),
- "-",
- ("Cut/X", 'cut_cmd'),
- ("Copy/C", 'copy_cmd'),
- ("Paste/V", 'paste_cmd'),
- ("Clear", 'clear_cmd'),
- "-",
- ("Select All/A", 'select_all_cmd'),
- "-",
- ("Preferences...", 'preferences_cmd'),
-]
-
-_help_menu_items = [
- ("About ", 'about_cmd'),
-]
-
-#------------------------------------------------------------------------------
-
-def basic_menus(substitutions = {}, include = None, exclude = None):
- return build_menus([
- ("File", _file_menu_items, False),
- ("Edit", _edit_menu_items, False),
- ("Help", _help_menu_items, True),
- ],
- substitutions = substitutions,
- include = include,
- exclude = exclude)
diff --git a/PyGUI-2.5.3/GUI/Win32/Task.py b/PyGUI-2.5.3/GUI/Win32/Task.py
deleted file mode 100644
index d9f1a20..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Task.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Task - Win32
-#
-#--------------------------------------------------------------------
-
-from weakref import WeakValueDictionary
-import win32con as wc, win32ui as ui
-from GUI import export, application
-from GUI.WinUtils import win_none
-from GUI.GTasks import Task as GTask
-
-#--------------------------------------------------------------------
-
-class TimerWnd(object):
-
- def __init__(self):
- win = ui.CreateFrame()
- win.CreateWindow(None, "", 0, (0, 0, 0, 0))
- win.AttachObject(self)
- self._win = win
- self.tasks = WeakValueDictionary()
-
- def schedule(self, task):
- self.cancel(task)
- event_id = id(task)
- timer_id = self._win.SetTimer(event_id, task._milliseconds)
- if not timer_id:
- raise ValueError("Out of timers")
- task._win_timer_id = timer_id
- self.tasks[event_id] = task
-
- def cancel(self, task):
- timer_id = task._win_timer_id
- if timer_id:
- self._win.KillTimer(timer_id)
- task._win_timer_id = None
-
- def OnTimer(self, event_id):
- #print "TimerWnd.OnTimer:", event_id
- task = self.tasks.get(event_id)
- if task:
- if not task._repeat:
- self.cancel(task)
- task._proc()
- # We do this so that the application can't get starved of idle time
- # by a repeatedly-firing Task:
- application()._win_idle()
-
-timer_wnd = TimerWnd()
-
-#--------------------------------------------------------------------
-
-class Task(GTask):
-
- _win_timer_id = 0
-
- def __init__(self, proc, interval, repeat = False, start = True):
- self._proc = proc
- self._milliseconds = int(1000 * interval)
- self._repeat = repeat
- if start:
- self.start()
-
- def __del__(self, timer_wnd = timer_wnd):
- timer_wnd.cancel(self)
-
- def get_interval(self):
- return self._milliseconds / 1000.0
-
- def get_repeat(self):
- return self._repeat
-
- def start(self):
- timer_wnd.schedule(self)
-
- def stop(self):
- timer_wnd.cancel(self)
-
-export(Task)
diff --git a/PyGUI-2.5.3/GUI/Win32/TextEditor.py b/PyGUI-2.5.3/GUI/Win32/TextEditor.py
deleted file mode 100644
index 0892a8b..0000000
--- a/PyGUI-2.5.3/GUI/Win32/TextEditor.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#
-# Python GUI - Text Editor - Win32
-#
-
-from __future__ import division
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.GTextEditors import TextEditor as GTextEditor
-from GUI.WinUtils import win_none
-from GUI.StdFonts import application_font
-
-PFM_TABSTOPS = 0x10
-MAX_TAB_STOPS = 32
-LOGPIXELSX = 88
-
-ui.InitRichEdit()
-
-class TextEditor(GTextEditor):
-
- _pass_key_events_to_platform = True
-
- def __init__(self, scrolling = 'hv', **kwds):
- win_style = ui.AFX_WS_DEFAULT_VIEW #| wc.WS_HSCROLL | wc.WS_VSCROLL
- win = ui.CreateRichEditView()
- ctl = win.GetRichEditCtrl()
- self._win_ctl = ctl
- if 'h' in scrolling:
- win.SetWordWrap(0) # Must do before CreateWindow
- win.CreateWindow(win_none, 1, win_style, (0, 0, 100, 100))
- #if 'v' not in scrolling:
- # Disabled because it doesn't work properly -- auto-scrolling is prevented
- # but a vertical scroll bar still appears when text goes past bottom of window.
- #ctl.SetOptions(wc.ECOOP_XOR, wc.ECO_AUTOVSCROLL) # Must do after CreateWindow
- ctl.SetOptions(wc.ECOOP_XOR, wc.ECO_NOHIDESEL)
- win.ShowScrollBar(wc.SB_BOTH, False)
- # We allow automatic scroll bar show/hide -- resistance is futile
- win.ShowWindow()
- kwds.setdefault('font', application_font)
- GTextEditor.__init__(self, _win = win, **kwds)
-# self.tab_spacing = self.font.width("X") * 4 ###
-
- def get_selection(self):
- return self._win.GetSel()
-
- def set_selection(self, value):
- self._win.SetSel(*value)
-
- def get_text(self):
- return self._win.GetWindowText()
-
- def set_text(self, text):
- self._win.SetWindowText(text)
-
- def get_text_length(self):
- return self._win.GetTextLength()
-
- def get_font(self):
- return self._font
-
- def set_font(self, x):
- self._font = x
- self._win.SetFont(x._win_font)
- self.invalidate()
-
- def get_tab_spacing(self):
- pf = self._win_ctl.GetParaFormat()
- tabs = pf[8]
- if tabs:
- return tabs[0] // 20
- else:
- return 36
-
- def set_tab_spacing(self, x):
- dc = self._win.GetDC()
- dpi = dc.GetDeviceCaps(LOGPIXELSX)
- mask = PFM_TABSTOPS
- twips = 1440 * x / dpi
- tabs = [int(round((i + 1) * twips)) for i in xrange(MAX_TAB_STOPS)]
- pf = (mask, 0, 0, 0, 0, 0, 0, tabs)
- old_sel = self.selection
- self.select_all()
- self._win_ctl.SetParaFormat(pf)
- self.selection = old_sel
-
-export(TextEditor)
diff --git a/PyGUI-2.5.3/GUI/Win32/TextField.py b/PyGUI-2.5.3/GUI/Win32/TextField.py
deleted file mode 100644
index e8d0406..0000000
--- a/PyGUI-2.5.3/GUI/Win32/TextField.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - TextField - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.StdFonts import application_font
-from GUI.WinUtils import win_none
-from GUI.GTextFields import TextField as GTextField
-
-win_vpad = 5
-win_style = wc.WS_VISIBLE | wc.WS_CLIPSIBLINGS | wc.ES_AUTOHSCROLL # | wc.WS_TABSTOP
-win_ex_style = wc.WS_EX_CLIENTEDGE
-win_multiline_style = wc.ES_MULTILINE | wc.ES_AUTOVSCROLL
-win_password_style = wc.ES_PASSWORD
-
-win_just_mask = wc.ES_LEFT | wc.ES_CENTER | wc.ES_RIGHT
-
-win_just_flags = {
- 'l': wc.ES_LEFT,
- 'c': wc.ES_CENTER,
- 'r': wc.ES_RIGHT,
-}
-
-class TextField(GTextField):
-
- _pass_key_events_to_platform = True
-
- def __init__(self, **kwds):
- font = kwds.setdefault('font', application_font)
- multiline = kwds.setdefault('multiline', False)
- password = kwds.pop('password', False)
- self._multiline = multiline
- self._password = password
- h = self._calc_height(font)
- flags = win_style
- if multiline:
- flags |= win_multiline_style
- if password:
- flags |= win_password_style
- win = ui.CreateEdit()
- # Border can get lost if we construct it with too big a rect, so
- # we set the initial size after creation.
- win.CreateWindow(flags, (0, 0, 0, 0), win_none, 0)
- win.ModifyStyleEx(0, win_ex_style)
- win.MoveWindow((0, 0, 100, h))
- GTextField.__init__(self, _win = win, **kwds)
-
- def get_text(self):
- return self._win.GetWindowText().replace("\r\n", "\n")
-
- def set_text(self, x):
- self._win.SetWindowText(x.replace("\n", "\r\n"))
-
- def set_just(self, x):
- self._just = x
- try:
- flags = win_just_flags[x[:1]]
- except KeyError:
- raise ValueError("Invalid TextField justification %r" % x)
- self._win.ModifyFlags(win_just_mask, flags)
-
- def get_selection(self):
- sel = self._win.GetSel()
- if self._multiline:
- sel = self._win_adjust_sel(sel, -1)
- return sel
-
- def set_selection(self, sel):
- if self._multiline:
- sel = self._win_adjust_sel(sel, 1)
- self._win.SetSel(*sel)
- self.become_target()
-
- def _win_adjust_sel(self, sel, d):
- text = self._win.GetWindowText()
- if d > 0:
- text = text.replace("\r\n", "\n")
- nl = "\n"
- else:
- nl = "\r\n"
- def adj(x):
- return x + d * text.count(nl, 0, x)
- return map(adj, sel)
-
- def get_multiline(self):
- return self._multiline
-
- def get_password(self):
- return self._password
-
- def _tab_in(self):
- self.select_all()
-
- def key_down(self, event):
- #print "TextField.key_down" ###
- if event.char == "\t":
- self.pass_event_to_next_handler(event)
- else:
- GTextField.key_down(self, event)
-
-export(TextField)
diff --git a/PyGUI-2.5.3/GUI/Win32/View.py b/PyGUI-2.5.3/GUI/Win32/View.py
deleted file mode 100644
index 6ffad68..0000000
--- a/PyGUI-2.5.3/GUI/Win32/View.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - View - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI import export
-from GUI.WinUtils import win_none
-from GUI.GViews import View as GView
-
-win_style = wc.WS_VISIBLE
-win_default_rect = (0, 0, GView._default_size[0], GView._default_size[1])
-
-class View(GView):
-
- def __init__(self, **kwds):
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_style, win_default_rect,
- win_none, 0)
- GView.__init__(self, _win = win)
- self.set(**kwds)
-
-export(View)
diff --git a/PyGUI-2.5.3/GUI/Win32/ViewBase.py b/PyGUI-2.5.3/GUI/Win32/ViewBase.py
deleted file mode 100644
index 4724a39..0000000
--- a/PyGUI-2.5.3/GUI/Win32/ViewBase.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - ViewBase - Win32
-#
-#--------------------------------------------------------------------
-
-import win32gui as gui
-from GUI import export
-from GUI import application
-from GUI.GViewBases import ViewBase as GViewBase
-
-class ViewBase(GViewBase):
-
- _win_captures_mouse = True
-
- _cursor = None
-
-# def track_mouse(self):
-# #print "ViewBase.track_mouse: enter" ###
-# self._win_tracking_mouse = True
-# try:
-# while 1:
-# application().event_loop()
-# event = self._win_mouse_event
-# yield event
-# if event.kind == 'mouse_up':
-# break
-# finally:
-# self._win_tracking_mouse = False
-# #print "ViewBase.track_mouse: exit" ###
-
- def track_mouse(self):
- self._win_tracking_mouse = True
- while 1:
- application().event_loop()
- event = self._win_mouse_event
- yield event
- if event.kind == 'mouse_up':
- break
- self._win_tracking_mouse = False
-
- def get_cursor(self):
- return self._cursor
-
- def set_cursor(self, c):
- self._cursor = c
-
- def OnSetCursor(self, wnd, hit, message):
- if hit == 1: # HTCLIENT
- cursor = self._cursor
- if cursor:
- gui.SetCursor(cursor._win_cursor)
- return
- self._win.OnSetCursor(wnd._win, hit, message)
-
-export(ViewBase)
diff --git a/PyGUI-2.5.3/GUI/Win32/WGL.py b/PyGUI-2.5.3/GUI/Win32/WGL.py
deleted file mode 100644
index de26d95..0000000
--- a/PyGUI-2.5.3/GUI/Win32/WGL.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - WGL - Win32
-#
-#------------------------------------------------------------------------------
-
-from ctypes import *
-gdi32 = windll.gdi32
-
-def SetPixelFormat(hdc, ipf):
- gdi32.SetPixelFormat(hdc, ipf, None)
-
-def attr_array(d):
- a = []
- for k, v in d.iteritems():
- a.append(k)
- a.append(v)
- a.append(0)
- return a
-
-def attr_dict(keys, values):
- return dict(zip(keys, values))
diff --git a/PyGUI-2.5.3/GUI/Win32/WinComboBox.py b/PyGUI-2.5.3/GUI/Win32/WinComboBox.py
deleted file mode 100644
index 2cd9941..0000000
--- a/PyGUI-2.5.3/GUI/Win32/WinComboBox.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - ComboBox
-#
-#--------------------------------------------------------------------
-
-import win32ui as ui, win32con as wc, win32gui as gui
-
-class ComboBox(object):
-
- def __init__(self, parent, pos, size, style = wc.CBS_DROPDOWNLIST):
- parent_hwnd = parent.GetSafeHwnd()
- self.hwnd = gui.CreateWindow("COMBOBOX", "Blarg",
- wc.WS_CHILD | wc.CBS_DROPDOWNLIST,
- pos[0], pos[1], size[0], size[1],
- parent_hwnd, 0, 0, None)
- self.pycwnd = ui.CreateWindowFromHandle(self.hwnd)
- print "ComboBox: pycwnd =", self.pycwnd ###
-
- def __del__(self):
- gui.DestroyWindow(self.hwnd)
-
- def ShowWindow(self):
- gui.ShowWindow(self.hwnd, wc.SW_SHOW)
-
- def AddString(self, text):
- print "ComboBox: Adding string %r" % text ###
- gui.SendMessage(self.hwnd, wc.CB_ADDSTRING, 0, text)
-
-
-def CreateComboBox(parent, pos, size, style = wc.CBS_DROPDOWNLIST):
- parent_hwnd = parent.GetSafeHwnd()
- hwnd = gui.CreateWindow("COMBOBOX", "Blarg",
- wc.WS_CHILD | wc.CBS_DROPDOWNLIST,
- pos[0], pos[1], size[0], size[1],
- parent_hwnd, 0, 0, None)
- return ui.CreateWindowFromHandle(hwnd)
diff --git a/PyGUI-2.5.3/GUI/Win32/WinEvents.py b/PyGUI-2.5.3/GUI/Win32/WinEvents.py
deleted file mode 100644
index 70ab715..0000000
--- a/PyGUI-2.5.3/GUI/Win32/WinEvents.py
+++ /dev/null
@@ -1,109 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Event utilities - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32api as api, win32gui as gui, win32ui as ui
-from GUI import Event
-
-win_message_map = {
- wc.WM_KEYDOWN: ('key_down', None),
- wc.WM_KEYUP: ('key_up', None),
- wc.WM_SYSKEYDOWN: ('key_down', None),
- wc.WM_SYSKEYUP: ('key_up', None),
- wc.WM_MOUSEMOVE: ('mouse_move', None),
- wc.WM_LBUTTONDOWN: ('mouse_down', 'left'),
- wc.WM_LBUTTONDBLCLK: ('mouse_down', 'left'),
- wc.WM_LBUTTONUP: ('mouse_up', 'left'),
- wc.WM_MBUTTONDOWN: ('mouse_down', 'middle'),
- wc.WM_MBUTTONDBLCLK: ('mouse_down', 'middle'),
- wc.WM_MBUTTONUP: ('mouse_up', 'middle'),
- wc.WM_RBUTTONDOWN: ('mouse_down', 'right'),
- wc.WM_RBUTTONDBLCLK: ('mouse_down', 'right'),
- wc.WM_RBUTTONUP: ('mouse_up', 'right'),
-}
-
-win_special_keys = {
- 0x70: 'f1',
- 0x71: 'f2',
- 0x72: 'f3',
- 0x73: 'f4',
- 0x74: 'f5',
- 0x75: 'f6',
- 0x76: 'f7',
- 0x77: 'f8',
- 0x78: 'f9',
- 0x79: 'f10',
- 0x7a: 'f11',
- 0x7b: 'f12',
- 0x91: 'f14',
- 0x13: 'f15',
- #0x2d: 'help',
- 0x2d: 'insert',
- 0x2e: 'delete',
- 0x24: 'home',
- 0x23: 'end',
- 0x21: 'page_up',
- 0x22: 'page_down',
- 0x25: 'left_arrow',
- 0x27: 'right_arrow',
- 0x26: 'up_arrow',
- 0x28: 'down_arrow',
-}
-
-win_button_flags = wc.MK_LBUTTON | wc.MK_MBUTTON | wc.MK_RBUTTON
-win_prev_key_state = 1 << 30
-
-win_last_mouse_down = None
-win_dbl_time = gui.GetDoubleClickTime() / 1000.0 # 0.25
-win_dbl_xdist = api.GetSystemMetrics(wc.SM_CXDOUBLECLK)
-win_dbl_ydist = api.GetSystemMetrics(wc.SM_CYDOUBLECLK)
-
-def win_message_to_event(message, target = None):
- hwnd, msg, wParam, lParam, milliseconds, gpos = message
- kind, button = win_message_map[msg]
- time = milliseconds / 1000.0
- if kind == 'mouse_move' and wParam & win_button_flags <> 0:
- kind = 'mouse_drag'
- if target:
- lpos = target.global_to_local(gpos)
- else:
- lpos = gpos
- event = Event()
- event.kind = kind
- event.global_position = gpos
- event.position = lpos
- event.time = time
- event.button = button
- shift = api.GetKeyState(wc.VK_SHIFT) & 0x80 <> 0
- control = api.GetKeyState(wc.VK_CONTROL) & 0x80 <> 0
- option = api.GetKeyState(wc.VK_MENU) & 0x80 <> 0
- event.shift = event.extend_contig = shift
- event.control = event.extend_noncontig = control
- event.option = option
- vkey = None
- if kind == 'mouse_down':
- global win_last_mouse_down
- last = win_last_mouse_down
- if last and last.button == button and time - last.time <= win_dbl_time:
- x0, y0 = last.global_position
- x1, y1 = gpos
- if abs(x1 - x0) <= win_dbl_xdist and abs(y1 - y0) <= win_dbl_ydist:
- event.num_clicks = last.num_clicks + 1
- win_last_mouse_down = event
- elif kind == 'key_down' or kind == 'key_up':
- event.unichars = ui.TranslateVirtualKey(wParam)
- event.char = event.unichars.decode('ascii')
- event._keycode = wParam
- if wParam == 0x0d:
- if (lParam & 0x1000000):
- event.key = 'enter'
- else:
- event.key = 'return'
- else:
- event.key = win_special_keys.get(wParam) or event.char
- if kind == 'key_down':
- event.auto = lParam & win_prev_key_state <> 0
- return event
-
diff --git a/PyGUI-2.5.3/GUI/Win32/WinMenus.py b/PyGUI-2.5.3/GUI/Win32/WinMenus.py
deleted file mode 100644
index c08c29d..0000000
--- a/PyGUI-2.5.3/GUI/Win32/WinMenus.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Menu utilities - Win32
-#
-#--------------------------------------------------------------------
-
-from weakref import WeakKeyDictionary, WeakValueDictionary
-import win32con as wc, win32ui as ui
-from GUI import application
-
-win_command_map = {}
-win_command_list = []
-
-def win_command_to_id(name, index = None):
- if index is not None:
- key = (name, index)
- else:
- key = name
- id = win_command_map.get(key)
- if not id:
- id = len(win_command_list) + 1
- win_command_map[key] = id
- win_command_list.append(key)
- application()._win_app.HookCommandUpdate(win_command_update, id)
- return id
-
-def win_command_update(cmd):
- win_menu = cmd.m_pMenu
- if win_menu:
- menu = win_get_menu_for_hmenu(win_menu.GetHandle())
- if menu:
- item = menu._get_flat_item(cmd.m_nIndex)
- cmd.Enable(item.enabled)
- cmd.SetCheck(bool(item.checked))
-
-def win_id_to_command(id):
- if 1 <= id <= len(win_command_list):
- return win_command_list[id - 1]
-
-win_hmenu_to_menubar = WeakValueDictionary()
-
-def win_get_menu_for_hmenu(hmenu):
- menubar = win_hmenu_to_menubar.get(hmenu)
- if menubar:
- return menubar.hmenu_to_menu.get(hmenu)
-
-#--------------------------------------------------------------------
-
-class MenuBar(object):
- # Wrapper around a PyCMenu
-
- def __init__(self):
- self.win_menu = ui.CreateMenu()
- self.hmenu_to_menu = {}
-
- def append_menu(self, menu):
- win_menu = menu._win_create_menu()
- hmenu = win_menu.Detach()
- self.win_menu.AppendMenu(wc.MF_POPUP | wc.MF_STRING, hmenu, menu.title)
- win_hmenu_to_menubar[hmenu] = self
- self.hmenu_to_menu[hmenu] = menu
-
diff --git a/PyGUI-2.5.3/GUI/Win32/WinPageSetup.py b/PyGUI-2.5.3/GUI/Win32/WinPageSetup.py
deleted file mode 100644
index 0c026ad..0000000
--- a/PyGUI-2.5.3/GUI/Win32/WinPageSetup.py
+++ /dev/null
@@ -1,168 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Win32 API - Page setup dialog
-#
-#------------------------------------------------------------------------------
-
-from ctypes import *
-from ctypes.wintypes import *
-
-comdlg32 = windll.comdlg32
-kernel32 = windll.kernel32
-
-CCHDEVICENAME = 32
-CCHFORMNAME = 32
-
-PSD_MARGINS = 0x2
-PSD_INTHOUSANDTHSOFINCHES = 0x4
-PSD_RETURNDEFAULT = 0x400
-
-LPPAGESETUPHOOK = c_void_p
-LPPAGEPAINTHOOK = c_void_p
-
-class PAGESETUPDLG(Structure):
- _fields_ = [
- ('lStructSize', DWORD),
- ('hwndOwner', HWND),
- ('hDevMode', HGLOBAL),
- ('hDevNames', HGLOBAL),
- ('Flags', DWORD),
- ('ptPaperSize', POINT),
- ('rtMinMargin', RECT),
- ('rtMargin', RECT),
- ('hInstance', HINSTANCE),
- ('lCustData', LPARAM),
- ('lpfnPageSetupHook', LPPAGESETUPHOOK),
- ('lpfnPagePaintHook', LPPAGEPAINTHOOK),
- ('lpPageSetupTemplateName', LPCSTR),
- ('hPageSetupTemplate', HGLOBAL),
- ]
-
- def __del__(self):
- print "PAGESETUPDLG.__del__" ###
- GlobalFree(self.hDevMode)
- GlobalFree(self.hDevNames)
-
-class DEVMODE(Structure):
- _fields_ = [
- ('dmDeviceName', c_char * CCHDEVICENAME),
- ('dmSpecVersion', WORD),
- ('dmDriverVersion', WORD),
- ('dmSize', WORD),
- ('dmDriverExtra', WORD),
- ('dmFields', DWORD),
- ('dmOrientation', c_short),
- ('dmPaperSize', c_short),
- ('dmPaperLength', c_short),
- ('dmPaperWidth', c_short),
- ('dmScale', c_short),
- ('dmCopies', c_short),
- ('dmDefaultSource', c_short),
- ('dmPrintQuality', c_short),
- ('dmColor', c_short),
- ('dmDuplex', c_short),
- ('dmYResolution', c_short),
- ('dmTTOption', c_short),
- ('dmCollate', c_short),
- ('dmFormName', c_char * CCHFORMNAME),
- ('dmLogPixels', WORD),
- ('dmBitsPerPel', DWORD),
- ('dmPelsWidth', DWORD),
- ('dmPelsHeight', DWORD),
- ('dmDisplayFlags', DWORD),
- ('dmDisplayFrequency', DWORD),
- ('dmICMMethod', DWORD),
- ('dmICMIntent', DWORD),
- ('dmMediaType', DWORD),
- ('dmDitherType', DWORD),
- ('dmReserved1', DWORD),
- ('dmReserved2', DWORD),
- ('dmPanningWidth', DWORD),
- ('dmPanningHeight', DWORD),
- ]
-
-class DEVNAMES(Structure):
- _fields_ = [
- ('wDriverOffset', WORD),
- ('wDeviceOffset', WORD),
- ('wOutputOffset', WORD),
- ('wDefault', WORD),
- ]
-
-_PageSetupDlg = comdlg32.PageSetupDlgA
-_PageSetupDlg.argtypes = [POINTER(PAGESETUPDLG)]
-
-GlobalAlloc = kernel32.GlobalAlloc
-GlobalAlloc.argtypes = [UINT, DWORD]
-
-GlobalSize = kernel32.GlobalSize
-GlobalSize.argtypes = [HGLOBAL]
-
-GlobalLock = kernel32.GlobalLock
-GlobalLock.argtypes = [HGLOBAL]
-
-GlobalUnlock = kernel32.GlobalUnlock
-GlobalUnlock.argtypes = [HGLOBAL]
-
-GlobalFree = kernel32.GlobalFree
-GlobalFree.argtypes = [HGLOBAL]
-
-def PageSetupDlg(psd):
- psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS
- return bool(_PageSetupDlg(psd))
-
-def get_handle_contents(h):
- n = GlobalSize(h)
- p = GlobalLock(h)
- data = string_at(p, n)
- GlobalUnlock(h)
- return data
-
-def handle_with_contents(data):
- n = len(data)
- h = GlobalAlloc(n)
- p = GlobalLock(h)
- memmove(p, data, n)
- GlobalUnlock(h)
- return h
-
-def lock_devmode_handle(h):
- p = c_void_p(GlobalLock(h))
- dmp = cast(p, POINTER(DEVMODE))
- return dmp[0]
-
-class DevNames(object):
-
- def __init__(self, hdevnames):
- a = GlobalLock(hdevnames)
- p = c_void_p(a)
- dnp = cast(p, POINTER(DEVNAMES))
- dn = dnp[0]
- self.driver = c_char_p(a + dn.wDriverOffset).value
- self.device = c_char_p(a + dn.wDeviceOffset).value
- self.output = c_char_p(a + dn.wOutputOffset).value
- self.default = dn.wDefault
- GlobalUnlock(hdevnames)
-
-def get_defaults():
- psd = PAGESETUPDLG()
- psd.lStructSize = sizeof(PAGESETUPDLG)
- psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_RETURNDEFAULT
- _PageSetupDlg(psd)
- return psd
-
-if __name__ == "__main__":
- def dump_psd(header, psd):
- print "%s:" % header, psd
- for name, _ in PAGESETUPDLG._fields_:
- print " %s = %r" % (name, getattr(psd, name))
- psd = PAGESETUPDLG()
- psd.lStructSize = sizeof(PAGESETUPDLG)
- dump_psd("Initial psd", psd)
- result = _PageSetupDlg(psd)
- print "Result:", result
- dump_psd("Final psd", psd)
- #print "DevMode:", repr(get_handle_contents(psd.hDevMode)[:sizeof(DEVMODE)])
- dm = lock_devmode_handle(psd.hDevMode)
- print "dmDeviceName:", dm.dmDeviceName
- #print "DevNames:", repr(get_handle_contents(psd.hDevNames))
diff --git a/PyGUI-2.5.3/GUI/Win32/WinPrint.py b/PyGUI-2.5.3/GUI/Win32/WinPrint.py
deleted file mode 100644
index 054bebe..0000000
--- a/PyGUI-2.5.3/GUI/Win32/WinPrint.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Win32 API - Printing
-#
-#------------------------------------------------------------------------------
-
-from ctypes import *
-from ctypes.wintypes import *
-
-comdlg32 = windll.comdlg32
-gdi32 = windll.gdi32
-
-PD_ALLPAGES = 0x0
-PD_RETURNDC = 0x100
-
-LOGPIXELSX = 88
-LOGPIXELSY = 90
-PHYSICALOFFSETX = 112
-PHYSICALOFFSETY = 113
-
-LPDWORD = POINTER(DWORD)
-LPHANDLE = POINTER(HANDLE)
-LPPOINT = POINTER(POINT)
-LPPRINTHOOKPROC = c_void_p
-LPSETUPHOOKPROC = c_void_p
-ABORTPROC = CFUNCTYPE(c_int, HDC, c_int)
-LPPRINTER_DEFAULTS = c_void_p
-
-class PRINTDLG(Structure):
-
- _pack_ = 2
- _fields_ = [
- ('lStructSize', DWORD),
- ('hwndOwner', HWND),
- ('hDevMode', HGLOBAL),
- ('hDevNames', HGLOBAL),
- ('hDC', HDC),
- ('Flags', DWORD),
- ('nFromPage', WORD),
- ('nToPage', WORD),
- ('nMinPage', WORD),
- ('nMaxPage', WORD),
- ('nCopies', WORD),
- ('hInstance', HINSTANCE),
- ('lCustData', LPARAM),
- ('lpfnPrintHook', LPPRINTHOOKPROC),
- ('lpfnSetupHook', LPSETUPHOOKPROC),
- ('lpPrintTemplateName', LPCSTR),
- ('lpSetupTemplateName', LPCSTR),
- ('hPrintTemplate', HGLOBAL),
- ('hSetupTemplate', HGLOBAL),
- ]
-
- def __init__(self):
- self.lStructSize = sizeof(PRINTDLG)
-
-class DOCINFO(Structure):
-
- _fields_ = [
- ('cbSize', c_int),
- ('lpszDocName', LPCSTR),
- ('lpszOutput', LPCSTR),
- ('lpszDatatype', LPCSTR),
- ('fwType', DWORD),
- ]
-
- def __init__(self):
- self.cbSize = sizeof(DOCINFO)
-
-class FORM_INFO_1_W(Structure):
-
- _fields_ = [
- ('Flags', DWORD),
- ('pName', LPWSTR),
- ('Size', SIZEL),
- ('ImageableArea', RECTL),
- ]
-
-_PrintDlg = comdlg32.PrintDlgA
-_PrintDlg.argtypes = [POINTER(PRINTDLG)]
-
-SetAbortProc = gdi32.SetAbortProc
-SetAbortProc.argtypes = [HDC, ABORTPROC]
-
-StartDoc = gdi32.StartDocA
-StartDoc.argtypes = [HDC, POINTER(DOCINFO)]
-
-StartPage = gdi32.StartPage
-StartPage.argtypes = [HDC]
-
-EndPage = gdi32.EndPage
-EndPage.argtypes = [HDC]
-
-EndDoc = gdi32.EndDoc
-EndDoc.argtypes = [HDC]
-
-DeleteDC = gdi32.DeleteDC
-DeleteDC.argtypes = [HDC]
-
-CommDlgExtendedError = comdlg32.CommDlgExtendedError
-CommDlgExtendedError.argtypes = []
-
-def PrintDlg(pd):
- pd.nFromPage = pd.nMinPage
- pd.nToPage = pd.nMaxPage
- pd.Flags = PD_RETURNDC
- #if pd.nMaxPage > pd.nMinPage:
- # pd.Flags |= PD_PAGENUMS
- result = _PrintDlg(pd)
- if result == 0:
- err = CommDlgExtendedError()
- if err <> 0:
- raise EnvironmentError("Common Dialog error %s" % err)
- return bool(result)
-
-def GetPrintingOffset(hdc):
- dpix = gdi32.GetDeviceCaps(hdc, LOGPIXELSX)
- dpiy = gdi32.GetDeviceCaps(hdc, LOGPIXELSY)
- offx = gdi32.GetDeviceCaps(hdc, PHYSICALOFFSETX)
- offy = gdi32.GetDeviceCaps(hdc, PHYSICALOFFSETY)
- return 72.0 * offx / dpix, 72.0 * offy / dpiy
-
-def abort_proc(hdc, err):
- return printing_aborted
-
-def install_abort_proc(hdc):
- global printing_aborted
- printing_aborted = False
- SetAbortProc(hdc, ABORTPROC(abort_proc))
diff --git a/PyGUI-2.5.3/GUI/Win32/WinUtils.py b/PyGUI-2.5.3/GUI/Win32/WinUtils.py
deleted file mode 100644
index eb28d2f..0000000
--- a/PyGUI-2.5.3/GUI/Win32/WinUtils.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - Utilities
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui, win32api as api
-from win32api import HIWORD, LOWORD
-from GUI import application
-from GUI.Exceptions import Cancel, InternalError
-
-win_dlog_class = "#32770"
-win_color3dhilight = api.GetSysColor(wc.COLOR_3DHILIGHT)
-win_color3dlight = api.GetSysColor(wc.COLOR_3DLIGHT)
-win_color3dface = api.GetSysColor(wc.COLOR_3DFACE)
-win_color3dshadow = api.GetSysColor(wc.COLOR_3DSHADOW)
-win_menubar_height = api.GetSystemMetrics(wc.SM_CYMENU)
-win_bg_color = api.GetSysColor(wc.COLOR_3DFACE)
-win_screen_width = api.GetSystemMetrics(wc.SM_CXFULLSCREEN)
-win_screen_height = api.GetSystemMetrics(wc.SM_CYFULLSCREEN)
-win_screen_rect = (0, 0, win_screen_width, win_screen_height)
-
-#win_bg_brush = ui.CreateBrush(wc.BS_SOLID, win_color3dface, 0)
-#win_bg_hbrush = win_bg_brush.GetSafeHandle()
-
-# An empty brush for not painting anything with
-win_null_brush = ui.CreateBrush(wc.BS_NULL, 0, 0)
-win_null_hbrush = win_null_brush.GetSafeHandle()
-
-# All components hook the following messages
-
-win_event_messages = (
- wc.WM_KEYDOWN, wc.WM_KEYUP,
- wc.WM_SYSKEYDOWN, wc.WM_SYSKEYUP,
- wc.WM_MOUSEMOVE,
- wc.WM_LBUTTONDOWN, wc.WM_LBUTTONDBLCLK, wc.WM_LBUTTONUP,
- wc.WM_MBUTTONDOWN, wc.WM_MBUTTONDBLCLK, wc.WM_MBUTTONUP,
- wc.WM_RBUTTONDOWN, wc.WM_RBUTTONDBLCLK, wc.WM_RBUTTONUP,
- #wc.WM_MOUSELEAVE,
-)
-
-# Dummy CWnd for use as parent of containerless components.
-# Also used as the main frame of the CWinApp.
-
-win_none = ui.CreateFrame()
-win_none.CreateWindow(None, "", 0, (0, 0, 10, 10))
-
-win_plain = ui.CreateWnd()
-win_plain.CreateWindow(None, None, 0, (0, 0, 10, 10), win_none, 0)
-win_plain_class = gui.GetClassName(win_plain.GetSafeHwnd())
-
-#--------------------------------------------------------------------
-
-win_command_map = {
- 0: '_win_bn_clicked', # BN_CLICKED
- wc.CBN_SELCHANGE: '_cbn_sel_change',
-}
-
-class WinMessageReflector(object):
-
- def _win_install_event_hooks(self, win):
- win.HookMessage(self._win_wm_scroll, wc.WM_HSCROLL)
- win.HookMessage(self._win_wm_scroll, wc.WM_VSCROLL)
-
-#
-# Disabled for now because overriding control colours
-# doesn't seem to work properly on XP.
-#
-# def OnCtlColor(self, dc, comp, typ):
-# #print "WinMessageReflector.OnCtlColor" ###
-# meth = getattr(comp, '_win_on_ctlcolor', None)
-# if meth:
-# return meth(dc, typ)
-
- def _win_wm_scroll(self, message):
- #print "WinMessageReflector._win_wm_scroll:", self, message ###
- wParam = message[2]
- code = wParam & 0xffff
- lParam = message[3]
- self._forward_reflected_message(lParam, '_win_wm_scroll', code)
-
- def OnCommand(self, wParam, lParam):
- #print "WinMessageReflector.OnCommand: code = 0x%04x 0x%04x lParam = 0x%08x" % (
- # HIWORD(wParam), LOWORD(wParam), lParam)
- try:
- code = HIWORD(wParam)
- id = LOWORD(wParam)
- if id:
- self._win_menu_command(id)
- else:
- name = win_command_map.get(code)
- if name:
- self._forward_reflected_message(lParam, name)
- except Cancel:
- pass
- except:
- application().report_error()
-
- def _forward_reflected_message(self, lParam, method_name, *args):
- wnd = ui.CreateWindowFromHandle(lParam)
- meth = getattr(wnd, method_name, None)
- if meth:
- meth(*args)
-
- def _win_menu_command(self, id):
- raise InternalError("_win_menu_command called on non-window: %r" % self)
-
-win_none_wrapper = WinMessageReflector()
-win_none_wrapper._win = win_none
-win_none_wrapper._win_install_event_hooks(win_none)
-win_none.AttachObject(win_none_wrapper)
-
-#--------------------------------------------------------------------
-#
-# Debugging routines
-#
-
-win_message_names = {}
-
-win_exclude_names = ["WM_MOUSEFIRST"]
-
-for name, value in wc.__dict__.iteritems():
- if name.startswith("WM_") and name not in win_exclude_names:
- win_message_names[value] = name
-
-def win_message_name(num):
- return win_message_names.get(num) or num
-
-def dump_flags(flags):
- for name in wc.__dict__.iterkeys():
- if name.startswith("WS_") and not name.startswith("WS_EX"):
- value = wc.__dict__[name]
- if flags & value:
- print "%20s = 0x%08x" % (name, value & 0xffffffffL)
-
-def win_deconstruct_style(flags):
- win_do_deconstruct_style(flags, "WS_", "WS_EX_")
-
-def win_deconstruct_style_ex(flags):
- win_do_deconstruct_style(flags, "WS_EX_")
-
-def win_do_deconstruct_style(flags, prefix, not_prefix = None):
- d = wc.__dict__
- for name in d.iterkeys():
- if name.startswith(prefix):
- if not not_prefix or not name.startswith(not_prefix):
- value = d[name]
- if value and flags & value == value:
- print "%25s 0x%08x" % (name, value)
diff --git a/PyGUI-2.5.3/GUI/Win32/Window.py b/PyGUI-2.5.3/GUI/Win32/Window.py
deleted file mode 100755
index d30f1c6..0000000
--- a/PyGUI-2.5.3/GUI/Win32/Window.py
+++ /dev/null
@@ -1,343 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Window - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui, win32api as api
-from GUI import export
-from GUI import WinUtils
-from GUI.Geometry import rect_size, sub_pt
-from GUI import application
-from GUI.Exceptions import Cancel
-from GUI.WinEvents import win_message_to_event
-from GUI.WinMenus import MenuBar, win_id_to_command
-from GUI.GMenus import search_list_for_key
-from GUI import Component
-from GUI.GWindows import Window as GWindow
-
-#--------------------------------------------------------------------
-
-capabilities = ('hidable', 'zoomable', 'resizable', 'movable', 'closable')
-
-win_defaults = {
- 'standard': (1, 1, 1, 1, 1),
- 'nonmodal_dialog': (1, 0, 0, 1, 1),
- 'modal_dialog': (0, 0, 0, 1, 1),
- 'alert': (0, 0, 0, 1, 1),
- 'fullscreen': (0, 0, 0, 0, 0),
-}
-
-win_base_flags = wc.WS_CLIPCHILDREN
-win_border_flags = wc.WS_DLGFRAME
-
-win_capability_flags = {
- 'hidable': wc.WS_MINIMIZEBOX | wc.WS_SYSMENU,
- 'zoomable': wc.WS_MAXIMIZEBOX | wc.WS_SYSMENU,
- 'resizable': wc.WS_THICKFRAME,
- 'movable': wc.WS_BORDER,
- 'closable': wc.WS_SYSMENU,
-}
-
-win_no_menu_styles = ('nonmodal_dialog', 'modal_dialog',
- 'alert', 'fullscreen')
-
-win_ex_flags = 0 #wc.WS_EX_WINDOWEDGE
-win_no_ex_flags = wc.WS_EX_CLIENTEDGE
-
-def win_calculate_flags(style, kwds):
- # Calculate window flags from the options present in kwds, and
- # fill in kwds with default values for missing options that need
- # to be passed to the base class constructor.
- flags = win_base_flags
- if style != 'fullscreen':
- flags |= win_border_flags
- try:
- defaults = win_defaults[style]
- except KeyError:
- raise ValueError("Invalid window style '%s'" % style)
- for name, default in zip(capabilities, defaults):
- value = kwds.pop(name, default)
- if name == 'closable':
- kwds[name] = value
- if value:
- flags |= win_capability_flags[name]
- return flags
-
-#def win_adjust_flags(flags, kwds, option_name, opt_flags):
-# option = kwds.pop(option_name, None)
-# if option is not None:
-# if option:
-# flags |= opt_flags
-# else:
-# flags &= ~opt_flags
-# return flags
-
-def win_next_wnd(wnd):
- wnd = getattr(wnd, '_win', wnd)
- #print "win_next_wnd:", wnd ###
- return wnd.GetWindow(wc.GW_HWNDNEXT)
-
-#--------------------------------------------------------------------
-
-class Window(GWindow):
-
- _win_hooks_events = True
- _win_has_menubar = True
- _win_captures_mouse = True
-
- _win_need_menubar_update = True
- _win_saved_target = False
- _win_fullscreen = False
-
- def __init__(self, **kwds):
- style = kwds.get('style', 'standard')
- flags = win_calculate_flags(style, kwds)
- #if style == 'fullscreen':
- # rect = WinUtils.win_screen_rect
- #else:
- rect = (0, 0, self._default_width, self._default_height)
- frame = ui.CreateFrame()
- frame.CreateWindow(None, "New Window", 0, rect)
- hwnd = frame.GetSafeHwnd()
- #api.SetClassLong(hwnd, wc.GCL_HBRBACKGROUND, win_bg_hbrush)
- api.SetClassLong(hwnd, wc.GCL_HBRBACKGROUND, 0)
-# print "Window: Setting style:" ###
-# win_deconstruct_style(flags) ###
- frame.ModifyStyle(-1, flags)
-# print "Window: Style is now:" ###
-# win_deconstruct_style(frame.GetStyle()) ###
- frame.ModifyStyleEx(win_no_ex_flags, win_ex_flags)
- if style == 'fullscreen':
- self._win_fullscreen = True
- frame.HookMessage(self._win_wm_initmenu, wc.WM_INITMENU)
- self._win = frame
- if style in win_no_menu_styles:
- self._win_has_menubar = False
- else:
- self._win_set_empty_menubar()
- kwds['closable'] = flags & wc.WS_CAPTION <> 0
- GWindow.__init__(self, _win = frame, **kwds)
-
- def OnPaint(self):
- win = self._win
- dc, ps = win.BeginPaint()
- rect = win.GetClientRect()
- dc.FillSolidRect(rect, WinUtils.win_bg_color)
- if self._win_has_menubar:
- l, t, r, b = rect
- dc.Draw3dRect((l, t, r + 1, t + 2),
- WinUtils.win_color3dshadow, WinUtils.win_color3dhilight)
- win.EndPaint(ps)
-
- def _win_install_event_hooks(self):
- self._win.HookMessage(self._wm_activate, wc.WM_ACTIVATE)
- #self._win.HookMessage(self._wm_setfocus, wc.WM_SETFOCUS)
- self._win.HookMessage(self._wm_windowposchanging, wc.WM_WINDOWPOSCHANGING)
- self._win.HookMessage(self._wm_windowposchanged, wc.WM_WINDOWPOSCHANGED)
- GWindow._win_install_event_hooks(self)
-
- def _wm_activate(self, msg):
- wParam = msg[2]
- #print "Window._wm_activate:", msg ###
- #print "...wParam =", wParam ###
- if wParam == wc.WA_INACTIVE:
- #print "Window: Deactivating:", self ###
- try:
- target = ui.GetFocus()
- #print "...target =", target ###
- except ui.error, e:
- #print "...no target", e ###
- target = None
- if isinstance(target, Component) and target is not self:
- #print "...saving target", target ###
- self._win_saved_target = target
-
- def _win_wm_setfocus(self, msg):
- #print "Window._win_wm_setfocus:", self ###
- target = self._win_saved_target
- if target and target.window == self:
- #print "...restoring target", target ###
- target._win.SetFocus()
- self._win_saved_target = None
- else:
- GWindow._win_wm_setfocus(self, msg)
-
- def get_target(self):
- if self._win_is_active():
- try:
- target = ui.GetFocus()
- except ui.error:
- target = None
- if target and isinstance(target, Component):
- return target
- return self._saved_target or self
-
- def _win_is_active(self):
- try:
- active_win = ui.GetActiveWindow()
- except ui.error:
- active_win = None
- return active_win is self
-
-# def _wm_setfocus(self, *args):
-# print "Window._wm_setfocus:", args ###
-
- def _wm_windowposchanging(self, message):
- #print "Window._wm_windowposchanging"
- self._win_old_size = rect_size(self._bounds)
- #print "...old size =", self._win_old_size
-
- def _wm_windowposchanged(self, message):
- #print "Window._wm_windowposchanged"
- old_size = self._win_old_size
- new_bounds = self._win_get_actual_bounds()
- self._bounds = new_bounds
- new_size = rect_size(new_bounds)
- #print "...new size =", new_size
- if old_size != new_size:
- self._resized(sub_pt(new_size, old_size))
-
- def _win_set_empty_menubar(self):
- # A completely empty menu bar collapses to zero height, and
- # controlling the window bounds is too complicated if the
- # menu bar comes and goes, so we add a dummy item to it.
- menubar = MenuBar()
- menubar.win_menu.AppendMenu(0, 0, "")
- self._win.SetMenu(menubar.win_menu)
- self._win_menubar = menubar
-
- def get_title(self):
- return self._win.GetWindowText()
-
- def set_title(self, x):
- self._win.SetWindowText(x)
-
- def get_visible(self):
- return self._win.IsWindowVisible()
-
- def set_visible(self, x):
- #print "Window.set_visible:", x, self ###
- if x:
- self._win_update_menubar()
- self._win.ShowWindow()
- else:
- self._win.ShowWindow(wc.SW_HIDE)
-
- def _show(self):
- self._win_update_menubar()
- win = self._win
- if self._win_fullscreen:
- win.ShowWindow(wc.SW_SHOWMAXIMIZED)
-# win.SetWindowPos(wc.HWND_TOP, (0, 0, 0, 0),
-# wc.SWP_NOMOVE | wc.SWP_NOSIZE | wc.SWP_SHOWWINDOW)
- win.ShowWindow(wc.SW_SHOWNORMAL)
- win.SetActiveWindow()
-
-# def get_bounds(self):
-# win = self._win
-# r = win.ClientToScreen(win.GetClientRect())
-# return r
-
- def _win_get_actual_bounds(self):
- win = self._win
- return win.ClientToScreen(win.GetClientRect())
-
- def _win_move_window(self, rect):
- win = self._win
- l, t, r, b = win.CalcWindowRect(rect)
- if self._win_has_menubar:
- t -= WinUtils.win_menubar_height
- self._win.MoveWindow((l, t, r, b))
-
- def set_menus(self, x):
- GWindow.set_menus(self, x)
- self._win_menus_changed()
-
- def _stagger(self):
- #print "Window._stagger:", self ###
- win = win_next_wnd(self._win)
- while win and not (isinstance(win, Window) and win.visible):
- #print "...win =", win ###
- win = win_next_wnd(win)
- if win:
- l, t, r, b = win._win.GetWindowRect()
- hwnd = self._win.GetSafeHwnd()
- gui.SetWindowPos(hwnd, 0, l + 20, t + 20, 0, 0,
- wc.SWP_NOSIZE | wc.SWP_NOZORDER)
-
- def OnClose(self):
- #print "Window:", self, "OnClose"
- try:
- self.close_cmd()
- except Cancel:
- pass
- except:
- application().report_error()
-
- def _win_menus_changed(self):
- self._win_need_menubar_update = True
- if self.visible:
- self._win_update_menubar()
-
- def _win_update_menubar(self):
- #print "Window._win_update_menubar:", self ###
- if self._win_need_menubar_update:
- all_menus = application()._effective_menus_for_window(self)
- self._all_menus = all_menus
- if self._win_has_menubar:
- if all_menus:
- menubar = MenuBar()
- for menu in all_menus:
- menubar.append_menu(menu)
- self._win.SetMenu(menubar.win_menu)
- self._win_menubar = menubar
- else:
- self._win_set_empty_menubar()
- self._win_need_menubar_update = False
-
- def _win_wm_initmenu(self, message):
- #print "Window._win_wm_initmenu:", self ###
- self._win_perform_menu_setup()
-
- def _win_perform_menu_setup(self):
- #print "Window._win_perform_menu_setup:", self ###
- application()._perform_menu_setup(self._all_menus)
-
- def _win_menu_command(self, id):
- command = win_id_to_command(id)
- if command:
- application().dispatch_menu_command(command)
-
- def _win_possible_menu_key(self, key, shift, option):
- self._win_perform_menu_setup()
- command = search_list_for_key(self._all_menus, key, shift, option)
- if command:
- application().dispatch_menu_command(command)
- return True
-
- def _screen_rect(self):
- return WinUtils.win_screen_rect
-
- def modal_event_loop(self):
- disabled = []
- for window in application().windows:
- if window is not self:
- if not window._win.EnableWindow(False):
- #print "Window.modal_event_loop: disabled", window.title ###
- disabled.append(window)
- status = self._win.RunModalLoop(0)
- if status:
- print "Window._modal_event_loop:", self, "status =", status ###
- #raise Cancel
- for window in disabled:
- #print "Window.modal_event_loop: enabling", window.title ###
- window._win.EnableWindow(True)
- if status <> 0: ###
- from GUI.Exceptions import InternalError ###
- raise InternalError("RunModalLoop returned %s" % status) ###
-
- def exit_modal_event_loop(self):
- self._win.EndModalLoop(0)
-
-export(Window)
diff --git a/PyGUI-2.5.3/GUI/__init__.py b/PyGUI-2.5.3/GUI/__init__.py
deleted file mode 100755
index 5dc533b..0000000
--- a/PyGUI-2.5.3/GUI/__init__.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Top level package initialisation
-#
-#--------------------------------------------------------------------
-
-import sys, types
-
-# The first item of each of the following pairs is the name of a module
-# to try to import. If the import is successful, the platform-dependent
-# directory named by the second item is used.
-
-_versions = [
- ("objc", "Cocoa"),
- ("nt", "Win32"),
- ("gi.repository.Gtk", "GtkGI"),
- ("gtk", "Gtk"),
-]
-
-#
-# The following function exports a class or function from a submodule in
-# such a way that it appears to have been defined directly at the top
-# level of the package. By giving the submodule that defines the class the
-# same name as the class, this provides an autoloading facility that is
-# friendly to application bundling tools.
-#
-
-_preserve = [] # Keeps references to replaced modules so they aren't cleared
-
-def export(obj):
- qname = "%s.%s" % (__name__, obj.__name__)
- obj.__module__ = __name__
- mod = sys.modules[qname]
- _preserve.append(mod)
- sys.modules[qname] = obj
-
-#
-# The environment variable PYGUI_IMPLEMENTATION may be set to the
-# name of one of the platform-dependent directories to force that
-# implementation to be used. This can be useful if more than one
-# PyGUI implementation is usable on your setup.
-#
-
-from os import environ as _env
-_platdir = _env.get("PYGUI_IMPLEMENTATION")
-if not _platdir:
- for _testmod, _platdir in _versions:
- try:
- __import__(_testmod)
- break
- except ImportError:
- continue
- else:
- raise ImportError("Unable to find an implementation of PyGUI for this installation")
-
-if _env.get("PYGUI_IMPLEMENTATION_DEBUG"):
- sys.stderr.write("PyGUI: Using implementation: %s\n" % _platdir)
-
-#
-# Append the chosen platform-dependent directory to the search
-# path for submodules of this package.
-#
-
-from os.path import join as _join
-_here = __path__[0]
-__path__.append(_join(_here, _platdir))
-__path__.append(_join(_here, "Generic"))
-
-#
-# Import global functions
-#
-
-from GUI.Globals import application, run
-from GUI.Colors import rgb
-
-#
-# Set up initial resource search path
-#
-
-from GUI import Resources
-Resources._add_file_path(__file__)
-_main_dir = sys.path[0]
-Resources._add_directory_path(_main_dir)
-Resources._add_directory_path(_main_dir, 1)
-#import __main__
-#Resources._add_module_path(__main__)
-#Resources._add_module_path(__main__, 1)
-#print "GUI: resource_path =", Resources.resource_path ###
-
-#
-# Perform global initialisation
-#
-
-import GUI.Application
diff --git a/PyGUI-2.5.3/GUI/py2exe.py b/PyGUI-2.5.3/GUI/py2exe.py
deleted file mode 100644
index 8c6541b..0000000
--- a/PyGUI-2.5.3/GUI/py2exe.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Fix py2exe to handle dynamic pywin32 module search paths
-#
-#--------------------------------------------------------------------
-
-import sys
-
-# py2exe 0.6.4 introduced a replacement modulefinder.
-# This means we have to add package paths there, not to the built-in
-# one. If this new modulefinder gets integrated into Python, then
-# we might be able to revert this some day.
-# if this doesn't work, try import modulefinder
-try:
- import py2exe.mf as modulefinder
-except ImportError:
- import modulefinder
-import win32com
-for p in win32com.__path__[1:]:
- modulefinder.AddPackagePath("win32com", p)
-for extra in ["win32com.shell"]: #,"win32com.mapi"
- __import__(extra)
- m = sys.modules[extra]
- for p in m.__path__[1:]:
- modulefinder.AddPackagePath(extra, p)
diff --git a/PyGUI-2.5.3/README.txt b/PyGUI-2.5.3/README.txt
deleted file mode 100644
index 4681a3f..0000000
--- a/PyGUI-2.5.3/README.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-Welcome to PyGUI
-================
-
-This is an experimental Python GUI framework. The ultimate aim of this
-project is to create a GUI package worthy of becoming the standard GUI
-for Python -- truly Pythonic, fully documented in Python terms,
-implemented on all the major platforms, and, ideally, distributed with
-Python itself, so that one may write GUI applications that work with
-any Python installation, anywhere.
-
-Three implementations are provided in this version:
-
-* MacOSX - requires PyObjC
-* Linux - requires pygtk
-* Windows - requires pywin32 and ctypes
-
-This package is still under development. The basic set of widgets is
-more or less complete, and will probably be expanded in the future.
-
-To install it, either do 'python setup.py install' to install it in
-your Python site directory, or put the directory containing the GUI
-directory on your PYTHONPATH.
-
-To get started with it, have a look at the documentation starting with
-Doc/index.html, and the example applications in the Demos directory.
-You may also find it instructive to study the programs in the Tests
-directory, although some of them are not written in the best style.
-
-License: This is free software. You are welcome to use it
-however you want.
-
-Please send comments, questions, suggestions and bug reports to:
-
- greg.ewing@canterbury.ac.nz
-
-Discussion is also welcome on the comp.lang.python newsgroup.
-
-At the time of writing, the latest version of PyGUI is available from:
-
- http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui
-
-Have fun,
-
-Gregory Ewing
-greg.ewing@canterbury.ac.nz
-http://www.cosc.canterbury.ac.nz/~greg
diff --git a/PyGUI-2.5.3/TODO.txt b/PyGUI-2.5.3/TODO.txt
deleted file mode 100644
index 617a4ca..0000000
--- a/PyGUI-2.5.3/TODO.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-Picture class.
-
-Add an 'editable' property to TextField.
-
-Support for multiple types of clipboard data.
-
-Fix justification of Labels, Buttons and TextFields.
-
-Way of testing whether a rect intersects the current clip region of a canvas.
-
-Add an 'equalize' option to place_row and place_column.
-
-Upgrade to newer PyGtk
- Use gdk.Drawable.draw_pixbuf
- Use Pixbuf.new_subpixbuf when scaling image
-
-Gtk/GLView:
- Call viewport_changed on any size change, not just resized().
-
-Setting the document property of a window should trigger update_title().
-
-Make binary a mandatory constructor argument of Document?
-
-Cocoa: Don't open the same file more than once.
-
-Gtk: Remember directory last used by Open dialog.
-
-Cocoa: Implement Hide/Show commands in application menu.
-
-Cocoa: Load standard cursors lazily (IBeamCursor not available
-until application is created).
-
-Cocoa: Create NSApplication earlier? (Pixmap creation fails before
-NSApplication exists.)
-
-Gtk: Dialog centering? (15-dialog.py)
-
-Gtk: Don't enable Copy menu command in password field.
-
-Gtk: Test 92-glpixmap.py on a properly OpenGL-capable X11 system.
-
-Remove custom tab handling.
-
-Bulk conversion of coordinates?
-
-Coordinate conversion of rects?
-
-Return/Enter (and Escape?) action for TextFields.
-
-Do fsync before renaming temp save files.
-
-
-To be implemented in Cocoa version
-----------------------------------
-
-Font.text_size
-Mixed state check boxes
-
-
-To be implemented in Gtk version
---------------------------------
-
-Mixed state check boxes
-
-
-To be documented
-----------------
-
-Font.text_size
-Font.but
-Container.added,removed
-View.model_added,model_removed
-New coordinate conversion methods
-
-
-Components to be added
-----------------------
-
-SpinButton control
-ComboBox control
-PopupMenu control
-
-Table view
-Rich text view
-
-
-To be de-documented
--------------------
-
-Window.target
-
-
-To be implemented in Pythonwin version
---------------------------------------
-
-Window._stagger
-Quit exception
-Special keys
-
-
-To be tested in Win32 version
------------------------------
-
-Float coords everywhere
diff --git a/PyGUI-2.5.3/Tests/.gdb_history b/PyGUI-2.5.3/Tests/.gdb_history
deleted file mode 100644
index eb9ee85..0000000
--- a/PyGUI-2.5.3/Tests/.gdb_history
+++ /dev/null
@@ -1,5 +0,0 @@
-run 90-glview.py
-run 90-glview.py d
-run 10-view.py
-where
-q
diff --git a/PyGUI-2.5.3/Tests/01-application.py b/PyGUI-2.5.3/Tests/01-application.py
deleted file mode 100644
index 19dd408..0000000
--- a/PyGUI-2.5.3/Tests/01-application.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - Test application and menus
-#
-
-import sys
-from GUI import Application, Window
-from testing import say
-
-class TestApp(Application):
-
- def __init__(self):
- Application.__init__(self)
-
- def key_down(self, event):
- say("Key down: %s\n" % event)
- if event.char == "E":
- raise Exception("This is a test exception.")
-
- def key_up(self, event):
- say("Key up: %s\n" % event)
-
- def auto_key(self, event):
- say("Auto key: %s\n" % event)
-
-app = TestApp()
-
-#say("Created TestApp")
-
-if not app.zero_windows_allowed():
- #say("Creating window")
- win = Window(title = "TestApp")
- #say("Created window")
- win.show()
- #say("Shown window")
-
-instructions = """
-On platforms capable of running an application without windows,
-there should be no windows, otherwise there should be a single
-window.
-
-If menus have been implemented, the standard menus should be
-available, the New, Open and Quit items should be enabled, and
-the Quit command should work both by menu selection and keyboard
-equivalent. The Page Setup command should be enabled and working
-if implemented.
-
-Key down, key up and auto key events should be reported.
-
-Type capital E to test exception handling. Either a dialog
-box should appear reporting the exception, or if dialog boxes
-are not yet implemented, the message 'Exception while handling
-exception' should be printed followed by two tracebacks.
-"""
-
-say(instructions)
-app.run()
diff --git a/PyGUI-2.5.3/Tests/02-window.py b/PyGUI-2.5.3/Tests/02-window.py
deleted file mode 100644
index 9d6440a..0000000
--- a/PyGUI-2.5.3/Tests/02-window.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# Python GUI - Test windows
-#
-
-from GUI import Window, run
-from testing import say
-
-class TestWindow(Window):
-
- def mouse_down(self, event):
- say(self.name, "Mouse down:", event)
-
- def mouse_drag(self, event):
- say(self.name, "Mouse drag:", event)
-
- def mouse_up(self, event):
- say(self.name, "Mouse up:", event)
- print
-
- def key_down(self, event):
- say(self.name, "Key down:", event)
-
- def key_up(self, event):
- say(self.name, "Key up:", event)
- print
-
-win1 = TestWindow(title = "Hello PyGUI!",
- bounds = (50, 70, 250, 270),
- auto_position = False)
-win1.name = "Win1"
-win1.show()
-
-win2 = TestWindow(title = "Hello Again!",
- auto_position = False,
- position = (300, 70),
- size = (400, 300),
- resizable = 0)
-win2.name = "Win2"
-win2.show()
-
-instructions = """
-There should be two windows, one titled 'Hello PyGUI!' positioned at (50, 70)
-with size (200, 200) and resizable, and one titled 'Hello Again!' positioned
-at (300, 70) with size (400, 300) and not resizable. Both should be movable
-and closable.
-
-Mouse down, mouse drag, mouse up, key down and key up events in both windows
-should be reported. Mouse drag and mouse up events should be reported for the
-window in which the preceding mouse down event occurred, and should be reported
-even if the mouse is moved outside the original window.
-"""
-
-say(instructions)
-say("win1 position =", win1.position, "size =", win1.size)
-say("win2 position =", win2.position, "size =", win2.size)
-
-run()
diff --git a/PyGUI-2.5.3/Tests/03-label.py b/PyGUI-2.5.3/Tests/03-label.py
deleted file mode 100644
index c7db3a2..0000000
--- a/PyGUI-2.5.3/Tests/03-label.py
+++ /dev/null
@@ -1,66 +0,0 @@
-from GUI import Window, Label, Font, application
-from GUI.StdColors import red
-from GUI.StdFonts import system_font
-from testing import say
-
-num_rows = 6
-
-italic_font = Font("Times", 2 * system_font.size, ['italic'])
-
-def dump_font(caption, f):
- say(caption, f.family, f.size, f.style)
-
-dump_font("System font:", system_font)
-dump_font("Italic font:", italic_font)
-
-def make_label(text, **kwds):
- #say("Creating label", text)
- return Label(text = text, **kwds)
-
-#say("Creating labels")
-lbls = [
- make_label("ParrotState:"),
- make_label("Resting"),
- make_label("Spam!\nGlorious Spam!"),
- make_label("Red", color = red),
- make_label("Big Italic", font = italic_font),
- make_label("Pig in the\nMiddle", just = 'center', width = 140),
- make_label("Right\nJustified", just = 'right', width = 140),
-]
-
-#say("Setting label positions")
-#say("Setting lbls[0].position to (20, 20)")
-#say("Before: lbls[0].bounds =", lbls[0].bounds)
-lbls[0].position = (20, 20)
-#say("After: lbls[0].bounds =", lbls[0].bounds)
-lbls[1].position = (lbls[0].right, lbls[0].top)
-for i in range(2, len(lbls)):
- lbls[i].position = (lbls[0].left, lbls[i-1].bottom + 20)
-
-#for lbl in lbls:
-# say(lbl.height)
-
-#say("Creating window")
-win = Window(title = "Labels")
-for lbl in lbls:
- win.add(lbl)
-win.size = (lbls[-1].right + 20, lbls[-1].bottom + 20)
-win.show()
-
-instructions = """
-There should be six rows of labels:
-1. Two labels "ParrotState:" and "Resting", abutting but not overlapping.
-2. A two-line label "Spam!\\nGlorious Spam!"
-3. A label "Red" in red text.
-4. A label "Big Italic" in a large italic font.
-5. A two-line label "Pig in the\\nMiddle" centred in the window.
-6. A two-line label "Right\\nJustified" right-aligned.
-All labels should remain stationary relative to the top left corner
-of the window when it is resized.
-"""
-
-say(instructions)
-
-#application().menus = []
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/04-button.py b/PyGUI-2.5.3/Tests/04-button.py
deleted file mode 100644
index 99500ae..0000000
--- a/PyGUI-2.5.3/Tests/04-button.py
+++ /dev/null
@@ -1,66 +0,0 @@
-from GUI import Window, Button, Font, application
-from GUI.StdFonts import system_font
-from GUI.StdColors import red, black
-from testing import say
-
-def say_hello():
- say("Hello, world!")
- btn2.enabled = 1
-
-def say_goodbye():
- say("Goodbye, world!")
- btn2.enabled = 0
-
-def simulate_hello():
- btn1.activate()
-
-btn1 = Button(position = (30, 30),
- title = "Hello", action = say_hello, style = 'default')
-
-btn2 = Button(x = 30, y = btn1.bottom + 30, width = 200,
- title = "Goodbye", just = 'centre',
- action = say_goodbye,
- enabled = 0)
-btn2.font = Font("Times", 1.2 * system_font.size, [])
-
-btn3 = Button(x = 30, y = btn2.bottom + 30, width = 200,
- font = Font("Times", 1.2 * system_font.size, ['italic']),
- action = simulate_hello, title = "Wrong", style = 'cancel')
-btn3.color = red
-btn3.just = 'right'
-btn3.title = "Gidday Mate"
-
-class TWindow(Window):
-
- def key_down(self, e):
- say(e)
- Window.key_down(self, e)
-
-win = TWindow(width = 260, height = btn3.bottom + 30, title = "Btns",
- resizable = 0, zoomable = 0)
-
-win.add(btn1)
-win.add(btn2)
-win.add(btn3)
-win.show()
-
-instructions = """
-There should be 3 buttons arranged vertically:
-1. Title "Hello", natural width, style 'default'
-2. Title "Goodbye" in a serif font, width 200, initially disabled
-3. Title "Gidday Mate" in red italic, width 200, style 'cancel', right aligned
-Pressing button 1 should print "Hello, world!" and enable button 2.
-Pressing button 2 should print "Goodbye, world!" and disable button 2.
-Pressing button 3 should simulate pressing button 1.
-"""
-
-say(instructions)
-say("Testing readback of button 3 properties:")
-say("title =", btn3.title)
-say("font =", btn3.font)
-say("color =", btn3.color)
-say("just =", btn3.just)
-say("End of readback test")
-say()
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/05-checkbox.py b/PyGUI-2.5.3/Tests/05-checkbox.py
deleted file mode 100644
index 037c4ed..0000000
--- a/PyGUI-2.5.3/Tests/05-checkbox.py
+++ /dev/null
@@ -1,81 +0,0 @@
-from GUI import Window, CheckBox, Button, rgb, application
-from testing import say
-
-def report():
- say("Check box set to", box.on)
-
-def change_auto_toggle():
- box.auto_toggle = auto.on
- say("Auto toggling =", box.auto_toggle)
-
-box = CheckBox(
- x = 20, y = 20,
- title = "Check Box", action = report)
-
-auto = CheckBox(x = 20, y = box.bottom + 10,
- title = "Auto Toggle",
- action = change_auto_toggle,
- color = rgb(1, 0, 0),
- on = 1)
-
-def update_allow_mixed():
- state = allow_mixed.on
- box.mixed = state
- mixed.enabled = state
-
-allow_mixed = CheckBox(x = 20, y = auto.bottom + 10,
- title = "Allow Mixed",
- action = update_allow_mixed)
-
-def make_mixed():
- try:
- box.on = 'mixed'
- except ValueError:
- e = sys.exc_info()[1]
- say(e)
- report()
-
-mixed = Button("Make Mixed",
- x = 20, y = allow_mixed.bottom + 10,
- action = make_mixed,
- enabled = False)
-
-def do_show_hide():
- if box.container:
- box.container = None
- else:
- box.container = win
-
-show_hide = Button("Show/Hide",
- x = 20, y = mixed.bottom + 10,
- action = do_show_hide)
-
-win = Window(width = 200, height = show_hide.bottom + 20,
- title = "Check Boxes")
-
-win.add(box)
-win.add(auto)
-win.add(allow_mixed)
-win.add(mixed)
-win.add(show_hide)
-win.show()
-
-instructions = """
-There should be two check boxes titled "Check Box" and "Auto Toggle".
-Clicking in the top check box should cause its state to be reported.
-Clicking in the bottom check box should turn auto-toggling behaviour
-of the top check box on and off.
-
-Clicking the "Show/Hide" button should make the top check box
-visible or invisible.
-
-On platforms which support it, the label of the second check box
-should be red.
-
-On platforms which support it, the Allow Mixed check box should enable
-pressing the Mixed button to set the top check box to a mixed state.
-"""
-
-say(instructions)
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/06-radiobutton.py b/PyGUI-2.5.3/Tests/06-radiobutton.py
deleted file mode 100644
index 220eb2f..0000000
--- a/PyGUI-2.5.3/Tests/06-radiobutton.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from GUI import Window, RadioButton, application
-from testing import say
-
-btn = RadioButton(x = 30, y = 30, width = 150, title = "Radio Button")
-
-win = Window(width = 200, height = btn.bottom + 30, title = "Radio Button")
-
-win.add(btn)
-win.show()
-
-say("The radio button probably won't do anything on its own.")
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/07-radiogroup.py b/PyGUI-2.5.3/Tests/07-radiogroup.py
deleted file mode 100644
index 0adf4b4..0000000
--- a/PyGUI-2.5.3/Tests/07-radiogroup.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from GUI import Window, Button, RadioButton, RadioGroup, application
-from testing import say
-
-labels = ["Banana", "Chocolate", "Strawberry"]
-
-def report():
- value = grp.value
- try:
- say(labels[value], "selected")
- except (TypeError, IndexError):
- say("Value =", value)
-
-def set_to_chocolate():
- grp.value = 1
-
-win = Window(width = 250, title = "Radio Groups")
-
-grp = RadioGroup(action = report)
-
-y = 20
-for i in range(0, 3):
- rbtn = RadioButton(
- position = (20, y),
- title = labels[i],
- group = grp,
- value = i)
- win.add(rbtn)
- y = rbtn.bottom + 5
-
-pbtn = Button(title = "Set to Chocolate",
- position = (20, rbtn.bottom + 20),
- action = set_to_chocolate)
-win.add(pbtn)
-
-win.height = pbtn.bottom + 20
-win.show()
-
-instructions = """
-There should be three radio buttons, "Banana", "Chocolate" and "Strawberry",
-and a "Set to Chocolate" button. All radio buttons should initially be off.
-Turning any of the buttons on should turn the others off. Changes to the
-setting should be reported.
-"""
-
-say(instructions)
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/08-menu.py b/PyGUI-2.5.3/Tests/08-menu.py
deleted file mode 100644
index f658d01..0000000
--- a/PyGUI-2.5.3/Tests/08-menu.py
+++ /dev/null
@@ -1,58 +0,0 @@
-from GUI import Window, Menu, Label, application
-from testing import say
-
-class MenuTestWindow(Window):
-
- is_hoopy = 1
- is_smeggy = 0
-
- def setup_menus(self, m):
- m.hoopy_cmd.enabled = 1
- m.smeggy_cmd.enabled = 1
- m.hoopy_cmd.checked = self.is_hoopy
- m.smeggy_cmd.checked = self.is_smeggy
- m.flavour_cmd.enabled = 1
-
- def hoopy_cmd(self):
- self.is_hoopy = 1
- self.is_smeggy = 0
-
- def smeggy_cmd(self):
- self.is_hoopy = 0
- self.is_smeggy = 1
-
- def flavour_cmd(self, i):
- if self.is_hoopy:
- hs = "Hoopy"
- else:
- hs = "Smeggy"
- lbl.text = "%s Flavour %s" % (hs, i)
-
-
-menus = [
- Menu("Flavour", [
- ("Hoopy/^H", 'hoopy_cmd'),
- ("Smeggy/^S", 'smeggy_cmd'),
- ("-"),
- (["Vanilla/^V", "Raspberry/^R", "Chocolate/^C"], 'flavour_cmd'),
- ]
- )
-]
-
-win = MenuTestWindow(title = "Menus", size = (240, 60))
-win.menus = menus
-lbl = Label("Select a Flavour", position = (20, 20), width = 200)
-win.add(lbl)
-win.show()
-
-instructions = """
-In addition to the standard menus, there should be a menu "Flavours" containing
-two options and three flavours. The most recently selected option should be
-checked in the menu. Upon selecting a flavour, the currently selected option
-and the index of the selected flavour should be displayed in the window. All
-items in the Flavours menu should have shifted key equivalents.
-"""
-
-say(instructions)
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/09-textfield.py b/PyGUI-2.5.3/Tests/09-textfield.py
deleted file mode 100644
index cd10be4..0000000
--- a/PyGUI-2.5.3/Tests/09-textfield.py
+++ /dev/null
@@ -1,104 +0,0 @@
-from GUI import Font, Window, TextField, Button, application
-from testing import say
-
-fancy = Font("Times", 24, ['italic'])
-
-win_num = 0
-
-
-class TestWindow(Window):
-
- def do_default_action(self):
- say("Default")
-
- def do_cancel_action(self):
- say("Cancel")
-
-
-def show_text(win):
- fields = [win.tf1, win.tf2, win.tf3]
- n = None
- t = application().target
- for i, f in enumerate(fields):
- say("Field %d:" % (i + 1), repr(f.text))
- if f is t:
- n = i + 1
- if n:
- say("Focus: Field %d: Selection = %r" % (n, t.selection))
- else:
- say("No focus")
-
-def select_text(win):
- win.tf2.selection = (7, 11)
-
-def make_window():
- global win_num
- win_num += 1
- win = TestWindow(size = (260, 200), title = "Text fields %d" % (win_num))
- win.tf1 = TextField(position = (20, 20), width = 200)
- #say("Field 1 Height =", win.tf1.height) ###
- win.tf2 = TextField(position = (20, win.tf1.bottom + 10), width = 200,
- text = "Spam\nGlorious Spam", multiline = True, lines = 2)
- #say("Field 2 Height =", win.tf2.height) ###
- win.tf3 = TextField(position = (20, win.tf2.bottom + 10), width = 200, font = fancy)
- show_but = Button("Show", position = (20, win.tf3.bottom + 20),
- action = (show_text, win))
- sel_but = Button("Select",
- position = (show_but.right + 5, win.tf3.bottom + 20),
- action = (select_text, win))
- new_but = Button("New",
- position = (sel_but.right + 5, win.tf3.bottom + 20),
- action = make_window)
- win.add(win.tf1)
- win.add(win.tf2)
- win.add(win.tf3)
- win.add(show_but)
- win.add(sel_but)
- win.add(new_but)
- win.height = show_but.bottom + 20
- win.tf1.become_target()
- win.show()
- return win
-
-win = make_window()
-
-instructions = """
-There should be a window containing 3 text fields:
-
-1. A single-line text field
-2. A 2-line text field with some initial text
-3. A single-line field with a large italic font
-
-A. Field 1 should have the initial keyboard focus.
-
-B. Field 2 should allow multi-line editing, the others should not.
-
-C. Tabbing between all fields should work.
-
-D. Cut, Copy, Paste, Clear, Select All commands and their keyboard equivalents
-should work. Their menu items should be enabled or disabled as appropriate.
-
-E. Pressing the Enter key on the numeric keypad should print "Default", and
-pressing Escape should print "Cancel". In single-line fields, the Return key
-on the main keyboard should also print "Default".
-
-F. The Show button should report the contents of each text field and the
-selection range of the field having the keyboard focus.
-
-G. The Sel button should select characters 5 to 11 of the second text
-field and focus that field. Check that type characters are entered into
-the field afterwards.
-
-H. Use New button to create an additional window and ensure that switching
-focus between windows and cut/copy/paste between windows works correctly.
-"""
-
-say(instructions)
-
-def sigterm(*a):
- raise Exception("SIGTERM")
-
-import signal
-signal.signal(signal.SIGTERM, sigterm)
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/10-view.py b/PyGUI-2.5.3/Tests/10-view.py
deleted file mode 100644
index 4102208..0000000
--- a/PyGUI-2.5.3/Tests/10-view.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from GUI import Window, application
-from TestViews import TestDrawing, fancy_font as f
-from TestInput import TestKeyEvents, TestTrackMouse
-from testing import say
-
-class TestView(TestKeyEvents, TestTrackMouse, TestDrawing):
- pass
-
-win = Window(width = 320, height = 200)
-view = TestView(width = 320, height = 200)
-win.add(view)
-view.become_target()
-win.show()
-
-say("""
-There should be a red triangle, a blue triangle and half a green
-triangle, outlined in black, on a yellow background, and three
-pieces of text. Each text line should sit accurately on the
-baseline drawn under it.
-
-The following events in the view should be reported: mouse down,
-mouse drag, mouse up, key down, key up, auto key.
-""")
-
-say("Font ascent =", f.ascent, "descent =", f.descent, "height =", f.height)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/11-view-clip.py b/PyGUI-2.5.3/Tests/11-view-clip.py
deleted file mode 100644
index 6a64cd6..0000000
--- a/PyGUI-2.5.3/Tests/11-view-clip.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Test user-defined views.
-#
-
-from GUI import Window, View, application
-from GUI.StdColors import red
-from testing import say
-
-class View1(View):
-
- def draw(self, c, r):
- say("View1.draw")
- c.set_forecolor(red)
- c.fill_rect(self.viewed_rect())
-
-
-def main():
- win = Window(size = (500, 400))
- view1 = View1(position = (10, 10), size = (200, 100))
- win.add(view1)
- win.show()
- application().run()
-
-instructions = """
-There should be 500x400 window with a 200x100 red filled rectangle
-near the top left corner.
-"""
-
-say(instructions)
-main()
diff --git a/PyGUI-2.5.3/Tests/12-scroll.py b/PyGUI-2.5.3/Tests/12-scroll.py
deleted file mode 100644
index 03a8974..0000000
--- a/PyGUI-2.5.3/Tests/12-scroll.py
+++ /dev/null
@@ -1,82 +0,0 @@
-from GUI import Window, Button, CheckBox, application
-from TestScrollableViews import TestScrollableView
-from testing import say
-
-class TestWindow(Window):
-
- def __init__(self, **kwds):
- Window.__init__(self, **kwds)
- self.view = TestScrollableView(container = self,
- x = 20, y = 20,
- width = 300, height = 300)#, scrolling = 'hv')
- self.view.report_update_rect = True
- if 1: ###
- self.h_scrolling_ctrl = CheckBox("Horizontal Scrolling",
- value = 'h' in self.view.scrolling,
- action = 'horz_scrolling')
- self.v_scrolling_ctrl = CheckBox("Vertical Scrolling",
- value = 'v' in self.view.scrolling,
- action = 'vert_scrolling')
- self.border_ctrl = CheckBox("Border", value = 1, action = 'change_border')
- CheckBox("Vertical Scrolling", value = 1, action = 'vert_scrolling'),
- buttons = self.create_buttons()
- x = self.view.right + 5
- y = self.view.top
- for b in buttons:
- b.position = (x, y)
- self.add(b)
- y = b.bottom + 5
- #self.shrink_wrap()
- self.view.become_target()
-
- def create_buttons(self):
- return [
- Button("Scroll Left", action = ('scroll', -16, 0)),
- Button("Scroll Right", action = ('scroll', 16, 0)),
- Button("Scroll Up", action = ('scroll', 0, -16)),
- Button("Scroll Down", action = ('scroll', 0, 16)),
- Button("Small Extent", action = ('extent', 100, 100)),
- Button("Medium Extent", action = ('extent', 500, 500)),
- Button("Large Extent", action = ('extent', 1000, 1000)),
- self.h_scrolling_ctrl,
- self.v_scrolling_ctrl,
- self.border_ctrl,
- ]
-
- def scroll(self, dx, dy):
- self.view.scroll_by(dx, dy)
-
- def extent(self, w, h):
- self.view.extent = (w, h)
- self.view.invalidate()
- say("Extent =", self.view.extent)
-
- def horz_scrolling(self):
- self.view.hscrolling = self.h_scrolling_ctrl.value
-
- def vert_scrolling(self):
- self.view.vscrolling = self.v_scrolling_ctrl.value
-
- def change_border(self):
- self.view.border = self.border_ctrl.value
-
-win = TestWindow(size = (500, 500))
-win.show()
-
-instructions = """
-There should be a scrolling view containing a diagonal row of red
-triangles on a white background. All scrolling controls should work
-properly.
-
-The extent of the view is marked with a black border. Ensure that the
-scrolling range extends exactly to the outer edge of this border in
-all directions for Medium and Large extents. For Small extent, the
-scroll bars should be disabled.
-
-Buttons down the right side can be used to simulate clicking on the
-scroll arrows and to change the extent. Ensure that the scroll bars
-are updated accordingly when these buttons are used.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/13-cursor.py b/PyGUI-2.5.3/Tests/13-cursor.py
deleted file mode 100644
index 2bfdb66..0000000
--- a/PyGUI-2.5.3/Tests/13-cursor.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Basic cursor test
-#
-
-from GUI import Window, StdCursors, application
-from TestViews import TestDrawing
-from TestScrollableViews import TestScrollableView
-from testing import say
-
-def test():
- cursor = StdCursors.finger
- win = Window(title = "Cursor", width = 500, height = 400)
- view1 = TestDrawing(position = (20, 20), size = (100, 70), cursor = cursor)
- view2 = TestScrollableView(position = (140, 20), size = (200, 200),
- scrolling = 'hv')
- view2.cursor = cursor
- win.add(view1)
- win.place(view2, sticky = 'nsew')
- win.shrink_wrap((20, 20))
- win.show()
-
-instructions = """
-There should be a window containing two views. The cursor should be a
-pointing finger over both views.
-
-Check that the cursor is properly masked and has the hotspot in the
-correct place.
-
-Check that the cursor areas remain correct when the window is resized
-and the scrolling view is scrolled.
-"""
-
-say(instructions)
-test()
-application().run()
diff --git a/PyGUI-2.5.3/Tests/14-place.py b/PyGUI-2.5.3/Tests/14-place.py
deleted file mode 100644
index bea2304..0000000
--- a/PyGUI-2.5.3/Tests/14-place.py
+++ /dev/null
@@ -1,105 +0,0 @@
-from GUI import Window, View, CheckBox, Button, Label, \
- RadioButton, RadioGroup, TextField
-from TestViews import TestDrawing
-from TestScrollableViews import TestScrollableDrawing
-from testing import say
-
-def pushed_it():
- say("Button pushed.")
-
-def checked_it():
- say("Check boxes changed to:", cb1.on, cb2.on)
-
-def option_chosen():
- say("Hoopy option %d chosen" % rg.value)
-
-def main():
- global cb1, cb2, rg
-
- win = Window(title = "Place Me By Your Side", width = 720, height = 500)
-
- view1 = TestDrawing(width = 320, height = 200)
-
- cb1 = CheckBox(title = "Check Me!", action = checked_it)
-
- cb2 = CheckBox(title = "Check Me Too!", action = checked_it)
-
- rbs = []
- for i in range(1, 4):
- rb = RadioButton(title = "Hoopy Option %d" % i, value = i)
- rbs.append(rb)
-
- rg = RadioGroup(rbs, action = option_chosen)
-
- pb = Button(title = "Push Me!", action = pushed_it)
-
- view2 = TestScrollableDrawing(width = 300, height = 300)
-
- label = Label(text = "Flavour:")
-
- entry = TextField(width = 200)
-
- win.place(view1, left = 10, top = 10, border = 1)
-
- win.place_row([cb1, cb2], left = 10, top = (view1, 20), spacing = 20)
-
- win.place_column(rbs, left = view1 + 20, top = 10)
-
- win.place(pb, right = -20, bottom = -10, anchor = 'rb')
-
- win.place(view2,
- left = rbs[0] + 20, top = 10,
- right = -20,
- bottom = pb - 10,
- scrolling = 'hv',
- anchor = 'ltrb',
- border = 1)
-
- win.place(label, left = 10, top = (cb1, 20))
-
- win.place(entry, left = 10, top = (label, 10),
- #border = 1
- )
- entry.become_target()
-
- win.show()
-
- import GUI
- GUI.run()
-
-instructions = """
-There should be a window containing:
-
-1. A 320x200 view, 10 pixels from the left and top, containing some drawing.
-
-2. Below the view, aligned with its left edge:
-
- 2a. A row of two check boxes
-
- 2b. A label
-
- 2c. A text field
-
-3. To the right of the view, aligned with its top edge, a column
- of three radio buttons.
-
-4. To the right of the radio buttons, a scrolling view, 10 pixels from the
- top of the window and 20 from the right edge.
-
-5. In the bottom right corner of the window, a button, 10 pixels from the
- scrolling view and from the bottom of the window, and 20 pixels from the
- right edge.
-
-When the window is resized, the scrolling view should resize with it,
-and the button should remain the same distance from the bottom right
-corner.
-
-Check that the layout remains correct when the window is obscured and
-then revealed again.
-
-Check that the layout remains correct when the window is made too small
-to display all of the items and then enlarged again.
-"""
-
-say(instructions)
-main()
diff --git a/PyGUI-2.5.3/Tests/15-dialog.py b/PyGUI-2.5.3/Tests/15-dialog.py
deleted file mode 100644
index b65d694..0000000
--- a/PyGUI-2.5.3/Tests/15-dialog.py
+++ /dev/null
@@ -1,39 +0,0 @@
-from GUI import Dialog, Label, Button, application
-from GUI.StdButtons import DefaultButton, CancelButton
-from testing import say
-
-class TestDialog(Dialog):
-
- def ok(self):
- say("OK")
-
- def cancel(self):
- say("Cancel")
-
-dlog = TestDialog(width = 250)
-lbl = Label(text = "Eject the tomato?")
-ok_btn = DefaultButton()
-cancel_btn = CancelButton()
-
-dlog.place(lbl, left = 20, top = 20)
-dlog.place(ok_btn, left = 20, top = lbl + 20)
-dlog.place(cancel_btn, right = -20, top = lbl + 20)
-dlog.height = ok_btn.bounds[3] + 20
-
-dlog.show()
-
-instructions = """
-There should be a non-modal dialog with two buttons in 'default' and
-'cancel' styles. The window should be movable but not resizable.
-
-Messages should be printed when the buttons are pressed (although they
-should not dismiss the dialog). Return and Enter should activate the
-OK button, and Escape should activate the Cancel button.
-
-On platforms without an application-wide menu bar, the window should
-not have a menu bar, but the keyboard equivalent of the Quit command
-should still work.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/16-modal_dialog.py b/PyGUI-2.5.3/Tests/16-modal_dialog.py
deleted file mode 100644
index a98b55e..0000000
--- a/PyGUI-2.5.3/Tests/16-modal_dialog.py
+++ /dev/null
@@ -1,49 +0,0 @@
-from GUI import Window, ModalDialog, Label, Button, \
- TextField, application
-from GUI.StdButtons import DefaultButton, CancelButton
-from testing import say
-
-def modal_dialog():
- #global dlog ###
- dlog = ModalDialog(title = "Spanish Inquisition", size = (200, 140))
- dlog.place(Label(text = "Surprise!!!"), left = 20, top = 20)
- field = TextField()
- dlog.place(field, left = 20, top = 60, right = -20)
- field.become_target()
- dlog.default_button = DefaultButton()
- dlog.cancel_button = CancelButton()
- dlog.place(dlog.default_button, right = -20, bottom = -20)
- dlog.place(dlog.cancel_button, left = 20, bottom = -20)
- dlog.center()
- result = dlog.present()
- say("Result =", result)
- dlog.destroy()
-
-win = Window(title = "Modal Dialogs", size = (200, 60))
-dialog_button = Button(title = "Give Me A Dialog", action = modal_dialog)
-win.place(dialog_button, left = 20, top = 20)
-win.show()
-
-instructions = """
-Clicking the "Give Me A Dialog" button should pop up a modal
-dialog centered on the screen, containing a label, a text
-field, an OK button and a Cancel button.
-
-While the dialog is up:
-* Interaction with the main window should be prevented.
-* Edit menu commands should be enabled as appropriate for the
- text field; other menu commands should be disabled.
-
-Clicking the OK button or pressing Return or Enter should
-dismiss the dialog and report "Result = True".
-
-Clicking the Cancel button or pressing Escape should
-dismiss the dialog and report "Result = False".
-
-On platforms without an application-wide menu bar, there should be
-no menu bar in the window. However, the keyboard equivalents of the
-edit menu commands should still work.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/17-alerts.py b/PyGUI-2.5.3/Tests/17-alerts.py
deleted file mode 100644
index 0634c12..0000000
--- a/PyGUI-2.5.3/Tests/17-alerts.py
+++ /dev/null
@@ -1,88 +0,0 @@
-from GUI import Window, Button, RadioGroup, RadioButton, \
- application
-from GUI.Alerts import alert, alert2, alert3, note_alert, stop_alert, \
- ask, confirm, ask_or_cancel, confirm_or_cancel
-from testing import say
-
-kinds = ['stop', 'caution', 'note', 'query']
-
-def the_kind():
- return rg.value
-
-def do_alert():
- alert(the_kind(), "The pudding factory is haunted.")
-
-def do_alert2():
- say("Doing alert2")
- result = alert2(the_kind(),
- "Do you really want to visit the haunted pudding factory?")
- say("Result =", result)
-
-def do_alert3():
- say("Doing alert3")
- result = alert3(the_kind(), "Exorcise the haunted pudding factory?")
- say("Result =", result)
-
-def do_note_alert():
- note_alert("The pudding is lumpy.")
-
-def do_stop_alert():
- stop_alert("Too much tapioca.")
-
-def do_ask():
- say("Doing ask")
- result = ask("Stir the pudding?")
- say("Result =", result)
-
-def do_ask_or_cancel():
- say("Doing ask_or_cancel")
- result = ask_or_cancel("How quickly do you want to stir the pudding?",
- "Fast", "Slow")
- say("Result =", result)
-
-def do_confirm():
- say("Doing confirm")
- result = confirm("Attack Orpuddex?")
- say("Result =", result)
-
-def do_confirm_or_cancel():
- say("Doing confirm_or_cancel")
- result = confirm_or_cancel(
- "Orpuddex is attacking.\nWhat is your response?",
- "Retaliate", "Surrender", "Run Away")
- say("Result =", result)
-
-win = Window(title = "Alerts")
-rg = RadioGroup()
-rb = []
-for kind in kinds:
- rb.append(RadioButton(kind.capitalize(), value = kind, group = rg))
-rg.set_value('stop')
-pb = [
- Button(title = "Alert", action = do_alert),
- Button(title = "Alert2", action = do_alert2),
- Button(title = "Alert3", action = do_alert3),
-]
-pb2 = [
- Button("Note Alert", action = do_note_alert),
- Button("Stop Alert", action = do_stop_alert),
- Button("Ask", action = do_ask),
- Button("Confirm", action = do_confirm),
- Button("Ask or Cancel", action = do_ask_or_cancel),
- Button("Confirm or Cancel", action = do_confirm_or_cancel),
-]
-win.place_column(pb, left = 20, top = 20)
-win.place_column(rb, left = pb[2] + 20, top = 20)
-win.place_column(pb2, left = rb[1].right + 20, top = 20)
-win.size = (pb2[-1].right + 20, pb2[-1].bottom + 20)
-win.show()
-
-instructions = """
-This lets you play around with the various standard dialog functions.
-Consult the documentation for details of how they should behave. Check
-that appropriate icons are displayed for the different flavours according
-to platform conventions.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/18-exceptions.py b/PyGUI-2.5.3/Tests/18-exceptions.py
deleted file mode 100644
index f34bb25..0000000
--- a/PyGUI-2.5.3/Tests/18-exceptions.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from GUI import Window, Button, application
-from GUI.Exceptions import ApplicationError
-from testing import say
-
-class ShrubberyError(Exception):
- pass
-
-def raise_application_error():
- raise ApplicationError("Your underpants are on fire.",
- "Please notify the fire service and proceed in an orderly manner to the nearest exit.")
-
-def raise_exception():
- raise ShrubberyError("The shrubbery is too small.")
-
-def test():
- win = Window(title = "Exceptions", size = (200, 100))
- but1 = Button("ApplicationError", action = raise_application_error)
- but2 = Button("Exception", action = raise_exception)
- win.place_column([but1, but2], left = 20, top = 20)
- win.shrink_wrap(padding = (20, 20))
- win.show()
- application().run()
-
-instructions = """
-Pressing the ApplicationError button will raise an ApplicationError.
-An alert box should appear displaying message and detail strings.
-
-Pressing the Exception button will raise an exception. A dialog box
-should appear containing a description of the exception and options
-Continue, Traceback and Abort. Continue should continue the application
-with no further action. Traceback should print a traceback to the
-console and then continue. Abort should print a traceback and exit
-the application.
-"""
-
-say(instructions)
-test()
diff --git a/PyGUI-2.5.3/Tests/19-file_dialogs.py b/PyGUI-2.5.3/Tests/19-file_dialogs.py
deleted file mode 100644
index be6c3f6..0000000
--- a/PyGUI-2.5.3/Tests/19-file_dialogs.py
+++ /dev/null
@@ -1,145 +0,0 @@
-import os, sys
-from GUI import Window, Button, CheckBox, application
-from GUI.Files import FileType, DirRef, FileRef
-from testing import say
-
-from GUI import FileDialogs
-functions = {}
-function_names = [
- 'request_old_file',
- 'request_old_files',
- 'request_new_file',
- 'request_old_directory',
- 'request_old_directories',
- 'request_new_directory',
-]
-for name in function_names:
- if hasattr(FileDialogs, name):
- functions[name] = getattr(FileDialogs, name)
- else:
- say("*** Missing function:", name)
-
-last_dir = DirRef(path = os.path.abspath(os.path.dirname(sys.argv[0])))
-last_name = ""
-
-say("last_dir =", last_dir) ###
-
-class TestWindow(Window):
-
- file_type = FileType(name = "TIFF Image", suffix = "tiff")
-
- def __init__(self):
- Window.__init__(self, size = (200, 200))
- self.filt = CheckBox("%ss only" % self.file_type.name)
- #self.multi = CheckBox("Multiple Selection")
- buts = []
- if 'request_old_file' in functions:
- buts.append(Button("Old File", action = self.do_old_file))
- if 'request_old_files' in functions:
- buts.append(Button("Old Files", action = self.do_old_files))
- if 'request_new_file' in functions:
- buts.append(Button("New File", action = self.do_new_file))
- if 'request_old_directory' in functions:
- buts.append(Button("Old Directory", action = self.do_old_dir))
- if 'request_old_directories' in functions:
- buts.append(Button("Old Directories", action = self.do_old_dirs))
- if 'request_new_directory' in functions:
- buts.append(Button("New Directory", action = self.do_new_dir))
- self.place_column([self.filt] + buts, left = 20, top = 20)
- self.shrink_wrap(padding = (20, 20))
-
- def save_result(self, result):
- if isinstance(result, list):
- say("Result:")
- for item in result:
- say(" ", item)
- else:
- say("Result =", result)
- print
- global last_dir, last_name
- if result:
- if isinstance(result, FileRef):
- last_dir = result.dir
- last_name = result.name
- elif isinstance(result, DirRef):
- say("Setting last_dir to", result) ###
- last_dir = result
-
- #def multiple(self):
- # return self.multi.on
-
- def do_old_file(self):
- say("Doing request_old_file")
- if self.filt.on:
- file_types = [self.file_type]
- else:
- file_types = None
- result = FileDialogs.request_old_file("Open Dusty Old File:",
- default_dir = last_dir, file_types = file_types)
- self.save_result(result)
-
- def do_old_files(self):
- say("Doing request_old_files")
- if self.filt.on:
- file_types = [self.file_type]
- else:
- file_types = None
- result = FileDialogs.request_old_files("Open Dusty Old Files:",
- default_dir = last_dir, file_types = file_types)
- self.save_result(result)
-
- def do_old_dir(self):
- say("Doing request_old_directory")
- result = FileDialogs.request_old_directory("Open Mouldy Old Directory:",
- default_dir = last_dir)
- self.save_result(result)
-
- def do_old_dirs(self):
- say("Doing request_old_directories")
- result = FileDialogs.request_old_directories("Open Mouldy Old Directories:",
- default_dir = last_dir)
- self.save_result(result)
-
- def do_new_file(self):
- say("Doing request_new_file with default_dir = %s, default_name = %r"
- % (last_dir, last_name))
- if self.filt.on:
- file_type = self.file_type
- else:
- file_type = None
- result = FileDialogs.request_new_file("Save Shiny New File:",
- default_dir = last_dir, default_name = last_name, file_type = file_type)
- self.save_result(result)
-
- def do_new_dir(self):
- say("Doing request_new_directory")
- result = FileDialogs.request_new_directory("Create Sparkling New Directory:",
- default_dir = last_dir, default_name = last_name)
- self.save_result(result)
-
-def test():
- win = TestWindow()
- win.show()
- application().run()
-
-
-instructions = """
-Buttons should be available for the following dialogs:
-
- * Old File - select a single existing file
- * Old Files - select multiple existing files
- * New File - specify name and location of a new file
- * Old Directory - select a single existing directory
- * Old Directories - select multiple existing directories
- * New Directory - specify name and location of a new directory
-
-The selected filename or list of filenames should be printed,
-or None if the dialog is cancelled.
-
-Checking 'TIFF Images Only' should restrict the files selectable
-by Old File and Old Files, and force the file name returned by
-New File to have a suffix of '.tiff'.
-"""
-
-say(instructions)
-test()
diff --git a/PyGUI-2.5.3/Tests/20-document.py b/PyGUI-2.5.3/Tests/20-document.py
deleted file mode 100644
index 00c3913..0000000
--- a/PyGUI-2.5.3/Tests/20-document.py
+++ /dev/null
@@ -1,53 +0,0 @@
-from GUI import Application, Window, Document, View, rgb, application
-from testing import say
-
-class TestDoc(Document):
-
- color = rgb(0.5, 0.5, 0.5)
-
- def set_color(self, c):
- self.color = c
- self.changed()
- self.notify_views()
-
-
-class TestDocView(View):
-
- def draw(self, c, r):
- r = self.viewed_rect()
- #say("TestDocView.draw: viewed_rect =", r)
- m = self.model
- c.forecolor = m.color
- c.fill_rect(self.viewed_rect())
-
- def mouse_down(self, e):
- l, t, r, b = self.viewed_rect()
- x, y = e.position
- red = float(x - l) / float(r - l)
- green = float(r - x) / float(r - l)
- blue = float(y - b) / float(t - b)
- self.model.set_color(rgb(red, green, blue))
-
-
-def test():
- doc = TestDoc(title = "Document")
- view = TestDocView(model = doc, size = (200, 200))
- win = Window(resizable = 0, size = (200, 200))
- win.add(view)
- win.document = doc
- #say(view.x, view.y, view.width, view.height)
- win.show()
- application().run()
-
-instructions = """
-There should be a window titled 'Document'.
-
-Clicking in the window should cause it to be filled with a colour
-that depends on the position of the click. On closing the window
-or quitting the application, if the window has been clicked,
-you should be asked whether to save changes. Cancelling should
-prevent the close or quit.
-"""
-
-say(instructions)
-test()
diff --git a/PyGUI-2.5.3/Tests/21-image.py b/PyGUI-2.5.3/Tests/21-image.py
deleted file mode 100644
index 57998ef..0000000
--- a/PyGUI-2.5.3/Tests/21-image.py
+++ /dev/null
@@ -1,48 +0,0 @@
-from GUI import Window, View, Image, application
-from GUI.Geometry import offset_rect, rect_sized
-from GUI.StdColors import yellow
-from testing import say
-
-
-class ImageTestView(View):
-
- def draw(self, c, r):
- c.backcolor = yellow
- c.erase_rect(r)
- main_image_pos = (10, 10)
- src_rect = image.bounds
- #say("Image bounds =", src_rect)
- dst_rect = offset_rect(src_rect, main_image_pos)
- #say("Drawing", src_rect, "in", dst_rect)
- image.draw(c, src_rect, dst_rect)
- src_rect = rect_sized((180, 160), (100, 100))
- c.frame_rect(offset_rect(src_rect, main_image_pos))
- dst_rect = rect_sized((10, 340), (150, 150))
- #say("Drawing", src_rect, "in", dst_rect)
- image.draw(c, src_rect, dst_rect)
- dst_rect = rect_sized((200, 340), (100, 100))
- #say("Drawing", src_rect, "in", dst_rect)
- image.draw(c, src_rect, dst_rect)
- dst_rect = rect_sized((340, 340), (50, 50))
- #say("Drawing", src_rect, "in", dst_rect)
- image.draw(c, src_rect, dst_rect)
-
-import os, sys
-here = sys.path[0]
-image_path = os.path.join(here, "imac.jpg")
-image = Image(file = image_path)
-
-win = Window(size = (500, 500))
-view = ImageTestView(size = win.size)
-win.add(view)
-view.become_target()
-win.show()
-
-instructions = """
-There should be a 360x264 image of an iMac with a rectangle drawn
-around part of the image. This part should appear at three different
-sizes (150x150, 100x100, 50x50) below the main image.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/22-pixmap.py b/PyGUI-2.5.3/Tests/22-pixmap.py
deleted file mode 100644
index 71babc3..0000000
--- a/PyGUI-2.5.3/Tests/22-pixmap.py
+++ /dev/null
@@ -1,57 +0,0 @@
-from GUI import Window, View, Pixmap, application
-from GUI.Geometry import offset_rect, rect_sized
-from GUI.StdColors import red, yellow, green, blue, cyan, black
-from testing import say
-
-class PixmapTestView(View):
-
- def draw(self, c, r):
- c.erase_rect(r)
- main_image_pos = (10, 10)
- src_rect = pixmap.bounds
- dst_rect = offset_rect(src_rect, main_image_pos)
- pixmap.draw(c, src_rect, dst_rect)
- src_rect = rect_sized((180, 160), (100, 100))
- c.frame_rect(offset_rect(src_rect, main_image_pos))
- dst_rect = rect_sized((10, 340), (150, 150))
- pixmap.draw(c, src_rect, dst_rect)
- dst_rect = rect_sized((200, 340), (100, 100))
- pixmap.draw(c, src_rect, dst_rect)
- dst_rect = rect_sized((340, 340), (50, 50))
- pixmap.draw(c, src_rect, dst_rect)
-
-
-def do_test_drawing(c):
- b = pixmap.bounds
- c.forecolor = cyan
- c.fill_rect(b)
- r = (20, 20, 200, 230)
- c.forecolor = red
- c.fill_rect(r)
- r = (160, 90, 300, 180)
- c.forecolor = yellow
- c.fill_rect(r)
- r = (250, 200, 350, 275)
- c.forecolor = blue
- c.fill_oval(r)
-
-instructions = """
-There should be a 400x300 image containing a filled red rectangle,
-yellow rectangle and blue oval on a cyan background, with a black
-frame around part of the image. The framed part should appear below
-in three different sizes, 150x150, 100x100 and 50x50.
-"""
-
-say(instructions)
-
-app = application()
-
-pixmap = Pixmap(400, 300)
-pixmap.with_canvas(do_test_drawing)
-
-win = Window(title = "Pixmap", size = (500, 500))
-view = PixmapTestView(size = win.size)
-win.add(view)
-win.show()
-
-app.run()
diff --git a/PyGUI-2.5.3/Tests/23-shrink_wrap.py b/PyGUI-2.5.3/Tests/23-shrink_wrap.py
deleted file mode 100644
index 377500a..0000000
--- a/PyGUI-2.5.3/Tests/23-shrink_wrap.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from GUI import Window, Button, CheckBox, TextField, application
-from testing import say
-
-def test():
- def bing():
- say("Bing!")
- #fld._win_dump_flags()
- win = Window(title = "Shrink Wrap", resizable = 0)
- but = Button("Bing!", action = bing)
- cbx = CheckBox("Spam")
- fld = TextField(width = 100)
- win.place(but, left = 20, top = 20)
- win.place(cbx, left = but + 20, top = 20)
- win.place(fld, left = 20, top = but + 20)
- win.shrink_wrap()
- win.show()
- application().run()
-
-
-instructions = """
-There should be a window containing three controls, with the window
-sized to fit the controls with 20 pixels of space on all sides.
-"""
-
-say(instructions)
-test()
diff --git a/PyGUI-2.5.3/Tests/24-task.py b/PyGUI-2.5.3/Tests/24-task.py
deleted file mode 100644
index b319f9c..0000000
--- a/PyGUI-2.5.3/Tests/24-task.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from GUI import Window, Button, Task, application
-from testing import say
-
-def do_task():
- say("Doing the task")
-
-task = Task(do_task, 1.0, repeat = 1, start = 0)
-
-def start_task():
- task.start()
-
-def stop_task():
- task.stop()
-
-def test():
- starter = Button("Start", action = start_task)
- stopper = Button("Stop", action = stop_task)
- win = Window(title = "Tasks")
- win.place_column([starter, stopper], left = 20, top = 20, spacing = 20)
- win.shrink_wrap(padding = (20, 20))
- win.show()
- application().run()
-
-instructions = """
-Pressing the Start button should begin a task which prints a
-message every second, and the Stop button should stop it.
-"""
-
-say(instructions)
-test()
diff --git a/PyGUI-2.5.3/Tests/25-password.py b/PyGUI-2.5.3/Tests/25-password.py
deleted file mode 100644
index ad38ce7..0000000
--- a/PyGUI-2.5.3/Tests/25-password.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from GUI import Window, TextField, Button, application
-from testing import say
-
-def show(tf):
- say("Text = %r" % tf.text)
-
-def make_window():
- win = Window(size = (240, 100), title = "Password")
- tf = TextField(position = (20, 20), width = 200, password = True)
- ok = Button("OK", position = (20, 60), action = (show, tf))
- win.add(tf)
- win.add(ok)
- win.show()
-
-make_window()
-
-instructions = """
-There should be a window containing a password entry field.
-Text in the field should be obfuscated, and it should not be
-possible to copy text out of the field. The OK button should
-cause the contents of the field to be reported.
-"""
-
-say(instructions)
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/26-targeting.py b/PyGUI-2.5.3/Tests/26-targeting.py
deleted file mode 100644
index 904f337..0000000
--- a/PyGUI-2.5.3/Tests/26-targeting.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# PyGUI - Test targeted() and untargeted() methods
-#
-
-from GUI import View, Window, application
-from GUI.StdColors import red, green
-from testing import say
-
-class TestPatch(View):
-
- def __init__(self, name, color, **kwds):
- self.name = name
- self.color = color
- View.__init__(self, size = (60, 60), **kwds)
-
- def draw(self, c, r):
- c.forecolor = self.color
- c.fill_rect(r)
-
- def mouse_down(self, e):
- say("%s clicked" % self.name)
- self.become_target()
-
- def targeted(self):
- say("%s targeted" % self.name)
-
- def untargeted(self):
- say("%s untargeted" % self.name)
-
-def test():
- win = Window(title = "Targeting", size = (180, 100))
- patch1 = TestPatch("Red patch", red, position = (20, 20))
- patch2 = TestPatch("Green patch", green, position = (100, 20))
- win.add(patch1)
- win.add(patch2)
- win.show()
- application().run()
-
-instructions = """
-There should be a window with two coloured patches. Clicking
-in a patch will make it the target. Messages should be printed
-whenever a patch is clicked or its target status changes.
-"""
-
-say(instructions)
-test()
diff --git a/PyGUI-2.5.3/Tests/27-poly.py b/PyGUI-2.5.3/Tests/27-poly.py
deleted file mode 100644
index 7b5d5d5..0000000
--- a/PyGUI-2.5.3/Tests/27-poly.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from GUI import Window, View, application
-from GUI.StdColors import green, black, white
-from testing import say
-
-class PolyView(View):
-
- def draw(self, c, r):
- points = [(10, 10), (20, 100), (50, 90), (100, 50), (40, 40)]
- c.forecolor = white
- c.fill_rect(r)
- c.forecolor = green
- c.fill_poly(points)
- c.forecolor = black
- c.stroke_poly(points)
-
-
-def main():
- win = Window()
- view = PolyView(width = 120, height = 120)
- win.add(view)
- win.shrink_wrap()
- win.show()
- application().run()
-
-instructions = """
-There should be a window containing an irregularly-shaped
-polygon filled with green and outlined in black.
-"""
-
-say(instructions)
-main()
diff --git a/PyGUI-2.5.3/Tests/28-std-cursors.py b/PyGUI-2.5.3/Tests/28-std-cursors.py
deleted file mode 100644
index 6a6dbcb..0000000
--- a/PyGUI-2.5.3/Tests/28-std-cursors.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Standard cursors test
-#
-
-from GUI import Window, View, \
- RadioGroup, RadioButton, application #, StdCursors
-from GUI.StdColors import black, white
-from testing import say
-
-class TestArea(View):
-
- def draw(self, c, r):
- c.forecolor = white
- c.fill_rect(r)
- c.forecolor = black
- w, h = self.size
- c.frame_rect((0, 0, w, h))
-
-def test():
- def select():
- i = group.value
- name = cursor_names[i]
- say("Selecting cursor no. %d (%s)" % (i, name))
- cursor = getattr(StdCursors, name)
- say("...", cursor)
- view.cursor = cursor
- win = Window(title = "Std Cursors")
- view = TestArea(size = (100, 100))
- win.place(view, left = 20, top = 20)
- group = RadioGroup(action = select)
- for i, name in enumerate(cursor_names):
- group.add_item(RadioButton(title = name, value = i))
- win.place_column(group, left = view + 20, top = 20, spacing = 0)
- win.shrink_wrap((20, 20))
- win.show()
- application().run()
-
-app = application()
-from GUI import StdCursors
-cursor_names = []
-for name in StdCursors.__all__:
- cursor_names.append(name)
-test()
diff --git a/PyGUI-2.5.3/Tests/29-slider.py b/PyGUI-2.5.3/Tests/29-slider.py
deleted file mode 100644
index 0c96ddc..0000000
--- a/PyGUI-2.5.3/Tests/29-slider.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#
-# PyGUI - Slider test
-#
-
-from GUI import Slider, Window, run
-from testing import say
-
-def slid(slider, orient, number):
- name = "%s%s" % (orient.upper(), number)
- def action():
- say("Slider %s value = %s" % (name, slider.value))
- return action
-
-def test(orient, pos, pad):
- win = Window(title = "%s Sliders" % orient.upper(), position = pos,
- auto_position = False)
- sliders = []
- if 1:
- #say("Creating slider 1")
- sl1 = sl2 = sl3 = None
- sl1 = Slider(orient = orient, max_value = 100)
- sl1.action = slid(sl1, orient, 1)
- sliders.append(sl1)
- if 1:
- #say("Creating slider 2")
- sl2 = Slider(orient = orient, max_value = 100, ticks = 6, live = False)
- sl2.value = 50
- sl2.action = slid(sl2, orient, 2)
- sliders.append(sl2)
- if 1:
- #say("Creating slider 3")
- sl3 = Slider(orient = orient, max_value = 100, ticks = 6, discrete = True)
- sl3.value = 100
- sl3.action = slid(sl3, orient, 3)
- sliders.append(sl3)
- #say("Created sliders")
- if orient == 'h':
- win.place_column(sliders, left = 20, top = 20, spacing = 20, sticky = 'ew')
- if sl2:
- sl2.vstretch = True
- if sl3:
- sl3.vmove = True
- else:
- win.place_row(sliders, left = 20, top = 20, spacing = 20, sticky = 'ns')
- if sl2:
- sl2.hstretch = True
- if sl3:
- sl3.hmove = True
- #say("Placed sliders")
- win.shrink_wrap()
- win.show()
-
-instructions = """
-There should be two windows, one containing horizontal sliders and
-one containing vertical sliders. In each window, there should be
-three sliders:
-
-1. No tick marks, continuous range 0 to 100,
- initial value 0, live.
-
-2. 6 tick marks, continuous range 0 to 100,
- initial value 50, non-live.
-
-3. 6 tick marks, discrete range 0 to 100 in steps of 20,
- initial value 100, live.
-
-The 'live' sliders should report their values continuously while
-the mouse is dragged; the others should report their values only
-when the mouse is released.
-"""
-
-say(instructions)
-test('h', (20, 60), (30, 30))
-test('v', (200, 60), (60, 30))
-run()
diff --git a/PyGUI-2.5.3/Tests/30-frame.py b/PyGUI-2.5.3/Tests/30-frame.py
deleted file mode 100644
index c48f1a6..0000000
--- a/PyGUI-2.5.3/Tests/30-frame.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# PyGUI - Frame test
-#
-
-from GUI import Window, Frame, Label, run
-from testing import say
-
-def test():
- win = Window(title = "Frame")
- frm = Frame()
- frm.place_column([
- Label("This is"),
- Label("A frame")],
- left = 0, top = 0)
- frm.shrink_wrap()
- win.place(frm, left = 30, top = 30)
- win.shrink_wrap(padding = (30, 30))
- win.show()
-
-instructions = """
-There should be a window containing two labels
-spaced 30 pixels from the edge of the window on
-all sides.
-"""
-
-say(instructions)
-test()
-run()
diff --git a/PyGUI-2.5.3/Tests/31-canvas.py b/PyGUI-2.5.3/Tests/31-canvas.py
deleted file mode 100644
index 97a6df8..0000000
--- a/PyGUI-2.5.3/Tests/31-canvas.py
+++ /dev/null
@@ -1,138 +0,0 @@
-#
-# PyGUI - Canvas primitives test
-#
-
-from GUI import Window, View, Menu, application
-from GUI.StdMenus import basic_menus
-from GUI.StdColors import black, white
-from testing import say
-
-r = 40
-sa = 45
-#aa = 240
-ea = 270
-
-class LineTest:
-
- menu_item = "Line/^L"
-
- def draw(self, c):
- c.newpath()
- c.moveto(10, 10)
- c.lineto(190, 290)
- c.stroke()
-
-
-class RectTest:
-
- menu_item = "Rect/^R"
-
- def draw(self, c):
- c.stroke_rect((20, 20, 180, 80))
- c.frame_rect((20, 120, 180, 180))
- c.fill_rect((20, 220, 180, 280))
-
-
-class OvalTest:
-
- menu_item = "Oval/^O"
-
- def draw(self, c):
- c.stroke_oval((20, 20, 180, 80))
- c.frame_oval((20, 120, 180, 180))
- c.fill_oval((20, 220, 180, 280))
-
-
-class ArcTest:
-
- menu_item = "Arc/^A"
-
- def draw(self, c):
- c.stroke_arc((50, 50), r, sa, ea)
- c.frame_arc((50, 150), r, sa, ea)
- #c.fill_arc((50, 250), r, sa, ea)
-
-
-class WedgeTest:
-
- menu_item = "Wedge/^W"
-
- def draw(self, c):
- c.stroke_wedge((50, 50), r, sa, ea)
- #c.frame_wedge((50, 150), r, sa, ea)
- c.fill_wedge((50, 250), r, sa, ea)
-
-class BezierTest:
-
- menu_item = "Bezier/^B"
-
- def bez_path(self, c, x0, y0):
- c.newpath()
- c.moveto(x0, y0 + 40)
- c.rcurveto((50, -100), (100, 100), (150, 0))
- c.closepath()
-
- def draw(self, c):
- self.bez_path(c, 10, 10)
- c.stroke()
- self.bez_path(c, 10, 210)
- c.fill()
-
-
-tests = [
- LineTest(),
- RectTest(),
- OvalTest(),
- ArcTest(),
- WedgeTest(),
- BezierTest(),
-]
-
-
-test_menu = Menu("Shape", [
- ([t.menu_item for t in tests], 'test_cmd')
-])
-
-
-class CTV(View):
-
- test = None
-
- def draw(self, c, r):
- c.forecolor = white
- c.fill_rect(r)
- c.forecolor = black
- c.pensize = 10
- if self.test:
- self.test.draw(c)
-
- def setup_menus(self, m):
- m.test_cmd.enabled = True
-
- def test_cmd(self, i):
- self.test = tests[i]
- self.invalidate()
-
-
-def main():
- view = CTV(size = (200, 300))
- win = Window(title = "Canvas")
- win.add(view)
- win.shrink_wrap()
- view.become_target()
- win.show()
- app = application()
- app.menus = basic_menus() + [test_menu]
- app.run()
-
-instructions = """
-The Line test should draw a straight diagonal line.
-The other tests should each produce a stroked shape,
-a framed shape and a filled shape where applicable.
-
-Arcs should start 45 degrees clockwise from the x
-axis and continue clockwise up to 270 degrees.
-"""
-
-say(instructions)
-main()
diff --git a/PyGUI-2.5.3/Tests/32-default-heights.py b/PyGUI-2.5.3/Tests/32-default-heights.py
deleted file mode 100644
index 255366d..0000000
--- a/PyGUI-2.5.3/Tests/32-default-heights.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# PyGUI - Default control height test
-#
-
-import sys
-from GUI import Window, Label, TextField, Button, CheckBox, RadioButton, Slider, \
- StdFonts, Font, run
-from testing import say
-
-#from AppKit import NSLayoutManager
-#nslm = NSLayoutManager.alloc().init()
-#
-#def showfont(n, f):
-# say("%s: %s" % (n, f))
-# say("height = %s" % f.height)
-# say("leading = %s" % f._ns_font.leading())
-# say("line height = %s" % nslm.defaultLineHeightForFont_(f._ns_font))
-
-def main():
- f = None
- args = sys.argv[1:]
- if args:
- fontsize = int(args[0])
- sf = StdFonts.system_font
- f = Font(sf.family, fontsize, sf.style)
- #showfont("Using font", f)
- win = Window(title = "Heights")
- if f:
- kwds = {'font': f}
- else:
- kwds = {}
- controls = [
- Label(text = "Label", **kwds),
- TextField(text = "Text", **kwds),
- CheckBox(title = "Check", **kwds),
- RadioButton(title = "Radio", **kwds),
- Slider(orient = 'h', width = 50),
- #Button(title = "Button", **kwds),
- ]
- #for ctl in controls:
- # say("Height of %r is %s" % (ctl, ctl.height))
- win.place_row(controls, left = 10, top = 10)
- win.shrink_wrap(padding = (10, 10))
- win.show()
- run()
-
-instructions = """
-The controls should line up horizontally.
-"""
-
-say(instructions)
-main()
diff --git a/PyGUI-2.5.3/Tests/33-mouse-events.py b/PyGUI-2.5.3/Tests/33-mouse-events.py
deleted file mode 100644
index 214fcfd..0000000
--- a/PyGUI-2.5.3/Tests/33-mouse-events.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# PyGUI - Mouse event test
-
-from GUI import Window, application
-from TestViews import TestDrawing
-from TestScrollableViews import TestScrollableDrawing
-from TestInput import TestMouseEvents
-from testing import say
-
-class TestView(TestMouseEvents, TestDrawing):
-
- def __init__(self, name, **kwds):
- self.name = name
- TestDrawing.__init__(self, **kwds)
-
- def mouse_down(self, event):
- #self.become_target()
- TestMouseEvents.mouse_down(self, event)
-
- def report_mouse_event(self, mess):
- say("%s: %s" % (self.name, mess))
-
-
-class TestScrollableView(TestMouseEvents, TestScrollableDrawing):
-
- def __init__(self, name, **kwds):
- self.name = name
- TestScrollableDrawing.__init__(self, scrolling = 'hv', **kwds)
-
- def mouse_down(self, event):
- #self.become_target()
- TestMouseEvents.mouse_down(self, event)
-
- def report_mouse_event(self, mess):
- say("%s: %s" % (self.name, mess))
-
-
-win = Window()
-view1 = TestView("View 1", width = 320, height = 200)
-view2 = TestScrollableView("View 2", width = 320, height = 200)
-win.place_row([view1, view2], left = 20, top = 20, spacing = 20)
-view2.hstretch = 1
-view2.vstretch = 1
-win.shrink_wrap(padding = (20, 20))
-win.show()
-view1.become_target()
-
-say("""
-There should be two views. The following events should be reported
-in either view: mouse_down, mouse_drag, mouse_up, mouse_move.
-
-The right-hand view should resize with the window. Check that
-mouse events are still reported correctly after resizing and after
-scrolling the view.
-""")
-
-application().run()
diff --git a/PyGUI-2.5.3/Tests/34-coloured-text.py b/PyGUI-2.5.3/Tests/34-coloured-text.py
deleted file mode 100644
index a76edf1..0000000
--- a/PyGUI-2.5.3/Tests/34-coloured-text.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# PyGUI - Test coloured text drawing
-#
-
-from GUI import Window, View, StdColors, run
-from testing import say
-
-tests = [
- ("Red", StdColors.red),
- ("Green", StdColors.green),
- ("Blue", StdColors.blue),
- ("Cyan", StdColors.cyan),
- ("Magenta", StdColors.magenta),
- ("Yellow", StdColors.yellow),
-]
-
-class TestView(View):
-
- def draw(self, c, r):
- c.forecolor = StdColors.grey
- c.fill_rect(r)
- f = c.font
- x = 10
- y = 10 + f.ascent
- h = f.line_height
- for (text, color) in tests:
- c.moveto(x, y)
- c.textcolor = color
- c.show_text(text)
- y += h
-
-def test():
- view = TestView(size = (300, 200))
- win = Window(title = "Coloured Text")
- win.add(view)
- win.shrink_wrap()
- win.show()
- run()
-
-instructions = """
-There should be a view showing text in a variety of colours.
-"""
-
-say(instructions)
-test()
diff --git a/PyGUI-2.5.3/Tests/35-fullscreen.py b/PyGUI-2.5.3/Tests/35-fullscreen.py
deleted file mode 100644
index fac2da2..0000000
--- a/PyGUI-2.5.3/Tests/35-fullscreen.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Python GUI - Test fullscreen windows
-#
-
-from GUI import Window, Label, run
-from testing import say
-
-class TestWindow(Window):
-
- def mouse_down(self, event):
- say("Mouse down in", self.title)
-
- def key_down(self, event):
- say("Key down in", self.title)
- self.other.show()
-
-win1 = TestWindow(title = "Fullscreen", style = 'fullscreen')
-win1.show()
-
-lbl = Label("Fullscreen", x = 300, y = 20)
-win1.add(lbl)
-
-win2 = TestWindow(title = "Not Fullscreen")
-
-win1.other = win2
-win2.other = win1
-win2.show()
-
-instructions = """
-There should be two windows, one fullscreen and one not fullscreen.
-The fullscreen window should have no title bar or other decorations
-and should fill the whole screen. Pressing a key should bring one or
-the other to the front. On MacOSX, the menu bar should be hidden when
-the fullscreen window is frontmost. Menu command key equivalents
-should still work.
-"""
-
-say(instructions)
-run()
diff --git a/PyGUI-2.5.3/Tests/36-no-cursor.py b/PyGUI-2.5.3/Tests/36-no-cursor.py
deleted file mode 100644
index e47363b..0000000
--- a/PyGUI-2.5.3/Tests/36-no-cursor.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Invisible cursor test
-#
-
-from GUI import Window, StdCursors, application
-from TestViews import TestDrawing
-from testing import say
-
-def test():
- cursor = StdCursors.empty_cursor()
- win = Window(title = "No Cursor", width = 500, height = 400)
- view = TestDrawing(position = (20, 20), size = (300, 200),
- cursor = cursor)
- win.add(view)
- win.show()
-
-instructions = """
-There should be a window containing a view. The cursor should be
-invisible when it is over the view.
-"""
-
-say(instructions)
-test()
-application().run()
diff --git a/PyGUI-2.5.3/Tests/37-image-cursor.py b/PyGUI-2.5.3/Tests/37-image-cursor.py
deleted file mode 100644
index 8a08dd8..0000000
--- a/PyGUI-2.5.3/Tests/37-image-cursor.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Basic cursor test
-#
-
-import os, sys
-from GUI import Window, Image, Cursor, application
-from TestViews import TestDrawing
-from TestScrollableViews import TestScrollableView
-from testing import say
-
-def test():
- file = "grail_masked.tiff"
- #file = "spam_masked.tiff"
- image = Image(os.path.join(sys.path[0], file))
- cursor = Cursor(image)
- win = Window(title = "Image Cursor", width = 500, height = 400)
- view1 = TestDrawing(position = (20, 20), size = (100, 70), cursor = cursor)
- view2 = TestScrollableView(position = (140, 20), size = (200, 200),
- scrolling = 'hv')
- view2.cursor = cursor
- win.add(view1)
- win.place(view2, sticky = 'nsew')
- win.shrink_wrap((20, 20))
- win.show()
-
-instructions = """
-There should be a window containing two views. The cursor should be a
-grail-shaped beacon over both views.
-
-Check that the cursor is properly masked and has the hotspot in the
-correct place.
-
-Check that the cursor areas remain correct when the window is resized
-and the scrolling view is scrolled.
-"""
-
-say(instructions)
-test()
-application().run()
diff --git a/PyGUI-2.5.3/Tests/38-keys.py b/PyGUI-2.5.3/Tests/38-keys.py
deleted file mode 100644
index ed5886d..0000000
--- a/PyGUI-2.5.3/Tests/38-keys.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Python GUI - Test keys
-#
-
-from GUI import Window, run
-from testing import say
-
-class TestWindow(Window):
-
- def key_down(self, event):
- say("char = %r key = %r unichars = %r _keycode = 0x%04x" % (
- event.char, event.key, event.unichars, event._keycode))
-
-instructions = """
-Check that the correct 'char' and 'key' values are produced
-for all keys.
-"""
-
-say(instructions)
-win = TestWindow(title = "Test Keys")
-win.show()
-run()
diff --git a/PyGUI-2.5.3/Tests/39-text_editor.py b/PyGUI-2.5.3/Tests/39-text_editor.py
deleted file mode 100644
index 1b0ca02..0000000
--- a/PyGUI-2.5.3/Tests/39-text_editor.py
+++ /dev/null
@@ -1,101 +0,0 @@
-from GUI import TextEditor, Window, Menu, Font, StdFonts, application
-from GUI.StdMenus import basic_menus
-from testing import say
-
-font_size = StdFonts.application_font.size
-mono_font = Font("Courier", font_size)
-sans_font = Font("Helvetica", font_size)
-
-tab_text = \
-"""X----X----X
-A\tB\tC"""
-
-test_text = \
-"""There was a young man from Gossage,
-Who was awfully fond of a sausage.
-He ate them in bed
-Between slices of bread
-And lay wake all night trying to think of something to rhyme with 'sausage', but couldn't.
-"""
-
-menus = [
- Menu("Test", [
- ("Show Selection/1", 'show_selection_cmd'),
- ("Select 3 to 7/2", 'set_selection_cmd'),
- ("Show Text/3", 'show_text_cmd'),
- ("Set Text/4", 'set_text_cmd'),
- ("Monospaced Font/5", 'mono_cmd'),
- ("Sans-Serif Font/6", 'sans_cmd'),
- ("Show Tab Spacing/7", 'show_tab_spacing_cmd'),
- ]),
-]
-
-class TestWindow(Window):
-
- def setup_menus(self, m):
- Window.setup_menus(self, m)
- m.show_selection_cmd.enabled = True
- m.set_selection_cmd.enabled = True
- m.show_text_cmd.enabled = True
- m.set_text_cmd.enabled = True
- m.mono_cmd.enabled = True
- m.sans_cmd.enabled = True
- m.show_tab_spacing_cmd.enabled = True
- #m..enabled = True
-
- def show_selection_cmd(self):
- say(self.view.selection)
-
- def set_selection_cmd(self):
- self.view.selection = (3, 7)
-
- def show_text_cmd(self):
- say(repr(self.view.text))
-
- def set_text_cmd(self):
- self.view.text = test_text
-
- def mono_cmd(self):
- self.view.font = mono_font
- self.setup_tabs()
-
- def sans_cmd(self):
- self.view.font = sans_font
- self.setup_tabs()
-
- def show_tab_spacing_cmd(self):
- say("Tab spacing =", self.view.tab_spacing)
-
- def setup_tabs(self):
- self.view.tab_spacing = self.view.font.width("X----")
-
-def make_window(x, scrolling, title):
- win = TestWindow(position = (x + 10, 50), size = (300, 400),
- auto_position = False, title = title)
- view = TextEditor(width = 300, height = 400, scrolling = scrolling,
- anchor = 'ltrb')
- win.view = view
- win.setup_tabs()
- view.text = tab_text
- win.add(view)
- view.become_target()
- win.show()
-
-say("""
-There should be three text editing areas, one with no scrolling, one with
-vertical scrolling and with both horizontal and vertical scrolling.
-
-The ones without horizontal scrolling should wrap text to the width of the
-visible area. Text should re-wrap when the window is resized.
-
-There should be tab stops set at the spacing of the X characters in the
-top line, and the characters in the next line should line up with them.
-""")
-
-make_window(0, '', "No Scrolling")
-make_window(310, 'v', "Vertical Scrolling")
-make_window(620, 'hv', "Full Scrolling")
-
-app = application()
-app.menus = basic_menus() + menus
-app.run()
diff --git a/PyGUI-2.5.3/Tests/40-row.py b/PyGUI-2.5.3/Tests/40-row.py
deleted file mode 100644
index 27ebb47..0000000
--- a/PyGUI-2.5.3/Tests/40-row.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from GUI import Window, Button, CheckBox, Label, TextField, Row, application
-from testing import say
-
-def make_row(align):
- return Row(
- [
- CheckBox("One"),
- Label("Two"),
- TextField(text = "Three", size = (100, 50)),
- Button("Four"),
- ],
- expand = 2,
- align = align)
-
-rows = []
-for align in ['t', 'c', 'b']:
- row = make_row(align)
- rows.append([row, "align = '%s'" % align])
-
-row = Row([Button("Buckle"), Button("My"), Button("Shoe")],
- equalize = 'w')
-rows.append([row, "equalize = 'w'"])
-
-y = 50
-for row, title in rows:
- row.position = (10, 10)
- row.anchor = 'ltrb'
- win = Window(title = title, position = (10, y),
- auto_position = False)
- win.add(row)
- win.shrink_wrap()
- win.show()
- y = win.bottom + 50
-
-instructions = """
-Check that the text field in the first three rows expands horizontally
-when the window is resized.
-
-Check that the components in the third row are anchored to the bottom
-of the window.
-
-The buttons in the fourth row should all be the same width.
-"""
-
-say(instructions)
-app = application()
-app.run()
diff --git a/PyGUI-2.5.3/Tests/41-column.py b/PyGUI-2.5.3/Tests/41-column.py
deleted file mode 100644
index f720596..0000000
--- a/PyGUI-2.5.3/Tests/41-column.py
+++ /dev/null
@@ -1,47 +0,0 @@
-from GUI import Window, Button, CheckBox, Label, TextField, Column, application
-from testing import say
-
-def make_col(align):
- return Column(
- [
- CheckBox("One"),
- Label("Two"),
- TextField(text = "Three", size = (100, 50)),
- Button("Four"),
- ],
- expand = 2,
- align = align)
-
-cols = []
-for align in ['l', 'c', 'r']:
- col = make_col(align)
- cols.append([col, "align = '%s'" % align])
-
-col = Column([Button("Buckle"), Button("My"), Button("Shoe")],
- equalize = 'w')
-cols.append([col, "equalize = 'w'"])
-
-x = 10
-for col, title in cols:
- col.position = (10, 10)
- col.anchor = 'ltrb'
- win = Window(title = title, position = (x, 50),
- auto_position = False)
- win.add(col)
- win.shrink_wrap()
- win.show()
- x = win.right + 10
-
-instructions = """
-Check that the text field in the first three columns expands vertically
-when the window is resized.
-
-Check that the components in the third column are anchored to the right
-of the window.
-
-The buttons in the fourth column should all be the same width.
-"""
-
-say(instructions)
-app = application()
-app.run()
diff --git a/PyGUI-2.5.3/Tests/42-grid.py b/PyGUI-2.5.3/Tests/42-grid.py
deleted file mode 100644
index 403ab23..0000000
--- a/PyGUI-2.5.3/Tests/42-grid.py
+++ /dev/null
@@ -1,25 +0,0 @@
-from GUI import Window, CheckBox, Label, TextField, Grid, application
-from testing import say
-
-items = [
- [Label("Name"), TextField(width = 100)],
- [Label("Age"), TextField(width = 50)],
- [Label("Language"), CheckBox("Python")],
-]
-
-grid = Grid(items)
-
-win = Window(title = "Grid")
-grid.position = (10, 10)
-win.add(grid)
-win.shrink_wrap()
-win.show()
-
-instructions = """
-There should be six components laid out in a grid of three rows
-and two columns. Each component should be centre-left aligned
-within its cell.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/43-scroll-embedded.py b/PyGUI-2.5.3/Tests/43-scroll-embedded.py
deleted file mode 100644
index ce685a9..0000000
--- a/PyGUI-2.5.3/Tests/43-scroll-embedded.py
+++ /dev/null
@@ -1,43 +0,0 @@
-from GUI import Window, Button, application
-from TestScrollableViews import TestScrollableView
-from testing import say
-
-class TestWindow(Window):
-
- def __init__(self, **kwds):
- Window.__init__(self, **kwds)
- view = TestScrollableView(container = self,
- size = (300, 300),
- extent = (1000, 1000),
- scrolling = 'hv',
- anchor = 'ltrb')
- button = Button("Embedded", action = self.click)
- off = (300, 300)
- view.scroll_offset = off
- button.position = off
- view.add(button)
- self.shrink_wrap()
-
- def click(self):
- say("Embedded button clicked")
-
-win = TestWindow(size = (500, 500))
-win.show()
-
-instructions = """
-There should be a scrolling view with an embedded button. The
-button should initially appear at the top left corner of the visible
-part of the view. The button should move with the view's contents
-when the view is scrolled.
-
-Check that the button responds to mouse clicks properly before and
-after scrolling.
-
-Check that mouse clicks outside the button are reported as clicks in
-the view before and after scrolling.
-
-Check that everything works correctly after resizing the window.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/44-pil_image.py b/PyGUI-2.5.3/Tests/44-pil_image.py
deleted file mode 100644
index d31f099..0000000
--- a/PyGUI-2.5.3/Tests/44-pil_image.py
+++ /dev/null
@@ -1,45 +0,0 @@
-from GUI import Window, View, application, rgb
-from GUI.Geometry import offset_rect, rect_sized
-from GUI.StdColors import yellow
-from GUI.PIL import image_from_pil_image
-import Image
-from testing import say
-
-from GUI import PIL
-PIL.debug_pil = True
-
-skyblue = rgb(102/255.0, 204/255.0, 1.0)
-
-class ImageTestView(View):
-
- def draw(self, c, r):
- c.backcolor = skyblue
- c.erase_rect(r)
- main_image_pos = (50, 50)
- src_rect = image.bounds
- #say("Image bounds =", src_rect)
- dst_rect = offset_rect(src_rect, main_image_pos)
- #say("Drawing", src_rect, "in", dst_rect)
- image.draw(c, src_rect, dst_rect)
-
-import os, sys
-here = sys.path[0]
-image_path = os.path.join(here, "pill.png")
-pil_image = Image.open(image_path)
-print "PIL Image: size =", pil_image.size, "mode =", pil_image.mode
-image = image_from_pil_image(pil_image)
-
-win = Window(size = (350, 200), title = "PIL Image")
-view = ImageTestView(size = win.size)
-win.add(view)
-view.become_target()
-win.show()
-
-instructions = """
-There should be an image of a red and yellow pill on a blue background.
-The background should show through transparent areas of the image, and
-the edges of the non-transparent areas should be smooth.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/45-ndarray.py b/PyGUI-2.5.3/Tests/45-ndarray.py
deleted file mode 100644
index e1cb5b1..0000000
--- a/PyGUI-2.5.3/Tests/45-ndarray.py
+++ /dev/null
@@ -1,56 +0,0 @@
-from __future__ import division
-from math import sin, pi
-from numpy import zeros, uint8
-from GUI import Window, View, application, rgb
-from GUI.StdColors import yellow
-from GUI.Numerical import image_from_ndarray
-from GUI.Geometry import offset_rect
-from testing import say
-
-background = rgb(0.25, 0.25, 0.25)
-
-width = 300
-height = 100
-
-def plot(a, f, c):
- h = height // 2
- A = h - 1
- for x in xrange(width):
- y = h + int(round(A * sin(2 * pi * f * x / width)))
- a[y, x] = c
-
-def make_array():
- a = zeros((height, width, 4), uint8)
- plot(a, 1, (255, 0, 0, 255))
- plot(a, 2, (255, 255, 0, 255))
- plot(a, 3, (0, 255, 0, 255))
- return a
-
-the_array = make_array()
-the_image = image_from_ndarray(the_array, 'RGBA')
-
-class ImageTestView(View):
-
- def draw(self, c, r):
- image = the_image
- c.backcolor = background
- c.erase_rect(r)
- main_image_pos = (10, 10)
- src_rect = image.bounds
- #say("Image bounds =", src_rect)
- dst_rect = offset_rect(src_rect, main_image_pos)
- #say("Drawing", src_rect, "in", dst_rect)
- image.draw(c, src_rect, dst_rect)
-
-win = Window(size = (width + 20, height + 20), title = "Image from NumPy Array")
-view = ImageTestView(size = win.size)
-win.add(view)
-view.become_target()
-win.show()
-
-instructions = """
-There should be a red, a yellow and a green sinewave on a grey background.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/46-listbutton.py b/PyGUI-2.5.3/Tests/46-listbutton.py
deleted file mode 100644
index 440221a..0000000
--- a/PyGUI-2.5.3/Tests/46-listbutton.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from GUI import Window, ListButton, application
-from testing import say
-
-def report():
- print "Value =", but.value
-
-but = ListButton(position = (20, 20),
- titles = ["Beatles", "Abba", "Enya"],
- values = [17, 42, 88],
- action = report)
-but.value = 42
-win = Window(title = "List Button")
-win.add(but)
-but.become_target()
-win.show()
-
-instructions = """
-There should be a list button with the following titles and values:
-
- "Beatles", 17
- "Abba", 42
- "Enya", 88
-
-Selecting an item should cause its value to be reported. On Windows,
-it should be possible to make a selection by typing the first letter
-of the title.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/47-grid_view.py b/PyGUI-2.5.3/Tests/47-grid_view.py
deleted file mode 100644
index 772d0ee..0000000
--- a/PyGUI-2.5.3/Tests/47-grid_view.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from GUI import Window, GridView, run
-from testing import say
-
-class TestGridView(GridView):
-
- def __init__(self):
- GridView.__init__(self, num_rows = 10, num_columns = 5,
- cell_size = (50, 20), anchor = 'ltrb')
- self.content_size = self.extent
-
- def draw_cell(self, c, row, col, rect):
- x = rect[0] + 5
- y = rect[1] + 15
- t = "Cell %d,%d" % (row, col)
- c.frame_rect(rect)
- c.moveto(x, y)
- c.show_text(t)
-
- def click_cell(self, row, col, event):
- print "Cell %d,%d clicked" % (row, col)
-
-
-win = Window(title = "Grid View")
-view = TestGridView()
-win.add(view)
-win.shrink_wrap()
-win.show()
-
-instructions = """
-There should be a grid view with 10 rows and 5 columns.
-The row and column numbers of clicked cells should be reported.
-"""
-
-say(instructions)
-run()
diff --git a/PyGUI-2.5.3/Tests/48-palette_view.py b/PyGUI-2.5.3/Tests/48-palette_view.py
deleted file mode 100644
index b9aa243..0000000
--- a/PyGUI-2.5.3/Tests/48-palette_view.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from GUI import Window, PaletteView, run
-from testing import say
-
-class TestPaletteView(PaletteView):
-
- def __init__(self):
- PaletteView.__init__(self, num_items = 10, items_per_row = 4,
- cell_size = (50, 30))
-
- def draw_item(self, c, i, rect):
- x = rect[0] + 5
- y = rect[1] + 15
- t = "Item %d" % i
- c.frame_rect(rect)
- c.moveto(x, y)
- c.show_text(t)
-
- def click_item(self, i, event):
- print "Item %d clicked" % i
-
-
-win = Window(title = "Palette View")
-view = TestPaletteView()
-win.add(view)
-win.shrink_wrap()
-win.show()
-
-instructions = """
-There should be a palette view with 10 items arranged in 4 columns.
-The item number of a clicked item should be reported.
-"""
-
-say(instructions)
-run()
diff --git a/PyGUI-2.5.3/Tests/90-glview.py b/PyGUI-2.5.3/Tests/90-glview.py
deleted file mode 100644
index bec5d3b..0000000
--- a/PyGUI-2.5.3/Tests/90-glview.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# This program is based on the color.c program written by Naofumi.
-
-import os, sys
-from GUI import Window, application
-from GUI.GL import GLView, GLConfig
-from OpenGL.GL import glClearColor, glClear, glBegin, glColor3f, glVertex2i, glEnd, \
- GL_COLOR_BUFFER_BIT, GL_TRIANGLES
-from TestInput import TestKeyEvents, TestMouseEvents
-from testing import say
-
-class TriangleView(TestKeyEvents, TestMouseEvents, GLView):
-
- def init_context(self):
- glClearColor(0.0, 0.0, 0.0, 0.0)
-
- def render(self):
- glClear(GL_COLOR_BUFFER_BIT)
- glBegin(GL_TRIANGLES)
- glColor3f(1.0, 0.0, 0.0)
- glVertex2i(0, 1)
- glColor3f(0.0, 1.0, 0.0)
- glVertex2i(-1, -1)
- glColor3f(0.0, 0.0, 1.0)
- glVertex2i(1, -1)
- glEnd()
-
-def make_view(db, options):
- pf = GLConfig(double_buffer = db)
- pf.alpha = "a" in options
- pf.depth_buffer = "d" in options
- pf.stencil_buffer = "s" in options
- pf.aux_buffers = "x" in options
- pf.accum_buffer = "A" in options
- view = TriangleView(pf, size = (200, 200))
- win = Window(
- title = "%s Buffered GLView" % ["Single", "Double"][db],
- size = (240, 240))
- win.place(view, left = 20, top = 20, sticky = "nsew")
- view.become_target()
- win.show()
-
-def get_args():
- args = sys.argv[1:]
- if not 0 <= len(args) <= 2:
- badusage()
- if args:
- sd = args[0][0]
- else:
- sd = "d"
- if sd == "s":
- db = False
- elif sd == "d":
- db = True
- else:
- badusage()
- if len(args) > 1:
- options = args[1]
- else:
- options = ""
- return db, options
-
-def badusage():
- sys.stderr.write("Usage: python %s s[ingle]|d[ouble] [adsxA]\n" % os.path.basename(sys.argv[0]))
- sys.exit(1)
-
-instructions = """
-There should be a window containing an OpenGL view, 20 pixels
-from the edge of the window on all sides. There should be a
-coloured triangle filling the view over a black background.
-
-Mouse and keyboard events in the view should be reported.
-The view and the triangle it contains should resize smoothly
-with the window.
-"""
-
-make_view(*get_args())
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/91-glview-task.py b/PyGUI-2.5.3/Tests/91-glview-task.py
deleted file mode 100644
index 4edadcf..0000000
--- a/PyGUI-2.5.3/Tests/91-glview-task.py
+++ /dev/null
@@ -1,248 +0,0 @@
-# A translation of the gears demo that comes with mesa.
-# Conversion from gtk.gl module to PyGtkGLExt by Naofumi Yasufuku
-# Conversion to PyGUI by Greg Ewing
-
-import math
-from GUI import Window, Task, application
-from GUI.GL import GLView
-from OpenGL import GL
-
-frame_interval = 0.01
-rotation_step = 5.0
-
-rotations = {
- 'up_arrow': (-rotation_step, 0.0, 0.0),
- 'down_arrow': ( rotation_step, 0.0, 0.0),
- 'left_arrow': (0.0, -rotation_step, 0.0),
- 'right_arrow': (0.0, rotation_step, 0.0),
-}
-
-#----------------------------------------------------------------------------
-
-# Draw a gear wheel. You'll probably want to call this function when
-# building a display list since we do a lot of trig here.
-#
-# Input:
-# inner_radius - radius of hole at center
-# outer_radius - radius at center of teeth
-# width - width of gear
-# teeth - number of teeth
-# tooth_depth - depth of tooth
-def gear(inner_radius, outer_radius, width, teeth, tooth_depth):
- cos = math.cos
- sin = math.sin
-
- r0 = inner_radius
- r1 = outer_radius - tooth_depth/2.0
- r2 = outer_radius + tooth_depth/2.0
-
- da = 2.0*math.pi / teeth / 4.0
-
- GL.glShadeModel(GL.GL_FLAT)
-
- GL.glNormal3f(0.0, 0.0, 1.0)
-
- # draw front face
- GL.glBegin(GL.GL_QUAD_STRIP)
- for i in range(teeth + 1):
- angle = i * 2.0*math.pi / teeth
- GL.glVertex3f(r0*cos(angle), r0*sin(angle), width*0.5)
- GL.glVertex3f(r1*cos(angle), r1*sin(angle), width*0.5)
- GL.glVertex3f(r0*cos(angle), r0*sin(angle), width*0.5)
- GL.glVertex3f(r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5)
- GL.glEnd()
-
- # draw front sides of teeth
- GL.glBegin(GL.GL_QUADS)
- da = 2.0*math.pi / teeth / 4.0
- for i in range(teeth):
- angle = i * 2.0*math.pi / teeth
- GL.glVertex3f(r1*cos(angle), r1*sin(angle), width*0.5)
- GL.glVertex3f(r2*cos(angle+da), r2*sin(angle+da), width*0.5)
- GL.glVertex3f(r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5)
- GL.glVertex3f(r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5)
- GL.glEnd()
-
- GL.glNormal3f(0.0, 0.0, -1.0)
-
- # draw back face
- GL.glBegin(GL.GL_QUAD_STRIP)
- for i in range(teeth + 1):
- angle = i * 2.0 * math.pi / teeth
- GL.glVertex3f(r1*cos(angle), r1*sin(angle), -width*0.5)
- GL.glVertex3f(r0*cos(angle), r0*sin(angle), -width*0.5)
- GL.glVertex3f(r1*cos(angle+3*da), r1*sin(angle+3*da),-width*0.5)
- GL.glVertex3f(r0*cos(angle), r0*sin(angle), -width*0.5)
- GL.glEnd()
-
- # draw back sides of teeth
- GL.glBegin(GL.GL_QUADS)
- da = 2.0*math.pi / teeth / 4.0
- for i in range(teeth):
- angle = i * 2.0*math.pi / teeth
- GL.glVertex3f(r1*cos(angle+3*da), r1*sin(angle+3*da),-width*0.5)
- GL.glVertex3f(r2*cos(angle+2*da), r2*sin(angle+2*da),-width*0.5)
- GL.glVertex3f(r2*cos(angle+da), r2*sin(angle+da), -width*0.5)
- GL.glVertex3f(r1*cos(angle), r1*sin(angle), -width*0.5)
- GL.glEnd()
-
- # draw outward faces of teeth
- GL.glBegin(GL.GL_QUAD_STRIP)
- for i in range(teeth):
- angle = i * 2.0*math.pi / teeth
- GL.glVertex3f(r1*cos(angle), r1*sin(angle), width*0.5)
- GL.glVertex3f(r1*cos(angle), r1*sin(angle), -width*0.5)
- u = r2*cos(angle+da) - r1*cos(angle)
- v = r2*sin(angle+da) - r1*sin(angle)
- len = math.sqrt(u*u + v*v)
- u = u / len
- v = v / len
- GL.glNormal3f(v, -u, 0.0)
- GL.glVertex3f(r2*cos(angle+da), r2*sin(angle+da), width*0.5)
- GL.glVertex3f(r2*cos(angle+da), r2*sin(angle+da), -width*0.5)
- GL.glNormal3f(cos(angle), sin(angle), 0.0)
- GL.glVertex3f(r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5)
- GL.glVertex3f(r2*cos(angle+2*da), r2*sin(angle+2*da),-width*0.5)
- u = r1*cos(angle+3*da) - r2*cos(angle+2*da)
- v = r1*sin(angle+3*da) - r2*sin(angle+2*da)
- GL.glNormal3f(v, -u, 0.0)
- GL.glVertex3f(r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5)
- GL.glVertex3f(r1*cos(angle+3*da), r1*sin(angle+3*da),-width*0.5)
- GL.glNormal3f(cos(angle), sin(angle), 0.0)
-
- GL.glVertex3f(r1*cos(0), r1*sin(0), width*0.5)
- GL.glVertex3f(r1*cos(0), r1*sin(0), -width*0.5)
-
- GL.glEnd()
-
- GL.glShadeModel(GL.GL_SMOOTH)
-
- # draw inside radius cylinder
- GL.glBegin(GL.GL_QUAD_STRIP)
- for i in range(teeth + 1):
- angle = i * 2.0*math.pi / teeth;
- GL.glNormal3f(-cos(angle), -sin(angle), 0.0)
- GL.glVertex3f(r0*cos(angle), r0*sin(angle), -width*0.5)
- GL.glVertex3f(r0*cos(angle), r0*sin(angle), width*0.5)
- GL.glEnd()
-
-#----------------------------------------------------------------------------
-
-class GearsView(GLView):
-
- view_rotx=20.0
- view_roty=30.0
- view_rotz=0.0
- angle = 0.0
-
- def init_context(self):
- #print "Init Context" ###
- pos = (5.0, 5.0, 10.0, 0.0)
- red = (0.8, 0.1, 0.0, 1.0)
- green = (0.0, 0.8, 0.2, 1.0)
- blue = (0.2, 0.2, 1.0, 1.0)
- #
- GL.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, pos)
- GL.glEnable(GL.GL_CULL_FACE)
- GL.glEnable(GL.GL_LIGHTING)
- GL.glEnable(GL.GL_LIGHT0)
- GL.glEnable(GL.GL_DEPTH_TEST)
- #
- self.gear1 = GL.glGenLists(1)
- GL.glNewList(self.gear1, GL.GL_COMPILE)
- GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, red)
- gear(1.0, 4.0, 1.0, 20, 0.7)
- GL.glEndList()
- #
- self.gear2 = GL.glGenLists(1)
- GL.glNewList(self.gear2, GL.GL_COMPILE)
- GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, green)
- gear(0.5, 2.0, 2.0, 10, 0.7)
- GL.glEndList()
- #
- self.gear3 = GL.glGenLists(1)
- GL.glNewList(self.gear3, GL.GL_COMPILE)
- GL.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, blue)
- gear(1.3, 2.0, 0.5, 10, 0.7)
- GL.glEndList()
- #
- GL.glEnable(GL.GL_NORMALIZE)
- #
- self.frame_task = Task(self.next_frame, frame_interval, repeat = 1)
-
- def init_projection(self):
- #print "init_projection" ###
- width, height = self.size
- if width > height:
- w = float(width) / float(height)
- GL.glFrustum(-w, w, -1.0, 1.0, 5.0, 60.0)
- else:
- h = float(height) / float(width)
- GL.glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0)
-
- def render(self):
- #print "Render" ###
- #GL.glMatrixMode(GL.GL_MODELVIEW)
- #GL.glLoadIdentity()
- GL.glTranslatef(0.0, 0.0, -40.0)
- GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
- #
- GL.glPushMatrix()
- #
- GL.glRotatef(self.view_rotx, 1.0, 0.0, 0.0)
- GL.glRotatef(self.view_roty, 0.0, 1.0, 0.0)
- GL.glRotatef(self.view_rotz, 0.0, 0.0, 1.0)
- #
- GL.glPushMatrix()
- GL.glTranslatef(-3.0, -2.0, 0.0)
- GL.glRotatef(self.angle, 0.0, 0.0, 1.0)
- GL.glCallList(self.gear1)
- GL.glPopMatrix()
- #
- GL.glPushMatrix()
- GL.glTranslatef(3.1, -2.0, 0.0)
- GL.glRotatef(-2.0 * self.angle - 9.0, 0.0, 0.0, 1.0)
- GL.glCallList(self.gear2)
- GL.glPopMatrix()
- #
- GL.glPushMatrix()
- GL.glTranslatef(-3.1, 4.2, 0.0)
- GL.glRotatef(-2.0 * self.angle - 25.0, 0.0, 0.0, 1.0)
- GL.glCallList(self.gear3)
- GL.glPopMatrix()
- #
- GL.glPopMatrix()
-
- def next_frame(self):
- #print "Next Frame" ###
- self.angle += 2.0
- self.invalidate()
- self.update()
-
- def key_down(self, event):
- #print "Key:", event ###
- try:
- xa, ya, za = rotations[event.key]
- self.view_rotx += xa
- self.view_roty += ya
- self.view_rotz += za
- except KeyError:
- pass
-
-#----------------------------------------------------------------------------
-
-def test():
- view = GearsView(size = (300, 300))
- win = Window(title = "Gears")
- win.place(view, sticky = "nsew")
- view.become_target()
- win.shrink_wrap()
- win.show()
- application().run()
-
-instructions = """
-Gears should be spinning. The arrow keys should rotate the view.
-"""
-
-print instructions
-test()
diff --git a/PyGUI-2.5.3/Tests/92-glpixmap.py b/PyGUI-2.5.3/Tests/92-glpixmap.py
deleted file mode 100644
index a3f7a28..0000000
--- a/PyGUI-2.5.3/Tests/92-glpixmap.py
+++ /dev/null
@@ -1,63 +0,0 @@
-from GUI import Window, View, application, rgb, Pixmap
-from GUI.Geometry import offset_rect
-from GUI.StdColors import black, white
-from GUI.GL import GLPixmap
-from OpenGL.GL import glClearColor, glClear, glBegin, glColor3f, glVertex2i, glEnd, \
- GL_COLOR_BUFFER_BIT, GL_TRIANGLES
-
-
-class PixmapTestView(View):
-
- def __init__(self, pixmap, **kwds):
- self.pixmap = pixmap
- View.__init__(self, **kwds)
-
- def draw(self, c, r):
- #print "Draw" ###
- c.forecolor = rgb(0.5, 0.75, 1.0)
- c.fill_rect(self.viewed_rect())
- c.forecolor = black
- pm = self.pixmap
- sr = pm.bounds
- for i in range(3):
- dr = offset_rect(sr, (10 + i * 50, 10 + i * 60))
- pm.draw(c, sr, dr)
-
-
-def draw_triangle():
- #print "Draw Triangle"
- glClearColor(0.0, 0.0, 0.0, 1.0)
- glClear(GL_COLOR_BUFFER_BIT)
- #return ###
- glBegin(GL_TRIANGLES)
- glColor3f(1.0, 0.0, 0.0)
- glVertex2i(0, 1)
- glColor3f(0.0, 1.0, 0.0)
- glVertex2i(-1, -1)
- glColor3f(0.0, 0.0, 1.0)
- glVertex2i(1, -1)
- glEnd()
-
-def draw_circle(c):
- c.forecolor = white
- c.frame_oval((10, 10, 40, 40))
-
-def test():
- app = application()
- pixmap = GLPixmap(50, 50, double_buffer = False, alpha = False)
- pixmap.with_context(draw_triangle, flush = True)
- #pixmap.with_canvas(draw_circle)
- view = PixmapTestView(pixmap, size = (180, 200))
- win = Window(title = "GLPixmap", resizable = False)
- win.add(view)
- win.shrink_wrap()
- win.show()
- app.run()
-
-instructions = """
-You should see a multicoloured triangle inside a black square,
-repeated three times over a blue background.
-"""
-
-print instructions
-test()
diff --git a/PyGUI-2.5.3/Tests/PrintMarrginTest.ps b/PyGUI-2.5.3/Tests/PrintMarrginTest.ps
deleted file mode 100755
index 95843a2..0000000
--- a/PyGUI-2.5.3/Tests/PrintMarrginTest.ps
+++ /dev/null
@@ -1,458 +0,0 @@
-%!PS-Adobe-3.0
-%%Title: PrintMarrginTest.sxw
-%%Creator: PScript5.dll Version 5.2
-%%CreationDate: 12/15/2009 21:5:38
-%%For: Administrator
-%%BoundingBox: (atend)
-%%Pages: (atend)
-%%Orientation: Portrait
-%%PageOrder: Special
-%%DocumentNeededResources: (atend)
-%%DocumentSuppliedResources: (atend)
-%%DocumentData: Clean7Bit
-%%TargetDevice: (Color LaserWriter 12/660 PS) (2014.108) 2
-%%LanguageLevel: 2
-%%EndComments
-
-%%BeginDefaults
-%%PageBoundingBox: 15 15 582 819
-%%ViewingOrientation: 1 0 0 1
-%%EndDefaults
-
-
-%%BeginProlog
-%%BeginResource: file Pscript_WinNT_VMErrorHandler 5.0 0
-/currentpacking where{pop/oldpack currentpacking def/setpacking where{pop false
-setpacking}if}if/$brkpage 64 dict def $brkpage begin/prnt{dup type/stringtype
-ne{=string cvs}if dup length 6 mul/tx exch def/ty 10 def currentpoint/toy exch
-def/tox exch def 1 setgray newpath tox toy 2 sub moveto 0 ty rlineto tx 0
-rlineto 0 ty neg rlineto closepath fill tox toy moveto 0 setgray show}bind def
-/nl{currentpoint exch pop lmargin exch moveto 0 -10 rmoveto}def/=={/cp 0 def
-typeprint nl}def/typeprint{dup type exec}readonly def/lmargin 72 def/rmargin 72
-def/tprint{dup length cp add rmargin gt{nl/cp 0 def}if dup length cp add/cp
-exch def prnt}readonly def/cvsprint{=string cvs tprint( )tprint}readonly def
-/integertype{cvsprint}readonly def/realtype{cvsprint}readonly def/booleantype
-{cvsprint}readonly def/operatortype{(--)tprint =string cvs tprint(-- )tprint}
-readonly def/marktype{pop(-mark- )tprint}readonly def/dicttype{pop
-(-dictionary- )tprint}readonly def/nulltype{pop(-null- )tprint}readonly def
-/filetype{pop(-filestream- )tprint}readonly def/savetype{pop(-savelevel- )
-tprint}readonly def/fonttype{pop(-fontid- )tprint}readonly def/nametype{dup
-xcheck not{(/)tprint}if cvsprint}readonly def/stringtype{dup rcheck{(\()tprint
-tprint(\))tprint}{pop(-string- )tprint}ifelse}readonly def/arraytype{dup rcheck
-{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint}forall(])
-tprint}ifelse}{pop(-array- )tprint}ifelse}readonly def/packedarraytype{dup
-rcheck{dup xcheck{({)tprint{typeprint}forall(})tprint}{([)tprint{typeprint}
-forall(])tprint}ifelse}{pop(-packedarray- )tprint}ifelse}readonly def/courier
-/Courier findfont 10 scalefont def end errordict/handleerror{systemdict begin
-$error begin $brkpage begin newerror{/newerror false store vmstatus pop pop 0
-ne{grestoreall}if initgraphics courier setfont lmargin 720 moveto errorname
-(VMerror)eq{version cvi 2016 ge{userdict/ehsave known{clear userdict/ehsave get
-restore 2 vmreclaim}if vmstatus exch pop exch pop PrtVMMsg}if}if systemdict
-/showpage get exec(%%[ Error: )print errorname =print(; OffendingCommand: )
-print/command load =print( ]%%)= flush}if end end end}dup 0 systemdict put dup
-4 $brkpage put bind readonly put/currentpacking where{pop/setpacking where{pop
-oldpack setpacking}if}if
-%%EndResource
-userdict /Pscript_WinNT_Incr 230 dict dup begin put
-%%BeginResource: file Pscript_FatalError 5.0 0
-userdict begin/FatalErrorIf{{initgraphics findfont 1 index 0 eq{exch pop}{dup
-length dict begin{1 index/FID ne{def}{pop pop}ifelse}forall/Encoding
-{ISOLatin1Encoding}stopped{StandardEncoding}if def currentdict end
-/ErrFont-Latin1 exch definefont}ifelse exch scalefont setfont counttomark 3 div
-cvi{moveto show}repeat showpage quit}{cleartomark}ifelse}bind def end
-%%EndResource
-userdict begin/PrtVMMsg{vmstatus exch sub exch pop gt{[
-(This job requires more memory than is available in this printer.)100 500
-(Try one or more of the following, and then print again:)100 485
-(For the output format, choose Optimize For Portability.)115 470
-(In the Device Settings page, make sure the Available PostScript Memory is accurate.)
-115 455(Reduce the number of fonts in the document.)115 440
-(Print the document in parts.)115 425 12/Times-Roman showpage
-(%%[ PrinterError: Low Printer VM ]%%)= true FatalErrorIf}if}bind def end
-version cvi 2016 ge{/VM?{pop}bind def}{/VM? userdict/PrtVMMsg get def}ifelse
-105000 VM?
-%%BeginResource: file Pscript_Win_Basic 5.0 0
-/d/def load def/,/load load d/~/exch , d/?/ifelse , d/!/pop , d/`/begin , d/^
-/index , d/@/dup , d/+/translate , d/$/roll , d/U/userdict , d/M/moveto , d/-
-/rlineto , d/&/currentdict , d/:/gsave , d/;/grestore , d/F/false , d/T/true ,
-d/N/newpath , d/E/end , d/Ac/arc , d/An/arcn , d/A/ashow , d/D/awidthshow , d/C
-/closepath , d/V/div , d/O/eofill , d/L/fill , d/I/lineto , d/-c/curveto , d/-M
-/rmoveto , d/+S/scale , d/Ji/setfont , d/Lc/setlinecap , d/Lj/setlinejoin , d
-/Lw/setlinewidth , d/Lm/setmiterlimit , d/sd/setdash , d/S/show , d/LH/showpage
-, d/K/stroke , d/W/widthshow , d/R/rotate , d/L2? false/languagelevel where{pop
-languagelevel 2 ge{pop true}if}if d L2?{/xS/xshow , d/yS/yshow , d/zS/xyshow ,
-d}if/b{bind d}bind d/bd{bind d}bind d/xd{~ d}bd/ld{, d}bd/bn/bind ld/lw/Lw ld
-/lc/Lc ld/lj/Lj ld/sg/setgray ld/ADO_mxRot null d/self & d/OrgMx matrix
-currentmatrix d/reinitialize{: OrgMx setmatrix[/TextInit/GraphInit/UtilsInit
-counttomark{@ where{self eq}{F}?{cvx exec}{!}?}repeat cleartomark ;}b
-/initialize{`{/Pscript_Win_Data where{!}{U/Pscript_Win_Data & put}?/ADO_mxRot ~
-d/TextInitialised? F d reinitialize E}{U/Pscript_Win_Data 230 dict @ ` put
-/ADO_mxRot ~ d/TextInitialised? F d reinitialize}?}b/terminate{!{& self eq
-{exit}{E}?}loop E}b/suspend/terminate , d/resume{` Pscript_Win_Data `}b U `
-/lucas 21690 d/featurebegin{countdictstack lucas[}b/featurecleanup{stopped
-{cleartomark @ lucas eq{! exit}if}loop countdictstack ~ sub @ 0 gt{{E}repeat}
-{!}?}b E/snap{transform 0.25 sub round 0.25 add ~ 0.25 sub round 0.25 add ~
-itransform}b/dsnap{dtransform round ~ round ~ idtransform}b/nonzero_round{@ 0.5
-ge{round}{@ -0.5 lt{round}{0 ge{1}{-1}?}?}?}b/nonzero_dsnap{dtransform
-nonzero_round ~ nonzero_round ~ idtransform}b U<04>cvn{}put/rr{1 ^ 0 - 0 ~ -
-neg 0 - C}b/irp{4 -2 $ + +S fx 4 2 $ M 1 ^ 0 - 0 ~ - neg 0 -}b/rp{4 2 $ M 1 ^ 0
-- 0 ~ - neg 0 -}b/solid{[]0 sd}b/g{@ not{U/DefIf_save save put}if U/DefIf_bool
-2 ^ put}b/DefIf_El{if U/DefIf_bool get not @{U/DefIf_save get restore}if}b/e
-{DefIf_El !}b/UDF{L2?{undefinefont}{!}?}b/UDR{L2?{undefineresource}{! !}?}b
-/freeVM{/Courier findfont[40 0 0 -40 0 0]makefont Ji 2 vmreclaim}b/hfRedefFont
-{findfont @ length dict `{1 ^/FID ne{d}{! !}?}forall & E @ ` ~{/CharStrings 1
-dict `/.notdef 0 d & E d}if/Encoding 256 array 0 1 255{1 ^ ~/.notdef put}for d
-E definefont !}bind d/hfMkCIDFont{/CIDFont findresource @ length 2 add dict `{1
-^ @/FID eq ~ @/XUID eq ~/UIDBase eq or or{! !}{d}?}forall/CDevProc ~ d/Metrics2
-16 dict d/CIDFontName 1 ^ d & E 1 ^ ~/CIDFont defineresource ![~]composefont !}
-bind d
-%%EndResource
-%%BeginResource: file Pscript_Win_Utils_L2 5.0 0
-/rf/rectfill , d/fx{1 1 dtransform @ 0 ge{1 sub 0.5}{1 add -0.5}? 3 -1 $ @ 0 ge
-{1 sub 0.5}{1 add -0.5}? 3 1 $ 4 1 $ idtransform 4 -2 $ idtransform}b/BZ{4 -2 $
-snap + +S fx rf}b/rs/rectstroke , d/rc/rectclip , d/UtilsInit{currentglobal{F
-setglobal}if}b/scol{! setcolor}b/colspA/DeviceGray d/colspABC/DeviceRGB d
-/colspRefresh{colspABC setcolorspace}b/SetColSpace{colspABC setcolorspace}b
-/resourcestatus where{!/ColorRendering/ProcSet resourcestatus{! ! T}{F}?}{F}?
-not{/ColorRendering<>/defineresource where{!/ProcSet
-defineresource !}{! !}?}if/buildcrdname{/ColorRendering/ProcSet findresource `
-mark GetHalftoneName @ type @/nametype ne ~/stringtype ne and{!/none}if(.)
-GetPageDeviceName @ type @/nametype ne ~/stringtype ne and{!/none}if(.)5 ^ 0 5
--1 1{^ length add}for string 6 1 $ 5 ^ 5{~ 1 ^ cvs length 1 ^ length 1 ^ sub
-getinterval}repeat ! cvn 3 1 $ ! ! E}b/definecolorrendering{~ buildcrdname ~
-/ColorRendering defineresource !}b/findcolorrendering where{!}{
-/findcolorrendering{buildcrdname @/ColorRendering resourcestatus{! ! T}{
-/ColorRendering/ProcSet findresource ` GetSubstituteCRD E F}?}b}?
-/selectcolorrendering{findcolorrendering !/ColorRendering findresource
-setcolorrendering}b/G2UBegin{findresource/FontInfo get/GlyphNames2Unicode get
-`}bind d/G2CCBegin{findresource/FontInfo get/GlyphNames2HostCode get `}bind d
-/G2UEnd{E}bind d/AddFontInfoBegin{/FontInfo 8 dict @ `}bind d/AddFontInfo{
-/GlyphNames2Unicode 16 dict d/GlyphNames2HostCode 16 dict d}bind d
-/AddFontInfoEnd{E d}bind d/T0AddCFFMtx2{/CIDFont findresource/Metrics2 get ` d
-E}bind d
-%%EndResource
-end
-%%EndProlog
-
-%%BeginSetup
-statusdict begin (%%[ ProductName: ) print product print ( ]%%)= flush end
-[ 1 0 0 1 0 0 ] false Pscript_WinNT_Incr dup /initialize get exec
-featurebegin{
-%%BeginNonPPDFeature: JobTimeout 0
-0 /languagelevel where{pop languagelevel}{1}ifelse 2 ge{1 dict dup/JobTimeout 4 -1 roll put setuserparams}{statusdict/setjobtimeout get exec}ifelse
-%%EndNonPPDFeature
-}featurecleanup
-
-featurebegin{
-%%BeginNonPPDFeature: WaitTimeout 300
-300 /languagelevel where{pop languagelevel}{1}ifelse 2 ge{1 dict dup/WaitTimeout 4 -1 roll put setuserparams}{statusdict/waittimeout 3 -1 roll put}ifelse
-%%EndNonPPDFeature
-}featurecleanup
-
-featurebegin{
-%%BeginFeature: *TraySwitch False
-1 dict dup /TraySwitch false put setpagedevice
-%%EndFeature
-}featurecleanup
-featurebegin{
-%%BeginFeature: *OutputMode Normal
-
- 1 dict dup /PostRenderingEnhanceDetails
- 2 dict dup /Type 19 put dup /OutputMode /Normal put put
- setpagedevice
-%%EndFeature
-}featurecleanup
-featurebegin{
-%%BeginFeature: *PageSize A4
-
- 2 dict dup /PageSize [595 842] put dup /ImagingBBox null put setpagedevice
-%%EndFeature
-}featurecleanup
-featurebegin{
-%%BeginFeature: *MediaType Plain
-
- 2 dict
- dup /MediaType (Plain) put
- dup /InputAttributes mark
- currentpagedevice /InputAttributes get
- {
- dup type /dicttype eq {
- dup length 1 add dict begin {def} forall
- /MediaType (Plain) def
- currentdict end
- } if
- } forall
- counttomark 2 idiv dup dict begin {def} repeat
- pop currentdict end
- put
- setpagedevice
-
-%%EndFeature
-}featurecleanup
-featurebegin{
-%%BeginFeature: *OutputBin OnlyOne
-
-%%EndFeature
-}featurecleanup
-featurebegin{
-%%BeginFeature: *InstalledMemory 16Meg
-
-%%EndFeature
-}featurecleanup
-featurebegin{
-%%BeginFeature: *OptionalCassette1 False
-
-%%EndFeature
-}featurecleanup
-featurebegin{
-%%BeginFeature: *Resolution 600dpi
-
-%%EndFeature
-}featurecleanup
-1 setlinecap 1 setlinejoin
-/mysetup [ 72 600 V 0 0 -72 600 V 15.00094 819 ] def
-%%EndSetup
-
-userdict begin /ehsave save def end
-%%Page: 1 1
-%%PageBoundingBox: 15 15 582 819
-%%EndPageComments
-%%BeginPageSetup
-/DeviceRGB dup setcolorspace /colspABC exch def
-mysetup concat colspRefresh
-%%EndPageSetup
-
-0 0 0 1 scol Pscript_WinNT_Incr begin
-%%BeginResource: file Pscript_Text 5.0 0
-/TextInit{TextInitialised? not{/Pscript_Windows_Font & d/TextInitialised? T d
-/fM[1 0 0 1 0 0]d/mFM matrix d/iMat[1 0 0.212557 1 0 0]d}if}b/copyfont{1 ^
-length add dict `{1 ^/FID ne{d}{! !}?}forall & E}b/EncodeDict 11 dict d/bullets
-{{/bullet}repeat}b/rF{3 copyfont @ ` ~ EncodeDict ~ get/Encoding ~ 3 ^/0 eq{&
-/CharStrings known{CharStrings/Eth known not{! EncodeDict/ANSIEncodingOld get}
-if}if}if d E}b/mF{@ 7 1 $ findfont ~{@/Encoding get @ StandardEncoding eq{! T}{
-{ISOLatin1Encoding}stopped{! F}{eq}?{T}{@ ` T 32 1 127{Encoding 1 ^ get
-StandardEncoding 3 -1 $ get eq and}for E}?}?}{F}?{1 ^ ~ rF}{0 copyfont}? 6 -2 $
-! ! ~ !/pd_charset @ where{~ get 128 eq{@ FDV 2 copy get @ length array copy
-put pd_CoverFCRange}if}{!}? 2 ^ ~ definefont fM 5 4 -1 $ put fM 4 0 put fM
-makefont Pscript_Windows_Font 3 1 $ put}b/sLT{: Lw -M currentpoint snap M 0 - 0
-Lc K ;}b/xUP null d/yUP null d/uW null d/xSP null d/ySP null d/sW null d/sSU{N
-/uW ~ d/yUP ~ d/xUP ~ d}b/sU{xUP yUP uW sLT}b/sST{N/sW ~ d/ySP ~ d/xSP ~ d}b/sT
-{xSP ySP sW sLT}b/sR{: + R 0 0 M}b/sRxy{: matrix astore concat 0 0 M}b/eR/; , d
-/AddOrigFP{{&/FontInfo known{&/FontInfo get length 6 add}{6}? dict `
-/WinPitchAndFamily ~ d/WinCharSet ~ d/OrigFontType ~ d/OrigFontStyle ~ d
-/OrigFontName ~ d & E/FontInfo ~ d}{! ! ! ! !}?}b/mFS{makefont
-Pscript_Windows_Font 3 1 $ put}b/mF42D{0 copyfont `/FontName ~ d 2 copy ~ sub 1
-add dict `/.notdef 0 d 2 copy 1 ~{@ 3 ^ sub Encoding ~ get ~ d}for & E
-/CharStrings ~ d ! ! & @ E/FontName get ~ definefont}b/mF42{15 dict ` @ 4 1 $
-FontName ~ d/FontType 0 d/FMapType 2 d/FontMatrix[1 0 0 1 0 0]d 1 ^ 254 add 255
-idiv @ array/Encoding ~ d 0 1 3 -1 $ 1 sub{@ Encoding 3 1 $ put}for/FDepVector
-Encoding length array d/CharStrings 2 dict `/.notdef 0 d & E d 0 1 Encoding
-length 1 sub{@ @ 10 lt{! FontName length 1 add string}{100 lt{FontName length 2
-add string}{FontName length 3 add string}?}? @ 0 FontName @ length string cvs
-putinterval @ 3 -1 $ @ 4 1 $ 3 string cvs FontName length ~ putinterval cvn 1 ^
-256 mul @ 255 add 3 -1 $ 4 ^ findfont mF42D FDepVector 3 1 $ put}for & @ E
-/FontName get ~ definefont ! ! ! mF}b/mF_OTF_V{~ ! ~ ! 4 -1 $ ! findfont 2 ^ ~
-definefont fM @ @ 4 6 -1 $ neg put 5 0 put 90 matrix R matrix concatmatrix
-makefont Pscript_Windows_Font 3 1 $ put}b/mF_TTF_V{3{~ !}repeat 3 -1 $ !
-findfont 1 ^ ~ definefont Pscript_Windows_Font 3 1 $ put}b/UmF{L2?
-{Pscript_Windows_Font ~ undef}{!}?}b/UmF42{@ findfont/FDepVector get{/FontName
-get undefinefont}forall undefinefont}b
-%%EndResource
-end reinitialize
-Pscript_WinNT_Incr begin
-%%BeginResource: file Pscript_Encoding256 5.0 0
-/CharCol256Encoding[/.notdef/breve/caron/dotaccent/dotlessi/fi/fl/fraction
-/hungarumlaut/Lslash/lslash/minus/ogonek/ring/Zcaron/zcaron/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign
-/dollar/percent/ampersand/quotesingle/parenleft/parenright/asterisk/plus/comma
-/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
-/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S
-/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore/grave
-/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright
-/asciitilde/.notdef/Euro/.notdef/quotesinglbase/florin/quotedblbase/ellipsis
-/dagger/daggerdbl/circumflex/perthousand/Scaron/guilsinglleft/OE/.notdef
-/.notdef/.notdef/.notdef/quoteleft/quoteright/quotedblleft/quotedblright/bullet
-/endash/emdash/tilde/trademark/scaron/guilsinglright/oe/.notdef/.notdef
-/Ydieresis/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar/section
-/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/.notdef/registered
-/macron/degree/plusminus/twosuperior/threesuperior/acute/mu/paragraph
-/periodcentered/cedilla/onesuperior/ordmasculine/guillemotright/onequarter
-/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis
-/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
-/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
-/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute
-/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve
-/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex
-/udieresis/yacute/thorn/ydieresis]def EncodeDict/256 CharCol256Encoding put
-%%EndResource
-end reinitialize
-
-%%IncludeResource: font Times-Roman
-Pscript_WinNT_Incr begin
-%%BeginResource: file Pscript_Win_Euro_L2 5.0 0
-/UseT3EuroFont{/currentdistillerparams where{pop currentdistillerparams
-/CoreDistVersion get 4000 le}{false}ifelse}bind def/NewEuroT3Font?{dup/FontType
-get 3 eq{dup/EuroFont known exch/BaseFont known and}{pop false}ifelse}bind def
-/T1FontHasEuro{dup/CharStrings known not{dup NewEuroT3Font?{dup/EuroGlyphName
-get exch/EuroFont get/CharStrings get exch known{true}{false}ifelse}{pop false}
-ifelse}{dup/FontType get 1 eq{/CharStrings get/Euro known}{dup/InfoDict known{
-/InfoDict get/Euro known}{/CharStrings get/Euro known}ifelse}ifelse}ifelse}bind
-def/FontHasEuro{findfont dup/Blend known{pop true}{T1FontHasEuro}ifelse}bind
-def/EuroEncodingIdx 1 def/EuroFontHdr{12 dict begin/FontInfo 10 dict dup begin
-/version(001.000)readonly def/Notice(Copyright (c)1999 Adobe Systems
-Incorporated. All Rights Reserved.)readonly def/FullName(Euro)readonly def
-/FamilyName(Euro)readonly def/Weight(Regular)readonly def/isFixedPitch false
-def/ItalicAngle 0 def/UnderlinePosition -100 def/UnderlineThickness 50 def end
-readonly def/FontName/Euro def/Encoding 256 array 0 1 255{1 index exch/.notdef
-put}for def/PaintType 0 def/FontType 1 def/FontMatrix[0.001 0 0 0.001 0 0]def
-/FontBBox{-25 -23 1500 804}readonly def currentdict end dup/Private 20 dict dup
-begin/ND{def}def/NP{put}def/lenIV -1 def/RD{string currentfile exch
-readhexstring pop}def/-|{string currentfile exch readstring pop}executeonly def
-/|-{def}executeonly def/|{put}executeonly def/BlueValues[-20 0 706 736 547 572]
-|-/OtherBlues[-211 -203]|-/BlueScale 0.0312917 def/MinFeature{16 16}|-/StdHW
-[60]|-/StdVW[71]|-/ForceBold false def/password 5839 def/Erode{8.5 dup 3 -1
-roll 0.1 mul exch 0.5 sub mul cvi sub dup mul 71 0 dtransform dup mul exch dup
-mul add le{pop pop 1.0 1.0}{pop pop 0.0 1.5}ifelse}def/OtherSubrs[{}{}{}
-{systemdict/internaldict known not{pop 3}{1183615869 systemdict/internaldict
-get exec dup/startlock known{/startlock get exec}{dup/strtlck known{/strtlck
-get exec}{pop 3}ifelse}ifelse}ifelse}executeonly]|-/Subrs 5 array dup 0
-<8E8B0C100C110C110C210B>put dup 1<8B8C0C100B>put dup 2<8B8D0C100B>put dup 3<0B>
-put dup 4<8E8C8E0C100C110A0B>put |- 2 index/CharStrings 256 dict dup begin
-/.notdef<8b8b0d0e>def end end put put dup/FontName get exch definefont pop}bind
-def/AddEuroGlyph{2 index exch EuroEncodingIdx 1 eq{EuroFontHdr}if systemdict
-begin/Euro findfont dup dup/Encoding get 5 1 roll/Private get begin/CharStrings
-get dup 3 index known{pop pop pop pop end end}{begin 1 index exch def end end
-end EuroEncodingIdx dup 1 add/EuroEncodingIdx exch def exch put}ifelse}bind def
-/GetNewXUID{currentdict/XUID known{[7 XUID aload pop]true}{currentdict/UniqueID
-known{[7 UniqueID]true}{false}ifelse}ifelse}bind def/BuildT3EuroFont{exch 16
-dict begin dup/FontName exch def findfont dup/Encoding get/Encoding exch def
-dup length 1 add dict copy dup/FID undef begin dup dup/FontName exch def
-/Encoding 256 array 0 1 255{1 index exch/.notdef put}for def GetNewXUID{/XUID
-exch def}if currentdict end definefont pop/BaseFont exch findfont 1000
-scalefont def/EuroFont exch findfont 1000 scalefont def pop/EuroGlyphName exch
-def/FontType 3 def/FontMatrix[.001 0 0 .001 0 0]def/FontBBox BaseFont/FontBBox
-get def/Char 1 string def/BuildChar{exch dup begin/Encoding get 1 index get
-/Euro eq{BaseFont T1FontHasEuro{false}{true}ifelse}{false}ifelse{EuroFont
-setfont pop userdict/Idx 0 put EuroFont/Encoding get{EuroGlyphName eq{exit}
-{userdict/Idx Idx 1 add put}ifelse}forall userdict/Idx get}{dup dup Encoding
-exch get BaseFont/Encoding get 3 1 roll put BaseFont setfont}ifelse Char 0 3 -1
-roll put Char stringwidth newpath 0 0 moveto Char true charpath flattenpath
-pathbbox setcachedevice 0 0 moveto Char show end}bind def currentdict end dup
-/FontName get exch definefont pop}bind def/AddEuroToT1Font{dup findfont dup
-length 10 add dict copy dup/FID undef begin/EuroFont 3 -1 roll findfont 1000
-scalefont def CharStrings dup length 1 add dict copy begin/Euro{EuroFont
-setfont pop EuroGBBox aload pop setcachedevice 0 0 moveto EuroGName glyphshow}
-bind def currentdict end/CharStrings exch def GetNewXUID{/XUID exch def}if 3 1
-roll/EuroGBBox exch def/EuroGName exch def currentdict end definefont pop}bind
-def/BuildNewFont{UseT3EuroFont{BuildT3EuroFont}{pop AddEuroToT1Font}ifelse}bind
-def/UseObliqueEuro{findfont/FontMatrix get dup 2 get 0 eq exch dup 0 get exch 3
-get eq and UseT3EuroFont or}bind def
-%%EndResource
-end reinitialize
-7500 VM?
-/Times-Roman FontHasEuro not
-{
-/Euro.Times-Roman
- [500 0 24 -14 493 676 ]
-
-AddEuroGlyph
-/Euro /Times-Roman /Times-Roman-Copy BuildNewFont
-} if
-F /F0 0 /256 T /Times-Roman mF
-/F0SC8 F0 [200 0 0 -200 0 0 ] mFS
-F0SC8 Ji
-372 484 M (Hello World)[145 88 57 55 100 50 187 100 68 55 0]xS
-Pscript_WinNT_Incr begin
-%%BeginResource: file Pscript_Win_GdiObject 5.0 0
-/SavedCTM null d/CTMsave{/SavedCTM SavedCTM currentmatrix d}b/CTMrestore
-{SavedCTM setmatrix}b/mp null d/ADO_mxRot null d/GDIHMatrix null d
-/GDIHPatternDict 22 dict d GDIHPatternDict `/PatternType 1 d/PaintType 2 d/Reps
-L2?{1}{5}? d/XStep 8 Reps mul d/YStep XStep d/BBox[0 0 XStep YStep]d/TilingType
-1 d/PaintProc{` 1 Lw[]0 sd PaintData , exec E}b/FGnd null d/BGnd null d
-/HS_Horizontal{horiz}b/HS_Vertical{vert}b/HS_FDiagonal{fdiag}b/HS_BDiagonal
-{biag}b/HS_Cross{horiz vert}b/HS_DiagCross{fdiag biag}b/MaxXYStep XStep YStep
-gt{XStep}{YStep}? d/horiz{Reps{0 4 M XStep 0 - 0 8 +}repeat 0 -8 Reps mul + K}b
-/vert{Reps{4 0 M 0 YStep - 8 0 +}repeat 0 -8 Reps mul + K}b/biag{Reps{0 0 M
-MaxXYStep @ - 0 YStep neg M MaxXYStep @ - 0 8 +}repeat 0 -8 Reps mul + 0 YStep
-M 8 8 - K}b/fdiag{Reps{0 0 M MaxXYStep @ neg - 0 YStep M MaxXYStep @ neg - 0 8
-+}repeat 0 -8 Reps mul + MaxXYStep @ M 8 -8 - K}b E/makehatch{4 -2 $/yOrg ~ d
-/xOrg ~ d GDIHPatternDict/PaintData 3 -1 $ put CTMsave GDIHMatrix setmatrix
-GDIHPatternDict matrix xOrg yOrg + mp CTMrestore ~ U ~ 2 ^ put}b/h0{/h0
-/HS_Horizontal makehatch}b/h1{/h1/HS_Vertical makehatch}b/h2{/h2/HS_FDiagonal
-makehatch}b/h3{/h3/HS_BDiagonal makehatch}b/h4{/h4/HS_Cross makehatch}b/h5{/h5
-/HS_DiagCross makehatch}b/GDIBWPatternMx null d/pfprep{save 8 1 $
-/PatternOfTheDay 8 1 $ GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d/yExt
-~ d/Width ~ d/BGnd ~ d/FGnd ~ d/Height yExt RepsV mul d/mx[Width 0 0 Height 0
-0]d E build_pattern ~ !}b/pfbf{/fEOFill ~ d pfprep hbf fEOFill{O}{L}? restore}b
-/GraphInit{GDIHMatrix null eq{/SavedCTM matrix d : ADO_mxRot concat 0 0 snap +
-: 0.48 @ GDIHPatternDict ` YStep mul ~ XStep mul ~ nonzero_dsnap YStep V ~
-XStep V ~ E +S/GDIHMatrix matrix currentmatrix readonly d ; : 0.24 -0.24 +S
-GDIBWPatternDict ` Width Height E nonzero_dsnap +S/GDIBWPatternMx matrix
-currentmatrix readonly d ; ;}if}b
-%%EndResource
-%%BeginResource: file Pscript_Win_GdiObject_L2 5.0 0
-/GDIBWPatternDict 25 dict @ `/PatternType 1 d/PaintType 1 d/RepsV 1 d/RepsH 1 d
-/BBox[0 0 RepsH 1]d/TilingType 1 d/XStep 1 d/YStep 1 d/Height 8 RepsV mul d
-/Width 8 d/mx[Width 0 0 Height neg 0 Height]d/FGnd null d/BGnd null d
-/SetBGndFGnd{BGnd null ne{BGnd aload ! scol BBox aload ! 2 ^ sub ~ 3 ^ sub ~
-rf}if FGnd null ne{FGnd aload ! scol}if}b/PaintProc{` SetBGndFGnd RepsH{Width
-Height F mx PaintData imagemask Width 0 +}repeat E}b E d/mp/makepattern , d
-/build_pattern{CTMsave GDIBWPatternMx setmatrix/nupangle where{! nupangle -90
-eq{nupangle R}if}if GDIBWPatternDict @ ` Width Height ne{Width Height gt{Width
-Height V 1}{1 Height Width V}? +S}if xOrg yOrg E matrix + mp CTMrestore}b/hbf
-{setpattern}b/hf{:/fEOFill ~ d ~ ! setpattern fEOFill{O}{L}? ;}b/pbf{: !
-/fEOFill ~ d GDIBWPatternDict `/yOrg ~ d/xOrg ~ d/PaintData ~ d/OutputBPP ~ d
-/Height ~ d/Width ~ d/PaintType 1 d/PatternType 1 d/TilingType 1 d/BBox[0 0
-Width Height]d/XStep Width d/YStep Height d/mx xOrg yOrg matrix + d 20 dict @ `
-/ImageType 1 d/Width Width d/Height Height d/ImageMatrix[1 0 0 1 0 0]d
-/BitsPerComponent 8 d OutputBPP 24 eq{/Decode[0 1 0 1 0 1]d}{OutputBPP 8 eq{
-/Decode[0 1]d}{/Decode[0 1 0 1 0 1 0 1]d}?}?/DataSource{PaintData}d E/ImageDict
-~ d/PaintProc{` ImageDict image E}b & mx makepattern setpattern E fEOFill{O}{L}
-? ;}b/mask_pbf{:/fEOFill ~ d 20 dict `/yOrg ~ d/xOrg ~ d/PaintData ~ d/Height ~
-d/Width ~ d/PatternType 1 d/PaintType 2 d/TilingType 1 d/BBox[0 0 Width Height]
-d/XStep Width d/YStep Height d/mx xOrg yOrg matrix + d/PaintProc{` Width Height
-T 1 1 dtransform abs ~ abs ~ 0 0 3 -1 $ 0 0 6 array astore{PaintData}imagemask
-E}b & mx makepattern setpattern E fEOFill{O}{L}? ;}b
-%%EndResource
-end reinitialize
-: N 348 282 1 269 rp C
- L ; : N 4363 282 1 269 rp C
- L ; : N 348 281 4016 1 rp C
- L ; : N 348 551 4016 1 rp C
- L ; LH
-(%%[Page: 1]%%) =
-%%PageTrailer
-
-%%Trailer
-%%BoundingBox: 15 15 582 819
-%%DocumentNeededResources:
-%%+ font Times-Roman
-%%DocumentSuppliedResources:
-%%+ procset Pscript_WinNT_VMErrorHandler 5.0 0
-%%+ procset Pscript_FatalError 5.0 0
-%%+ procset Pscript_Win_Basic 5.0 0
-%%+ procset Pscript_Win_Utils_L2 5.0 0
-%%+ procset Pscript_Text 5.0 0
-%%+ procset Pscript_Encoding256 5.0 0
-%%+ procset Pscript_Win_Euro_L2 5.0 0
-%%+ procset Pscript_Win_GdiObject 5.0 0
-%%+ procset Pscript_Win_GdiObject_L2 5.0 0
-Pscript_WinNT_Incr dup /terminate get exec
-ehsave restore
-%%Pages: 1
-(%%[LastPage]%%) =
-%%EOF
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/Tests/TestInput.py b/PyGUI-2.5.3/Tests/TestInput.py
deleted file mode 100644
index ba8a695..0000000
--- a/PyGUI-2.5.3/Tests/TestInput.py
+++ /dev/null
@@ -1,54 +0,0 @@
-from testing import say
-
-class TestKeyEvents:
-
- def key_down(self, event):
- which = self.which_key(event)
- if event.auto:
- say("Auto key:", which)
- else:
- say("Key down:", which)
-
- def key_up(self, event):
- say("Key up:", self.which_key(event))
-
- def which_key(self, event):
- return repr(event.key or event.char)
-
-
-class TestMouseEvents:
-
- def mouse_down(self, event):
- self.report_mouse_event(
- "Mouse down: %s button: %s clicks: %s" % (event.position, event.button, event.num_clicks))
-
- def mouse_drag(self, event):
- self.report_mouse_event("Mouse drag: %s %s" % (event.position, event.delta))
-
- def mouse_up(self, event):
- self.report_mouse_event("Mouse up: %s button: %s" % (event.position, event.button))
-
- def mouse_move(self, event):
- self.report_mouse_event("Mouse move: %s %s" % (event.position, event.delta))
-
-# def mouse_enter(self, event):
-# self.report_mouse_event("Mouse enter: %s" % (event.position,))
-#
-# def mouse_leave(self, event):
-# self.report_mouse_event("Mouse leave: %s" % (event.position,))
-
- def report_mouse_event(self, mess):
- say(mess)
-
-
-class TestTrackMouse:
-
- def mouse_down(self, event):
- say("Mouse down:", event.position)
- for event in self.track_mouse():
- if event.kind == 'mouse_drag':
- say("Mouse drag:", event.position)
- elif event.kind == 'mouse_up':
- say("Mouse up:", event.position)
- else:
- say("Other event:", event.kind)
diff --git a/PyGUI-2.5.3/Tests/TestScrollableViews.py b/PyGUI-2.5.3/Tests/TestScrollableViews.py
deleted file mode 100644
index 859c032..0000000
--- a/PyGUI-2.5.3/Tests/TestScrollableViews.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# User-defined scrollable views used by test programs
-#
-
-from GUI import ScrollableView, Color, Font
-from GUI.StdFonts import system_font, application_font
-from GUI.StdColors import black, red, green, blue, yellow, white
-from TestInput import TestKeyEvents, TestTrackMouse
-from testing import say
-
-bgc = [green, blue, yellow] ###
-bgi = 0 ###
-
-class TestScrollableDrawing(ScrollableView):
-
- report_update_rect = False
-
- def __init__(self, **kwds):
- ScrollableView.__init__(self, **kwds)
- self.extent = (1000, 1000)
-
- def blue_update_rgn(self, c):
- c.fillcolor = blue
- c.fill_rect(self.viewed_rect())
-
- def draw(self, c, r):
- if self.report_update_rect:
- say("Update rect =", r)
- viewed_rect = self.viewed_rect()
- c.fillcolor = white
- c.fill_rect(viewed_rect)
- c.pensize = 6
- c.fillcolor = red
- x = 20
- y = 10
- for i in range(0, 20):
- c.newpath()
- c.moveto(x - 20, y + 20)
- c.rlineto(80, -20)
- c.rlineto(-40, 60)
- c.closepath()
- c.fill()
- c.stroke()
- x += 80
- y += 80
- ew, eh = self.extent
- c.frame_rect((0, 0, ew, eh))
-
-
-class TestScrollableView(TestKeyEvents, TestTrackMouse, TestScrollableDrawing):
- pass
diff --git a/PyGUI-2.5.3/Tests/TestViews.py b/PyGUI-2.5.3/Tests/TestViews.py
deleted file mode 100644
index c0094a4..0000000
--- a/PyGUI-2.5.3/Tests/TestViews.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# User-defined views used by test programs
-#
-
-from GUI import View, Color, Font
-from GUI.StdFonts import system_font, application_font
-from GUI.StdColors import black, red, green, blue, yellow, white
-from testing import say
-
-fancy_font = Font("Times", 48, ['italic'])
-#fancy_font = Font("Courier New", 48)
-#fancy_font = Font("Courier", 48)
-
-class TestDrawing(View):
-
- def draw(self, c, r):
- c.backcolor = yellow
- c.erase_rect((0, 0, self.width, self.height))
- self.draw_triangle(c, 10, 40, red)
- c.gsave()
- c.rectclip((100, 0, 120, 50))
- self.draw_triangle(c, 100, 40, green)
- c.grestore()
- self.draw_triangle(c, 50, 100, blue)
- f1 = system_font
- f2 = application_font
- f3 = fancy_font
- self.draw_text(c, 150, 100, f1, "System Font")
- self.draw_text(c, 150, 120, f2, "Application Font")
- self.draw_text(c, 5, 180, f3, "Times Italic 48")
-
- def draw_text(self, c, x, y, f, s):
- a = f.ascent
- d = f.descent
- #say("Font size", f.size, "ascent", a, "descent", d)
- w = f.width(s)
- c.fill_rect((x, y - a - 1, x + w, y - a))
- c.fill_rect((x, y, x + w, y + 1))
- c.fill_rect((x, y + d, x + w, y + d + 1))
- c.font = f
- c.moveto(x, y)
- c.show_text(s)
-
- def triangle_path(self, c, x, y):
- c.newpath()
- c.moveto(x, y)
- c.rlineto(40, 0)
- c.rlineto(-20, -30)
- c.closepath()
-
- def draw_triangle(self, c, x, y, hue):
- self.triangle_path(c, x, y)
- c.forecolor = hue
- c.fill()
- self.triangle_path(c, x, y)
- c.pensize = 3
- c.forecolor = black
- c.stroke()
-
- def fill_rectangle(self, c, rect, hue):
- (l, t, r, b) = rect
- c.newpath()
- c.moveto(l, t)
- c.lineto(l, b)
- c.lineto(r, b)
- c.lineto(r, t)
- c.closepath()
- c.forecolor = hue
- c.fill()
-
-
diff --git a/PyGUI-2.5.3/Tests/bare_file_dialog.py b/PyGUI-2.5.3/Tests/bare_file_dialog.py
deleted file mode 100644
index 27571ae..0000000
--- a/PyGUI-2.5.3/Tests/bare_file_dialog.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from GUI import application, Task
-from GUI.FileDialogs import request_old_file
-
-def tick():
- print "Tick"
-
-app = application()
-task = Task(interval = 1, repeat = True, proc = tick)
-result = request_old_file()
-print "Result =", result
diff --git a/PyGUI-2.5.3/Tests/grail.tiff b/PyGUI-2.5.3/Tests/grail.tiff
deleted file mode 100644
index 8980bcc..0000000
Binary files a/PyGUI-2.5.3/Tests/grail.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/grail_masked.tiff b/PyGUI-2.5.3/Tests/grail_masked.tiff
deleted file mode 100644
index 3fa489c..0000000
Binary files a/PyGUI-2.5.3/Tests/grail_masked.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/imac.jpg b/PyGUI-2.5.3/Tests/imac.jpg
deleted file mode 100644
index de01e5c..0000000
Binary files a/PyGUI-2.5.3/Tests/imac.jpg and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/long-list-button.py b/PyGUI-2.5.3/Tests/long-list-button.py
deleted file mode 100644
index f6534ab..0000000
--- a/PyGUI-2.5.3/Tests/long-list-button.py
+++ /dev/null
@@ -1,25 +0,0 @@
-from GUI import Window, ListButton, application
-from testing import say
-
-def report():
- print "Value =", but.value
-
-but = ListButton(position = (20, 20),
- titles = ["Item %d" % i for i in xrange(30)],
- action = report)
-but.value = 42
-win = Window(title = "List Button")
-win.add(but)
-but.become_target()
-win.show()
-
-instructions = """
-There should be a list button containing 30 items.
-
-Selecting an item should cause its value to be reported. On Windows,
-it should be possible to make a selection by typing the first letter
-of the title.
-"""
-
-say(instructions)
-application().run()
diff --git a/PyGUI-2.5.3/Tests/output.pdf b/PyGUI-2.5.3/Tests/output.pdf
deleted file mode 100644
index d331c1c..0000000
Binary files a/PyGUI-2.5.3/Tests/output.pdf and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/pill.png b/PyGUI-2.5.3/Tests/pill.png
deleted file mode 100644
index a25ac01..0000000
Binary files a/PyGUI-2.5.3/Tests/pill.png and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/setpath.bat b/PyGUI-2.5.3/Tests/setpath.bat
deleted file mode 100644
index 7b07740..0000000
--- a/PyGUI-2.5.3/Tests/setpath.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-set PATH=c:\python25;%PATH%
-set PYTHONPATH=..;../..
diff --git a/PyGUI-2.5.3/Tests/setpath3.bat b/PyGUI-2.5.3/Tests/setpath3.bat
deleted file mode 100644
index 5e35148..0000000
--- a/PyGUI-2.5.3/Tests/setpath3.bat
+++ /dev/null
@@ -1 +0,0 @@
-set PATH=c:\python31;%PATH%
diff --git a/PyGUI-2.5.3/Tests/spam.cwk b/PyGUI-2.5.3/Tests/spam.cwk
deleted file mode 100644
index c5efe3e..0000000
Binary files a/PyGUI-2.5.3/Tests/spam.cwk and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/spam.png b/PyGUI-2.5.3/Tests/spam.png
deleted file mode 100644
index e5d79eb..0000000
Binary files a/PyGUI-2.5.3/Tests/spam.png and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/spam.tiff b/PyGUI-2.5.3/Tests/spam.tiff
deleted file mode 100644
index cd6ed2f..0000000
Binary files a/PyGUI-2.5.3/Tests/spam.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/spam_masked.tiff b/PyGUI-2.5.3/Tests/spam_masked.tiff
deleted file mode 100644
index 3815d64..0000000
Binary files a/PyGUI-2.5.3/Tests/spam_masked.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/test_launcher.py b/PyGUI-2.5.3/Tests/test_launcher.py
deleted file mode 100644
index 7390572..0000000
--- a/PyGUI-2.5.3/Tests/test_launcher.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#---------------------------------------------------
-#
-# PyGUI test launcher for Windows
-#
-#---------------------------------------------------
-
-import os, sys
-from glob import glob
-from testing import say, ask
-
-def get_test_names():
- global test_names
- test_names = glob("*-*.py")
-
-def list_tests():
- all = test_names + [""]
- n = len(all) // 2
- for row in zip(all[:n], all[n:]):
- for name in row:
- sys.stdout.write("%-38s" % name)
- sys.stdout.write("\n")
-
-def get_test():
- while 1:
- prefix = ask("Test? ")
- if not prefix:
- sys.exit(0)
- matches = glob("%s-*.py" % prefix)
- if not matches:
- say("Unknown test")
- continue
- if len(matches) > 1:
- say("Ambiguous")
- continue
- return matches[0]
-
-def main():
- get_test_names()
- while 1:
- list_tests()
- name = get_test()
- print
- #cmd = r"c:\python25\python %s" % name
- cmd = "%s %s" % (sys.executable, name)
- say("Executing:", repr(cmd))
- os.system(cmd)
-
-main()
diff --git a/PyGUI-2.5.3/Tests/testing.py b/PyGUI-2.5.3/Tests/testing.py
deleted file mode 100644
index faf3a5d..0000000
--- a/PyGUI-2.5.3/Tests/testing.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import sys
-
-try:
- ask = raw_input
-except NameError:
- ask = input
-
-def say(*args):
- sys.stdout.write(" ".join(map(str, args)) + "\n")
diff --git a/PyGUI-2.5.3/Tests/testing.pyc b/PyGUI-2.5.3/Tests/testing.pyc
deleted file mode 100644
index 9820d09..0000000
Binary files a/PyGUI-2.5.3/Tests/testing.pyc and /dev/null differ
diff --git a/PyGUI-2.5.3/Tests/texteditor_test_text.txt b/PyGUI-2.5.3/Tests/texteditor_test_text.txt
deleted file mode 100644
index 11a9b9f..0000000
--- a/PyGUI-2.5.3/Tests/texteditor_test_text.txt
+++ /dev/null
@@ -1,236 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - TextEditor Printing - Gtk
-#
-#------------------------------------------------------------------------------
-
-import re
-from Printing import Printable
-
-class TextEditorPrintView(Printable):
-
- def __init__(self, base_view, page_setup):
- self.base_view = base_view; self.width = page_setup.page_width; self.page_height = page_setup.page_height; self.lay_out_text(); lines_per_page = int(page_setup.page_height / base_view.font.line_height); self.lines_per_page = lines_per_page; num_lines = len(self.lines); self.num_pages = (num_lines + lines_per_page - 1) // lines_per_page
- self.height = self.num_pages * self.page_height
- print "TextEditorPrintView: lines_per_page =", self.lines_per_page ###
- print "...num_lines =", num_lines ###
- print "...height =", self.height ###
- print "...page_height =", self.page_height ###
-
- def lay_out_text(self):
- base_view = self.base_view
- font = base_view.font
- space_width = font.width(" ")
- tab_spacing = base_view.tab_spacing
- page_width = self.width
- wrap = not base_view.get_hscrolling()
- if wrap:
- pat = re.compile(r"[ \t]|[^ \t]+")
- else:
- pat = re.compile(r"\t|[^ \t]+")
- lines = []
- line = []
- x = 0
- for text_line in base_view.text.splitlines():
- for match in pat.finditer(text_line):
- item = match.group()
- if item == " ":
- item_width = space_width
- item = ""
- elif item == "\t":
- item_width = tab_spacing - x % tab_spacing
- item = ""
- else:
- item_width = font.width(item)
- if wrap and x + item_width > page_width and x > 0:
- lines.append(line); line = []; x = 0
- line.append((x, item))
- x += item_width
- lines.append(line); line = []; x = 0
- self.lines = lines
-
- def get_print_extent(self):
- return self.width, self.height
-
- def draw(self, canvas, page_rect):
- l, t, r, b = page_rect
- page_no = int(t / self.page_height)
- print "TextEditorPrintView.draw: page_no =", page_no ###
- n = self.lines_per_page
- i = page_no * n
- font = self.base_view.font
- y = t + font.ascent
- dy = font.line_height
- for line in self.lines[i : i + n]:
- for x, item in line:
- canvas.moveto(x, y)
- canvas.show_text(item)
- y += dy
-
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Generic
-#
-#------------------------------------------------------------------------------
-
-from __future__ import division
-from math import ceil
-import cPickle as pickle
-from Properties import overridable_property
-from Globals import application
-
-class PageSetup(object):
- """Holder of information specified by the "Page Setup" command."""
-
- paper_name = overridable_property('paper_name')
- paper_width = overridable_property('paper_width')
- paper_height = overridable_property('paper_height')
- left_margin = overridable_property('left_margin')
- top_margin = overridable_property('top_margin')
- right_margin = overridable_property('right_margin')
- bottom_margin = overridable_property('bottom_margin')
- orientation = overridable_property('orientation')
-
- paper_size = overridable_property('paper_size')
- margins = overridable_property('margins')
- page_width = overridable_property('page_width')
- page_height = overridable_property('page_height')
- page_size = overridable_property('page_size')
- page_rect = overridable_property('page_rect')
- printable_rect = overridable_property('printable_rect') # May not work
- printer_name = overridable_property('printer_name')
-
- _pickle_attributes = ['paper_name', 'paper_size', 'margins',
- 'printer_name', 'orientation']
-
- def __getstate__(self):
- state = {}
- for name in self._pickle_attributes:
- state[name] = getattr(self, name)
- return state
-
- def __setstate__(self, state):
- for name, value in state.iteritems():
- setattr(self, name, value)
-
- def from_string(s):
- """Restore a pickled PageSetup object from a string."""
- return pickle.loads(s)
-
- from_string = staticmethod(from_string)
-
- def to_string(self):
- """Pickle the PageSetup object and return it as a string."""
- return pickle.dumps(self, 2)
-
- def get_paper_size(self):
- return self.paper_width, self.paper_height
-
- def set_paper_size(self, x):
- self.paper_width, self.paper_height = x
-
- def get_margins(self):
- return self.left_margin, self.top_margin, self.right_margin, self.bottom_margin
-
- def set_margins(self, x):
- self.left_margin, self.top_margin, self.right_margin, self.bottom_margin = x
-
- def get_page_width(self):
- return self.paper_width - self.left_margin - self.right_margin
-
- def get_page_height(self):
- return self.paper_height - self.top_margin - self.bottom_margin
-
- def get_page_size(self):
- return (self.page_width, self.page_height)
-
- def get_page_rect(self):
- lm, tm, rm, bm = self.margins
- pw, ph = self.paper_size
- return (lm, tm, pw - rm, ph - bm)
-
-#------------------------------------------------------------------------------
-
-class Printable(object):
- """Mixin class for components implementing the "Print" command."""
-
- printable = overridable_property('printable', "Whether this component should handle the 'Print' command.")
- page_setup = overridable_property('page_setup', "The PageSetup object to use for printing.")
- print_title = overridable_property('print_title', "Title for print job.")
-
- _printable = True
-
- def get_printable(self):
- return self._printable
-
- def set_printable(self, x):
- self._printable = x
-
- def get_print_title(self):
- window = self.window
- if window:
- return window.title
- else:
- return ""
-
- def get_page_setup(self):
- result = None
- model = getattr(self, 'model', None)
- if model:
- result = getattr(model, 'page_setup', None)
- if not result:
- result = application().page_setup
- return result
-
- def setup_menus(self, m):
- if self.printable:
- m.print_cmd.enabled = True
-
- def print_cmd(self):
- if self.printable:
- page_setup = self.page_setup
- if page_setup:
- self.print_view(page_setup)
- else:
- self.pass_to_next_handler('print_cmd')
-
-#------------------------------------------------------------------------------
-
-class Paginator(object):
- """Used internally. A generic pagination algorithm for printing."""
-
- def __init__(self, view, page_setup):
- self.view = view
- extent_width, extent_height = view.get_print_extent()
- #paper_width, paper_height = page_setup.paper_size
- #lm, tm, rm, bm = page_setup.margins
- #page_width = int(paper_width - lm - rm)
- #page_height = int(paper_height - tm - bm)
- page_width, page_height = page_setup.page_size
- if page_width <= 0 or page_height <= 0:
- from AlertFunctions import stop_alert
- stop_alert("Margins are too large for the page size.")
- return
- self.extent_rect = (0, 0, extent_width, extent_height)
- self.page_width = page_width
- self.page_height = page_height
- self.left_margin = page_setup.left_margin
- self.top_margin = page_setup.top_margin
- self.pages_wide = int(ceil(extent_width / page_width))
- self.pages_high = int(ceil(extent_height / page_height))
- self.num_pages = self.pages_wide * self.pages_high
-
- def draw_page(self, canvas, page_num):
- row, col = divmod(page_num, self.pages_wide)
- view_left = col * self.page_width
- view_top = row * self.page_height
- view_right = view_left + self.page_width
- view_bottom = view_top + self.page_height
- view_rect = (view_left, view_top, view_right, view_bottom)
- dx = self.left_margin - view_left
- dy = self.top_margin - view_top
- canvas.translate(dx, dy)
- canvas.rectclip(self.extent_rect)
- canvas.rectclip(view_rect)
- canvas._printing = True
- self.view.draw(canvas, view_rect)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Actions.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Actions.py
deleted file mode 100644
index 7f2ea48..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Actions.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Actions - Generic
-#
-#------------------------------------------------------------------------------
-
-from GUI.Properties import overridable_property
-from GUI.Exceptions import ApplicationError
-
-#------------------------------------------------------------------------------
-
-def action_property(name, doc):
- attr = intern('_' + name)
- def getter(self):
- return getattr(self, attr)
- def setter(self, value):
- setattr(self, attr, value)
- return property(getter, setter, None, doc)
-
-#------------------------------------------------------------------------------
-
-class ActionBase(object):
- """Mixin class providing base support for action properties."""
-
- def do_named_action(self, name):
- #print "ActionBase.do_named_action:", repr(name) ###
- action = getattr(self, name)
- #print "...action =", repr(action) ###
- if action:
- try:
- if isinstance(action, tuple):
- args = action[1:]
- action = action[0]
- else:
- args = ()
- if isinstance(action, str):
- #print "...handling", action ###
- self.handle(action, *args)
- else:
- action(*args)
- except ApplicationError:
- raise
- except:
- import sys
- et, ev, tb = sys.exc_info()
- raise et, et("%s (while doing action %r%r)" % (ev, action, args)), tb
-
-#------------------------------------------------------------------------------
-
-class Action(ActionBase):
- """Mixin class providing a single action property called 'action'."""
-
- action = action_property('action', """Action to be performed.
- May be or (, ...) where is either
- a message name or a callable object.""")
-
- _action = None
-
- def do_action(self):
- "Invoke the action."
- self.do_named_action('action')
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/AlertClasses.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/AlertClasses.py
deleted file mode 100644
index 806fb0d..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/AlertClasses.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - Alerts - Gtk
-#
-
-from GUI.GAlertClasses import Alert, Alert2, Alert3
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Alerts.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Alerts.py
deleted file mode 100644
index efc5351..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Alerts.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#-----------------------------------------------------------------------
-#
-# PyGUI - Alert functions - Generic
-#
-#-----------------------------------------------------------------------
-
-from GUI import BaseAlertFunctions
-
-def alert(kind, prompt, ok_label = "OK", **kwds):
- """Displays an alert box with one button. Does not return a value.
- Kind may be 'stop' for conditions preventing continuation,
- 'caution' for warning messages, 'note' for informational
- messages, and 'query' for asking a question of the user."""
-
- BaseAlertFunctions.alert(kind, prompt, ok_label, **kwds)
-
-
-def alert2(kind, prompt, yes_label = "Yes", no_label = "No",
- **kwds):
- """Displays an alert with two buttons. Returns 1 if the
- first button is pressed, 0 if the second button is pressed.
- The 'default' and 'cancel' arguments specify which buttons,
- if any, are activated by the standard keyboard equivalents,
- and take the values 1, 0 or None."""
-
- return BaseAlertFunctions.alert2(kind, prompt, yes_label, no_label,**kwds)
-
-
-def alert3(kind, prompt,
- yes_label = "Yes", no_label = "No", other_label = "Cancel",
- **kwds):
- """Displays an alert with 3 buttons. Returns 1 if the
- first button is pressed, 0 if the second button is pressed,
- and -1 if the third button is pressed. The 'default' and 'cancel'
- arguments specify which buttons, if any, are activated by the
- standard keyboard equivalents, and take the values 1, 0, -1 or None."""
-
- return BaseAlertFunctions.alert3(kind, prompt, yes_label, no_label, other_label, **kwds)
-
-
-def stop_alert(*args, **kwds):
- """Displays a 1-button alert of type 'stop'. See alert()."""
- alert('stop', *args, **kwds)
-
-def note_alert(*args, **kwds):
- """Displays a 1-button alert of type 'note'. See alert()."""
- alert('note', *args, **kwds)
-
-def confirm(*args, **kwds):
- """Displays a 2-button alert of type 'caution'. See alert2()."""
- return alert2('caution', *args, **kwds)
-
-def ask(*args, **kwds):
- """Displays a 2-button alert of type 'query'. See alert2()."""
- return alert2('query', *args, **kwds)
-
-def confirm_or_cancel(*args, **kwds):
- """Displays a 3-button alert of type 'caution'. See alert3()."""
- return alert3('caution', *args, **kwds)
-
-def ask_or_cancel(*args, **kwds):
- """Displays a 3-button alert of type 'query'. See alert3()."""
- return alert3('query', *args, **kwds)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Application.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Application.py
deleted file mode 100644
index 2fb46d2..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Application.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#
-# Python GUI - Application class - Gtk
-#
-
-import sys
-import gtk
-from GUI import export
-from GUI import application
-from GUI.GApplications import Application as GApplication
-
-class Application(GApplication):
-
- _in_gtk_main = 0
-
- def run(self):
- GApplication.run(self)
-
- def set_menus(self, menu_list):
- GApplication.set_menus(self, menu_list)
- for window in self._windows:
- window._gtk_update_menubar()
-
-# def handle_events(self):
-# #print "Application.handle_events: entering gtk.main" ###
-# _call_with_excepthook(gtk.main, gtk.main_quit)
-# #print "Application.handle_events: returned from gtk.main" ###
-
- def handle_next_event(self, modal_window = None):
- _call_with_excepthook(gtk.main_iteration)
- self._check_for_no_windows()
-
-# def _quit(self):
-# self._quit_flag = True
-# gtk.main_quit()
-
-# def _exit_event_loop(self):
-# gtk.main_quit()
-
- def get_target_window(self):
- for window in self._windows:
- if window._gtk_outer_widget.has_focus:
- return window
- return None
-
- def zero_windows_allowed(self):
- return 0
-
- def query_clipboard(self):
- return _gtk_clipboard.available()
-
- def get_clipboard(self):
- return _gtk_clipboard.get()
-
- def set_clipboard(self, data):
- _gtk_clipboard.set(data)
-
-#------------------------------------------------------------------------------
-
-class GtkClipboard(gtk.Window):
-
- data = ""
-
- def __init__(self):
- gtk.Window.__init__(self)
- self.realize()
- self.connect('selection_get', self.selection_get_signalled)
- self.connect('selection_received', self.selection_received_signalled)
- self.selection_add_target("CLIPBOARD", "STRING", 0)
-
- def selection_get_signalled(self, w, selection_data, info, time_stamp):
- #print "Clipboard.selection_get_signalled" ###
- selection_data.set_text(self.data, len(self.data))
-
- def selection_received_signalled(self, w, selection_data, info):
- #print "Clipboard.selection_received_signalled:", selection_data ###
- type = str(selection_data.type)
- if type == "STRING":
- data = selection_data.get_text()
- elif type == "ATOM":
- data = selection_data.get_targets()
- else:
- #print "Clipboard.selection_received_signalled: Unknown type: %r" % type
- data = None
- #print "...data =", repr(data) ###
- self.received_data = data
-
- def request(self, target, default):
- # Get the contents of the clipboard.
- #print "Clipboard.request:", target ###
- self.received_data = -1
- self.selection_convert("CLIPBOARD", target)
- while self.received_data == -1:
- gtk.main_iteration()
- data = self.received_data
- self.received_data = None
- if data is None:
- data = default
- #print "Clipboard.request ->", repr(data) ###
- return data
-
- def available(self):
- targets = self.request("TARGETS", ())
- #print "Clipboard.available: targets =", repr(targets) ###
- return "STRING" in map(str, targets)
-
- def get(self):
- # Get the contents of the clipboard.
- text = self.request("STRING", "")
- #print "Clipboard.get ->", repr(text) ###
- return text
-
- def set(self, text):
- # Put the given text on the clipboard.
- #print "Clipboard.set:", text ###
- self.data = text
- result = self.selection_owner_set("CLIPBOARD")
- #print "...result =", result ###
-
-#------------------------------------------------------------------------------
-
-_gtk_clipboard = GtkClipboard()
-
-#------------------------------------------------------------------------------
-
-def _call_with_excepthook(proc, breakout = None):
- # This function arranges for exceptions to be propagated
- # across calls to the Gtk event loop functions.
- exc_info = []
- def excepthook(*args):
- exc_info[:] = args
- if breakout:
- breakout()
- old_excepthook = sys.excepthook
- try:
- sys.excepthook = excepthook
- proc()
- finally:
- sys.excepthook = old_excepthook
- if exc_info:
- #print "_call_with_excepthook: raising", exc_info ###
- raise exc_info[0], exc_info[1], exc_info[2]
-
-export(Application)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseAlert.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseAlert.py
deleted file mode 100644
index d845ef8..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseAlert.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Python GUI - Alert base class - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GBaseAlerts import BaseAlert as GBaseAlert
-
-_kind_to_gtk_stock_id = {
- 'stop': gtk.STOCK_DIALOG_ERROR,
- 'caution': gtk.STOCK_DIALOG_WARNING,
- 'note': gtk.STOCK_DIALOG_INFO,
- 'query': gtk.STOCK_DIALOG_QUESTION,
-}
-
-class BaseAlert(GBaseAlert):
-
- def _layout_icon(self, kind):
- gtk_stock_id = _kind_to_gtk_stock_id[kind]
- gtk_icon = gtk.image_new_from_stock(gtk_stock_id, gtk.ICON_SIZE_DIALOG)
- gtk_icon.show()
- icon_size = gtk_icon.size_request()
- icon_width, icon_height = icon_size
- self._gtk_inner_widget.put(gtk_icon, self._left_margin, self._top_margin)
- return icon_size
-
-export(BaseAlert)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseAlertFunctions.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseAlertFunctions.py
deleted file mode 100644
index 84a0b38..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseAlertFunctions.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Python GUI - Basic alert functions - Generic
-#
-
-from GUI.AlertClasses import Alert, Alert2, Alert3
-
-def present_and_destroy(dlog):
- dlog.center()
- try:
- return dlog.present()
- finally:
- dlog.destroy()
-
-
-def alert(kind, prompt, ok_label, **kwds):
- present_and_destroy(Alert(kind, prompt, ok_label))
-
-
-def alert2(kind, prompt, yes_label, no_label, **kwds):
- return present_and_destroy(
- Alert2(kind, prompt, yes_label, no_label, **kwds))
-
-
-def alert3(kind, prompt, yes_label, no_label, other_label, **kwds):
- return present_and_destroy(
- Alert3(kind, prompt, yes_label, no_label, other_label, **kwds))
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseFileDialogs.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseFileDialogs.py
deleted file mode 100644
index fef6f86..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/BaseFileDialogs.py
+++ /dev/null
@@ -1,214 +0,0 @@
-#
-# Python GUI - File selection dialogs - Gtk
-#
-
-import os
-import gtk
-from GUI.Files import FileRef
-from GUI.Alerts import confirm
-from GUI import application
-
-#------------------------------------------------------------------
-
-class _FileDialog(gtk.FileChooserDialog):
-
- def __init__(self, ok_label, **kwds):
- gtk.FileChooserDialog.__init__(self, **kwds)
- self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT)
- self.add_button(ok_label, gtk.RESPONSE_ACCEPT)
- self.connect('response', self.response)
- self.set_default_size(600, 600)
- self.set_position(gtk.WIN_POS_CENTER)
-
- def add_file_type(self, file_type):
- suffix = file_type.suffix
- if suffix:
- filter = gtk.FileFilter()
- name = file_type.name
- if name:
- filter.set_name(name)
- filter.add_pattern("*.%s" % suffix)
- self.add_filter(filter)
-
- def present_modally(self):
- return self.run() == gtk.RESPONSE_ACCEPT
-
- def response(self, _, id):
- #print "_FileDialog.response:", id ###
- if id == gtk.RESPONSE_ACCEPT:
- if not self.check():
- self.stop_emission('response')
-
- def check(self):
- return True
-
-#------------------------------------------------------------------
-
-class _SaveFileDialog(_FileDialog):
-
- def check(self):
- path = self.get_filename()
- #print "_SaveFileDialog.ok: checking path %r" % path ###
- #if path is None:
- # return False
- if not os.path.exists(path):
- return True
- else:
- result = confirm("Replace existing '%s'?" % os.path.basename(path),
- "Cancel", "Replace", cancel = None)
- return result == 0
-
-#------------------------------------------------------------------
-
-def _request_old(prompt, default_dir, file_types, dir, multiple):
-
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- if dir:
- action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER
- else:
- action = gtk.FILE_CHOOSER_ACTION_OPEN
- dlog = _FileDialog(title = prompt, action = action,
- ok_label = gtk.STOCK_OPEN)
- dlog.set_select_multiple(multiple)
- if file_types:
- for file_type in file_types:
- dlog.add_file_type(file_type)
- if default_dir:
- dlog.set_current_folder(default_dir.path)
- if dlog.present_modally():
- if multiple:
- result = [FileRef(path = path) for path in dlog.get_filenames()]
- else:
- result = FileRef(path = dlog.get_filename())
- else:
- result = None
- dlog.destroy()
- return result
-
-#------------------------------------------------------------------
-
-#def request_old_file(prompt = "Open File", default_dir = None,
-# file_types = None, multiple = False):
-# """Present a dialog for selecting an existing file or set of files.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _FileDialog(title = prompt, ok_label = gtk.STOCK_OPEN)
-# dlog.set_select_multiple(multiple)
-# if file_types:
-# for file_type in file_types:
-# dlog.add_file_type(file_type)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if dlog.present_modally():
-# if multiple:
-# result = [FileRef(path = path) for path in dlog.get_filenames()]
-# else:
-# result = FileRef(path = dlog.get_filename())
-# else:
-# result = None
-# dlog.destroy()
-# return result
-
-#------------------------------------------------------------------
-
-#def request_old_directory(prompt = "Choose Folder", default_dir = None,
-# multiple = False):
-# """Present a dialog for selecting an existing directory or set of directories.
-# Returns a DirRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _FileDialog(title = prompt, ok_label = gtk.STOCK_OPEN,
-# action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
-# dlog.set_select_multiple(multiple)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if dlog.present_modally():
-# if multiple:
-# result = [DirRef(path = path) for path in dlog.get_filenames()]
-# else:
-# result = DirRef(path = dlog.get_filename())
-# else:
-# result = None
-# dlog.destroy()
-# return result
-
-#------------------------------------------------------------------
-
-def _request_new(prompt, default_dir, default_name, file_type, dir):
- if dir:
- action = gtk.FILE_CHOOSER_ACTION_CREATE_FOLDER
- else:
- action = gtk.FILE_CHOOSER_ACTION_SAVE
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- dlog = _SaveFileDialog(title = prompt, action = action,
- ok_label = gtk.STOCK_SAVE)
- if file_type:
- dlog.add_file_type(file_type)
- if default_dir:
- dlog.set_current_folder(default_dir.path)
- if default_name:
- dlog.set_current_name(default_name)
- if dlog.present_modally():
- path = dlog.get_filename()
- if file_type:
- path = file_type._add_suffix(path)
- result = FileRef(path = path)
- else:
- result = None
- dlog.destroy()
- return result
-
-#------------------------------------------------------------------
-
-#def request_new_file(prompt = "Save File", default_dir = None,
-# default_name = "", file_type = None):
-# """Present a dialog requesting a name and location for a new file.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _SaveFileDialog(title = prompt, ok_label = gtk.STOCK_SAVE,
-# action = gtk.FILE_CHOOSER_ACTION_SAVE)
-# if file_type:
-# dlog.add_file_type(file_type)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if default_name:
-# dlog.set_current_name(default_name)
-# if dlog.present_modally():
-# path = dlog.get_filename()
-# if file_type:
-# path = file_type._add_suffix(path)
-# result = FileRef(path = path)
-# else:
-# result = None
-# dlog.destroy()
-# return result
-
-#------------------------------------------------------------------
-
-#def request_new_directory(prompt = "Create Folder", default_dir = None,
-# default_name = ""):
-# """Present a dialog requesting a name and location for a new directory.
-# Returns a FileRef, or None if cancelled."""
-#
-# if prompt.endswith(":"):
-# prompt = prompt[:-1]
-# dlog = _SaveFileDialog(title = prompt, ok_label = gtk.STOCK_SAVE,
-# action = gtk.FILE_CHOOSER_ACTION_CREATE_FOLDER)
-# if default_dir:
-# dlog.set_current_folder(default_dir.path)
-# if default_name:
-# dlog.set_current_name(default_name)
-# if dlog.present_modally():
-# path = dlog.get_filename()
-# result = FileRef(path = path)
-# else:
-# result = None
-# dlog.destroy()
-# return result
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Button.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Button.py
deleted file mode 100644
index 2c0f62e..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Button.py
+++ /dev/null
@@ -1,100 +0,0 @@
-#
-# Python GUI - Buttons - Gtk version
-#
-
-import gtk
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.GButtons import Button as GButton
-
-_gtk_extra_hpad = 5 # Amount to add to default width at each end
-_gtk_icon_spacing = 2 # Space to leave between icon and label
-
-class Button(GButton):
-
- _gtk_icon = None # Icon, when we have one
- _style = 'normal' # or 'default' or 'cancel'
-
- def __init__(self, title = "Button", #style = 'normal',
- font = system_font, **kwds):
- gtk_label = gtk.Label(title)
- gtk_box = gtk.HBox(spacing = _gtk_icon_spacing)
- gtk_box.pack_end(gtk_label, fill = True, expand = True)
- gtk_alignment = gtk.Alignment(0.5, 0.5, 0.0, 0.0)
- hp = _gtk_extra_hpad
- gtk_alignment.set_padding(0, 0, hp, hp)
- gtk_alignment.add(gtk_box)
- gtk_button = gtk.Button()
- gtk_button.add(gtk_alignment)
- gtk_button.set_focus_on_click(False)
- gtk_button.show_all()
- w, h = font.text_size(title)
- w2 = w + 2 * _gtk_button_hpad + _gtk_icon_width + _gtk_icon_spacing
- h2 = max(h + 2 * _gtk_button_vpad, _gtk_default_button_height)
- gtk_button.set_size_request(int(round(w2)), int(round(h2)))
- self._gtk_box = gtk_box
- self._gtk_alignment = gtk_alignment
- self._gtk_connect(gtk_button, 'clicked', self._gtk_clicked_signal)
- GButton.__init__(self, _gtk_outer = gtk_button, _gtk_title = gtk_label,
- font = font, **kwds)
-
- def _gtk_get_alignment(self):
- return self._gtk_alignment.get_property('xalign')
-
- def _gtk_set_alignment(self, fraction, just):
- self._gtk_alignment.set_property('xalign', fraction)
- self._gtk_title_widget.set_justify(just)
-
- def get_style(self):
- return self._style
-
- def set_style(self, new_style):
- if self._style <> new_style:
- if new_style == 'default':
- self._gtk_add_icon(gtk.STOCK_OK)
- elif new_style == 'cancel':
- self._gtk_add_icon(gtk.STOCK_CANCEL)
- else:
- self._gtk_remove_icon()
- self._style = new_style
-
- def _gtk_add_icon(self, gtk_stock_id):
- gtk_icon = gtk.image_new_from_stock(gtk_stock_id, gtk.ICON_SIZE_BUTTON)
- gtk_icon.show()
- self._gtk_box.pack_start(gtk_icon)
- self._gtk_icon = gtk_icon
-
- def _gtk_remove_icon(self):
- gtk_icon = self._gtk_icon
- if gtk_icon:
- gtk_icon.destroy()
- self._gtk_icon = None
-
- def activate(self):
- """Highlight the button momentarily and then perform its action."""
- self._gtk_outer_widget.activate()
-
- def _gtk_clicked_signal(self):
- self.do_action()
-
-
-def _calc_size_constants():
- global _gtk_icon_width, _gtk_default_button_height
- global _gtk_button_hpad, _gtk_button_vpad
- gtk_icon = gtk.image_new_from_stock(gtk.STOCK_OK, gtk.ICON_SIZE_BUTTON)
- gtk_button = gtk.Button()
- gtk_button.add(gtk_icon)
- gtk_button.show_all()
- icon_width, icon_height = gtk_icon.size_request()
- butn_width, butn_height = gtk_button.size_request()
- _gtk_icon_width = icon_width
- _gtk_default_button_height = butn_height
- _gtk_button_hpad = (butn_width - icon_width) / 2 + _gtk_extra_hpad
- _gtk_button_vpad = (butn_height - icon_height) / 2
- gtk_button.destroy()
-
-_calc_size_constants()
-del _calc_size_constants
-
-export(Button)
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Canvas.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Canvas.py
deleted file mode 100644
index f83f3ec..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Canvas.py
+++ /dev/null
@@ -1,255 +0,0 @@
-#--------------------------------------------------------------------
-#
-# Python GUI - Canvas - Gtk
-#
-#--------------------------------------------------------------------
-
-from math import sin, cos, pi, floor
-from cairo import OPERATOR_OVER, OPERATOR_SOURCE, FILL_RULE_EVEN_ODD
-from GUI import export
-from GUI.Geometry import sect_rect
-from GUI.StdFonts import application_font
-from GUI.StdColors import black, white
-from GUI.GCanvases import Canvas as GCanvas
-from GUI.GCanvasPaths import CanvasPaths as GCanvasPaths
-
-deg = pi / 180
-twopi = 2 * pi
-
-#--------------------------------------------------------------------
-
-class GState(object):
-
- pencolor = black
- fillcolor = black
- textcolor = black
- backcolor = white
- pensize = 1
- font = application_font
-
- def __init__(self, clone = None):
- if clone:
- self.__dict__.update(clone.__dict__)
-
-#--------------------------------------------------------------------
-
-class Canvas(GCanvas, GCanvasPaths):
-
- def _from_gdk_drawable(cls, gdk_drawable):
- return cls(gdk_drawable.cairo_create())
-
- _from_gdk_drawable = classmethod(_from_gdk_drawable)
-
- def _from_cairo_context(cls, ctx):
- return cls(ctx)
-
- _from_cairo_context = classmethod(_from_cairo_context)
-
- def __init__(self, ctx):
- ctx.set_fill_rule(FILL_RULE_EVEN_ODD)
- self._gtk_ctx = ctx
- self._gstack = []
- self._state = GState()
- GCanvas.__init__(self)
- GCanvasPaths.__init__(self)
-
- def get_pencolor(self):
- return self._state.pencolor
-
- def set_pencolor(self, c):
- self._state.pencolor = c
-
- def get_fillcolor(self):
- return self._state.fillcolor
-
- def set_fillcolor(self, c):
- self._state.fillcolor = c
-
- def get_textcolor(self):
- return self._state.textcolor
-
- def set_textcolor(self, c):
- self._state.textcolor = c
-
- def get_backcolor(self):
- return self._state.backcolor
-
- def set_backcolor(self, c):
- self._state.backcolor = c
-
- def get_pensize(self):
- return self._state.pensize
-
- def set_pensize(self, d):
- self._state.pensize = d
-
- def get_font(self):
- return self._state.font
-
- def set_font(self, f):
- self._state.font = f
-
- def get_current_point(self):
- return self._gtk_ctx.get_current_point()
-
- def rectclip(self, r):
- l, t, r, b = r
- ctx = self._gtk_ctx
- ctx.new_path()
- ctx.rectangle(l, t, r - l, b - t)
- ctx.clip()
-
- def gsave(self):
- old_state = self._state
- self._gstack.append(old_state)
- self._state = GState(old_state)
- self._gtk_ctx.save()
-
- def grestore(self):
- self._state = self._gstack.pop()
- self._gtk_ctx.restore()
-
- def newpath(self):
- self._gtk_ctx.new_path()
-
- def moveto(self, x, y):
- self._gtk_ctx.move_to(x, y)
-
- def rmoveto(self, x, y):
- self._gtk_ctx.rel_move_to(x, y)
-
- def lineto(self, x, y):
- self._gtk_ctx.line_to(x, y)
-
- def rlineto(self, x, y):
- self._gtk_ctx.rel_line_to(x, y)
-
- def curveto(self, p1, p2, p3):
- self._gtk_ctx.curve_to(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1])
-
- def rcurveto(self, p1, p2, p3):
- self._gtk_ctx.rel_curve_to(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1])
-
- def arc(self, c, r, a0, a1):
- self._gtk_ctx.arc(c[0], c[1], r, a0 * deg, a1 * deg)
-
- def closepath(self):
- ctx = self._gtk_ctx
- ctx.close_path()
- ctx.new_sub_path()
-
- def clip(self):
- self._gtk_ctx.clip_preserve()
-
- def stroke(self):
- state = self._state
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*state.pencolor._rgba)
- ctx.set_source_color(state.pencolor._gdk_color)
- ctx.set_line_width(state.pensize)
- ctx.stroke_preserve()
-
- def fill(self):
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*self._state.fillcolor._rgba)
- ctx.set_source_color(self._state.fillcolor._gdk_color)
- ctx.fill_preserve()
-
- def erase(self):
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*self._state.backcolor._rgba)
- ctx.set_source_color(self._state.backcolor._gdk_color)
- ctx.set_operator(OPERATOR_SOURCE)
- ctx.fill_preserve()
- ctx.set_operator(OPERATOR_OVER)
-
- def show_text(self, text):
- font = self._state.font
- layout = font._get_pango_layout(text, True)
- dx = layout.get_pixel_size()[0]
- dy = font.ascent
- ctx = self._gtk_ctx
- #ctx.set_source_rgba(*self._state.textcolor._rgba)
- ctx.set_source_color(self._state.textcolor._gdk_color)
- ctx.rel_move_to(0, -dy)
- ctx.show_layout(layout)
- ctx.rel_move_to(dx, dy)
-
- def rect(self, rect):
- l, t, r, b = rect
- self._gtk_ctx.rectangle(l, t, r - l, b - t)
-
- def oval(self, rect):
- l, t, r, b = rect
- a = 0.5 * (r - l)
- b = 0.5 * (b - t)
- ctx = self._gtk_ctx
- ctx.new_sub_path()
- ctx.save()
- ctx.translate(l + a, t + b)
- ctx.scale(a, b)
- ctx.arc(0, 0, 1, 0, twopi)
- ctx.close_path()
- ctx.restore()
-
- def translate(self, dx, dy):
- self._gtk_ctx.translate(dx, dy)
- return
-
- def rotate(self, degrees):
- self._gtk_ctx.rotate(degrees*pi/180)
- return
-
- def scale(self, xscale, yscale):
- self._gtk_ctx.scale(xscale, yscale)
- return
-
-# def _coords(self, x, y):
-# x0, y0 = self._origin
-# return int(round(x0 + x)), int(round(y0 + y))
-
-# def _coords(self, x, y):
-# return int(round(x)), int(round(y))
-
-# def _rect_coords(self, (l, t, r, b)):
-# x0, y0 = self._origin
-# l = int(round(x0 + l))
-# t = int(round(y0 + t))
-# r = int(round(x0 + r))
-# b = int(round(y0 + b))
-# return l, t, r - l, b - t
-
-# def _rect_coords(self, (l, t, r, b)):
-# l = int(round(l))
-# t = int(round(t))
-# r = int(round(r))
-# b = int(round(b))
-# return l, t, r - l, b - t
-
-# def _frame_coords(self, r):
-# l, t, w, h = self._rect_coords(r)
-# p = self._gdk_gc.line_width
-# d = p // 2
-# return (
-# int(floor(l + d)),
-# int(floor(t + d)),
-# int(floor(w - p)),
-# int(floor(h - p)))
-
-#def _gdk_angles(start_angle, end_angle):
-# arc_angle = (end_angle - start_angle) % 360
-# start = int(round(start_angle * 64))
-# arc = int(round((arc_angle) * 64))
-# return -start, -arc
-
-#def _arc_rect((cx, cy), r):
-# return (cx - r, cy - r, cx + r, cy + r)
-
-#def _arc_endpoint(center, r, a):
-# cx, cy = center
-# ar = a * deg
-# x = int(round(cx + r * cos(ar)))
-# y = int(round(cy + r * sin(ar)))
-# return x, y
-
-export(Canvas)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/CheckBox.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/CheckBox.py
deleted file mode 100644
index ef3a74b..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/CheckBox.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - Check boxes - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GCheckBoxes import CheckBox as GCheckBox
-
-class CheckBox(GCheckBox):
-
- def __init__(self, title = "New Control", **kwds):
- gtk_checkbox = gtk.CheckButton(title)
- gtk_checkbox.show()
- self._gtk_connect(gtk_checkbox, 'clicked', self._gtk_clicked_signal)
- self._gtk_inhibit_action = 0
- GCheckBox.__init__(self, _gtk_outer = gtk_checkbox, **kwds)
-
- def get_on(self):
- gtk_checkbox = self._gtk_outer_widget
- if gtk_checkbox.get_inconsistent():
- return 'mixed'
- else:
- return gtk_checkbox.get_active()
-
- def set_on(self, state):
- mixed = state == 'mixed'
- if mixed:
- if not self._mixed:
- raise ValueError("CheckBox state cannot be 'mixed'")
- active = False
- else:
- active = bool(state)
- save = self._gtk_inhibit_action
- self._gtk_inhibit_action = 1
- try:
- gtk_checkbox = self._gtk_outer_widget
- gtk_checkbox.set_active(active)
- gtk_checkbox.set_inconsistent(mixed)
- finally:
- self._gtk_inhibit_action = save
-
- def _gtk_clicked_signal(self):
- gtk_checkbox = self._gtk_outer_widget
- if not self._gtk_inhibit_action:
- if self._auto_toggle:
- gtk_checkbox.set_inconsistent(False)
- else:
- save = self._gtk_inhibit_action
- self._gtk_inhibit_action = 1
- try:
- gtk_checkbox.set_active(not gtk_checkbox.get_active())
- finally:
- self._gtk_inhibit_action = save
- self.do_action()
-
-export(CheckBox)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Color.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Color.py
deleted file mode 100644
index 39b15e3..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Color.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# Python GUI - Colors - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GColors import Color as GColor
-
-class Color(GColor):
-
- _alpha = 1.0
-
- def _from_gdk_color(cls, _gdk_color):
- c = cls.__new__(cls)
- c._gdk_color = _gdk_color
- return c
-
- _from_gdk_color = classmethod(_from_gdk_color)
-
- def __init__(self, red, green, blue, alpha = 1.0):
- self._rgba = (red, green, blue, alpha)
- gdk_color = gdk.Color()
- gdk_color.red = int(red * 65535)
- gdk_color.green = int(green * 65535)
- gdk_color.blue = int(blue * 65535)
- self._gdk_color = gdk_color
- self._alpha = alpha
-
- def get_red(self):
- return self._gdk_color.red / 65535.0
-
- def get_green(self):
- return self._gdk_color.green / 65535.0
-
- def get_blue(self):
- return self._gdk_color.blue / 65535.0
-
- def get_alpha(self):
- return self._alpha
-
-export(Color)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Colors.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Colors.py
deleted file mode 100644
index 9fa29dd..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Colors.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Python GUI - Color constants and functions - Gtk
-#
-
-from gtk import Style
-from GUI import Color
-
-rgb = Color
-
-s = Style()
-selection_forecolor = Color._from_gdk_color(s.fg[3])
-selection_backcolor = Color._from_gdk_color(s.bg[3])
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Column.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Column.py
deleted file mode 100644
index 715d666..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Column.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Column layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Column(Frame):
-
- def __init__(self, items, spacing = 10, align = 'l', equalize = '',
- expand = None, padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- if expand is not None and not isinstance(expand, int):
- expand = items.index(expand)
- equalize_components(items, equalize)
- width = 0
- for item in items:
- if item:
- width = max(width, item.width)
- y = vpad
- gap = 0
- vanchor = 't'
- hanchor = align
- for i, item in enumerate(items):
- if item:
- y += gap
- if 'l' in align:
- x = 0
- if 'r' in align:
- item.width = width
- elif align == 'r':
- x = width - item.width
- else:
- x = (width - item.width) // 2
- item.position = (x + hpad, y)
- if i == expand:
- item.anchor = 'tb' + hanchor
- vanchor = 'b'
- else:
- item.anchor = vanchor + hanchor
- y += item.height
- if i == expand:
- vanchor = 'b'
- gap = spacing
- self.size = (width + 2 * hpad, y + vpad)
- self.add(items)
- self.set(**kwds)
-
-export(Column)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Compatibility.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Compatibility.py
deleted file mode 100644
index 87eda05..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Compatibility.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#-------------------------------------------------------------------------------
-#
-# PyGUI - Facilities for compatibility across Python versions
-#
-#-------------------------------------------------------------------------------
-
-try:
- from __builtin__ import set
-except ImportError:
- from sets import Set as set
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Component.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Component.py
deleted file mode 100644
index 36e76b8..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Component.py
+++ /dev/null
@@ -1,252 +0,0 @@
-#
-# Python GUI - Components - Gtk
-#
-
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI import Event
-from GUI.Geometry import sub_pt
-from GUI.GComponents import Component as GComponent
-
-_gdk_events_of_interest = (
- gdk.POINTER_MOTION_MASK |
- gdk.BUTTON_MOTION_MASK |
- gdk.BUTTON_PRESS_MASK |
- gdk.BUTTON_RELEASE_MASK |
- gdk.KEY_PRESS_MASK |
- gdk.KEY_RELEASE_MASK |
- gdk.ENTER_NOTIFY_MASK |
- gdk.LEAVE_NOTIFY_MASK |
- 0
-)
-
-_gtk_widget_to_component = {}
-_gtk_last_keyval_down = None
-
-#------------------------------------------------------------------------------
-
-class Component(GComponent):
-
- _pass_key_events_to_platform = True
-
- def _gtk_find_component(gtk_widget):
- while gtk_widget:
- component = _gtk_widget_to_component.get(gtk_widget)
- if component:
- return component
- gtk_widget = gtk_widget.get_parent()
- return None
-
- _gtk_find_component = staticmethod(_gtk_find_component)
-
- def __init__(self, _gtk_outer, _gtk_inner = None,
- _gtk_focus = None, _gtk_input = None, **kwds):
- self._position = (0, 0)
- self._size = _gtk_outer.size_request()
- _gtk_inner = _gtk_inner or _gtk_outer
- self._gtk_outer_widget = _gtk_outer
- self._gtk_inner_widget = _gtk_inner
- self._gtk_focus_widget = _gtk_focus
- _gtk_widget_to_component[_gtk_outer] = self
- self._gtk_connect_input_events(_gtk_input or _gtk_inner)
- if _gtk_focus:
- _gtk_focus.set_property('can-focus', True)
- self._gtk_connect(_gtk_focus, 'focus-in-event', self._gtk_focus_in)
- GComponent.__init__(self, **kwds)
-
- def destroy(self):
- gtk_widget = self._gtk_outer_widget
- if gtk_widget in _gtk_widget_to_component:
- del _gtk_widget_to_component[gtk_widget]
- GComponent.destroy(self)
-
- #
- # Properties
- #
-
- def set_width(self, v):
- w, h = self.size
- self.size = (v, h)
-
- def set_height(self, v):
- w, h = self.size
- self.size = (w, v)
-
- def get_position(self):
- return self._position
-
- def set_position(self, v):
- self._position = v
- widget = self._gtk_outer_widget
- parent = widget.get_parent()
- if parent:
- parent.move(widget, *v)
-
- def get_size(self):
- return self._size
-
- def set_size(self, new_size):
- w0, h0 = self._size
- w1, h1 = new_size
- self._gtk_outer_widget.set_size_request(max(int(w1), 1), max(int(h1), 1))
- self._size = new_size
- if w0 != w1 or h0 != h1:
- self._resized((w1 - w0, h1 - h0))
-
- def get_bounds(self):
- x, y = self._position
- w, h = self.size
- return (x, y, x + w, y + h)
-
- def set_bounds(self, (l, t, r, b)):
- self.position = (l, t)
- self.size = (r - l, b - t)
-
-# def get_visible(self):
-# return self._gtk_outer_widget.get_property('visible')
-#
-# def set_visible(self, v):
-# self._gtk_outer_widget.set_property('visible', v)
-
- #
- # Message dispatching
- #
-
- def become_target(self):
- gtk_focus = self._gtk_focus_widget
- if gtk_focus:
- gtk_focus.grab_focus()
- else:
- raise ValueError("%r cannot be targeted" % self)
-
-# def current_target(self):
-# """Find the current target object within the Window containing
-# this component. If the component is not contained in a Window,
-# the result is undefined."""
-# target = _gtk_find_component(self._gtk_outer_widget.get_focus())
-# if not target:
-# target = self.window
-# return target
-
- def is_target(self):
- """Return true if this is the current target within the containing
- Window. If the component is not contained in a Window, the result
- is undefined."""
- gtk_focus = self._gtk_focus_widget
- if gtk_focus:
- return gtk_focus.get_property('has-focus')
- else:
- return False
-
- #
- # Internal
- #
-
- def _gtk_connect(self, gtk_widget, signal, handler):
- def catch(widget, *args):
- try:
- handler(*args)
- except:
- _gtk_exception_in_signal_handler()
- gtk_widget.connect(signal, lambda widget, *args: handler(*args))
-
- def _gtk_connect_after(self, gtk_widget, signal, handler):
- def catch(widget, *args):
- try:
- handler(*args)
- except:
- _gtk_exception_in_signal_handler()
- gtk_widget.connect_after(signal, lambda widget, *args: handler(*args))
-
- def _gtk_focus_in(self, gtk_event):
- window = self.window
- if window:
- old_target = window._target
- window._target = self
- if old_target and old_target is not self:
- old_target._untargeted()
- self._targeted()
-
- def _targeted(self):
- pass
-
- def _untargeted(self):
- pass
-
- def _gtk_connect_input_events(self, gtk_widget):
- self._last_mouse_down_time = 0
- self._click_count = 0
- gtk_widget.add_events(_gdk_events_of_interest)
- self._gtk_connect(gtk_widget, 'button-press-event',
- self._gtk_button_press_event_signal)
- self._gtk_connect(gtk_widget, 'motion-notify-event',
- self._gtk_motion_notify_event_signal)
- self._gtk_connect(gtk_widget, 'button-release-event',
- self._gtk_button_release_event_signal)
- self._gtk_connect(gtk_widget, 'enter-notify-event',
- self._gtk_enter_leave_event_signal)
- self._gtk_connect(gtk_widget, 'leave-notify-event',
- self._gtk_enter_leave_event_signal)
- self._gtk_connect(gtk_widget, 'key-press-event',
- self._handle_gtk_key_event)
- self._gtk_connect(gtk_widget, 'key-release-event',
- self._handle_gtk_key_event)
-
- def _gtk_button_press_event_signal(self, gtk_event):
- if gtk_event.type == gdk.BUTTON_PRESS: # don't want 2BUTTON or 3BUTTON
- event = Event._from_gtk_mouse_event(gtk_event)
- last_time = self._last_mouse_down_time
- this_time = event.time
- num_clicks = self._click_count
- if this_time - last_time <= 0.25:
- num_clicks += 1
- else:
- num_clicks = 1
- event.num_clicks = num_clicks
- self._click_count = num_clicks
- self._last_mouse_down_time = this_time
- #print "Component._gtk_button_press_event_signal:" ###
- #print event ###
- return self._event_custom_handled(event)
-
- def _gtk_motion_notify_event_signal(self, gtk_event):
- event = Event._from_gtk_mouse_event(gtk_event)
- self._mouse_event = event
- return self._event_custom_handled(event)
-
- def _gtk_button_release_event_signal(self, gtk_event):
- event = Event._from_gtk_mouse_event(gtk_event)
- self._mouse_event = event
- return self._event_custom_handled(event)
-
- def _gtk_enter_leave_event_signal(self, gtk_event):
- #print "Component._gtk_enter_leave_event_signal:" ###
- event = Event._from_gtk_mouse_event(gtk_event)
- return self._event_custom_handled(event)
-
- def _handle_gtk_key_event(self, gtk_event):
- """Convert a Gtk key-press or key-release event into an Event
- object and pass it up the message path."""
- #print "Component._handle_gtk_key_event for", self ###
- global _gtk_last_keyval_down
- if Event._gtk_key_event_of_interest(gtk_event):
- event = Event._from_gtk_key_event(gtk_event)
- if event.kind == 'key_down':
- this_keyval = gtk_event.keyval
- if _gtk_last_keyval_down == this_keyval:
- event.auto = 1
- _gtk_last_keyval_down = this_keyval
- else:
- _gtk_last_keyval_down = None
- #if event.kind == 'key_down': ###
- # print event ###
- return self._event_custom_handled(event)
-
-#------------------------------------------------------------------------------
-
-def _gtk_exception_in_signal_handler():
- print >>sys.stderr, "---------- Exception in gtk signal handler ----------"
- traceback.print_exc()
-
-export(Component)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Container.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Container.py
deleted file mode 100644
index eac37ed..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Container.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Containers - Gtk version
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.Geometry import inset_rect
-from GUI.GContainers import Container as GContainer
-
-class Container(GContainer):
- # Subclasses must set the inner widget to be a Fixed or Layout
- # widget.
-
- def _add(self, comp):
- GContainer._add(self, comp)
- x, y = comp._position
- self._gtk_inner_widget.put(comp._gtk_outer_widget, int(x), int(y))
-
- def _remove(self, comp):
- self._gtk_inner_widget.remove(comp._gtk_outer_widget)
- GContainer._remove(self, comp)
-
-export(Container)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Control.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Control.py
deleted file mode 100644
index 7d1a2f3..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Control.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Python GUI - Controls - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.Enumerations import EnumMap
-from GUI import Color
-from GUI import Font
-from GUI.GControls import Control as GControl
-
-_justs = ['left', 'center', 'right']
-
-_just_to_gtk_alignment = EnumMap("justification",
- left = (0.0, gtk.JUSTIFY_LEFT),
- centre = (0.5, gtk.JUSTIFY_CENTER),
- center = (0.5, gtk.JUSTIFY_CENTER),
- right = (1.0, gtk.JUSTIFY_RIGHT),
-)
-
-class Control(GControl):
- # A component which encapsulates a Gtk control widget.
-
- _font = None
-
- def __init__(self, _gtk_outer = None, _gtk_title = None, **kwds):
- self._gtk_title_widget = _gtk_title or _gtk_outer
- GControl.__init__(self, _gtk_outer = _gtk_outer,
- _gtk_focus = kwds.pop('_gtk_focus', _gtk_outer),
- **kwds)
-
- def get_title(self):
- return self._gtk_title_widget.get_label()
-
- def set_title(self, v):
- self._gtk_title_widget.set_label(v)
-
- def get_enabled(self):
- #return self._gtk_outer_widget.get_sensitive()
- return self._gtk_outer_widget.get_property('sensitive')
-
- def set_enabled(self, v):
- self._gtk_outer_widget.set_sensitive(v)
-
- def get_color(self):
- gdk_color = self._gtk_title_widget.style.fg[gtk.STATE_NORMAL]
- return Color._from_gdk_color(gdk_color)
-
- def set_color(self, v):
- self._gtk_title_widget.modify_fg(gtk.STATE_NORMAL, v._gdk_color)
-
- def get_font(self):
- font = self._font
- if not font:
- font = Font._from_pango_description(self._gtk_title_widget.style.font_desc)
- return font
-
- def set_font(self, f):
- self._font = f
- gtk_title = self._gtk_title_widget
- gtk_title.modify_font(f._pango_description)
- gtk_title.queue_resize()
-
- def get_just(self):
- h = self._gtk_get_alignment()
- return _justs[int(round(2.0 * h))]
-
- def set_just(self, v):
- fraction, just = _just_to_gtk_alignment[v]
- self._gtk_set_alignment(fraction, just)
-
- def set_lines(self, num_lines):
- line_height = self.font.text_size("X")[1]
- #print "Control.set_lines: line_height =", line_height ###
- self.height = num_lines * line_height + self._vertical_padding
-
- def _gtk_get_alignment(self):
- raise NotImplementedError
-
- def _gtk_set_alignment(self, h):
- raise NotImplementedError
-
-export(Control)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Cursor.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Cursor.py
deleted file mode 100644
index cfee65f..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Cursor.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# Python GUI - Cursors - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GCursors import Cursor as GCursor
-
-class Cursor(GCursor):
- #
- # _gtk_cursor gtk.gdk.Cursor
-
- def _from_gtk_std_cursor(cls, id):
- cursor = cls.__new__(cls)
- cursor._gtk_cursor = gdk.Cursor(id)
- return cursor
-
- _from_gtk_std_cursor = classmethod(_from_gtk_std_cursor)
-
- def _from_nothing(cls):
- cursor = cls.__new__(cls)
- pixmap = gdk.Pixmap(None, 1, 1, 1)
- color = gdk.Color()
- cursor._gtk_cursor = gdk.Cursor(pixmap, pixmap, color, color, 0, 0)
- return cursor
-
- _from_nothing = classmethod(_from_nothing)
-
- def _init_from_image_and_hotspot(self, image, hotspot):
- #print "Cursor._init_from_image_and_hotspot:", image, hotspot ###
- x, y = hotspot
- gdk_display = gdk.display_get_default()
- self._gtk_cursor = gdk.Cursor(gdk_display, image._gdk_pixbuf, x, y)
-
-export(Cursor)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Dialog.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Dialog.py
deleted file mode 100644
index 46ea57d..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Dialog.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# Python GUI - Dialogs - Gtk
-#
-
-from GUI import export
-from GUI.GDialogs import Dialog as GDialog
-
-class Dialog(GDialog):
-
- _default_keys = ['\r']
- _cancel_keys = ['\x1b']
-
-export(Dialog)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Document.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Document.py
deleted file mode 100644
index 1ff797c..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Document.py
+++ /dev/null
@@ -1,321 +0,0 @@
-#
-# Python GUI - Documents - Generic
-#
-
-import os, tempfile
-from GUI import export
-from GUI.Alerts import confirm, confirm_or_cancel
-from GUI.Properties import overridable_property
-from GUI import Model
-from GUI import MessageHandler
-from GUI.Files import FileRef, DirRef
-from GUI.FileDialogs import request_new_file
-from GUI import application
-from GUI.Exceptions import Cancel, UnimplementedMethod, ApplicationError
-from GUI.Printing import PageSetup, present_page_setup_dialog
-
-_next_doc_number = 1 # Counter for generating default titles
-
-class Document(Model, MessageHandler):
- """A Document represents an
- application data structure that can be stored in a file. It
- implements the standard parts of asking the user for file names and
- reading and writing files.
-
- Each Document can have one or more windows associated with it. When
- the last window belonging to a document is closed, the document itself
- is closed.
-
- A Document provides support for keeping track of whether it has been
- edited, and asking the user whether to save changes when it is
- closed."""
-
- # The following attribute prevents a Document that is the parent
- # of a Model from being pickled along with that Model.
- pickle_as_parent_model = False
-
- needs_saving = overridable_property('needs_saving',
- "True if the document has been edited and needs to be saved.")
-
- file = overridable_property('file',
- """FileRef of the file that the document was read from or last written
- to, or None. Changing this causes update_title to be called.""")
-
- file_type = overridable_property('file_type',
- """FileType specifying the type of file handled by this document.""")
-
- title = overridable_property('title',
- """The title of the document. Changing this causes update_title of each
- associated window to be called.""")
-
- windows = overridable_property('windows',
- "List of windows associated with the document. Do not modify directly.")
-
- page_setup = overridable_property('page_setup',
- "The PageSetup to be used for printing this document.")
-
- binary = True # True if files are to be opened in binary mode
-
- _file_type = None # Type of file to create when saving
- _needs_saving = 0 # True if has been edited
- _file = None # FileRef of associated file, if any
- _title = None # Title for use in window banners, etc.
- _windows = None # List of associated windows
- _page_setup = None # Document-specific PageSetup instance
-
- #
- # Initialisation and destruction
- #
-
- def __init__(self, **kwds):
- self._windows = []
- Model.__init__(self, **kwds)
- application()._add_document(self)
-
- def destroy(self):
- """Destroy any associated windows, then destroy document contents."""
- #print "Document.destroy:", self ###
- for win in self._windows[:]:
- win.destroy()
- application()._remove_document(self)
- self.destroy_contents()
- Model.destroy(self)
-
- #
- # Properties
- #
-
- def get_needs_saving(self):
- return self._needs_saving
-
- def set_needs_saving(self, x):
- if self._needs_saving <> x:
- self._needs_saving = x
- for window in self._windows:
- window._document_needs_saving(x)
-
- def get_file(self):
- return self._file
-
- def set_file(self, x):
- self._file = x
- if x is not None:
- application()._last_directory = x.dir
- self.update_title()
-
- def get_file_type(self):
- return self._file_type
-
- def set_file_type(self, x):
- self._file_type = x
-
- def get_title(self):
- t = self._title
- if t == None:
- t = self.make_title()
- self._title = t
- return t
-
- def set_title(self, x):
- self._title = x
- for win in self._windows:
- win.update_title()
-
- def get_windows(self):
- return self._windows
-
- def get_page_setup(self):
- ps = self._page_setup
- if not ps:
- ps = PageSetup()
- self._page_setup = ps
- return ps
-
- def set_page_setup(self, ps):
- self._page_setup = ps
-
- #
- # Methods
- #
-
- def changed(self):
- "Set the needs_saving property to true."
- self.needs_saving = 1
-
- def new_contents(self):
- """Should initialise the document to the appropriate state following a New
- command."""
- pass
-
- def read_contents(self, file):
- """Should initialise the document's contents by reading it from the given
- file object."""
- raise UnimplementedMethod(self, 'read_contents')
-
- def write_contents(self, file):
- """Should write the document's contents to the given file object."""
- raise UnimplementedMethod(self, 'write_contents')
-
- def destroy_contents(self):
- """Called when the contents of the document are about to be discarded.
- If the contents contains any Model objects, they should be destroyed."""
-
- def save_changes(self):
- """If the document has been edited, ask the user whether to save changes,
- and do so if requested."""
- if self._needs_saving:
- result = confirm_or_cancel('Save changes to "%s"?' % self.title,
- "Save", "Don't Save", "Cancel")
- if result < 0:
- raise Cancel
- if result:
- self.save_cmd()
-
- def save_cmd(self):
- """Implements the standard Save command. Writes the document to its
- associated file, asking the user for one first if necessary."""
- if self._file == None:
- self.get_new_file_name()
- try:
- self.write()
- except EnvironmentError, e:
- raise ApplicationError("Unable to save '%s'." % self._file.name, e)
-
- def save_as_cmd(self):
- """Implements the standard Save As... command. Asks the user for a new file
- and writes the document to it."""
- self.get_new_file_name()
- self.save_cmd()
-
- def revert_cmd(self):
- """Implements the standard Revert command. Discards the current contents
- of the document and re-reads it from the associated file."""
- if self._file != None:
- if confirm(
- 'Revert to the last saved version of "%s"?' % self.title,
- "Revert", "Cancel"):
- self.destroy_contents()
- self.read()
-
- def close_cmd(self):
- """Implements the standard Close command. Asks whether to save any
- changes, then destroys the document."""
- self.save_changes()
- self.destroy()
-
- def page_setup_cmd(self):
- if present_page_setup_dialog(self.page_setup):
- self.changed()
-
- def make_title(self):
- """Generates a title for the document. If associated with a file,
- uses its last pathname component, else generates 'Untitled-n'."""
- global _next_doc_number
- if self._file != None:
- return os.path.basename(self._file)
- else:
- n = _next_doc_number
- _next_doc_number = n + 1
- return "Untitled-%d" % n
-
- def update_title(self):
- """Called when the file property changes, to update the
- title property appropriately."""
- file = self._file
- if file:
- self.title = file.name
-
- def get_default_save_directory(self):
- """Called when the user is about to be asked for a location in which
- to save a document that has not been saved before, to find a default
- directory for request_new_file(). Should return a DirRef or FileRef,
- or None if there is no particular preferred location."""
- return None
-
- def get_default_save_filename(self):
- """Called when the user is about to be asked for a location in which
- to save a document that has not been saved before, to find a default
- file name for request_new_file(). Should return a suggested file name,
- or an empty string to require the user to enter a file name."""
- return ""
-
- #
- # Internal methods
- #
-
- def get_new_file_name(self):
- """Ask the user for a new file and associate the document with it."""
- old_file = self.file
- if old_file:
- old_name = old_file.name
- old_dir = old_file.dir
- else:
- old_name = self.get_default_save_filename()
- old_dir = self.get_default_save_directory()
- #print "Document.get_new_file_name: old_dir =", old_dir, "old_name =", old_name ###
- new_file = request_new_file(
- #'Save "%s" as:' % self.title,
- default_dir = old_dir,
- default_name = old_name,
- file_type = self.file_type or application().save_file_type)
- if new_file is None:
- raise Cancel()
- self.file = new_file
-
- def read(self):
- """Read the document from its currently associated file. The
- document must be associated with a file and not have any existing
- contents when this is called."""
- if self.binary:
- mode = "rb"
- else:
- mode = "rU"
- file = self.file.open(mode)
- try:
- self.read_contents(file)
- finally:
- file.close()
- self.needs_saving = 0
-
- def write(self):
- """Write the document to its currently associated file. The
- document must be associated with a file when this is called.
- The document is initially written to a temporary file which
- is then renamed, so if writing fails part way through, the
- original file is undisturbed."""
- if self.binary:
- mode = "wb"
- else:
- mode = "w"
- dir_path = self.file.dir.path
- fd, temp_path = tempfile.mkstemp(dir = dir_path, text = not self.binary)
- file = os.fdopen(fd, mode)
- try:
- try:
- self.write_contents(file)
- finally:
- file.close()
- except EnvironmentError:
- os.unlink(fd)
- raise
- path = self.file.path
- try:
- os.unlink(path)
- except EnvironmentError:
- pass
- os.rename(temp_path, path)
- self.needs_saving = 0
-
- def setup_menus(self, m):
- #print "Document.setup_menus" ###
- if self._needs_saving or not self._file:
- m.save_cmd.enabled = 1
- if self._needs_saving and self._file:
- m.revert_cmd.enabled = 1
- m.save_as_cmd.enabled = 1
- m.page_setup_cmd.enabled = 1
-
- def next_handler(self):
- return application()
-
-export(Document)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/DrawableContainer.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/DrawableContainer.py
deleted file mode 100644
index ca9893b..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/DrawableContainer.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# Python GUI - DrawableViews - Gtk
-#
-
-import os, traceback
-from math import floor, ceil
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI import Canvas, Event, rgb
-from GUI.StdColors import grey
-from GUI.GDrawableContainers import DrawableContainer as GDrawableContainer
-
-class DrawableContainer(GDrawableContainer):
-
- _background_color = grey
-
- def __init__(self, _gtk_outer = None, **kwds):
- gtk_layout = gtk.Layout()
- gtk_layout.add_events(gdk.EXPOSURE_MASK)
- gtk_layout.show()
- self._gtk_connect(gtk_layout, 'expose-event',
- self._gtk_expose_event_signal)
- if _gtk_outer:
- _gtk_outer.add(gtk_layout)
- else:
- _gtk_outer = gtk_layout
- GDrawableContainer.__init__(self, _gtk_outer = _gtk_outer, _gtk_inner = gtk_layout,
- _gtk_focus = gtk_layout, _gtk_input = gtk_layout)
- self.set(**kwds)
-
- #
- # Other methods
- #
-
- def with_canvas(self, proc):
- hadj, vadj = self._gtk_adjustments()
- clip = rect_sized((hadj.value, vadj.value), self.size)
- canvas = Canvas._from_gdk_drawable(self._gtk_inner_widget.bin_window)
- proc(canvas)
-
- def invalidate_rect(self, (l, t, r, b)):
- gdk_window = self._gtk_inner_widget.bin_window
- if gdk_window:
- gdk_rect = (int(floor(l)), int(floor(t)),
- int(ceil(r - l)), int(ceil(b - t)))
- #print "View.invalidate_rect: gdk_rect =", gdk_rect ###
- gdk_window.invalidate_rect(gdk_rect, 0)
-
- def update(self):
- gdk_window = self._gtk_inner_widget.bin_window
- gdk_window.process_updates()
-
- #
- # Internal
- #
-
- def _gtk_expose_event_signal(self, gtk_event):
- try:
- #print "View._gtk_expose_event_signal:", self ###
- l, t, w, h = gtk_event.area
- clip = (l, t, l + w, t + h)
- #print "...clip =", clip ###
- gtk_layout = self._gtk_inner_widget
- canvas = Canvas._from_gdk_drawable(gtk_layout.bin_window)
- update = self._draw_background(canvas, clip)
- self.draw(canvas, update)
- except:
- print "------------------ Exception while drawing ------------------"
- traceback.print_exc()
-
-export(DrawableContainer)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/EditCmdHandler.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/EditCmdHandler.py
deleted file mode 100644
index d068331..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/EditCmdHandler.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# PyGUI - Edit command handling - Gtk
-#
-
-from GUI import export
-from GUI.GEditCmdHandlers import EditCmdHandler
-
-export(EditCmdHandler)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Enumerations.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Enumerations.py
deleted file mode 100644
index 310168f..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Enumerations.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# PyGUI - Enumerated type facilities
-#
-
-class EnumMap(dict):
-
- def __init__(self, __name__, *args, **kwds):
- self.name = __name__
- dict.__init__(self, *args, **kwds)
-
- def __getitem__(self, key):
- try:
- return dict.__getitem__(self, key)
- except KeyError:
- raise ValueError("Invalid %s '%s', should be one of %s" %
- (self.name, key, ", ".join(["'%s'" % val for val in self.keys()])))
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Event.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Event.py
deleted file mode 100644
index bbbf74e..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Event.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#
-# Python GUI - Events - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GEvents import Event as GEvent
-
-_gdk_button_mask = (
- gdk.BUTTON1_MASK |
- gdk.BUTTON2_MASK |
- gdk.BUTTON3_MASK |
- gdk.BUTTON4_MASK |
- gdk.BUTTON5_MASK
-)
-
-_gdk_event_type_to_kind = {
- gdk.BUTTON_PRESS: 'mouse_down',
- gdk._2BUTTON_PRESS: 'mouse_down',
- gdk._3BUTTON_PRESS: 'mouse_down',
- gdk.MOTION_NOTIFY: 'mouse_move',
- gdk.BUTTON_RELEASE: 'mouse_up',
- gdk.KEY_PRESS: 'key_down',
- gdk.KEY_RELEASE: 'key_up',
- gdk.ENTER_NOTIFY: 'mouse_enter',
- gdk.LEAVE_NOTIFY: 'mouse_leave',
-}
-
-_gtk_button_to_button = {
- 1: 'left',
- 2: 'middle',
- 3: 'right',
- 4: 'fourth',
- 5: 'fifth',
-}
-
-_gdk_keyval_to_keyname = {
- 0xFF50: 'home',
- 0xFF51: 'left_arrow',
- 0xFF52: 'up_arrow',
- 0xFF53: 'right_arrow',
- 0xFF54: 'down_arrow',
- 0xFF55: 'page_up',
- 0xFF56: 'page_down',
- 0xFF57: 'end',
- #0xFF6A: 'help',
- 0xFF6A: 'insert',
- 0xFF0D: 'return',
- 0xFF8D: 'enter',
- 0xFFBE: 'f1',
- 0xFFBF: 'f2',
- 0xFFC0: 'f3',
- 0xFFC1: 'f4',
- 0xFFC2: 'f5',
- 0xFFC3: 'f6',
- 0xFFC4: 'f7',
- 0xFFC5: 'f8',
- 0xFFC6: 'f9',
- 0xFFC7: 'f10',
- 0xFFC8: 'f11',
- 0xFFC9: 'f12',
- 0xFFCA: 'f13',
- 0xFFCB: 'f14',
- 0xFFCC: 'f15',
- 0xFFFF: 'delete',
-}
-
-class Event(GEvent):
- """Platform-dependent modifiers (boolean):
- mod1 The X11 MOD1 key.
- """
-
- button = None
- position = None
- global_position = None
- num_clicks = 0
- char = None
- key = None
- auto = 0
-
- def _gtk_key_event_of_interest(gtk_event):
- keyval = gtk_event.keyval
- return (keyval <= 0xFF
- or 0xFF00 <= keyval <= 0xFF1F
- or 0xFF80 <= keyval <= 0xFFBD
- or keyval == 0xFE20 # shift-tab
- or keyval == 0xFFFF
- or keyval in _gdk_keyval_to_keyname)
-
- _gtk_key_event_of_interest = staticmethod(_gtk_key_event_of_interest)
-
- def _from_gtk_key_event(cls, gtk_event):
- event = cls.__new__(cls)
- event._set_from_gtk_event(gtk_event)
- keyval = gtk_event.keyval
- event._keycode = keyval
- #print "Event._from_gtk_key_event: keyval = 0x%04X" % keyval ###
- key = _gdk_keyval_to_keyname.get(keyval, "")
- if keyval == 0xFFFF: # GDK_Delete
- char = "\x7F"
- elif keyval == 0xFF8D:
- char = "\r"
- elif keyval == 0xFE20: # shift-tab
- char = "\t"
- elif keyval <= 0xFF1F:
- if event.control:
- char = chr(keyval & 0x1F)
- else:
- char = chr(keyval & 0x7F)
- else:
- char = ""
- if not key and "\x20" <= char <= "\x7e":
- key = char
- event.char = char
- event.key = key
- event.unichars = unicode(char)
- return event
-
- _from_gtk_key_event = classmethod(_from_gtk_key_event)
-
- def _from_gtk_mouse_event(cls, gtk_event):
- event = cls.__new__(cls)
- event._set_from_gtk_event(gtk_event)
- if event.kind in ('mouse_down', 'mouse_up'):
- event.button = _gtk_button_to_button[gtk_event.button]
- event.position = (gtk_event.x, gtk_event.y)
- event.global_position = (gtk_event.x_root, gtk_event.y_root)
- return event
-
- _from_gtk_mouse_event = classmethod(_from_gtk_mouse_event)
-
- def _set_from_gtk_event(self, gtk_event):
- typ = gtk_event.type
- state = gtk_event.state
- if typ == gdk.MOTION_NOTIFY and state & _gdk_button_mask:
- self.kind = 'mouse_drag'
- else:
- self.kind = _gdk_event_type_to_kind[gtk_event.type]
- self.time = gtk_event.time / 1000.0
- self.shift = self.extend_contig = (state & gdk.SHIFT_MASK) <> 0
- self.control = self.extend_noncontig = (state & gdk.CONTROL_MASK) <> 0
- self.option = self.mod1 = (state & gdk.MOD1_MASK) <> 0
-
- def _platform_modifiers_str(self):
- return " mod1:%s" % (self.mod1)
-
-export(Event)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Exceptions.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Exceptions.py
deleted file mode 100644
index 470a80d..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Exceptions.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Exceptions.py - GUI exception classes
-#
-
-class Cancel(Exception):
- """Exception raised when user cancels an operation."""
- pass
-
-
-#class Quit(Exception):
-# """Exception raised to exit the main event loop."""
-# pass
-
-
-class Error(StandardError):
-
- def __init__(self, obj, mess):
- self.obj = obj
- self.mess = mess
- Exception.__init__(self, "%s: %s" % (obj, mess))
-
-
-class ApplicationError(StandardError):
- """Exception used for reporting errors to the user."""
-
- def __init__(self, message, detail = None):
- self.message = message
- self.detail = detail
- if detail:
- message = "%s\n\n%s" % (message, detail)
- StandardError.__init__(self, message)
-
-
-class InternalError(Exception):
- pass
-
-
-class UnimplementedMethod(NotImplementedError):
-
- def __init__(self, obj, meth_name):
- self.obj = obj
- StandardError.__init__(self, "%s.%s not implemented" % \
- (obj.__class__.__name__, meth_name))
-
-
-class ArgumentError(TypeError):
-
- def __init__(self, obj, meth_name, arg_name, value):
- self.obj = obj
- self.meth_name = meth_name
- self.arg_name = arg_name
- self.value = value
- TypeError.__init__(self,
- "%s: Invalid value %s for argument %s of method %s",
- (obj, value, arg_name, meth_name))
-
-
-class SetAttributeError(AttributeError):
-
- def __init__(self, obj, attr):
- self.obj = obj
- self.attr = attr
- AttributeError.__init__(self, "Attribute '%s' of %s cannot be set" % (attr, obj))
-
-
-class UsageError(StandardError):
- pass
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/FileDialogs.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/FileDialogs.py
deleted file mode 100644
index ced310a..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/FileDialogs.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - File selection dialogs - Generic
-#
-
-from GUI.BaseFileDialogs import _request_old, _request_new
-
-
-def request_old_file(prompt = "Open File", default_dir = None, file_types = None):
- """Present a dialog for selecting an existing file.
- Returns a FileRef, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types,
- dir = False, multiple = False)
-
-
-def request_old_files(prompt = "Choose Files", default_dir = None, file_types = None):
- """Present a dialog for selecting a set of existing files.
- Returns a list of FileRefs, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types,
- dir = False, multiple = True)
-
-
-def request_old_directory(prompt = "Choose Folder", default_dir = None):
- """Present a dialog for selecting an existing directory.
- Returns a FileRef, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types = None,
- dir = True, multiple = False)
-
-
-def request_old_directories(prompt = "Choose Folders", default_dir = None,
- multiple = False):
- """Present a dialog for selecting a set of existing directories.
- Returns a list of FileRefs, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types = None,
- dir = True, multiple = True)
-
-
-def request_new_file(prompt = "Save As:", default_dir = None,
- default_name = "", file_type = None):
- """Present a dialog requesting a name and location for a new file.
- Returns a FileRef, or None if cancelled."""
-
- return _request_new(prompt, default_dir, default_name, file_type,
- dir = False)
-
-
-def request_new_directory(prompt = "Create Folder:", default_dir = None,
- default_name = ""):
- """Present a dialog requesting a name and location for a new directory.
- Returns a FileRef, or None if cancelled."""
-
- return _request_new(prompt, default_dir, default_name, file_type = None,
- dir = True)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Files.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Files.py
deleted file mode 100644
index 2807408..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Files.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - File references and types - Gtk
-#
-
-from GUI.GFiles import *
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Font.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Font.py
deleted file mode 100644
index e9c3f7d..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Font.py
+++ /dev/null
@@ -1,155 +0,0 @@
-#
-# Python GUI - Fonts - Gtk
-#
-
-from __future__ import division
-
-import sys
-import pango, gtk
-from gtk import gdk
-from GUI import export
-from GUI.GFonts import Font as GFont
-
-class Font(GFont):
-
- #_gdk_font = None
- _pango_font = None
- _pango_metrics = None
- _pango_layout = None
-
-# def _from_gdk_font(cls, gdk_font):
-# font = cls.__new__(cls)
-# font._gdk_font = gdk_font
-# return font
-#
-# _from_gdk_font = classmethod(_from_gdk_font)
-
- def _from_pango_description(cls, pango_description):
- font = cls.__new__(cls)
- font._pango_description = pango_description
- return font
-
- _from_pango_description = classmethod(_from_pango_description)
-
- def __init__(self, family, size = 12, style = []):
- if 'italic' in style:
- pango_style = pango.STYLE_ITALIC
- else:
- pango_style = pango.STYLE_NORMAL
- if 'bold' in style:
- pango_weight = pango.WEIGHT_BOLD
- else:
- pango_weight = pango.WEIGHT_NORMAL
- jigger = _find_size_correction_factor(family, pango_style, pango_weight)
- pfd = pango.FontDescription()
- pfd.set_family(family)
- pfd.set_size(int(round(jigger * size * pango.SCALE)))
- pfd.set_style(pango_style)
- pfd.set_weight(pango_weight)
- self._pango_description = pfd
-
- def get_family(self):
- return self._pango_description.get_family()
-
- def get_size(self):
- return self._pango_description.get_size() / pango.SCALE
-
- def get_style(self):
- style = []
- pfd = self._pango_description
- if pfd.get_weight() > pango.WEIGHT_NORMAL:
- style.append('bold')
- if pfd.get_style() <> pango.STYLE_NORMAL:
- style.append('italic')
- return style
-
- def get_ascent(self):
- self._get_pango_metrics()
- result = self._ascent
- return result
-
- def get_descent(self):
- self._get_pango_metrics()
- return self._descent
-
- def get_height(self):
- self._get_pango_metrics()
- return self._ascent + self._descent
-
- def get_line_height(self):
- return self.get_height()
-
- def _get_pango_metrics(self):
- #print "Font._get_pango_metrics: enter" ###
- pfm = self._pango_metrics
- if not pfm:
- pf = self._get_pango_font()
- pfm = pf.get_metrics()
- self._pango_metrics = pfm
- self._ascent = pfm.get_ascent() / pango.SCALE
- self._descent = pfm.get_descent() / pango.SCALE
- return pfm
-
- def _get_pango_font(self):
- pf = self._pango_font
- if not pf:
- pf = _pango_context.load_font(self._pango_description)
- if not pf:
- raise ValueError("Unable to load Pango font for %s" % self)
- self._pango_font = pf
- return pf
-
- def width(self, s, start = 0, end = sys.maxint):
- layout = self._get_pango_layout(s[start:end], True)
- return layout.get_pixel_size()[0]
-
- def text_size(self, text):
- layout = self._get_pango_layout(text, False)
- return layout.get_pixel_size()
- #w, h = layout.get_size()
- #u = pango.SCALE
- #return (w / u, h / u)
-
- def x_to_pos(self, s, x):
- layout = self._get_pango_layout(s, True)
- return pango_layout.xy_to_index(x, 0)
-
- def _get_pango_layout(self, text, single_paragraph_mode):
- layout = self._pango_layout
- if not layout:
- layout = pango.Layout(_pango_context)
- layout.set_font_description(self._pango_description)
- self._pango_layout = layout
- layout.set_single_paragraph_mode(single_paragraph_mode)
- layout.set_text(text)
- return layout
-
-
-_pango_context = gtk.Label().create_pango_context()
-
-_jigger_cache = {}
-
-def _find_size_correction_factor(family, pango_style, pango_weight):
- # Unlike the rest of the world, Pango seems to consider the point
- # size of a font to only include the ascent. So we first ask for
- # a 1-point font, find the ratio of its ascent to its descent,
- # and use that to adjust the size requested by the user.
- key = (family, pango_style, pango_weight)
- result = _jigger_cache.get(key)
- if result is None:
- pd = pango.FontDescription()
- pd.set_family(family)
- pd.set_size(pango.SCALE)
- pd.set_style(pango_style)
- pd.set_weight(pango_weight)
- pf = _pango_context.load_font(pd)
- pm = pf.get_metrics()
- a = pm.get_ascent()
- d = pm.get_descent()
- result = a / (a + d)
- #print "Jigger factor for font:", family, pango_style, pango_weight ###
- #print "ascent =", a, "descent =", d, "factor =", result ###
- _jigger_cache[key] = result
- return result
-
-export(Font)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Frame.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Frame.py
deleted file mode 100644
index 2723a15..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Frame.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# Python GUI - Frames - Gtk
-#
-
-from gtk import Fixed
-from GUI import export
-from GUI.GFrames import Frame as GFrame
-
-class Frame(GFrame):
-
- def __init__(self, **kwds):
- gtk_widget = Fixed()
- gtk_widget.show()
- GFrame.__init__(self, _gtk_outer = gtk_widget)
-
-export(Frame)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GAlertClasses.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GAlertClasses.py
deleted file mode 100644
index d8eba49..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GAlertClasses.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Python GUI - Alerts - Generic
-#
-
-from GUI import BaseAlert
-from GUI import Button
-from GUI.StdButtons import DefaultButton, CancelButton
-
-
-class Alert(BaseAlert):
-
- def __init__(self, kind, prompt,
- ok_label = "OK", default = 1, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [ok_label], default = default, **kwds)
-
- def _create_buttons(self, ok_label):
- self.yes_button = DefaultButton(title = ok_label, action = self.yes)
- #self.default_button = self.ok_button
-
- def _layout_buttons(self):
- self.place(self.yes_button,
- right = self.label.right,
- top = self.label + self._label_button_spacing)
-
-
-class Alert2(BaseAlert):
-
- def __init__(self, kind, prompt,
- yes_label = "Yes", no_label = "No",
- default = 1, cancel = 0, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [yes_label, no_label],
- default = default, cancel = cancel, **kwds)
-
- def _create_buttons(self, yes_label, no_label):
- self.yes_button = DefaultButton(title = yes_label, action = self.yes)
- self.no_button = CancelButton(title = no_label, action = self.no)
-
- def _layout_buttons(self):
- self.place_row([self.no_button, self.yes_button],
- right = self.label.right,
- top = self.label + self._label_button_spacing)
-
-
-class Alert3(BaseAlert):
-
- _minimum_width = 300
-
- def __init__(self, kind, prompt,
- yes_label = "Yes", no_label = "No", other_label = "Cancel",
- default = 1, cancel = -1, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [yes_label, no_label, other_label],
- default = default, cancel = cancel, **kwds)
-
- def _create_buttons(self, yes_label, no_label, cancel_label):
- self.yes_button = DefaultButton(title = yes_label, action = self.yes)
- self.no_button = CancelButton(title = no_label, action = self.no)
- self.other_button = Button(title = cancel_label, action = self.other)
-
- def _layout_buttons(self):
- self.place_row([self.other_button, self.yes_button],
- right = self.label.right,
- top = self.label + self._label_button_spacing)
- self.place(self.no_button,
- left = self._left_margin, top = self.label + self._label_button_spacing)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GApplications.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GApplications.py
deleted file mode 100644
index fa7b2d6..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GApplications.py
+++ /dev/null
@@ -1,547 +0,0 @@
-#
-# Python GUI - Application class - Generic
-#
-
-import os, sys, traceback
-from GUI import Globals
-from GUI.Properties import Properties, overridable_property
-from GUI import MessageHandler
-from GUI.Exceptions import Cancel, UnimplementedMethod, UsageError, \
- ApplicationError #, Quit
-from GUI.StdMenus import basic_menus
-from GUI.GMenus import MenuState
-from GUI.Files import FileRef
-from GUI.Printing import PageSetup, present_page_setup_dialog
-
-class Application(Properties, MessageHandler):
- """The user should create exactly one Application object,
- or subclass thereof. It implements the main event loop
- and other application-wide behaviour."""
-
- _windows = None # List of all existing Windows
- _documents = None # List of all existing Documents
- _menus = None # Menus to appear in all Windows
- _clipboard = None
- _save_file_type = None
- _exit_event_loop_flag = False
- _last_directory = None
-
- windows = overridable_property('windows',
- """A list of all existing Windows.""")
-
- documents = overridable_property('documents',
- """A list of all existing documents.""")
-
- menus = overridable_property('menus',
- """A list of Menus that are to be available from all Windows.""")
-
- open_file_types = overridable_property('open_file_types',
- """List of FileTypes openable by the default Open... command.""")
-
- save_file_type = overridable_property('save_file_type',
- """Default FileType for Documents that do not specify their own.""")
-
- file_type = overridable_property('file_type',
- """Write only. Sets open_file_types and save_file_type.""")
-
- target = overridable_property('target',
- """Current target for key events and menu messages.""")
-
- target_window = overridable_property('target_window',
- """Window containing the current target, or None if there are no windows.""")
-
- page_setup = overridable_property('page_setup',
- """Default PageSetup instance.""")
-
- def __init__(self, title = None):
- if Globals._application is not None:
- raise UsageError("More than one Application instance created")
- if title:
- Globals.application_name = title
- self._open_file_types = []
- self._windows = []
- self._documents = []
- self._update_list = []
- self._idle_tasks = []
- self._page_setup = None
- Globals._application = self
- self._quit_flag = False
-
- def destroy(self):
- Globals._application = None
-
- #
- # Constants
- #
-
-# def get_std_menus(self):
-# """Returns a list of Menus containing the standard
-# framework-defined menu commands in their standard
-# positions."""
-# return basic_menus()
-#
-# std_menus = property(get_std_menus)
-
- #
- # Properties
- #
-
- def get_windows(self):
- return self._windows
-
- def get_documents(self):
- return self._documents
-
- def get_menus(self):
- menus = self._menus
- if menus is None:
- menus = []
- return menus
-
- def set_menus(self, menus):
- self._menus = menus
-
- def get_open_file_types(self):
- return self._open_file_types
-
- def set_open_file_types(self, x):
- self._open_file_types = x
-
- def get_save_file_type(self):
- return self._save_file_type
-
- def set_save_file_type(self, x):
- self._save_file_type = x
-
- def set_file_type(self, x):
- self._open_file_types = [x]
- self._save_file_type = x
-
- def get_page_setup(self):
- # This property is initialised lazily, because on Windows it turn out
- # that calling PageSetupDlg() before the application's first window is
- # created causes the app not to be brought to the foreground initially.
- ps = self._page_setup
- if not ps:
- ps = PageSetup()
- self._page_setup = ps
- return ps
-
- def set_page_setup(self, x):
- self._page_setup = x
-
- #
- # Event loop
- #
-
- def run(self):
- """The main event loop. Runs until _quit() is called, or
- KeyboardInterrupt or SystemExit is raised."""
- # Implementations may override this together with _quit() to use
- # a different means of causing the main event loop to exit.
- self.process_args(sys.argv[1:])
- if self._menus is None:
- self.menus = basic_menus()
- while not self._quit_flag:
- try:
- self.event_loop()
- #except (KeyboardInterrupt, Quit), e:
- except KeyboardInterrupt:
- return
- except SystemExit:
- raise
- except:
- self.report_error()
-
- def _quit(self):
- # Causes the main event loop to exit.
- self._quit_flag = True
- self._exit_event_loop()
-
- def event_loop(self):
- """Loop reading and handling events until exit_event_loop() is called."""
- # Implementations may override this together with exit_event_loop() to
- # implement non-modal event loops in a different way.
- self._event_loop(None)
-
- def _event_loop(self, modal_window):
- # Generic modal and non-modal event loop.
- # Loop reading and handling events for the given window, or for all
- # windows if window is None, until exit_event_loop() is called.
- # Enabled application-wide menu items should be selectable in any case.
- # If an exception other than Cancel is raised, it should either be
- # reported using report_error() or propagated. Implementations may
- # override this together with _exit_event_loop() if handling events
- # individually is not desirable.
- save = self._exit_event_loop_flag
- self._exit_event_loop_flag = False
- try:
- while not self._exit_event_loop_flag:
- try:
- self.handle_next_event(modal_window)
- except Cancel:
- pass
- finally:
- self._exit_event_loop_flag = save
-
- def exit_event_loop(self):
- """Cause the current call to event_loop() or modal_event_loop()
- to exit."""
- self._exit_event_loop()
-
- def _exit_event_loop(self):
- # Exit the generic _event_loop implementation.
- self._exit_event_loop_flag = True
-
-# def event_loop_until(self, exit):
-# """Loop reading and handling events until exit() returns
-# true, _quit_flag is set or an exception other than Cancel
-# is raised."""
-# while not exit() and not self._quit_flag:
-# try:
-# self.handle_next_event()
-# except Cancel:
-# pass
-
-# def handle_events(self):
-# """Handle events until an exception occurs. Waits for at least one event;
-# may handle more, at the discretion of the implementation."""
-# self.handle_next_event()
-
- def handle_next_event(self, modal_window):
- # Wait for the next event to arrive and handle it. Transparently handles
- # any internal events such as window updates, etc., and executes any idle
- # tasks that become due while waiting for an event. If modal_window is
- # not None, restrict interaction to that window (but allow use of enabled
- # application-wide menu items).
- #
- # This only needs to be implemented if the generic _event_loop() is being
- # used.
- raise UnimplementedMethod(self, "handle_next_event")
-
- #
- # Menu commands
- #
-
- def setup_menus(self, m):
- m.new_cmd.enabled = 1
- m.open_cmd.enabled = 1
- m.page_setup_cmd.enabled = 1
- m.quit_cmd.enabled = 1
-
- def new_cmd(self):
- "Handle the New menu command."
- doc = self.make_new_document()
- if not doc:
- raise UsageError(
- "Application.make_document(None) did not return a Document.")
- doc.new_contents()
- self.make_window(doc)
-
- def open_cmd(self):
- "Handle the Open... menu command."
- from FileDialogs import request_old_file
- dir = self.get_default_open_directory()
- fileref = request_old_file(default_dir = dir,
- file_types = self._open_file_types)
- if fileref:
- self.open_fileref(fileref)
- else:
- raise Cancel
-
- def get_default_open_directory(self):
- """Called by the default implementation of open_cmd() to find an initial
- directory for request_old_file(). Should return a DirRef or FileRef, or
- None if there is no preferred location. By default it returns the last
- directory in which a document was opened or saved during this session,
- if any."""
- return self._last_directory
-
- def page_setup_cmd(self):
- present_page_setup_dialog(self.page_setup)
-
- def quit_cmd(self):
- """Handle the Quit menu command."""
- while self._documents:
- self._documents[0].close_cmd()
- windows = self._windows
- while windows:
- window = windows[-1]
- window.destroy()
- assert not (windows and windows[-1] is window), \
- "%r failed to remove itself from application on destruction" % window
- self._quit()
-
- #
- # Opening files
- #
-
- def process_args(self, args):
- """Process command line arguments. Called by run() when the application
- is starting up."""
- if not args:
- self.open_app()
- else:
- for arg in args:
- if os.path.exists(arg):
- arg = os.path.abspath(arg)
- self.open_path(arg)
-
- def open_app(self):
- """Called by run() when the application is opened with no arguments."""
- pass
-
- def open_path(self, path):
- """Open document specified by a pathname. Called for each command line
- argument when the application is starting up."""
- self.open_fileref(FileRef(path = path))
-
- def open_fileref(self, fileref):
- """Open document specified by a FileRef."""
- doc = self.make_file_document(fileref)
- if not doc:
- raise ApplicationError("The file '%s' is not recognised by %s." % (
- fileref.name, Globals.application_name))
- doc.set_file(fileref)
- try:
- doc.read()
- except EnvironmentError, e:
- raise ApplicationError("Unable to open '%s'." % fileref.name, e)
- self.make_window(doc)
-
- #
- # Message dispatching
- #
-
-# def dispatch(self, message, *args):
-# target_window = self._find_target_window()
-# if target_window:
-# target_window.dispatch(message, *args)
-# else:
-# self.handle(message, *args)
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
- def dispatch_menu_command(self, command):
- if isinstance(command, tuple):
- name, index = command
- self.dispatch(name, index)
- else:
- self.dispatch(command)
-
- def get_target(self):
- # Implementations may override this to locate the target in a
- # different way if they choose not to implement the Window.target
- # property. Should return self if no other target can be found.
- window = self.target_window
- if window:
- return window.target
- else:
- return self
-
- def get_target_window(self):
- """Return the window to which messages should be dispatched, or None."""
- raise NotImplementedError
-
- #
- # Abstract
- #
-
- def make_new_document(self):
- """Create a new Document object of the appropriate
- class in response to a New command."""
- return self.make_document(None)
-
- def make_file_document(self, fileref):
- """Create a new Document object of the appropriate
- class for the given FileRef."""
- return self.make_document(fileref)
-
- def make_document(self, fileref):
- """Should create a new Document object of the appropriate
- class for the given FileRef, or if FileRef is None, a new
- empty Document of the appropriate class for the New command."""
- return None
-
- def make_window(self, document):
- """Should create a Window set up appropriately for viewing
- the given Document."""
- raise UnimplementedMethod(self, 'make_window')
-
- #
- # Clipboard
- #
-
- def query_clipboard(self):
- "Tests whether the clipboard contains any data."
- return not not self._clipboard
-
- def get_clipboard(self):
- return self._clipboard
-
- def set_clipboard(self, x):
- self._clipboard = x
-
- #
- # Window list management
- #
-
- def _add_window(self, window):
- if window not in self._windows:
- self._windows.append(window)
-
- def _remove_window(self, window):
- if window in self._windows:
- self._windows.remove(window)
-
- #
- # Document list management
- #
-
- def _add_document(self, doc):
- if doc not in self._documents:
- self._documents.append(doc)
-
- def _remove_document(self, doc):
- if doc in self._documents:
- self._documents.remove(doc)
-
- #
- # Exception reporting
- #
-
- def report_error(self):
- """Display an appropriate error message for the most recent
- exception caught."""
- try:
- raise
- except Cancel:
- pass
- except ApplicationError, e:
- from GUI.Alerts import stop_alert
- stop_alert(str(e))
- except:
- self.report_exception()
-
- def report_exception(self):
- """Display an alert box describing the most recent exception, and
- giving the options Continue, Traceback or Abort. Traceback displays
- a traceback and continues; Abort raises SystemExit."""
- try:
- exc_type, exc_val, exc_tb = sys.exc_info()
- exc_desc = "%s: %s" % (exc_type.__name__, exc_val)
- self.print_traceback(exc_desc, exc_tb)
- from GUI.Alerts import alert3
- message = "Sorry, something went wrong."
- result = alert3('stop', "%s\n\n%s" % (message, exc_desc),
- "Continue", "Abort", "Traceback",
- default = 1, cancel = None, width = 450, lines = 5)
- if result == 1: # Continue
- return
- elif result == -1: # Traceback
- self.display_traceback(exc_desc, exc_tb)
- return
- else: # Abort
- raise SystemExit
- except (KeyboardInterrupt, SystemExit):
- os._exit(1)
- except:
- print >>sys.stderr, "---------- Exception while reporting exception ----------"
- traceback.print_exc()
- print >>sys.stderr, "------------------ Original exception -------------------"
- traceback.print_exception(exc_type, exc_val, exc_tb)
- #os._exit(1)
-
- def display_traceback(self, exc_desc, exc_tb):
- """Display an exception description and traceback.
- TODO: display this in a scrolling window."""
- self.print_traceback(exc_desc, exc_tb)
-
- def print_traceback(self, exc_desc, exc_tb):
- """Print exception description and traceback to standard error."""
- import traceback
- sys.stderr.write("\nTraceback (most recent call last):\n")
- traceback.print_tb(exc_tb)
- sys.stderr.write("%s\n\n" % exc_desc)
-
- #
- # Other
- #
-
- def zero_windows_allowed(self):
- """Platforms should implement this to return false if there
- must be at least one window open at all times. Returning false
- here forces the Quit command to be used instead of Close when
- there is only one window open."""
- # TODO: Move this somewhere more global.
- raise UnimplementedMethod(self, 'zero_windows_allowed')
-
- def _perform_menu_setup(self, menus = None):
- """Given a list of Menu objects, perform menu setup processing
- and update associated platform menus ready for popping up or
- pulling down."""
- if menus is None:
- menus = self._effective_menus()
- menu_state = MenuState(menus)
- menu_state.reset()
- self._dispatch_menu_setup(menu_state)
- for menu in menus:
- menu._update_platform_menu()
-
- def _dispatch_menu_setup(self, menu_state):
- self.dispatch('_setup_menus', menu_state)
-
- def _effective_menus(self):
- """Return a list of the menus in effect for the currently active
- window, including both application-wide and window-specific menus,
- in an appropriate order according to platform conventions."""
- window = self.target_window
- return self._effective_menus_for_window(window)
-
- def _effective_menus_for_window(self, window):
- """Return a list of the menus in effect for the specified
- window, including both application-wide and window-specific menus,
- in an appropriate order according to platform conventions."""
- menus = self.menus
- if window:
- menus = menus + window.menus
- regular_menus = []
- special_menus = []
- for menu in menus:
- if menu.special:
- special_menus.insert(0, menu)
- else:
- regular_menus.append(menu)
- return regular_menus + special_menus
-
-# def _may_close_a_window(self):
-# # On implementations where at least one window is needed in order to
-# # interact with the application, check whether closing a window would
-# # leave no more visible windows.
-# if self.zero_windows_allowed():
-# return True
-# count = 0
-# for window in self.windows:
-# if window.visible:
-# count += 1
-# if count >= 2:
-# return True
-# return False
-
- def _check_for_no_windows(self):
- # On implementations where at least one window is needed in order to
- # interact with the application, check whether there are no more visible
- # windows and take appropriate action.
- if not self.zero_windows_allowed():
- for window in self.windows:
- if window.visible:
- return
- self.no_visible_windows()
-
- def no_visible_windows(self):
- """On platforms that require a window in order to interact with the
- application, this is called when there are no more visible windows.
- The default action is to close the application; subclasses may override
- it to take some other action, such as creating a new window."""
- self.quit_cmd()
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GBaseAlerts.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GBaseAlerts.py
deleted file mode 100644
index 36840da..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GBaseAlerts.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#
-# Python GUI - Alert base class - Generic
-#
-
-import textwrap
-from GUI import ModalDialog
-from GUI import Label
-
-class BaseAlert(ModalDialog):
-
- _wrapwidth = 50
- _minimum_width = 200
- _left_margin = 24
- _right_margin = 24
- _top_margin = 14
- _bottom_margin = 20
- _icon_spacing = 16
- _label_button_spacing = 20
- _default_width = 380
- _default_lines = 3
-
- yes_button = None
- no_button = None
- other_button = None
-
- def __init__(self, kind, prompt, width = None, lines = None,
- button_labels = None, default = None, cancel = None):
- #if width is None:
- # width = self._default_width
- #if lines is None:
- # lines = self._default_lines
- ModalDialog.__init__(self, style = 'alert')
- self.label = Label(text = self._wrap(prompt), lines = lines)
- if self.label.width < self._minimum_width:
- self.label.width = self._minimum_width
- self._create_buttons(*button_labels)
- #self.default_button = self._find_button(default)
- #self.cancel_button = self._find_button(cancel)
- self._layout(kind)
-
- def _layout(self, kind):
- icon_width, icon_height = self._layout_icon(kind)
- label_left = self._left_margin
- if icon_width:
- label_left += icon_width + self._icon_spacing
- if self.label.height < icon_height:
- self.label.height = icon_height
- self.place(self.label,
- left = label_left,
- top = self._top_margin)# + icon_height/4)
- #_wrap_text(self.label, self._default_width - label_left - self._right_margin)
- self._layout_buttons()
- self.shrink_wrap(padding = (self._right_margin, self._bottom_margin))
-
- def _layout_icon(self, kind):
- # Place icon for the given alert kind, if any, and return its size.
- # If there is no icon, return (0, 0).
- return (0, 0)
-
- def _wrap(self, text):
- width = self._wrapwidth
- return "\n\n".join(
- [textwrap.fill(para, width)
- for para in text.split("\n\n")])
-
- def _find_button(self, value):
- #print "BaseAlert._find_button:", value ###
- if value == 1:
- result = self.yes_button
- elif value == 0:
- result = self.no_button
- elif value == -1:
- result = self.other_button
- else:
- result = None
- #print "BaseAlert._find_button: result =", result ###
- return result
-
- def yes(self):
- self.dismiss(1)
-
- def no(self):
- self.dismiss(0)
-
- def other(self):
- self.dismiss(-1)
-
-#def _wrap_text(label, label_width):
-# hard_lines = [text.split()
-# for text in label.text.split("\n")]
-# words = hard_lines[0]
-# for hard_line in hard_lines[1:]:
-# words.append("\n")
-# words.extend(hard_line)
-# font = label.font
-# space_width = font.width(" ")
-# lines = []
-# line = []
-# line_width = 0
-# for word in words:
-# word_width = font.width(word)
-# if word == "\n" or (line_width > 0
-# and line_width + space_width + word_width > label_width):
-# lines.append(line)
-# line = []
-# line_width = 0
-# if word <> "\n":
-# line.append(word)
-# if line_width > 0:
-# line_width += space_width
-# line_width += word_width
-# if line:
-# lines.append(line)
-# label.text = "\n".join([" ".join(line) for line in lines])
-
-
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GButtons.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GButtons.py
deleted file mode 100644
index 7b24bcd..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GButtons.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Buttons - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control
-
-class Button(Control, Action):
- """ A pushbutton control."""
-
- style = overridable_property('style',
- "One of 'normal', 'default', 'cancel'")
-
- def activate(self):
- """Highlight the button momentarily and then perform its action."""
- self.flash()
- self.do_action()
-
- def flash(self):
- """Highlight the button momentarily as though it had been clicked,
- without performing the action."""
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCanvasPaths.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCanvasPaths.py
deleted file mode 100644
index 8055411..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCanvasPaths.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Python GUI - Canvas Paths - Generic
-#
-
-class CanvasPaths:
- # Mixin class providing generic implementations of
- # canvas path construction operators.
-
- def __init__(self):
- self.newpath()
-
- def newpath(self):
- self._path = []
- self._current_subpath = None
- self._current_point = (0, 0)
-
- def moveto(self, x, y):
- self._current_subpath = None
- self._current_point = self._coords(x, y)
-
- def rmoveto(self, dx, dy):
- x, y = self._current_point
- self.moveto(x + dx, y + dy)
-
- def lineto(self, x, y):
- subpath = self._current_subpath
- if subpath is None:
- subpath = [self._current_point]
- self._path.append(subpath)
- self._current_subpath = subpath
- p = self._coords(x, y)
- subpath.append(p)
- self._current_point = p
-
- def rlineto(self, dx, dy):
- x, y = self._current_point
- self.lineto(x + dx, y + dy)
-
- def closepath(self):
- subpath = self._current_subpath
- if subpath:
- subpath.append(subpath[0])
- self._current_subpath = None
-
- def get_current_point(self):
- return self._current_point
-
- # Implementations may set _coords to one of the following
-
- def _int_coords(self, x, y):
- return int(round(x)), int(round(y))
-
- def _float_coords(self, x, y):
- return x, y
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCanvases.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCanvases.py
deleted file mode 100644
index a1dbab0..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCanvases.py
+++ /dev/null
@@ -1,282 +0,0 @@
-#
-# Python GUI - Drawing - Generic
-#
-
-from GUI.StdColors import black, white
-from GUI.StdFonts import application_font
-from GUI.Properties import Properties, overridable_property
-
-class Canvas(Properties):
-
- _default_forecolor = black
- _default_backcolor = white
- _printing = False
-
- pencolor = overridable_property('pencolor', "Current color for stroking paths.")
- fillcolor = overridable_property('fillcolor', "Current color for filling paths.")
- textcolor = overridable_property('textcolor', "Current color for drawint text.")
- forecolor = overridable_property('forecolor', "Sets pen, fill and text colors to the same color.")
- backcolor = overridable_property('backcolor', "Current color for erasing regions.")
- pensize = overridable_property('pensize', "Width of pen for framing and stroking.")
- font = overridable_property('font', "Font for drawing text.")
- current_point = overridable_property('current_point', "The current point, or None.")
- printing = overridable_property('printing', "True if drawing destination is a non-display device.")
-
- #forecolor = overridable_property('forecolor', "Sets both pencolor and fillcolor.")
-
- def __init__(self):
- self.newpath()
-
- def get_printing(self):
- return self._printing
-
- def initgraphics(self):
- self.set_forecolor(self._default_forecolor)
- self.set_backcolor(self._default_backcolor)
- self.set_pensize(1)
- self.set_font(application_font)
-
- def set_forecolor(self, c):
- self.pencolor = c
- self.fillcolor = c
- self.textcolor = c
-
- def rmoveto(self, dx, dy):
- x0, y0 = self._current_point()
- self.moveto(x0 + dx, y0 + dy)
-
- def rlineto(self, dx, dy):
- x0, y0 = self.current_point
- self.lineto(x0 + dx, y0 + dy)
-
- def curve(self, sp, cp1, cp2, ep):
- self.moveto(sp)
- self.curveto(cp1, cp2, ep)
-
- def rcurveto(self, cp1, cp2, ep):
- x0, y0 = self.current_point
- x1, y1 = cp1
- x2, y2 = cp2
- x3, y3 = ep
- self.curveto(
- (x0 + x1, y0 + y1),
- (x0 + x2, y0 + y2),
- (x0 + x3, y0 + y3))
-
- def fill_stroke(self):
- self.fill()
- self.stroke()
-
- # Rectangles
-
- def _pen_inset_rect(self, rect):
- l, t, r, b = rect
- p = 0.5 * self.pensize
- return (l + p, t + p, r - p, b - p)
-
- def rect(self, rect):
- l, t, r, b = rect
- self.moveto(l, t)
- self.lineto(r, t)
- self.lineto(r, b)
- self.lineto(l, b)
- self.closepath()
-
- def rect_frame(self, rect):
- self.rect(self._pen_inset_rect(rect))
-
- def fill_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.fill()
-
- def stroke_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.stroke()
-
- def frame_rect(self, rect):
- self.newpath()
- self.rect_frame(rect)
- self.stroke()
-
- def fill_stroke_rect(self, rect):
- self.rect_path(rect)
- self.fill_stroke()
-
- def fill_frame_rect(self, rect):
- self.fill_rect(rect)
- self.frame_rect(rect)
-
- def erase_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.erase()
-
- # Ovals
-
- def oval_frame(self, rect):
- self.oval(self._pen_inset_rect(rect))
-
- def fill_oval(self, rect):
- self.newpath()
- self.oval_frame(rect)
- self.fill()
-
- def stroke_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.stroke()
-
- def frame_oval(self, rect):
- self.newpath()
- self.oval_frame(rect)
- self.stroke()
-
- def fill_stroke_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.fill_stroke()
-
- def fill_frame_oval(self, rect):
- self.fill_oval(rect)
- self.frame_oval()
-
- def erase_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.erase()
-
- # Arcs
-
- def _arc_path(self, c, r, a0, a1):
-# x, y = c
-# a0r = a0 * deg
-# x0 = x + r * cos(a0r)
-# y0 = y + r * sin(a0r)
- self.newpath()
-# self.moveto(x0, y0)
- self.arc(c, r, a0, a1)
-
- def _arc_frame_path(self, c, r, a0, a1):
- self._arc_path(c, r - 0.5 * self.pensize, a0, a1)
-
- def stroke_arc(self, c, r, a0, a1):
- self._arc_path(c, r, a0, a1)
- self.stroke()
-
- def frame_arc(self, c, r, a0, a1):
- self._arc_frame_path(c, r, a0, a1)
- self.stroke()
-
- # Wedges
-
- def wedge(self, c, r, a0, a1):
- self.moveto(*c)
- self.arc(c, r, a0, a1)
- self.closepath()
-
- def fill_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.fill()
-
- def stroke_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.stroke()
-
- def fill_stroke_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.fill_stroke()
-
- def erase_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.erase()
-
- # Polylines
-
- def lines(self, points):
- point_iter = iter(points)
- self.moveto(*point_iter.next())
- for p in point_iter:
- self.lineto(*p)
-
- def linesto(self, points):
- for p in points:
- self.lineto(*p)
-
- def stroke_lines(self, points):
- self.newpath()
- self.lines(points)
- self.stroke()
-
- # Polycurves
-
- def curves(self, points):
- self.moveto(*points[0])
- for i in xrange(1, len(points), 3):
- self.curveto(*points[i:i+3])
-
- def curvesto(self, points):
- for i in xrange(0, len(points), 3):
- self.curveto(*points[i:i+3])
-
- def stroke_curves(self, points):
- self.newpath()
- self.curves(points)
- self.stroke()
-
- # Polygons
-
- def poly(self, points):
- self.lines(points)
- self.closepath()
-
- def fill_poly(self, points):
- self.newpath()
- self.poly(points)
- self.fill()
-
- def stroke_poly(self, points):
- self.newpath()
- self.poly(points)
- self.stroke()
-
- def fill_stroke_poly(self, points):
- self.newpath()
- self.poly(points)
- self.fill_stroke()
-
- def erase_poly(self, points):
- self.newpath()
- self.poly(points)
- self.erase()
-
- # Loops
-
- def loop(self, points):
- self.curves(points)
- self.closepath()
-
- def fill_loop(self, points):
- self.newpath()
- self.loop(points)
- self.fill()
-
- def stroke_loop(self, points):
- self.newpath()
- self.loop(points)
- self.stroke()
-
- def fill_stroke_loop(self, points):
- self.newpath()
- self.loop(points)
- self.fill_stroke()
-
- def erase_loop(self, points):
- self.newpath()
- self.loop(points)
- self.erase()
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCheckBoxes.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCheckBoxes.py
deleted file mode 100644
index 2860744..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCheckBoxes.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Python GUI - Check boxes - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-from GUI.Actions import Action
-
-class CheckBox(Control, Action):
- """A CheckBox is a control used to represent a binary choice."""
-
- def __init__(self, **kwds):
- Control.__init__(self, **kwds)
-
- on = overridable_property('on', "Boolean value of the check box.")
-
- auto_toggle = overridable_property('auto_toggle', """If true,
- the check box's 'on' property will automatically be toggled
- before performing the action, if any.""")
-
- mixed = overridable_property('mixed', """If true, the check box
- is capable of displaying a mixed state.""")
-
- _auto_toggle = True
- _mixed = False
-
- def get_auto_toggle(self):
- return self._auto_toggle
-
- def set_auto_toggle(self, v):
- self._auto_toggle = v
-
- def get_mixed(self):
- return self._mixed
-
- def set_mixed(self, v):
- self._mixed = v
-
- def get_value(self):
- return self.on
-
- def set_value(self, x):
- self.on = x
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GColors.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GColors.py
deleted file mode 100644
index 07799c9..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GColors.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Python GUI - Colors - Generic
-#
-
-from GUI.Properties import overridable_property
-
-class Color(object):
- """A drawing color.
-
- Constructors:
- rgb(red, green, blue, alpha = 1.0)
- where red, green, blue, alpha are in the range 0.0 to 1.0
-
- Properties:
- red --> float
- green --> float
- blue --> float
- rgb --> (red, green, blue)
- rgba --> (red, green, blue, alpha)
- """
-
- red = overridable_property('red', "Red component (0.0 to 1.0)")
- green = overridable_property('green', "Blue component (0.0 to 1.0)")
- blue = overridable_property('blue', "Blue component (0.0 to 1.0)")
- alpha = overridable_property('alpha', "Alpha (opacity) component")
- rgb = overridable_property('rgb', "Tuple of (red, green, blue) (0.0 to 1.0)")
- rgba = overridable_property('rgba',
- "Tuple of (red, green, blue, alpha) (0.0 to 1.0)")
-
- def get_alpha(self):
- return 1.0
-
- def get_rgb(self):
- return (self.red, self.green, self.blue)
-
- def set_rgb(self, x):
- self.red, self.green, self.blue = x
-
- def get_rgba(self):
- return (self.red, self.green, self.blue, self.alpha)
-
- def set_rgba(self, x):
- self.red, self.green, self.blue, self.alpha = x
-
- def __str__(self):
- return "Color(%g,%g,%g,%g)" % self.rgba
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GComponents.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GComponents.py
deleted file mode 100644
index a516955..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GComponents.py
+++ /dev/null
@@ -1,477 +0,0 @@
-#
-# Python GUI - Components - Generic
-#
-
-import os
-from GUI.Properties import Properties, overridable_property
-from GUI import MessageHandler
-from GUI.Geometry import add_pt, sub_pt, rect_size, rect_sized, rect_topleft
-from GUI import application
-
-_user_tab_stop = os.environ.get("PYGUI_KEYBOARD_NAVIGATION") or None
-# Allow "False", "True", "0", "1"
-if _user_tab_stop is not None:
- _user_tab_stop = _user_tab_stop.strip().capitalize()
- try:
- _user_tab_stop = {"False": False, "True": True}[_user_tab_stop]
- except KeyError:
- try:
- _user_tab_stop = int(_user_tab_stop)
- except ValueError:
- sys.stderr.write("PYGUI_KEYBOARD_NAVIGATION: Unrecognized value %r"
- % _user_tab_stop)
- _user_tab_stop = None
-
-class Component(Properties, MessageHandler):
- """Component is an abstract class representing a user
- interface component."""
-
- left = overridable_property('left', "Position of left edge relative to container.")
- top = overridable_property('top', "Position of top edge relative to container.")
- right = overridable_property('right', "Position of right edge relative to container.")
- bottom = overridable_property('bottom', "Position of bottom edge relative to container.")
-
- x = overridable_property('x', "Horizontal position relative to container.")
- y = overridable_property('y', "Vertical position relative to container.")
- width = overridable_property('width')
- height = overridable_property('height')
-
- position = overridable_property('position', "Position relative to container.")
- size = overridable_property('size')
-
- bounds = overridable_property('bounds', "Bounding rectangle in container's coordinates.")
-
- container = overridable_property('container',
- "Container which contains this Component. Setting this property has the "
- "effect of removing the component from its previous container, if any, "
- "and adding it to the new one, if any.")
-
-# visible = overridable_property('visible',
-# "Whether the component is currently shown.")
-
- tab_stop = overridable_property('tab_stop',
- "Whether tab key can navigate into this control.")
-
- anchor = overridable_property('anchor', "A string of 'ltrb' controlling behaviour when container is resized.")
-
- border = overridable_property('border', "True if the component should have a border.")
-
- _is_scrollable = False # Overridden by scrollable subclasses
- _generic_tabbing = True # Whether to use generic tab navigation code
- _default_tab_stop = False
- _user_tab_stop_override = False # Whether user preference overrides _default_tab_stop
- _tab_stop = None
-
- #
- # Class variables defined by implementations:
- #
- # _has_local_coords bool True if component has a local coordinate system
- #
-
- _container = None
- _border = False
- hmove = 0
- vmove = 0
- hstretch = 0
- vstretch = 0
-
- def __init__(self, tab_stop = None, **kwds):
- Properties.__init__(self, **kwds)
- if tab_stop is None:
- tab_stop = self._get_default_tab_stop()
- self.tab_stop = tab_stop
-
- def destroy(self):
- self.container = None
-
- #
- # Geometry properties
- #
- # Default implementations of position and size properties
- # in terms of the bounds property. A minimal implementation
- # need only implement get_bounds and set_bounds.
- #
- # It is the implementation's responsibility to call _resized()
- # whenever the size of the component changes, either by
- # explicit assignment to geometry properties or by the user
- # resizing the containing window. It should not be called if
- # setting a geometry property does not cause the size to change.
- #
-
- def get_left(self):
- return self.position[0]
-
- def set_left(self, v):
- l, t, r, b = self.bounds
- self.bounds = (v, t, r, b)
-
- def get_top(self):
- return self.bounds[1]
-
- def set_top(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, v, r, b)
-
- def get_right(self):
- return self.bounds[2]
-
- def set_right(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, v, b)
-
- def get_bottom(self):
- return self.bounds[3]
-
- def set_bottom(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, r, v)
-
- def get_x(self):
- return self.bounds[0]
-
- def set_x(self, v):
- l, t, r, b = self.bounds
- self.bounds = (v, t, v + r - l, b)
-
- def get_y(self):
- return self.bounds[1]
-
- def set_y(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, v, r, v + b - t)
-
- def get_position(self):
- l, t, r, b = self.bounds
- return (l, t)
-
- def set_position(self, (x, y)):
- l, t, r, b = self.bounds
- self.bounds = (x, y, x + r - l, y + b - t)
-
- def get_width(self):
- l, t, r, b = self.bounds
- return r - l
-
- def set_width(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, l + v, b)
-
- def get_height(self):
- l, t, r, b = self.bounds
- return b - t
-
- def set_height(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, r, t + v)
-
- def get_size(self):
- l, t, r, b = self.bounds
- return (r - l, b - t)
-
- def set_size(self, (w, h)):
- l, t, r, b = self.bounds
- self.bounds = (l, t, l + w, t + h)
-
- #
- # Container management
- #
-
- def get_container(self):
- return self._container
-
- def set_container(self, new_container):
- if self._container != new_container:
- self._change_container(new_container)
-
- def _change_container(self, new_container):
- old_container = self._container
- if old_container:
- self._container = None
- old_container._remove(self)
- if new_container:
- self._container = new_container
- new_container._add(self)
-
- #
- # Message dispatching
- #
-
- def become_target(self):
- """Arrange for this object to be the first to handle messages
- dispatched to the containing Window. If the component is not
- contained in a Window, the effect is undefined."""
- raise NotImplementedError
-
- def is_target(self):
- """Return true if this is the current target within the containing
- Window. If the component is not contained in a Window, the result
- is undefined."""
- return self.window and self.window.target is self
-
- #
- # Message handling
- #
-
- def next_handler(self):
- return self._container
-
- #
- # Visibility control
- #
-
-# def show(self):
-# """Make the Component visible (provided its container is visible)."""
-# self.visible = 1
-#
-# def hide(self):
-# """Make the Component invisible."""
-# self.visible = 0
-
- #
- # Border
- #
-
- def get_border(self):
- return self._border
-
- def set_border(self, x):
- self._border = x
-
- #
- # Resizing
- #
-
- def get_anchor(self):
- if self.hmove:
- s1 = 'r'
- elif self.hstretch:
- s1 = 'lr'
- else:
- s1 = 'l'
- if self.vmove:
- s2 = 'b'
- elif self.vstretch:
- s2 = 'tb'
- else:
- s2 = 't'
- return s1 + s2
-
- def set_anchor(self, s):
- if 'r' in s:
- if 'l' in s:
- self.hstretch = True
- self.hmove = False
- else:
- self.hstretch = False
- self.hmove = True
- else:
- self.hstretch = False
- self.hmove = False
- if 'b' in s:
- if 't' in s:
- self.vstretch = True
- self.vmove = False
- else:
- self.vstretch = False
- self.vmove = True
- else:
- self.vstretch = False
- self.vmove = False
-
- def get_auto_layout(self):
- return self._auto_layout
-
- def set_auto_layout(self, x):
- self._auto_layout = x
-
- def _resized(self, delta):
- # Called whenever the size of the component changes for
- # any reason.
- pass
-
- def container_resized(self, delta):
- """Called whenever the component's container changes size and the
- container's auto_layout property is true. The default implementation
- repositions and resizes this component according to its resizing
- options."""
- dw, dh = delta
- left, top, right, bottom = self.bounds
- if self.hmove:
- left += dw
- right += dw
- elif self.hstretch:
- right += dw
- if self.vmove:
- top += dh
- bottom += dh
- elif self.vstretch:
- bottom += dh
- self.bounds = (left, top, right, bottom)
-
- #
- # Update region maintenance
- #
-
- def invalidate(self):
- """Mark the whole Component as needing to be redrawn."""
- self.invalidate_rect(self.viewed_rect())
-
-# def invalidate_rect(self, r):
-# print "GComponent.invalidate_rect:", self, r ###
-# container = self._container
-# if container:
-# container.invalidate_rect(r)
-
-# def _invalidate_in_container(self):
-# container = self._container
-# if container:
-# container._invalidate_subcomponent(self)
-
- #
- # Coordinate transformation
- #
-
- def local_to_global(self, p):
- p = self.local_to_container(p)
- parent = self._container
- if parent:
- return parent.local_to_global(p)
- else:
- return p
-
- def global_to_local(self, p):
- parent = self._container
- if parent:
- p = parent.global_to_local(p)
- return self.container_to_local(p)
-
- def local_to_container(self, p):
- if self._has_local_coords:
- return add_pt(p, self.local_to_container_offset())
- else:
- return p
-
- def container_to_local(self, p):
- if self._has_local_coords:
- return sub_pt(p, self.local_to_container_offset())
- else:
- return p
-
- def local_to_container_offset(self):
- if self._has_local_coords:
- return self.position
- else:
- return (0, 0)
-
- def transform_from(self, other, p):
- return transform_coords(other, self, p)
-
- def transform_to(self, other, p):
- return transform_coords(self, other, p)
-
- #
- # Placement specification support
- #
-
- def __add__(self, offset):
- return (self, offset)
-
- def __sub__(self, offset):
- return (self, -offset)
-
- #
- # Tabbing
- #
-
-# def get_tabbable(self):
-# return self._tabbable
-#
-# def set_tabbable(self, value):
-# if self._tabbable <> value:
-# self._tabbable = value
-# self._invalidate_tab_chain()
-
- def get_tab_stop(self):
- return self._tab_stop
-
- def set_tab_stop(self, x):
- if self._tab_stop <> x:
- self._tab_stop = x
- self._invalidate_tab_chain()
-
- def _get_default_tab_stop(self):
- if self._user_tab_stop_override:
- result = _user_tab_stop
- else:
- result = None
- if result is None:
- result = self._default_tab_stop
- return result
-
- def _tab_out(self):
- pass
-
- def _tab_in(self):
- self.become_target()
-
- def _build_tab_chain(self, chain):
- if self._tab_stop:
- chain.append(self)
-
- def _invalidate_tab_chain(self):
- window = self.window
- if window:
- window._invalidate_tab_chain()
-
- def _is_targetable(self):
- return True
-
- #
- # Other
- #
-
- window = overridable_property('window', """The Window ultimately containing
- this Component, or None.""")
-
- def get_window(self):
- container = self._container
- if container:
- return container.window
- else:
- return None
-
- def reset_blink(self):
- application().reset_blink()
-
- def viewed_rect(self):
- """Returns the rectangle in local coordinates that is
- currently visible within the component."""
- if self._has_local_coords:
- width, height = self.size
- return (0, 0, width, height)
- else:
- return self.bounds
-
- def broadcast(self, message, *args):
- """Traverse the component hierarchy, calling each component's handler for
- the given message, if any."""
- method = getattr(self, message, None)
- if method:
- method(*args)
-
- def _dispatch_mouse_event(self, event):
- self._handle_mouse_event(event)
-
- def _handle_mouse_event(self, event):
- self.handle(event.kind, event)
-
-
-def transform_coords(from_component, to_component, p):
- if from_component:
- g = from_component.local_to_global(p)
- else:
- g = p
- if to_component:
- return to_component.global_to_local(g)
- else:
- return g
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GContainers.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GContainers.py
deleted file mode 100644
index fb6714f..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GContainers.py
+++ /dev/null
@@ -1,382 +0,0 @@
-#
-# Python GUI - Containers - Generic
-#
-
-try:
- maketrans = str.maketrans
-except AttributeError:
- from string import maketrans
-from GUI.Properties import overridable_property
-from GUI.Exceptions import ArgumentError
-from GUI.Geometry import pt_in_rect
-from GUI import Component
-
-anchor_to_sticky = maketrans("ltrb", "wnes")
-
-class Container(Component):
- """A Container is a Component that can contain other Components.
- The sub-components are clipped to the boundary of their container."""
-
- contents = overridable_property('contents',
- "List of subcomponents. Do not modify directly.")
-
- content_width = overridable_property('content_width', "Width of the content area.")
- content_height = overridable_property('content_height', "Height of the content area.")
- content_size = overridable_property('content_size', "Size of the content area.")
-
- auto_layout = overridable_property('auto_layout',
- "Automatically adjust layout of subcomponents when resized.")
-
- _auto_layout = True
-
- # _contents [Component]
-
- def __init__(self, **kw):
- self._contents = []
- Component.__init__(self, **kw)
-
- def destroy(self):
- """Destroy this Container and all of its contents."""
- contents = self._contents
- while contents:
- comp = contents[-1]
- comp.destroy()
- assert not contents or contents[-1] is not comp, \
- "%r failed to remove itself from container on destruction" % comp
- Component.destroy(self)
-
- #
- # Content area
- #
-
- def get_content_width(self):
- return self.content_size[0]
-
- def set_content_width(self, w):
- self.content_size = w, self.content_height
-
- def get_content_height(self):
- return self.content_size[1]
-
- def set_content_height(self, h):
- self.content_size = self.content_width, h
-
- get_content_size = Component.get_size
- set_content_size = Component.set_size
-
- #
- # Subcomponent Management
- #
-
- def get_contents(self):
- return self._contents
-
- def add(self, comp):
- """Add the given Component as a subcomponent."""
- if comp:
- if isinstance(comp, Component):
- comp.container = self
- else:
- for item in comp:
- self.add(item)
-
- def remove(self, comp):
- """Remove subcomponent, if present."""
- if isinstance(comp, Component):
- if comp in self._contents:
- comp.container = None
- else:
- for item in comp:
- self.remove(item)
-
- def _add(self, comp):
- # Called by comp.set_container() to implement subcomponent addition.
- self._contents.append(comp)
- self._invalidate_tab_chain()
- self.added(comp)
-
- def _remove(self, comp):
- # Called by comp.set_container() to implement subcomponent removal.
- self._contents.remove(comp)
- self._invalidate_tab_chain()
- self.removed(comp)
-
- def added(self, comp):
- """Called after a subcomponent has been added."""
- pass
-
- def removed(self, comp):
- """Called after a subcomponent has been removed."""
- pass
-
- #
- # The infamous 'place' method and friends.
- #
-
- _place_default_spacing = 8
-
- def place(self, item,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, anchor = None):
- """Add a component to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- self._place([item], left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border, anchor = anchor)
-
- def place_row(self, items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, spacing = None,
- anchor = None):
- """Add a row of components to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- if left is not None and right is not None:
- raise ValueError("Cannot specify both left and right to place_row")
- elif left is None and right is not None:
- direction = 'left'
- items = items[:]
- items.reverse()
- else:
- direction = 'right'
- self._place(items, left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border,
- direction = direction, spacing = spacing, anchor = anchor)
-
- def place_column(self, items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, spacing = None,
- anchor = None):
- """Add a column of components to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- if top is not None and bottom is not None:
- raise ValueError("Cannot specify both top and bottom to place_column")
- elif top is None and bottom is not None:
- direction = 'up'
- items = items[:]
- items.reverse()
- else:
- direction = 'down'
- self._place(items, left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border,
- direction = direction, spacing = spacing, anchor = anchor)
-
- def _place(self, items,
- left = None,
- right = None,
- top = None,
- bottom = None,
- sticky = 'nw',
- scrolling = '',
- direction = 'right',
- spacing = None,
- border = None,
- anchor = None):
-
- def side(spec, name):
- # Process a side specification taking the form of either
- # (1) an offset, (2) a reference component, or (3) a
- # tuple (component, offset). Returns a tuple (ref, offset)
- # where ref is the reference component or None (representing
- # the Frame being placed into). Checks that the reference
- # component, if any, is directly contained by this Frame.
- ref = None
- offset = None
- if spec is not None:
- if isinstance(spec, tuple):
- ref, offset = spec
- elif isinstance(spec, Component):
- ref = spec
- offset = 0
- elif isinstance(spec, (int, float)):
- offset = spec
- else:
- raise ArgumentError(self, 'place', name, spec)
- if ref is self:
- ref = None
- elif ref:
- con = ref.container
- #if con is not self and isinstance(con, ScrollFrame):
- # ref = con
- # con = ref.container
- if con is not self:
- raise ValueError("Reference component for place() is not"
- " directly contained by the frame being placed into.")
- return ref, offset
-
- if spacing is None:
- spacing = self._place_default_spacing
-
- # Decode the sticky options
- if anchor is not None:
- sticky = anchor.translate(anchor_to_sticky)
- hmove = vmove = hstretch = vstretch = 0
- if 'e' in sticky:
- if 'w' in sticky:
- hstretch = 1
- else:
- hmove = 1
- if 's' in sticky:
- if 'n' in sticky:
- vstretch = 1
- else:
- vmove = 1
-
- # Translate the direction argument
- try:
- dir = {'right':0, 'down':1, 'left':2, 'up':3}[direction]
- except KeyError:
- raise ArgumentError(self, 'place', 'direction', direction)
-
- # Unpack the side arguments
- left_obj, left_off = side(left, 'left')
- right_obj, right_off = side(right, 'right')
- top_obj, top_off = side(top, 'top')
- bottom_obj, bottom_off = side(bottom, 'bottom')
-
- # Process the items
- #if not isinstance(items, list):
- # items = [items]
- for item in items:
- x, y = item.position
- w, h = item.size
- # Calculate left edge position
- if left_obj:
- l = left_obj.left + left_obj.width + left_off
- elif left_off is not None:
- if left_off < 0:
- l = self.width + left_off
- else:
- l = left_off
- else:
- l = None
- # Calculate top edge position
- if top_obj:
- t = top_obj.top + top_obj.height + top_off
- elif top_off is not None:
- if top_off < 0:
- t = self.height + top_off
- else:
- t = top_off
- else:
- t = None
- # Calculate right edge position
- if right_obj:
- r = right_obj.left + right_off
- elif right_off is not None:
- if right_off <= 0:
- r = self.width + right_off
- else:
- r = right_off
- else:
- r = None
- # Calculate bottom edge position
- if bottom_obj:
- b = bottom_obj.top + bottom_off
- elif bottom_off is not None:
- if bottom_off <= 0:
- b = self.height + bottom_off
- else:
- b = bottom_off
- else:
- b = None
- # Fill in unspecified positions
- if l is None:
- if r is not None:
- l = r - w
- else:
- l = x
- if r is None:
- r = l + w
- if t is None:
- if b is not None:
- t = b - h
- else:
- t = y
- if b is None:
- b = t + h
- if scrolling:
- item.scrolling = scrolling
- # Position, resize and add the item
- item.bounds = (l, t, r, b)
- self.add(item)
- # Record resizing and border options
- item.hmove = hmove
- item.vmove = vmove
- item.hstretch = hstretch
- item.vstretch = vstretch
- if border is not None:
- item.border = border
- # Step to the next item
- if dir == 0:
- left_obj = item
- left_off = spacing
- elif dir == 1:
- top_obj = item
- top_off = spacing
- elif dir == 2:
- right_obj = item
- right_off = -spacing
- else:
- bottom_obj = item
- bottom_off = -spacing
-
- #
- # Resizing
- #
-
- def _resized(self, delta):
- if self._auto_layout:
- self.resized(delta)
-
- def resized(self, delta):
- for c in self._contents:
- c.container_resized(delta)
-
- def resize(self, auto_layout = False, **kwds):
- """Change the geometry of the component, with control over whether
- the layout of subcomponents is updated. The default is not to do so.
- Keyword arguments to this method may be any of the properties
- affecting position and size (i.e. left, top, right, bottom, x, y,
- width, height, position, size, bounds)."""
- old_auto_layout = self.auto_layout
- try:
- self.auto_layout = auto_layout
- self.set(**kwds)
- finally:
- self.auto_layout = old_auto_layout
-
- #
- # Tabbing
- #
-
- def _build_tab_chain(self, chain):
- Component._build_tab_chain(self, chain)
- for c in self._contents:
- c._build_tab_chain(chain)
-
- #
- # Other
- #
-
- def shrink_wrap(self, padding = None):
- """Adjust the size of the component so that it neatly encloses its
- contents. If padding is specified, it specifies the amount of space
- to leave at right and bottom, otherwise the minimum distance from the
- left and top sides to the nearest components is used."""
- contents = self.contents
- if not contents:
- return
- if padding:
- hpad, vpad = padding
- else:
- hpad = min([item.left for item in contents])
- vpad = min([item.top for item in contents])
- rights = [item.right for item in contents]
- bottoms = [item.bottom for item in contents]
- self.resize(size = (max(rights) + hpad, max(bottoms) + vpad))
-
- def broadcast(self, message, *args):
- """Traverse the component hierarchy, calling each component's handler for
- the given message, if any."""
- Component.broadcast(self, message, *args)
- for comp in self._contents:
- comp.broadcast(message, *args)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GControls.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GControls.py
deleted file mode 100644
index 47f0a81..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GControls.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Python GUI - Controls - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Component
-
-class Control(Component):
- """Abstract base class for components such as buttons, check
- boxes and text entry boxes."""
-
- title = overridable_property('title', "Title of the control.")
- value = overridable_property('value', "Value of the control.")
- enabled = overridable_property('enabled', "True if user can manipulate the control.")
- font = overridable_property('font')
- color = overridable_property('color')
- just = overridable_property('just', "Justification ('left', 'center' or 'right').")
- lines = overridable_property('lines',
- "Height of the control measured in lines of the current font.")
- tab_stop = overridable_property('tab_stop',
- "Whether tab key can navigate into this control.")
-
- _vertical_padding = 0 # Extra height to add when setting 'lines' property
- _default_tab_stop = True
- _user_tab_stop_override = True
-
- def __init__(self, font = None, lines = None, **kwds):
- Component.__init__(self, **kwds)
- # If font and lines are both specified, must set font first.
- if font:
- self.font = font
- if lines is not None:
- self.lines = lines
-
- def get_lines(self):
- return int(round((self.height - self._vertical_padding) / self.font.line_height))
-
- def set_lines(self, num_lines):
- self.height = self._calc_height(self.font, num_lines)
-
- def _calc_height(self, font, num_lines = 1):
- return num_lines * font.line_height + self._vertical_padding
-
- def _is_targetable(self):
- return self.enabled
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCursors.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCursors.py
deleted file mode 100644
index a5982f0..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GCursors.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# Python GUI - Cursors - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI.Properties import Properties
-from GUI.Resources import lookup_resource, find_resource, get_resource
-from GUI import Image
-
-def _hotspot_for_resource(resource_name):
- path = lookup_resource(resource_name, "hot")
- if path:
- f = open(path, "rU")
- xs, ys = f.readline().split()
- return int(xs), int(ys)
- else:
- return None
-
-class Cursor(Properties):
- """A Cursor is an image representing the mouse pointer.
-
- Constructors:
- Cursor(resource_name, hotspot)
- Cursor(image, hotspot)
- """
-
- def from_resource(cls, name, hotspot = None, **kwds):
- def load(path):
- image = Image.from_resource(name, **kwds)
- return cls(image, hotspot or _hotspot_for_resource(name))
- return get_resource(load, name)
-
- from_resource = classmethod(from_resource)
-
- def __init__(self, spec, hotspot = None):
- """Construct a Cursor from a resource or Image and a hotspot point.
- The hotspot defaults to the centre of the image."""
- if isinstance(spec, basestring):
- self._init_from_resource(spec, hotspot)
- else:
- self._init_from_image(spec, hotspot)
-
- def _init_from_resource(self, resource_name, hotspot):
- image = Image(file = find_resource(resource_name))
- if not hotspot:
- hotspot = _hotspot_for_resource(resource_name)
- self._init_from_image(image, hotspot)
-
- def _init_from_image(self, image, hotspot):
- if not hotspot:
- width, height = image.size
- hotspot = (width // 2, height // 2)
- self._init_from_image_and_hotspot(image, hotspot)
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GDialogs.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GDialogs.py
deleted file mode 100644
index ab9116e..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GDialogs.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# Python GUI - Dialogs - Generic
-#
-
-from GUI import Globals
-from GUI.Properties import overridable_property
-from GUI.Actions import ActionBase, action_property
-from GUI import Window
-
-class Dialog(Window, ActionBase):
-
- _default_keys = "\r"
- _cancel_keys = "\x1b"
-
-# default_button = overridable_property('default_button',
-# "Button to be activated by the default key.")
-#
-# cancel_button = overridable_property('cancel_button',
-# "Button to be activated by the cancel key.")
-#
-# _default_button = None
-# _cancel_button = None
-
- default_action = action_property('default_action',
- "Action to perform when Return or Enter is pressed.")
-
- cancel_action = action_property('cancel_action',
- "Action to perform when Escape is pressed.")
-
- _default_action = 'ok'
- _cancel_action ='cancel'
-
- def __init__(self, style = 'nonmodal_dialog',
- closable = 0, zoomable = 0, resizable = 0, **kwds):
- if 'title' not in kwds:
- kwds['title'] = Globals.application_name
- Window.__init__(self, style = style,
- closable = closable, zoomable = zoomable, resizable = resizable,
- **kwds)
-
-# def get_default_button(self):
-# return self._default_button
-#
-# def set_default_button(self, button):
-# self._default_button = button
-# if button:
-# button.style = 'default'
-#
-# def get_cancel_button(self):
-# return self._cancel_button
-#
-# def set_cancel_button(self, button):
-# self._cancel_button = button
-# if button:
-# button.style = 'cancel'
-
- def key_down(self, event):
- #print "GDialog.key_down:", repr(event.char) ###
- c = event.char
- if c:
- if c in self._default_keys:
- self.do_default_action()
- return
- elif c in self._cancel_keys:
- self.do_cancel_action()
- return
- Window.key_down(self, event)
-
- def do_default_action(self):
- self.do_named_action('default_action')
-
- def do_cancel_action(self):
- self.do_named_action('cancel_action')
-
-# def _activate_button(self, button):
-# if button:
-# button.activate()
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GDrawableContainers.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GDrawableContainers.py
deleted file mode 100644
index f060b18..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GDrawableContainers.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - DrawableContainer - Generic
-#
-#--------------------------------------------------------------------
-
-from GUI.Geometry import rect_sized
-from GUI import Container
-from GUI import ViewBase
-from GUI.Printing import Printable
-
-default_size = (100, 100)
-
-class DrawableContainer(ViewBase, Container, Printable):
-
- #
- # Construction and destruction
- #
-
- def __init__(self, **kwds):
- Container.__init__(self, **kwds)
- ViewBase.__init__(self)
-
- def destroy(self):
- ViewBase.destroy(self)
- Container.destroy(self)
-
- def setup_menus(self, m):
- ViewBase.setup_menus(self, m)
- Container.setup_menus(self, m)
-
- def viewed_rect(self):
- """Return the rectangle in local coordinates bounding the currently
- visible part of the extent."""
- return rect_sized((0, 0), self.size)
-
- def with_canvas(self, proc):
- """Call the procedure with a canvas suitable for drawing in this
- view. The canvas is only valid for the duration of the call, and
- should not be retained beyond it."""
- raise NotImplementedError
-
- def update(self):
- """Redraw invalidated regions immediately, without waiting for a
- return to the event loop."""
- raise NotImplementedError
-
- def get_print_extent(self):
- return self.content_size
-
- def _draw_background(self, canvas, clip_rect):
- return clip_rect
-
- #
- # Callbacks
- #
-
- def draw(self, canvas, rect):
- """Called when the view needs to be drawn. The rect is the bounding
- rectangle of the region needing to be drawn. The default implementation
- does nothing."""
- pass
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GEditCmdHandlers.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GEditCmdHandlers.py
deleted file mode 100644
index eac1bbe..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GEditCmdHandlers.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# PyGUI - Edit command handling - Generic
-#
-
-from GUI import application
-
-class EditCmdHandler(object):
- # Mixin for objects that implement the standard editing commands.
-
- _may_be_password = False
-
- def setup_menus(self, m):
- selbeg, selend = self.selection
- anysel = selbeg < selend
- anyscrap = application().query_clipboard()
- passwd = self._may_be_password and self.password
- m.cut_cmd.enabled = anysel and not passwd
- m.copy_cmd.enabled = anysel and not passwd
- m.paste_cmd.enabled = anyscrap
- m.clear_cmd.enabled = anysel
- m.select_all_cmd.enabled = True
-
- def select_all_cmd(self):
- self.select_all()
-
- def select_all(self):
- self.selection = (0, self.get_text_length())
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GEvents.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GEvents.py
deleted file mode 100644
index d4522ea..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GEvents.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# Python GUI - Events - Generic
-#
-
-class Event(object):
-
- """An input event.
-
- Attributes:
-
- kind Type of event. One of 'mouse_down', 'mouse_up', 'key_down',
- 'key_up'.
-
- global_position Position of mouse in screen coordinates at the time of the event.
-
- position For mouse events, position in local coordinates of the View that
- was the target of this event. Undefined for other event types.
-
- time Time of event, in platform-dependent units.
-
- button Button identifier for mouse down/up events.
-
- num_clicks Number of consecutive clicks within double-click time.
-
- char For key events, an ASCII character. Undefined for other event types.
-
- key For non-printing keys, a value identifying the key. Undefined for other event types.
-
- auto True if key-down event is an autorepeat (not supported on all platforms).
-
- Platform-independent modifiers (boolean):
-
- shift The Shift key.
- control The Control key.
- option The additional modifier key.
- extend_contig The contiguous selection extension modifier key.
- extend_noncontig The noncontiguous selection extension modifier key.
- """
-
- kind = None
- global_position = None
- position = None
- time = None
- button = None
- num_clicks = 0
- char = None
- key = None
- auto = False
- shift = False
- control = False
- option = False
- extend_contig = False
- extend_noncontig = False
- delta = (0, 0)
- _keycode = 0 # Platform-dependent key code
- _originator = None # Component to which originally delivered by platform
- _not_handled = False # Reached default event method of originating component
-
- def position_in(self, view):
- """Return the position of this event in the coordinate system
- of the specified view."""
- return view.global_to_local(self.global_position)
-
- def __str__(self):
- return "" \
- % (self.kind, self.global_position, self.position, self.time,
- self.num_clicks, self.char, self.key, self.shift, self.control,
- self.option, self.extend_contig, self.extend_noncontig, self.auto,
- self._platform_modifiers_str())
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFiles.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFiles.py
deleted file mode 100644
index 585d9af..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFiles.py
+++ /dev/null
@@ -1,193 +0,0 @@
-#
-# Python GUI - File references and types - Generic
-#
-# Classes for dealing with file references and file types
-# in as platform-independent a manner as possible.
-#
-# In this view of things, a file reference consists
-# of two parts:
-#
-# 1) A directory reference, whose nature is
-# platform-dependent,
-#
-# 2) A name.
-#
-
-import os
-from GUI.Properties import Properties, overridable_property
-
-class FileRef(Properties):
- """A FileRef represents a file system object in a platform-independent way.
- It consists of two parts, a directory specification and the name of an
- object within that directory. The directory specification always refers
- to an existing directory, but the named object may or may not exist.
-
- Constructors:
- FileRef(dir = DirRef or path, name = string)
- FileRef(path = string)
- """
-
- dir = overridable_property('dir', "DirRef representing the parent directory.")
- name = overridable_property('name', "Name of the object within the parent directory.")
- path = overridable_property('path', "Full pathname of the object.")
-
- _dir = None # DirRef representing the parent directory
- _name = None # Name, including type suffix if any
-
- #
- # Constructor
- #
-
- def __init__(self, dir = None, name = None, path = None):
- if dir and name and not path:
- if not isinstance(dir, DirRef):
- dir = DirRef(dir)
- elif path and not (dir or name):
- dirpath, name = os.path.split(path)
- dir = DirRef(path = dirpath)
- else:
- raise TypeError("Invalid argument combination to FileRef constructor")
- self._dir = dir
- self._name = name
-
- #
- # Properties
- #
-
- def get_dir(self):
- return self._dir
-
- def get_name(self):
- "Return the name of the file."
- return self._name
-
- def get_path(self):
- return os.path.join(self._dir.path, self._name)
-
- #
- # Methods
- #
-
- def open(self, mode, file_type = None):
- """Open as a file with the given mode and return a file object. On
- platforms which have file-type metadata (e.g. Macintosh), if the
- mode contains 'w' and a file_type is specified, the newly-created
- file will be given the specified type."""
- f = open(self.path, mode)
- if "w" in mode and file_type:
- self._set_type(file_type)
- return f
-
- def mkdir(self):
- """Create a directory with the name and parent directory specified
- by this FileRef. Returns a DirRef for the created directory."""
- return DirRef(os.mkdir(self.path))
-
- def _set_type(self, file_type):
- # Platforms which have file-type metadata (e.g. Macintosh) use this
- # to set the type of a file.
- pass
-
- def __str__(self):
- return "FileRef(%r,%r)" % (self.dir.path, self.name)
-
-#-------------------------------------------------------------------------
-
-class DirRef(Properties):
- """A DirRef is an object representing a directory in the
- file system. Its representation is completely platform
- dependent.
-
- Constructor:
- DirRef(path = string)
- """
-
- _path = None
-
- path = overridable_property('path', "Full pathname of the directory.")
-
- def __init__(self, path):
- self._path = path
-
- def get_path(self):
- return self._path
-
- def __str__(self):
- return "DirRef(%r)" % self.path
-
-#-------------------------------------------------------------------------
-
-class FileType(Properties):
- """A FileType is a multi-platform representation of a file type."""
-
- _name = None
- _suffix = None
- _mac_creator = None
- _mac_type = None
- _mac_force_suffix = True
-
- name = overridable_property('name', "Human-readable description of the file type")
- suffix = overridable_property('suffix', "Filename suffix (without dot)")
- mac_creator = overridable_property('mac_creator', "Macintosh 4-character creator code")
- mac_type = overridable_property('mac_type', "Macintosh 4-character type code")
- mac_force_suffix = overridable_property('mac_force_suffix', "Enforce filename suffix on MacOSX")
-
- def get_name(self):
- return self._name
-
- def set_name(self, x):
- self._name = x
-
- def get_suffix(self):
- return self._suffix
-
- def set_suffix(self, x):
- self._suffix = x
-
- def get_mac_creator(self):
- return self._mac_creator
-
- def set_mac_creator(self, x):
- self._mac_creator = x
-
- def get_mac_type(self):
- return self._mac_type
-
- def set_mac_type(self, x):
- self._mac_type = x
-
- def get_mac_force_suffix(self):
- return self._mac_force_suffix
-
- def set_mac_force_suffix(self, x):
- self._mac_force_suffix = x
-
- def _matches(self, name, mac_type):
- # Return true if the given name or type code matches that of
- # this file type.
- this_mac_type = self._mac_type
- this_suffix = self._suffix
- if this_mac_type and mac_type == this_mac_type:
- return True
- # Allow generic text files to match typeless files for MacOSX
- if not this_suffix and this_mac_type == "TEXT" and mac_type == "\0\0\0\0":
- return True
- if this_suffix and _matches_suffix(name, this_suffix):
- return True
- return False
-
- def _add_suffix(self, name):
- # Force the given name to have the appropriate suffix for this file
- # type. Platforms which have other means of representing file types
- # (e.g. Macintosh) may override this.
- suffix = self._suffix
- if suffix and not _matches_suffix(name, suffix):
- name = "%s.%s" % (name, suffix)
- return name
-
-#-------------------------------------------------------------------------
-
-def _matches_suffix(name, suffix):
- # Test case-insensitively whether the given filename has
- # the given suffix.
- return name.lower().endswith("." + suffix.lower())
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFonts.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFonts.py
deleted file mode 100644
index 80ccc29..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFonts.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#
-# Python GUI - Fonts - Generic
-#
-
-import sys
-from GUI.Properties import overridable_property
-
-class Font(object):
- """A Font object represents a set of characters of a particular
- typeface, style and size. Font objects are immutable.
-
- Constructors:
- Font(family, size, style)
- family = family name
- size = size in points
- style = a list of 'bold', 'italic'
-
- Properties:
- family --> string
- size --> number
- style --> ['bold', 'italic']
- ascent --> number
- descent --> number
- leading --> number
- height --> number
- cap_height --> number
- x_height --> number
- line_height --> number
- """
-
- family = overridable_property('family', "Family name ('Times', 'Helvetica', etc.)")
- size = overridable_property('size', "Size in points")
- style = overridable_property('style', "A list of 'bold', 'italic'")
- ascent = overridable_property('ascent', "Distance from baseline to top of highest character")
- descent = overridable_property('descent', "Distance from baseline to bottom of lowest character")
- height = overridable_property('height', "Sum of ascent and descent")
- cap_height = overridable_property('cap_height', "Height above baseline of capital letters")
- x_height = overridable_property('x_height', "Height above baseline of lowercase letters without ascenders")
- leading = overridable_property('leading', "Recommended extra space between lines")
- line_height = overridable_property('line_height', "Recommended distance between baselines")
-
- def get_cap_height(self):
- # Approximation for platforms not supporting this
- return self.ascent
-
- def get_x_height(self):
- # Approximation for platforms not supporting this
- return self.ascent - self.descent
-
- def get_leading(self):
- return self.line_height - self.height
-
- def but(self, family = None, size = None, style = None,
- style_includes = None, style_excludes = None):
- """Return a new Font that is the same as this one except for the
- specified characteristics."""
- if not family:
- family = self.family
- if not size:
- size = self.size
- if style is None:
- style = self.style
- style = style[:]
- if style_includes:
- for item in style_includes:
- style.append(item)
- if style_excludes:
- for item in style_excludes:
- if item in style:
- style.remove(item)
- return self.__class__(family, size, style)
-
- def width(self, s, start = 0, end = None):
- """width(s [,start [,end ]])
- The width of the specified part of the given string in this font."""
- if start or end is not None:
- if end is None:
- end = len(s)
- s = s[start:end]
- return self._width(s)
-
- def _width(self, s):
- raise NotImplementedError
-
- def x_to_pos(self, s, x):
- """Given a number of pixels measured from the left of
- the given string, returns the nearest inter-character position.
- Returns 0 if x is negative, and len(string) if x is beyond the
- right end of the string."""
- raise NotImplementedError
-
- def __str__(self):
- return "Font(%r,%g,%s)" % (self.family, self.size, self.style)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFrames.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFrames.py
deleted file mode 100644
index 503bb6d..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GFrames.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Python GUI - Frames - Generic
-#
-
-from GUI import Container
-
-class Frame(Container):
- """A Frame is a general-purpose instantiable subclass of Container."""
-
- _default_size = (100, 100)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLConfig.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLConfig.py
deleted file mode 100644
index 3a92da2..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLConfig.py
+++ /dev/null
@@ -1,162 +0,0 @@
-#
-# PyGUI - OpenGL Pixel Formats - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class GLConfig(Properties):
- """Class holding the attributes of an OpenGL context configuration."""
-
- # NOTE: When adding a property here, also add it to
- # _pixel_format_attribute_names below.
-
- double_buffer = overridable_property("double_buffer", "True if context is to be double-buffered.")
- alpha = overridable_property("alpha", "True if there is to be an alpha channel.")
- color_size = overridable_property("color_size", "Number of bits per colour buffer component.")
- alpha_size = overridable_property("alpha_size", "Number of bits per alpha channel component.")
- stereo = overridable_property("stereo", "True if stereoscopic context is required.")
- aux_buffers = overridable_property("aux_buffers", "Number of auxiliary colour buffers to allocate.")
- depth_buffer = overridable_property("depth_buffer", "True if a depth buffer is required.")
- depth_size = overridable_property("depth_size", "Number of bits per depth buffer element.")
- stencil_buffer = overridable_property("stencil_buffer", "True if a stencil buffer is required.")
- stencil_size = overridable_property("stencil_size", "Number of bits per stencil buffer element.")
- accum_buffer = overridable_property("accum_buffer", "True if an accumulation buffer is required.")
- accum_size = overridable_property("accum_size", "Number of bits per accumulation buffer component.")
- multisample = overridable_property("multisample", "True if a multisampled context is required.")
- samples_per_pixel = overridable_property("samples_per_pixel", "Number of samples per multisampled pixel.")
-
- _double_buffer = True
- _alpha = True
- _color_size = 8
- _alpha_size = 8
- _stereo = False
- _aux_buffers = 0
- _depth_buffer = True
- _depth_size = 32
- _stencil_buffer = False
- _stencil_size = 8
- _accum_buffer = False
- _accum_size = 8
- _multisample = False
- _samples_per_pixel = 4
-
- _pixel_format_attribute_names = (
- 'double_buffer', 'alpha', 'color_size', 'alpha_size',
- 'stereo', 'aux_buffers', 'depth_buffer', 'depth_size',
- 'stencil_buffer', 'stencil_size', 'accum_buffer', 'accum_size',
- 'multisample', 'samples_per_pixel',
- )
-
- def _from_args(cls, config, kwds):
- # Extract pixel format arguments from arguments of GLView.__init__
- # or GLPixmap.__init__ and return a GLConfig. Used keyword
- # arguments are removed from kwds.
- pf_kwds = {}
- for name in cls._pixel_format_attribute_names:
- if name in kwds:
- pf_kwds[name] = kwds.pop(name)
- if config and pf_kwds:
- raise TypeError("Explicit config cannot be used with other configuration keyword arguments")
- if not config:
- config = cls(**pf_kwds)
- return config
-
- _from_args = classmethod(_from_args)
-
- def get_double_buffer(self):
- return self._double_buffer
-
- def set_double_buffer(self, x):
- self._double_buffer = x
-
- def get_alpha(self):
- return self._alpha
-
- def set_alpha(self, x):
- self._alpha = x
-
- def get_color_size(self):
- return self._color_size
-
- def set_color_size(self, x):
- self._color_size = x
-
- def get_alpha_size(self):
- return self._alpha_size
-
- def set_alpha_size(self, x):
- self._alpha_size = x
-
- def get_stereo(self):
- return self._stereo
-
- def set_stereo(self, x):
- self._stereo = x
-
- def get_aux_buffers(self):
- return self._aux_buffers
-
- def set_aux_buffers(self, x):
- self._aux_buffers = x
-
- def get_depth_buffer(self):
- return self._depth_buffer
-
- def set_depth_buffer(self, x):
- self._depth_buffer = x
-
- def get_depth_size(self):
- return self._depth_size
-
- def set_depth_size(self, x):
- self._depth_size = x
-
- def get_stencil_buffer(self):
- return self._stencil_buffer
-
- def set_stencil_buffer(self, x):
- self._stencil_buffer = x
-
- def get_stencil_size(self):
- return self._stencil_size
-
- def set_stencil_size(self, x):
- self._stencil_size = x
-
- def get_accum_buffer(self):
- return self._accum_buffer
-
- def set_accum_buffer(self, x):
- self._accum_buffer = x
-
- def get_accum_size(self):
- return self._accum_size
-
- def set_accum_size(self, x):
- self._accum_size = x
-
- def get_multisample(self):
- return self._multisample
-
- def set_multisample(self, x):
- self._multisample = x
-
- def get_samples_per_pixel(self):
- return self._samples_per_pixel
-
- def set_samples_per_pixel(self, x):
- self._samples_per_pixel = x
-
- def supported(self):
- """Determine whether the combination of attributes requested by this configuration
- can be satisfied. If successful, a new GLConfig object is returned whose
- attributes reflect those actually allocated. Otherwise, a GLConfigError is
- raised."""
- raise NotImplementedError
-
-#------------------------------------------------------------------------------
-
-class GLConfigError(ValueError):
-
- def __init__(self, msg = "OpenGL configuration not available"):
- ValueError.__init__(self, msg)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLContexts.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLContexts.py
deleted file mode 100644
index 82ed632..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLContexts.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# PyGUI - OpenGL Contexts - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.GLShareGroups import ShareGroup
-
-_current_share_group = None
-
-class GLContext(object):
- """Abstract base class for objects having an OpenGL context."""
- #
- # _share_group ShareGroup
- #
-
- share_group = overridable_property('share_group',
- "ShareGroup to which this context should belong, or None.")
-
- def __init__(self, share_group):
- if not share_group:
- share_group = ShareGroup()
- self._share_group = share_group
- if share_group:
- share_group._add(self)
-
- def destroy(self):
- pass
-
- def init_context(self):
- """This method is called once after the associated OpenGL context
- is created. When called, this object's OpenGL context is the current
- context and the viewport is set to (0, 0, width, height). This method
- may be used to establish any desired initial OpenGL state."""
- pass
-
- def get_share_group(self):
- return self._share_group
-
- def _get_shared_context(self):
- """Return another arbitrarily-chosen member of the share group of this
- context, or None if this context has no share group or there are no
- other members."""
- return self._share_group._some_member(exclude = self)
-
- def with_context(self, proc, flush = False):
- """The proc should be a callable object of no arguments. Calls
- the proc with the associated OpenGL context as the current context.
- If flush is true, after calling proc, a glFlush followed by a
- buffer flush or swap is performed as appropriate."""
- self._with_context(proc, flush)
-
- def _with_context(self, proc, flush):
- # Subclasses override this to implement with_context.
- # Should call _with_share_group(proc).
- # Signature can be changed if with_context is overridden to match.
- raise NotImplementedError
-
- def _with_share_group(self, proc):
- global _current_share_group
- old_share_group = _current_share_group
- _current_share_group = self._share_group
- try:
- proc()
- finally:
- _current_share_group = old_share_group
-
-
-def current_share_group():
- group = _current_share_group
- if not group:
- raise ValueError("No current PyGUI OpenGL context")
- return group
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLPixelFormats.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLPixelFormats.py
deleted file mode 100644
index 1f20cc8..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLPixelFormats.py
+++ /dev/null
@@ -1,163 +0,0 @@
-#
-# PyGUI - OpenGL Pixel Formats - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class GLPixelFormat(Properties):
- """Class holding the attributes of an OpenGL pixel format."""
-
- # NOTE: When adding a property here, also add it to
- # _pixel_format_attribute_names below.
-
- double_buffer = overridable_property("double_buffer", "True if context is to be double-buffered.")
- alpha = overridable_property("alpha", "True if there is to be an alpha channel.")
- color_size = overridable_property("color_size", "Number of bits per colour buffer component.")
- alpha_size = overridable_property("alpha_size", "Number of bits per alpha channel component.")
- stereo = overridable_property("stereo", "True if stereoscopic context is required.")
- aux_buffers = overridable_property("aux_buffers", "Number of auxiliary colour buffers to allocate.")
- depth_buffer = overridable_property("depth_buffer", "True if a depth buffer is required.")
- depth_size = overridable_property("depth_size", "Number of bits per depth buffer element.")
- stencil_buffer = overridable_property("stencil_buffer", "True if a stencil buffer is required.")
- stencil_size = overridable_property("stencil_size", "Number of bits per stencil buffer element.")
- accum_buffer = overridable_property("accum_buffer", "True if an accumulation buffer is required.")
- accum_size = overridable_property("accum_size", "Number of bits per accumulation buffer component.")
- multisample = overridable_property("multisample", "True if a multisampled context is required.")
- samples_per_pixel = overridable_property("samples_per_pixel", "Number of samples per multisampled pixel.")
-
- _double_buffer = True
- _alpha = True
- _color_size = 8
- _alpha_size = 8
- _stereo = False
- _aux_buffers = 0
- _depth_buffer = True
- _depth_size = 32
- _stencil_buffer = False
- _stencil_size = 8
- _accum_buffer = False
- _accum_size = 8
- _multisample = False
- _samples_per_pixel = False
-
- _pixel_format_attribute_names = (
- 'double_buffer', 'alpha', 'color_size', 'alpha_size',
- 'stereo', 'aux_buffers', 'depth_buffer', 'depth_size',
- 'stencil_buffer', 'stencil_size', 'accum_buffer', 'accum_size',
- 'multisample', 'samples_per_pixel',
- )
-
- def _from_args(cls, pixel_format, kwds):
- # Extract pixel format arguments from arguments of GLView.__init__
- # or GLPixmap.__init__ and return a GLPixelFormat. Used keyword
- # arguments are removed from kwds.
- pf_kwds = {}
- for name in cls._pixel_format_attribute_names:
- if name in kwds:
- pf_kwds[name] = kwds.pop(name)
- if pixel_format and pf_kwds:
- raise TypeError("Explicit pixel_format cannot be used with other pixel format keyword arguments")
- if not pixel_format:
- pixel_format = cls(**pf_kwds)
- return pixel_format
-
- _from_args = classmethod(_from_args)
-
- def get_double_buffer(self):
- return self._double_buffer
-
- def set_double_buffer(self, x):
- self._double_buffer = x
-
- def get_alpha(self):
- return self._alpha
-
- def set_alpha(self, x):
- self._alpha = x
-
- def get_color_size(self):
- return self._color_size
-
- def set_color_size(self, x):
- self._color_size = x
-
- def get_alpha_size(self):
- return self._alpha_size
-
- def set_alpha_size(self, x):
- self._alpha_size = x
-
- def get_stereo(self):
- return self._stereo
-
- def set_stereo(self, x):
- self._stereo = x
-
- def get_aux_buffers(self):
- return self._aux_buffers
-
- def set_aux_buffers(self, x):
- self._aux_buffers = x
-
- def get_depth_buffer(self):
- return self._depth_buffer
-
- def set_depth_buffer(self, x):
- self._depth_buffer = x
-
- def get_depth_size(self):
- return self._depth_size
-
- def set_depth_size(self, x):
- self._depth_size = x
-
- def get_stencil_buffer(self):
- return self._stencil_buffer
-
- def set_stencil_buffer(self, x):
- self._stencil_buffer = x
-
- def get_stencil_size(self):
- return self._stencil_size
-
- def set_stencil_size(self, x):
- self._stencil_size = x
-
- def get_accum_buffer(self):
- return self._accum_buffer
-
- def set_accum_buffer(self, x):
- self._accum_buffer = x
-
- def get_accum_size(self):
- return self._accum_size
-
- def set_accum_size(self, x):
- self._accum_size = x
-
- def get_multisample(self):
- return self._multisample
-
- def set_multisample(self, x):
- self._multisample = x
-
- def get_samples_per_pixel(self):
- return self._samples_per_pixel
-
- def set_samples_per_pixel(self, x):
- self._samples_per_pixel = x
-
- def supported(self):
- """Determine whether the combination of attributes requested by this pixel format
- can be satisfied. If successful, a new GLPixelFormat object is returned whose
- attributes reflect those actually allocated. Otherwise, a GLPixelFormatError is
- raised."""
- raise NotImplementedError
-
-#------------------------------------------------------------------------------
-
-class GLPixelFormatError(ValueError):
-
- def __init__(self):
- ValueError.__init__(self,
- "OpenGL pixel format attribute request cannot be satisfied")
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLPixmaps.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLPixmaps.py
deleted file mode 100644
index 8f07090..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLPixmaps.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# PyGUI - OpenGL Pixmap - Generic
-#
-
-from OpenGL.GL import glViewport
-from GUI import ImageBase
-from GUI.GLContexts import GLContext
-
-class GLPixmap(ImageBase, GLContext):
- """An offscreen OpenGL drawing area.
-
- Constructors:
- GLPixmap(width, height, share = None, config_attr = value...)
- GLPixmap(width, height, config, share = None)
- """
-
- def destroy(self):
- GLContext.destroy(self)
-
- def _init_context(self):
- width, height = self.size
- glViewport(0, 0, int(width), int(height))
- self.init_context()
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLTextures.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLTextures.py
deleted file mode 100644
index 0a56f85..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLTextures.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Generic
-#
-
-from weakref import WeakKeyDictionary
-from OpenGL.GL import glGenTextures, glBindTexture, glDeleteTextures, \
- glTexImage2D, GL_TEXTURE_2D, GL_RGBA
-from OpenGL.GLU import gluBuild2DMipmaps
-from GUI.GGLContexts import current_share_group
-from GUI.GLDisplayLists import call_when_not_compiling_display_list
-
-#----------------------------------------------------------------------
-
-class TextureIdMap(WeakKeyDictionary):
-
- def __del__(self):
- #print "GL.TextureIdMap.__del__:", self ###
- def free_texture():
- glDeleteTextures([gl_id])
- for share_group, gl_id in self.items():
- context = share_group._some_member()
- if context:
- #print "...freeing texture id", gl_id, "for", share_group, "using", context ###
- context.with_context(free_texture)
-
-#----------------------------------------------------------------------
-
-class Texture(object):
- """This class encapsulates an OpenGL texture and maintains a
- representation of it for each OpenGL context with which it is used.
- Allocation and maintentance of texture numbers is handled automatically.
-
- Constructor:
- Texture(texture_type)
- where texture_type is the appropriate GL constant for the type
- of texture (GL_TEXTURE_2D etc.)
- """
- #
- # _gl_type int GL_TEXTURE_2D, etc.
- # _gl_id ShareGroup -> int Mapping from OpenGL share group to texture number
-
- def __init__(self, texture_type):
- self._gl_type = texture_type
- self._gl_id = TextureIdMap()
-
- def deallocate(self):
- """Deallocate any OpenGL resources that have been allocated for this
- texture in any context."""
- self._gl_id.__del__()
-
- def bind(self):
- """Makes this texture the current texture for the current context
- by calling glBindTexture. If this texture has not previously been
- used with the current context, do_setup() is called to allocate
- and initialise a representation of the texture."""
- gl_id = self.gl_id()
- glBindTexture(self._gl_type, gl_id)
-
- def gl_id(self):
- """Returns the OpenGL texture number corresponding to this texture
- in the current context. May trigger allocation of a new texture and
- a call to do_setup(). Does not bind the texture, unless a new texture
- is allocated, in which case the current texture binding may be changed
- as a side effect."""
- share_group = current_share_group()
- gl_id = self._gl_id.get(share_group)
- if gl_id is None:
- gl_id = glGenTextures(1)
- #print "GLTexture: assigned id %d for %s in share group %s" % (
- # gl_id, self, share_group) ###
- self._gl_id[share_group] = gl_id
- call_when_not_compiling_display_list(lambda: self._setup(gl_id))
- return gl_id
-
- def _setup(self, gl_id):
- glBindTexture(self._gl_type, gl_id)
- self.do_setup()
-
- def do_setup(self):
- """Subclasses should override this to make the necessary OpenGL
- calls to initialise the texture, assuming that glBindTexture has
- already been called."""
- raise NotImplementedError
-
- def gl_tex_image_2d(self, image, target = GL_TEXTURE_2D, internal_format = GL_RGBA,
- border = False, with_mipmaps = False):
- """Load the currently bound texture with data from an image, with automatic
- scaling to power-of-2 size and optional mipmap generation."""
- border = bool(border)
- if border and with_mipmaps:
- raise ValueError("Bordered texture cannot have mipmaps")
- b2 = 2 * border
- width, height = image.size
- twidth = pow2up(width - b2) + b2
- theight = pow2up(height - b2) + b2
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: before scaling: size =", (width, height) ###
- if width <> twidth or height <> theight:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: scaling image to size", (twidth, theight) ###
- from Pixmaps import Pixmap
- image2 = Pixmap(twidth, theight)
- def scale(canvas):
- image.draw(canvas, (0, 0, width, height), (0, 0, twidth, theight))
- image2.with_canvas(scale)
- image = image2
- format, type, data = self._gl_get_texture_data(image)
- if with_mipmaps:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: loading mipmaps" ###
- gluBuild2DMipmaps(target, internal_format, twidth, theight,
- format, type, data)
- else:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: loading texture" ###
- glTexImage2D(target, 0, internal_format, twidth, theight, border,
- format, type, data)
-
-#----------------------------------------------------------------------
-
-def pow2up(size):
- # Round size up to a power of 2
- psize = 1
- while psize < size:
- psize <<= 1
- return psize
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLViews.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLViews.py
deleted file mode 100644
index 368970d..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGLViews.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# PyGUI - OpenGL View - Generic
-#
-
-from OpenGL.GL import glViewport, glMatrixMode, glLoadIdentity, \
- GL_PROJECTION, GL_MODELVIEW
-from GUI import Component
-from GUI import ViewBase
-from GUI.GLContexts import GLContext
-
-class GLError(StandardError):
- pass
-
-class GLView(ViewBase, Component, GLContext):
- """A GLView is a Component providing an OpenGL 3D display area.
-
- Constructors:
- GLView(config_attr = value..., share = None)
- GLView(config, share = None)
- """
-
- _default_size = (100, 100)
-
- def __init__(self, **kwds):
- Component.__init__(self, **kwds)
- ViewBase.__init__(self)
-
- def destroy(self):
- ViewBase.destroy(self)
- Component.destroy(self)
-
- def _render(self):
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity()
- self.render()
-
- def render(self):
- """This method is called when the contents of the view needs to
- be redrawn, with the view's OpenGL context as the current context.
- The modelview matrix has been selected as the current matrix and
- set to an identity matrix. After calling this method, buffers will
- be automatically swapped or drawing flushed as appropriate."""
- pass
-
- def viewport_changed(self):
- """This method is called when the view's size has changed, with
- the view's OpenGL context as the current context, and the OpenGL
- viewport set to (0, 0, width, height). The default implementation
- loads an identity projection matrix and calls init_projection()."""
- glMatrixMode(GL_PROJECTION)
- glLoadIdentity()
- self.init_projection()
-
- def init_projection(self):
- """This method is called to establish the projection whenever the
- viewport changes. The projection matrix has been selected as the
- current matrix and set to an identity matrix."""
- pass
-
- def update(self):
- """Redraws the contents of the view immediately, without waiting
- for a return to the event loop."""
- self.with_context(self.render, flush = True)
-
- def _init_context(self):
- self.init_context()
- self._update_viewport()
-
- def _update_viewport(self):
- width, height = self.size
- glViewport(0, 0, int(width), int(height))
- self.viewport_changed()
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGeometry.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGeometry.py
deleted file mode 100644
index 0a5bb8a..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GGeometry.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Python GUI - Point and rectangle utilities - Generic
-#
-
-def add_pt((x1, y1), (x2, y2)):
- return (x1 + x2), (y1 + y2)
-
-def sub_pt((x1, y1), (x2, y2)):
- return (x1 - x2), (y1 - y2)
-
-def rect_sized((l, t), (w, h)):
- return (l, t, l + w, t + h)
-
-def rect_left(r):
- return r[0]
-
-def rect_top(r):
- return r[1]
-
-def rect_right(r):
- return r[2]
-
-def rect_bottom(r):
- return r[3]
-
-def rect_width(r):
- return r[2] - r[0]
-
-def rect_height(r):
- return r[3] - r[1]
-
-def rect_topleft(r):
- return r[:2]
-
-def rect_botright(r):
- return r[2:]
-
-def rect_center((l, t, r, b)):
- return ((l + r) // 2, (t + b) // 2)
-
-def rect_size((l, t, r, b)):
- return (r - l, b - t)
-
-def union_rect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return (min(l1, l2), min(t1, t2), max(r1, r2), max(b1, b2))
-
-def sect_rect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return (max(l1, l2), max(t1, t2), min(r1, r2), min(b1, b2))
-
-def inset_rect((l, t, r, b), (dx, dy)):
- return (l + dx, t + dy, r - dx, b - dy)
-
-def offset_rect((l, t, r, b), (dx, dy)):
- return (l + dx, t + dy, r + dx, b + dy)
-
-def offset_rect_neg((l, t, r, b), (dx, dy)):
- return (l - dx, t - dy, r - dx, b - dy)
-
-def empty_rect((l, t, r, b)):
- return r <= l or b <= t
-
-def pt_in_rect((x, y), (l, t, r, b)):
- return l <= x < r and t <= y < b
-
-def rects_intersect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return l1 < r2 and l2 < r1 and t1 < b2 and t2 < b1
-
-def rect_with_center((l, t, r, b), (x, y)):
- w = r - l
- h = b - t
- rl = x - w // 2
- rt = y - h // 2
- return (rl, rt, rl + w, rt + h)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GImageBases.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GImageBases.py
deleted file mode 100644
index 5762234..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GImageBases.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Python GUI - Image Base - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-from GUI.Geometry import rect_sized
-
-class ImageBase(Properties):
- """Abstract base class for Image, Pixmap and GLPixmap."""
-
- width = overridable_property('width', "Width of the image in pixels (read only).")
- height = overridable_property('height', "Height of the image in pixels (read only).")
- size = overridable_property('size', "Size of the image in pixels (read only).")
- bounds = overridable_property('bounds', "Bounding rectangle of the image in pixels (read only).")
-
- def get_size(self):
- return (self.width, self.height)
-
- def get_bounds(self):
- return rect_sized((0, 0), self.size)
-
- def draw(self, canvas, src_rect, dst_rect):
- """Draw the part of the image specified by src_rect on the given canvas,
- scaled to fit within dst_rect."""
- raise NotImplementedError
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GImages.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GImages.py
deleted file mode 100644
index 21fb9bb..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GImages.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Python GUI - Images - Generic
-#
-
-from GUI.Files import FileRef
-from GUI.Resources import get_resource
-from GUI import ImageBase
-
-class Image(ImageBase):
- """Class Image represents an RGB or RGBA image.
-
- Constructors:
- Image(file = FileRef or pathname)
- """
-
- def from_resource(cls, name, **kwds):
- return get_resource(cls, name, **kwds)
-
- from_resource = classmethod(from_resource)
-
- def __init__(self, file):
- if isinstance(file, FileRef):
- file = file.path
- self._init_from_file(file)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GL.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GL.py
deleted file mode 100644
index df93e8e..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GL.py
+++ /dev/null
@@ -1,212 +0,0 @@
-#
-# PyGUI - OpenGL View - Gtk/GtkGLExt
-#
-
-try:
- from gtk import gdkgl, gtkgl
- from OpenGL.GL import glViewport
-except ImportError, e:
- raise ImportError("OpenGL support is not available (%s)" % e)
-
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI import ImageBase
-from GUI.GtkPixmaps import GtkPixmap
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-from GUI.GLDisplayLists import DisplayList
-
-#------------------------------------------------------------------------------
-
-def gtk_find_config_default(attr, mode_bit):
- try:
- cfg = gdkgl.Config(mode = mode_bit)
- value = cfg.get_attrib(attr)[0]
- except gdkgl.NoMatches:
- value = 0
- print "default for attr", attr, "=", value
- return value
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- _alpha = False
- _color_size = 1
- _alpha_size = 1
- _depth_size = 1
- _stencil_size = 1
- _accum_size = 1
-
- def _gtk_get_config(self):
- csize = self._color_size
- asize = 0
- dsize = 0
- ssize = 0
- acsize = 0
- aasize = 0
- if self._alpha:
- asize = self._alpha_size
- if self._depth_buffer:
- dsize = self._depth_size
- if self._stencil_buffer:
- ssize = self._stencil_size
- if self._accum_buffer:
- acsize = self._accum_size
- if self._alpha:
- aasize = acsize
- attrs = [
- gdkgl.RGBA,
- gdkgl.RED_SIZE, csize,
- gdkgl.GREEN_SIZE, csize,
- gdkgl.BLUE_SIZE, csize,
- gdkgl.ALPHA_SIZE, asize,
- gdkgl.AUX_BUFFERS, self._aux_buffers,
- gdkgl.DEPTH_SIZE, dsize,
- gdkgl.STENCIL_SIZE, ssize,
- gdkgl.ACCUM_RED_SIZE, acsize,
- gdkgl.ACCUM_GREEN_SIZE, acsize,
- gdkgl.ACCUM_BLUE_SIZE, acsize,
- gdkgl.ACCUM_ALPHA_SIZE, aasize,
- ]
- if self._double_buffer:
- attrs += [gdkgl.DOUBLEBUFFER]
- if self._stereo:
- attrs += [gdkgl.STEREO]
- if self._multisample:
- attrs += [
- gdkgl.SAMPLE_BUFFERS, 1,
- gdkgl.SAMPLES, self._samples_per_pixel
- ]
- result = self._gdkgl_config(attrs)
- if not result and self._double_buffer:
- attrs.remove(gdkgl.DOUBLEBUFFER)
- result = self._gdkgl_config(attrs)
- if not result:
- raise GLConfigError
- return result
-
- def _gdkgl_config(self, attrs):
- try:
- return gdkgl.Config(attrib_list = attrs)
- except gdkgl.NoMatches:
- return None
-
- def _gtk_set_config(self, gtk_config):
- def attr(key):
- return gtk_config.get_attrib(key)[0]
- self._color_size = attr(gdkgl.RED_SIZE)
- self._alpha_size = attr(gdkgl.ALPHA_SIZE)
- self._alpha = gtk_config.has_alpha()
- self._double_buffer = gtk_config.is_double_buffered()
- self._stereo = gtk_config.is_stereo()
- self._aux_buffers = attr(gdkgl.AUX_BUFFERS)
- self._depth_size = attr(gdkgl.DEPTH_SIZE)
- self._depth_buffer = gtk_config.has_depth_buffer()
- self._stencil_size = attr(gdkgl.STENCIL_SIZE)
- self._stencil_buffer = gtk_config.has_stencil_buffer()
- self._accum_size = attr(gdkgl.ACCUM_RED_SIZE)
- self._accum_buffer = gtk_config.has_accum_buffer()
- self._multisample = attr(gdkgl.SAMPLE_BUFFERS) <> 0
- self._samples_per_pixel = attr(gdkgl.SAMPLES)
-
- def supported(self, mode = 'both'):
- try:
- gtk_config = self._gtk_get_config()
- pf = GLConfig.__new__(GLConfig)
- pf._gtk_set_config(gtk_config)
- return pf
- except GLConfigError:
- return None
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- _first_expose = 0
-
- def __init__(self, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- GLContext.__init__(self, share_group, pf, kwds)
- gtk_share = self._gtk_get_share()
- area = gtkgl.DrawingArea(glconfig = self._gl_config, share_list = gtk_share,
- render_type = gdkgl.RGBA_TYPE)
- area.show()
- self._gtk_connect_after(area, "realize", self._gtk_realize_signal)
- self._gtk_connect(area, "expose-event", self._gtk_expose_event_signal)
- GGLView.__init__(self, _gtk_outer = area, _gtk_input = area,
- _gtk_focus = area)
- self.set(**kwds)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
- def _gtk_get_gl_context(self):
- if not self._gl_context:
- self._gtk_inner_widget.realize()
- return self._gl_context
-
- def _gtk_realize_signal(self):
- #print "GLView._gtk_realize_signal" ###
- area = self._gtk_inner_widget
- self._gl_drawable = area.get_gl_drawable()
- self._gl_context = area.get_gl_context()
- self.with_context(self.init_context)
-
- def _gtk_expose_event_signal(self, gtk_event):
- #print "GLView._gtk_expose_event_signal" ###
- if not self._first_expose:
- self.with_context(self._update_viewport)
- self._first_expose = 1
- try:
- self.with_context(self._render, flush = True)
- except:
- import sys, traceback
- sys.stderr.write("\n<<<<<<<<<< Exception while rendering a GLView\n")
- traceback.print_exc()
- sys.stderr.write(">>>>>>>>>>\n\n")
-
- def invalidate(self):
- gtk_window = self._gtk_outer_widget.window
- if gtk_window:
- width, height = self.size
- gtk_window.invalidate_rect((0, 0, width, height), 0)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GtkPixmap, GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- GLContext.__init__(self, share_group, pf, kwds)
- gl_config = pf._gtk_get_config()
- self._gl_config = gl_config
-# if share:
-# gtk_share = share.shared_context._gtk_get_gl_context()
-# else:
-# gtk_share = None
- gtk_share = self._gtk_get_share()
- GtkPixmap.__init__(self, width, height)
- gdk_pixmap = self._gdk_pixmap
- gdkgl.ext(gdk_pixmap)
- self._gl_drawable = gdk_pixmap.set_gl_capability(glconfig = gl_config)
- print "GLPixmap: self._gl_drawable =", self._gl_drawable ###
- self._gl_context = gdkgl.Context(
- self._gl_drawable,
- direct = False,
- share_list = gtk_share,
- render_type = gdkgl.RGBA_TYPE
- )
- print "GLPixmap: self._gl_context =", self._gl_context ###
- ImageBase.__init__(self, **kwds)
- self.with_context(self._init_context)
- print "GLPixmap: initialised context" ###
-
-# def _init_context(self):
-# width, height = self.size
-# glViewport(0, 0, int(width), int(height))
-# print "GLPixmap: Set viewport to", width, height ###
-# self.init_context()
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLContexts.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLContexts.py
deleted file mode 100644
index 1765565..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLContexts.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# PyGUI - GL Context - Gtk
-#
-
-from GUI.GGLContexts import GLContext as GGLContext
-
-try:
- from OpenGL.GL import glFlush
-except ImportError, e:
- raise ImportError("OpenGL support is not available (%s)" % e)
-
-class GLContext(GGLContext):
-
- _gl_drawable = None
- _gl_context = None
-
- def __init__(self, share_group, config, kwds):
- GGLContext.__init__(self, share_group)
- self._gl_config = config._gtk_get_config()
-
- def _gtk_get_share(self):
- shared_context = self._get_shared_context()
- if shared_context:
- return shared_context._gtk_get_gl_context()
- else:
- return None
-
- def _with_context(self, proc, flush):
- drawable = self._gl_drawable
- if drawable:
- if not drawable.gl_begin(self._gl_context):
- raise ValueError(
- "Unable to make %s the current OpenGL context (gl_begin failed)" % self)
- try:
- self._with_share_group(proc)
- if flush:
- if drawable.is_double_buffered():
- #print "GLContext.with_context: swapping buffers" ###
- drawable.swap_buffers()
- else:
- #print "GLContext.with_context: flushing" ###
- glFlush()
- finally:
- drawable.gl_end()
- #return result
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLDisplayLists.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLDisplayLists.py
deleted file mode 100644
index e6ed682..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLDisplayLists.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# PyGUI - OpenGL Display Lists - Generic
-#
-
-from weakref import WeakKeyDictionary
-from OpenGL.GL import glGenLists, glNewList, glEndList, glCallList, \
- glDeleteLists, GL_COMPILE
-from GUI.Properties import Properties, overridable_property
-from GUI.GGLContexts import current_share_group
-
-#----------------------------------------------------------------------
-
-class DisplayListIdMap(WeakKeyDictionary):
-
- def __del__(self):
- # Delete any display lists that have been allocated for this map.
- #print "GL.DisplayListIdMap.__del__:", self ###
- def free_display_list():
- glDeleteLists(gl_id, 1)
- for share_group, gl_id in self.items():
- context = share_group._some_member()
- if context:
- #print "...freeing display list id", gl_id, "for", share_group, "using", context ###
- context.with_context(free_display_list)
-
-#----------------------------------------------------------------------
-
-class DisplayList(Properties):
- """This class encapsulates an OpenGL display list and maintains a
- representation of it for each OpenGL context with which it is used.
- Allocation and maintentance of display list numbers is handled
- automatically."""
- #
- # _gl_id ShareGroup -> int Mapping from OpenGL share group to
- # display list number
-
- setup = overridable_property('setup',
- """Function to set up the display list by making the necessary
- OpenGL calls, excluding glNewList and glEndList.""")
-
- def __init__(self, setup = None):
- self._gl_id = DisplayListIdMap()
- self._setup = setup
-
- def deallocate(self):
- """Deallocate any OpenGL resources that have been allocated for this
- display list in any context."""
- self._gl_id.__del__()
-
- def get_setup(self):
- return self._setup
-
- def set_setup(self, x):
- self._setup = x
-
- def call(self):
- """Calls the display list using glCallList(). If this display list
- has not previously been used with the current context, allocates
- a display list number and arranges for do_setup() to be called
- to compile a representation of the display list."""
- share_group = current_share_group()
- gl_id = self._gl_id.get(share_group)
- if gl_id is None:
- gl_id = glGenLists(1)
- #print "GLDisplayList: assigned id %d for %s in share group %s" % (
- # gl_id, self, share_group) ###
- self._gl_id[share_group] = gl_id
- call_when_not_compiling_display_list(lambda: self._compile(gl_id))
- glCallList(gl_id)
-
- def _compile(self, gl_id):
- global compiling_display_list
- compiling_display_list = True
- glNewList(gl_id, GL_COMPILE)
- try:
- self.do_setup()
- finally:
- glEndList()
- compiling_display_list = False
-
- def do_setup(self):
- """Make all the necessary OpenGL calls to compile the display list,
- except for glNewList() and glEndList() which will be called automatically
- before and after. The default implementation calls the 'setup' property."""
- setup = self._setup
- if setup:
- setup()
- else:
- raise NotImplementedError(
- "No setup function or do_setup method for GL.DisplayList")
-
-
-compiling_display_list = False
-pending_functions = []
-
-def call_when_not_compiling_display_list(func):
- #print "GLDisplayLists: entering call_when_not_compiling_display_list" ###
- if compiling_display_list:
- #print "GLDisplayLists: deferring", func ###
- pending_functions.append(func)
- else:
- #print "GLDisplayLists: immediately calling", func ###
- func()
- while pending_functions:
- #print "GLDisplayLists: calling deferred", func ###
- pending_functions.pop()()
- #print "GLDisplayLists: exiting call_when_not_compiling_display_list" ###
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLShareGroups.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLShareGroups.py
deleted file mode 100644
index 8bb2cfc..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLShareGroups.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# PyGUI - OpenGL Context Sharing - Generic
-#
-
-from weakref import WeakKeyDictionary
-
-class ShareGroup(object):
- """Object representing a shared texture and display list
- namespace for OpenGL contexts."""
-
- def __init__(self):
- self.contexts = WeakKeyDictionary()
-
- def __contains__(self, context):
- "Test whether a GLView or GLPixmap is a member of this share group."
- return context in self.contexts
-
- def __iter__(self):
- "Return an iterator over the members of this share group."
- return iter(self.contexts)
-
- def _add(self, context):
- self.contexts[context] = 1
-
- def _some_member(self, exclude = None):
- for member in self.contexts:
- if member is not exclude:
- return member
- return None
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLTextures.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLTextures.py
deleted file mode 100644
index d1fb55e..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLTextures.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Gtk
-#
-
-from GUI.GGLTextures import Texture as GTexture
-
-class Texture(GTexture):
-
- def _gl_get_texture_data(self, image):
- raise NotImplementedError("Loading texture from image not yet implemented for Gtk")
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLabels.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLabels.py
deleted file mode 100644
index db84870..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GLabels.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Python GUI - Labels - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-
-class Label(Control):
- """A piece of static text for labelling items in a window."""
-
- _default_tab_stop = False
-
- text = overridable_property('text')
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GListButtons.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GListButtons.py
deleted file mode 100644
index a811401..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GListButtons.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - Pop-up list control - Generic
-#
-#--------------------------------------------------------------
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control, application
-
-class ListButton(Control, Action):
- """A button that displays a value and provides a pop-up or
- pull-down list of choices."""
-
- titles = overridable_property('titles',
- "List of item title strings")
-
- values = overridable_property('values',
- "List of values corresponding to tiles, or None to use item index as value")
-
- def _extract_initial_items(self, kwds):
- titles = kwds.pop('titles', None) or []
- values = kwds.pop('values', None)
- return titles, values
-
- def get_titles(self):
- return self._titles
-
- def set_titles(self, x):
- self._titles = x
- self._update_items()
-
- def get_values(self):
- return self._values
-
- def set_values(self, x):
- self._values = x
-
- def get_value(self):
- i = self._get_selected_index()
- if i >= 0:
- values = self.values
- if values:
- return values[i]
- else:
- return i
-
- def set_value(self, value):
- values = self.values
- if values:
- try:
- i = values.index(value)
- except ValueError:
- i = -1
- else:
- if value is None:
- i = -1
- else:
- i = value
- self._set_selected_index(i)
-
- def do_action(self):
- try:
- Action.do_action(self)
- except:
- application().report_error()
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GMenus.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GMenus.py
deleted file mode 100644
index 13fd7ef..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GMenus.py
+++ /dev/null
@@ -1,335 +0,0 @@
-#----------------------------------------------------------------------
-#
-# Python GUI - Menus - Generic
-#
-#----------------------------------------------------------------------
-
-from GUI import Globals
-from GUI.Properties import Properties, overridable_property
-
-#----------------------------------------------------------------------
-
-def search_list_for_key(items, char, shift, option):
- for i in xrange(len(items)-1, -1, -1):
- result = items[i]._search_for_key(char, shift, option)
- if result:
- return result
-
-#----------------------------------------------------------------------
-
-class Menu(Properties):
- """Pull-down or pop-up menu class.
-
- Menu(title, item_descriptors)
- constructs a menu with the given title and items. Each
- item_descriptor is of the form
-
- "-"
-
- for a separator,
-
- ("text/key", 'command_name')
-
- for a single menu item, or
-
- (["text/key", ...], 'command_name')
-
- for an indexed item group. An indexed group is a group
- of items sharing the same command name and distinguished
- by an integer index. Items can be added to and removed
- from the group dynamically, to implement e.g. a font
- menu or windows menu.
-
- The "key" part of the item descriptor (which is optional)
- specifies the keyboard equivalent. It should consist of
- a single character together with the following optional
- modifiers:
-
- ^ representing the Shift key
- @ representing the Alt or Option key
- """
-
- title = overridable_property('title', "Title string appearing in menu bar")
- special = overridable_property('special', "Menu appears at right end of menu bar")
-
- _flat_items = None
-
- def __init__(self, title, items, special = False, substitutions = {}, **kwds):
- self._title = title
- self._items = []
- self._special = special
- Properties.__init__(self, **kwds)
- self.extend(items, substitutions)
-
- def get_title(self):
- return self._title
-
- def get_special(self):
- return self._special
-
- def item_with_command(self, cmd):
- for item in self._items:
- if item._command_name == cmd:
- return item
- return None
-
- def append(self, item, substitutions = {}):
- items = self._items
- item = self._make_item(item, substitutions)
- if not (items and isinstance(item, MenuSeparator)
- and isinstance(items[-1], MenuSeparator)):
- items.append(item)
-
- def extend(self, items, substitutions = {}):
- for item in items:
- self.append(item, substitutions)
-
- def _make_item(self, item, substitutions):
- if isinstance(item, MenuItem):
- return item
- elif item == "-":
- return _menu_separator
- else:
- (text, cmd) = item
- if isinstance(text, basestring):
- return SingleMenuItem(text, cmd, substitutions)
- else:
- return MenuItemGroup(text, cmd)
-
- def _command_and_args_for_item(self, item_num):
- i = 1
- for item in self._items:
- n = item._num_subitems()
- if item_num < i + n:
- return item._command_and_args_for_subitem(item_num - i)
- i += n
- return '', ()
-
- def _update_platform_menu(self):
- # Called during menu setup after items have been enabled/checked.
- # Generic implementation rebuilds the whole menu from scratch.
- # Implementations may override this to be more elegant.
- self._rebuild_platform_menu()
-
- def _rebuild_platform_menu(self):
- self._clear_platform_menu()
- for item in self._items:
- item._add_to_platform_menu(self)
-
- def _search_for_key(self, char, shift, option):
- return search_list_for_key(self._items, char, shift, option)
-
- def _get_flat_items(self):
- flat = self._flat_items
- if flat is None:
- flat = []
- for item in self._items:
- item._collect_flat_items(flat)
- self._flat_items = flat
- return flat
-
- def _get_flat_item(self, i):
- return self._get_flat_items()[i]
-
-#----------------------------------------------------------------------
-
-class MenuItem(Properties):
- # Internal class representing a menu item, group or separator.
- #
- # _command_name string Internal command name
-
- def _num_subitems(self):
- return 1
-
- def _split_text(self, text):
- # Split menu text into label and key combination.
- if "/" in text:
- return text.split("/")
- else:
- return text, ""
-
- def _name(self):
- return self._label.replace("", Globals.application_name)
-
- def _collect_flat_items(self, result):
- result.append(self)
-
-#----------------------------------------------------------------------
-
-class MenuSeparator(MenuItem):
- # Internal class representing a menu separator.
-
- _command_name = ''
-
- def _add_to_platform_menu(self, menu):
- menu._add_separator_to_platform_menu()
-
- def _search_for_key(self, char, shift, option):
- pass
-
-#----------------------------------------------------------------------
-
-class SingleMenuItem(MenuItem):
- """Class representing a menu item.
-
- Properties:
- enabled boolean
- checked boolean
- """
-
- enabled = 0
- checked = 0
- _key = None
- _shift = 0
- _option = 0
- #_index = None
-
- def __init__(self, text, cmd, substitutions = {}):
- label1, keycomb1 = self._split_text(text)
- label2, keycomb2 = self._split_text(substitutions.get(cmd, ""))
- self._label = label2 or label1
- keycomb = keycomb2 or keycomb1
- for c in keycomb:
- if c == '^':
- self._shift = 1
- elif c == '@':
- self._option = 1
- else:
- self._key = c.upper()
- self._command_name = cmd
-
- def __str__(self):
- return "" % (
- self._label, self._key, self._shift, self._option, self.enabled)
-
- def _add_to_platform_menu(self, menu):
- menu._add_item_to_platform_menu(self, self._name(), self._command_name)
-
- def _command_and_args_for_subitem(self, i):
- return self._command_name, ()
-
- def _search_for_key(self, char, shift, option):
- if self._matches_key(char, shift, option):
- return self._command_name
-
- def _matches_key(self, char, shift, option):
- return self._key == char and self._shift == shift \
- and self._option == option and self.enabled
-
-#----------------------------------------------------------------------
-
-class MenuItemGroup(MenuItem):
- """Class representing a menu item group.
-
- Properties:
- enabled <- boolean Assigning to these changes the corresponding
- checked <- boolean property of all the group's items.
-
- Operators:
- group[index] -> MenuItem
-
- Methods:
- set_items(["text/key", ...])
- Replaces all the items in the group by the specified items.
- """
-
- enabled = overridable_property('enabled')
- checked = overridable_property('checked')
-
- def __init__(self, text_list, cmd):
- self.set_items(text_list)
- self._command_name = cmd
-
- def _num_subitems(self):
- return len(self._items)
-
- def _command_and_args_for_subitem(self, i):
- return self._command_name, (i,)
-
- def get_enabled(self):
- raise AttributeError("'enabled' property of MenuItemGroup is write-only")
-
- def set_enabled(self, state):
- for item in self._items:
- item.enabled = state
-
- def get_checked(self):
- raise AttributeError("'checked' property of MenuItemGroup is write-only")
-
- def set_checked(self, state):
- for item in self._items:
- item.checked = state
-
- def __getitem__(self, index):
- return self._items[index]
-
- def set_items(self, text_list):
- self._items = [SingleMenuItem(text, '') for text in text_list]
-
- def _add_to_platform_menu(self, menu):
- #for item in self._items:
- # item._add_to_platform_menu(menu)
- cmd = self._command_name
- for index, item in enumerate(self._items):
- menu._add_item_to_platform_menu(item, item._name(), cmd, index)
-
- def _search_for_key(self, char, shift, option):
- items = self._items
- for i in xrange(len(items)-1, -1, -1):
- if items[i]._matches_key(char, shift, option):
- return (self._command_name, i)
-
- def _collect_flat_items(self, result):
- for item in self._items:
- item._collect_flat_items(result)
-
-#----------------------------------------------------------------------
-
-_menu_separator = MenuSeparator()
-_dummy_menu_item = SingleMenuItem("", '')
-
-#----------------------------------------------------------------------
-
-class MenuState:
- """A MenuState object is used to enable/disable and check/uncheck
- menu items, and to add or remove items of indexed groups,
- during the menu setup phase of menu command handling.
-
- Each single menu item or item group appears as an attribute of
- the MenuState object, with the command name as the attribute name,
- allowing operations such as
-
- menu_state.copy_cmd.enabled = 1
- menu_state.font_cmd[current_font].checked = 1
-
- The command name may also be used as a mapping index.
-
- Operators:
- menu_state.command_name -> MenuItem
- menu_state['command_name'] -> MenuItem
- """
-
- def __init__(self, menu_list):
- mapping = {}
- for menu in menu_list:
- for item in menu._items:
- cmd = item._command_name
- if cmd:
- mapping[cmd] = item
- self._mapping = mapping
-
- def __getattr__(self, name):
- try:
- return self._mapping[name]
- except KeyError:
- if name.startswith("__"):
- raise AttributeError, name
- return _dummy_menu_item
-
- __getitem__ = __getattr__
-
- def reset(self):
- """Disable and uncheck all items."""
- for item in self._mapping.values():
- item.enabled = 0
- item.checked = None
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GMouseTrackers.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GMouseTrackers.py
deleted file mode 100644
index 6644dba..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GMouseTrackers.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Python GUI - Mouse trackers - Generic
-#
-
-from GUI import application
-
-class MouseTracker(object):
- """Iterator used to track movements of the mouse following a mouse_down
- event in a Views. Each call to the next() method returns a mouse_drag
- event, except for the last one, which returns a mouse_up event."""
-
- def __init__(self, view):
- self._view = view
- self._finished = 0
-
- def __iter__(self):
- return self
-
- def next(self):
- if not self._finished:
- event = self._next_mouse_event()
- event.position = event.position_in(self._view)
- if event.kind == 'mouse_up':
- self._finished = 1
- return event
- else:
- raise StopIteration
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GPixmaps.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GPixmaps.py
deleted file mode 100644
index af13c33..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GPixmaps.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Python GUI - Pixmap - Generic
-#
-
-from GUI import ImageBase
-
-class Pixmap(ImageBase):
- """A Pixmap is an offscreen area that can be used both as a
- destination for drawing and a source of image data for drawing
- in a View or another Pixmap.
-
- Constructor:
- Pixmap(width, height)
- """
-
- def with_canvas(self, proc):
- """Call the given procedure with a canvas suitable for drawing on
- this Pixmap. The canvas is valid only for the duration of the call,
- and should not be retained beyond it."""
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GPrinting.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GPrinting.py
deleted file mode 100644
index 28b8ea2..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GPrinting.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Generic
-#
-#------------------------------------------------------------------------------
-
-from __future__ import division
-from math import ceil
-import cPickle as pickle
-from GUI.Properties import overridable_property
-from GUI import application
-
-class PageSetup(object):
- """Holder of information specified by the "Page Setup" command."""
-
- paper_name = overridable_property('paper_name')
- paper_width = overridable_property('paper_width')
- paper_height = overridable_property('paper_height')
- left_margin = overridable_property('left_margin')
- top_margin = overridable_property('top_margin')
- right_margin = overridable_property('right_margin')
- bottom_margin = overridable_property('bottom_margin')
- orientation = overridable_property('orientation')
-
- paper_size = overridable_property('paper_size')
- margins = overridable_property('margins')
- page_width = overridable_property('page_width')
- page_height = overridable_property('page_height')
- page_size = overridable_property('page_size')
- page_rect = overridable_property('page_rect')
- printable_rect = overridable_property('printable_rect') # May not work
- printer_name = overridable_property('printer_name')
-
- _pickle_attributes = ['paper_name', 'paper_size', 'margins',
- 'printer_name', 'orientation']
-
- def __getstate__(self):
- state = {}
- for name in self._pickle_attributes:
- state[name] = getattr(self, name)
- return state
-
- def __setstate__(self, state):
- for name, value in state.iteritems():
- setattr(self, name, value)
-
- def from_string(s):
- """Restore a pickled PageSetup object from a string."""
- return pickle.loads(s)
-
- from_string = staticmethod(from_string)
-
- def to_string(self):
- """Pickle the PageSetup object and return it as a string."""
- return pickle.dumps(self, 2)
-
- def get_paper_size(self):
- return self.paper_width, self.paper_height
-
- def set_paper_size(self, x):
- self.paper_width, self.paper_height = x
-
- def get_margins(self):
- return self.left_margin, self.top_margin, self.right_margin, self.bottom_margin
-
- def set_margins(self, x):
- self.left_margin, self.top_margin, self.right_margin, self.bottom_margin = x
-
- def get_page_width(self):
- return self.paper_width - self.left_margin - self.right_margin
-
- def get_page_height(self):
- return self.paper_height - self.top_margin - self.bottom_margin
-
- def get_page_size(self):
- return (self.page_width, self.page_height)
-
- def get_page_rect(self):
- lm, tm, rm, bm = self.margins
- pw, ph = self.paper_size
- return (lm, tm, pw - rm, ph - bm)
-
-#------------------------------------------------------------------------------
-
-class Printable(object):
- """Mixin class for components implementing the "Print" command."""
-
- printable = overridable_property('printable', "Whether this component should handle the 'Print' command.")
- page_setup = overridable_property('page_setup', "The PageSetup object to use for printing.")
- print_title = overridable_property('print_title', "Title for print job.")
-
- _printable = True
-
- def get_printable(self):
- return self._printable
-
- def set_printable(self, x):
- self._printable = x
-
- def get_print_title(self):
- window = self.window
- if window:
- return window.title
- else:
- return ""
-
- def get_page_setup(self):
- result = None
- model = getattr(self, 'model', None)
- if model:
- result = getattr(model, 'page_setup', None)
- if not result:
- result = application().page_setup
- return result
-
- def setup_menus(self, m):
- if self.printable:
- m.print_cmd.enabled = True
-
- def print_cmd(self):
- if self.printable:
- page_setup = self.page_setup
- if page_setup:
- self.print_view(page_setup)
- else:
- self.pass_to_next_handler('print_cmd')
-
-#------------------------------------------------------------------------------
-
-class Paginator(object):
- """Used internally. A generic pagination algorithm for printing."""
-
- def __init__(self, view, page_setup):
- self.view = view
- extent_width, extent_height = view.get_print_extent()
- #paper_width, paper_height = page_setup.paper_size
- #lm, tm, rm, bm = page_setup.margins
- #page_width = int(paper_width - lm - rm)
- #page_height = int(paper_height - tm - bm)
- page_width, page_height = page_setup.page_size
- if page_width <= 0 or page_height <= 0:
- from AlertFunctions import stop_alert
- stop_alert("Margins are too large for the page size.")
- return
- self.extent_rect = (0, 0, extent_width, extent_height)
- self.page_width = page_width
- self.page_height = page_height
- self.left_margin = page_setup.left_margin
- self.top_margin = page_setup.top_margin
- self.pages_wide = int(ceil(extent_width / page_width))
- self.pages_high = int(ceil(extent_height / page_height))
- self.num_pages = self.pages_wide * self.pages_high
-
- def draw_page(self, canvas, page_num):
- row, col = divmod(page_num, self.pages_wide)
- view_left = col * self.page_width
- view_top = row * self.page_height
- view_right = view_left + self.page_width
- view_bottom = view_top + self.page_height
- view_rect = (view_left, view_top, view_right, view_bottom)
- dx = self.left_margin - view_left
- dy = self.top_margin - view_top
- canvas.translate(dx, dy)
- canvas.rectclip(self.extent_rect)
- canvas.rectclip(view_rect)
- canvas._printing = True
- self.view.draw(canvas, view_rect)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GRadioButtons.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GRadioButtons.py
deleted file mode 100644
index 952f6d0..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GRadioButtons.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Python GUI - Radio buttons - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-
-class RadioButton(Control):
- """RadioButtons are used in groups to represent a 1-of-N
- choice. A group of RadioButtons is coordinated by a
- RadioGroup object. The 'group' property indicates the
- RadioGroup to which it belongs, and the 'value' property
- is the value to which the RadioGroup's value is set
- when this RadioButton is selected."""
-
- group = overridable_property('group', """The RadioGroup to
- which this radio button belongs.""")
-
- value = overridable_property('value', """The value to which
- the associated radio group's 'value' property should be
- set when this radio button is selected.""")
-
- _group = None
- _value = None
-
- #
- # Properties
- #
-
- def get_group(self):
- return self._group
-
- def set_group(self, new_group):
- old_group = self._group
- if new_group is not old_group:
- if old_group:
- old_group._remove_item(self)
- self._group = new_group
- if new_group:
- new_group._add_item(self)
-
- def get_value(self):
- return self._value
-
- def set_value(self, new_value):
- old_value = self._value
- if new_value != old_value:
- self._value = new_value
- self._value_changed()
-
- def _value_changed(self):
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GRadioGroups.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GRadioGroups.py
deleted file mode 100644
index a6fd792..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GRadioGroups.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# Python GUI - Radio groups - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-from GUI.Actions import Action
-
-class RadioGroup(Properties, Action):
- """A RadioGroup coordinates a group of RadioButtons.
- It has a 'value' property which is equal to the value
- of the currently selected RadioButton. It may be given
- an action procedure to execute when its value changes.
-
- Operations:
- iter(group)
- Returns an iterator over the items of the group.
- """
-
- value = overridable_property('value', """The value of the currently
- selected radio button.""")
-
- _items = None
- _value = None
-
- def __init__(self, items = [], **kwds):
- Properties.__init__(self, **kwds)
- self._items = []
- self.add_items(items)
-
- #
- # Operations
- #
-
- def __iter__(self):
- return iter(self._items)
-
- #
- # Properties
- #
-
- def get_value(self):
- return self._value
-
- def set_value(self, x):
- if self._value <> x:
- self._value = x
- self._value_changed()
- self.do_action()
-
- #
- # Adding and removing items
- #
-
- def add_items(self, items):
- "Add a sequence of RadioButtons to this group."
- for item in items:
- self.add_item(item)
-
- def add_item(self, item):
- "Add a RadioButton to this group."
- item.group = self
-
- def remove_items(self, items):
- "Remove a sequence of RadioButtons from this group."
- for item in items:
- item.group = None
-
- def remove_item(self, item):
- "Remove a RadioButton from this group."
- item.group = None
-
- def _add_item(self, item):
- self._items.append(item)
- self._item_added(item)
-
- def _remove_item(self, item):
- self._items.remove(item)
- self._item_removed(item)
-
- def _item_added(self, item):
- raise NotImplementedError
-
- def _item_removed(self, item):
- raise NotImplementedError
-
- def _value_changed(self):
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GScrollableViews.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GScrollableViews.py
deleted file mode 100644
index a23f442..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GScrollableViews.py
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# Python GUI - Scrollable Views - Generic
-#
-
-from GUI.Geometry import rect_sized, add_pt, sub_pt
-from GUI.Properties import overridable_property
-from GUI.Geometry import sect_rect
-from GUI import DrawableContainer
-
-default_extent = (300, 300)
-default_line_scroll_amount = (16, 16)
-default_scrolling = 'hv'
-
-class ScrollableView(DrawableContainer):
- """A ScrollableView is a 2D drawing area having its own coordinate
- system and clipping area, with support for scrolling."""
-
- scrolling = overridable_property('scrolling',
- "String containing 'h' for horizontal and 'v' for vertical scrolling.")
-
- hscrolling = overridable_property('hscrolling',
- "True if horizontal scrolling is enabled.")
-
- vscrolling = overridable_property('vscrolling',
- "True if vertical scrolling is enabled.")
-
- extent = overridable_property('extent',
- "Size of scrollable area in local coordinates.")
-
- scroll_offset = overridable_property('scroll_offset',
- "Current scrolling position.")
-
- line_scroll_amount = overridable_property('line_scroll_amount',
- "Tuple specifying horizontal and vertical line scrolling increments.")
-
- background_color = overridable_property('background_color',
- "Color with which to fill areas outside the extent, or None")
-
- #scroll_bars = overridable_property('scroll_bars',
- # "Attached ScrollBar instances.")
- #
- ## _scroll_bars [ScrollBar]
-
- def set(self, **kwds):
- if 'scrolling' in kwds:
- self.scrolling = kwds.pop('scrolling')
- DrawableContainer.set(self, **kwds)
-
- def get_scrolling(self):
- chars = []
- if self.hscrolling:
- chars.append('h')
- if self.vscrolling:
- chars.append('v')
- return ''.join(chars)
-
- def set_scrolling(self, value):
- self.hscrolling = 'h' in value
- self.vscrolling = 'v' in value
-
- def viewed_rect(self):
- """Return the rectangle in local coordinates bounding the currently
- visible part of the extent."""
- return rect_sized(self.scroll_offset, self.size)
-
- def get_print_extent(self):
- return self.extent
-
- def get_background_color(self):
- return self._background_color
-
- def set_background_color(self, x):
- self._background_color = x
- self.invalidate()
-
- #
- # Coordinate transformation
- #
-
- def local_to_container_offset(self):
- return sub_pt(self.position, self.scroll_offset)
-
- #
- # Scrolling
- #
-
- def h_line_scroll_amount(self):
- """Return the horizontal line scroll increment."""
- return self.line_scroll_amount[0]
-
- def v_line_scroll_amount(self):
- """Return the vertical line scroll increment."""
- return self.line_scroll_amount[1]
-
- def h_page_scroll_amount(self):
- """Return the horizontal page scroll increment."""
- return self.width - self.h_line_scroll_amount()
-
- def v_page_scroll_amount(self):
- """Return the vertical page scroll increment."""
- return self.height - self.v_line_scroll_amount()
-
- def scroll_by(self, dx, dy):
- """Scroll by the given amount horizontally and vertically."""
- self.scroll_offset = add_pt(self.scroll_offset, (dx, dy))
-
- def scroll_line_left(self):
- """Called by horizontal scroll bar to scroll left by one line."""
- self.scroll_by(-self.h_line_scroll_amount(), 0)
-
- def scroll_line_right(self):
- """Called by horizontal scroll bar to scroll right by one line."""
- self.scroll_by(self.h_line_scroll_amount(), 0)
-
- def scroll_line_up(self):
- """Called by vertical scroll bar to scroll up by one line."""
- self.scroll_by(0, -self.v_line_scroll_amount())
-
- def scroll_line_down(self):
- """Called by vertical scroll bar to scroll down by one line."""
- self.scroll_by(0, self.v_line_scroll_amount())
-
- def scroll_page_left(self):
- """Called by horizontal scroll bar to scroll left by one page."""
- self.scroll_by(-self.h_page_scroll_amount(), 0)
-
- def scroll_page_right(self):
- """Called by horizontal scroll bar to scroll right by one page."""
- self.scroll_by(self.h_page_scroll_amount(), 0)
-
- def scroll_page_up(self):
- """Called by vertical scroll bar to scroll up by one page."""
- self.scroll_by(0, -self.v_page_scroll_amount())
-
- def scroll_page_down(self):
- """Called by vertical scroll bar to scroll down by one page."""
- self.scroll_by(0, self.v_page_scroll_amount())
-
- #
- # Background drawing
- #
-
- def _draw_background(self, canvas, clip_rect):
- # If the view has a background color, uses it to fill the parts of the
- # clip_rect that are outside the view's extent and returns the remaining
- # rectangle. Otherwise, returns the clip_rect unchanged.
- color = self._background_color
- if color:
- vl, vt, vr, vb = clip_rect
- ew, eh = self.extent
- if vr > ew or vb > eh:
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: old backcolor =", canvas.backcolor ###
- canvas.gsave()
- canvas.backcolor = color
- if ew < vr:
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: erasing", (ew, vt, vr, vb) ###
- canvas.erase_rect((ew, vt, vr, vb))
- if eh < vb:
- if getattr(self, "_debug_bg", False): ###
- print "ScrollableView: erasing", (vl, eh, ew, vb) ###
- canvas.erase_rect((vl, eh, ew, vb))
- canvas.grestore()
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: restored backcolor =", canvas.backcolor ###
- return sect_rect(clip_rect, (0, 0, ew, eh))
- return clip_rect
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GSliders.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GSliders.py
deleted file mode 100644
index a1a9822..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GSliders.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Python GUI - Slider - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control
-
-class Slider(Control, Action):
- """A control for entering a value by moving a knob along a scale.
-
- Constructor:
- Slider(orient)
- where orient = 'h' for horizontal or 'v' for vertical.
- """
-
- _default_length = 100
-
- value = overridable_property('value', "The current value of the control")
- min_value = overridable_property('min_value', "Minimum value of the control")
- max_value = overridable_property('max_value', "Maximum value of the control")
- range = overridable_property('range', "Tuple (min_value, max_value)")
- ticks = overridable_property('ticks', "Number of tick marks")
- discrete = overridable_property('discrete', "Whether to constrain value to ticks")
- live = overridable_property('live', "Whether to invoke action continuously while dragging")
-
- def get_range(self):
- return (self.min_value, self.max_value)
-
- def set_range(self, x):
- self.min_value = x[0]
- self.max_value = x[1]
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GStdMenus.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GStdMenus.py
deleted file mode 100644
index 005984a..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GStdMenus.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#-------------------------------------------------------------------------------
-#
-# PyGUI - Standard Menus - Generic
-#
-#-------------------------------------------------------------------------------
-
-from GUI.Compatibility import set
-from GUI import Menu
-from GUI import MenuList
-
-#-------------------------------------------------------------------------------
-
-class CommandSet(set):
- """A set of menu command names.
-
- Constructors:
- CommandSet(string)
- CommandSet(sequence of strings)
-
- Operations:
- string in CommandSet
- CommandSet + x
- CommmandSet - x
- x + CommandSet
- x - CommandSet
- CommandSet += x
- CommandSet -= x
- where x is a CommandSet, a string or a sequence of strings
- """
-
- def __init__(self, arg = None):
- if arg:
- if isinstance(arg, basestring):
- arg = [arg]
- set.__init__(self, arg)
-
- def __or__(self, other):
- return set.__or__(self, as_command_set(other))
-
- __ror__ = __add__ = __radd__ = __or__
-
- def __ior__(self, other):
- return set.__ior__(self, as_command_set(other))
-
- __iadd__ = __ior__
-
- def __sub__(self, other):
- return set.__sub__(self, as_command_set(other))
-
- def __rsub__(self, other):
- return as_command_set(other) - self
-
- def __isub__(self, other):
- return set.__isub__(self, as_command_set(other))
-
-#-------------------------------------------------------------------------------
-
-def as_command_set(x):
- if not isinstance(x, CommandSet):
- if isinstance(x, basestring):
- x = [x]
- x = CommandSet(x)
- return x
-
-def filter_menu_items(items, include):
- result = []
- sep = False
- for item in items:
- if item == "-":
- sep = True
- elif item[1] in include:
- if sep:
- result.append("-")
- sep = False
- result.append(item)
- return result
-
-def build_menus(spec_list, substitutions = {}, include = None, exclude = None):
- if include is None:
- include = sum(default_includes)
- include = include + sum(always_include)
- if exclude is not None:
- include = include - exclude
- menus = []
- for title, items, special in spec_list:
- items = filter_menu_items(items, include)
- if items:
- menus.append(Menu(title, items, special = special, substitutions = substitutions))
- return MenuList(menus)
-
-#-------------------------------------------------------------------------------
-
-fundamental_cmds = CommandSet(['quit_cmd'])
-help_cmds = CommandSet(['about_cmd', 'help_cmd'])
-pref_cmds = CommandSet(['preferences_cmd'])
-file_cmds = CommandSet(['new_cmd', 'open_cmd', 'close_cmd', 'save_cmd', 'save_as_cmd', 'revert_cmd'])
-print_cmds = CommandSet(['page_setup_cmd', 'print_cmd'])
-edit_cmds = CommandSet(['undo_cmd', 'redo_cmd', 'cut_cmd', 'copy_cmd', 'paste_cmd', 'clear_cmd', 'select_all_cmd'])
-
-always_include = [fundamental_cmds, edit_cmds]
-default_includes = [help_cmds, pref_cmds, file_cmds, print_cmds]
-
-#-------------------------------------------------------------------------------
-
-if __name__ == "__main__":
- s1 = CommandSet('a')
- print "s1 =", s1
- s2 = CommandSet(['a', 'b'])
- print "s2 =", s2
- s3 = s2 + 'c'
- print "s3 =", s3
- s4 = 'd' + s3
- print "s4 =", s4
- s5 = s4 - 'b'
- print "s5 =", s5
- s6 = ['a', 'b', 'c', 'd', 'e', 'f'] - s5
- print "s6 =", s6
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTasks.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTasks.py
deleted file mode 100644
index 2582c77..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTasks.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# PyGUI - Tasks - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class Task(Properties):
- """A Task represents an action to be performed after a specified
- time interval, either once or repeatedly.
-
- Constructor:
- Task(proc, interval, repeat = False, start = True)
- Creates a task to call the given proc, which should be
- a callable object of no arguments, after the specified
- interval in seconds from the time the task is scheduled.
- If repeat is true, the task will be automatically re-scheduled
- each time the proc is called. If start is true, the task will be
- automatically scheduled upon creation; otherwise the start()
- method must be called to schedule the task.
- """
-
- interval = overridable_property('interval', "Time in seconds between firings")
- repeat = overridable_property('repeat', "Whether to fire repeatedly or once only")
-
- def __del__(self):
- self.stop()
-
- scheduled = overridable_property('scheduled',
- "True if the task is currently scheduled. Read-only.")
-
- def start(self):
- """Schedule the task if it is not already scheduled."""
- raise NotImplementedError("GUI.Task.start")
-
- def stop(self):
- """Unschedules the task if it is currently scheduled."""
- raise NotImplementedError("GUI.Task.stop")
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTextEditors.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTextEditors.py
deleted file mode 100644
index 58ec145..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTextEditors.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Python GUI - Text Editor - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Component
-from GUI import EditCmdHandler
-from GUI.Printing import Printable
-
-class TextEditor(Component, EditCmdHandler, Printable):
- """A component for editing substantial amounts of text. The text is
- kept internally to the component and cannot be shared between views."""
-
- text = overridable_property('text', "The contents as a string.")
- text_length = overridable_property('text_length', "Number of characters in the text.")
- selection = overridable_property('selection', "Range of text selected.")
- font = overridable_property('font')
- tab_spacing = overridable_property('tab_spacing', "Distance between tab stops")
-
- def setup_menus(self, m):
- Component.setup_menus(self, m)
- EditCmdHandler.setup_menus(self, m)
- Printable.setup_menus(self, m)
-
- def key_down(self, e):
- if e.key == 'enter':
- self.pass_to_next_handler('key_down', e)
- else:
- Component.key_down(self, e)
-
- def print_view(self, page_setup):
- from TextEditorPrinting import TextEditorPrintView
- view = TextEditorPrintView(self, page_setup)
- view.print_view(page_setup)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTextFields.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTextFields.py
deleted file mode 100644
index 8314920..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GTextFields.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# Python GUI - Text fields - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import ActionBase, action_property
-from GUI import application
-from GUI import Control
-from GUI import EditCmdHandler
-
-class TextField(Control, ActionBase, EditCmdHandler):
- """A control for entering and editing small amounts of text."""
-
- text = overridable_property('text')
- selection = overridable_property('selection', "Range of text selected.")
- multiline = overridable_property('multiline', "Multiple text lines allowed.")
- password = overridable_property('password', "Display characters obfuscated.")
- enter_action = action_property('enter_action', "Action to be performed "
- "when the Return or Enter key is pressed.")
- escape_action = action_property('escape_action', "Action to be performed "
- "when the Escape key is pressed.")
-
- _may_be_password = True
-
- #_tabbable = True
- _default_tab_stop = True
- _user_tab_stop_override = False
- _enter_action = 'do_default_action'
- _escape_action = 'do_cancel_action'
-
- _intercept_tab_key = True
-
- def __init__(self, **kwds):
- self._multiline = kwds.pop('multiline')
- Control.__init__(self, **kwds)
-
- def get_multiline(self):
- return self._multiline
-
- def key_down(self, event):
- #print "GTextField.key_down for", self ###
- c = event.char
- if c == '\r':
- if event.key == 'enter' or not self._multiline:
- self.do_enter_action()
- return
- if c == '\x1b':
- self.do_escape_action()
- return
- if c == '\t':
- if self._intercept_tab_key:
- self.pass_event_to_next_handler(event)
- return
- Control.key_down(self, event)
-
- def setup_menus(self, m):
- Control.setup_menus(self, m)
- EditCmdHandler.setup_menus(self, m)
-
- def do_enter_action(self):
- self.do_named_action('enter_action')
-
- def do_escape_action(self):
- self.do_named_action('escape_action')
-
- def get_text_length(self):
- # Implementations can override this if they have a more
- # efficient way of getting the text length.
- return len(self.text)
-
- def get_value(self):
- return self.text
-
- def set_value(self, x):
- self.text = x
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GUtils.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GUtils.py
deleted file mode 100644
index 768eab7..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GUtils.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Utilities - Generic
-#
-#--------------------------------------------------------------------------
-
-def splitdict(src, *names, **defaults):
- result = {}
- for name in names:
- if name in src:
- result[name] = src.pop(name)
- for name, default in defaults.iteritems():
- result[name] = src.pop(name, default)
- return result
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GViewBases.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GViewBases.py
deleted file mode 100644
index 0274840..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GViewBases.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#
-# Python GUI - View Base - Generic
-#
-
-from GUI.Properties import overridable_property
-
-class ViewBase(object):
- """ViewBase is an abstract base class for user-defined views.
- It provides facilities for handling mouse and keyboard events
- and associating the view with one or more models, and default
- behaviour for responding to changes in the models."""
-
- models = overridable_property('models',
- "List of Models being observed. Do not modify directly.")
-
- model = overridable_property('model',
- "Convenience property for views which observe only one Model.")
-
- cursor = overridable_property('cursor',
- "The cursor to display over the view.")
-
- # _models [Model]
-
- _cursor = None
-
- def __init__(self):
- self._models = []
-
- def destroy(self):
- #print "GViewBase.destroy:", self ###
- for m in self._models[:]:
- #print "GViewBase.destroy: removing model", m ###
- self.remove_model(m)
-
- def setup_menus(self, m):
- pass
-
- #
- # Getting properties
- #
-
- def get_model(self):
- models = self._models
- if models:
- return self._models[0]
- else:
- return None
-
- def get_models(self):
- return self._models
-
- #
- # Setting properties
- #
-
- def set_model(self, new_model):
- models = self._models
- if not (len(models) == 1 and models[0] == new_model):
- for old_model in models[:]:
- self.remove_model(old_model)
- if new_model:
- self.add_model(new_model)
-
- #
- # Model association
- #
-
- def add_model(self, model):
- """Add the given Model to the set of models being observed."""
- if model not in self._models:
- self._models.append(model)
- model.add_view(self)
- self.model_added(model)
-
- def remove_model(self, model):
- """Remove the given Model from the set of models being observed."""
- if model in self._models:
- self._models.remove(model)
- model.remove_view(self)
- self.model_removed(model)
-
- def model_added(self, model):
- """Called after a model has been added to the view."""
- pass
-
- def model_removed(self, model):
- """Called after a model has been removed from the view."""
- pass
-
- #
- # Input event handling
- #
-
- def track_mouse(self):
- """Following a mouse_down event, returns an iterator which can be used
- to track the movements of the mouse until the mouse is released.
- Each call to the iterator's next() method returns a mouse_drag
- event, except for the last one, which returns a mouse_up event."""
- raise NotImplementedError
-
- def targeted(self):
- """Called when the component becomes the target within its Window."""
- pass
-
- def untargeted(self):
- """Called when the component ceases to be the target within its Window."""
- pass
-
- #
- # Cursors
- #
-
- def get_cursor(self, x):
- return self._cursor
-
- def set_cursor(self, x):
- self._cursor = x
- self._cursor_changed()
-
- #
- # Callbacks
- #
-
- def model_changed(self, model, *args, **kwds):
- """Default method called by the attached Model's notify_views
- method. Default is to invalidate the whole view."""
- self.invalidate()
-
- def model_destroyed(self, model):
- """Called when an attached model is destroyed. Default is to
- destroy the window containing this view."""
- win = self.window
- if win:
- win.destroy()
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GViews.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GViews.py
deleted file mode 100644
index 87e136c..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GViews.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Python GUI - Views - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Geometry import add_pt, sub_pt, rect_sized
-from GUI import DrawableContainer
-
-class View(DrawableContainer):
- """A View is a 2D drawing area having its own coordinate
- system and clipping area."""
-
- _default_size = (100, 100)
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GWindows.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GWindows.py
deleted file mode 100644
index cf03f79..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GWindows.py
+++ /dev/null
@@ -1,257 +0,0 @@
-#
-# Python GUI - Windows - Generic
-#
-
-import Exceptions
-from GUI.Properties import overridable_property
-from GUI import Container
-from GUI import application
-
-class Window(Container):
- """Top-level Container."""
-
- menus = overridable_property('menus', "Menus to be available when this window is active.")
- document = overridable_property('document', "Document with which this window is associated.")
- title = overridable_property('title', "Title of the window.")
- auto_position = overridable_property('auto_position', "Whether to position automatically when first shown.")
- target = overridable_property('target', "Current target for key events and menu messages.")
- tab_chain = overridable_property('tab_chain', "List of subcomponents in tabbing order.")
- visible = overridable_property('visible', "Whether the window is currently shown.")
-
- keeps_document_open = True
-
- _default_width = 200
- _default_height = 200
- _modal_styles = ('modal_dialog', 'alert')
- _dialog_styles = ('nonmodal_dialog', 'modal_dialog', 'alert')
-
- _menus = []
- _document = None
- _closable = 0
- _auto_position = True
- _tab_chain = None
-
- def __init__(self, style = 'standard', closable = None, **kwds):
- if closable is None:
- raise Exceptions.InternalError(
- "'closable' parameter unspecified in call to generic Window.__init__")
- Container.__init__(self, **kwds)
- self._style = style
- self._dialog_style = style.find('dialog') >= 0
- self._closable = closable
- application()._add_window(self)
-
- def destroy(self):
- """Detaches the window from document and application and removes it
- from the screen."""
- self.set_document(None)
- application()._remove_window(self)
- Container.destroy(self)
-
- #
- # Message handling
- #
-
- def next_handler(self):
- if self._document:
- return self._document
- else:
- return application()
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
- #
- # Menus
- #
-
- def get_menus(self):
- return self._menus
-
- def set_menus(self, x):
- self._menus = x
-
- #
- # Document association
- #
-
- def get_document(self):
- return self._document
-
- def set_document(self, x):
- if self._document != x:
- if self._document:
- self._document._windows.remove(self)
- self._document = x
- if self._document:
- self._document._windows.append(self)
- self.update_title()
-
- #
- # Title
- #
-
- def update_title(self):
- """Update the window's title after a change in its document's title."""
- doc = self._document
- if doc:
- self.set_title(doc.title)
-
- #
- # Showing and Positioning
- #
-
- def get_auto_position(self):
- return self._auto_position
-
- def set_auto_position(self, v):
- self._auto_position = v
-
- def center(self):
- """Position the window in the centre of the screen."""
- print "GWindow.center" ###
- sl, st, sr, sb = self._screen_rect()
- w, h = self.size
- l = (sr - sl - w) // 2
- t = (sb - st - h) // 2
- self.position = (l, t)
-
- def centre(self):
- self.center()
-
- def show(self):
- if self._auto_position:
- if self._style == 'standard':
- self._stagger()
- else:
- self.center()
- self._auto_position = False
- self._show()
-
- def _stagger(self):
- pass
-
- def _show(self):
- self.visible = True
-
- def hide(self):
- self.visible = False
-
- #
- # Menu commands
- #
-
- def setup_menus(self, m):
- Container.setup_menus(self, m)
- app = application()
- if self._closable:
- m.close_cmd.enabled = 1
-
- def close_cmd(self):
- """If this window is the only window belonging to a document
- whose keeps_document_open attribute is true, then close the
- document, else destroy the window."""
-# app = application()
-# if not app._may_close_a_window():
-# #print "GWindow.close_cmd: Quitting the application" ###
-# app.quit_cmd()
-# else:
- doc = self._document
- n = 0
- if doc:
- for win in doc._windows:
- if win is not self and win.keeps_document_open:
- n += 1
- if doc and n == 0:
- doc.close_cmd()
- else:
- self.destroy()
-
- #
- # Tabbing
- #
-
- def get_tab_chain(self):
- chain = self._tab_chain
- if chain is None:
- chain = []
- self._build_tab_chain(chain)
- self._tab_chain = chain
- #print "Window.get_tab_chain:", chain ###
- return chain
-
- def _invalidate_tab_chain(self):
- self._tab_chain = None
-
- def _tab_to_next(self):
- self._tab_to(1)
-
- def _tab_to_prev(self):
- self._tab_to(-1)
-
- def _tab_to(self, direction):
- #print "GWindow._tab_to:", direction ###
- chain = self.tab_chain
- if chain:
- old_target = application().target
- new_target = None
- n = len(chain)
- try:
- i = chain.index(old_target)
- except ValueError:
- if direction > 0:
- i = -1
- else:
- i = n
- k = n
- while k:
- k -= 1
- i = (i + direction) % n
- comp = chain[i]
- if comp._is_targetable():
- new_target = comp
- break
- if new_target:
- if old_target:
- old_target._tab_out()
- new_target._tab_in()
-
- def key_down(self, event):
- #print "GWindow.key_down:", event ###
- if self._generic_tabbing and event.char == '\t':
- #print "GWindow.key_down: doing generic tabbing" ###
- if event.shift:
- self._tab_to_prev()
- else:
- self._tab_to_next()
- else:
- Container.key_down(self, event)
-
-# def _default_key_event(self, event):
-# #print "GWindow._default_key_event" ###
-# self.pass_event_to_next_handler(event)
-
- #
- # Other
- #
-
- def get_window(self):
- return self
-
- def first_dispatcher(self):
- return self
-
- def _document_needs_saving(self, state):
- pass
-
- def modal_event_loop(self):
- """Loop reading and handling events for the given window until
- exit_event_loop() is called. Interaction with other windows is prevented
- (although enabled application-wide menu commands can be used)."""
- # Implementations can override this together with exit_modal_event_loop()
- # to implement modal event loops in a different way.
- application()._event_loop(self)
-
- def exit_modal_event_loop(self):
- # Cause the current call to modal_event_loop() to exit.
- application()._exit_event_loop()
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Geometry.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Geometry.py
deleted file mode 100644
index 2ebbd95..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Geometry.py
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Python GUI - Points and Rectangles - Gtk
-#
-
-from GUI.GGeometry import *
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Globals.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Globals.py
deleted file mode 100644
index f6b1df9..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Globals.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Generic - Global variables and functions
-#
-#--------------------------------------------------------------------
-
-import os, sys
-
-_main_file_name = os.path.basename(sys.argv[0])
-application_name = os.path.splitext(_main_file_name)[0]
-
-_application = None
-
-def application():
- """Returns the global Application object. Creates a default one if needed."""
- global _application
- if not _application:
- from GUI import Application
- _application = Application()
- return _application
-
-def run():
- """Runs the application, retaining control until the application is quit."""
- application().run()
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Grid.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Grid.py
deleted file mode 100644
index 67bdb92..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Grid.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Grid layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Grid(Frame):
-
- def __init__(self, items, row_spacing = 5, column_spacing = 10,
- align = 'l', equalize = '', expand_row = None, expand_column = None,
- padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- num_rows = len(items)
- num_cols = max([len(row) for row in items])
- col_widths = [0] * num_cols
- row_heights = [0] * num_rows
- for i, row in enumerate(items):
- for j, item in enumerate(row):
- if item:
- row_heights[i] = max(row_heights[i], item.height)
- col_widths[j] = max(col_widths[j], item.width)
- tot_width = 0
- row_top = 0
- row_gap = 0
- vanchor = 't'
- for i, row in enumerate(items):
- row_height = row_heights[i]
- row_top += row_gap
- col_left = 0
- col_gap = 0
- hanchor = 'l'
- if i == expand_row:
- vanchor = 'tb'
- for j, item in enumerate(row):
- col_width = col_widths[j]
- col_left += col_gap
- if item:
- if 'l' in align:
- x = 0
- elif 'r' in align:
- x = col_width - item.width
- else:
- x = (col_width - item.width) // 2
- if 't' in align:
- y = 0
- elif 'b' in align:
- y = row_height - item.height
- else:
- y = (row_height - item.height) // 2
- item.position = (hpad + col_left + x, vpad + row_top + y)
- if j == expand_column:
- item.anchor = 'lr' + vanchor
- else:
- item.anchor = hanchor + vanchor
- self.add(item)
- if j == expand_column:
- hanchor = 'r'
- col_left += col_width
- col_gap = column_spacing
- tot_width = max(tot_width, col_left)
- if i == expand_row:
- vanchor = 'b'
- row_top += row_height
- row_gap = row_spacing
- tot_height = row_top
- self.size = (tot_width + 2 * hpad, tot_height + 2 * vpad)
- self.set(**kwds)
-
-export(Grid)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GridView.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GridView.py
deleted file mode 100644
index c201f90..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GridView.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Grid View - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import ScrollableView, rgb
-
-class GridView(ScrollableView):
- """A ScrollableView consisting of a grid of equal-sized cells."""
-
- num_columns = overridable_property('num_columns',
- "Width of the view in columns")
-
- num_rows = overridable_property('num_rows',
- "Height of the view in rows")
-
- cell_size = overridable_property('cell_size',
- "Size of each cell")
-
- backcolor = overridable_property('backcolor',
- "Background fill colour")
-
- _cell_size = (32, 32)
- _num_rows = 0
- _num_columns = 0
- _backcolor = rgb(1, 1, 1, 1)
-
- def __init__(self, num_rows, num_columns, cell_size, **kwds):
- ScrollableView.__init__(self)
- self._num_rows = num_rows
- self._num_columns = num_columns
- self._cell_size = cell_size
- self._update_extent()
- self.set(**kwds)
-
- def get_cell_size(self):
- return self._cell_size
-
- def set_cell_size(self, x):
- self._cell_size = x
- self._update_extent()
-
- def get_num_rows(self):
- return self._num_rows
-
- def set_num_rows(self, x):
- self._num_rows = x
- self._update_extent()
-
- def get_num_columns(self):
- return self._num_columns
-
- def set_num_columns(self, x):
- self._num_columns = x
- self._update_extent()
-
- def _update_extent(self):
- cw, ch = self._cell_size
- nr = self._num_rows
- nc = self._num_columns
- self.extent = (cw * nc, ch * nr)
-
- def cell_rect(self, row, col):
- w, h = self._cell_size
- l = col * w
- t = row * h
- return (l, t, l + w, t + h)
-
- def get_backcolor(self):
- return self._backcolor
-
- def set_backcolor(self, x):
- self._backcolor = x
-
- def cell_containing_point(self, p):
- x, y = p
- cw, ch = self.cell_size
- return (int(y // ch), int(x // cw))
-
- def draw(self, canvas, update_rect):
- canvas.backcolor = self.backcolor
- canvas.erase_rect(update_rect)
- ul, ut, ur, ub = update_rect
- nr = self._num_rows
- nc = self._num_columns
- cw, ch = self.cell_size
- row0 = max(0, int(ut // ch))
- row1 = min(nr, int(ub // ch) + 1)
- col0 = max(0, int(ul // cw))
- col1 = min(nc, int(ur // cw) + 1)
- row_range = xrange(row0, row1)
- col_range = xrange(col0, col1)
- for row in row_range:
- for col in col_range:
- rect = self.cell_rect(row, col)
- self.draw_cell(canvas, row, col, rect)
-
- def draw_cell(self, canvas, row, col, rect):
- """Should draw the cell at the given row and colum inside the given rect."""
- pass
-
- def mouse_down(self, event):
- row, col = self.cell_containing_point(event.position)
- nr = self._num_rows
- nc = self._num_columns
- if 0 <= row < nr and 0 <= col < nc:
- self.click_cell(row, col, event)
-
- def click_cell(self, row, col, event):
- """Called when a mouse_down event has occured in the indicated cell."""
- pass
-
-export(GridView)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GtkImageScaling.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GtkImageScaling.py
deleted file mode 100644
index 119ddb5..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GtkImageScaling.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Python GUI - Image scaling utilities - Gtk
-#
-
-from gtk import gdk
-
-def gtk_scale_pixbuf(src_pixbuf, sx, sy, sw, sh, dw, dh):
- """Return a new pixbuf containing the specified part of
- the given pixbuf scaled to the specified size."""
- dst_pixbuf = gdk.Pixbuf(
- src_pixbuf.get_colorspace(), src_pixbuf.get_has_alpha(),
- src_pixbuf.get_bits_per_sample(), dw, dh)
- xscale = float(dw) / sw
- yscale = float(dh) / sh
- xoffset = - xscale * sx
- yoffset = - yscale * sy
- src_pixbuf.scale(dst_pixbuf, 0, 0, dw, dh,
- xoffset, yoffset, xscale, yscale, gdk.INTERP_BILINEAR)
- return dst_pixbuf
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GtkPixmaps.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GtkPixmaps.py
deleted file mode 100644
index e7908e5..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/GtkPixmaps.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Python GUI - Gtk - Common pixmap code
-#
-
-from gtk import gdk
-from GUI.StdColors import clear
-from GUI.GtkImageScaling import gtk_scale_pixbuf
-from GUI import Canvas
-
-class GtkPixmap:
-
- def __init__(self, width, height):
- gdk_root = gdk.get_default_root_window()
- self._gdk_pixmap = gdk.Pixmap(gdk_root, width, height)
- #ctx = self._gdk_pixmap.cairo_create()
- #self._gtk_surface = ctx.get_target()
-
- def _gtk_set_source(self, ctx, x, y):
- ctx.set_source_pixmap(self._gdk_pixmap, x, y)
-
- def get_width(self):
- return self._gdk_pixmap.get_size()[0]
-
- def get_height(self):
- return self._gdk_pixmap.get_size()[1]
-
- def get_size(self):
- return self._gdk_pixmap.get_size()
-
- def with_canvas(self, proc):
- canvas = Canvas._from_gdk_drawable(self._gdk_pixmap)
- canvas.backcolor = clear
- proc(canvas)
-
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Image.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Image.py
deleted file mode 100644
index 1bd4017..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Image.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Python GUI - Images - Gtk
-#
-
-from __future__ import division
-from array import array
-import cairo
-from gtk import gdk
-from GUI import export
-from GUI.GImages import Image as GImage
-
-class Image(GImage):
-
- def _init_from_file(self, file):
- self._gdk_pixbuf = gdk.pixbuf_new_from_file(file)
-
- def _from_gdk_pixbuf(cls, gdk_pixbuf):
- self = cls.__new__(cls)
- self._gdk_pixbuf = gdk_pixbuf
- return self
-
- _from_gdk_pixbuf = classmethod(_from_gdk_pixbuf)
-
- def _gtk_set_source(self, ctx, x, y):
- ctx.set_source_pixbuf(self._gdk_pixbuf, x, y)
-
- def get_width(self):
- return self._gdk_pixbuf.get_width()
-
- def get_height(self):
- return self._gdk_pixbuf.get_height()
-
-export(Image)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ImageBase.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ImageBase.py
deleted file mode 100644
index 873c51f..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ImageBase.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# PyGUI - Image Base - Gtk
-#
-
-from __future__ import division
-from GUI import export
-from GUI.GImageBases import ImageBase as GImageBase
-
-class ImageBase(GImageBase):
-
-# def get_width(self):
-# return self._gtk_surface.get_width()
-#
-# def get_height(self):
-# return self._gtk_surface.get_height()
-
- def draw(self, canvas, src_rect, dst_rect):
- sx, sy, sr, sb = src_rect
- dx, dy, dr, db = dst_rect
- sw = sr - sx
- sh = sb - sy
- dw = dr - dx
- dh = db - dy
- ctx = canvas._gtk_ctx
- ctx.save()
- ctx.translate(dx, dy)
- ctx.new_path()
- ctx.rectangle(0, 0, dw, dh)
- ctx.clip()
- ctx.scale(dw / sw, dh / sh)
- self._gtk_set_source(canvas._gtk_ctx, -sx, -sy)
- ctx.paint()
- ctx.restore()
-
-export(ImageBase)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Label.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Label.py
deleted file mode 100644
index 9699177..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Label.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Python GUI - Labels - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.GLabels import Label as GLabel
-
-class Label(GLabel):
-
- _vertical_padding = 6
-
- def __init__(self, text = "New Label", font = system_font, **kwds):
- width, height = font.text_size(text)
- gtk_label = gtk.Label(text)
- gtk_label.set_alignment(0.0, 0.5)
- gtk_label.set_size_request(width, height + self._vertical_padding)
- gtk_label.show()
- GLabel.__init__(self, _gtk_outer = gtk_label, font = font, **kwds)
-
- def get_text(self):
- return self._gtk_outer_widget.get_text()
-
- def set_text(self, text):
- self._gtk_outer_widget.set_text(text)
-
- def _gtk_get_alignment(self):
- return self._gtk_outer_widget.get_alignment()[0]
-
- def _gtk_set_alignment(self, fraction, just):
- gtk_label = self._gtk_outer_widget
- gtk_label.set_alignment(fraction, 0.0)
- gtk_label.set_justify(just)
-
-export(Label)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/LayoutUtils.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/LayoutUtils.py
deleted file mode 100644
index 6b49662..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/LayoutUtils.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Utilities for use by layout components - Generic
-#
-#---------------------------------------------------------------------------
-
-def equalize_components(items, flags):
- if items:
- if 'w' in flags:
- width = max([item.width for item in items if item])
- for item in items:
- if item:
- item.width = width
- if 'h' in flags:
- height = max([item.height for item in items if item])
- for item in items:
- if item:
- item.height = height
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ListButton.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ListButton.py
deleted file mode 100644
index 7d3d75c..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ListButton.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - Pop-up list control - Gtk
-#
-#--------------------------------------------------------------
-
-import gtk
-from GUI import export
-from GUI.GListButtons import ListButton as GListButton
-
-class ListButton(GListButton):
-
- _gtk_suppress_action = False
-
- def __init__(self, **kwds):
- titles, values = self._extract_initial_items(kwds)
- self._titles = titles
- self._values = values
- gtk_widget = gtk.combo_box_new_text()
- gtk_widget.connect('changed', self._gtk_changed_signalled)
- gtk_widget.set_property('focus_on_click', False)
- gtk_widget.show()
- self._gtk_update_items(gtk_widget)
- GListButton.__init__(self, _gtk_outer = gtk_widget, **kwds)
-
- def _update_items(self):
- self._gtk_update_items(self._gtk_outer_widget)
-
- def _gtk_update_items(self, gtk_widget):
- self._gtk_suppress_action = True
- n = gtk_widget.get_model().iter_n_children(None)
- for i in xrange(n - 1, -1, -1):
- gtk_widget.remove_text(i)
- for title in self._titles:
- gtk_widget.append_text(title)
- self._gtk_suppress_action = False
-
- def _get_selected_index(self):
- return self._gtk_outer_widget.get_active()
-
- def _set_selected_index(self, i):
- self._gtk_suppress_action = True
- self._gtk_outer_widget.set_active(i)
- self._gtk_suppress_action = False
-
- def _gtk_changed_signalled(self, _):
- if not self._gtk_suppress_action:
- self.do_action()
-
-export(ListButton)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Menu.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Menu.py
deleted file mode 100644
index 05b9e65..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Menu.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# Python GUI - Menus - Gtk version
-#
-
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI.Globals import application
-from GUI.GMenus import Menu as GMenu, MenuItem
-
-def _report_accel_changed_(*args):
- print "Menus: accel_changed:", args
-
-class Menu(GMenu):
-
- def __init__(self, title, items, **kwds):
- GMenu.__init__(self, title, items, **kwds)
- self._gtk_menu = gtk.Menu()
- self._gtk_accel_group = gtk.AccelGroup()
- #self._gtk_accel_group.connect('accel_changed', _report_accel_changed_) ###
-
- def _clear_platform_menu(self):
- gtk_menu = self._gtk_menu
- for gtk_item in gtk_menu.get_children():
- gtk_item.destroy()
-
- def _add_separator_to_platform_menu(self):
- gtk_item = gtk.MenuItem()
- gtk_item.set_sensitive(0)
- gtk_separator = gtk.HSeparator()
- gtk_item.add(gtk_separator)
- self._gtk_add_item(gtk_item)
-
- def _gtk_add_item(self, gtk_item):
- gtk_item.show_all()
- self._gtk_menu.append(gtk_item)
-
- def _add_item_to_platform_menu(self, item, name, command = None, index = None):
- checked = item.checked
- if checked is None:
- gtk_item = gtk.MenuItem(name)
- else:
- gtk_item = gtk.CheckMenuItem(name)
- self._gtk_add_item(gtk_item)
- if not item.enabled:
- gtk_item.set_sensitive(0)
- if checked:
- gtk_item.set_active(1)
- if command:
- app = application()
- if index is not None:
- action = lambda widget: app.dispatch(command, index)
- else:
- action = lambda widget: app.dispatch(command)
- gtk_item.connect('activate', action)
- key = item._key
- if key:
- gtk_modifiers = gdk.CONTROL_MASK
- if item._shift:
- gtk_modifiers |= gdk.SHIFT_MASK
- if item._option:
- gtk_modifiers |= gdk.MOD1_MASK
- gtk_item.add_accelerator('activate', self._gtk_accel_group,
- ord(key), gtk_modifiers, gtk.ACCEL_VISIBLE)
-
-export(Menu)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/MenuList.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/MenuList.py
deleted file mode 100644
index 16892c3..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/MenuList.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Python GUI - Menu Lists - Generic
-#
-
-from GUI import export
-
-class MenuList(list):
- """A MenuList is a sequence of Menus with methods for finding
- menus and menu items by command."""
-
- def menu_with_command(self, cmd):
- """Returns the menu containing the given command, or None
- if there is no such menu in the list."""
- for menu in self:
- if menu.item_with_command(cmd):
- return menu
- return None
-
- def item_with_command(self, cmd):
- """Returns the menu item having the given command, or None
- if there is no such item."""
- for menu in self:
- item = menu.item_with_command(cmd)
- if item:
- return item
- return None
-
-export(MenuList)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/MessageHandler.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/MessageHandler.py
deleted file mode 100644
index 2407b90..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/MessageHandler.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#
-# Python GUI - Message handlers - Generic
-#
-
-from GUI import export
-
-class MessageHandler(object):
- """A MessageHandler is an object which can form part of the
- message handling hierarchy. This hierarchy is used to handle
- keyboard events, menu commands, and action messages generated
- by buttons or other components.
-
- At any given moment, one of the application's windows is the
- 'target window' for messages. Within the target window, some
- component is designated as the 'target object', or just 'target'.
-
- Messages are initially delivered to the target object, and
- passed up the hierarchy using the handle() method. At each step,
- if the object has a method with the same name as the message, it
- is called with the message's arguments. Otherwise the message is
- passed on to the object determined by the next_handler() method.
- Usually this is the object's container, but need not be.
-
- The become_target() method is used to make a component the target
- within its window. The targeted() and untargeted() methods are
- called to notify a component when it has become or ceased to be
- the target. The is_target() method can be used to test whether a
- component is currently the target."""
-
- #----- Event handling -----
-
- def handle_event_here(self, event):
- """Send an event message to this object, ignoring the event if
- there is no method to handle it."""
- self.handle_here(event.kind, event)
-
- def handle_event(self, event):
- """Send an event message up the message path until a method
- is found to handle it."""
- self.handle(event.kind, event)
-
- #----- Message handling -----
-
- def handle_here(self, message, *args):
- """If there is a method with the same name as the message, call
- it with the given args. Otherwise, ignore the message."""
- method = getattr(self, message, None)
- if method:
- method(*args)
-
- def handle(self, message, *args):
- """If there is a method with the same name as the message, call
- it with the given args. Otherwise, pass the message up to the
- next handler."""
- #print "MessageHandler: handling", message, "for", self ###
- method = getattr(self, message, None)
- if method:
- #print "MessageHandler: calling method from", method.im_func.func_code.co_filename ###
- method(*args)
- else:
- #print "MessageHandler: passing to next handler" ###
- self.pass_to_next_handler(message, *args)
-
- def pass_event_to_next_handler(self, event):
- """Pass the given event on to the next handler, if any."""
- self.pass_to_next_handler(event.kind, event)
-
- def pass_to_next_handler(self, message, *args):
- """Pass the given message on to the next handler, if any."""
- next = self.next_handler()
- if next:
- next.handle(message, *args)
-
- def next_handler(self):
- """Return the object, if any, to which messages not handled
- by this object should be passed on."""
- return None
-
- #----- Default handlers and callbacks -----
-
- def _setup_menus(self, m):
- self.pass_to_next_handler('_setup_menus', m)
- #print "MessageHandler._setup_menus: calling setup_menus for", self ###
- self.setup_menus(m)
-
- def setup_menus(self, m):
- """Called before a menu is pulled down, to allow the Component to
- enable menu commands that it responds to."""
- pass
-
- _pass_key_events_to_platform = False
-
- def _default_key_event(self, event):
- #print "MessageHandler._default_key_event for", self ###
- #print "...originator =", event._originator ###
- if event._originator is self and self._pass_key_events_to_platform:
- #print "...passing to platform" ###
- event._not_handled = True
- else:
- self.pass_event_to_next_handler(event)
-
- def _default_mouse_event(self, event):
- event._not_handled = True
-
- def _event_custom_handled(self, event):
- # Give custom event handlers of this component a chance to handle
- # the event. If it reaches a default event method of this component,
- # the event is not passed to the next handler and false is returned.
- # If it is handled by an overridden method or explicitly passed to
- # the next handler, true is returned.
- event._originator = self
- self.handle_event(event)
- return not event._not_handled
-
- def key_down(self, event):
- #print "MessageHandler.key_down for", self ###
- self._default_key_event(event)
-
- def key_up(self, event):
- self._default_key_event(event)
-
- def mouse_down(self, event):
- self._default_mouse_event(event)
-
- def mouse_drag(self, event):
- self._default_mouse_event(event)
-
- def mouse_up(self, event):
- self._default_mouse_event(event)
-
- def mouse_move(self, event):
- self._default_mouse_event(event)
-
- def mouse_enter(self, event):
- self._default_mouse_event(event)
-
- def mouse_leave(self, event):
- self._default_mouse_event(event)
-
-export(MessageHandler)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ModalDialog.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ModalDialog.py
deleted file mode 100644
index c0d7922..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ModalDialog.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Python GUI - Modal Dialogs - Generic
-#
-
-from GUI import application, export
-from GUI import Dialog
-
-class ModalDialog(Dialog):
-
- def __init__(self, style = 'modal_dialog', **kwds):
- Dialog.__init__(self, style = style, **kwds)
-
- def present(self):
- self._result = None
- self._dismissed = 0
- self.show()
- app = application()
- try:
- while not self._dismissed:
- self.modal_event_loop()
- finally:
- self.hide()
- return self._result
-
- def dismiss(self, result = 0):
- self._result = result
- self._dismissed = 1
- self.exit_modal_event_loop()
-
- def close_cmd(self):
- self.dismiss()
-
- def next_handler(self):
- return None
-
- def ok(self):
- self.dismiss(True)
-
- def cancel(self):
- self.dismiss(False)
-
-export(ModalDialog)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Model.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Model.py
deleted file mode 100644
index ff69691..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Model.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# Python GUI - Models - Generic
-#
-
-import weakref
-from GUI import export
-from GUI.Properties import Properties, overridable_property
-
-# List of views for a model is kept separately so that models
-# can be pickled without fear of accidentally trying to pickle
-# the user interface.
-
-_model_views = weakref.WeakKeyDictionary() # {Model: [object]}
-
-class Model(Properties):
- """A Model represents an application object which can appear in a View.
- Each Model can have any number of Views attached to it. When a Model is
- changed, it should notify all of its Views so that they can update
- themselves.
-
- The 'parent' attribute of a Model is treated specially when pickling.
- If it refers to an object having a 'pickle_as_parent_model' attribute
- whose value is false, the 'parent' attribute is not pickled. This allows
- a Model to have a Document as a parent without the Document being pickled
- along with the Model.
- """
-
- views = overridable_property('views',
- "List of objects observing this model. Do not modify directly.")
-
- parent = None # Model
-
- def __init__(self, parent = None, **kwds):
- Properties.__init__(self, **kwds)
- if parent:
- self.parent = parent
-
- def destroy(self):
- """All views currently observing this model are removed, and their
- 'model_destroyed' methods, if any, are called with the model as
- an argument."""
- for view in self.views[:]:
- self.remove_view(view)
- self._call_if_present(view, 'model_destroyed', self)
-
- #
- # Properties
- #
-
- def get_views(self):
- views = _model_views.get(self)
- if views is None:
- views = []
- _model_views[self] = views
- return views
-
- #
- # Pickling behaviour
- #
-
- def __getstate__(self):
- state = self.__dict__
- parent = self.parent
- if not getattr(parent, 'pickle_as_parent_model', True):
- state = state.copy()
- del state['parent']
- return state
-
- def __setstate__(self, state):
- self.__dict__.update(state)
-
- #
- # Adding and removing views
- #
-
- def add_view(self, view):
- """Add the given object as an observer of this model. The view will
- typically be a View subclass, but need not be. If the view is not
- already an observer of this model and defines an 'add_model' method,
- this method is called with the model as an argument."""
- views = self.views
- if view not in views:
- views.append(view)
- self._call_if_present(view, 'add_model', self)
-
- def remove_view(self, view):
- """If the given object is currently an observer of this model, it
- is removed, and if it defines a 'remove_model' method, this method
- is called with the model as an argument."""
- views = self.views
- if view in views:
- views.remove(view)
- self._call_if_present(view, 'remove_model', self)
-
- #
- # View notification
- #
-
- def notify_views(self, message = 'model_changed', *args, **kwds):
- """For each observer, if the observer defines a method with the name of the
- message, call it with the given arguments. Otherwise, if it defines a
- method called 'model_changed', call it with no arguments. Otherwise,
- do nothing for that observer."""
- for view in self.views:
- if not self._call_if_present(view, message, self, *args, **kwds):
- self._call_if_present(view, 'model_changed', self)
-
- def _call_if_present(self, obj, method_name, *args, **kwds):
- method = getattr(obj, method_name, None)
- if method:
- method(*args, **kwds)
- return 1
- else:
- return 0
-
- #
- # Marking as changed
- #
-
- def changed(self):
- "Mark the containing Document as changed."
- parent = self.parent
- if parent:
- parent.changed()
-
-export(Model)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Numerical.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Numerical.py
deleted file mode 100644
index 8cec11b..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Numerical.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - NumPy interface - Gtk
-#
-#--------------------------------------------------------------
-
-from gtk import gdk
-from GUI import Image
-
-def image_from_ndarray(array, format, size = None):
- """
- Creates an Image from a numpy ndarray object. The format
- may be 'RGB' or 'RGBA'. If a size is specified, the array
- will be implicitly reshaped to that size, otherwise the size
- is inferred from the first two dimensions of the array.
- """
- if array.itemsize <> 1:
- raise ValueError("Color component size must be 1 byte")
- if size is None:
- shape = array.shape
- if len(shape) <> 3:
- raise ValueError("Array has wrong number of dimensions")
- width, height, pixel_size = shape
- if pixel_size <> len(format):
- raise ValueError("Last dimension of array does not match format")
- else:
- width, height = size
- pixel_size = len(format)
- data_size = array.size
- if data_size <> width * height * pixel_size:
- raise ValueError("Array has wrong shape for specified size and format")
- alpha = pixel_size == 4
- gdk_pixbuf = gdk.pixbuf_new_from_data(array, gdk.COLORSPACE_RGB, alpha,
- 8, width, height, width * pixel_size)
- image = Image._from_gdk_pixbuf(gdk_pixbuf)
- #image._data = array ###
- return image
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/PIL.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/PIL.py
deleted file mode 100644
index 2c09c3e..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/PIL.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - PIL interface - Gtk
-#
-#--------------------------------------------------------------
-
-from gtk import gdk
-from gtk.gdk import COLORSPACE_RGB
-from GUI import Image
-
-def image_from_pil_image(pil_image):
- """Creates an Image from a Python Imaging Library (PIL)
- Image object."""
- mode = pil_image.mode
- w, h = pil_image.size
- data = pil_image.tostring()
- if mode == "RGB":
- bps = 3; alpha = False
- elif mode == "RGBA":
- bps = 4; alpha = True
- else:
- raise ValueError("Unsupported PIL image mode '%s'" % mode)
- bpr = w * bps
- image = Image.__new__(Image)
- image._gdk_pixbuf = gdk.pixbuf_new_from_data(data, COLORSPACE_RGB,
- alpha, 8, w, h, bpr)
- return image
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/PaletteView.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/PaletteView.py
deleted file mode 100644
index 9387afa..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/PaletteView.py
+++ /dev/null
@@ -1,144 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Palette View - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import StdColors, GridView
-from GUI.GUtils import splitdict
-
-class PaletteView(GridView):
- """A GridView whose cells are identified by a linear index from
- left to right and top to bottom. Also provides support for
- highlighting one or more selected cells."""
-
- num_items = overridable_property('num_items',
- "Total number of items")
-
- items_per_row = overridable_property('items_per_row',
- "Number of items displayed in one row")
-
- highlight_style = overridable_property('highlight_style',
- "Style of selection highlighting")
-
- highlight_color = overridable_property('highlight_color',
- "Color of selection highlighting")
-
- highlight_thickness = overridable_property('highlight_thickness',
- "Width of selection highlighting for 'frame' highlight mode")
-
- _highlight_style = 'fill'
- _highlight_color = StdColors.selection_backcolor
- _highlight_thickness = 4
-
- def __init__(self, num_items, items_per_row, cell_size,
- scrolling = '', **kwds):
- base_kwds = splitdict(kwds, 'border', scrolling = '')
- GridView.__init__(self, num_rows = 0, num_columns = 0,
- cell_size = cell_size, **base_kwds)
- self._num_items = num_items
- self._items_per_row = items_per_row
- self._update_num_rows_and_columns()
- ew, eh = self.extent
- if not self.hscrolling:
- self.content_width = ew
- if not self.vscrolling:
- self.content_height = eh
- self.set(**kwds)
-
- def get_num_items(self):
- return self._num_items
-
- def set_num_items(self, n):
- self._num_items = n
- self._update_num_rows_and_columns()
-
- def get_items_per_row(self):
- return self.num_columns
-
- def set_items_per_row(self, n):
- self._items_per_row = n
- self._update_num_rows_and_columns()
-
- def _update_num_rows_and_columns(self):
- nc = self._items_per_row
- nr = (self._num_items + nc - 1) // nc
- self._num_columns = nc
- self._num_rows = nr
- self._update_extent()
-
- def get_highlight_style(self):
- return self._highlight_style
-
- def set_highlight_style(self, x):
- self._highlight_style = x
-
- def get_highlight_color(self):
- return self._highlight_color
-
- def set_highlight_color(self, x):
- self._highlight_color = x
-
- def get_highlight_color(self):
- return self._highlight_color
-
- def set_highlight_color(self, x):
- self._highlight_color = x
-
- def item_no_of_cell(self, row, col):
- i = row * self._items_per_row + col
- if 0 <= i < self._num_items:
- return i
-
- def cell_of_item_no(self, item_no):
- if 0 <= item_no < self._num_items:
- return divmod(item_no, self._items_per_row)
-
- def item_rect(self, item_no):
- cell = self.cell_of_item_no(item_no)
- if cell:
- return self.cell_rect(*cell)
-
- def draw_cell(self, canvas, row, col, rect):
- i = self.item_no_of_cell(row, col)
- if i is not None:
- highlight = self.item_is_selected(i)
- self.draw_item_and_highlight(canvas, i, rect, highlight)
-
- def draw_item_and_highlight(self, canvas, item_no, rect, highlight):
- """Draw the specified item, with selection highlighting if highlight
- is true."""
- if highlight:
- style = self.highlight_style
- if style:
- canvas.gsave()
- if style == 'fill':
- canvas.fillcolor = self.highlight_color
- canvas.fill_rect(rect)
- else:
- canvas.pencolor = self.highlight_color
- canvas.pensize = self.highlight_thickness
- canvas.frame_rect(rect)
- canvas.grestore()
- self.draw_item(canvas, item_no, rect)
-
- def draw_item(self, canvas, item_no, rect):
- """Should draw the specified item in the given rect."""
- pass
-
- def click_cell(self, row, col, event):
- i = self.item_no_of_cell(row, col)
- if i is not None:
- self.click_item(i, event)
-
- def click_item(self, item_no, event):
- """Called when a mouse_down event has occurred in the indicated item."""
- pass
-
- def item_is_selected(self, item_no):
- """Should return true if the indicated item is to be drawn highlighted."""
- return False
-
-export(PaletteView)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Picture.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Picture.py
deleted file mode 100644
index 2a58b65..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Picture.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Python GUI - Picture class - Generic
-#
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import View
-
-class Picture(View):
-
- image = overridable_property('image', "The image to display")
-
- _image = None
-
- def __init__(self, image = None, file = None, **kwds):
- if file:
- from Images import Image
- image = Image(file)
- View.__init__(self, **kwds)
- if image:
- self.size = image.size
- self._image = image
-
- def get_image(self):
- return self._image
-
- def set_image(self, x):
- self._image = x
- self.invalidate()
-
- def draw(self, canvas, rect):
- image = self._image
- if image:
- w, h = self.size
- image.draw(canvas, image.bounds, (0, 0, w, h))
-
-export(Picture)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Pixmap.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Pixmap.py
deleted file mode 100644
index 1a0c452..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Pixmap.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Python GUI - Pixmap - Gtk
-#
-
-from gtk import gdk
-from GUI import export
-from GUI.GtkPixmaps import GtkPixmap
-from GUI.GPixmaps import Pixmap as GPixmap
-
-class Pixmap(GtkPixmap, GPixmap):
-
- def __init__(self, width, height):
- GtkPixmap.__init__(self, width, height)
-
-export(Pixmap)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Printing.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Printing.py
deleted file mode 100644
index 5ee9da3..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Printing.py
+++ /dev/null
@@ -1,188 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Gtk
-#
-#------------------------------------------------------------------------------
-
-import gtk, gtkunixprint
-from gtk import UNIT_POINTS
-from GUI import Canvas
-from GUI.GPrinting import PageSetup as GPageSetup, Printable as GPrintable, \
- Paginator
-
-gtk_paper_names = [
- gtk.PAPER_NAME_A3,
- gtk.PAPER_NAME_A4,
- gtk.PAPER_NAME_A5,
- gtk.PAPER_NAME_B5,
- gtk.PAPER_NAME_LETTER,
- gtk.PAPER_NAME_EXECUTIVE,
- gtk.PAPER_NAME_LEGAL,
-]
-
-gtk_paper_formats = {}
-
-gtk_print_settings = gtk.PrintSettings()
-
-def init_gtk_paper_formats():
- for gtk_name in gtk_paper_names:
- display_name = gtk.PaperSize(gtk_name).get_display_name()
- gtk_paper_formats[display_name] = gtk_name
-
-init_gtk_paper_formats()
-
-def gtk_default_page_setup():
- pset = gtk.PageSetup()
- pset.set_paper_size(gtk.PaperSize())
- return pset
-
-def get_gtk_state(gtk_page_setup):
- state = {}
- state['orientation'] = gtk_page_setup.get_orientation()
- state['paper_size'] = gtk_page_setup.get_paper_size().get_name()
- state['top_margin'] = gtk_page_setup.get_top_margin(UNIT_POINTS)
- state['bottom_margin'] = gtk_page_setup.get_bottom_margin(UNIT_POINTS)
- state['left_margin'] = gtk_page_setup.get_left_margin(UNIT_POINTS)
- state['right_margin'] = gtk_page_setup.get_right_margin(UNIT_POINTS)
- return state
-
-def set_gtk_state(gtk_page_setup, state):
- gtk_page_setup.set_orientation(state['orientation'])
- gtk_page_setup.set_paper_size(gtk.PaperSize(state['paper_size']))
- gtk_page_setup.set_top_margin(state['top_margin'], UNIT_POINTS)
- gtk_page_setup.set_bottom_margin(state['bottom_margin'], UNIT_POINTS)
- gtk_page_setup.set_left_margin(state['left_margin'], UNIT_POINTS)
- gtk_page_setup.set_right_margin(state['right_margin'], UNIT_POINTS)
-
-#------------------------------------------------------------------------------
-
-class PageSetup(GPageSetup):
-
- _printer_name = ""
- _left_margin = 36
- _top_margin = 36
- _right_margin = 36
- _bottom_margin = 36
-
- def __init__(self):
- self._gtk_page_setup = gtk_default_page_setup()
-
- def __getstate__(self):
- state = GPageSetup.__getstate__(self)
- state['_gtk_page_setup'] = get_gtk_state(self._gtk_page_setup)
- return state
-
- def __setstate__(self, state):
- gtk_setup = gtk_default_page_setup()
- self._gtk_page_setup = gtk_setup
- gtk_state = state.pop('_gtk_page_setup', None)
- if gtk_state:
- set_gtk_state(gtk_setup, gtk_state)
- self.margins = state['margins']
- self.printer_name = state['printer_name']
- else:
- GPageSetup.__setstate__(state)
-
- def get_paper_name(self):
- return self._gtk_page_setup.get_paper_size().get_display_name()
-
- def set_paper_name(self, x):
- psize = gtk.PaperSize(gtk_paper_formats.get(x) or x)
- self._gtk_page_setup.set_paper_size(psize)
-
- def get_paper_width(self):
- return self._gtk_page_setup.get_paper_width(UNIT_POINTS)
-
- def set_paper_width(self, x):
- self._gtk_page_setup.set_paper_width(x, UNIT_POINTS)
-
- def get_paper_height(self):
- return self._gtk_page_setup.get_paper_height(UNIT_POINTS)
-
- def set_paper_height(self, x):
- self._gtk_page_setup.set_paper_height(x, UNIT_POINTS)
-
- def get_orientation(self):
- o = self._gtk_page_setup.get_orientation()
- if o in (gtk.PAGE_ORIENTATION_LANDSCAPE,
- gtk.PAGE_ORIENTATION_REVERSE_LANDSCAPE):
- return 'landscape'
- else:
- return 'portrait'
-
- def set_orientation(self, x):
- if x == 'landscape':
- o = gtk.PAGE_ORIENTATION_LANDSCAPE
- else:
- o = gtk.PAGE_ORIENTATION_PORTRAIT
- self._gtk_page_setup.set_orientation(o)
-
- def get_left_margin(self):
- return self._left_margin
-
- def get_top_margin(self):
- return self._top_margin
-
- def get_right_margin(self):
- return self._right_margin
-
- def get_bottom_margin(self):
- return self._bottom_margin
-
- def set_left_margin(self, x):
- self._left_margin = x
-
- def set_top_margin(self, x):
- self._top_margin = x
-
- def set_right_margin(self, x):
- self._right_margin = x
-
- def set_bottom_margin(self, x):
- self._bottom_margin = x
-
- def get_printer_name(self):
- return self._printer_name
-
- def set_printer_name(self, x):
- self._printer_name = x
-
-#------------------------------------------------------------------------------
-
-class Printable(GPrintable):
-
- def print_view(self, page_setup, prompt = True):
- global gtk_print_settings
- paginator = Paginator(self, page_setup)
-
- def draw_page(_, gtk_print_context, page_num):
- cairo_context = gtk_print_context.get_cairo_context()
- canvas = Canvas._from_cairo_context(cairo_context)
- paginator.draw_page(canvas, page_num)
-
- gtk_op = gtk.PrintOperation()
- gtk_op.set_print_settings(gtk_print_settings)
- gtk_op.set_default_page_setup(page_setup._gtk_page_setup)
- gtk_op.set_n_pages(paginator.num_pages)
- gtk_op.set_use_full_page(True)
- gtk_op.set_unit(UNIT_POINTS)
- gtk_op.connect('draw-page', draw_page)
- if prompt:
- action = gtk.PRINT_OPERATION_ACTION_PRINT_DIALOG
- else:
- action = gtk.PRINT_OPERATION_ACTION_PRINT
- result = gtk_op.run(action)
- if result == gtk.PRINT_OPERATION_RESULT_APPLY:
- gtk_print_settings = gtk_op.get_print_settings()
-
-#------------------------------------------------------------------------------
-
-def present_page_setup_dialog(page_setup):
- old_setup = page_setup._gtk_page_setup
- ps = gtk.PrintSettings()
- new_setup = gtk.print_run_page_setup_dialog(None, old_setup, ps)
- if get_gtk_state(old_setup) <> get_gtk_state(new_setup):
- page_setup._gtk_page_setup = new_setup
- return True
- else:
- return False
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Properties.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Properties.py
deleted file mode 100644
index 5fa0811..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Properties.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Properties - Generic
-#
-#------------------------------------------------------------------------------
-
-class Properties(object):
- """
- This class implements the standard interface for initialising
- properties using keyword arguments.
- """
-
- def __init__(self, **kw):
- "Properties(name=value, ...) passes the given arguments to the set() method."
- self.set(**kw)
-
- def set(self, **kw):
- """set(name=value, ...) sets property values according to the given
- keyword arguments. Will only set attributes for which a descriptor exists."""
- cls = self.__class__
- for name, value in kw.iteritems():
- try:
- s = getattr(cls, name).__set__
- except AttributeError:
- raise TypeError("%s object has no writable property %r" % (
- self.__class__.__name__, name))
- s(self, value)
-
-#------------------------------------------------------------------------------
-
-def overridable_property(name, doc = None):
- """Creates a property which calls methods get_xxx and set_xxx of
- the underlying object to get and set the property value, so that
- the property's behaviour may be easily overridden by subclasses."""
-
- getter_name = intern('get_' + name)
- setter_name = intern('set_' + name)
- return property(
- lambda self: getattr(self, getter_name)(),
- lambda self, value: getattr(self, setter_name)(value),
- None,
- doc)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/RadioButton.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/RadioButton.py
deleted file mode 100644
index 3db37a1..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/RadioButton.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Python GUI - Radio buttons - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GRadioButtons import RadioButton as GRadioButton
-
-class RadioButton(GRadioButton):
-
- def __init__(self, title = "New Control", **kwds):
- gtk_radiobutton = gtk.RadioButton(None, title)
- gtk_radiobutton.show()
- self._gtk_connect(gtk_radiobutton, 'toggled', self._gtk_toggled_signal)
- GRadioButton.__init__(self, _gtk_outer = gtk_radiobutton, **kwds)
-
- def _value_changed(self):
- group = self._group
- if group:
- if self._value == group._value:
- self._turn_on()
- else:
- group._turn_all_off()
-
- def _turn_on(self):
- self._gtk_outer_widget.set_active(1)
-
- def _is_on(self):
- return self._gtk_outer_widget.get_active()
-
- def _gtk_toggled_signal(self):
- if self._is_on():
- group = self._group
- if group and group._value <> self._value:
- group._value = self._value
- group.do_action()
-
-export(RadioButton)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/RadioGroup.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/RadioGroup.py
deleted file mode 100644
index 92b0e80..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/RadioGroup.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Python GUI - Radio groups - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GRadioGroups import RadioGroup as GRadioGroup
-
-class RadioGroup(GRadioGroup):
-
- def __init__(self, items = [], **kwds):
- self._gtk_dummy_radiobutton = gtk.RadioButton()
- GRadioGroup.__init__(self, items, **kwds)
-
- def _item_added(self, item):
- old_value = self._value
- item._gtk_outer_widget.set_group(self._gtk_dummy_radiobutton)
- self.value = old_value
-
- def _item_removed(self, item):
- item._gtk_outer_widget.set_group(None)
- if item._value == self._value:
- self._value = None
- self._turn_all_off()
-
- def _value_changed(self):
- new_value = self._value
- for item in self._items:
- if item._value == new_value:
- item._turn_on()
- return
- self._turn_all_off()
-
- def _turn_all_off(self):
- self._gtk_dummy_radiobutton.set_active(1)
-
-export(RadioGroup)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources.py
deleted file mode 100644
index 91d570d..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# PyGUI - Resources - Generic
-#
-
-import os
-
-resource_path = []
-resource_cache = {}
-
-class ResourceNotFoundError(ValueError):
-
- def __init__(self, name, type, path):
- name = _append_type(name, type)
- ValueError.__init__(self, "Resource %r not found in %s" % (name, path))
-
-def _append_type(name, type):
- if type:
- name = "%s.%s" % (os.path.splitext(name)[0], type)
- return name
-
-def _add_directory_path(dir, up = 0):
- # Add the given directory to the resource path if it exists.
- dir = os.path.abspath(dir)
- while up > 0:
- dir = os.path.dirname(dir)
- up -= 1
- resdir = os.path.join(dir, "Resources")
- #print "GUI.Resources: Checking for directory", repr(resdir) ###
- if os.path.isdir(resdir):
- resource_path.insert(0, resdir)
-
-def _add_file_path(file, up = 0):
- # Add the directory containing the given file to the resource path.
- #print "GUI.Resources: Adding path for file", repr(file) ###
- dir = os.path.dirname(os.path.abspath(file))
- _add_directory_path(dir, up)
-
-def _add_module_path(module, up = 0):
- # Add the directory containing the given module to the resource path.
- if hasattr(module, '__file__'):
- _add_file_path(module.__file__, up)
-
-def lookup_resource(name, type = None):
- """
- Return the full pathname of a resource given its relative name
- using '/' as a directory separator. If a type is specified, any
- dot-suffix on the name is replaced with '.type'. Returns None if
- no matching file is found on the resource search path.
- """
- name = _append_type(name, type)
- relpath = os.path.join(*name.split("/"))
- for dir in resource_path:
- path = os.path.join(dir, relpath)
- if os.path.exists(path):
- return path
- return None
-
-def find_resource(name, type = None):
- """
- Returns the full pathname of a resource as per lookup_resource(), but
- raises ResourceNotFoundError if the resource is not found.
- """
- path = lookup_resource(name, type)
- if not path:
- raise ResourceNotFoundError(name, type, resource_path)
- return path
-
-def get_resource(loader, name, type = None, default = None, **kwds):
- """
- Find a resource and load it using the specified loader function.
- The loader is called as: loader(path, **kwds) where path is the full
- pathname of the resource. The loaded resource is cached, and subsequent
- calls referencing the same resource will return the cached value.
- If the resource is not found, the specified default is returned if any,
- otherwise ResourceNotFoundError is raised.
- """
- path = lookup_resource(name, type)
- if path:
- result = resource_cache.get(path)
- if result is None:
- result = loader(path, **kwds)
- resource_cache[path] = result
- else:
- if default is not None:
- result = default
- else:
- raise ResourceNotFoundError(name, type, resource_path)
- return result
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/arrow.hot b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/arrow.hot
deleted file mode 100644
index 8835c07..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/arrow.hot
+++ /dev/null
@@ -1 +0,0 @@
-4 4
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/arrow.tiff b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/arrow.tiff
deleted file mode 100644
index 2232993..0000000
Binary files a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/arrow.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/crosshair.hot b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/crosshair.hot
deleted file mode 100644
index 11c8dd7..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/crosshair.hot
+++ /dev/null
@@ -1 +0,0 @@
-7 7
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/crosshair.tiff b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/crosshair.tiff
deleted file mode 100644
index e15aa9d..0000000
Binary files a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/crosshair.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/finger.hot b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/finger.hot
deleted file mode 100644
index e846a7c..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/finger.hot
+++ /dev/null
@@ -1 +0,0 @@
-5 0
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/finger.tiff b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/finger.tiff
deleted file mode 100644
index 55e059c..0000000
Binary files a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/finger.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/fist.hot b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/fist.hot
deleted file mode 100644
index 99ca153..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/fist.hot
+++ /dev/null
@@ -1 +0,0 @@
-8 8
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/fist.tiff b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/fist.tiff
deleted file mode 100644
index 961b33d..0000000
Binary files a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/fist.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/hand.hot b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/hand.hot
deleted file mode 100644
index 99ca153..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/hand.hot
+++ /dev/null
@@ -1 +0,0 @@
-8 8
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/hand.tiff b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/hand.tiff
deleted file mode 100644
index 2441917..0000000
Binary files a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/hand.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/ibeam.hot b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/ibeam.hot
deleted file mode 100644
index 1a99162..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/ibeam.hot
+++ /dev/null
@@ -1 +0,0 @@
-4 5
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/ibeam.tiff b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/ibeam.tiff
deleted file mode 100644
index 70d7462..0000000
Binary files a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/ibeam.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/poof.hot b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/poof.hot
deleted file mode 100644
index b0597be..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/poof.hot
+++ /dev/null
@@ -1 +0,0 @@
-11 4
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/poof.tiff b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/poof.tiff
deleted file mode 100644
index c8cc981..0000000
Binary files a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Resources/cursors/poof.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Row.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Row.py
deleted file mode 100644
index 25b6fc3..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Row.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Row layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Row(Frame):
-
- def __init__(self, items, spacing = 10, align = 'c', equalize = '',
- expand = None, padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- if expand is not None and not isinstance(expand, int):
- expand = items.index(expand)
- equalize_components(items, equalize)
- height = 0
- for item in items:
- if item:
- height = max(height, item.height)
- x = hpad
- gap = 0
- hanchor = 'l'
- vanchor = align
- for i, item in enumerate(items):
- x += gap;
- if item:
- if 't' in align:
- y = 0
- if 'b' in align:
- item.height = height
- elif align == 'b':
- y = height - item.height
- else:
- y = (height - item.height) // 2
- item.position = (x, y + vpad)
- if i == expand:
- item.anchor = 'lr' + vanchor
- else:
- item.anchor = hanchor + vanchor
- x += item.width;
- if i == expand:
- hanchor = 'r'
- gap = spacing
- self.size = (x + hpad, height + 2 * vpad)
- self.add(items)
- self.set(**kwds)
-
-export(Row)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Scrollable.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Scrollable.py
deleted file mode 100644
index dccb3dd..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Scrollable.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Python GUI - Common code for scrollable components - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI import Globals
-
-gtk_scroll_policies = [gtk.POLICY_NEVER, gtk.POLICY_ALWAYS]
-
-
-class Scrollable(object):
-
- gtk_scrollbar_breadth = gtk.VScrollbar().size_request()[0] + 3
- s = gtk.ScrolledWindow().get_style()
- gtk_border_thickness = (s.xthickness, s.ythickness)
- del s
-
- def get_hscrolling(self):
- return self._gtk_outer_widget.get_property('hscrollbar-policy') <> gtk.POLICY_NEVER
-
- def set_hscrolling(self, value):
- self._gtk_outer_widget.set_property('hscrollbar-policy', gtk_scroll_policies[value])
-
- def get_vscrolling(self):
- return self._gtk_outer_widget.get_property('vscrollbar-policy') <> gtk.POLICY_NEVER
-
- def set_vscrolling(self, value):
- self._gtk_outer_widget.set_property('vscrollbar-policy', gtk_scroll_policies[value])
-
-export(Scrollable)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ScrollableView.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ScrollableView.py
deleted file mode 100644
index 8712d62..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ScrollableView.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#
-# Python GUI - Scrollable Views - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI import Scrollable
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount, default_scrolling
-
-class ScrollableView(GScrollableView, Scrollable):
-
- def __init__(self, extent = default_extent,
- line_scroll_amount = default_line_scroll_amount,
- scrolling = default_scrolling,
- **kwds):
- gtk_scrolled_window = gtk.ScrolledWindow()
- gtk_scrolled_window.show()
- GScrollableView.__init__(self, _gtk_outer = gtk_scrolled_window,
- extent = extent, line_scroll_amount = line_scroll_amount,
- scrolling = scrolling)
- self.set(**kwds)
-
- #
- # Properties
- #
-
- def get_border(self):
- return self._gtk_outer_widget.get_shadow_type() <> gtk.SHADOW_NONE
-
- def set_border(self, x):
- if x:
- s = gtk.SHADOW_IN
- else:
- s = gtk.SHADOW_NONE
- self._gtk_outer_widget.set_shadow_type(s)
-
- def get_content_width(self):
- w = self._size[0]
- if self.hscrolling:
- w -= self.gtk_scrollbar_breadth
- if self.border:
- w -= 2 * self.gtk_border_thickness[0]
- return w
-
- def get_content_height(self):
- h = self._size[1]
- if self.vscrolling:
- h -= self.gtk_scrollbar_breadth
- if self.border:
- h -= 2 * self.gtk_border_thickness[1]
- return h
-
- def get_content_size(self):
- return self.content_width, self.content_height
-
- def set_content_size(self, size):
- w, h = size
- d = self.gtk_scrollbar_breadth
- if self.hscrolling:
- w += d
- if self.vscrolling:
- h += d
- if self.border:
- b = self.gtk_border_thickness
- w += 2 * b[0]
- h += 2 * b[1]
- self.size = (w, h)
-
- def get_extent(self):
- return self._gtk_inner_widget.get_size()
-
- def set_extent(self, (w, h)):
- self._gtk_inner_widget.set_size(int(round(w)), int(round(h)))
-
- def get_scroll_offset(self):
- hadj, vadj = self._gtk_adjustments()
- return int(hadj.value), int(vadj.value)
-
- def set_scroll_offset(self, (x, y)):
- hadj, vadj = self._gtk_adjustments()
- hadj.set_value(min(float(x), hadj.upper - hadj.page_size))
- vadj.set_value(min(float(y), vadj.upper - vadj.page_size))
-
- def get_line_scroll_amount(self):
- hadj, vadj = self._gtk_adjustments()
- return hadj.step_increment, vadj.step_increment
-
- def set_line_scroll_amount(self, (dx, dy)):
- hadj, vadj = self._gtk_adjustments()
- hadj.step_increment = float(dx) # Amazingly, ints are not
- vadj.step_increment = float(dy) # acceptable here.
-
- #
- # Internal
- #
-
- def _gtk_adjustments(self):
- gtk_widget = self._gtk_inner_widget
- hadj = gtk_widget.get_hadjustment()
- vadj = gtk_widget.get_vadjustment()
- return hadj, vadj
-
-export(ScrollableView)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Slider.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Slider.py
deleted file mode 100644
index 015d177..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Slider.py
+++ /dev/null
@@ -1,157 +0,0 @@
-#
-# Python GUI - Slider - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GSliders import Slider as GSlider
-
-class Slider(GSlider):
-
- _gtk_tick_length = 8
- _gtk_tick_inset = 18
-
- def __init__(self, orient = 'h', ticks = 0, **kwds):
- self._orient = orient
- self._ticks = ticks
- self._discrete = False
- self._live = True
- self._gtk_ticks = None
- length = 100
- gtk_adjustment = gtk.Adjustment(upper = 1.0)
- xs = 0.0
- ys = 0.0
- if orient == 'h':
- gtk_scale = gtk.HScale(gtk_adjustment)
- gtk_scale.set_size_request(length, -1)
- gtk_box = gtk.VBox()
- xs = 1.0
- elif orient == 'v':
- gtk_scale = gtk.VScale(gtk_adjustment)
- gtk_scale.set_size_request(-1, length)
- gtk_box = gtk.HBox()
- ys = 1.0
- else:
- raise ValueError("Invalid orientation, should be 'h' or 'v'")
- gtk_scale.set_draw_value(False)
- self._gtk_scale = gtk_scale
- gtk_box.pack_start(gtk_scale)
- self._gtk_box = gtk_box
- if ticks:
- self._gtk_create_ticks()
- gtk_alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5,
- xscale = xs, yscale = ys)
- gtk_alignment.add(gtk_box)
- gtk_alignment.show_all()
- self._gtk_connect(gtk_adjustment, 'value-changed', self._gtk_value_changed)
- self._gtk_connect(gtk_scale, 'change-value', self._gtk_change_value)
- self._gtk_connect(gtk_scale, 'button-release-event', self._gtk_button_release)
- self._gtk_scale = gtk_scale
- self._gtk_adjustment = gtk_adjustment
- self._gtk_enable_action = True
- GSlider.__init__(self, _gtk_outer = gtk_alignment, **kwds)
-
- def get_min_value(self):
- return self._min_value
-
- def set_min_value(self, x):
- self._gtk_adjustment.lower = x
-
- def get_max_value(self):
- return self._max_value
-
- def set_max_value(self, x):
- self._gtk_adjustment.upper = x
-
- def get_value(self):
- return self._gtk_adjustment.value
-
- def set_value(self, x):
- self._gtk_enable_action = False
- self._gtk_adjustment.value = x
- self._gtk_enable_action = True
-
- def get_ticks(self):
- return self._ticks
-
- def set_ticks(self, x):
- self._ticks = x
- if x:
- self._gtk_create_ticks()
- else:
- self._gtk_destroy_ticks()
-
- def get_discrete(self):
- return self._discrete
-
- def set_discrete(self, x):
- self._discrete = x
-
- def get_live(self):
- return self._live
-
- def set_live(self, x):
- self._live = x
-
- def _gtk_create_ticks(self):
- if not self._gtk_ticks:
- gtk_ticks = gtk.DrawingArea()
- length = self._gtk_tick_length
- if self._orient == 'h':
- gtk_ticks.set_size_request(-1, length)
- else:
- gtk_ticks.set_size_request(length, -1)
- self._gtk_ticks = gtk_ticks
- self._gtk_connect(gtk_ticks, 'expose-event', self._gtk_draw_ticks)
- self._gtk_box.pack_start(gtk_ticks)
-
- def _gtk_destroy_ticks(self):
- gtk_ticks = self._gtk_ticks
- if gtk_ticks:
- gtk_ticks.destroy()
- self._gtk_ticks = None
-
- def _gtk_draw_ticks(self, event):
- gtk_ticks = self._gtk_ticks
- gdk_win = gtk_ticks.window
- gtk_style = gtk_ticks.style
- orient = self._orient
- steps = self._ticks - 1
- _, _, w, h = gtk_ticks.allocation
- u0 = self._gtk_tick_inset
- v0 = 0
- if orient == 'h':
- draw_line = gtk_style.paint_vline
- u1 = w - u0
- v1 = h
- else:
- draw_line = gtk_style.paint_hline
- u1 = h - u0
- v1 = w
- state = gtk.STATE_NORMAL
- for i in xrange(steps + 1):
- u = u0 + i * (u1 - u0) / steps
- draw_line(gdk_win, state, None, gtk_ticks, "", v0, v1, u)
-
- def _gtk_value_changed(self):
- if self._live and self._gtk_enable_action:
- self.do_action()
-
- def _gtk_change_value(self, event_type, value):
- gtk_adjustment = self._gtk_adjustment
- vmin = gtk_adjustment.lower
- vmax = gtk_adjustment.upper
- value = min(max(vmin, value), vmax)
- if self._discrete:
- steps = self._ticks - 1
- if steps > 0:
- q = round(steps * (value - vmin) / (vmax - vmin))
- value = vmin + q * (vmax - vmin) / steps
- if gtk_adjustment.value <> value:
- gtk_adjustment.value = value
- return True
-
- def _gtk_button_release(self, gtk_event):
- self.do_action()
-
-export(Slider)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdButtons.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdButtons.py
deleted file mode 100644
index f448461..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdButtons.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Python GUI - Standard Buttons
-#
-
-from GUI import Button
-
-class DefaultButton(Button):
-
- def __init__(self, title = "OK", **kwds):
- kwds.setdefault('style', 'default')
- kwds.setdefault('action', 'do_default_action')
- Button.__init__(self, title = title, **kwds)
-
-class CancelButton(Button):
-
- def __init__(self, title = "Cancel", **kwds):
- kwds.setdefault('style', 'cancel')
- kwds.setdefault('action', 'do_cancel_action')
- Button.__init__(self, title = title, **kwds)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdColors.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdColors.py
deleted file mode 100644
index f7701b4..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdColors.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Python GUI - Standard Colors - Generic
-#
-
-from GUI.Colors import rgb, selection_forecolor, selection_backcolor
-
-black = rgb(0, 0, 0)
-dark_grey = rgb(0.25, 0.25, 0.25)
-grey = rgb(0.5, 0.5, 0.5)
-light_grey = rgb(0.75, 0.75, 0.75)
-white = rgb(1, 1, 1)
-red = rgb(1, 0, 0)
-green = rgb(0, 1, 0)
-blue = rgb(0, 0, 1)
-yellow = rgb(1, 1, 0)
-cyan = rgb(0, 1, 1)
-magenta = rgb(1, 0, 1)
-clear = rgb(0, 0, 0, 0)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdCursors.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdCursors.py
deleted file mode 100644
index be943e9..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdCursors.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Python GUI - Standard Cursors - Gtk
-#
-
-from gtk import gdk
-from GUI import Cursor
-
-__all__ = [
- 'arrow',
- 'ibeam',
- 'crosshair',
- 'fist',
- 'hand',
- 'finger',
- 'invisible',
-]
-
-arrow = Cursor._from_gtk_std_cursor(gdk.LEFT_PTR)
-ibeam = Cursor._from_gtk_std_cursor(gdk.XTERM)
-crosshair = Cursor._from_gtk_std_cursor(gdk.TCROSS)
-fist = Cursor("cursors/fist.tiff")
-hand = Cursor("cursors/hand.tiff")
-finger = Cursor("cursors/finger.tiff")
-invisible = Cursor._from_nothing()
-
-del gdk
-del Cursor
-
-def empty_cursor():
- return invisible
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdFonts.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdFonts.py
deleted file mode 100644
index 9281638..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdFonts.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Python GUI - Standard Fonts - Gtk
-#
-
-import gtk
-from GUI import Font
-
-system_font = Font._from_pango_description(gtk.Label().style.font_desc)
-application_font = Font._from_pango_description(gtk.Entry().style.font_desc)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdMenus.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdMenus.py
deleted file mode 100644
index c60f653..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/StdMenus.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Python GUI - Standard Menus - Gtk
-#
-
-from GUI.GStdMenus import build_menus, \
- fundamental_cmds, help_cmds, pref_cmds, file_cmds, print_cmds, edit_cmds
-
-_file_menu_items = [
- ("New/N", 'new_cmd'),
- ("Open.../O", 'open_cmd'),
- ("Close/W", 'close_cmd'),
- "-",
- ("Save/S", 'save_cmd'),
- ("Save As...", 'save_as_cmd'),
- ("Revert", 'revert_cmd'),
- "-",
- ("Page Setup...", 'page_setup_cmd'),
- ("Print.../P", 'print_cmd'),
- "-",
- ("Quit/Q", 'quit_cmd'),
-]
-
-_edit_menu_items = [
- ("Undo/Z", 'undo_cmd'),
- ("Redo/^Z", 'redo_cmd'),
- "-",
- ("Cut/X", 'cut_cmd'),
- ("Copy/C", 'copy_cmd'),
- ("Paste/V", 'paste_cmd'),
- ("Clear", 'clear_cmd'),
- "-",
- ("Select All/A", 'select_all_cmd'),
- "-",
- ("Preferences...", 'preferences_cmd'),
-]
-
-_help_menu_items = [
- ("About ", 'about_cmd'),
-]
-
-#------------------------------------------------------------------------------
-
-def basic_menus(substitutions = {}, include = None, exclude = None):
- return build_menus([
- ("File", _file_menu_items, False),
- ("Edit", _edit_menu_items, False),
- ("Help", _help_menu_items, True),
- ],
- substitutions = substitutions,
- include = include,
- exclude = exclude)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Task.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Task.py
deleted file mode 100644
index ae2a791..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Task.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# PyGUI - Tasks - Gtk
-#
-
-import gobject
-from GUI import export
-from GUI.GTasks import Task as GTask
-
-class Task(GTask):
-
- def __init__(self, proc, interval, repeat = 0, start = 1):
- self._proc = proc
- self._gtk_interval = int(interval * 1000)
- self._repeat = repeat
- self._gtk_timeout_id = None
- if start:
- self.start()
-
- def get_scheduled(self):
- return self._gtk_timeout_id is not None
-
- def get_interval(self):
- return self._gtk_interval / 1000.0
-
- def get_repeat(self):
- return self._repeat
-
- def start(self):
- if self._gtk_timeout_id is None:
- self._gtk_timeout_id = gobject.timeout_add(self._gtk_interval,
- self._gtk_fire)
-
- def stop(self):
- id = self._gtk_timeout_id
- if id is not None:
- gobject.source_remove(id)
- self._gtk_timeout_id = None
-
- def _gtk_fire(self):
- self._proc()
- if self._repeat:
- return 1
- else:
- self._gtk_timeout_id = None
-
-export(Task)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextEditor.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextEditor.py
deleted file mode 100644
index 5a82cad..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextEditor.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# Python GUI - Text Editor - Gtk
-#
-
-import pango, gtk
-from GUI import export
-from GUI import application
-from GUI import Scrollable
-from GUI import Font
-from GUI.GTextEditors import TextEditor as GTextEditor
-
-class TextEditor(GTextEditor, Scrollable):
-
- _font = None
-
- def __init__(self, scrolling = 'hv', **kwds):
- gtk_sw = gtk.ScrolledWindow()
- gtk_sw.show()
- gtk_tv = gtk.TextView()
- gtk_tv.show()
- gtk_sw.add(gtk_tv)
- gtk_tb = gtk.TextBuffer()
- self._gtk_textbuffer = gtk_tb
- gtk_tv.set_buffer(self._gtk_textbuffer)
- tag = gtk.TextTag()
- tabs = pango.TabArray(1, True)
- tabs.set_tab(0, pango.TAB_LEFT, 28)
- tag.set_property('tabs', tabs)
- tag.set_property('tabs-set', True)
- self._gtk_tag = tag
- gtk_tb.get_tag_table().add(tag)
- GTextEditor.__init__(self, _gtk_outer = gtk_sw, _gtk_inner = gtk_tv,
- _gtk_focus = gtk_tv, **kwds)
- self.set_hscrolling('h' in scrolling)
- self.set_vscrolling('v' in scrolling)
- if 'h' not in scrolling:
- gtk_tv.set_wrap_mode(gtk.WRAP_WORD)
- self._gtk_apply_tag()
-
- def _gtk_get_sel_iters(self):
- gtk_textbuffer = self._gtk_textbuffer
- sel_iters = gtk_textbuffer.get_selection_bounds()
- if not sel_iters:
- insert_mark = gtk_textbuffer.get_insert()
- insert_iter = gtk_textbuffer.get_iter_at_mark(insert_mark)
- sel_iters = (insert_iter, insert_iter)
- return sel_iters
-
- def _gtk_apply_tag(self):
- tb = self._gtk_textbuffer
- tb.apply_tag(self._gtk_tag, tb.get_start_iter(), tb.get_end_iter())
-
- def get_selection(self):
- tb = self._gtk_textbuffer
- bounds = tb.get_selection_bounds()
- if bounds:
- return (bounds[0].get_offset(), bounds[1].get_offset())
- else:
- i = tb.get_property('cursor-position')
- return (i, i)
-
- def set_selection(self, value):
- tb = self._gtk_textbuffer
- start = tb.get_iter_at_offset(value[0])
- end = tb.get_iter_at_offset(value[1])
- tb.select_range(start, end)
-
- def get_text(self):
- tb = self._gtk_textbuffer
- start = tb.get_start_iter()
- end = tb.get_end_iter()
- return tb.get_slice(start, end)
-
- def set_text(self, text):
- self._gtk_textbuffer.set_text(text)
- self._gtk_apply_tag()
-
- def get_text_length(self):
- return self._gtk_textbuffer.get_end_iter().get_offset()
-
- def get_font(self):
- font = self._font
- if not font:
- font = Font._from_pango_description(self._gtk_inner_widget.style.font_desc)
- return font
-
- def set_font(self, f):
- self._font = f
- tv = self._gtk_inner_widget
- tv.modify_font(f._pango_description)
-
- def get_tab_spacing(self):
- tabs = self._gtk_tag.get_property('tabs')
- return tabs.get_tab(0)[1]
-
- def set_tab_spacing(self, x):
- tabs = pango.TabArray(1, True)
- tabs.set_tab(0, pango.TAB_LEFT, x)
- self._gtk_tag.set_property('tabs', tabs)
-
- def cut_cmd(self):
- self.copy_cmd()
- self.clear_cmd()
-
- def copy_cmd(self):
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- text = gtk_textbuffer.get_text(start_iter, end_iter, 1)
- if text:
- application().set_clipboard(text)
-
- def paste_cmd(self):
- text = application().get_clipboard()
- self.clear_cmd()
- self._gtk_textbuffer.insert_at_cursor(text)
-
- def clear_cmd(self):
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- gtk_textbuffer.delete(start_iter, end_iter)
-
-export(TextEditor)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextEditorPrinting.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextEditorPrinting.py
deleted file mode 100644
index d3afe19..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextEditorPrinting.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - TextEditor Printing - Generic
-#
-#------------------------------------------------------------------------------
-
-import re
-from GUI import View
-
-class TextEditorPrintView(View):
-
- def __init__(self, base_view, page_setup):
- print "TextEditorPrintView:" ###
- print "...paper_size =", page_setup.paper_size ###
- print "...margins =", page_setup.margins ###
- print "...page_size =", page_setup.page_size ###
- View.__init__(self)
- self.base_view = base_view
- self.width = page_setup.page_width
- self.page_height = page_setup.page_height
- self.lay_out_text()
- lines_per_page = int(page_setup.page_height / base_view.font.line_height)
- self.lines_per_page = lines_per_page
- num_lines = len(self.lines)
- self.num_pages = (num_lines + lines_per_page - 1) // lines_per_page
- self.height = self.num_pages * self.page_height
-
- def lay_out_text(self):
- base_view = self.base_view
- font = base_view.font
- space_width = font.width(" ")
- tab_spacing = base_view.tab_spacing
- page_width = self.width
- pat = re.compile(r"[ \t]|[^ \t]+")
- lines = []
- line = []
- x = 0
- for text_line in base_view.text.splitlines():
- for match in pat.finditer(text_line):
- item = match.group()
- if item == " ":
- item_width = space_width
- item = ""
- elif item == "\t":
- item_width = tab_spacing - x % tab_spacing
- item = ""
- else:
- item_width = font.width(item)
- if x + item_width > page_width and x > 0:
- lines.append(line); line = []; x = 0
- line.append((x, item))
- x += item_width
- lines.append(line); line = []; x = 0
- self.lines = lines
-
- def draw(self, canvas, page_rect):
- l, t, r, b = page_rect
- page_no = int(t / self.page_height)
- n = self.lines_per_page
- i = page_no * n
- font = self.base_view.font
- y = t + font.ascent
- dy = font.line_height
- for line in self.lines[i : i + n]:
- for x, item in line:
- canvas.moveto(x, y)
- canvas.show_text(item)
- y += dy
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextField.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextField.py
deleted file mode 100644
index 8ad6bc4..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/TextField.py
+++ /dev/null
@@ -1,188 +0,0 @@
-#
-# Python GUI - Text fields - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import application
-from GUI.StdFonts import application_font
-from GUI.GTextFields import TextField as GTextField
-
-gtk_margins = (2, 2, 0, 0)
-
-class TextField(GTextField):
-
- _pass_key_events_to_platform = True
-
- _multiline = 0
-
- def __init__(self, font = application_font, lines = 1,
- multiline = 0, password = 0, **kwds):
- self._multiline = multiline
- lm, tm, rm, bm = gtk_margins
- if multiline:
- gtk_textbuffer = gtk.TextBuffer()
- gtk_textview = gtk.TextView(gtk_textbuffer)
- #gtk_textview.set_accepts_tab(False) #^%$#^%$!!! moves the focus itself.
- #self._gtk_connect(gtk_textview, 'key-press-event', self._gtk_key_press_event)
- gtk_alignment = gtk.Alignment(0.5, 0.5, 1.0, 1.0)
- gtk_alignment.set_padding(tm, bm, lm, rm)
- gtk_alignment.add(gtk_textview)
- gtk_box = gtk.EventBox()
- gtk_box.add(gtk_alignment)
- gtk_box.modify_bg(gtk.STATE_NORMAL,
- gtk_textview.style.base[gtk.STATE_NORMAL])
- gtk_frame = gtk.Frame()
- gtk_frame.set_shadow_type(gtk.SHADOW_IN)
- gtk_frame.add(gtk_box)
- self._gtk_textbuffer = gtk_textbuffer
- gtk_text_widget = gtk_textview
- gtk_outer = gtk_frame
- else:
- gtk_entry = gtk.Entry()
- #self._gtk_connect(gtk_entry, 'key-press-event', self._gtk_key_press_event)
- self._gtk_entry = gtk_entry
- gtk_text_widget = gtk_entry
- gtk_outer = gtk_entry
- self._font = font
- gtk_text_widget.modify_font(font._pango_description)
- self._vertical_padding = tm + 2 * gtk_outer.style.ythickness + bm
- height = self._vertical_padding + lines * font.text_size("X")[1]
- gtk_outer.set_size_request(-1, height)
- self._password = password
- if password:
- if not multiline:
- self._gtk_entry.set_visibility(0)
- self._gtk_entry.set_invisible_char("*")
- else:
- raise ValueError("The password option is not supported for multiline"
- " TextFields on this platform")
- gtk_outer.show_all()
- GTextField.__init__(self,
- _gtk_outer = gtk_outer,
- _gtk_title = gtk_text_widget,
- _gtk_focus = gtk_text_widget,
- _gtk_input = gtk_text_widget,
- multiline = multiline, **kwds)
-
- def get_text(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start = gtk_textbuffer.get_start_iter()
- end = gtk_textbuffer.get_end_iter()
- return self._gtk_textbuffer.get_text(start, end, 1)
- else:
- return self._gtk_entry.get_text()
-
- def set_text(self, text):
- if self._multiline:
- self._gtk_textbuffer.set_text(text)
- else:
- self._gtk_entry.set_text(text)
-
- def get_selection(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- start = start_iter.get_offset()
- end = end_iter.get_offset()
- sel = (start, end)
- else:
- sel = self._gtk_get_sel_positions()
- return sel
-
- def _gtk_get_sel_iters(self):
- gtk_textbuffer = self._gtk_textbuffer
- sel_iters = gtk_textbuffer.get_selection_bounds()
- if not sel_iters:
- insert_mark = gtk_textbuffer.get_insert()
- insert_iter = gtk_textbuffer.get_iter_at_mark(insert_mark)
- sel_iters = (insert_iter, insert_iter)
- return sel_iters
-
- def _gtk_get_sel_positions(self):
- gtk_entry = self._gtk_entry
- sel = gtk_entry.get_selection_bounds()
- if not sel:
- pos = gtk_entry.get_position()
- sel = (pos, pos)
- return sel
-
- def _set_selection(self, start, end):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter = gtk_textbuffer.get_iter_at_offset(start)
- end_iter = gtk_textbuffer.get_iter_at_offset(end)
- gtk_textbuffer.select_range(start_iter, end_iter)
- else:
- self._gtk_entry.select_region(start, end)
-
- def set_selection(self, (start, end)):
- self._set_selection(start, end)
- self.become_target()
-
- def get_multiline(self):
- return self._multiline
-
- def get_password(self):
- return self._password
-
- def _select_all(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start = gtk_textbuffer.get_start_iter()
- end = gtk_textbuffer.get_end_iter()
- gtk_textbuffer.select_range(start, end)
- else:
- self._gtk_entry.select_region(0, -1)
-
- def select_all(self):
- self._select_all()
- self.become_target()
-
- def cut_cmd(self):
- self.copy_cmd()
- self.clear_cmd()
-
- def copy_cmd(self):
- if self._password:
- return
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- text = gtk_textbuffer.get_text(start_iter, end_iter, 1)
- else:
- start, end = self._gtk_get_sel_positions()
- text = self._gtk_entry.get_chars(start, end)
- if text:
- application().set_clipboard(text)
-
- def paste_cmd(self):
- text = application().get_clipboard()
- self.clear_cmd()
- if self._multiline:
- self._gtk_textbuffer.insert_at_cursor(text)
- else:
- gtk_entry = self._gtk_entry
- pos = gtk_entry.get_position()
- gtk_entry.insert_text(text, pos)
- gtk_entry.set_position(pos + len(text))
-
- def clear_cmd(self):
- if self._multiline:
- gtk_textbuffer = self._gtk_textbuffer
- start_iter, end_iter = self._gtk_get_sel_iters()
- gtk_textbuffer.delete(start_iter, end_iter)
- else:
- start, end = self._gtk_get_sel_positions()
- self._gtk_entry.delete_text(start, end)
-
- def _untargeted(self):
- self._set_selection(0, 0)
-
- def _tab_in(self):
- self._select_all()
- GTextField._tab_in(self)
-
-export(TextField)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Version.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Version.py
deleted file mode 100644
index 326513e..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Version.py
+++ /dev/null
@@ -1 +0,0 @@
-version = '2.5.3'
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/View.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/View.py
deleted file mode 100644
index b507db7..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/View.py
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Python GUI - Views - Gtk
-#
-
-from GUI import export
-from GUI.GViews import View
-
-export(View)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ViewBase.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ViewBase.py
deleted file mode 100644
index 8cea9e2..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/ViewBase.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Python GUI - View Base - Gtk
-#
-
-import gtk
-from GUI import export
-from GUI.GViewBases import ViewBase as GViewBase
-
-class ViewBase(GViewBase):
-
- def __init__(self, **kwds):
- GViewBase.__init__(self, **kwds)
- self._gtk_connect(self._gtk_inner_widget, 'realize', self._gtk_realize)
-
- def track_mouse(self):
- finished = 0
- while not finished:
- self._mouse_event = None
- while not self._mouse_event:
- gtk.main_iteration()
- event = self._mouse_event
- if event.kind == 'mouse_up':
- finished = 1
- yield event
-
- def _cursor_changed(self):
- gtk_widget = self._gtk_inner_widget
- gdk_window = gtk_widget.window
- if gdk_window:
- cursor = self._cursor
- if cursor:
- gdk_window.set_cursor(self._cursor._gtk_cursor)
- else:
- gdk_window.set_cursor(None)
-
- def _gtk_realize(self):
- self._cursor_changed()
-
- def _targeted(self):
- self.targeted()
-
- def _untargeted(self):
- self.untargeted()
-
-export(ViewBase)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Window.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Window.py
deleted file mode 100644
index 15da4ff..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/Window.py
+++ /dev/null
@@ -1,263 +0,0 @@
-#
-# Python GUI - Windows - Gtk version
-#
-
-import sys
-import gtk
-from gtk import gdk
-from GUI import export
-from GUI import export
-from GUI.GGeometry import sub_pt
-from GUI import Component
-from GUI import Container
-from GUI import application
-from GUI.GWindows import Window as GWindow
-
-_default_width = 200
-_default_height = 200
-
-_modal_styles = ('modal_dialog', 'alert')
-_dialog_styles = ('nonmodal_dialog', 'modal_dialog', 'alert')
-
-class Window(GWindow):
-
- #_pass_key_events_to_platform = False
-
- _size = (_default_width, _default_height)
- _gtk_menubar = None
- _need_menubar_update = 0
- _target = None
-
- def __init__(self, style = 'standard', title = "New Window",
- movable = 1, closable = 1, hidable = None, resizable = 1,
- zoomable = 1, **kwds):
- self._all_menus = []
- modal = style in _modal_styles
- if hidable is None:
- hidable = not modal
- self._resizable = resizable
- gtk_win = gtk.Window(gtk.WINDOW_TOPLEVEL)
- gtk_win.set_gravity(gdk.GRAVITY_STATIC)
- gtk_win.set_decorated(style <> 'fullscreen'
- and (movable or closable or hidable or zoomable))
- gtk_win.set_resizable(resizable)
- gtk_win.set_modal(style in _modal_styles)
- gtk_content = gtk.Layout()
- gtk_content.show()
- if style in _dialog_styles:
- gtk_win.set_type_hint(gdk.WINDOW_TYPE_HINT_DIALOG)
- gtk_win.add(gtk_content)
- else:
- self._gtk_create_menubar()
- gtk_box = gtk.VBox()
- gtk_box.show()
- gtk_box.pack_start(self._gtk_menubar, expand = 0, fill = 0)
- gtk_box.pack_end(gtk_content, expand = 1, fill = 1)
- gtk_win.add(gtk_box)
- self._need_menubar_update = 1
- self._gtk_connect(gtk_win, 'configure-event', self._gtk_configure_event)
- self._gtk_connect(gtk_win, 'key-press-event', self._gtk_key_press_event)
- self._gtk_connect(gtk_win, 'delete-event', self._gtk_delete_event)
- GWindow.__init__(self, _gtk_outer = gtk_win, _gtk_inner = gtk_content,
- _gtk_focus = gtk_content, _gtk_input = gtk_content,
- style = style, title = title, closable = closable)
- if style == 'fullscreen':
- size = (gdk.screen_width(), gdk.screen_height())
- else:
- size = (_default_width, _default_height)
- self.set_size(size)
- self.set(**kwds)
- self.become_target()
-
- def _gtk_create_menubar(self):
- gtk_menubar = gtk.MenuBar()
- gtk_dummy_item = gtk.MenuItem("")
- gtk_menubar.append(gtk_dummy_item)
- gtk_menubar.show_all()
- h = gtk_menubar.size_request()[1]
- gtk_menubar.set_size_request(-1, h)
- gtk_dummy_item.remove_submenu()
- self._gtk_menubar = gtk_menubar
- self._gtk_connect(gtk_menubar, 'button-press-event',
- self._gtk_menubar_button_press_event)
-
- def destroy(self):
- self.hide()
- GWindow.destroy(self)
-
- def set_menus(self, x):
- GWindow.set_menus(self, x)
- self._need_menubar_update = 1
- if self.visible:
- self._gtk_update_menubar()
-
- def get_title(self):
- return self._gtk_outer_widget.get_title()
-
- def set_title(self, new_title):
- self._gtk_outer_widget.set_title(new_title)
-
- def set_position(self, v):
- self._position = v
- self._gtk_outer_widget.move(*v)
-
- def set_size(self, new_size):
- w, h = new_size
- if self._resizable:
- h += self._gtk_menubar_height()
- gtk_resize = self._gtk_outer_widget.resize
- else:
- gtk_resize = self._gtk_inner_widget.set_size_request
- gtk_resize(max(w, 1), max(h, 1))
- self._size = new_size
-
- def _gtk_configure_event(self, gtk_event):
- gtk_win = self._gtk_outer_widget
- self._position = gtk_win.get_position()
- #self._update_size(gtk_win.get_size())
- w, h = gtk_win.get_size()
- #w, h = self._gtk_inner_widget.get_size()
- #w, h = self._gtk_inner_widget.size_request()
- old_size = self._size
- new_size = (w, h - self._gtk_menubar_height())
- #new_size = (w, h)
- #print "Window._gtk_configure_event:", old_size, "->", new_size ###
- self._size = new_size
- if old_size <> new_size:
- self._resized(sub_pt(new_size, old_size))
-
- def get_visible(self):
- return self._gtk_outer_widget.get_property('visible')
-
- def set_visible(self, new_v):
- old_v = self.visible
- self._gtk_outer_widget.set_property('visible', new_v)
- if new_v and not old_v and self._need_menubar_update:
- self._gtk_update_menubar()
-
- def _show(self):
- self.set_visible(1)
- self._gtk_outer_widget.present()
-
-# def key_down(self, event):
-# if event.char == '\t':
-# if event.shift:
-# self._tab_to_prev()
-# else:
-# self._tab_to_next()
-# else:
-# self.pass_to_next_handler('key_down', event)
-
- def get_target(self):
- target = Component._gtk_find_component(self._gtk_outer_widget.get_focus())
- return target or self
-
- def _screen_rect(self):
- w = gdk.screen_width()
- h = gdk.screen_height()
- return (0, 0, w, h)
-
- def _gtk_menubar_height(self):
- mb = self._gtk_menubar
- if mb:
- h = mb.size_request()[1]
- else:
- h = 0
- #print "Window._gtk_menubar_height -->", h ###
- return h
-
- def _gtk_delete_event(self, event):
- try:
- self.close_cmd()
- except:
- sys.excepthook(*sys.exc_info())
- return 1
-
- def _gtk_update_menubar(self):
- #
- # Update the contents of the menubar after either the application
- # menu list or this window's menu list has changed. We only add
- # the menu titles at this stage; the menus themselves are attached
- # during menu setup. We also attach the accel groups associated
- # with the new menus.
- #
- # Things would be simpler if we could attach the menus here,
- # but attempting to share menus between menubar items provokes
- # a warning from Gtk, even though it otherwise appears to work.
- #
- gtk_menubar = self._gtk_menubar
- gtk_window = self._gtk_outer_widget
- # Remove old accel groups
- for menu in self._all_menus:
- gtk_window.remove_accel_group(menu._gtk_accel_group)
- # Detach any existing menus and remove old menu titles
- if gtk_menubar:
- for gtk_menubar_item in gtk_menubar.get_children():
- gtk_menubar_item.remove_submenu()
- gtk_menubar_item.destroy()
- # Install new menu list
- #all_menus = application().menus + self.menus
- all_menus = application()._effective_menus_for_window(self)
- self._all_menus = all_menus
- # Create new menu titles and attach accel groups
- for menu in all_menus:
- if gtk_menubar:
- gtk_menubar_item = gtk.MenuItem(menu._title)
- gtk_menubar_item.show()
- gtk_menubar.append(gtk_menubar_item)
- gtk_window.add_accel_group(menu._gtk_accel_group)
- self._need_menubar_update = 0
-
- def _gtk_menubar_button_press_event(self, event):
- # A button press has occurred in the menu bar. Before pulling
- # down the menu, perform menu setup and attach the menus to
- # the menubar items.
- self._gtk_menu_setup()
- for (gtk_menubar_item, menu) in \
- zip(self._gtk_menubar.get_children(), self._all_menus):
- gtk_menu = menu._gtk_menu
- attached_widget = gtk_menu.get_attach_widget()
- if attached_widget and attached_widget is not gtk_menubar_item:
- attached_widget.remove_submenu()
- gtk_menubar_item.set_submenu(gtk_menu)
-
- def _gtk_key_press_event(self, gtk_event):
- # Intercept key presses with the Control key down and update
- # menus, in case this is a keyboard equivalent for a menu command.
- if gtk_event.state & gdk.CONTROL_MASK:
- #print "Window._gtk_key_press_event: doing menu setup"
- self._gtk_menu_setup()
- # It appears that GtkWindow caches accelerators, and updates
- # the cache in an idle task after accelerators change. This
- # would be too late for us, so we force it to be done now.
- self._gtk_outer_widget.emit("keys-changed")
- #print "Window._gtk_key_press_event: done menu setup"
-
- def _gtk_menu_setup(self):
- application()._perform_menu_setup(self._all_menus)
-
- def _default_key_event(self, event):
- self.pass_event_to_next_handler(event)
- if event._originator is self:
- event._not_handled = True
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
-
-_gtk_menubar_height = None
-
-def _gtk_find_menubar_height():
- global _gtk_menubar_height
- if _gtk_menubar_height is None:
- print "Windows: Finding menubar height"
- item = gtk.MenuItem("X")
- bar = gtk.MenuBar()
- bar.append(item)
- bar.show_all()
- w, h = bar.size_request()
- _gtk_menubar_height = h
- print "...done"
- return _gtk_menubar_height
-
-export(Window)
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/__init__.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/__init__.py
deleted file mode 100644
index 5dc533b..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/__init__.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Top level package initialisation
-#
-#--------------------------------------------------------------------
-
-import sys, types
-
-# The first item of each of the following pairs is the name of a module
-# to try to import. If the import is successful, the platform-dependent
-# directory named by the second item is used.
-
-_versions = [
- ("objc", "Cocoa"),
- ("nt", "Win32"),
- ("gi.repository.Gtk", "GtkGI"),
- ("gtk", "Gtk"),
-]
-
-#
-# The following function exports a class or function from a submodule in
-# such a way that it appears to have been defined directly at the top
-# level of the package. By giving the submodule that defines the class the
-# same name as the class, this provides an autoloading facility that is
-# friendly to application bundling tools.
-#
-
-_preserve = [] # Keeps references to replaced modules so they aren't cleared
-
-def export(obj):
- qname = "%s.%s" % (__name__, obj.__name__)
- obj.__module__ = __name__
- mod = sys.modules[qname]
- _preserve.append(mod)
- sys.modules[qname] = obj
-
-#
-# The environment variable PYGUI_IMPLEMENTATION may be set to the
-# name of one of the platform-dependent directories to force that
-# implementation to be used. This can be useful if more than one
-# PyGUI implementation is usable on your setup.
-#
-
-from os import environ as _env
-_platdir = _env.get("PYGUI_IMPLEMENTATION")
-if not _platdir:
- for _testmod, _platdir in _versions:
- try:
- __import__(_testmod)
- break
- except ImportError:
- continue
- else:
- raise ImportError("Unable to find an implementation of PyGUI for this installation")
-
-if _env.get("PYGUI_IMPLEMENTATION_DEBUG"):
- sys.stderr.write("PyGUI: Using implementation: %s\n" % _platdir)
-
-#
-# Append the chosen platform-dependent directory to the search
-# path for submodules of this package.
-#
-
-from os.path import join as _join
-_here = __path__[0]
-__path__.append(_join(_here, _platdir))
-__path__.append(_join(_here, "Generic"))
-
-#
-# Import global functions
-#
-
-from GUI.Globals import application, run
-from GUI.Colors import rgb
-
-#
-# Set up initial resource search path
-#
-
-from GUI import Resources
-Resources._add_file_path(__file__)
-_main_dir = sys.path[0]
-Resources._add_directory_path(_main_dir)
-Resources._add_directory_path(_main_dir, 1)
-#import __main__
-#Resources._add_module_path(__main__)
-#Resources._add_module_path(__main__, 1)
-#print "GUI: resource_path =", Resources.resource_path ###
-
-#
-# Perform global initialisation
-#
-
-import GUI.Application
diff --git a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/py2exe.py b/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/py2exe.py
deleted file mode 100644
index 8c6541b..0000000
--- a/PyGUI-2.5.3/build/lib.linux-i686-2.6/GUI/py2exe.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Fix py2exe to handle dynamic pywin32 module search paths
-#
-#--------------------------------------------------------------------
-
-import sys
-
-# py2exe 0.6.4 introduced a replacement modulefinder.
-# This means we have to add package paths there, not to the built-in
-# one. If this new modulefinder gets integrated into Python, then
-# we might be able to revert this some day.
-# if this doesn't work, try import modulefinder
-try:
- import py2exe.mf as modulefinder
-except ImportError:
- import modulefinder
-import win32com
-for p in win32com.__path__[1:]:
- modulefinder.AddPackagePath("win32com", p)
-for extra in ["win32com.shell"]: #,"win32com.mapi"
- __import__(extra)
- m = sys.modules[extra]
- for p in m.__path__[1:]:
- modulefinder.AddPackagePath(extra, p)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Actions.py b/PyGUI-2.5.3/build/lib/GUI/Actions.py
deleted file mode 100644
index 7f2ea48..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Actions.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Actions - Generic
-#
-#------------------------------------------------------------------------------
-
-from GUI.Properties import overridable_property
-from GUI.Exceptions import ApplicationError
-
-#------------------------------------------------------------------------------
-
-def action_property(name, doc):
- attr = intern('_' + name)
- def getter(self):
- return getattr(self, attr)
- def setter(self, value):
- setattr(self, attr, value)
- return property(getter, setter, None, doc)
-
-#------------------------------------------------------------------------------
-
-class ActionBase(object):
- """Mixin class providing base support for action properties."""
-
- def do_named_action(self, name):
- #print "ActionBase.do_named_action:", repr(name) ###
- action = getattr(self, name)
- #print "...action =", repr(action) ###
- if action:
- try:
- if isinstance(action, tuple):
- args = action[1:]
- action = action[0]
- else:
- args = ()
- if isinstance(action, str):
- #print "...handling", action ###
- self.handle(action, *args)
- else:
- action(*args)
- except ApplicationError:
- raise
- except:
- import sys
- et, ev, tb = sys.exc_info()
- raise et, et("%s (while doing action %r%r)" % (ev, action, args)), tb
-
-#------------------------------------------------------------------------------
-
-class Action(ActionBase):
- """Mixin class providing a single action property called 'action'."""
-
- action = action_property('action', """Action to be performed.
- May be or (, ...) where is either
- a message name or a callable object.""")
-
- _action = None
-
- def do_action(self):
- "Invoke the action."
- self.do_named_action('action')
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/AlertClasses.py b/PyGUI-2.5.3/build/lib/GUI/AlertClasses.py
deleted file mode 100644
index 6157c34..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/AlertClasses.py
+++ /dev/null
@@ -1,7 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Alert - Win32
-#
-#--------------------------------------------------------------------
-
-from GUI.GAlertClasses import Alert, Alert2, Alert3
diff --git a/PyGUI-2.5.3/build/lib/GUI/Alerts.py b/PyGUI-2.5.3/build/lib/GUI/Alerts.py
deleted file mode 100644
index efc5351..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Alerts.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#-----------------------------------------------------------------------
-#
-# PyGUI - Alert functions - Generic
-#
-#-----------------------------------------------------------------------
-
-from GUI import BaseAlertFunctions
-
-def alert(kind, prompt, ok_label = "OK", **kwds):
- """Displays an alert box with one button. Does not return a value.
- Kind may be 'stop' for conditions preventing continuation,
- 'caution' for warning messages, 'note' for informational
- messages, and 'query' for asking a question of the user."""
-
- BaseAlertFunctions.alert(kind, prompt, ok_label, **kwds)
-
-
-def alert2(kind, prompt, yes_label = "Yes", no_label = "No",
- **kwds):
- """Displays an alert with two buttons. Returns 1 if the
- first button is pressed, 0 if the second button is pressed.
- The 'default' and 'cancel' arguments specify which buttons,
- if any, are activated by the standard keyboard equivalents,
- and take the values 1, 0 or None."""
-
- return BaseAlertFunctions.alert2(kind, prompt, yes_label, no_label,**kwds)
-
-
-def alert3(kind, prompt,
- yes_label = "Yes", no_label = "No", other_label = "Cancel",
- **kwds):
- """Displays an alert with 3 buttons. Returns 1 if the
- first button is pressed, 0 if the second button is pressed,
- and -1 if the third button is pressed. The 'default' and 'cancel'
- arguments specify which buttons, if any, are activated by the
- standard keyboard equivalents, and take the values 1, 0, -1 or None."""
-
- return BaseAlertFunctions.alert3(kind, prompt, yes_label, no_label, other_label, **kwds)
-
-
-def stop_alert(*args, **kwds):
- """Displays a 1-button alert of type 'stop'. See alert()."""
- alert('stop', *args, **kwds)
-
-def note_alert(*args, **kwds):
- """Displays a 1-button alert of type 'note'. See alert()."""
- alert('note', *args, **kwds)
-
-def confirm(*args, **kwds):
- """Displays a 2-button alert of type 'caution'. See alert2()."""
- return alert2('caution', *args, **kwds)
-
-def ask(*args, **kwds):
- """Displays a 2-button alert of type 'query'. See alert2()."""
- return alert2('query', *args, **kwds)
-
-def confirm_or_cancel(*args, **kwds):
- """Displays a 3-button alert of type 'caution'. See alert3()."""
- return alert3('caution', *args, **kwds)
-
-def ask_or_cancel(*args, **kwds):
- """Displays a 3-button alert of type 'query'. See alert3()."""
- return alert3('query', *args, **kwds)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Application.py b/PyGUI-2.5.3/build/lib/GUI/Application.py
deleted file mode 100644
index a456aab..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Application.py
+++ /dev/null
@@ -1,356 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Application class - PyObjC
-#
-#------------------------------------------------------------------------------
-
-import os, sys, traceback
-import objc
-from Foundation import NSObject, NSBundle, NSDefaultRunLoopMode, NSData, NSDate
-import AppKit
-from AppKit import NSApplication, NSResponder, NSScreen, NSMenu, NSMenuItem, \
- NSKeyDown, NSKeyUp, NSMouseMoved, NSLeftMouseDown, NSSystemDefined, \
- NSCommandKeyMask, NSPasteboard, NSStringPboardType, NSModalPanelRunLoopMode
-NSAnyEventMask = 0xffffffff
-from GUI import Globals, GApplications
-from GUI import application, export
-from GUI.GApplications import Application as GApplication
-from GUI import Event
-
-#------------------------------------------------------------------------------
-
-Globals.ns_screen_height = None
-Globals.ns_last_mouse_moved_event = None
-Globals.pending_exception = None
-Globals.ns_application = None
-
-ns_distant_future = NSDate.distantFuture()
-
-#------------------------------------------------------------------------------
-
-class Application(GApplication):
- # _ns_app _PyGui_NSApplication
- # _ns_pasteboard NSPasteboard
- # _ns_key_window Window
-
- _ns_menubar_update_pending = False
- _ns_files_opened = False
- _ns_using_clargs = False
- _ns_menus_updated = False
-
- def __init__(self, **kwds):
- self._ns_app = Globals.ns_application
- self._ns_app.pygui_app = self
- self._ns_pasteboard = NSPasteboard.generalPasteboard()
- self._ns_key_window = None
- GApplication.__init__(self, **kwds)
- self.ns_init_application_name()
-
- def destroy(self):
- del self.menus[:]
- import Windows
- Windows._ns_zombie_window = None
- self._ns_app.pygui_app = None
- self._ns_app = None
- self._ns_pasteboard = None
- GApplication.destroy(self)
-
- def set_menus(self, menu_list):
- GApplication.set_menus(self, menu_list)
- self._update_menubar()
-
- def _update_menubar(self):
- ns_app = self._ns_app
- ns_menubar = NSMenu.alloc().initWithTitle_("")
- menu_list = self._effective_menus()
- for menu in menu_list:
- ns_item = NSMenuItem.alloc()
- ns_item.initWithTitle_action_keyEquivalent_(menu.title, '', "")
- ns_menubar.addItem_(ns_item)
- ns_menu = menu._ns_menu
- # An NSMenu can only be a submenu of one menu at a time, so
- # remove it from the old menubar if necessary.
- old_supermenu = ns_menu.supermenu()
- if old_supermenu:
- i = old_supermenu.indexOfItemWithSubmenu_(ns_menu)
- old_supermenu.removeItemAtIndex_(i)
- ns_menubar.setSubmenu_forItem_(ns_menu, ns_item)
- # The menu you pass to setAppleMenu_ must *also* be a member of the
- # main menu.
- ns_app.setMainMenu_(ns_menubar)
- if menu_list:
- ns_app_menu = menu_list[0]._ns_menu
- ns_app.setAppleMenu_(ns_app_menu)
-
- def handle_next_event(self, modal_window = None):
- ns_app = self._ns_app
- if modal_window:
- ns_mode = NSModalPanelRunLoopMode
- ns_modal_window = modal_window._ns_window
- else:
- ns_mode = NSDefaultRunLoopMode
- ns_modal_window = None
- ns_event = ns_app.nextEventMatchingMask_untilDate_inMode_dequeue_(
- NSAnyEventMask, ns_distant_future, ns_mode, True)
- if ns_event:
- ns_window = ns_event.window()
- if not ns_window or not ns_modal_window or ns_window == ns_modal_window:
- ns_app.sendEvent_(ns_event)
-
- def get_target_window(self):
- # NSApplication.keyWindow() isn't reliable enough. We keep track
- # of the key window ourselves.
- return self._ns_key_window
-
- def zero_windows_allowed(self):
- return 1
-
- def query_clipboard(self):
- pb = self._ns_pasteboard
- pb_types = pb.types()
- return NSStringPboardType in pb_types
-
- def get_clipboard(self):
- pb = self._ns_pasteboard
- ns_data = pb.dataForType_(NSStringPboardType)
- if ns_data:
- return ns_data.bytes().tobytes()
-
- def set_clipboard(self, data):
- ns_data = NSData.dataWithBytes_length_(data, len(data))
- pb = self._ns_pasteboard
- pb.clearContents()
- pb.setData_forType_(ns_data, NSStringPboardType)
-
- def setup_menus(self, m):
- m.hide_app_cmd.enabled = True
- m.hide_other_apps_cmd.enabled = True
- m.show_all_apps_cmd.enabled = True
- if not self._ns_app.modalWindow():
- GApplication.setup_menus(self, m)
-
- def process_args(self, args):
- # Note: When using py2app, argv_emulation should be disabled.
- if args and args[0].startswith("-psn"):
- # Launched from MacOSX Finder -- wait for file open/app launch messages
- pass
- else:
- # Not launched from Finder or using argv emulation
- self._ns_using_clargs = True
- GApplication.process_args(self, args)
-
- def run(self, fast_exit = True):
- try:
- GApplication.run(self)
- except (KeyboardInterrupt, SystemExit):
- pass
- except:
- traceback.print_exc()
- # A py2app bundled application seems to crash on exit if we don't
- # bail out really quickly here (Python 2.3, PyObjC 1.3.7, py2app 0.2.1,
- # MacOSX 10.4.4)
- if fast_exit:
- os._exit(0)
-
- def event_loop(self):
- self._ns_app.run()
-
- def _quit(self):
- self._quit_flag = True
- self._ns_app.stop_(self._ns_app)
-
- def hide_app_cmd(self):
- self._ns_app.hide_(self)
-
- def hide_other_apps_cmd(self):
- self._ns_app.hideOtherApplications_(self)
-
- def show_all_apps_cmd(self):
- self._ns_app.unhideAllApplications_(self)
-
- def ns_process_key_event(self, ns_event):
- # Perform menu setup before command-key events.
- # Send non-command key events to associated window if any,
- # otherwise pass them to the pygui application. This is necessary
- # because otherwise there is no way of receiving key events when
- # there are no windows.
- if ns_event.modifierFlags() & NSCommandKeyMask:
- NSApplication.sendEvent_(self._ns_app, ns_event)
- else:
- ns_window = ns_event.window()
- if ns_window:
- ns_window.sendEvent_(ns_event)
- else:
- event = Event(ns_event)
- self.handle(event.kind, event)
-
- def ns_menu_needs_update(self, ns_menu):
- try:
- if not self._ns_menus_updated:
- self._perform_menu_setup()
- self._ns_menus_updated = True
- except Exception:
- self.report_exception()
-
- def ns_init_application_name(self):
- # Arrange for the application name to be used as the title
- # of the application menu.
- ns_bundle = NSBundle.mainBundle()
- if ns_bundle:
- ns_info = ns_bundle.localizedInfoDictionary()
- if not ns_info:
- ns_info = ns_bundle.infoDictionary()
- if ns_info:
- if ns_info['CFBundleName'] == "Python":
- #print "GUI.Application: NSBundle infoDictionary =", ns_info ###
- ns_info['CFBundleName'] = Globals.application_name
- return
-
-#------------------------------------------------------------------------------
-
-_ns_key_event_mask = AppKit.NSKeyDownMask | AppKit.NSKeyUpMask
-
-#------------------------------------------------------------------------------
-
-class _PyGui_NSApplication(NSApplication):
-
- pygui_app = None
-
- def sendEvent_(self, ns_event):
- # Perform special processing of key events.
- # Perform menu setup when menu bar is clicked.
- # Remember the most recent mouse-moved event to use as the
- # location of event types which do not have a location themselves.
- if Globals.pending_exception:
- raise_pending_exception()
- ns_type = ns_event.type()
- self.pygui_app._ns_menus_updated = False
- if (1 << ns_type) & _ns_key_event_mask:
- self.pygui_app.ns_process_key_event(ns_event)
- else:
- if ns_type == NSMouseMoved:
- Globals.ns_last_mouse_moved_event = ns_event
- ns_window = ns_event.window()
- if ns_window:
- ns_view = ns_window.contentView().hitTest_(ns_event.locationInWindow())
- if ns_view:
- ns_view.mouseMoved_(ns_event)
- else:
- NSApplication.sendEvent_(self, ns_event)
-
- def menuNeedsUpdate_(self, ns_menu):
- self.pygui_app.ns_menu_needs_update(ns_menu)
-
- def menuSelection_(self, ns_menu_item):
- try:
- command = ns_menu_item.representedObject()
- index = ns_menu_item.tag()
- if index >= 0:
- dispatch_to_app(self, command, index)
- else:
- dispatch_to_app(self, command)
- except:
- self.pygui_app.report_error()
-
- def validateMenuItem_(self, item):
- return False
-
- def undo_(self, sender):
- dispatch_to_app(self, 'undo_cmd')
-
- def redo_(self, sender):
- dispatch_to_app(self, 'redo_cmd')
-
- def cut_(self, sender):
- dispatch_to_app(self, 'cut_cmd')
-
- def copy_(self, sender):
- dispatch_to_app(self, 'copy_cmd')
-
- def paste_(self, sender):
- dispatch_to_app(self, 'paste_cmd')
-
- def clear_(self, sender):
- dispatch_to_app(self, 'clear_cmd')
-
- def selectAll_(self, sender):
- dispatch_to_app(self, 'select_all_cmd')
-
- def application_openFile_(self, ns_app, path):
- app = self.pygui_app
- if app._ns_using_clargs:
- return True
- # Bizarrely, argv[0] gets passed to application_openFile_ under
- # some circumstances. We don't want to try to open it!
- if path == sys.argv[0]:
- return True
- app._ns_files_opened = True
- try:
- app.open_path(path)
- return True
- except Exception, e:
- app.report_error()
- return False
-
- def applicationDidFinishLaunching_(self, notification):
- app = self.pygui_app
- if app._ns_using_clargs:
- return
- try:
- if not app._ns_files_opened:
- app.open_app()
- except Exception, e:
- app.report_error()
- return False
-
-export(Application)
-
-#------------------------------------------------------------------------------
-
-def raise_pending_exception():
- exc_type, exc_value, exc_tb = Globals.pending_exception
- Globals.pending_exception = None
- raise exc_type, exc_value, exc_tb
-
-def create_ns_application():
- ns_app = _PyGui_NSApplication.sharedApplication()
- ns_app.setDelegate_(ns_app)
- Globals.ns_application = ns_app
-
-def dispatch_to_app(ns_app, *args):
- app = ns_app.pygui_app
- if app:
- app.dispatch(*args)
-
-Globals.ns_screen_height = NSScreen.mainScreen().frame().size.height
-
-create_ns_application()
-
-#------------------------------------------------------------------------------
-
-# Disable this for now, since MachSignals.signal segfaults. :-(
-#
-#def _install_sigint_handler():
-# print "_install_sigint_handler" ###
-# from Foundation import NSRunLoop
-# run_loop = NSRunLoop.currentRunLoop()
-# if not run_loop:
-# print "...No current run loop" ###
-# sys.exit(1) ###
-# MachSignals.signal(signal.SIGINT, _sigint_handler)
-# #from PyObjCTools.AppHelper import installMachInterrupt
-# #installMachInterrupt()
-# print "...done" ###
-#
-#def _sigint_handler(signum):
-# print "_sigint_handler" ###
-# raise KeyboardInterrupt
-
-#def _install_sigint_handler():
-# import signal
-# signal.signal(signal.SIGINT, _raise_keyboard_interrupt)
-#
-#def _raise_keyboard_interrupt(signum, frame):
-# raise KeyboardInterrupt
-
-#_install_sigint_handler()
diff --git a/PyGUI-2.5.3/build/lib/GUI/BaseAlert.py b/PyGUI-2.5.3/build/lib/GUI/BaseAlert.py
deleted file mode 100644
index aa59b41..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/BaseAlert.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - BaseAlert - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32gui as gui, win32api as api
-from GUI import export
-from GUI import application
-from GUI.WinUtils import win_bg_color
-from GUI import View
-from GUI.GBaseAlerts import BaseAlert as GBaseAlert
-
-win_icon_ids = {
- 'stop': wc.IDI_HAND,
- 'caution': wc.IDI_EXCLAMATION,
- 'note': wc.IDI_ASTERISK,
- 'query': wc.IDI_QUESTION,
-}
-
-win_icon_size = (
- api.GetSystemMetrics(wc.SM_CXICON),
- api.GetSystemMetrics(wc.SM_CYICON)
-)
-
-def win_load_icon(id):
- return gui.LoadIcon(0, id)
-
-class AlertIcon(View):
-
- _win_transparent = True
-
- def __init__(self, id, **kwds):
- View.__init__(self, size = win_icon_size, **kwds)
- #hwnd = self._win.GetSafeHwnd()
- self.win_icon = win_load_icon(id)
-
- def draw(self, c, r):
- gfx = c._win_graphics
- hdc = gfx.GetHDC()
- gui.DrawIcon(hdc, 0, 0, self.win_icon)
- gfx.ReleaseHDC(hdc)
-
-# def draw(self, c, r):
-# dc = c._win_dc
-# dc.DrawIcon((0, 0), self.win_icon)
-
-class BaseAlert(GBaseAlert):
-
- _win_icon = None
-
- def _layout_icon(self, kind):
- id = win_icon_ids.get(kind)
- if id:
- icon = AlertIcon(id, position = (self._left_margin, self._top_margin))
- self.add(icon)
- return icon.size
- else:
- return (0, 0)
-
-export(BaseAlert)
diff --git a/PyGUI-2.5.3/build/lib/GUI/BaseAlertFunctions.py b/PyGUI-2.5.3/build/lib/GUI/BaseAlertFunctions.py
deleted file mode 100644
index 07c9efe..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/BaseAlertFunctions.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Python GUI - Basic alert functions - Cocoa
-#
-
-from AppKit import \
- NSRunAlertPanel, NSRunCriticalAlertPanel, NSRunInformationalAlertPanel
-
-def alert(kind, prompt, ok_label, **kwds):
- alert_n(kind, prompt, ok_label, None, None)
-
-def alert2(kind, prompt, yes_label, no_label, **kwds):
- return alert_n(kind, prompt, yes_label, no_label, None)
-
-def alert3(kind, prompt, yes_label, no_label, other_label, **kwds):
- return alert_n(kind, prompt, yes_label, no_label, other_label)
-
-def alert_n(kind, prompt, label1, label2, label3):
- splat = prompt.split("\n", 1)
- title = splat[0]
- if len(splat) > 1:
- msg = splat[1]
- else:
- msg = ""
- if kind == 'caution':
- return NSRunCriticalAlertPanel(title, msg, label1, label2, label3)
- elif kind == 'note':
- return NSRunInformationalAlertPanel(title, msg, label1, label2, label3)
- else:
- return NSRunAlertPanel(title, msg, label1, label2, label3)
diff --git a/PyGUI-2.5.3/build/lib/GUI/BaseFileDialogs.py b/PyGUI-2.5.3/build/lib/GUI/BaseFileDialogs.py
deleted file mode 100644
index 600f19b..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/BaseFileDialogs.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Python GUI - File selection dialogs - Cocoa
-#
-
-from AppKit import NSOpenPanel, NSSavePanel, NSOKButton
-from GUI.Files import FileRef
-from GUI import application
-
-#------------------------------------------------------------------
-
-def _request_old(prompt, default_dir, file_types, dir, multiple):
- ns_panel = NSOpenPanel.openPanel()
- if prompt.endswith(":"):
- prompt = prompt[:-1]
- ns_panel.setTitle_(prompt)
- ns_panel.setCanChooseFiles_(not dir)
- ns_panel.setCanChooseDirectories_(dir)
- ns_panel.setAllowsMultipleSelection_(multiple)
- if default_dir:
- ns_dir = default_dir.path
- else:
- ns_dir = None
- if file_types:
- ns_types = []
- for type in file_types:
- ns_types.extend(type._ns_file_types())
- else:
- ns_types = None
- result = ns_panel.runModalForDirectory_file_types_(ns_dir, None, ns_types)
- if result == NSOKButton:
- if multiple:
- return [FileRef(path = path) for path in ns_panel.filenames()]
- else:
- return FileRef(path = ns_panel.filename())
- else:
- return None
-
-#------------------------------------------------------------------
-
-def _request_new(prompt, default_dir, default_name, file_type, dir):
- ns_panel = NSSavePanel.savePanel()
- #if prompt.endswith(":"):
- # prompt = prompt[:-1]
- #if prompt.lower().endswith(" as"):
- # prompt = prompt[:-3]
- #ns_panel.setTitle_(prompt)
- #print "_request_new: setting label to", repr(prompt) ###
- ns_panel.setNameFieldLabel_(prompt)
- if default_dir:
- ns_dir = default_dir.path
- else:
- ns_dir = None
- if file_type:
- suffix = file_type.suffix
- if suffix:
- ns_panel.setCanSelectHiddenExtension_(True)
- if not file_type.mac_type or file_type.mac_force_suffix:
- ns_panel.setRequiredFileType_(suffix)
- result = ns_panel.runModalForDirectory_file_(ns_dir, default_name)
- if result == NSOKButton:
- return FileRef(path = ns_panel.filename())
- else:
- return None
diff --git a/PyGUI-2.5.3/build/lib/GUI/Button.py b/PyGUI-2.5.3/build/lib/GUI/Button.py
deleted file mode 100644
index d12deae..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Button.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Python GUI - Buttons - PyObjC version
-#
-
-import AppKit
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.ButtonBasedControls import ButtonBasedControl
-from GUI.GButtons import Button as GButton
-
-_style_to_ns_key_equivalent = {
- 'default': "\x0d",
- 'cancel': "\x1b",
-}
-
-_ns_key_equivalent_to_style = {
- "\x0d": 'default',
- "\x1b": 'cancel',
-}
-
-class Button(ButtonBasedControl, GButton):
-
- def __init__(self, title = "New Button", font = system_font, **kwds):
- ns_button = self._create_ns_button(title = title, font = font,
- ns_button_type = AppKit.NSMomentaryLight,
- ns_bezel_style = AppKit.NSRoundedBezelStyle,
- padding = (10, 2)
- )
- GButton.__init__(self, _ns_view = ns_button, **kwds)
-
- def get_style(self):
- ns_key = self._ns_view.getKeyEquivalent()
- return _ns_key_equivalent_to_style.get(ns_key, 'normal')
-
- def set_style(self, style):
- ns_key = _style_to_ns_key_equivalent.get(style, "")
- self._ns_view.setKeyEquivalent_(ns_key)
-
- def activate(self):
- self._ns_view.performClick_(None)
-
-# def key_down(self, e): ###
-# print "Button.key_down:", e ###
-
-export(Button)
diff --git a/PyGUI-2.5.3/build/lib/GUI/ButtonBasedControls.py b/PyGUI-2.5.3/build/lib/GUI/ButtonBasedControls.py
deleted file mode 100644
index fee4a95..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ButtonBasedControls.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - PyObjC version
-#
-# Mixin class for controls based on NSButton
-#
-#------------------------------------------------------------------------------
-
-from Foundation import NSMutableDictionary, NSAttributedString
-from AppKit import NSMutableParagraphStyle, NSFontAttributeName, \
- NSForegroundColorAttributeName, NSParagraphStyleAttributeName, \
- NSButton
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, \
- ns_set_action, ns_size_to_fit
-from GUI import Control
-from GUI.StdColors import black
-
-#------------------------------------------------------------------------------
-
-class ButtonBasedControl(object):
-
- _ns_handle_mouse = True
-
- _color = None
-
- def _create_ns_button(self, title, font, ns_button_type, ns_bezel_style,
- padding = (0, 0)):
- ns_button = PyGUI_NSButton.alloc().init()
- ns_button.pygui_component = self
- ns_button.setButtonType_(ns_button_type)
- ns_button.setBezelStyle_(ns_bezel_style)
- ns_button.setTitle_(title)
- ns_button.setFont_(font._ns_font)
- num_lines = title.count("\n") + 1
- ns_size_to_fit(ns_button, padding = padding,
- height = font.line_height * num_lines + 5)
- ns_set_action(ns_button, 'doAction:')
- return ns_button
-
- def set_title(self, title):
- Control.set_title(self, title)
- self._ns_update_attributed_title()
-
- def set_font(self, font):
- Control.set_font(self, font)
- self._ns_update_attributed_title()
-
- def set_just(self, just):
- Control.set_just(self, just)
- self._ns_update_attributed_title()
-
- def get_color(self):
- if self._color:
- return self._color
- else:
- return black
-
- def set_color(self, color):
- self._color = color
- self._ns_update_attributed_title()
-
- # There is no direct way of setting the text colour of the title;
- # it must be done using an attributed string. But when doing
- # this, the attributes must include the font and alignment
- # as well. So when using a custom color, we construct a new
- # attributed string whenever the title, font, alignment or color
- # is changed.
-
- def _ns_update_attributed_title(self):
- if self._color:
- ns_button = self._ns_view
- ns_attrs = NSMutableDictionary.alloc().init()
- ns_attrs[NSFontAttributeName] = ns_button.font()
- ns_attrs[NSForegroundColorAttributeName] = self._color._ns_color
- ns_parstyle = NSMutableParagraphStyle.alloc().init()
- ns_parstyle.setAlignment_(ns_button.alignment())
- ns_attrs[NSParagraphStyleAttributeName] = ns_parstyle
- ns_attstr = NSAttributedString.alloc().initWithString_attributes_(
- ns_button.title(), ns_attrs)
- ns_button.setAttributedTitle_(ns_attstr)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSButton(NSButton, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
diff --git a/PyGUI-2.5.3/build/lib/GUI/ButtonBases.py b/PyGUI-2.5.3/build/lib/GUI/ButtonBases.py
deleted file mode 100644
index 579899f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ButtonBases.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Button base - Win32
-#
-#--------------------------------------------------------------------
-
-class ButtonBase(object):
-
- def key_down(self, event):
- if not event.auto:
- c = event.char
- if c == ' ' or c == '\r':
- self._win.SetState(True)
- else:
- GControl.key_down(self, event)
-
- def key_up(self, event):
- c = event.char
- if c == ' ' or c == '\r':
- if self._win.GetState() & 4:
- self._win.SetState(False)
- self._win_activate()
- else:
- GControl.key_down(self, event)
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/Canvas.py b/PyGUI-2.5.3/build/lib/GUI/Canvas.py
deleted file mode 100644
index e65d6b4..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Canvas.py
+++ /dev/null
@@ -1,321 +0,0 @@
-#
-# Python GUI - Drawing - PyObjC
-#
-
-from array import array
-from Foundation import NSPoint, NSMakeRect, NSString
-from AppKit import NSGraphicsContext, NSBezierPath, NSEvenOddWindingRule, \
- NSFontAttributeName, NSForegroundColorAttributeName, \
- NSCompositeCopy, NSCompositeSourceOver, NSAffineTransform
-from GUI import export
-from GUI.StdColors import black, white
-from GUI.GCanvases import Canvas as GCanvas
-import math
-
-class Canvas(GCanvas):
-
- def __init__(self):
- self._ns_path = NSBezierPath.bezierPath()
- self._ns_path.setWindingRule_(NSEvenOddWindingRule)
- self._stack = []
- ctx = NSGraphicsContext.currentContext()
- ctx.setCompositingOperation_(NSCompositeSourceOver)
- GCanvas.__init__(self)
- self._printing = not ctx.isDrawingToScreen()
- self.initgraphics()
- self.transformstack = [[]]
-
- def get_pencolor(self):
- return self._pencolor
-
- def set_pencolor(self, c):
- self._pencolor = c
-
- def get_fillcolor(self):
- return self._fillcolor
-
- def set_fillcolor(self, c):
- self._fillcolor = c
-
- def get_textcolor(self):
- return self._textcolor
-
- def set_textcolor(self, c):
- self._textcolor = c
-
- def get_backcolor(self):
- return self._backcolor
-
- def set_backcolor(self, c):
- self._backcolor = c
-
- def get_pensize(self):
- return self._pensize
-
- def set_pensize(self, d):
- self._pensize = d
- self._ns_path.setLineWidth_(d)
-
- def get_font(self):
- return self._font
-
- def set_font(self, f):
- self._font = f
-
- def get_current_point(self):
- return self._ns_path.currentPoint()
-
- def newpath(self):
- self._ns_path.removeAllPoints()
- #for i in range(len(self.transformstack)):
- #j = self.transformstack.pop()
- #transforms = {"translate":self.translate,"rotate":self.rotate,"scale":self.scale}
- #transforms[j[0]](*j[1:])
-
- def moveto(self, x, y):
- x, y = self._transform(x, y)
- self._ns_path.moveToPoint_((x, y))
-
- def rmoveto(self, dx, dy):
- self._ns_path.relativeMoveToPoint_((dx, dy))
-
- def lineto(self, x, y):
- x, y = self._transform(x, y)
- self._ns_path.lineToPoint_((x, y))
-
- def rlineto(self, dx, dy):
- self._ns_path.relativeLineToPoint_((dx, dy))
-
- def curveto(self, cp1, cp2, ep):
- cp1 = self._transform(*cp1)
- cp2 = self._transform(*cp2)
- ep = self._transform(*ep)
- self._ns_path.curveToPoint_controlPoint1_controlPoint2_(
- ep, cp1, cp2)
-
- def rcurveto(self, cp1, cp2, ep):
- self._ns_path.relativeCurveToPoint_controlPoint1_controlPoint2_(
- ep, cp1, cp2)
-
- def arc(self, c, r, a0, a1):
- c = self._transform(*c)
- self._ns_path.appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_(
- c, r, a0, a1)
-
- def rect(self, rect):
- try:
- rect = self._transform(rect[0],rect[1]) + self._transform(rect[2], rect[3])
- except:
- print "Error here - line 113"
- self._ns_path.appendBezierPathWithRect_(_ns_rect(rect))
-
- def oval(self, rect):
- rect = (self._transform(*rect[0]), self._transform(*rect[1]))
- self._ns_path.appendBezierPathWithOvalInRect(_ns_rect(rect))
-
- def lines(self, points):
- # Due to a memory leak in PyObjC 2.3, we need to be very careful
- # about the type of object that we pass to appendBezierPathWithPoints_count_.
- # If 'points' is a numpy array, we convert it to an array.array of type 'f',
- # else we fall back on iterating over the points in Python.
-# ns = self._ns_path
-# ns.moveToPoint_(points[0])
-# ns.appendBezierPathWithPoints_count_(points, len(points))
- try:
- p = points.flat
- except AttributeError:
- GCanvas.lines(self, points)
- else:
- a = array('f', p)
- ns = self._ns_path
- ns.moveToPoint_(points[0])
- ns.appendBezierPathWithPoints_count_(a, len(points))
-
-
- def poly(self, points):
-# ns = self._ns_path
-# ns.moveToPoint_(points[0])
-# ns.appendBezierPathWithPoints_count_(points, len(points))
-# ns.closePath()
- self.lines(points)
- self.closepath()
-
- def closepath(self):
- self._ns_path.closePath()
-
- def clip(self):
- ns = self._ns_path
- ns.addClip()
-
- def rectclip(self, (l, t, r, b)):
- ns_rect = NSMakeRect(l, t, r - l, b - t)
- NSBezierPath.clipRect_(ns_rect)
-
- def gsave(self):
- self._stack.append((
- self._pencolor, self._fillcolor, self._textcolor, self._backcolor,
- self._pensize, self._font))
- self.transformstack.append([])
- NSGraphicsContext.currentContext().saveGraphicsState()
-
- def grestore(self):
- (self._pencolor, self._fillcolor, self._textcolor, self._backcolor,
- self._pensize, self._font) = self._stack.pop()
- self.transformstack.pop()
- NSGraphicsContext.currentContext().restoreGraphicsState()
-
- def stroke(self):
- ns = self._ns_path
- self._pencolor._ns_color.set()
- ns.stroke()
-
- def fill(self):
- ns = self._ns_path
- self._fillcolor._ns_color.set()
- ns.fill()
-
- def erase(self):
- ns = self._ns_path
- self._backcolor._ns_color.set()
- ctx = NSGraphicsContext.currentContext()
- ctx.setCompositingOperation_(NSCompositeCopy)
- ns.fill()
- ctx.setCompositingOperation_(NSCompositeSourceOver)
-
- def fill_stroke(self):
- ns = self._ns_path
- self._pencolor._ns_color.set()
- ns.stroke()
- self._fillcolor._ns_color.set()
- ns.fill()
-
- def show_text(self, text):
- x, y = self._ns_path.currentPoint()
- font = self._font
- ns_font = font._ns_font
- ns_color = self._textcolor._ns_color
- ns_string = NSString.stringWithString_(text)
- ns_attrs = {
- NSFontAttributeName: ns_font,
- NSForegroundColorAttributeName: ns_color,
- }
-# print "Canvas.show_text:", repr(text) ###
-# print "family:", ns_font.familyName() ###
-# print "size:", ns_font.pointSize() ###
-# print "ascender:", ns_font.ascender() ###
-# print "descender:", ns_font.descender() ###
-# print "capHeight:", ns_font.capHeight() ###
-# print "leading:", ns_font.leading() ###
-# print "matrix:", ns_font.matrix() ###
-# print "defaultLineHeightForFont:", ns_font.defaultLineHeightForFont() ###
- h = ns_font.defaultLineHeightForFont()
- d = -ns_font.descender()
- dy = h - d
- if ns_font.familyName() == "Courier New":
- dy += ns_font.pointSize() * 0.229167
- ns_point = NSPoint(x, y - dy)
- #print "drawing at:", ns_point ###
- ns_string.drawAtPoint_withAttributes_(ns_point, ns_attrs)
- dx = ns_font.widthOfString_(ns_string)
- #self._ns_path.relativeMoveToPoint_(NSPoint(x + dx, y))
- self._ns_path.relativeMoveToPoint_((dx, 0))
-
- def _ns_frame_rect(self, (l, t, r, b)):
- p = self._pensize
- q = 0.5 * p
- return NSMakeRect(l + q, t + q, r - l - p, b - t - p)
-
- def stroke_rect(self, r):
- self._pencolor._ns_color.set()
- NSBezierPath.setDefaultLineWidth_(self._pensize)
- NSBezierPath.strokeRect_(_ns_rect(r))
-
- def frame_rect(self, r):
- self._pencolor._ns_color.set()
- NSBezierPath.setDefaultLineWidth_(self._pensize)
- NSBezierPath.strokeRect_(self._ns_frame_rect(r))
-
- def fill_rect(self, r):
- self._fillcolor._ns_color.set()
- NSBezierPath.fillRect_(_ns_rect(r))
-
- def erase_rect(self, r):
- self._backcolor._ns_color.set()
- NSBezierPath.fillRect_(_ns_rect(r))
-
- def _ns_oval_path(self, ns_rect):
- ns_path = NSBezierPath.bezierPathWithOvalInRect_(ns_rect)
- ns_path.setLineWidth_(self._pensize)
- return ns_path
-
- def stroke_oval(self, r):
- self._pencolor._ns_color.set()
- self._ns_oval_path(_ns_rect(r)).stroke()
-
- def frame_oval(self, r):
- self._pencolor._ns_color.set()
- self._ns_oval_path(self._ns_frame_rect(r)).stroke()
-
- def fill_oval(self, r):
- self._fillcolor._ns_color.set()
- self._ns_oval_path(_ns_rect(r)).fill()
-
- def erase_oval(self, r):
- self._backcolor._ns_color.set()
- self._ns_oval_path(_ns_rect(r)).fill()
-
- def _ns_arc_path(self, c, r, sa, ea):
- ns_path = NSBezierPath.bezierPath()
- ns_path.setLineWidth_(self._pensize)
- ns_path.\
- appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_(
- c, r, sa, ea)
- return ns_path
-
- def stroke_arc(self, center, radius, start_angle, arc_angle):
- ns_path = self._ns_arc_path(center, radius, start_angle, arc_angle)
- self._pencolor._ns_color.set()
- ns_path.stroke()
-
- def frame_arc(self, center, radius, start_angle, arc_angle):
- r = radius - 0.5 * self._pensize
- ns_path = self._ns_arc_path(center, r, start_angle, arc_angle)
- self._pencolor._ns_color.set()
- ns_path.stroke()
-
- def translate(self, dx, dy):
- matrix = NSAffineTransform.transform()
- matrix.translateXBy_yBy_(dx, dy)
- self._ns_path.transformUsingAffineTransform_(matrix)
- self.transformstack[-1].append(["translate",dx,dy])
-
- def rotate(self, rotation):
- matrix = NSAffineTransform.transform()
- matrix.rotateByDegrees_(rotation)
- self._ns_path.transformUsingAffineTransform_(matrix)
- self.transformstack[-1].append(["rotate",rotation])
-
- def scale(self, sx, sy):
- matrix = NSAffineTransform.transform()
- matrix.scaleXBy_yBy_(sx, sy)
- self._ns_path.transformUsingAffineTransform_(matrix)
- self.transformstack[-1].append(["scale",sx,sy])
- def _transform(self, x, y):
- for i in self.transformstack: #reversed(self.transformstack):
- for j in i: # reversed(i):
- if j[0]=="translate":
- x = x+j[1]
- y = y+j[2]
- elif j[0]=="rotate":
- x = x*math.cos(j[1])-y*math.sin(j[1])
- y = x*math.sin(j[1])+y*math.cos(j[1])
- elif j[0]=="scale":
- x = x*j[1]
- y = y*j[2]
- return x, y
-
-def _ns_rect((l, t, r, b)):
- return NSMakeRect(l, t, r - l, b - t)
-
-export(Canvas)
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/CheckBox.py b/PyGUI-2.5.3/build/lib/GUI/CheckBox.py
deleted file mode 100644
index bc0732e..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/CheckBox.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Python GUI - Check boxes - PyObjC
-#
-
-import AppKit
-from AppKit import NSOnState, NSOffState, NSMixedState
-from GUI import export
-from GUI.Actions import Action
-from GUI.StdFonts import system_font
-from GUI.ButtonBasedControls import ButtonBasedControl
-from GUI.GCheckBoxes import CheckBox as GCheckBox
-
-class CheckBox(ButtonBasedControl, GCheckBox):
-
- _ns_mixed = False
-
- def __init__(self, title = "New Check Box", font = system_font, **kwds):
- ns_button = self._create_ns_button(title = title, font = font,
- ns_button_type = AppKit.NSSwitchButton,
- ns_bezel_style = AppKit.NSRoundedBezelStyle)
- #if mixed:
- # self._ns_mixed = True
- # ns_button.setAllowsMixedState_(True)
- GCheckBox.__init__(self, _ns_view = ns_button, **kwds)
-
- def get_mixed(self):
- return self._ns_view.allowsMixedState()
-
- def set_mixed(self, x):
- self._ns_view.setAllowsMixedState_(x)
-
- def get_on(self):
- state = self._ns_view.state()
- if state == NSMixedState:
- return 'mixed'
- else:
- return state <> NSOffState
-
- def set_on(self, v):
- if v == 'mixed' and self.mixed:
- state = NSMixedState
- elif v:
- state = NSOnState
- else:
- state = NSOffState
- self._ns_view.setState_(state)
-
- def do_action(self):
- if not self._auto_toggle:
- self.on = not self.on
- Action.do_action(self)
-
-export(CheckBox)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Color.py b/PyGUI-2.5.3/build/lib/GUI/Color.py
deleted file mode 100644
index a756d38..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Color.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Python GUI - Colors - PyObjC
-#
-
-from AppKit import NSColor, NSCalibratedRGBColorSpace
-from GUI import export
-from GUI.GColors import Color as GColor
-
-NSColor.setIgnoresAlpha_(False)
-
-class Color(GColor):
-
- def _from_ns_color(cls, ns_color):
- color = cls.__new__(cls)
- color._ns_color = ns_color.colorUsingColorSpaceName_(
- NSCalibratedRGBColorSpace)
- return color
-
- _from_ns_color = classmethod(_from_ns_color)
-
- def __init__(self, red, green, blue, alpha = 1.0):
- self._ns_color = NSColor.colorWithCalibratedRed_green_blue_alpha_(
- red, green, blue, alpha)
-
- def get_red(self):
- return self._ns_color.redComponent()
-
- def get_green(self):
- return self._ns_color.greenComponent()
-
- def get_blue(self):
- return self._ns_color.blueComponent()
-
- def get_alpha(self):
- return self._ns_color.alphaComponent()
-
- def get_rgb(self):
- return self.get_rgba()[:3]
-
- def get_rgba(self):
- m = self._ns_color.getRed_green_blue_alpha_
- try:
- return m()
- except TypeError:
- return m(None, None, None, None)
-
-export(Color)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Colors.py b/PyGUI-2.5.3/build/lib/GUI/Colors.py
deleted file mode 100644
index cf159f4..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Colors.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# Python GUI - Color constants and functions - Cocoa
-#
-
-from AppKit import NSColor
-from GUI import Color
-
-rgb = Color
-
-selection_forecolor = Color._from_ns_color(NSColor.selectedTextColor())
-selection_backcolor = Color._from_ns_color(NSColor.selectedTextBackgroundColor())
diff --git a/PyGUI-2.5.3/build/lib/GUI/Column.py b/PyGUI-2.5.3/build/lib/GUI/Column.py
deleted file mode 100644
index 715d666..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Column.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Column layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Column(Frame):
-
- def __init__(self, items, spacing = 10, align = 'l', equalize = '',
- expand = None, padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- if expand is not None and not isinstance(expand, int):
- expand = items.index(expand)
- equalize_components(items, equalize)
- width = 0
- for item in items:
- if item:
- width = max(width, item.width)
- y = vpad
- gap = 0
- vanchor = 't'
- hanchor = align
- for i, item in enumerate(items):
- if item:
- y += gap
- if 'l' in align:
- x = 0
- if 'r' in align:
- item.width = width
- elif align == 'r':
- x = width - item.width
- else:
- x = (width - item.width) // 2
- item.position = (x + hpad, y)
- if i == expand:
- item.anchor = 'tb' + hanchor
- vanchor = 'b'
- else:
- item.anchor = vanchor + hanchor
- y += item.height
- if i == expand:
- vanchor = 'b'
- gap = spacing
- self.size = (width + 2 * hpad, y + vpad)
- self.add(items)
- self.set(**kwds)
-
-export(Column)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Compatibility.py b/PyGUI-2.5.3/build/lib/GUI/Compatibility.py
deleted file mode 100644
index 87eda05..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Compatibility.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#-------------------------------------------------------------------------------
-#
-# PyGUI - Facilities for compatibility across Python versions
-#
-#-------------------------------------------------------------------------------
-
-try:
- from __builtin__ import set
-except ImportError:
- from sets import Set as set
diff --git a/PyGUI-2.5.3/build/lib/GUI/Component.py b/PyGUI-2.5.3/build/lib/GUI/Component.py
deleted file mode 100644
index 895a9c2..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Component.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#
-# Python GUI - Components - PyObjC
-#
-
-from Foundation import NSRect, NSPoint, NSSize, NSObject
-from GUI import export
-from GUI import Globals, application
-from GUI import Event
-from GUI.GComponents import Component as GComponent
-
-#------------------------------------------------------------------------------
-
-Globals._ns_view_to_component = {} # Mapping from NSView to corresponding Component
-
-#------------------------------------------------------------------------------
-
-class Component(GComponent):
-
- _has_local_coords = True
- _generic_tabbing = False
- _ns_pass_mouse_events_to_platform = False
- _ns_handle_mouse = False
- _ns_accept_first_responder = False
-
- def __init__(self, _ns_view, _ns_inner_view = None, _ns_responder = None,
- _ns_set_autoresizing_mask = True, **kwds):
- self._ns_view = _ns_view
- if not _ns_inner_view:
- _ns_inner_view = _ns_view
- self._ns_inner_view = _ns_inner_view
- self._ns_responder = _ns_responder or _ns_inner_view
- Globals._ns_view_to_component[_ns_view] = self
- GComponent.__init__(self, **kwds)
-
- def destroy(self):
- #print "Component.destroy:", self ###
- GComponent.destroy(self)
- _ns_view = self._ns_view
- if _ns_view in Globals._ns_view_to_component:
- #print "Component.destroy: removing", _ns_view, "from mapping" ###
- del Globals._ns_view_to_component[_ns_view]
- #print "Component.destroy: breaking link to", self._ns_view ###
- self._ns_view = None
- #if self._ns_inner_view: print "Component.destroy: breaking inner link to", self._ns_inner_view ###
- self._ns_inner_view = None
- self._ns_responder = None
-
- def get_bounds(self):
- (l, t), (w, h) = self._ns_view.frame()
- return (l, t, l + w, t + h)
-
- def set_bounds(self, (l, t, r, b)):
- ns = self._ns_view
- w0, h0 = ns.frame().size
- w1 = r - l
- h1 = b - t
- ns_frame = ((l, t), (w1, h1))
- old_ns_frame = ns.frame()
- ns.setFrame_(ns_frame)
- sv = ns.superview()
- if sv:
- sv.setNeedsDisplayInRect_(old_ns_frame)
- sv.setNeedsDisplayInRect_(ns_frame)
- if w0 != w1 or h0 != h1:
- self._resized((w1 - w0, h1 - h0))
-
- def become_target(self):
- ns_view = self._ns_view
- ns_window = ns_view.window()
- if ns_window:
- self._ns_accept_first_responder = True
- ns_window.makeFirstResponder_(ns_view)
- self._ns_accept_first_responder = False
-
- def _ns_pass_to_platform(self, event, method_name):
- #print "Component._ns_pass_to_platform:", self ###
- h = self._ns_responder
- b = h.__class__.__bases__[0]
- m = getattr(b, method_name)
- #print "...ns responder =", object.__repr__(h) ###
- #print "...ns base class =", b ###
- #print "...ns method =", m ###
- m(h, event._ns_event)
-
- def mouse_down(self, event):
- if self._ns_handle_mouse:
- self._ns_pass_to_platform(event, ns_mouse_down_methods[event.button])
-
- def mouse_drag(self, event):
- if self._ns_handle_mouse:
- self._ns_pass_to_platform(event, 'mouseDragged_')
-
- def mouse_up(self, event):
- if self._ns_handle_mouse:
- self._ns_pass_to_platform(event, ns_mouse_up_methods[event.button])
-
- def mouse_move(self, event):
- #self._ns_pass_to_platform(event, 'mouseMoved_')
- pass
-
- def mouse_enter(self, event):
- #self._ns_pass_to_platform(event, 'mouseEntered_')
- pass
-
- def mouse_leave(self, event):
- #self._ns_pass_to_platform(event, 'mouseExited_')
- pass
-
- def key_down(self, event):
- #print "Component.key_down:", repr(event.char), "for", self ###
- self._ns_pass_to_platform(event, 'keyDown_')
-
- def key_up(self, event):
- self._ns_pass_to_platform(event, 'keyUp_')
-
-#------------------------------------------------------------------------------
-
-ns_mouse_down_methods = {
- 'left': 'mouseDown_', 'middle': 'otherMouseDown_', 'right': 'rightMouseDown_'
-}
-
-ns_mouse_up_methods = {
- 'left': 'mouseUp_', 'middle': 'otherMouseUp_', 'right': 'rightMouseUp_'
-}
-
-#------------------------------------------------------------------------------
-
-export(Component)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Container.py b/PyGUI-2.5.3/build/lib/GUI/Container.py
deleted file mode 100644
index e578481..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Container.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Python GUI - Containers - PyObjC version
-#
-
-from AppKit import NSView
-from GUI.Utils import PyGUI_Flipped_NSView
-from GUI import export
-from GUI.GContainers import Container as GContainer
-
-class Container(GContainer):
- # _ns_inner_view NSView Containing NSView for subcomponents
-
-# def __init__(self, _ns_view, **kwds):
-# GContainer.__init__(self, _ns_view = _ns_view, **kwds)
-
-# def destroy(self):
-# #print "Container.destroy:", self ###
-# GContainer.destroy(self)
-# #print "Container.destroy: breaking inner link to", self._ns_inner_view ###
-
- def _add(self, comp):
- GContainer._add(self, comp)
- self._ns_inner_view.addSubview_(comp._ns_view)
-
- def _remove(self, comp):
- GContainer._remove(self, comp)
- comp._ns_view.removeFromSuperview()
-
-#------------------------------------------------------------------------------
-
-export(Container)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Control.py b/PyGUI-2.5.3/build/lib/GUI/Control.py
deleted file mode 100644
index 17bc4a0..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Control.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# Python GUI - Controls - PyObjC
-#
-
-from math import ceil
-from Foundation import NSSize
-import AppKit
-from GUI import export
-from GUI import StdColors
-from GUI import Color
-from GUI import Font
-from GUI.GControls import Control as GControl
-
-_ns_alignment_from_just = {
- 'left': AppKit.NSLeftTextAlignment,
- 'center': AppKit.NSCenterTextAlignment,
- 'centre': AppKit.NSCenterTextAlignment,
- 'right': AppKit.NSRightTextAlignment,
- 'flush': AppKit.NSJustifiedTextAlignment,
- '': AppKit.NSNaturalTextAlignment,
-}
-
-_ns_alignment_to_just = {
- AppKit.NSLeftTextAlignment: 'left',
- AppKit.NSCenterTextAlignment: 'center',
- AppKit.NSRightTextAlignment: 'right',
- AppKit.NSJustifiedTextAlignment: 'flush',
- AppKit.NSNaturalTextAlignment: '',
-}
-
-class Control(GControl):
-
- #_vertical_padding = 5
-
- def get_title(self):
- return self._ns_cell().title()
-
- def set_title(self, v):
- self._ns_cell().setTitle_(v)
-
- def get_enabled(self):
- return self._ns_cell().enabled()
-
- def set_enabled(self, v):
- self._ns_cell().setEnabled_(v)
-
- def get_color(self):
- return StdColors.black
-
- def set_color(self, v):
- pass
-
- def get_font(self):
- return Font._from_ns_font(self._ns_cell().font())
-
- def set_font(self, f):
- self._ns_cell().setFont_(f._ns_font)
-
- def get_just(self):
- return _ns_alignment_to_just[self._ns_cell().alignment()]
-
- def set_just(self, v):
- self._ns_cell().setAlignment_(_ns_alignment_from_just[v])
-
- def _ns_cell(self):
- return self._ns_inner_view.cell()
-
-export(Control)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Cursor.py b/PyGUI-2.5.3/build/lib/GUI/Cursor.py
deleted file mode 100644
index 48a86f0..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Cursor.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Python GUI - Cursors - Cocoa
-#
-
-from AppKit import NSCursor
-from GUI import export
-from GUI.GCursors import Cursor as GCursor
-
-class Cursor(GCursor):
- #
- # _ns_cursor NSCursor
-
- def _from_ns_cursor(cls, ns_cursor):
- cursor = cls.__new__(cls)
- cursor._ns_cursor = ns_cursor
- return cursor
-
- _from_ns_cursor = classmethod(_from_ns_cursor)
-
- def _init_from_image_and_hotspot(self, image, hotspot):
- #print "Cursor._init_from_image_and_hotspot:", image, hotspot ###
- ns_image = image._ns_image.copy()
- ns_image.setFlipped_(False)
- self._ns_cursor = NSCursor.alloc().initWithImage_hotSpot_(
- ns_image, hotspot)
-
-export(Cursor)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Dialog.py b/PyGUI-2.5.3/build/lib/GUI/Dialog.py
deleted file mode 100644
index 92016a6..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Dialog.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Python GUI - Dialogs - Cocoa
-#
-
-from GUI import export
-from GUI.GDialogs import Dialog #as GDialog
-
-#class Dialog(GDialog):
-#
-# _default_keys = ['\r']
-# _cancel_keys = ['\x1b']
-#
-# def key_down(self, event):
-# # Cocoa already takes care of default/cancel button activation
-# self.pass_to_next_handler('key_down', event)
-
-export(Dialog)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Document.py b/PyGUI-2.5.3/build/lib/GUI/Document.py
deleted file mode 100644
index 1ff797c..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Document.py
+++ /dev/null
@@ -1,321 +0,0 @@
-#
-# Python GUI - Documents - Generic
-#
-
-import os, tempfile
-from GUI import export
-from GUI.Alerts import confirm, confirm_or_cancel
-from GUI.Properties import overridable_property
-from GUI import Model
-from GUI import MessageHandler
-from GUI.Files import FileRef, DirRef
-from GUI.FileDialogs import request_new_file
-from GUI import application
-from GUI.Exceptions import Cancel, UnimplementedMethod, ApplicationError
-from GUI.Printing import PageSetup, present_page_setup_dialog
-
-_next_doc_number = 1 # Counter for generating default titles
-
-class Document(Model, MessageHandler):
- """A Document represents an
- application data structure that can be stored in a file. It
- implements the standard parts of asking the user for file names and
- reading and writing files.
-
- Each Document can have one or more windows associated with it. When
- the last window belonging to a document is closed, the document itself
- is closed.
-
- A Document provides support for keeping track of whether it has been
- edited, and asking the user whether to save changes when it is
- closed."""
-
- # The following attribute prevents a Document that is the parent
- # of a Model from being pickled along with that Model.
- pickle_as_parent_model = False
-
- needs_saving = overridable_property('needs_saving',
- "True if the document has been edited and needs to be saved.")
-
- file = overridable_property('file',
- """FileRef of the file that the document was read from or last written
- to, or None. Changing this causes update_title to be called.""")
-
- file_type = overridable_property('file_type',
- """FileType specifying the type of file handled by this document.""")
-
- title = overridable_property('title',
- """The title of the document. Changing this causes update_title of each
- associated window to be called.""")
-
- windows = overridable_property('windows',
- "List of windows associated with the document. Do not modify directly.")
-
- page_setup = overridable_property('page_setup',
- "The PageSetup to be used for printing this document.")
-
- binary = True # True if files are to be opened in binary mode
-
- _file_type = None # Type of file to create when saving
- _needs_saving = 0 # True if has been edited
- _file = None # FileRef of associated file, if any
- _title = None # Title for use in window banners, etc.
- _windows = None # List of associated windows
- _page_setup = None # Document-specific PageSetup instance
-
- #
- # Initialisation and destruction
- #
-
- def __init__(self, **kwds):
- self._windows = []
- Model.__init__(self, **kwds)
- application()._add_document(self)
-
- def destroy(self):
- """Destroy any associated windows, then destroy document contents."""
- #print "Document.destroy:", self ###
- for win in self._windows[:]:
- win.destroy()
- application()._remove_document(self)
- self.destroy_contents()
- Model.destroy(self)
-
- #
- # Properties
- #
-
- def get_needs_saving(self):
- return self._needs_saving
-
- def set_needs_saving(self, x):
- if self._needs_saving <> x:
- self._needs_saving = x
- for window in self._windows:
- window._document_needs_saving(x)
-
- def get_file(self):
- return self._file
-
- def set_file(self, x):
- self._file = x
- if x is not None:
- application()._last_directory = x.dir
- self.update_title()
-
- def get_file_type(self):
- return self._file_type
-
- def set_file_type(self, x):
- self._file_type = x
-
- def get_title(self):
- t = self._title
- if t == None:
- t = self.make_title()
- self._title = t
- return t
-
- def set_title(self, x):
- self._title = x
- for win in self._windows:
- win.update_title()
-
- def get_windows(self):
- return self._windows
-
- def get_page_setup(self):
- ps = self._page_setup
- if not ps:
- ps = PageSetup()
- self._page_setup = ps
- return ps
-
- def set_page_setup(self, ps):
- self._page_setup = ps
-
- #
- # Methods
- #
-
- def changed(self):
- "Set the needs_saving property to true."
- self.needs_saving = 1
-
- def new_contents(self):
- """Should initialise the document to the appropriate state following a New
- command."""
- pass
-
- def read_contents(self, file):
- """Should initialise the document's contents by reading it from the given
- file object."""
- raise UnimplementedMethod(self, 'read_contents')
-
- def write_contents(self, file):
- """Should write the document's contents to the given file object."""
- raise UnimplementedMethod(self, 'write_contents')
-
- def destroy_contents(self):
- """Called when the contents of the document are about to be discarded.
- If the contents contains any Model objects, they should be destroyed."""
-
- def save_changes(self):
- """If the document has been edited, ask the user whether to save changes,
- and do so if requested."""
- if self._needs_saving:
- result = confirm_or_cancel('Save changes to "%s"?' % self.title,
- "Save", "Don't Save", "Cancel")
- if result < 0:
- raise Cancel
- if result:
- self.save_cmd()
-
- def save_cmd(self):
- """Implements the standard Save command. Writes the document to its
- associated file, asking the user for one first if necessary."""
- if self._file == None:
- self.get_new_file_name()
- try:
- self.write()
- except EnvironmentError, e:
- raise ApplicationError("Unable to save '%s'." % self._file.name, e)
-
- def save_as_cmd(self):
- """Implements the standard Save As... command. Asks the user for a new file
- and writes the document to it."""
- self.get_new_file_name()
- self.save_cmd()
-
- def revert_cmd(self):
- """Implements the standard Revert command. Discards the current contents
- of the document and re-reads it from the associated file."""
- if self._file != None:
- if confirm(
- 'Revert to the last saved version of "%s"?' % self.title,
- "Revert", "Cancel"):
- self.destroy_contents()
- self.read()
-
- def close_cmd(self):
- """Implements the standard Close command. Asks whether to save any
- changes, then destroys the document."""
- self.save_changes()
- self.destroy()
-
- def page_setup_cmd(self):
- if present_page_setup_dialog(self.page_setup):
- self.changed()
-
- def make_title(self):
- """Generates a title for the document. If associated with a file,
- uses its last pathname component, else generates 'Untitled-n'."""
- global _next_doc_number
- if self._file != None:
- return os.path.basename(self._file)
- else:
- n = _next_doc_number
- _next_doc_number = n + 1
- return "Untitled-%d" % n
-
- def update_title(self):
- """Called when the file property changes, to update the
- title property appropriately."""
- file = self._file
- if file:
- self.title = file.name
-
- def get_default_save_directory(self):
- """Called when the user is about to be asked for a location in which
- to save a document that has not been saved before, to find a default
- directory for request_new_file(). Should return a DirRef or FileRef,
- or None if there is no particular preferred location."""
- return None
-
- def get_default_save_filename(self):
- """Called when the user is about to be asked for a location in which
- to save a document that has not been saved before, to find a default
- file name for request_new_file(). Should return a suggested file name,
- or an empty string to require the user to enter a file name."""
- return ""
-
- #
- # Internal methods
- #
-
- def get_new_file_name(self):
- """Ask the user for a new file and associate the document with it."""
- old_file = self.file
- if old_file:
- old_name = old_file.name
- old_dir = old_file.dir
- else:
- old_name = self.get_default_save_filename()
- old_dir = self.get_default_save_directory()
- #print "Document.get_new_file_name: old_dir =", old_dir, "old_name =", old_name ###
- new_file = request_new_file(
- #'Save "%s" as:' % self.title,
- default_dir = old_dir,
- default_name = old_name,
- file_type = self.file_type or application().save_file_type)
- if new_file is None:
- raise Cancel()
- self.file = new_file
-
- def read(self):
- """Read the document from its currently associated file. The
- document must be associated with a file and not have any existing
- contents when this is called."""
- if self.binary:
- mode = "rb"
- else:
- mode = "rU"
- file = self.file.open(mode)
- try:
- self.read_contents(file)
- finally:
- file.close()
- self.needs_saving = 0
-
- def write(self):
- """Write the document to its currently associated file. The
- document must be associated with a file when this is called.
- The document is initially written to a temporary file which
- is then renamed, so if writing fails part way through, the
- original file is undisturbed."""
- if self.binary:
- mode = "wb"
- else:
- mode = "w"
- dir_path = self.file.dir.path
- fd, temp_path = tempfile.mkstemp(dir = dir_path, text = not self.binary)
- file = os.fdopen(fd, mode)
- try:
- try:
- self.write_contents(file)
- finally:
- file.close()
- except EnvironmentError:
- os.unlink(fd)
- raise
- path = self.file.path
- try:
- os.unlink(path)
- except EnvironmentError:
- pass
- os.rename(temp_path, path)
- self.needs_saving = 0
-
- def setup_menus(self, m):
- #print "Document.setup_menus" ###
- if self._needs_saving or not self._file:
- m.save_cmd.enabled = 1
- if self._needs_saving and self._file:
- m.revert_cmd.enabled = 1
- m.save_as_cmd.enabled = 1
- m.page_setup_cmd.enabled = 1
-
- def next_handler(self):
- return application()
-
-export(Document)
diff --git a/PyGUI-2.5.3/build/lib/GUI/DrawableContainer.py b/PyGUI-2.5.3/build/lib/GUI/DrawableContainer.py
deleted file mode 100644
index 5ddb84f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/DrawableContainer.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#
-# Python GUI - DrawableContainers - PyObjC
-#
-
-from Foundation import NSMakeRect
-from AppKit import NSView, NSScrollView, NSColor
-from GUI import export
-from GUI.Utils import PyGUI_Flipped_NSView
-from GUI import Canvas
-from GUI.Geometry import rect_to_ns_rect
-from GUI.Utils import NSMultiClass, PyGUI_NS_ViewBase
-from GUI.GDrawableContainers import default_size, \
- DrawableContainer as GDrawableContainer
-
-ns_gray = NSColor.grayColor()
-
-class DrawableContainer(GDrawableContainer):
-
- def __init__(self, **kwds):
- width, height = default_size
- ns_frame = NSMakeRect(0, 0, width, height)
- ns_inner_view = PyGUI_User_NSView.alloc().initWithFrame_(ns_frame)
- if self._ns_scrollable:
- ns_view = NSScrollView.alloc().initWithFrame_(ns_frame)
- ns_view.setDocumentView_(ns_inner_view)
- ns_view.setBackgroundColor_(ns_gray)
- else:
- ns_view = ns_inner_view
- ns_inner_view.pygui_component = self
- GDrawableContainer.__init__(self, _ns_view = ns_view, _ns_inner_view = ns_inner_view)
- self.set(**kwds)
-
- def destroy(self):
- #print "View.destroy:", self ###
- ns_inner_view = self._ns_inner_view
- GDrawableContainer.destroy(self)
- if ns_inner_view:
- #print "View.destroy: breaking back link from", ns_inner_view ###
- ns_inner_view.pygui_component = None
-
- def get_background_color(self):
- ns_view = self._ns_inner_view
- if ns_view.drawsBackground():
- return Color._from_ns_color(ns_view.backgroundColor())
-
- def set_background_color(self, x):
- ns_view = self._ns_inner_view
- if x:
- ns_view.setBackgroundColor_(x._ns_color)
- ns_view.setDrawsBackground_(True)
- else:
- ns_view.setDrawsBackground_(False)
-
- def invalidate(self):
- self._ns_inner_view.setNeedsDisplay_(True)
-
- def invalidate_rect(self, r):
- self._ns_inner_view.setNeedsDisplayInRect_(rect_to_ns_rect(r))
-
- def with_canvas(self, proc):
- ns_view = self._ns_view
- ns_view.lockFocus()
- proc(Canvas())
- ns_view.unlockFocus()
-
- def update(self):
- self._ns_view.displayIfNeeded()
-
- def track_mouse(self):
- return self._ns_track_mouse(self._ns_inner_view)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_User_NSView(PyGUI_Flipped_NSView, PyGUI_NS_ViewBase):
- #
- # pygui_component View
-
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
- def drawRect_(self, ns_rect):
- (l, t), (w, h) = ns_rect
- rect = (l, t, l + w, t + h)
- self.pygui_component.draw(Canvas(), rect)
-
-export(DrawableContainer)
diff --git a/PyGUI-2.5.3/build/lib/GUI/EditCmdHandler.py b/PyGUI-2.5.3/build/lib/GUI/EditCmdHandler.py
deleted file mode 100644
index 876a752..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/EditCmdHandler.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# PyGUI - Edit command handling - Cocoa
-#
-
-from AppKit import NSMenuItem
-from GUI import export
-
-class EditCmdHandler(object):
- # Mixin for Components whose _ns_responder handles the
- # standard editing commands.
-
- def setup_menus(self, m):
- def validate(cmd_name, ns_selector):
- ns_menu_item = NSMenuItem.alloc().\
- initWithTitle_action_keyEquivalent_("", ns_selector, "")
- m[cmd_name].enabled = ns_target.validateMenuItem_(ns_menu_item)
- ns_target = self.window._ns_window
- if ns_target:
- validate('undo_cmd', 'undo:')
- validate('redo_cmd', 'redo:')
- ns_target = self._ns_edit_cmd_target()
- if ns_target:
- validate('cut_cmd', 'cut:')
- validate('copy_cmd', 'copy:')
- validate('paste_cmd', 'paste:')
- validate('clear_cmd', 'delete:')
- validate('select_all_cmd', 'selectAll:')
-
- def undo_cmd(self):
- ns_window = self.window._ns_window
- if ns_window:
- ns_window.undo_(None)
-
- def redo_cmd(self):
- ns_window = self.window._ns_window
- if ns_window:
- ns_window.redo_(None)
-
- def cut_cmd(self):
- self._ns_edit_cmd('cut_')
-
- def copy_cmd(self):
- self._ns_edit_cmd('copy_')
-
- def paste_cmd(self):
- self._ns_edit_cmd('paste_')
-
- def clear_cmd(self):
- self._ns_edit_cmd('delete_')
-
- def select_all_cmd(self):
- self._ns_edit_cmd('selectAll_')
-
- def _ns_edit_cmd(self, ns_method_name):
- ns_target = self._ns_edit_cmd_target()
- if ns_target:
- getattr(ns_target, ns_method_name)(None)
-
- def _ns_edit_cmd_target(self):
- return self._ns_responder
-
-export(EditCmdHandler)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Enumerations.py b/PyGUI-2.5.3/build/lib/GUI/Enumerations.py
deleted file mode 100644
index 310168f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Enumerations.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#
-# PyGUI - Enumerated type facilities
-#
-
-class EnumMap(dict):
-
- def __init__(self, __name__, *args, **kwds):
- self.name = __name__
- dict.__init__(self, *args, **kwds)
-
- def __getitem__(self, key):
- try:
- return dict.__getitem__(self, key)
- except KeyError:
- raise ValueError("Invalid %s '%s', should be one of %s" %
- (self.name, key, ", ".join(["'%s'" % val for val in self.keys()])))
diff --git a/PyGUI-2.5.3/build/lib/GUI/Event.py b/PyGUI-2.5.3/build/lib/GUI/Event.py
deleted file mode 100644
index 6941271..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Event.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#
-# Python GUI - Events - PyObjC version
-#
-
-import AppKit
-from AppKit import NSEvent, \
- NSShiftKeyMask, NSControlKeyMask, NSCommandKeyMask, NSAlternateKeyMask
-from GUI import export
-from GUI import Globals
-from GUI.GEvents import Event as GEvent
-
-_ns_event_type_to_kind = {
- AppKit.NSLeftMouseDown: 'mouse_down',
- AppKit.NSLeftMouseUp: 'mouse_up',
- AppKit.NSRightMouseDown: 'mouse_down',
- AppKit.NSRightMouseUp: 'mouse_up',
- AppKit.NSOtherMouseDown: 'mouse_down',
- AppKit.NSOtherMouseUp: 'mouse_up',
- AppKit.NSMouseMoved: 'mouse_move',
- AppKit.NSLeftMouseDragged: 'mouse_drag',
- AppKit.NSRightMouseDragged: 'mouse_drag',
- AppKit.NSOtherMouseDragged: 'mouse_drag',
- AppKit.NSMouseEntered: 'mouse_enter',
- AppKit.NSMouseExited: 'mouse_leave',
- AppKit.NSKeyDown: 'key_down',
- AppKit.NSKeyUp: 'key_up',
- AppKit.NSFlagsChanged: 'flags_changed',
- AppKit.NSAppKitDefined: 'app_kit_defined',
- AppKit.NSSystemDefined: 'system_defined',
- AppKit.NSApplicationDefined: 'application_defined',
- AppKit.NSPeriodic: 'periodic',
- AppKit.NSCursorUpdate: 'cursor_update',
-}
-
-_ns_event_type_to_button = {
- AppKit.NSLeftMouseDown: 'left',
- AppKit.NSLeftMouseUp: 'left',
- AppKit.NSRightMouseDown: 'right',
- AppKit.NSRightMouseUp: 'right',
- AppKit.NSOtherMouseDown: 'middle',
- AppKit.NSOtherMouseUp: 'middle',
- AppKit.NSLeftMouseDragged: 'left',
- AppKit.NSRightMouseDragged: 'right',
- AppKit.NSOtherMouseDragged: 'middle',
-}
-
-_ns_keycode_to_keyname = {
- AppKit.NSUpArrowFunctionKey: 'up_arrow',
- AppKit.NSDownArrowFunctionKey: 'down_arrow',
- AppKit.NSLeftArrowFunctionKey: 'left_arrow',
- AppKit.NSRightArrowFunctionKey: 'right_arrow',
- AppKit.NSF1FunctionKey: 'f1',
- AppKit.NSF2FunctionKey: 'f2',
- AppKit.NSF3FunctionKey: 'f3',
- AppKit.NSF4FunctionKey: 'f4',
- AppKit.NSF5FunctionKey: 'f5',
- AppKit.NSF6FunctionKey: 'f6',
- AppKit.NSF7FunctionKey: 'f7',
- AppKit.NSF8FunctionKey: 'f8',
- AppKit.NSF9FunctionKey: 'f9',
- AppKit.NSF10FunctionKey: 'f10',
- AppKit.NSF11FunctionKey: 'f11',
- AppKit.NSF12FunctionKey: 'f12',
- AppKit.NSF13FunctionKey: 'f13',
- AppKit.NSF14FunctionKey: 'f14',
- AppKit.NSF15FunctionKey : 'f15',
- AppKit.NSDeleteFunctionKey: 'delete',
- AppKit.NSHomeFunctionKey: 'home',
- AppKit.NSEndFunctionKey: 'end',
- AppKit.NSPageUpFunctionKey: 'page_up',
- AppKit.NSPageDownFunctionKey: 'page_down',
- AppKit.NSClearLineFunctionKey: 'clear',
- #AppKit.NSHelpFunctionKey: 'help',
- AppKit.NSHelpFunctionKey: 'insert',
- "\r": 'return',
- "\x03": 'enter',
-}
-
-_mouse_events = [
- 'mouse_down', 'mouse_drag', 'mouse_up',
- 'mouse_move', 'mouse_enter', 'mouse_exit'
-]
-
-_key_events = [
- 'key_down', 'key_up'
-]
-
-_ns_screen_height = None
-
-class Event(GEvent):
- """Platform-dependent modifiers (boolean):
- command The Macintosh Command key.
- option The Macintosh Option key.
- """
-
- global_position = (0, 0)
- position = (0, 0)
- button = ''
- num_clicks = 0
- char = ""
- unichars = ""
- key = ''
- auto = False
- delta = (0, 0)
-
- def __init__(self, ns_event):
- self._ns_event = ns_event
- _ns_type = ns_event.type()
- kind = _ns_event_type_to_kind[_ns_type]
- self.kind = kind
- self.time = ns_event.timestamp()
- ns_window = ns_event.window()
- is_mouse_event = kind in _mouse_events
- if is_mouse_event:
- ns_win_pos = ns_event.locationInWindow()
- x, y = ns_window.convertBaseToScreen_(ns_win_pos)
- else:
- ns_last_mouse = Globals.ns_last_mouse_moved_event
- if ns_last_mouse:
- ns_window = ns_last_mouse.window()
- if ns_window:
- ns_win_pos = ns_last_mouse.locationInWindow()
- x, y = ns_window.convertBaseToScreen_(ns_win_pos)
- else:
- x, y = ns_last_mouse.locationInWindow()
- else:
- x, y = NSEvent.mouseLocation()
- h = Globals.ns_screen_height
- self.global_position = (x, h - y)
- if is_mouse_event:
- self.button = _ns_event_type_to_button.get(_ns_type, '')
- if kind == 'mouse_down':
- self.num_clicks = ns_event.clickCount()
- self.delta = (ns_event.deltaX(), ns_event.deltaY())
- ns_flags = ns_event.modifierFlags()
- self.shift = self.extend_contig = (ns_flags & NSShiftKeyMask) <> 0
- self.control = (ns_flags & NSControlKeyMask) <> 0
- self.command = self.extend_noncontig = (ns_flags & NSCommandKeyMask) <> 0
- self.option = (ns_flags & NSAlternateKeyMask) <> 0
- if kind in _key_events:
- self.auto = ns_event.isARepeat()
- ns_chars = ns_event.characters()
- #print "Event.__init__: ns_chars =", repr(ns_chars) ###
- self.unichars = ns_chars
- if len(ns_chars) == 1:
- if ns_chars == "\x19" and ns_event.keyCode() == 48:
- self.char = "\t"
- elif ns_chars == "\x7f":
- self.char = "\x08"
- elif ns_chars <= "\x7e":
- self.char = str(ns_chars)
- #else:
- # self.char = ns_chars
- ns_unmod = ns_event.charactersIgnoringModifiers()
- key = _ns_keycode_to_keyname.get(ns_chars, '')
- if not key and u"\x20" <= ns_unmod <= u"\x7e":
- key = str(ns_unmod)
- self.key = key
- if key == 'enter':
- self.char = "\r"
- elif key == 'delete':
- self.char = "\x7f"
-
- def _platform_modifiers_str(self):
- return " command:%s option:%s" % (self.command, self.option)
-
-export(Event)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Exceptions.py b/PyGUI-2.5.3/build/lib/GUI/Exceptions.py
deleted file mode 100644
index 470a80d..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Exceptions.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Exceptions.py - GUI exception classes
-#
-
-class Cancel(Exception):
- """Exception raised when user cancels an operation."""
- pass
-
-
-#class Quit(Exception):
-# """Exception raised to exit the main event loop."""
-# pass
-
-
-class Error(StandardError):
-
- def __init__(self, obj, mess):
- self.obj = obj
- self.mess = mess
- Exception.__init__(self, "%s: %s" % (obj, mess))
-
-
-class ApplicationError(StandardError):
- """Exception used for reporting errors to the user."""
-
- def __init__(self, message, detail = None):
- self.message = message
- self.detail = detail
- if detail:
- message = "%s\n\n%s" % (message, detail)
- StandardError.__init__(self, message)
-
-
-class InternalError(Exception):
- pass
-
-
-class UnimplementedMethod(NotImplementedError):
-
- def __init__(self, obj, meth_name):
- self.obj = obj
- StandardError.__init__(self, "%s.%s not implemented" % \
- (obj.__class__.__name__, meth_name))
-
-
-class ArgumentError(TypeError):
-
- def __init__(self, obj, meth_name, arg_name, value):
- self.obj = obj
- self.meth_name = meth_name
- self.arg_name = arg_name
- self.value = value
- TypeError.__init__(self,
- "%s: Invalid value %s for argument %s of method %s",
- (obj, value, arg_name, meth_name))
-
-
-class SetAttributeError(AttributeError):
-
- def __init__(self, obj, attr):
- self.obj = obj
- self.attr = attr
- AttributeError.__init__(self, "Attribute '%s' of %s cannot be set" % (attr, obj))
-
-
-class UsageError(StandardError):
- pass
diff --git a/PyGUI-2.5.3/build/lib/GUI/FileDialogs.py b/PyGUI-2.5.3/build/lib/GUI/FileDialogs.py
deleted file mode 100644
index ced310a..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/FileDialogs.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - File selection dialogs - Generic
-#
-
-from GUI.BaseFileDialogs import _request_old, _request_new
-
-
-def request_old_file(prompt = "Open File", default_dir = None, file_types = None):
- """Present a dialog for selecting an existing file.
- Returns a FileRef, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types,
- dir = False, multiple = False)
-
-
-def request_old_files(prompt = "Choose Files", default_dir = None, file_types = None):
- """Present a dialog for selecting a set of existing files.
- Returns a list of FileRefs, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types,
- dir = False, multiple = True)
-
-
-def request_old_directory(prompt = "Choose Folder", default_dir = None):
- """Present a dialog for selecting an existing directory.
- Returns a FileRef, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types = None,
- dir = True, multiple = False)
-
-
-def request_old_directories(prompt = "Choose Folders", default_dir = None,
- multiple = False):
- """Present a dialog for selecting a set of existing directories.
- Returns a list of FileRefs, or None if cancelled."""
-
- return _request_old(prompt, default_dir, file_types = None,
- dir = True, multiple = True)
-
-
-def request_new_file(prompt = "Save As:", default_dir = None,
- default_name = "", file_type = None):
- """Present a dialog requesting a name and location for a new file.
- Returns a FileRef, or None if cancelled."""
-
- return _request_new(prompt, default_dir, default_name, file_type,
- dir = False)
-
-
-def request_new_directory(prompt = "Create Folder:", default_dir = None,
- default_name = ""):
- """Present a dialog requesting a name and location for a new directory.
- Returns a FileRef, or None if cancelled."""
-
- return _request_new(prompt, default_dir, default_name, file_type = None,
- dir = True)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Files.py b/PyGUI-2.5.3/build/lib/GUI/Files.py
deleted file mode 100644
index 3d78a3f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Files.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Python GUI - File references and types - Cocoa
-#
-
-from struct import unpack
-from Foundation import NSFileTypeForHFSTypeCode, \
- NSFileManager, NSFileHFSCreatorCode, NSFileHFSTypeCode
-from GUI.GFiles import FileRef as GFileRef, DirRef, FileType as GFileType
-
-class FileType(GFileType):
-
- def _ns_file_types(self):
- # Return list of Cocoa file type specifications matched
- # by this file type.
- result = []
- mac_type = self._mac_type
- if mac_type:
- result.append(NSFileTypeForHFSTypeCode(mac_type))
- suffix = self._suffix
- if suffix:
- result.append(suffix)
- return result
-
-
-class FileRef(GFileRef):
-
- def _set_type(self, file_type):
- creator = file_type.mac_creator
- type = file_type.mac_type
- if creator is not None or type is not None:
- fm = NSFileManager.defaultManager()
- attrs = {}
- if creator is not None:
- attrs[NSFileHFSCreatorCode] = four_char_code(creator)
- if type is not None:
- attrs[NSFileHFSTypeCode] = four_char_code(type)
- #print "FileRef: Setting attributes of %r to %s" % ( ###
- # self.path, attrs) ###
- fm.changeFileAttributes_atPath_(attrs, self.path)
-
-
-def four_char_code(chars):
- return unpack(">L", chars)[0]
diff --git a/PyGUI-2.5.3/build/lib/GUI/Font.py b/PyGUI-2.5.3/build/lib/GUI/Font.py
deleted file mode 100644
index 586ee46..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Font.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# Python GUI - Fonts - PyObjC
-#
-
-import sys
-from AppKit import NSFont, NSFontManager, NSBoldFontMask, NSItalicFontMask, \
- NSLayoutManager
-from GUI import export
-from GUI.GFonts import Font as GFont
-
-_ns_font_manager = NSFontManager.sharedFontManager()
-_ns_layout_manager = NSLayoutManager.alloc().init()
-
-class Font(GFont):
- # _ns_font NSFont
-
- def _from_ns_font(cls, ns_font):
- font = cls.__new__(cls)
- font._ns_font = ns_font
- return font
-
- _from_ns_font = classmethod(_from_ns_font)
-
- def __init__(self, family, size = 12, style = []):
- traits = 0
- if 'bold' in style:
- traits |= NSBoldFontMask
- if 'italic' in style:
- traits |= NSItalicFontMask
- self._ns_font = _ns_font_manager.fontWithFamily_traits_weight_size_(
- family, traits, 5, size)
- if not self._ns_font:
- import StdFonts
- self._ns_font = StdFonts.application_font._ns_font
-
- def get_family(self):
- return self._ns_font.familyName()
-
- def get_size(self):
- return self._ns_font.pointSize()
-
- def get_style(self):
- style = []
- traits = _ns_font_manager.traitsOfFont_(self._ns_font)
- if traits & NSBoldFontMask:
- style.append('bold')
- if traits & NSItalicFontMask:
- style.append('italic')
- return style
-
- def get_ascent(self):
- return self._ns_font.ascender()
-
- def get_descent(self):
- return -self._ns_font.descender()
-
- def get_height(self):
- ns_font = self._ns_font
- a = ns_font.ascender()
- d = ns_font.descender()
- return a - d
-
- def get_cap_height(self):
- return self._ns_font.capHeight()
-
- def get_x_height(self):
- return self._ns_font.xHeight()
-
- def get_line_height(self):
- # Adding 1 here to match what NSTextField seems to do
- return _ns_layout_manager.defaultLineHeightForFont_(self._ns_font) + 1
-
- def width(self, s, start = 0, end = sys.maxint):
- return self._ns_font.widthOfString_(s[start:end])
-
-export(Font)
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/Frame.py b/PyGUI-2.5.3/build/lib/GUI/Frame.py
deleted file mode 100644
index 3c8e510..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Frame.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Frames - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from GUI.GFrames import Frame as GFrame
-from GUI import export
-from GUI.Utils import NSMultiClass
-from GUI.Utils import PyGUI_NS_EventHandler, PyGUI_Flipped_NSView
-
-class Frame(GFrame):
-
- def __init__(self, **kwds):
- ns_view = PyGUI_Frame.alloc().initWithFrame_(((0, 0), (100, 100)))
- ns_view.pygui_component = self
- GFrame.__init__(self, _ns_view = ns_view, **kwds)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_Frame(PyGUI_Flipped_NSView, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(Frame)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GAlertClasses.py b/PyGUI-2.5.3/build/lib/GUI/GAlertClasses.py
deleted file mode 100644
index d8eba49..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GAlertClasses.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Python GUI - Alerts - Generic
-#
-
-from GUI import BaseAlert
-from GUI import Button
-from GUI.StdButtons import DefaultButton, CancelButton
-
-
-class Alert(BaseAlert):
-
- def __init__(self, kind, prompt,
- ok_label = "OK", default = 1, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [ok_label], default = default, **kwds)
-
- def _create_buttons(self, ok_label):
- self.yes_button = DefaultButton(title = ok_label, action = self.yes)
- #self.default_button = self.ok_button
-
- def _layout_buttons(self):
- self.place(self.yes_button,
- right = self.label.right,
- top = self.label + self._label_button_spacing)
-
-
-class Alert2(BaseAlert):
-
- def __init__(self, kind, prompt,
- yes_label = "Yes", no_label = "No",
- default = 1, cancel = 0, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [yes_label, no_label],
- default = default, cancel = cancel, **kwds)
-
- def _create_buttons(self, yes_label, no_label):
- self.yes_button = DefaultButton(title = yes_label, action = self.yes)
- self.no_button = CancelButton(title = no_label, action = self.no)
-
- def _layout_buttons(self):
- self.place_row([self.no_button, self.yes_button],
- right = self.label.right,
- top = self.label + self._label_button_spacing)
-
-
-class Alert3(BaseAlert):
-
- _minimum_width = 300
-
- def __init__(self, kind, prompt,
- yes_label = "Yes", no_label = "No", other_label = "Cancel",
- default = 1, cancel = -1, **kwds):
- BaseAlert.__init__(self, kind, prompt,
- button_labels = [yes_label, no_label, other_label],
- default = default, cancel = cancel, **kwds)
-
- def _create_buttons(self, yes_label, no_label, cancel_label):
- self.yes_button = DefaultButton(title = yes_label, action = self.yes)
- self.no_button = CancelButton(title = no_label, action = self.no)
- self.other_button = Button(title = cancel_label, action = self.other)
-
- def _layout_buttons(self):
- self.place_row([self.other_button, self.yes_button],
- right = self.label.right,
- top = self.label + self._label_button_spacing)
- self.place(self.no_button,
- left = self._left_margin, top = self.label + self._label_button_spacing)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GApplications.py b/PyGUI-2.5.3/build/lib/GUI/GApplications.py
deleted file mode 100644
index fa7b2d6..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GApplications.py
+++ /dev/null
@@ -1,547 +0,0 @@
-#
-# Python GUI - Application class - Generic
-#
-
-import os, sys, traceback
-from GUI import Globals
-from GUI.Properties import Properties, overridable_property
-from GUI import MessageHandler
-from GUI.Exceptions import Cancel, UnimplementedMethod, UsageError, \
- ApplicationError #, Quit
-from GUI.StdMenus import basic_menus
-from GUI.GMenus import MenuState
-from GUI.Files import FileRef
-from GUI.Printing import PageSetup, present_page_setup_dialog
-
-class Application(Properties, MessageHandler):
- """The user should create exactly one Application object,
- or subclass thereof. It implements the main event loop
- and other application-wide behaviour."""
-
- _windows = None # List of all existing Windows
- _documents = None # List of all existing Documents
- _menus = None # Menus to appear in all Windows
- _clipboard = None
- _save_file_type = None
- _exit_event_loop_flag = False
- _last_directory = None
-
- windows = overridable_property('windows',
- """A list of all existing Windows.""")
-
- documents = overridable_property('documents',
- """A list of all existing documents.""")
-
- menus = overridable_property('menus',
- """A list of Menus that are to be available from all Windows.""")
-
- open_file_types = overridable_property('open_file_types',
- """List of FileTypes openable by the default Open... command.""")
-
- save_file_type = overridable_property('save_file_type',
- """Default FileType for Documents that do not specify their own.""")
-
- file_type = overridable_property('file_type',
- """Write only. Sets open_file_types and save_file_type.""")
-
- target = overridable_property('target',
- """Current target for key events and menu messages.""")
-
- target_window = overridable_property('target_window',
- """Window containing the current target, or None if there are no windows.""")
-
- page_setup = overridable_property('page_setup',
- """Default PageSetup instance.""")
-
- def __init__(self, title = None):
- if Globals._application is not None:
- raise UsageError("More than one Application instance created")
- if title:
- Globals.application_name = title
- self._open_file_types = []
- self._windows = []
- self._documents = []
- self._update_list = []
- self._idle_tasks = []
- self._page_setup = None
- Globals._application = self
- self._quit_flag = False
-
- def destroy(self):
- Globals._application = None
-
- #
- # Constants
- #
-
-# def get_std_menus(self):
-# """Returns a list of Menus containing the standard
-# framework-defined menu commands in their standard
-# positions."""
-# return basic_menus()
-#
-# std_menus = property(get_std_menus)
-
- #
- # Properties
- #
-
- def get_windows(self):
- return self._windows
-
- def get_documents(self):
- return self._documents
-
- def get_menus(self):
- menus = self._menus
- if menus is None:
- menus = []
- return menus
-
- def set_menus(self, menus):
- self._menus = menus
-
- def get_open_file_types(self):
- return self._open_file_types
-
- def set_open_file_types(self, x):
- self._open_file_types = x
-
- def get_save_file_type(self):
- return self._save_file_type
-
- def set_save_file_type(self, x):
- self._save_file_type = x
-
- def set_file_type(self, x):
- self._open_file_types = [x]
- self._save_file_type = x
-
- def get_page_setup(self):
- # This property is initialised lazily, because on Windows it turn out
- # that calling PageSetupDlg() before the application's first window is
- # created causes the app not to be brought to the foreground initially.
- ps = self._page_setup
- if not ps:
- ps = PageSetup()
- self._page_setup = ps
- return ps
-
- def set_page_setup(self, x):
- self._page_setup = x
-
- #
- # Event loop
- #
-
- def run(self):
- """The main event loop. Runs until _quit() is called, or
- KeyboardInterrupt or SystemExit is raised."""
- # Implementations may override this together with _quit() to use
- # a different means of causing the main event loop to exit.
- self.process_args(sys.argv[1:])
- if self._menus is None:
- self.menus = basic_menus()
- while not self._quit_flag:
- try:
- self.event_loop()
- #except (KeyboardInterrupt, Quit), e:
- except KeyboardInterrupt:
- return
- except SystemExit:
- raise
- except:
- self.report_error()
-
- def _quit(self):
- # Causes the main event loop to exit.
- self._quit_flag = True
- self._exit_event_loop()
-
- def event_loop(self):
- """Loop reading and handling events until exit_event_loop() is called."""
- # Implementations may override this together with exit_event_loop() to
- # implement non-modal event loops in a different way.
- self._event_loop(None)
-
- def _event_loop(self, modal_window):
- # Generic modal and non-modal event loop.
- # Loop reading and handling events for the given window, or for all
- # windows if window is None, until exit_event_loop() is called.
- # Enabled application-wide menu items should be selectable in any case.
- # If an exception other than Cancel is raised, it should either be
- # reported using report_error() or propagated. Implementations may
- # override this together with _exit_event_loop() if handling events
- # individually is not desirable.
- save = self._exit_event_loop_flag
- self._exit_event_loop_flag = False
- try:
- while not self._exit_event_loop_flag:
- try:
- self.handle_next_event(modal_window)
- except Cancel:
- pass
- finally:
- self._exit_event_loop_flag = save
-
- def exit_event_loop(self):
- """Cause the current call to event_loop() or modal_event_loop()
- to exit."""
- self._exit_event_loop()
-
- def _exit_event_loop(self):
- # Exit the generic _event_loop implementation.
- self._exit_event_loop_flag = True
-
-# def event_loop_until(self, exit):
-# """Loop reading and handling events until exit() returns
-# true, _quit_flag is set or an exception other than Cancel
-# is raised."""
-# while not exit() and not self._quit_flag:
-# try:
-# self.handle_next_event()
-# except Cancel:
-# pass
-
-# def handle_events(self):
-# """Handle events until an exception occurs. Waits for at least one event;
-# may handle more, at the discretion of the implementation."""
-# self.handle_next_event()
-
- def handle_next_event(self, modal_window):
- # Wait for the next event to arrive and handle it. Transparently handles
- # any internal events such as window updates, etc., and executes any idle
- # tasks that become due while waiting for an event. If modal_window is
- # not None, restrict interaction to that window (but allow use of enabled
- # application-wide menu items).
- #
- # This only needs to be implemented if the generic _event_loop() is being
- # used.
- raise UnimplementedMethod(self, "handle_next_event")
-
- #
- # Menu commands
- #
-
- def setup_menus(self, m):
- m.new_cmd.enabled = 1
- m.open_cmd.enabled = 1
- m.page_setup_cmd.enabled = 1
- m.quit_cmd.enabled = 1
-
- def new_cmd(self):
- "Handle the New menu command."
- doc = self.make_new_document()
- if not doc:
- raise UsageError(
- "Application.make_document(None) did not return a Document.")
- doc.new_contents()
- self.make_window(doc)
-
- def open_cmd(self):
- "Handle the Open... menu command."
- from FileDialogs import request_old_file
- dir = self.get_default_open_directory()
- fileref = request_old_file(default_dir = dir,
- file_types = self._open_file_types)
- if fileref:
- self.open_fileref(fileref)
- else:
- raise Cancel
-
- def get_default_open_directory(self):
- """Called by the default implementation of open_cmd() to find an initial
- directory for request_old_file(). Should return a DirRef or FileRef, or
- None if there is no preferred location. By default it returns the last
- directory in which a document was opened or saved during this session,
- if any."""
- return self._last_directory
-
- def page_setup_cmd(self):
- present_page_setup_dialog(self.page_setup)
-
- def quit_cmd(self):
- """Handle the Quit menu command."""
- while self._documents:
- self._documents[0].close_cmd()
- windows = self._windows
- while windows:
- window = windows[-1]
- window.destroy()
- assert not (windows and windows[-1] is window), \
- "%r failed to remove itself from application on destruction" % window
- self._quit()
-
- #
- # Opening files
- #
-
- def process_args(self, args):
- """Process command line arguments. Called by run() when the application
- is starting up."""
- if not args:
- self.open_app()
- else:
- for arg in args:
- if os.path.exists(arg):
- arg = os.path.abspath(arg)
- self.open_path(arg)
-
- def open_app(self):
- """Called by run() when the application is opened with no arguments."""
- pass
-
- def open_path(self, path):
- """Open document specified by a pathname. Called for each command line
- argument when the application is starting up."""
- self.open_fileref(FileRef(path = path))
-
- def open_fileref(self, fileref):
- """Open document specified by a FileRef."""
- doc = self.make_file_document(fileref)
- if not doc:
- raise ApplicationError("The file '%s' is not recognised by %s." % (
- fileref.name, Globals.application_name))
- doc.set_file(fileref)
- try:
- doc.read()
- except EnvironmentError, e:
- raise ApplicationError("Unable to open '%s'." % fileref.name, e)
- self.make_window(doc)
-
- #
- # Message dispatching
- #
-
-# def dispatch(self, message, *args):
-# target_window = self._find_target_window()
-# if target_window:
-# target_window.dispatch(message, *args)
-# else:
-# self.handle(message, *args)
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
- def dispatch_menu_command(self, command):
- if isinstance(command, tuple):
- name, index = command
- self.dispatch(name, index)
- else:
- self.dispatch(command)
-
- def get_target(self):
- # Implementations may override this to locate the target in a
- # different way if they choose not to implement the Window.target
- # property. Should return self if no other target can be found.
- window = self.target_window
- if window:
- return window.target
- else:
- return self
-
- def get_target_window(self):
- """Return the window to which messages should be dispatched, or None."""
- raise NotImplementedError
-
- #
- # Abstract
- #
-
- def make_new_document(self):
- """Create a new Document object of the appropriate
- class in response to a New command."""
- return self.make_document(None)
-
- def make_file_document(self, fileref):
- """Create a new Document object of the appropriate
- class for the given FileRef."""
- return self.make_document(fileref)
-
- def make_document(self, fileref):
- """Should create a new Document object of the appropriate
- class for the given FileRef, or if FileRef is None, a new
- empty Document of the appropriate class for the New command."""
- return None
-
- def make_window(self, document):
- """Should create a Window set up appropriately for viewing
- the given Document."""
- raise UnimplementedMethod(self, 'make_window')
-
- #
- # Clipboard
- #
-
- def query_clipboard(self):
- "Tests whether the clipboard contains any data."
- return not not self._clipboard
-
- def get_clipboard(self):
- return self._clipboard
-
- def set_clipboard(self, x):
- self._clipboard = x
-
- #
- # Window list management
- #
-
- def _add_window(self, window):
- if window not in self._windows:
- self._windows.append(window)
-
- def _remove_window(self, window):
- if window in self._windows:
- self._windows.remove(window)
-
- #
- # Document list management
- #
-
- def _add_document(self, doc):
- if doc not in self._documents:
- self._documents.append(doc)
-
- def _remove_document(self, doc):
- if doc in self._documents:
- self._documents.remove(doc)
-
- #
- # Exception reporting
- #
-
- def report_error(self):
- """Display an appropriate error message for the most recent
- exception caught."""
- try:
- raise
- except Cancel:
- pass
- except ApplicationError, e:
- from GUI.Alerts import stop_alert
- stop_alert(str(e))
- except:
- self.report_exception()
-
- def report_exception(self):
- """Display an alert box describing the most recent exception, and
- giving the options Continue, Traceback or Abort. Traceback displays
- a traceback and continues; Abort raises SystemExit."""
- try:
- exc_type, exc_val, exc_tb = sys.exc_info()
- exc_desc = "%s: %s" % (exc_type.__name__, exc_val)
- self.print_traceback(exc_desc, exc_tb)
- from GUI.Alerts import alert3
- message = "Sorry, something went wrong."
- result = alert3('stop', "%s\n\n%s" % (message, exc_desc),
- "Continue", "Abort", "Traceback",
- default = 1, cancel = None, width = 450, lines = 5)
- if result == 1: # Continue
- return
- elif result == -1: # Traceback
- self.display_traceback(exc_desc, exc_tb)
- return
- else: # Abort
- raise SystemExit
- except (KeyboardInterrupt, SystemExit):
- os._exit(1)
- except:
- print >>sys.stderr, "---------- Exception while reporting exception ----------"
- traceback.print_exc()
- print >>sys.stderr, "------------------ Original exception -------------------"
- traceback.print_exception(exc_type, exc_val, exc_tb)
- #os._exit(1)
-
- def display_traceback(self, exc_desc, exc_tb):
- """Display an exception description and traceback.
- TODO: display this in a scrolling window."""
- self.print_traceback(exc_desc, exc_tb)
-
- def print_traceback(self, exc_desc, exc_tb):
- """Print exception description and traceback to standard error."""
- import traceback
- sys.stderr.write("\nTraceback (most recent call last):\n")
- traceback.print_tb(exc_tb)
- sys.stderr.write("%s\n\n" % exc_desc)
-
- #
- # Other
- #
-
- def zero_windows_allowed(self):
- """Platforms should implement this to return false if there
- must be at least one window open at all times. Returning false
- here forces the Quit command to be used instead of Close when
- there is only one window open."""
- # TODO: Move this somewhere more global.
- raise UnimplementedMethod(self, 'zero_windows_allowed')
-
- def _perform_menu_setup(self, menus = None):
- """Given a list of Menu objects, perform menu setup processing
- and update associated platform menus ready for popping up or
- pulling down."""
- if menus is None:
- menus = self._effective_menus()
- menu_state = MenuState(menus)
- menu_state.reset()
- self._dispatch_menu_setup(menu_state)
- for menu in menus:
- menu._update_platform_menu()
-
- def _dispatch_menu_setup(self, menu_state):
- self.dispatch('_setup_menus', menu_state)
-
- def _effective_menus(self):
- """Return a list of the menus in effect for the currently active
- window, including both application-wide and window-specific menus,
- in an appropriate order according to platform conventions."""
- window = self.target_window
- return self._effective_menus_for_window(window)
-
- def _effective_menus_for_window(self, window):
- """Return a list of the menus in effect for the specified
- window, including both application-wide and window-specific menus,
- in an appropriate order according to platform conventions."""
- menus = self.menus
- if window:
- menus = menus + window.menus
- regular_menus = []
- special_menus = []
- for menu in menus:
- if menu.special:
- special_menus.insert(0, menu)
- else:
- regular_menus.append(menu)
- return regular_menus + special_menus
-
-# def _may_close_a_window(self):
-# # On implementations where at least one window is needed in order to
-# # interact with the application, check whether closing a window would
-# # leave no more visible windows.
-# if self.zero_windows_allowed():
-# return True
-# count = 0
-# for window in self.windows:
-# if window.visible:
-# count += 1
-# if count >= 2:
-# return True
-# return False
-
- def _check_for_no_windows(self):
- # On implementations where at least one window is needed in order to
- # interact with the application, check whether there are no more visible
- # windows and take appropriate action.
- if not self.zero_windows_allowed():
- for window in self.windows:
- if window.visible:
- return
- self.no_visible_windows()
-
- def no_visible_windows(self):
- """On platforms that require a window in order to interact with the
- application, this is called when there are no more visible windows.
- The default action is to close the application; subclasses may override
- it to take some other action, such as creating a new window."""
- self.quit_cmd()
diff --git a/PyGUI-2.5.3/build/lib/GUI/GBaseAlerts.py b/PyGUI-2.5.3/build/lib/GUI/GBaseAlerts.py
deleted file mode 100644
index 36840da..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GBaseAlerts.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#
-# Python GUI - Alert base class - Generic
-#
-
-import textwrap
-from GUI import ModalDialog
-from GUI import Label
-
-class BaseAlert(ModalDialog):
-
- _wrapwidth = 50
- _minimum_width = 200
- _left_margin = 24
- _right_margin = 24
- _top_margin = 14
- _bottom_margin = 20
- _icon_spacing = 16
- _label_button_spacing = 20
- _default_width = 380
- _default_lines = 3
-
- yes_button = None
- no_button = None
- other_button = None
-
- def __init__(self, kind, prompt, width = None, lines = None,
- button_labels = None, default = None, cancel = None):
- #if width is None:
- # width = self._default_width
- #if lines is None:
- # lines = self._default_lines
- ModalDialog.__init__(self, style = 'alert')
- self.label = Label(text = self._wrap(prompt), lines = lines)
- if self.label.width < self._minimum_width:
- self.label.width = self._minimum_width
- self._create_buttons(*button_labels)
- #self.default_button = self._find_button(default)
- #self.cancel_button = self._find_button(cancel)
- self._layout(kind)
-
- def _layout(self, kind):
- icon_width, icon_height = self._layout_icon(kind)
- label_left = self._left_margin
- if icon_width:
- label_left += icon_width + self._icon_spacing
- if self.label.height < icon_height:
- self.label.height = icon_height
- self.place(self.label,
- left = label_left,
- top = self._top_margin)# + icon_height/4)
- #_wrap_text(self.label, self._default_width - label_left - self._right_margin)
- self._layout_buttons()
- self.shrink_wrap(padding = (self._right_margin, self._bottom_margin))
-
- def _layout_icon(self, kind):
- # Place icon for the given alert kind, if any, and return its size.
- # If there is no icon, return (0, 0).
- return (0, 0)
-
- def _wrap(self, text):
- width = self._wrapwidth
- return "\n\n".join(
- [textwrap.fill(para, width)
- for para in text.split("\n\n")])
-
- def _find_button(self, value):
- #print "BaseAlert._find_button:", value ###
- if value == 1:
- result = self.yes_button
- elif value == 0:
- result = self.no_button
- elif value == -1:
- result = self.other_button
- else:
- result = None
- #print "BaseAlert._find_button: result =", result ###
- return result
-
- def yes(self):
- self.dismiss(1)
-
- def no(self):
- self.dismiss(0)
-
- def other(self):
- self.dismiss(-1)
-
-#def _wrap_text(label, label_width):
-# hard_lines = [text.split()
-# for text in label.text.split("\n")]
-# words = hard_lines[0]
-# for hard_line in hard_lines[1:]:
-# words.append("\n")
-# words.extend(hard_line)
-# font = label.font
-# space_width = font.width(" ")
-# lines = []
-# line = []
-# line_width = 0
-# for word in words:
-# word_width = font.width(word)
-# if word == "\n" or (line_width > 0
-# and line_width + space_width + word_width > label_width):
-# lines.append(line)
-# line = []
-# line_width = 0
-# if word <> "\n":
-# line.append(word)
-# if line_width > 0:
-# line_width += space_width
-# line_width += word_width
-# if line:
-# lines.append(line)
-# label.text = "\n".join([" ".join(line) for line in lines])
-
-
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GButtons.py b/PyGUI-2.5.3/build/lib/GUI/GButtons.py
deleted file mode 100644
index 7b24bcd..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GButtons.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Buttons - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control
-
-class Button(Control, Action):
- """ A pushbutton control."""
-
- style = overridable_property('style',
- "One of 'normal', 'default', 'cancel'")
-
- def activate(self):
- """Highlight the button momentarily and then perform its action."""
- self.flash()
- self.do_action()
-
- def flash(self):
- """Highlight the button momentarily as though it had been clicked,
- without performing the action."""
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib/GUI/GCanvasPaths.py b/PyGUI-2.5.3/build/lib/GUI/GCanvasPaths.py
deleted file mode 100644
index 8055411..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GCanvasPaths.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# Python GUI - Canvas Paths - Generic
-#
-
-class CanvasPaths:
- # Mixin class providing generic implementations of
- # canvas path construction operators.
-
- def __init__(self):
- self.newpath()
-
- def newpath(self):
- self._path = []
- self._current_subpath = None
- self._current_point = (0, 0)
-
- def moveto(self, x, y):
- self._current_subpath = None
- self._current_point = self._coords(x, y)
-
- def rmoveto(self, dx, dy):
- x, y = self._current_point
- self.moveto(x + dx, y + dy)
-
- def lineto(self, x, y):
- subpath = self._current_subpath
- if subpath is None:
- subpath = [self._current_point]
- self._path.append(subpath)
- self._current_subpath = subpath
- p = self._coords(x, y)
- subpath.append(p)
- self._current_point = p
-
- def rlineto(self, dx, dy):
- x, y = self._current_point
- self.lineto(x + dx, y + dy)
-
- def closepath(self):
- subpath = self._current_subpath
- if subpath:
- subpath.append(subpath[0])
- self._current_subpath = None
-
- def get_current_point(self):
- return self._current_point
-
- # Implementations may set _coords to one of the following
-
- def _int_coords(self, x, y):
- return int(round(x)), int(round(y))
-
- def _float_coords(self, x, y):
- return x, y
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GCanvases.py b/PyGUI-2.5.3/build/lib/GUI/GCanvases.py
deleted file mode 100644
index a1dbab0..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GCanvases.py
+++ /dev/null
@@ -1,282 +0,0 @@
-#
-# Python GUI - Drawing - Generic
-#
-
-from GUI.StdColors import black, white
-from GUI.StdFonts import application_font
-from GUI.Properties import Properties, overridable_property
-
-class Canvas(Properties):
-
- _default_forecolor = black
- _default_backcolor = white
- _printing = False
-
- pencolor = overridable_property('pencolor', "Current color for stroking paths.")
- fillcolor = overridable_property('fillcolor', "Current color for filling paths.")
- textcolor = overridable_property('textcolor', "Current color for drawint text.")
- forecolor = overridable_property('forecolor', "Sets pen, fill and text colors to the same color.")
- backcolor = overridable_property('backcolor', "Current color for erasing regions.")
- pensize = overridable_property('pensize', "Width of pen for framing and stroking.")
- font = overridable_property('font', "Font for drawing text.")
- current_point = overridable_property('current_point', "The current point, or None.")
- printing = overridable_property('printing', "True if drawing destination is a non-display device.")
-
- #forecolor = overridable_property('forecolor', "Sets both pencolor and fillcolor.")
-
- def __init__(self):
- self.newpath()
-
- def get_printing(self):
- return self._printing
-
- def initgraphics(self):
- self.set_forecolor(self._default_forecolor)
- self.set_backcolor(self._default_backcolor)
- self.set_pensize(1)
- self.set_font(application_font)
-
- def set_forecolor(self, c):
- self.pencolor = c
- self.fillcolor = c
- self.textcolor = c
-
- def rmoveto(self, dx, dy):
- x0, y0 = self._current_point()
- self.moveto(x0 + dx, y0 + dy)
-
- def rlineto(self, dx, dy):
- x0, y0 = self.current_point
- self.lineto(x0 + dx, y0 + dy)
-
- def curve(self, sp, cp1, cp2, ep):
- self.moveto(sp)
- self.curveto(cp1, cp2, ep)
-
- def rcurveto(self, cp1, cp2, ep):
- x0, y0 = self.current_point
- x1, y1 = cp1
- x2, y2 = cp2
- x3, y3 = ep
- self.curveto(
- (x0 + x1, y0 + y1),
- (x0 + x2, y0 + y2),
- (x0 + x3, y0 + y3))
-
- def fill_stroke(self):
- self.fill()
- self.stroke()
-
- # Rectangles
-
- def _pen_inset_rect(self, rect):
- l, t, r, b = rect
- p = 0.5 * self.pensize
- return (l + p, t + p, r - p, b - p)
-
- def rect(self, rect):
- l, t, r, b = rect
- self.moveto(l, t)
- self.lineto(r, t)
- self.lineto(r, b)
- self.lineto(l, b)
- self.closepath()
-
- def rect_frame(self, rect):
- self.rect(self._pen_inset_rect(rect))
-
- def fill_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.fill()
-
- def stroke_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.stroke()
-
- def frame_rect(self, rect):
- self.newpath()
- self.rect_frame(rect)
- self.stroke()
-
- def fill_stroke_rect(self, rect):
- self.rect_path(rect)
- self.fill_stroke()
-
- def fill_frame_rect(self, rect):
- self.fill_rect(rect)
- self.frame_rect(rect)
-
- def erase_rect(self, rect):
- self.newpath()
- self.rect(rect)
- self.erase()
-
- # Ovals
-
- def oval_frame(self, rect):
- self.oval(self._pen_inset_rect(rect))
-
- def fill_oval(self, rect):
- self.newpath()
- self.oval_frame(rect)
- self.fill()
-
- def stroke_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.stroke()
-
- def frame_oval(self, rect):
- self.newpath()
- self.oval_frame(rect)
- self.stroke()
-
- def fill_stroke_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.fill_stroke()
-
- def fill_frame_oval(self, rect):
- self.fill_oval(rect)
- self.frame_oval()
-
- def erase_oval(self, rect):
- self.newpath()
- self.oval(rect)
- self.erase()
-
- # Arcs
-
- def _arc_path(self, c, r, a0, a1):
-# x, y = c
-# a0r = a0 * deg
-# x0 = x + r * cos(a0r)
-# y0 = y + r * sin(a0r)
- self.newpath()
-# self.moveto(x0, y0)
- self.arc(c, r, a0, a1)
-
- def _arc_frame_path(self, c, r, a0, a1):
- self._arc_path(c, r - 0.5 * self.pensize, a0, a1)
-
- def stroke_arc(self, c, r, a0, a1):
- self._arc_path(c, r, a0, a1)
- self.stroke()
-
- def frame_arc(self, c, r, a0, a1):
- self._arc_frame_path(c, r, a0, a1)
- self.stroke()
-
- # Wedges
-
- def wedge(self, c, r, a0, a1):
- self.moveto(*c)
- self.arc(c, r, a0, a1)
- self.closepath()
-
- def fill_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.fill()
-
- def stroke_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.stroke()
-
- def fill_stroke_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.fill_stroke()
-
- def erase_wedge(self, c, r, a0, a1):
- self.newpath()
- self.wedge(c, r, a0, a1)
- self.erase()
-
- # Polylines
-
- def lines(self, points):
- point_iter = iter(points)
- self.moveto(*point_iter.next())
- for p in point_iter:
- self.lineto(*p)
-
- def linesto(self, points):
- for p in points:
- self.lineto(*p)
-
- def stroke_lines(self, points):
- self.newpath()
- self.lines(points)
- self.stroke()
-
- # Polycurves
-
- def curves(self, points):
- self.moveto(*points[0])
- for i in xrange(1, len(points), 3):
- self.curveto(*points[i:i+3])
-
- def curvesto(self, points):
- for i in xrange(0, len(points), 3):
- self.curveto(*points[i:i+3])
-
- def stroke_curves(self, points):
- self.newpath()
- self.curves(points)
- self.stroke()
-
- # Polygons
-
- def poly(self, points):
- self.lines(points)
- self.closepath()
-
- def fill_poly(self, points):
- self.newpath()
- self.poly(points)
- self.fill()
-
- def stroke_poly(self, points):
- self.newpath()
- self.poly(points)
- self.stroke()
-
- def fill_stroke_poly(self, points):
- self.newpath()
- self.poly(points)
- self.fill_stroke()
-
- def erase_poly(self, points):
- self.newpath()
- self.poly(points)
- self.erase()
-
- # Loops
-
- def loop(self, points):
- self.curves(points)
- self.closepath()
-
- def fill_loop(self, points):
- self.newpath()
- self.loop(points)
- self.fill()
-
- def stroke_loop(self, points):
- self.newpath()
- self.loop(points)
- self.stroke()
-
- def fill_stroke_loop(self, points):
- self.newpath()
- self.loop(points)
- self.fill_stroke()
-
- def erase_loop(self, points):
- self.newpath()
- self.loop(points)
- self.erase()
diff --git a/PyGUI-2.5.3/build/lib/GUI/GCheckBoxes.py b/PyGUI-2.5.3/build/lib/GUI/GCheckBoxes.py
deleted file mode 100644
index 2860744..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GCheckBoxes.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Python GUI - Check boxes - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-from GUI.Actions import Action
-
-class CheckBox(Control, Action):
- """A CheckBox is a control used to represent a binary choice."""
-
- def __init__(self, **kwds):
- Control.__init__(self, **kwds)
-
- on = overridable_property('on', "Boolean value of the check box.")
-
- auto_toggle = overridable_property('auto_toggle', """If true,
- the check box's 'on' property will automatically be toggled
- before performing the action, if any.""")
-
- mixed = overridable_property('mixed', """If true, the check box
- is capable of displaying a mixed state.""")
-
- _auto_toggle = True
- _mixed = False
-
- def get_auto_toggle(self):
- return self._auto_toggle
-
- def set_auto_toggle(self, v):
- self._auto_toggle = v
-
- def get_mixed(self):
- return self._mixed
-
- def set_mixed(self, v):
- self._mixed = v
-
- def get_value(self):
- return self.on
-
- def set_value(self, x):
- self.on = x
diff --git a/PyGUI-2.5.3/build/lib/GUI/GColors.py b/PyGUI-2.5.3/build/lib/GUI/GColors.py
deleted file mode 100644
index 07799c9..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GColors.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Python GUI - Colors - Generic
-#
-
-from GUI.Properties import overridable_property
-
-class Color(object):
- """A drawing color.
-
- Constructors:
- rgb(red, green, blue, alpha = 1.0)
- where red, green, blue, alpha are in the range 0.0 to 1.0
-
- Properties:
- red --> float
- green --> float
- blue --> float
- rgb --> (red, green, blue)
- rgba --> (red, green, blue, alpha)
- """
-
- red = overridable_property('red', "Red component (0.0 to 1.0)")
- green = overridable_property('green', "Blue component (0.0 to 1.0)")
- blue = overridable_property('blue', "Blue component (0.0 to 1.0)")
- alpha = overridable_property('alpha', "Alpha (opacity) component")
- rgb = overridable_property('rgb', "Tuple of (red, green, blue) (0.0 to 1.0)")
- rgba = overridable_property('rgba',
- "Tuple of (red, green, blue, alpha) (0.0 to 1.0)")
-
- def get_alpha(self):
- return 1.0
-
- def get_rgb(self):
- return (self.red, self.green, self.blue)
-
- def set_rgb(self, x):
- self.red, self.green, self.blue = x
-
- def get_rgba(self):
- return (self.red, self.green, self.blue, self.alpha)
-
- def set_rgba(self, x):
- self.red, self.green, self.blue, self.alpha = x
-
- def __str__(self):
- return "Color(%g,%g,%g,%g)" % self.rgba
diff --git a/PyGUI-2.5.3/build/lib/GUI/GComponents.py b/PyGUI-2.5.3/build/lib/GUI/GComponents.py
deleted file mode 100644
index a516955..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GComponents.py
+++ /dev/null
@@ -1,477 +0,0 @@
-#
-# Python GUI - Components - Generic
-#
-
-import os
-from GUI.Properties import Properties, overridable_property
-from GUI import MessageHandler
-from GUI.Geometry import add_pt, sub_pt, rect_size, rect_sized, rect_topleft
-from GUI import application
-
-_user_tab_stop = os.environ.get("PYGUI_KEYBOARD_NAVIGATION") or None
-# Allow "False", "True", "0", "1"
-if _user_tab_stop is not None:
- _user_tab_stop = _user_tab_stop.strip().capitalize()
- try:
- _user_tab_stop = {"False": False, "True": True}[_user_tab_stop]
- except KeyError:
- try:
- _user_tab_stop = int(_user_tab_stop)
- except ValueError:
- sys.stderr.write("PYGUI_KEYBOARD_NAVIGATION: Unrecognized value %r"
- % _user_tab_stop)
- _user_tab_stop = None
-
-class Component(Properties, MessageHandler):
- """Component is an abstract class representing a user
- interface component."""
-
- left = overridable_property('left', "Position of left edge relative to container.")
- top = overridable_property('top', "Position of top edge relative to container.")
- right = overridable_property('right', "Position of right edge relative to container.")
- bottom = overridable_property('bottom', "Position of bottom edge relative to container.")
-
- x = overridable_property('x', "Horizontal position relative to container.")
- y = overridable_property('y', "Vertical position relative to container.")
- width = overridable_property('width')
- height = overridable_property('height')
-
- position = overridable_property('position', "Position relative to container.")
- size = overridable_property('size')
-
- bounds = overridable_property('bounds', "Bounding rectangle in container's coordinates.")
-
- container = overridable_property('container',
- "Container which contains this Component. Setting this property has the "
- "effect of removing the component from its previous container, if any, "
- "and adding it to the new one, if any.")
-
-# visible = overridable_property('visible',
-# "Whether the component is currently shown.")
-
- tab_stop = overridable_property('tab_stop',
- "Whether tab key can navigate into this control.")
-
- anchor = overridable_property('anchor', "A string of 'ltrb' controlling behaviour when container is resized.")
-
- border = overridable_property('border', "True if the component should have a border.")
-
- _is_scrollable = False # Overridden by scrollable subclasses
- _generic_tabbing = True # Whether to use generic tab navigation code
- _default_tab_stop = False
- _user_tab_stop_override = False # Whether user preference overrides _default_tab_stop
- _tab_stop = None
-
- #
- # Class variables defined by implementations:
- #
- # _has_local_coords bool True if component has a local coordinate system
- #
-
- _container = None
- _border = False
- hmove = 0
- vmove = 0
- hstretch = 0
- vstretch = 0
-
- def __init__(self, tab_stop = None, **kwds):
- Properties.__init__(self, **kwds)
- if tab_stop is None:
- tab_stop = self._get_default_tab_stop()
- self.tab_stop = tab_stop
-
- def destroy(self):
- self.container = None
-
- #
- # Geometry properties
- #
- # Default implementations of position and size properties
- # in terms of the bounds property. A minimal implementation
- # need only implement get_bounds and set_bounds.
- #
- # It is the implementation's responsibility to call _resized()
- # whenever the size of the component changes, either by
- # explicit assignment to geometry properties or by the user
- # resizing the containing window. It should not be called if
- # setting a geometry property does not cause the size to change.
- #
-
- def get_left(self):
- return self.position[0]
-
- def set_left(self, v):
- l, t, r, b = self.bounds
- self.bounds = (v, t, r, b)
-
- def get_top(self):
- return self.bounds[1]
-
- def set_top(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, v, r, b)
-
- def get_right(self):
- return self.bounds[2]
-
- def set_right(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, v, b)
-
- def get_bottom(self):
- return self.bounds[3]
-
- def set_bottom(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, r, v)
-
- def get_x(self):
- return self.bounds[0]
-
- def set_x(self, v):
- l, t, r, b = self.bounds
- self.bounds = (v, t, v + r - l, b)
-
- def get_y(self):
- return self.bounds[1]
-
- def set_y(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, v, r, v + b - t)
-
- def get_position(self):
- l, t, r, b = self.bounds
- return (l, t)
-
- def set_position(self, (x, y)):
- l, t, r, b = self.bounds
- self.bounds = (x, y, x + r - l, y + b - t)
-
- def get_width(self):
- l, t, r, b = self.bounds
- return r - l
-
- def set_width(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, l + v, b)
-
- def get_height(self):
- l, t, r, b = self.bounds
- return b - t
-
- def set_height(self, v):
- l, t, r, b = self.bounds
- self.bounds = (l, t, r, t + v)
-
- def get_size(self):
- l, t, r, b = self.bounds
- return (r - l, b - t)
-
- def set_size(self, (w, h)):
- l, t, r, b = self.bounds
- self.bounds = (l, t, l + w, t + h)
-
- #
- # Container management
- #
-
- def get_container(self):
- return self._container
-
- def set_container(self, new_container):
- if self._container != new_container:
- self._change_container(new_container)
-
- def _change_container(self, new_container):
- old_container = self._container
- if old_container:
- self._container = None
- old_container._remove(self)
- if new_container:
- self._container = new_container
- new_container._add(self)
-
- #
- # Message dispatching
- #
-
- def become_target(self):
- """Arrange for this object to be the first to handle messages
- dispatched to the containing Window. If the component is not
- contained in a Window, the effect is undefined."""
- raise NotImplementedError
-
- def is_target(self):
- """Return true if this is the current target within the containing
- Window. If the component is not contained in a Window, the result
- is undefined."""
- return self.window and self.window.target is self
-
- #
- # Message handling
- #
-
- def next_handler(self):
- return self._container
-
- #
- # Visibility control
- #
-
-# def show(self):
-# """Make the Component visible (provided its container is visible)."""
-# self.visible = 1
-#
-# def hide(self):
-# """Make the Component invisible."""
-# self.visible = 0
-
- #
- # Border
- #
-
- def get_border(self):
- return self._border
-
- def set_border(self, x):
- self._border = x
-
- #
- # Resizing
- #
-
- def get_anchor(self):
- if self.hmove:
- s1 = 'r'
- elif self.hstretch:
- s1 = 'lr'
- else:
- s1 = 'l'
- if self.vmove:
- s2 = 'b'
- elif self.vstretch:
- s2 = 'tb'
- else:
- s2 = 't'
- return s1 + s2
-
- def set_anchor(self, s):
- if 'r' in s:
- if 'l' in s:
- self.hstretch = True
- self.hmove = False
- else:
- self.hstretch = False
- self.hmove = True
- else:
- self.hstretch = False
- self.hmove = False
- if 'b' in s:
- if 't' in s:
- self.vstretch = True
- self.vmove = False
- else:
- self.vstretch = False
- self.vmove = True
- else:
- self.vstretch = False
- self.vmove = False
-
- def get_auto_layout(self):
- return self._auto_layout
-
- def set_auto_layout(self, x):
- self._auto_layout = x
-
- def _resized(self, delta):
- # Called whenever the size of the component changes for
- # any reason.
- pass
-
- def container_resized(self, delta):
- """Called whenever the component's container changes size and the
- container's auto_layout property is true. The default implementation
- repositions and resizes this component according to its resizing
- options."""
- dw, dh = delta
- left, top, right, bottom = self.bounds
- if self.hmove:
- left += dw
- right += dw
- elif self.hstretch:
- right += dw
- if self.vmove:
- top += dh
- bottom += dh
- elif self.vstretch:
- bottom += dh
- self.bounds = (left, top, right, bottom)
-
- #
- # Update region maintenance
- #
-
- def invalidate(self):
- """Mark the whole Component as needing to be redrawn."""
- self.invalidate_rect(self.viewed_rect())
-
-# def invalidate_rect(self, r):
-# print "GComponent.invalidate_rect:", self, r ###
-# container = self._container
-# if container:
-# container.invalidate_rect(r)
-
-# def _invalidate_in_container(self):
-# container = self._container
-# if container:
-# container._invalidate_subcomponent(self)
-
- #
- # Coordinate transformation
- #
-
- def local_to_global(self, p):
- p = self.local_to_container(p)
- parent = self._container
- if parent:
- return parent.local_to_global(p)
- else:
- return p
-
- def global_to_local(self, p):
- parent = self._container
- if parent:
- p = parent.global_to_local(p)
- return self.container_to_local(p)
-
- def local_to_container(self, p):
- if self._has_local_coords:
- return add_pt(p, self.local_to_container_offset())
- else:
- return p
-
- def container_to_local(self, p):
- if self._has_local_coords:
- return sub_pt(p, self.local_to_container_offset())
- else:
- return p
-
- def local_to_container_offset(self):
- if self._has_local_coords:
- return self.position
- else:
- return (0, 0)
-
- def transform_from(self, other, p):
- return transform_coords(other, self, p)
-
- def transform_to(self, other, p):
- return transform_coords(self, other, p)
-
- #
- # Placement specification support
- #
-
- def __add__(self, offset):
- return (self, offset)
-
- def __sub__(self, offset):
- return (self, -offset)
-
- #
- # Tabbing
- #
-
-# def get_tabbable(self):
-# return self._tabbable
-#
-# def set_tabbable(self, value):
-# if self._tabbable <> value:
-# self._tabbable = value
-# self._invalidate_tab_chain()
-
- def get_tab_stop(self):
- return self._tab_stop
-
- def set_tab_stop(self, x):
- if self._tab_stop <> x:
- self._tab_stop = x
- self._invalidate_tab_chain()
-
- def _get_default_tab_stop(self):
- if self._user_tab_stop_override:
- result = _user_tab_stop
- else:
- result = None
- if result is None:
- result = self._default_tab_stop
- return result
-
- def _tab_out(self):
- pass
-
- def _tab_in(self):
- self.become_target()
-
- def _build_tab_chain(self, chain):
- if self._tab_stop:
- chain.append(self)
-
- def _invalidate_tab_chain(self):
- window = self.window
- if window:
- window._invalidate_tab_chain()
-
- def _is_targetable(self):
- return True
-
- #
- # Other
- #
-
- window = overridable_property('window', """The Window ultimately containing
- this Component, or None.""")
-
- def get_window(self):
- container = self._container
- if container:
- return container.window
- else:
- return None
-
- def reset_blink(self):
- application().reset_blink()
-
- def viewed_rect(self):
- """Returns the rectangle in local coordinates that is
- currently visible within the component."""
- if self._has_local_coords:
- width, height = self.size
- return (0, 0, width, height)
- else:
- return self.bounds
-
- def broadcast(self, message, *args):
- """Traverse the component hierarchy, calling each component's handler for
- the given message, if any."""
- method = getattr(self, message, None)
- if method:
- method(*args)
-
- def _dispatch_mouse_event(self, event):
- self._handle_mouse_event(event)
-
- def _handle_mouse_event(self, event):
- self.handle(event.kind, event)
-
-
-def transform_coords(from_component, to_component, p):
- if from_component:
- g = from_component.local_to_global(p)
- else:
- g = p
- if to_component:
- return to_component.global_to_local(g)
- else:
- return g
diff --git a/PyGUI-2.5.3/build/lib/GUI/GContainers.py b/PyGUI-2.5.3/build/lib/GUI/GContainers.py
deleted file mode 100644
index fb6714f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GContainers.py
+++ /dev/null
@@ -1,382 +0,0 @@
-#
-# Python GUI - Containers - Generic
-#
-
-try:
- maketrans = str.maketrans
-except AttributeError:
- from string import maketrans
-from GUI.Properties import overridable_property
-from GUI.Exceptions import ArgumentError
-from GUI.Geometry import pt_in_rect
-from GUI import Component
-
-anchor_to_sticky = maketrans("ltrb", "wnes")
-
-class Container(Component):
- """A Container is a Component that can contain other Components.
- The sub-components are clipped to the boundary of their container."""
-
- contents = overridable_property('contents',
- "List of subcomponents. Do not modify directly.")
-
- content_width = overridable_property('content_width', "Width of the content area.")
- content_height = overridable_property('content_height', "Height of the content area.")
- content_size = overridable_property('content_size', "Size of the content area.")
-
- auto_layout = overridable_property('auto_layout',
- "Automatically adjust layout of subcomponents when resized.")
-
- _auto_layout = True
-
- # _contents [Component]
-
- def __init__(self, **kw):
- self._contents = []
- Component.__init__(self, **kw)
-
- def destroy(self):
- """Destroy this Container and all of its contents."""
- contents = self._contents
- while contents:
- comp = contents[-1]
- comp.destroy()
- assert not contents or contents[-1] is not comp, \
- "%r failed to remove itself from container on destruction" % comp
- Component.destroy(self)
-
- #
- # Content area
- #
-
- def get_content_width(self):
- return self.content_size[0]
-
- def set_content_width(self, w):
- self.content_size = w, self.content_height
-
- def get_content_height(self):
- return self.content_size[1]
-
- def set_content_height(self, h):
- self.content_size = self.content_width, h
-
- get_content_size = Component.get_size
- set_content_size = Component.set_size
-
- #
- # Subcomponent Management
- #
-
- def get_contents(self):
- return self._contents
-
- def add(self, comp):
- """Add the given Component as a subcomponent."""
- if comp:
- if isinstance(comp, Component):
- comp.container = self
- else:
- for item in comp:
- self.add(item)
-
- def remove(self, comp):
- """Remove subcomponent, if present."""
- if isinstance(comp, Component):
- if comp in self._contents:
- comp.container = None
- else:
- for item in comp:
- self.remove(item)
-
- def _add(self, comp):
- # Called by comp.set_container() to implement subcomponent addition.
- self._contents.append(comp)
- self._invalidate_tab_chain()
- self.added(comp)
-
- def _remove(self, comp):
- # Called by comp.set_container() to implement subcomponent removal.
- self._contents.remove(comp)
- self._invalidate_tab_chain()
- self.removed(comp)
-
- def added(self, comp):
- """Called after a subcomponent has been added."""
- pass
-
- def removed(self, comp):
- """Called after a subcomponent has been removed."""
- pass
-
- #
- # The infamous 'place' method and friends.
- #
-
- _place_default_spacing = 8
-
- def place(self, item,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, anchor = None):
- """Add a component to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- self._place([item], left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border, anchor = anchor)
-
- def place_row(self, items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, spacing = None,
- anchor = None):
- """Add a row of components to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- if left is not None and right is not None:
- raise ValueError("Cannot specify both left and right to place_row")
- elif left is None and right is not None:
- direction = 'left'
- items = items[:]
- items.reverse()
- else:
- direction = 'right'
- self._place(items, left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border,
- direction = direction, spacing = spacing, anchor = anchor)
-
- def place_column(self, items,
- left = None, right = None, top = None, bottom = None,
- sticky = 'nw', scrolling = '', border = None, spacing = None,
- anchor = None):
- """Add a column of components to the frame with positioning,
- resizing and scrolling options. See the manual for details."""
- if top is not None and bottom is not None:
- raise ValueError("Cannot specify both top and bottom to place_column")
- elif top is None and bottom is not None:
- direction = 'up'
- items = items[:]
- items.reverse()
- else:
- direction = 'down'
- self._place(items, left = left, right = right, top = top, bottom = bottom,
- sticky = sticky, scrolling = scrolling, border = border,
- direction = direction, spacing = spacing, anchor = anchor)
-
- def _place(self, items,
- left = None,
- right = None,
- top = None,
- bottom = None,
- sticky = 'nw',
- scrolling = '',
- direction = 'right',
- spacing = None,
- border = None,
- anchor = None):
-
- def side(spec, name):
- # Process a side specification taking the form of either
- # (1) an offset, (2) a reference component, or (3) a
- # tuple (component, offset). Returns a tuple (ref, offset)
- # where ref is the reference component or None (representing
- # the Frame being placed into). Checks that the reference
- # component, if any, is directly contained by this Frame.
- ref = None
- offset = None
- if spec is not None:
- if isinstance(spec, tuple):
- ref, offset = spec
- elif isinstance(spec, Component):
- ref = spec
- offset = 0
- elif isinstance(spec, (int, float)):
- offset = spec
- else:
- raise ArgumentError(self, 'place', name, spec)
- if ref is self:
- ref = None
- elif ref:
- con = ref.container
- #if con is not self and isinstance(con, ScrollFrame):
- # ref = con
- # con = ref.container
- if con is not self:
- raise ValueError("Reference component for place() is not"
- " directly contained by the frame being placed into.")
- return ref, offset
-
- if spacing is None:
- spacing = self._place_default_spacing
-
- # Decode the sticky options
- if anchor is not None:
- sticky = anchor.translate(anchor_to_sticky)
- hmove = vmove = hstretch = vstretch = 0
- if 'e' in sticky:
- if 'w' in sticky:
- hstretch = 1
- else:
- hmove = 1
- if 's' in sticky:
- if 'n' in sticky:
- vstretch = 1
- else:
- vmove = 1
-
- # Translate the direction argument
- try:
- dir = {'right':0, 'down':1, 'left':2, 'up':3}[direction]
- except KeyError:
- raise ArgumentError(self, 'place', 'direction', direction)
-
- # Unpack the side arguments
- left_obj, left_off = side(left, 'left')
- right_obj, right_off = side(right, 'right')
- top_obj, top_off = side(top, 'top')
- bottom_obj, bottom_off = side(bottom, 'bottom')
-
- # Process the items
- #if not isinstance(items, list):
- # items = [items]
- for item in items:
- x, y = item.position
- w, h = item.size
- # Calculate left edge position
- if left_obj:
- l = left_obj.left + left_obj.width + left_off
- elif left_off is not None:
- if left_off < 0:
- l = self.width + left_off
- else:
- l = left_off
- else:
- l = None
- # Calculate top edge position
- if top_obj:
- t = top_obj.top + top_obj.height + top_off
- elif top_off is not None:
- if top_off < 0:
- t = self.height + top_off
- else:
- t = top_off
- else:
- t = None
- # Calculate right edge position
- if right_obj:
- r = right_obj.left + right_off
- elif right_off is not None:
- if right_off <= 0:
- r = self.width + right_off
- else:
- r = right_off
- else:
- r = None
- # Calculate bottom edge position
- if bottom_obj:
- b = bottom_obj.top + bottom_off
- elif bottom_off is not None:
- if bottom_off <= 0:
- b = self.height + bottom_off
- else:
- b = bottom_off
- else:
- b = None
- # Fill in unspecified positions
- if l is None:
- if r is not None:
- l = r - w
- else:
- l = x
- if r is None:
- r = l + w
- if t is None:
- if b is not None:
- t = b - h
- else:
- t = y
- if b is None:
- b = t + h
- if scrolling:
- item.scrolling = scrolling
- # Position, resize and add the item
- item.bounds = (l, t, r, b)
- self.add(item)
- # Record resizing and border options
- item.hmove = hmove
- item.vmove = vmove
- item.hstretch = hstretch
- item.vstretch = vstretch
- if border is not None:
- item.border = border
- # Step to the next item
- if dir == 0:
- left_obj = item
- left_off = spacing
- elif dir == 1:
- top_obj = item
- top_off = spacing
- elif dir == 2:
- right_obj = item
- right_off = -spacing
- else:
- bottom_obj = item
- bottom_off = -spacing
-
- #
- # Resizing
- #
-
- def _resized(self, delta):
- if self._auto_layout:
- self.resized(delta)
-
- def resized(self, delta):
- for c in self._contents:
- c.container_resized(delta)
-
- def resize(self, auto_layout = False, **kwds):
- """Change the geometry of the component, with control over whether
- the layout of subcomponents is updated. The default is not to do so.
- Keyword arguments to this method may be any of the properties
- affecting position and size (i.e. left, top, right, bottom, x, y,
- width, height, position, size, bounds)."""
- old_auto_layout = self.auto_layout
- try:
- self.auto_layout = auto_layout
- self.set(**kwds)
- finally:
- self.auto_layout = old_auto_layout
-
- #
- # Tabbing
- #
-
- def _build_tab_chain(self, chain):
- Component._build_tab_chain(self, chain)
- for c in self._contents:
- c._build_tab_chain(chain)
-
- #
- # Other
- #
-
- def shrink_wrap(self, padding = None):
- """Adjust the size of the component so that it neatly encloses its
- contents. If padding is specified, it specifies the amount of space
- to leave at right and bottom, otherwise the minimum distance from the
- left and top sides to the nearest components is used."""
- contents = self.contents
- if not contents:
- return
- if padding:
- hpad, vpad = padding
- else:
- hpad = min([item.left for item in contents])
- vpad = min([item.top for item in contents])
- rights = [item.right for item in contents]
- bottoms = [item.bottom for item in contents]
- self.resize(size = (max(rights) + hpad, max(bottoms) + vpad))
-
- def broadcast(self, message, *args):
- """Traverse the component hierarchy, calling each component's handler for
- the given message, if any."""
- Component.broadcast(self, message, *args)
- for comp in self._contents:
- comp.broadcast(message, *args)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GControls.py b/PyGUI-2.5.3/build/lib/GUI/GControls.py
deleted file mode 100644
index 47f0a81..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GControls.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Python GUI - Controls - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Component
-
-class Control(Component):
- """Abstract base class for components such as buttons, check
- boxes and text entry boxes."""
-
- title = overridable_property('title', "Title of the control.")
- value = overridable_property('value', "Value of the control.")
- enabled = overridable_property('enabled', "True if user can manipulate the control.")
- font = overridable_property('font')
- color = overridable_property('color')
- just = overridable_property('just', "Justification ('left', 'center' or 'right').")
- lines = overridable_property('lines',
- "Height of the control measured in lines of the current font.")
- tab_stop = overridable_property('tab_stop',
- "Whether tab key can navigate into this control.")
-
- _vertical_padding = 0 # Extra height to add when setting 'lines' property
- _default_tab_stop = True
- _user_tab_stop_override = True
-
- def __init__(self, font = None, lines = None, **kwds):
- Component.__init__(self, **kwds)
- # If font and lines are both specified, must set font first.
- if font:
- self.font = font
- if lines is not None:
- self.lines = lines
-
- def get_lines(self):
- return int(round((self.height - self._vertical_padding) / self.font.line_height))
-
- def set_lines(self, num_lines):
- self.height = self._calc_height(self.font, num_lines)
-
- def _calc_height(self, font, num_lines = 1):
- return num_lines * font.line_height + self._vertical_padding
-
- def _is_targetable(self):
- return self.enabled
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/build/lib/GUI/GCursors.py b/PyGUI-2.5.3/build/lib/GUI/GCursors.py
deleted file mode 100644
index a5982f0..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GCursors.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# Python GUI - Cursors - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI.Properties import Properties
-from GUI.Resources import lookup_resource, find_resource, get_resource
-from GUI import Image
-
-def _hotspot_for_resource(resource_name):
- path = lookup_resource(resource_name, "hot")
- if path:
- f = open(path, "rU")
- xs, ys = f.readline().split()
- return int(xs), int(ys)
- else:
- return None
-
-class Cursor(Properties):
- """A Cursor is an image representing the mouse pointer.
-
- Constructors:
- Cursor(resource_name, hotspot)
- Cursor(image, hotspot)
- """
-
- def from_resource(cls, name, hotspot = None, **kwds):
- def load(path):
- image = Image.from_resource(name, **kwds)
- return cls(image, hotspot or _hotspot_for_resource(name))
- return get_resource(load, name)
-
- from_resource = classmethod(from_resource)
-
- def __init__(self, spec, hotspot = None):
- """Construct a Cursor from a resource or Image and a hotspot point.
- The hotspot defaults to the centre of the image."""
- if isinstance(spec, basestring):
- self._init_from_resource(spec, hotspot)
- else:
- self._init_from_image(spec, hotspot)
-
- def _init_from_resource(self, resource_name, hotspot):
- image = Image(file = find_resource(resource_name))
- if not hotspot:
- hotspot = _hotspot_for_resource(resource_name)
- self._init_from_image(image, hotspot)
-
- def _init_from_image(self, image, hotspot):
- if not hotspot:
- width, height = image.size
- hotspot = (width // 2, height // 2)
- self._init_from_image_and_hotspot(image, hotspot)
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GDI.py b/PyGUI-2.5.3/build/lib/GUI/GDI.py
deleted file mode 100644
index bf5765e..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GDI.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - GDI
-#
-#--------------------------------------------------------------------
-
-LF_FACESIZE = 32
-
-from ctypes import *
-from ctypes.wintypes import *
-
-class LOGFONT(Structure):
- _fields_ = [ ('lfHeight', c_long),
- ('lfWidth', c_long),
- ('lfEscapement', c_long),
- ('lfOrientation', c_long),
- ('lfWeight', c_long),
- ('lfItalic', c_byte),
- ('lfUnderline', c_byte),
- ('lfStrikeOut', c_byte),
- ('lfCharSet', c_byte),
- ('lfOutPrecision', c_byte),
- ('lfClipPrecision', c_byte),
- ('lfQuality', c_byte),
- ('lfPitchAndFamily', c_byte),
- ('lfFaceName', c_char * LF_FACESIZE) ]
-
- def __init__(self):
- self.lfHeight = 10
- self.lfWidth = 0
- self.lfEscapement = 10
- self.lfOrientation = 0
- self.lfUnderline = 0
- self.lfStrikeOut = 0
- self.lfCharSet = 0 # ANSI_CHARSET
- #self.lfPitchAndFamily = 0
- self.lfOutPrecision = 0
- self.lfClipPrecision = 0
- self.lfQuality = 0
- self.lfPitchAndFamily = 2
-
-def create_hfont(family, size, style):
- lf = LOGFONT()
- lf.lfFaceName = family
- lf.lfHeight = size
- if 'italic' in style:
- lf.lfItalic = 1
- if 'bold' in style:
- lf.lfWeight = 10
- return windll.gdi32.CreateFontIndirectA(byref(lf))
diff --git a/PyGUI-2.5.3/build/lib/GUI/GDIPlus.py b/PyGUI-2.5.3/build/lib/GUI/GDIPlus.py
deleted file mode 100644
index 788bfa7..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GDIPlus.py
+++ /dev/null
@@ -1,494 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - GDI Plus
-#
-#--------------------------------------------------------------------
-
-from ctypes import *
-from ctypes.wintypes import BOOL
-try:
- from numpy import ndarray, float32
-except ImportError:
- class ndarray(object):
- pass
-
-#wg = windll.gdiplus
-wg = oledll.gdiplus
-
-#--------------------------------------------------------------------
-
-# enum Unit
-
-UnitWorld = 0
-UnitDisplay = 1
-UnitPixel = 2
-UnitPoint = 3
-
-# enum FillMode
-
-FillModeAlternate = 0
-
-# enum CombineMode
-
-CombineModeIntersect = 1
-
-# enum MatrixOrder
-
-MatrixOrderPrepend = 0
-MatrixOrderAppend = 1
-
-# Pixel Formats
-
-# In-memory pixel data formats:
-# bits 0-7 = format index
-# bits 8-15 = pixel size (in bits)
-# bits 16-23 = flags
-# bits 24-31 = reserved
-
-PixelFormatIndexed = 0x00010000 # Indexes into a palette
-PixelFormatGDI = 0x00020000 # Is a GDI-supported format
-PixelFormatAlpha = 0x00040000 # Has an alpha component
-PixelFormatPAlpha = 0x00080000 # Pre-multiplied alpha
-PixelFormatExtended = 0x00100000 # Extended color 16 bits/channel
-PixelFormatCanonical = 0x00200000
-
-PixelFormat1bppIndexed = (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI)
-PixelFormat4bppIndexed = (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI)
-PixelFormat8bppIndexed = (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI)
-PixelFormat16bppGrayScale = (4 | (16 << 8) | PixelFormatExtended)
-PixelFormat16bppRGB555 = (5 | (16 << 8) | PixelFormatGDI)
-PixelFormat16bppRGB565 = (6 | (16 << 8) | PixelFormatGDI)
-PixelFormat16bppARGB1555 = (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI)
-PixelFormat24bppRGB = (8 | (24 << 8) | PixelFormatGDI)
-PixelFormat32bppRGB = (9 | (32 << 8) | PixelFormatGDI)
-PixelFormat32bppARGB = (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical)
-PixelFormat32bppPARGB = (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI)
-PixelFormat48bppRGB = (12 | (48 << 8) | PixelFormatExtended)
-PixelFormat64bppARGB = (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended)
-PixelFormat64bppPARGB = (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended)
-
-# enum FontStyle
-
-FontStyleBold = 1
-FontStyleItalic = 2
-FontStyleUnderline = 4
-FontStyleStrikeout = 8
-
-class PointF(Structure):
- _fields_ = [("x", c_float), ("y", c_float)]
-
-class RectF(Structure):
- _fields_ = [
- ("x", c_float), ("y", c_float),
- ("width", c_float), ("height", c_float)]
-
-#--------------------------------------------------------------------
-
-def rect_args(rect):
- l, t, r, b = rect
- return c_float(l), c_float(t), c_float(r - l), c_float(b - t)
-
-def points_args(points):
- if isinstance(points, ndarray) and points.flags['C_CONTIGUOUS'] and points.dtype == float32:
- #print "GDIPlus.points_args: using ndarray" ###
- n = points.size // 2
- buf = points.ctypes.data
- else:
- n = len(points)
- buf = (PointF * n)()
- for i, p in enumerate(points):
- buf[i].x, buf[i].y = p
- return buf, n
-
-def arc_args(c, r, a0, a1):
- x, y = c
- d = c_float(2 * r)
- return c_float(x - r), c_float(y - r), d, d, \
- c_float(a0), c_float((a1 - a0) % 360.0)
-
-#--------------------------------------------------------------------
-
-class GdiplusStartupInput(Structure):
-
- _fields_ = [
- ('GdiplusVersion', c_uint),
- ('DebugEventCallback', c_void_p),
- ('SuppressBackgroundThread', BOOL),
- ('SuppressExternalCodecs', BOOL),
- ]
-
- def __init__(self):
- Structure.__init__(self)
- self.GdiplusVersion = 1
- self.DebugEventCallback = None
- self.SuppressBackgroundThread = 0
- self.SuppressExternalCodecs = 0
-
-StartupInput = GdiplusStartupInput()
-token = c_ulong()
-wg.GdiplusStartup(pointer(token), pointer(StartupInput), None)
-
-#--------------------------------------------------------------------
-
-class Pen(object):
-
- def __init__(self, argb, size):
- ptr = c_void_p()
- wg.GdipCreatePen1(argb, c_float(size), UnitWorld, byref(ptr))
- self.ptr = ptr
-
- def __del__(self, wg = wg):
- wg.GdipDeletePen(self.ptr)
-
-#--------------------------------------------------------------------
-
-class SolidBrush(object):
-
- def __init__(self, argb):
- ptr = c_void_p()
- wg.GdipCreateSolidFill(argb, byref(ptr))
- self.ptr = ptr
-
- def __del__(self, wg = wg):
- wg.GdipDeleteBrush(self.ptr)
-
- def __str__(self):
- argb = c_ulong()
- wg.GdipGetSolidFillColor(self.ptr, byref(argb))
- return "" % argb.value
-
-#--------------------------------------------------------------------
-
-class Font(object):
-
- def __init__(self, family, size, style):
- uname = create_unicode_buffer(family)
- fam = c_void_p()
- wg.GdipCreateFontFamilyFromName(uname, None, byref(fam))
- flags = 0
- if 'bold' in style:
- flags |= FontStyleBold
- if 'italic' in style:
- flags |= FontStyleItalic
- ptr = c_void_p()
- wg.GdipCreateFont(fam, c_float(size), flags, UnitWorld, byref(ptr))
- self.ptr = ptr
- wg.GdipDeleteFontFamily(fam)
-
- def from_hdc(cls, hdc):
- self = cls.__new__(cls)
- ptr = c_void_p()
- wg.GdipCreateFontFromDC(hdc, byref(ptr))
- self.ptr = ptr
- return self
-
- from_hdc = classmethod(from_hdc)
-
- def __del__(self, wg = wg):
- wg.GdipDeleteFont(self.ptr)
-
-#--------------------------------------------------------------------
-
-class Image(object):
-
- def __str__(self):
- return "" % self.ptr.value
-
- def from_file(cls, path):
- self = cls.__new__(cls)
- ptr = c_void_p()
- upath = create_unicode_buffer(path)
- self._create_from_file(upath, ptr)
- self.ptr = ptr
- return self
-
- from_file = classmethod(from_file)
-
- def _create_from_file(self, upath, ptr):
- wg.GdipLoadImageFromFile(upath, byref(ptr))
-
- def __del__(self, wg = wg):
- wg.GdipDisposeImage(self.ptr)
-
- def GetWidth(self):
- uint = c_uint()
- wg.GdipGetImageWidth(self.ptr, byref(uint))
- return uint.value
-
- def GetHeight(self):
- uint = c_uint()
- wg.GdipGetImageHeight(self.ptr, byref(uint))
- return uint.value
-
-#--------------------------------------------------------------------
-
-class Bitmap(Image):
-
- def __init__(self, width, height):
- ptr = c_void_p()
- format = PixelFormat32bppARGB
- wg.GdipCreateBitmapFromScan0(width, height, 0, format, None, byref(ptr))
- self.ptr = ptr
- #print "GDIPlus.Bitmap:", (width, height), repr(self), "ptr =", self.ptr ###
-
- def _create_from_file(self, upath, ptr):
- wg.GdipCreateBitmapFromFile(upath, byref(ptr))
-
- def from_data(cls, width, height, format, data):
- self = cls.__new__(cls)
- ptr = c_void_p()
- bits_per_pixel = (format >> 8) & 0xff
- row_stride = (width * bits_per_pixel) >> 3
- wg.GdipCreateBitmapFromScan0(width, height, row_stride, format, data, byref(ptr))
- self.ptr = ptr
- return self
-
- from_data = classmethod(from_data)
-
- def __str__(self):
- return "" % self.ptr.value
-
- def GetHICON(self):
- hicon = c_ulong()
- wg.GdipCreateHICONFromBitmap(self.ptr, byref(hicon))
- return hicon.value
-
- def GetPixel(self, x, y):
- c = c_ulong()
- wg.GdipBitmapGetPixel(self.ptr, x, y, byref(c))
- return c.value
-
- def SetPixel(self, x, y, c):
- wg.GdipBitmapSetPixel(self.ptr, x, y, c)
-
-#--------------------------------------------------------------------
-
-class GraphicsPath(object):
-
- def __init__(self):
- ptr = c_void_p()
- wg.GdipCreatePath(FillModeAlternate, byref(ptr))
- self.ptr = ptr
-
- def __del__(self, wg = wg):
- wg.GdipDeletePath(self.ptr)
-
- def Reset(self):
- wg.GdipResetPath(self.ptr)
-
- def StartFigure(self):
- wg.GdipStartPathFigure(self.ptr)
-
- def AddLine_4f(self, x0, y0, x1, y1):
- wg.GdipAddPathLine(self.ptr,
- c_float(x0), c_float(y0), c_float(x1), c_float(y1))
-
- def AddBezier_4p(self, p0, p1, p2, p3):
- x0, y0 = p0
- x1, y1 = p1
- x2, y2 = p2
- x3, y3 = p3
- wg.GdipAddPathBezier(self.ptr,
- c_float(x0), c_float(y0), c_float(x1), c_float(y1),
- c_float(x2), c_float(y2), c_float(x3), c_float(y3))
-
- def AddBeziers_pv(self, points):
- wg.GdipAddPathBeziers(self.ptr, *points_args(points))
-
- def AddRectangle_r(self, rect):
- wg.GdipAddPathRectangle(self.ptr, *rect_args(rect))
-
- def AddEllipse_r(self, rect):
- wg.GdipAddPathEllipse(self.ptr, *rect_args(rect))
-
- def AddArc_p3f(self, c, r, a0, a1):
- wg.GdipAddPathArc(self.ptr, *arc_args(c, r, a0, a1))
-
- def AddPie_p3f(self, c, r, a0, a1):
- wg.GdipAddPathPie(self.ptr, *arc_args(c, r, a0, a1))
-
- def AddLines_pv(self, points):
- wg.GdipAddPathLine2(self.ptr, *points_args(points))
-
- def AddPolygon_pv(self, points):
- wg.GdipAddPathPolygon(self.ptr, *points_args(points))
-
- def CloseFigure(self):
- wg.GdipClosePathFigure(self.ptr)
-
- def GetLastPoint(self):
- p = PointF()
- wg.GdipGetPathLastPoint(self.ptr, byref(p))
- return p.x, p.y
-
-#--------------------------------------------------------------------
-
-class Graphics(object):
-
- def from_hdc(cls, hdc):
- self = cls.__new__(cls)
- ptr = c_void_p()
- wg.GdipCreateFromHDC(c_ulong(hdc), byref(ptr))
- self.ptr = ptr
- return self
-
- from_hdc = classmethod(from_hdc)
-
- def from_dc(cls, dc):
- return cls.from_hdc(dc.GetSafeHdc())
-
- from_dc = classmethod(from_dc)
-
- def from_image(cls, image):
- #print "Graphics.from_image:", repr(image) ###
- #print "...", image ###
- self = cls.__new__(cls)
- ptr = c_void_p()
- wg.GdipGetImageGraphicsContext(image.ptr, byref(ptr))
- self.ptr = ptr
- return self
-
- from_image = classmethod(from_image)
-
- def __del__(self, wg = wg):
- wg.GdipDeleteGraphics(self.ptr)
-
- def __str__(self):
- return "" % self.ptr.value
-
- def GetHDC(self):
- hdc = c_long()
- wg.GdipGetDC(self.ptr, byref(hdc))
- return hdc.value
-
- def ReleaseHDC(self, hdc):
- wg.GdipReleaseDC(self.ptr, hdc)
-
- def GetDpiX(self):
- result = c_float()
- wg.GdipGetDpiX(self.ptr, byref(result))
- return result.value
-
- def GetDpiY(self):
- result = c_float()
- wg.GdipGetDpiY(self.ptr, byref(result))
- return result.value
-
- def SetPageUnit(self, unit):
- self.unit = unit
- wg.GdipSetPageUnit(self.ptr, unit)
-
- def GetClipBounds(self):
- r = RectF()
- wg.GdipGetClipBounds(self.ptr, byref(r))
- return (r.x, r.y, r.x + r.width, r.y + r.height)
-
- def Save(self):
- state = c_uint()
- wg.GdipSaveGraphics(self.ptr, byref(state))
- return state.value
-
- def Restore(self, state):
- wg.GdipRestoreGraphics(self.ptr, state)
-
- def DrawImage_rr(self, image, dst_rect, src_rect):
- sl, st, sr, sb = src_rect
- dl, dt, dr, db = dst_rect
- wg.GdipDrawImageRectRect(self.ptr, image.ptr,
- c_float(dl), c_float(dt), c_float(dr - dl), c_float(db - dt),
- c_float(sl), c_float(st), c_float(sr - sl), c_float(sb - st),
- UnitPixel, None, None, None)
-
- def DrawPath(self, pen, path):
- wg.GdipDrawPath(self.ptr, pen.ptr, path.ptr)
-
- def FillPath(self, brush, path):
- wg.GdipFillPath(self.ptr, brush.ptr, path.ptr)
-
- def DrawAndMeasureStringWidth_2f(self, text, font, x, y, brush):
- wtext = unicode(text)
- n = len(text)
- pos = PointF(x, y)
- flags = 5 # DriverStringOptions CmapLookup+RealizedAdvance
- b = RectF()
- wg.GdipDrawDriverString(self.ptr, wtext, n, font.ptr, brush.ptr,
- byref(pos), flags, None)
- wg.GdipMeasureDriverString(self.ptr, wtext, n, font.ptr, byref(pos),
- flags, None, byref(b))
- return b.width
-
- def MeasureStringWidth(self, text, font):
- wtext = unicode(text)
- n = len(text)
- pos = PointF(0, 0)
- flags = 5 # DriverStringOptions CmapLookup+RealizedAdvance
- b = RectF()
- wg.GdipMeasureDriverString(self.ptr, wtext, n, font.ptr, byref(pos),
- flags, None, byref(b))
- return b.width
-
- def SetClip_PI(self, path):
- wg.GdipSetClipPath(self.ptr, path.ptr, CombineModeIntersect)
-
- def SetClip_rI(self, rect):
- x, y, w, h = rect_args(rect)
- wg.GdipSetClipRect(self.ptr, x, y, w, h, CombineModeIntersect)
-
- def DrawRectangle_r(self, pen, rect):
- wg.GdipDrawRectangle(self.ptr, pen.ptr, *rect_args(rect))
-
- def FillRectangle_r(self, brush, rect):
- #print "Graphics.FillRectangle_r:", self, brush, rect ###
- #print "... clip bounds =", self.GetClipBounds() ###
- wg.GdipFillRectangle(self.ptr, brush.ptr, *rect_args(rect))
-
- def DrawEllipse_r(self, pen, rect):
- wg.GdipDrawEllipse(self.ptr, pen.ptr, *rect_args(rect))
-
- def FillEllipse_r(self, brush, rect):
- wg.GdipFillEllipse(self.ptr, brush.ptr, *rect_args(rect))
-
- def DrawArc_3pf(self, pen, c, r, a0, a1):
- wg.GdipDrawArc(self.ptr, pen.ptr, *arc_args(c, r, a0, a1))
-
- def DrawPie_p3f(self, pen, c, r, a0, a1):
- wg.GdipDrawPie(self.ptr, pen.ptr, *arc_args(c, r, a0, a1))
-
- def FillPie_p3f(self, brush, c, r, a0, a1):
- wg.GdipFillPie(self.ptr, brush.ptr, *arc_args(c, r, a0, a1))
-
- def DrawPolygon_pv(self, pen, points):
- wg.GdipDrawPolygon(self.ptr, pen.ptr, *points_args(points))
-
- def FillPolygon_pv(self, brush, points):
- buf, n = points_args(points)
- wg.GdipFillPolygon(self.ptr, brush.ptr, buf, n, FillModeAlternate)
-
- def DrawBeziers_pv(self, pen, points):
- wg.GdipDrawBeziers(self.ptr, pen.ptr, *points_args(points))
-
- def DrawLines_pv(self, pen, points):
- wg.GdipDrawLines(self.ptr, pen.ptr, *points_args(points))
-
- def Translate_2f(self, dx, dy):
- wg.GdipTranslateWorldTransform(self.ptr, c_float(dx), c_float(dy),
- MatrixOrderAppend)
-
- def Scale_2f(self, sx, sy):
- wg.GdipScaleWorldTransform(self.ptr, c_float(sx), c_float(sy),
- MatrixOrderAppend)
-
- def Rotate_1f(self, r):
- wg.GdipRotateWorldTransform(self.ptr, c_float(r),
- MatrixOrderAppend)
-
-
-
- def GetTransform(self):
- matrix = c_void_p()
- elems = (c_float * 6)()
- wg.GdipCreateMatrix(byref(matrix))
- wg.GdipGetWorldTransform(self.ptr, matrix)
- wg.GdipGetMatrixElements(matrix, elems)
- wg.GdipDeleteMatrix(matrix)
- return list(elems)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GDialogs.py b/PyGUI-2.5.3/build/lib/GUI/GDialogs.py
deleted file mode 100644
index ab9116e..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GDialogs.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#
-# Python GUI - Dialogs - Generic
-#
-
-from GUI import Globals
-from GUI.Properties import overridable_property
-from GUI.Actions import ActionBase, action_property
-from GUI import Window
-
-class Dialog(Window, ActionBase):
-
- _default_keys = "\r"
- _cancel_keys = "\x1b"
-
-# default_button = overridable_property('default_button',
-# "Button to be activated by the default key.")
-#
-# cancel_button = overridable_property('cancel_button',
-# "Button to be activated by the cancel key.")
-#
-# _default_button = None
-# _cancel_button = None
-
- default_action = action_property('default_action',
- "Action to perform when Return or Enter is pressed.")
-
- cancel_action = action_property('cancel_action',
- "Action to perform when Escape is pressed.")
-
- _default_action = 'ok'
- _cancel_action ='cancel'
-
- def __init__(self, style = 'nonmodal_dialog',
- closable = 0, zoomable = 0, resizable = 0, **kwds):
- if 'title' not in kwds:
- kwds['title'] = Globals.application_name
- Window.__init__(self, style = style,
- closable = closable, zoomable = zoomable, resizable = resizable,
- **kwds)
-
-# def get_default_button(self):
-# return self._default_button
-#
-# def set_default_button(self, button):
-# self._default_button = button
-# if button:
-# button.style = 'default'
-#
-# def get_cancel_button(self):
-# return self._cancel_button
-#
-# def set_cancel_button(self, button):
-# self._cancel_button = button
-# if button:
-# button.style = 'cancel'
-
- def key_down(self, event):
- #print "GDialog.key_down:", repr(event.char) ###
- c = event.char
- if c:
- if c in self._default_keys:
- self.do_default_action()
- return
- elif c in self._cancel_keys:
- self.do_cancel_action()
- return
- Window.key_down(self, event)
-
- def do_default_action(self):
- self.do_named_action('default_action')
-
- def do_cancel_action(self):
- self.do_named_action('cancel_action')
-
-# def _activate_button(self, button):
-# if button:
-# button.activate()
diff --git a/PyGUI-2.5.3/build/lib/GUI/GDrawableContainers.py b/PyGUI-2.5.3/build/lib/GUI/GDrawableContainers.py
deleted file mode 100644
index f060b18..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GDrawableContainers.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - DrawableContainer - Generic
-#
-#--------------------------------------------------------------------
-
-from GUI.Geometry import rect_sized
-from GUI import Container
-from GUI import ViewBase
-from GUI.Printing import Printable
-
-default_size = (100, 100)
-
-class DrawableContainer(ViewBase, Container, Printable):
-
- #
- # Construction and destruction
- #
-
- def __init__(self, **kwds):
- Container.__init__(self, **kwds)
- ViewBase.__init__(self)
-
- def destroy(self):
- ViewBase.destroy(self)
- Container.destroy(self)
-
- def setup_menus(self, m):
- ViewBase.setup_menus(self, m)
- Container.setup_menus(self, m)
-
- def viewed_rect(self):
- """Return the rectangle in local coordinates bounding the currently
- visible part of the extent."""
- return rect_sized((0, 0), self.size)
-
- def with_canvas(self, proc):
- """Call the procedure with a canvas suitable for drawing in this
- view. The canvas is only valid for the duration of the call, and
- should not be retained beyond it."""
- raise NotImplementedError
-
- def update(self):
- """Redraw invalidated regions immediately, without waiting for a
- return to the event loop."""
- raise NotImplementedError
-
- def get_print_extent(self):
- return self.content_size
-
- def _draw_background(self, canvas, clip_rect):
- return clip_rect
-
- #
- # Callbacks
- #
-
- def draw(self, canvas, rect):
- """Called when the view needs to be drawn. The rect is the bounding
- rectangle of the region needing to be drawn. The default implementation
- does nothing."""
- pass
diff --git a/PyGUI-2.5.3/build/lib/GUI/GEditCmdHandlers.py b/PyGUI-2.5.3/build/lib/GUI/GEditCmdHandlers.py
deleted file mode 100644
index eac1bbe..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GEditCmdHandlers.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# PyGUI - Edit command handling - Generic
-#
-
-from GUI import application
-
-class EditCmdHandler(object):
- # Mixin for objects that implement the standard editing commands.
-
- _may_be_password = False
-
- def setup_menus(self, m):
- selbeg, selend = self.selection
- anysel = selbeg < selend
- anyscrap = application().query_clipboard()
- passwd = self._may_be_password and self.password
- m.cut_cmd.enabled = anysel and not passwd
- m.copy_cmd.enabled = anysel and not passwd
- m.paste_cmd.enabled = anyscrap
- m.clear_cmd.enabled = anysel
- m.select_all_cmd.enabled = True
-
- def select_all_cmd(self):
- self.select_all()
-
- def select_all(self):
- self.selection = (0, self.get_text_length())
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GEvents.py b/PyGUI-2.5.3/build/lib/GUI/GEvents.py
deleted file mode 100644
index d4522ea..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GEvents.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# Python GUI - Events - Generic
-#
-
-class Event(object):
-
- """An input event.
-
- Attributes:
-
- kind Type of event. One of 'mouse_down', 'mouse_up', 'key_down',
- 'key_up'.
-
- global_position Position of mouse in screen coordinates at the time of the event.
-
- position For mouse events, position in local coordinates of the View that
- was the target of this event. Undefined for other event types.
-
- time Time of event, in platform-dependent units.
-
- button Button identifier for mouse down/up events.
-
- num_clicks Number of consecutive clicks within double-click time.
-
- char For key events, an ASCII character. Undefined for other event types.
-
- key For non-printing keys, a value identifying the key. Undefined for other event types.
-
- auto True if key-down event is an autorepeat (not supported on all platforms).
-
- Platform-independent modifiers (boolean):
-
- shift The Shift key.
- control The Control key.
- option The additional modifier key.
- extend_contig The contiguous selection extension modifier key.
- extend_noncontig The noncontiguous selection extension modifier key.
- """
-
- kind = None
- global_position = None
- position = None
- time = None
- button = None
- num_clicks = 0
- char = None
- key = None
- auto = False
- shift = False
- control = False
- option = False
- extend_contig = False
- extend_noncontig = False
- delta = (0, 0)
- _keycode = 0 # Platform-dependent key code
- _originator = None # Component to which originally delivered by platform
- _not_handled = False # Reached default event method of originating component
-
- def position_in(self, view):
- """Return the position of this event in the coordinate system
- of the specified view."""
- return view.global_to_local(self.global_position)
-
- def __str__(self):
- return "" \
- % (self.kind, self.global_position, self.position, self.time,
- self.num_clicks, self.char, self.key, self.shift, self.control,
- self.option, self.extend_contig, self.extend_noncontig, self.auto,
- self._platform_modifiers_str())
diff --git a/PyGUI-2.5.3/build/lib/GUI/GFiles.py b/PyGUI-2.5.3/build/lib/GUI/GFiles.py
deleted file mode 100644
index 585d9af..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GFiles.py
+++ /dev/null
@@ -1,193 +0,0 @@
-#
-# Python GUI - File references and types - Generic
-#
-# Classes for dealing with file references and file types
-# in as platform-independent a manner as possible.
-#
-# In this view of things, a file reference consists
-# of two parts:
-#
-# 1) A directory reference, whose nature is
-# platform-dependent,
-#
-# 2) A name.
-#
-
-import os
-from GUI.Properties import Properties, overridable_property
-
-class FileRef(Properties):
- """A FileRef represents a file system object in a platform-independent way.
- It consists of two parts, a directory specification and the name of an
- object within that directory. The directory specification always refers
- to an existing directory, but the named object may or may not exist.
-
- Constructors:
- FileRef(dir = DirRef or path, name = string)
- FileRef(path = string)
- """
-
- dir = overridable_property('dir', "DirRef representing the parent directory.")
- name = overridable_property('name', "Name of the object within the parent directory.")
- path = overridable_property('path', "Full pathname of the object.")
-
- _dir = None # DirRef representing the parent directory
- _name = None # Name, including type suffix if any
-
- #
- # Constructor
- #
-
- def __init__(self, dir = None, name = None, path = None):
- if dir and name and not path:
- if not isinstance(dir, DirRef):
- dir = DirRef(dir)
- elif path and not (dir or name):
- dirpath, name = os.path.split(path)
- dir = DirRef(path = dirpath)
- else:
- raise TypeError("Invalid argument combination to FileRef constructor")
- self._dir = dir
- self._name = name
-
- #
- # Properties
- #
-
- def get_dir(self):
- return self._dir
-
- def get_name(self):
- "Return the name of the file."
- return self._name
-
- def get_path(self):
- return os.path.join(self._dir.path, self._name)
-
- #
- # Methods
- #
-
- def open(self, mode, file_type = None):
- """Open as a file with the given mode and return a file object. On
- platforms which have file-type metadata (e.g. Macintosh), if the
- mode contains 'w' and a file_type is specified, the newly-created
- file will be given the specified type."""
- f = open(self.path, mode)
- if "w" in mode and file_type:
- self._set_type(file_type)
- return f
-
- def mkdir(self):
- """Create a directory with the name and parent directory specified
- by this FileRef. Returns a DirRef for the created directory."""
- return DirRef(os.mkdir(self.path))
-
- def _set_type(self, file_type):
- # Platforms which have file-type metadata (e.g. Macintosh) use this
- # to set the type of a file.
- pass
-
- def __str__(self):
- return "FileRef(%r,%r)" % (self.dir.path, self.name)
-
-#-------------------------------------------------------------------------
-
-class DirRef(Properties):
- """A DirRef is an object representing a directory in the
- file system. Its representation is completely platform
- dependent.
-
- Constructor:
- DirRef(path = string)
- """
-
- _path = None
-
- path = overridable_property('path', "Full pathname of the directory.")
-
- def __init__(self, path):
- self._path = path
-
- def get_path(self):
- return self._path
-
- def __str__(self):
- return "DirRef(%r)" % self.path
-
-#-------------------------------------------------------------------------
-
-class FileType(Properties):
- """A FileType is a multi-platform representation of a file type."""
-
- _name = None
- _suffix = None
- _mac_creator = None
- _mac_type = None
- _mac_force_suffix = True
-
- name = overridable_property('name', "Human-readable description of the file type")
- suffix = overridable_property('suffix', "Filename suffix (without dot)")
- mac_creator = overridable_property('mac_creator', "Macintosh 4-character creator code")
- mac_type = overridable_property('mac_type', "Macintosh 4-character type code")
- mac_force_suffix = overridable_property('mac_force_suffix', "Enforce filename suffix on MacOSX")
-
- def get_name(self):
- return self._name
-
- def set_name(self, x):
- self._name = x
-
- def get_suffix(self):
- return self._suffix
-
- def set_suffix(self, x):
- self._suffix = x
-
- def get_mac_creator(self):
- return self._mac_creator
-
- def set_mac_creator(self, x):
- self._mac_creator = x
-
- def get_mac_type(self):
- return self._mac_type
-
- def set_mac_type(self, x):
- self._mac_type = x
-
- def get_mac_force_suffix(self):
- return self._mac_force_suffix
-
- def set_mac_force_suffix(self, x):
- self._mac_force_suffix = x
-
- def _matches(self, name, mac_type):
- # Return true if the given name or type code matches that of
- # this file type.
- this_mac_type = self._mac_type
- this_suffix = self._suffix
- if this_mac_type and mac_type == this_mac_type:
- return True
- # Allow generic text files to match typeless files for MacOSX
- if not this_suffix and this_mac_type == "TEXT" and mac_type == "\0\0\0\0":
- return True
- if this_suffix and _matches_suffix(name, this_suffix):
- return True
- return False
-
- def _add_suffix(self, name):
- # Force the given name to have the appropriate suffix for this file
- # type. Platforms which have other means of representing file types
- # (e.g. Macintosh) may override this.
- suffix = self._suffix
- if suffix and not _matches_suffix(name, suffix):
- name = "%s.%s" % (name, suffix)
- return name
-
-#-------------------------------------------------------------------------
-
-def _matches_suffix(name, suffix):
- # Test case-insensitively whether the given filename has
- # the given suffix.
- return name.lower().endswith("." + suffix.lower())
diff --git a/PyGUI-2.5.3/build/lib/GUI/GFonts.py b/PyGUI-2.5.3/build/lib/GUI/GFonts.py
deleted file mode 100644
index 80ccc29..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GFonts.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#
-# Python GUI - Fonts - Generic
-#
-
-import sys
-from GUI.Properties import overridable_property
-
-class Font(object):
- """A Font object represents a set of characters of a particular
- typeface, style and size. Font objects are immutable.
-
- Constructors:
- Font(family, size, style)
- family = family name
- size = size in points
- style = a list of 'bold', 'italic'
-
- Properties:
- family --> string
- size --> number
- style --> ['bold', 'italic']
- ascent --> number
- descent --> number
- leading --> number
- height --> number
- cap_height --> number
- x_height --> number
- line_height --> number
- """
-
- family = overridable_property('family', "Family name ('Times', 'Helvetica', etc.)")
- size = overridable_property('size', "Size in points")
- style = overridable_property('style', "A list of 'bold', 'italic'")
- ascent = overridable_property('ascent', "Distance from baseline to top of highest character")
- descent = overridable_property('descent', "Distance from baseline to bottom of lowest character")
- height = overridable_property('height', "Sum of ascent and descent")
- cap_height = overridable_property('cap_height', "Height above baseline of capital letters")
- x_height = overridable_property('x_height', "Height above baseline of lowercase letters without ascenders")
- leading = overridable_property('leading', "Recommended extra space between lines")
- line_height = overridable_property('line_height', "Recommended distance between baselines")
-
- def get_cap_height(self):
- # Approximation for platforms not supporting this
- return self.ascent
-
- def get_x_height(self):
- # Approximation for platforms not supporting this
- return self.ascent - self.descent
-
- def get_leading(self):
- return self.line_height - self.height
-
- def but(self, family = None, size = None, style = None,
- style_includes = None, style_excludes = None):
- """Return a new Font that is the same as this one except for the
- specified characteristics."""
- if not family:
- family = self.family
- if not size:
- size = self.size
- if style is None:
- style = self.style
- style = style[:]
- if style_includes:
- for item in style_includes:
- style.append(item)
- if style_excludes:
- for item in style_excludes:
- if item in style:
- style.remove(item)
- return self.__class__(family, size, style)
-
- def width(self, s, start = 0, end = None):
- """width(s [,start [,end ]])
- The width of the specified part of the given string in this font."""
- if start or end is not None:
- if end is None:
- end = len(s)
- s = s[start:end]
- return self._width(s)
-
- def _width(self, s):
- raise NotImplementedError
-
- def x_to_pos(self, s, x):
- """Given a number of pixels measured from the left of
- the given string, returns the nearest inter-character position.
- Returns 0 if x is negative, and len(string) if x is beyond the
- right end of the string."""
- raise NotImplementedError
-
- def __str__(self):
- return "Font(%r,%g,%s)" % (self.family, self.size, self.style)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GFrames.py b/PyGUI-2.5.3/build/lib/GUI/GFrames.py
deleted file mode 100644
index 503bb6d..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GFrames.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# Python GUI - Frames - Generic
-#
-
-from GUI import Container
-
-class Frame(Container):
- """A Frame is a general-purpose instantiable subclass of Container."""
-
- _default_size = (100, 100)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GGLConfig.py b/PyGUI-2.5.3/build/lib/GUI/GGLConfig.py
deleted file mode 100644
index 3a92da2..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GGLConfig.py
+++ /dev/null
@@ -1,162 +0,0 @@
-#
-# PyGUI - OpenGL Pixel Formats - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class GLConfig(Properties):
- """Class holding the attributes of an OpenGL context configuration."""
-
- # NOTE: When adding a property here, also add it to
- # _pixel_format_attribute_names below.
-
- double_buffer = overridable_property("double_buffer", "True if context is to be double-buffered.")
- alpha = overridable_property("alpha", "True if there is to be an alpha channel.")
- color_size = overridable_property("color_size", "Number of bits per colour buffer component.")
- alpha_size = overridable_property("alpha_size", "Number of bits per alpha channel component.")
- stereo = overridable_property("stereo", "True if stereoscopic context is required.")
- aux_buffers = overridable_property("aux_buffers", "Number of auxiliary colour buffers to allocate.")
- depth_buffer = overridable_property("depth_buffer", "True if a depth buffer is required.")
- depth_size = overridable_property("depth_size", "Number of bits per depth buffer element.")
- stencil_buffer = overridable_property("stencil_buffer", "True if a stencil buffer is required.")
- stencil_size = overridable_property("stencil_size", "Number of bits per stencil buffer element.")
- accum_buffer = overridable_property("accum_buffer", "True if an accumulation buffer is required.")
- accum_size = overridable_property("accum_size", "Number of bits per accumulation buffer component.")
- multisample = overridable_property("multisample", "True if a multisampled context is required.")
- samples_per_pixel = overridable_property("samples_per_pixel", "Number of samples per multisampled pixel.")
-
- _double_buffer = True
- _alpha = True
- _color_size = 8
- _alpha_size = 8
- _stereo = False
- _aux_buffers = 0
- _depth_buffer = True
- _depth_size = 32
- _stencil_buffer = False
- _stencil_size = 8
- _accum_buffer = False
- _accum_size = 8
- _multisample = False
- _samples_per_pixel = 4
-
- _pixel_format_attribute_names = (
- 'double_buffer', 'alpha', 'color_size', 'alpha_size',
- 'stereo', 'aux_buffers', 'depth_buffer', 'depth_size',
- 'stencil_buffer', 'stencil_size', 'accum_buffer', 'accum_size',
- 'multisample', 'samples_per_pixel',
- )
-
- def _from_args(cls, config, kwds):
- # Extract pixel format arguments from arguments of GLView.__init__
- # or GLPixmap.__init__ and return a GLConfig. Used keyword
- # arguments are removed from kwds.
- pf_kwds = {}
- for name in cls._pixel_format_attribute_names:
- if name in kwds:
- pf_kwds[name] = kwds.pop(name)
- if config and pf_kwds:
- raise TypeError("Explicit config cannot be used with other configuration keyword arguments")
- if not config:
- config = cls(**pf_kwds)
- return config
-
- _from_args = classmethod(_from_args)
-
- def get_double_buffer(self):
- return self._double_buffer
-
- def set_double_buffer(self, x):
- self._double_buffer = x
-
- def get_alpha(self):
- return self._alpha
-
- def set_alpha(self, x):
- self._alpha = x
-
- def get_color_size(self):
- return self._color_size
-
- def set_color_size(self, x):
- self._color_size = x
-
- def get_alpha_size(self):
- return self._alpha_size
-
- def set_alpha_size(self, x):
- self._alpha_size = x
-
- def get_stereo(self):
- return self._stereo
-
- def set_stereo(self, x):
- self._stereo = x
-
- def get_aux_buffers(self):
- return self._aux_buffers
-
- def set_aux_buffers(self, x):
- self._aux_buffers = x
-
- def get_depth_buffer(self):
- return self._depth_buffer
-
- def set_depth_buffer(self, x):
- self._depth_buffer = x
-
- def get_depth_size(self):
- return self._depth_size
-
- def set_depth_size(self, x):
- self._depth_size = x
-
- def get_stencil_buffer(self):
- return self._stencil_buffer
-
- def set_stencil_buffer(self, x):
- self._stencil_buffer = x
-
- def get_stencil_size(self):
- return self._stencil_size
-
- def set_stencil_size(self, x):
- self._stencil_size = x
-
- def get_accum_buffer(self):
- return self._accum_buffer
-
- def set_accum_buffer(self, x):
- self._accum_buffer = x
-
- def get_accum_size(self):
- return self._accum_size
-
- def set_accum_size(self, x):
- self._accum_size = x
-
- def get_multisample(self):
- return self._multisample
-
- def set_multisample(self, x):
- self._multisample = x
-
- def get_samples_per_pixel(self):
- return self._samples_per_pixel
-
- def set_samples_per_pixel(self, x):
- self._samples_per_pixel = x
-
- def supported(self):
- """Determine whether the combination of attributes requested by this configuration
- can be satisfied. If successful, a new GLConfig object is returned whose
- attributes reflect those actually allocated. Otherwise, a GLConfigError is
- raised."""
- raise NotImplementedError
-
-#------------------------------------------------------------------------------
-
-class GLConfigError(ValueError):
-
- def __init__(self, msg = "OpenGL configuration not available"):
- ValueError.__init__(self, msg)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GGLContexts.py b/PyGUI-2.5.3/build/lib/GUI/GGLContexts.py
deleted file mode 100644
index 82ed632..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GGLContexts.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# PyGUI - OpenGL Contexts - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.GLShareGroups import ShareGroup
-
-_current_share_group = None
-
-class GLContext(object):
- """Abstract base class for objects having an OpenGL context."""
- #
- # _share_group ShareGroup
- #
-
- share_group = overridable_property('share_group',
- "ShareGroup to which this context should belong, or None.")
-
- def __init__(self, share_group):
- if not share_group:
- share_group = ShareGroup()
- self._share_group = share_group
- if share_group:
- share_group._add(self)
-
- def destroy(self):
- pass
-
- def init_context(self):
- """This method is called once after the associated OpenGL context
- is created. When called, this object's OpenGL context is the current
- context and the viewport is set to (0, 0, width, height). This method
- may be used to establish any desired initial OpenGL state."""
- pass
-
- def get_share_group(self):
- return self._share_group
-
- def _get_shared_context(self):
- """Return another arbitrarily-chosen member of the share group of this
- context, or None if this context has no share group or there are no
- other members."""
- return self._share_group._some_member(exclude = self)
-
- def with_context(self, proc, flush = False):
- """The proc should be a callable object of no arguments. Calls
- the proc with the associated OpenGL context as the current context.
- If flush is true, after calling proc, a glFlush followed by a
- buffer flush or swap is performed as appropriate."""
- self._with_context(proc, flush)
-
- def _with_context(self, proc, flush):
- # Subclasses override this to implement with_context.
- # Should call _with_share_group(proc).
- # Signature can be changed if with_context is overridden to match.
- raise NotImplementedError
-
- def _with_share_group(self, proc):
- global _current_share_group
- old_share_group = _current_share_group
- _current_share_group = self._share_group
- try:
- proc()
- finally:
- _current_share_group = old_share_group
-
-
-def current_share_group():
- group = _current_share_group
- if not group:
- raise ValueError("No current PyGUI OpenGL context")
- return group
diff --git a/PyGUI-2.5.3/build/lib/GUI/GGLPixelFormats.py b/PyGUI-2.5.3/build/lib/GUI/GGLPixelFormats.py
deleted file mode 100644
index 1f20cc8..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GGLPixelFormats.py
+++ /dev/null
@@ -1,163 +0,0 @@
-#
-# PyGUI - OpenGL Pixel Formats - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class GLPixelFormat(Properties):
- """Class holding the attributes of an OpenGL pixel format."""
-
- # NOTE: When adding a property here, also add it to
- # _pixel_format_attribute_names below.
-
- double_buffer = overridable_property("double_buffer", "True if context is to be double-buffered.")
- alpha = overridable_property("alpha", "True if there is to be an alpha channel.")
- color_size = overridable_property("color_size", "Number of bits per colour buffer component.")
- alpha_size = overridable_property("alpha_size", "Number of bits per alpha channel component.")
- stereo = overridable_property("stereo", "True if stereoscopic context is required.")
- aux_buffers = overridable_property("aux_buffers", "Number of auxiliary colour buffers to allocate.")
- depth_buffer = overridable_property("depth_buffer", "True if a depth buffer is required.")
- depth_size = overridable_property("depth_size", "Number of bits per depth buffer element.")
- stencil_buffer = overridable_property("stencil_buffer", "True if a stencil buffer is required.")
- stencil_size = overridable_property("stencil_size", "Number of bits per stencil buffer element.")
- accum_buffer = overridable_property("accum_buffer", "True if an accumulation buffer is required.")
- accum_size = overridable_property("accum_size", "Number of bits per accumulation buffer component.")
- multisample = overridable_property("multisample", "True if a multisampled context is required.")
- samples_per_pixel = overridable_property("samples_per_pixel", "Number of samples per multisampled pixel.")
-
- _double_buffer = True
- _alpha = True
- _color_size = 8
- _alpha_size = 8
- _stereo = False
- _aux_buffers = 0
- _depth_buffer = True
- _depth_size = 32
- _stencil_buffer = False
- _stencil_size = 8
- _accum_buffer = False
- _accum_size = 8
- _multisample = False
- _samples_per_pixel = False
-
- _pixel_format_attribute_names = (
- 'double_buffer', 'alpha', 'color_size', 'alpha_size',
- 'stereo', 'aux_buffers', 'depth_buffer', 'depth_size',
- 'stencil_buffer', 'stencil_size', 'accum_buffer', 'accum_size',
- 'multisample', 'samples_per_pixel',
- )
-
- def _from_args(cls, pixel_format, kwds):
- # Extract pixel format arguments from arguments of GLView.__init__
- # or GLPixmap.__init__ and return a GLPixelFormat. Used keyword
- # arguments are removed from kwds.
- pf_kwds = {}
- for name in cls._pixel_format_attribute_names:
- if name in kwds:
- pf_kwds[name] = kwds.pop(name)
- if pixel_format and pf_kwds:
- raise TypeError("Explicit pixel_format cannot be used with other pixel format keyword arguments")
- if not pixel_format:
- pixel_format = cls(**pf_kwds)
- return pixel_format
-
- _from_args = classmethod(_from_args)
-
- def get_double_buffer(self):
- return self._double_buffer
-
- def set_double_buffer(self, x):
- self._double_buffer = x
-
- def get_alpha(self):
- return self._alpha
-
- def set_alpha(self, x):
- self._alpha = x
-
- def get_color_size(self):
- return self._color_size
-
- def set_color_size(self, x):
- self._color_size = x
-
- def get_alpha_size(self):
- return self._alpha_size
-
- def set_alpha_size(self, x):
- self._alpha_size = x
-
- def get_stereo(self):
- return self._stereo
-
- def set_stereo(self, x):
- self._stereo = x
-
- def get_aux_buffers(self):
- return self._aux_buffers
-
- def set_aux_buffers(self, x):
- self._aux_buffers = x
-
- def get_depth_buffer(self):
- return self._depth_buffer
-
- def set_depth_buffer(self, x):
- self._depth_buffer = x
-
- def get_depth_size(self):
- return self._depth_size
-
- def set_depth_size(self, x):
- self._depth_size = x
-
- def get_stencil_buffer(self):
- return self._stencil_buffer
-
- def set_stencil_buffer(self, x):
- self._stencil_buffer = x
-
- def get_stencil_size(self):
- return self._stencil_size
-
- def set_stencil_size(self, x):
- self._stencil_size = x
-
- def get_accum_buffer(self):
- return self._accum_buffer
-
- def set_accum_buffer(self, x):
- self._accum_buffer = x
-
- def get_accum_size(self):
- return self._accum_size
-
- def set_accum_size(self, x):
- self._accum_size = x
-
- def get_multisample(self):
- return self._multisample
-
- def set_multisample(self, x):
- self._multisample = x
-
- def get_samples_per_pixel(self):
- return self._samples_per_pixel
-
- def set_samples_per_pixel(self, x):
- self._samples_per_pixel = x
-
- def supported(self):
- """Determine whether the combination of attributes requested by this pixel format
- can be satisfied. If successful, a new GLPixelFormat object is returned whose
- attributes reflect those actually allocated. Otherwise, a GLPixelFormatError is
- raised."""
- raise NotImplementedError
-
-#------------------------------------------------------------------------------
-
-class GLPixelFormatError(ValueError):
-
- def __init__(self):
- ValueError.__init__(self,
- "OpenGL pixel format attribute request cannot be satisfied")
diff --git a/PyGUI-2.5.3/build/lib/GUI/GGLPixmaps.py b/PyGUI-2.5.3/build/lib/GUI/GGLPixmaps.py
deleted file mode 100644
index 8f07090..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GGLPixmaps.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# PyGUI - OpenGL Pixmap - Generic
-#
-
-from OpenGL.GL import glViewport
-from GUI import ImageBase
-from GUI.GLContexts import GLContext
-
-class GLPixmap(ImageBase, GLContext):
- """An offscreen OpenGL drawing area.
-
- Constructors:
- GLPixmap(width, height, share = None, config_attr = value...)
- GLPixmap(width, height, config, share = None)
- """
-
- def destroy(self):
- GLContext.destroy(self)
-
- def _init_context(self):
- width, height = self.size
- glViewport(0, 0, int(width), int(height))
- self.init_context()
diff --git a/PyGUI-2.5.3/build/lib/GUI/GGLTextures.py b/PyGUI-2.5.3/build/lib/GUI/GGLTextures.py
deleted file mode 100644
index 0a56f85..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GGLTextures.py
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Generic
-#
-
-from weakref import WeakKeyDictionary
-from OpenGL.GL import glGenTextures, glBindTexture, glDeleteTextures, \
- glTexImage2D, GL_TEXTURE_2D, GL_RGBA
-from OpenGL.GLU import gluBuild2DMipmaps
-from GUI.GGLContexts import current_share_group
-from GUI.GLDisplayLists import call_when_not_compiling_display_list
-
-#----------------------------------------------------------------------
-
-class TextureIdMap(WeakKeyDictionary):
-
- def __del__(self):
- #print "GL.TextureIdMap.__del__:", self ###
- def free_texture():
- glDeleteTextures([gl_id])
- for share_group, gl_id in self.items():
- context = share_group._some_member()
- if context:
- #print "...freeing texture id", gl_id, "for", share_group, "using", context ###
- context.with_context(free_texture)
-
-#----------------------------------------------------------------------
-
-class Texture(object):
- """This class encapsulates an OpenGL texture and maintains a
- representation of it for each OpenGL context with which it is used.
- Allocation and maintentance of texture numbers is handled automatically.
-
- Constructor:
- Texture(texture_type)
- where texture_type is the appropriate GL constant for the type
- of texture (GL_TEXTURE_2D etc.)
- """
- #
- # _gl_type int GL_TEXTURE_2D, etc.
- # _gl_id ShareGroup -> int Mapping from OpenGL share group to texture number
-
- def __init__(self, texture_type):
- self._gl_type = texture_type
- self._gl_id = TextureIdMap()
-
- def deallocate(self):
- """Deallocate any OpenGL resources that have been allocated for this
- texture in any context."""
- self._gl_id.__del__()
-
- def bind(self):
- """Makes this texture the current texture for the current context
- by calling glBindTexture. If this texture has not previously been
- used with the current context, do_setup() is called to allocate
- and initialise a representation of the texture."""
- gl_id = self.gl_id()
- glBindTexture(self._gl_type, gl_id)
-
- def gl_id(self):
- """Returns the OpenGL texture number corresponding to this texture
- in the current context. May trigger allocation of a new texture and
- a call to do_setup(). Does not bind the texture, unless a new texture
- is allocated, in which case the current texture binding may be changed
- as a side effect."""
- share_group = current_share_group()
- gl_id = self._gl_id.get(share_group)
- if gl_id is None:
- gl_id = glGenTextures(1)
- #print "GLTexture: assigned id %d for %s in share group %s" % (
- # gl_id, self, share_group) ###
- self._gl_id[share_group] = gl_id
- call_when_not_compiling_display_list(lambda: self._setup(gl_id))
- return gl_id
-
- def _setup(self, gl_id):
- glBindTexture(self._gl_type, gl_id)
- self.do_setup()
-
- def do_setup(self):
- """Subclasses should override this to make the necessary OpenGL
- calls to initialise the texture, assuming that glBindTexture has
- already been called."""
- raise NotImplementedError
-
- def gl_tex_image_2d(self, image, target = GL_TEXTURE_2D, internal_format = GL_RGBA,
- border = False, with_mipmaps = False):
- """Load the currently bound texture with data from an image, with automatic
- scaling to power-of-2 size and optional mipmap generation."""
- border = bool(border)
- if border and with_mipmaps:
- raise ValueError("Bordered texture cannot have mipmaps")
- b2 = 2 * border
- width, height = image.size
- twidth = pow2up(width - b2) + b2
- theight = pow2up(height - b2) + b2
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: before scaling: size =", (width, height) ###
- if width <> twidth or height <> theight:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: scaling image to size", (twidth, theight) ###
- from Pixmaps import Pixmap
- image2 = Pixmap(twidth, theight)
- def scale(canvas):
- image.draw(canvas, (0, 0, width, height), (0, 0, twidth, theight))
- image2.with_canvas(scale)
- image = image2
- format, type, data = self._gl_get_texture_data(image)
- if with_mipmaps:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: loading mipmaps" ###
- gluBuild2DMipmaps(target, internal_format, twidth, theight,
- format, type, data)
- else:
- #print "GUI.GGLTextures.Texture.gl_tex_image_2d: loading texture" ###
- glTexImage2D(target, 0, internal_format, twidth, theight, border,
- format, type, data)
-
-#----------------------------------------------------------------------
-
-def pow2up(size):
- # Round size up to a power of 2
- psize = 1
- while psize < size:
- psize <<= 1
- return psize
diff --git a/PyGUI-2.5.3/build/lib/GUI/GGLViews.py b/PyGUI-2.5.3/build/lib/GUI/GGLViews.py
deleted file mode 100644
index 368970d..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GGLViews.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# PyGUI - OpenGL View - Generic
-#
-
-from OpenGL.GL import glViewport, glMatrixMode, glLoadIdentity, \
- GL_PROJECTION, GL_MODELVIEW
-from GUI import Component
-from GUI import ViewBase
-from GUI.GLContexts import GLContext
-
-class GLError(StandardError):
- pass
-
-class GLView(ViewBase, Component, GLContext):
- """A GLView is a Component providing an OpenGL 3D display area.
-
- Constructors:
- GLView(config_attr = value..., share = None)
- GLView(config, share = None)
- """
-
- _default_size = (100, 100)
-
- def __init__(self, **kwds):
- Component.__init__(self, **kwds)
- ViewBase.__init__(self)
-
- def destroy(self):
- ViewBase.destroy(self)
- Component.destroy(self)
-
- def _render(self):
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity()
- self.render()
-
- def render(self):
- """This method is called when the contents of the view needs to
- be redrawn, with the view's OpenGL context as the current context.
- The modelview matrix has been selected as the current matrix and
- set to an identity matrix. After calling this method, buffers will
- be automatically swapped or drawing flushed as appropriate."""
- pass
-
- def viewport_changed(self):
- """This method is called when the view's size has changed, with
- the view's OpenGL context as the current context, and the OpenGL
- viewport set to (0, 0, width, height). The default implementation
- loads an identity projection matrix and calls init_projection()."""
- glMatrixMode(GL_PROJECTION)
- glLoadIdentity()
- self.init_projection()
-
- def init_projection(self):
- """This method is called to establish the projection whenever the
- viewport changes. The projection matrix has been selected as the
- current matrix and set to an identity matrix."""
- pass
-
- def update(self):
- """Redraws the contents of the view immediately, without waiting
- for a return to the event loop."""
- self.with_context(self.render, flush = True)
-
- def _init_context(self):
- self.init_context()
- self._update_viewport()
-
- def _update_viewport(self):
- width, height = self.size
- glViewport(0, 0, int(width), int(height))
- self.viewport_changed()
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GGeometry.py b/PyGUI-2.5.3/build/lib/GUI/GGeometry.py
deleted file mode 100644
index 0a5bb8a..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GGeometry.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#
-# Python GUI - Point and rectangle utilities - Generic
-#
-
-def add_pt((x1, y1), (x2, y2)):
- return (x1 + x2), (y1 + y2)
-
-def sub_pt((x1, y1), (x2, y2)):
- return (x1 - x2), (y1 - y2)
-
-def rect_sized((l, t), (w, h)):
- return (l, t, l + w, t + h)
-
-def rect_left(r):
- return r[0]
-
-def rect_top(r):
- return r[1]
-
-def rect_right(r):
- return r[2]
-
-def rect_bottom(r):
- return r[3]
-
-def rect_width(r):
- return r[2] - r[0]
-
-def rect_height(r):
- return r[3] - r[1]
-
-def rect_topleft(r):
- return r[:2]
-
-def rect_botright(r):
- return r[2:]
-
-def rect_center((l, t, r, b)):
- return ((l + r) // 2, (t + b) // 2)
-
-def rect_size((l, t, r, b)):
- return (r - l, b - t)
-
-def union_rect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return (min(l1, l2), min(t1, t2), max(r1, r2), max(b1, b2))
-
-def sect_rect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return (max(l1, l2), max(t1, t2), min(r1, r2), min(b1, b2))
-
-def inset_rect((l, t, r, b), (dx, dy)):
- return (l + dx, t + dy, r - dx, b - dy)
-
-def offset_rect((l, t, r, b), (dx, dy)):
- return (l + dx, t + dy, r + dx, b + dy)
-
-def offset_rect_neg((l, t, r, b), (dx, dy)):
- return (l - dx, t - dy, r - dx, b - dy)
-
-def empty_rect((l, t, r, b)):
- return r <= l or b <= t
-
-def pt_in_rect((x, y), (l, t, r, b)):
- return l <= x < r and t <= y < b
-
-def rects_intersect((l1, t1, r1, b1), (l2, t2, r2, b2)):
- return l1 < r2 and l2 < r1 and t1 < b2 and t2 < b1
-
-def rect_with_center((l, t, r, b), (x, y)):
- w = r - l
- h = b - t
- rl = x - w // 2
- rt = y - h // 2
- return (rl, rt, rl + w, rt + h)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GImageBases.py b/PyGUI-2.5.3/build/lib/GUI/GImageBases.py
deleted file mode 100644
index 5762234..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GImageBases.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# Python GUI - Image Base - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-from GUI.Geometry import rect_sized
-
-class ImageBase(Properties):
- """Abstract base class for Image, Pixmap and GLPixmap."""
-
- width = overridable_property('width', "Width of the image in pixels (read only).")
- height = overridable_property('height', "Height of the image in pixels (read only).")
- size = overridable_property('size', "Size of the image in pixels (read only).")
- bounds = overridable_property('bounds', "Bounding rectangle of the image in pixels (read only).")
-
- def get_size(self):
- return (self.width, self.height)
-
- def get_bounds(self):
- return rect_sized((0, 0), self.size)
-
- def draw(self, canvas, src_rect, dst_rect):
- """Draw the part of the image specified by src_rect on the given canvas,
- scaled to fit within dst_rect."""
- raise NotImplementedError
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GImages.py b/PyGUI-2.5.3/build/lib/GUI/GImages.py
deleted file mode 100644
index 21fb9bb..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GImages.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Python GUI - Images - Generic
-#
-
-from GUI.Files import FileRef
-from GUI.Resources import get_resource
-from GUI import ImageBase
-
-class Image(ImageBase):
- """Class Image represents an RGB or RGBA image.
-
- Constructors:
- Image(file = FileRef or pathname)
- """
-
- def from_resource(cls, name, **kwds):
- return get_resource(cls, name, **kwds)
-
- from_resource = classmethod(from_resource)
-
- def __init__(self, file):
- if isinstance(file, FileRef):
- file = file.path
- self._init_from_file(file)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GL.py b/PyGUI-2.5.3/build/lib/GUI/GL.py
deleted file mode 100644
index da2453c..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GL.py
+++ /dev/null
@@ -1,185 +0,0 @@
-#
-# PyGUI - OpenGL View - Cocoa
-#
-
-__all__ = ['GLConfig', 'GLView', 'GLPixmap']
-
-import AppKit
-from Foundation import NSSize
-from AppKit import NSOpenGLPixelFormat, NSOpenGLView, \
- NSBitmapImageRep, NSCachedImageRep, NSImage, NSAlphaFirstBitmapFormat, \
- NSFloatingPointSamplesBitmapFormat
-from Foundation import NSMakeRect
-from OpenGL.GL import glViewport, glFlush, glFinish, glReadPixels, \
- GL_RGB, GL_RGBA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, \
- GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, GL_FLOAT, \
- glReadPixelsub, glTexImage2D, glPixelStorei, GL_UNPACK_ALIGNMENT
-from OpenGL.GLU import gluBuild2DMipmaps
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.GGLConfig import GLConfig as GGLConfig
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-from GUI.GLDisplayLists import DisplayList
-from GUI.Utils import NSMultiClass, PyGUI_NS_ViewBase
-
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
- # _ns_pixel_format NSOpenGLPixelFormat
-
- def _ns_get_pixel_format(self, offscreen = False):
- attrs = [AppKit.NSOpenGLPFAColorSize, self._color_size]
- if self._double_buffer:
- attrs += [AppKit.NSOpenGLPFADoubleBuffer]
- if self._alpha:
- attrs += [AppKit.NSOpenGLPFAAlphaSize, self._alpha_size]
- if self._stereo:
- attrs += [AppKit.NSOpenGLPFAStereo]
- if self._aux_buffers:
- attrs += [AppKit.NSOpenGLPFAAuxBuffers, self._aux_buffers]
- if self._depth_buffer:
- attrs += [AppKit.NSOpenGLPFADepthSize, self._depth_size]
- if self._stencil_buffer:
- attrs += [AppKit.NSOpenGLPFAStencilSize, self._stencil_size]
- if self._accum_buffer:
- attrs += [AppKit.NSOpenGLPFAAccumSize, self._accum_size]
- if self._multisample:
- attrs += [AppKit.NSOpenGLPFASampleBuffers, 1]
- attrs += [AppKit.NSOpenGLPFASamples, self._samples_per_pixel]
- if offscreen:
- attrs += [AppKit.NSOpenGLPFAOffScreen]
- attrs.append(0)
- ns_pf = NSOpenGLPixelFormat.alloc().initWithAttributes_(attrs)
- if not ns_pf and self._double_buffer:
- attrs.remove(AppKit.NSOpenGLPFADoubleBuffer)
- ns_pf = NSOpenGLPixelFormat.alloc().initWithAttributes_(attrs)
- if not ns_pf:
- raise GLConfigError
- return ns_pf
-
- def _ns_set_pixel_format(self, ns_pf):
- def ns_attr(attr):
- return ns_pf.getValues_forAttribute_forVirtualScreen_(attr, 0)[0]
- self._ns_pixel_format = ns_pf
- self._double_buffer = ns_attr(AppKit.NSOpenGLPFADoubleBuffer)
- self._color_size = ns_attr(AppKit.NSOpenGLPFAColorSize)
- self._alpha_size = ns_attr(AppKit.NSOpenGLPFAAlphaSize)
- self._alpha = self._alpha_size > 0
- self._stereo = ns_attr(AppKit.NSOpenGLPFAStereo)
- self._aux_buffers = ns_attr(AppKit.NSOpenGLPFAAuxBuffers)
- self._depth_size = ns_attr(AppKit.NSOpenGLPFADepthSize)
- self._depth_buffer = self._depth_size > 0
- self._stencil_size = ns_attr(AppKit.NSOpenGLPFAStencilSize)
- self._stencil_buffer = self._stencil_size > 0
- self._accum_size = ns_attr(AppKit.NSOpenGLPFAAccumSize)
- self._accum_buffer = self._accum_size > 0
- self._multisample = ns_attr(AppKit.NSOpenGLPFASampleBuffers) > 0
- self._samples_per_pixel = ns_attr(AppKit.NSOpenGLPFASamples)
-
- def supported(self, mode = 'both'):
- try:
- ns_pf = self._ns_get_pixel_format()
- pf = GLConfig.__new__()
- pf._ns_set_pixel_format(ns_pf)
- return pf
- except GLConfigError:
- return None
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
- # _ns_view NSOpenGLView
- # _ns_context NSOpenGLContext
- # _ns_flush function for flushing/swapping buffers
-
- def __init__(self, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- ns_pf = pf._ns_get_pixel_format()
- width, height = GGLView._default_size
- ns_rect = NSMakeRect(0, 0, width, height)
- ns_view = _PyGUI_NSOpenGLView.alloc().initWithFrame_pixelFormat_(
- ns_rect, ns_pf)
- ns_view.pygui_component = self
- GGLView.__init__(self, _ns_view = ns_view)
- GLContext.__init__(self, share_group = share_group, _ns_pixel_format = ns_pf)
- ns_context = self._ns_context
- ns_view.setOpenGLContext_(ns_context)
- #ns_context.setView_(ns_view) # Docs say this is needed, but
- # prints warning and seems to work without.
- if pf.double_buffer:
- self._ns_flush = ns_context.flushBuffer
- else:
- self._ns_flush = glFlush
- self.set(**kwds)
- self.with_context(self._init_context)
-
- def destroy(self):
- #print "GLView.destroy:", self ###
- ns_view = self._ns_view
- GGLView.destroy(self)
- #print "GLView.destroy: breaking back link from", ns_view ###
- ns_view.pygui_component = None
-
- def invalidate(self):
- self._ns_view.setNeedsDisplay_(True)
-
- def update(self):
- self._ns_view.displayIfNeeded()
-
- def track_mouse(self):
- return self._ns_track_mouse(self._ns_view)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- pf = GLConfig._from_args(config, kwds)
- ns_pf = pf._ns_get_pixel_format()
- ns_size = NSSize(width, height)
- ns_cache = NSCachedImageRep.alloc().initWithSize_depth_separate_alpha_(
- ns_size, 0, True, True)
- ns_image = NSImage.alloc().initWithSize_(ns_size)
- GLContext.__init__(self, share_group = share_group, _ns_pixel_format = ns_pf)
- self._ns_context.setView_(ns_cache.window().contentView())
- self._init_with_ns_image(ns_image, flipped = False)
- self._ns_cache = ns_cache
- self.with_context(self._init_context)
-
- def _ns_flush(self):
- glFlush()
- width, height = self.size
- pixels = glReadPixels(0, 0, int(width), int(height), GL_RGBA, GL_UNSIGNED_BYTE)
- bytes_per_row = int(width) * 4
- ns_new_bitmap = NSBitmapImageRep.alloc().\
- initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(
- (pixels, "", "", "", ""), int(width), int(height), 8, 4, True, False, AppKit.NSDeviceRGBColorSpace, bytes_per_row, 0)
- ns_image = NSImage.alloc().initWithSize_(NSSize(width, height))
- ns_image.addRepresentation_(ns_new_bitmap)
- ns_image.lockFocus()
- ns_image.unlockFocus()
- self._ns_image = ns_image
- self._ns_bitmap_image_rep = ns_new_bitmap
-
-#------------------------------------------------------------------------------
-
-class _PyGUI_NSOpenGLView(NSOpenGLView, PyGUI_NS_ViewBase):
- __metaclass__ = NSMultiClass
- #
- # pygui_component GLView
-
- __slots__ = ['pygui_component']
-
- def isFlipped(self):
- return True
-
- def reshape(self):
- comp = self.pygui_component
- if comp.window:
- comp.with_context(comp._update_viewport)
-
- def drawRect_(self, rect):
- comp = self.pygui_component
- comp.with_context(comp._render, flush = True)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GLContexts.py b/PyGUI-2.5.3/build/lib/GUI/GLContexts.py
deleted file mode 100644
index ec0f154..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GLContexts.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# PyGUI - OpenGL Contexts - Cocoa
-#
-
-from AppKit import NSOpenGLContext
-from GUI.GGLContexts import GLContext as GGLContext
-
-class GLContext(GGLContext):
- # _ns_context NSOpenGLContext
-
- def __init__(self, share_group, _ns_pixel_format):
- GGLContext.__init__(self, share_group)
- shared_context = self._get_shared_context()
- if shared_context:
- ns_share = shared_context._ns_context
- else:
- ns_share = None
- ns_context = NSOpenGLContext.alloc().initWithFormat_shareContext_(
- _ns_pixel_format, ns_share)
- self._ns_context = ns_context
-
- def _with_context(self, proc, flush):
- #print "GLContext._with_context: Entering context", self._ns_context ###
- old_context = NSOpenGLContext.currentContext()
- self._ns_context.makeCurrentContext()
- try:
- self._with_share_group(proc)
- if flush:
- self._ns_flush()
- finally:
- #print "GL: Restoring previous context" ###
- if old_context:
- old_context.makeCurrentContext()
- else:
- NSOpenGLContext.clearCurrentContext()
diff --git a/PyGUI-2.5.3/build/lib/GUI/GLContexts_arb.py b/PyGUI-2.5.3/build/lib/GUI/GLContexts_arb.py
deleted file mode 100644
index 1b9d85a..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GLContexts_arb.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - GLContext - Win32
-#
-#------------------------------------------------------------------------------
-
-import OpenGL as gl
-from OpenGL import WGL as wgl
-import WGL
-from GUI.GGLContexts import GLContext as GGLContext
-
-class GLContext(GGLContext):
- # _win_context WGL context
- # _win_dblbuf Is double buffered
-
- def __init__(self, share_group, config, hdc, mode):
- print "GLContext: mode =", mode ###
- GGLContext.__init__(self, share_group)
- shared_context = self._get_shared_context()
- if shared_context:
- share_ctx = shared_context._win_context
- else:
- share_ctx = None
- ipf, act_attrs = config._win_supported_pixelformat(hdc, mode)
- if ipf is None:
- raise GLConfigError
- #config._check_win_pixelattrs(act_attrs, mode)
- print "GLContext: Setting pixel format", ipf, "for hdc", hdc ###
- WGL.SetPixelFormat(hdc, ipfs)
- ctx = wgl.wglCreateContext(hdc)
- if share_ctx:
- wgl.wglShareLists(share_ctx, ctx)
- self._win_context = ctx
- self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
-
- def destroy(self):
- wgl.wglDeleteContext(self._win_context)
-
- def _with_context(self, hdc, proc, flush = False):
- old_hdc = wgl.wglGetCurrentDC()
- old_ctx = wgl.wglGetCurrentContext()
- result = wgl.wglMakeCurrent(hdc, self._win_context)
- try:
- self._with_share_group(proc)
- if flush:
- if self._win_dblbuf:
- wgl.SwapBuffers(hdc)
- else:
- gl.glFlush()
- finally:
- wgl.wglMakeCurrent(old_hdc, old_ctx)
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/build/lib/GUI/GLContexts_nonarb.py b/PyGUI-2.5.3/build/lib/GUI/GLContexts_nonarb.py
deleted file mode 100644
index 3db0d41..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GLContexts_nonarb.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - GLContext - Win32
-#
-#------------------------------------------------------------------------------
-
-import OpenGL as gl
-from OpenGL import WGL as wgl
-from GUI.GGLContexts import GLContext as GGLContext
-
-class GLContext(GGLContext):
- # _win_dc Device context
- # _win_context WGL context
- # _win_dblbuf Is double buffered
-
- def __init__(self, share_group, config, hdc, mode):
- print "GLContext: mode =", mode ###
- GGLContext.__init__(self, share_group)
- shared_context = self._get_shared_context()
- if shared_context:
- share_ctx = shared_context._win_context
- else:
- share_ctx = None
- ipf, actpf = config._win_supported_pixelformat(hdc, mode)
- config._check_win_pixelformat(actpf, mode)
- print "GLContext: Setting pixel format", ipf, "for hdc", hdc ###
- wgl.SetPixelFormat(hdc, ipf, actpf)
- print "GLContext: Creating context for hdc", hdc ###
- ctx = wgl.wglCreateContext(hdc)
- if share_ctx:
- wgl.wglShareLists(share_ctx, ctx)
- self._win_context = ctx
- self._win_dblbuf = actpf.dwFlags & wgl.PFD_DOUBLEBUFFER != 0
-
- def destroy(self):
- wgl.wglDeleteContext(self._win_context)
-
- def _with_context(self, hdc, proc, flush = False):
- old_hdc = wgl.wglGetCurrentDC()
- old_ctx = wgl.wglGetCurrentContext()
- result = wgl.wglMakeCurrent(hdc, self._win_context)
- try:
- self._with_share_group(proc)
- if flush:
- if self._win_dblbuf:
- wgl.SwapBuffers(hdc)
- else:
- gl.glFlush()
- finally:
- wgl.wglMakeCurrent(old_hdc, old_ctx)
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/build/lib/GUI/GLDisplayLists.py b/PyGUI-2.5.3/build/lib/GUI/GLDisplayLists.py
deleted file mode 100644
index e6ed682..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GLDisplayLists.py
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# PyGUI - OpenGL Display Lists - Generic
-#
-
-from weakref import WeakKeyDictionary
-from OpenGL.GL import glGenLists, glNewList, glEndList, glCallList, \
- glDeleteLists, GL_COMPILE
-from GUI.Properties import Properties, overridable_property
-from GUI.GGLContexts import current_share_group
-
-#----------------------------------------------------------------------
-
-class DisplayListIdMap(WeakKeyDictionary):
-
- def __del__(self):
- # Delete any display lists that have been allocated for this map.
- #print "GL.DisplayListIdMap.__del__:", self ###
- def free_display_list():
- glDeleteLists(gl_id, 1)
- for share_group, gl_id in self.items():
- context = share_group._some_member()
- if context:
- #print "...freeing display list id", gl_id, "for", share_group, "using", context ###
- context.with_context(free_display_list)
-
-#----------------------------------------------------------------------
-
-class DisplayList(Properties):
- """This class encapsulates an OpenGL display list and maintains a
- representation of it for each OpenGL context with which it is used.
- Allocation and maintentance of display list numbers is handled
- automatically."""
- #
- # _gl_id ShareGroup -> int Mapping from OpenGL share group to
- # display list number
-
- setup = overridable_property('setup',
- """Function to set up the display list by making the necessary
- OpenGL calls, excluding glNewList and glEndList.""")
-
- def __init__(self, setup = None):
- self._gl_id = DisplayListIdMap()
- self._setup = setup
-
- def deallocate(self):
- """Deallocate any OpenGL resources that have been allocated for this
- display list in any context."""
- self._gl_id.__del__()
-
- def get_setup(self):
- return self._setup
-
- def set_setup(self, x):
- self._setup = x
-
- def call(self):
- """Calls the display list using glCallList(). If this display list
- has not previously been used with the current context, allocates
- a display list number and arranges for do_setup() to be called
- to compile a representation of the display list."""
- share_group = current_share_group()
- gl_id = self._gl_id.get(share_group)
- if gl_id is None:
- gl_id = glGenLists(1)
- #print "GLDisplayList: assigned id %d for %s in share group %s" % (
- # gl_id, self, share_group) ###
- self._gl_id[share_group] = gl_id
- call_when_not_compiling_display_list(lambda: self._compile(gl_id))
- glCallList(gl_id)
-
- def _compile(self, gl_id):
- global compiling_display_list
- compiling_display_list = True
- glNewList(gl_id, GL_COMPILE)
- try:
- self.do_setup()
- finally:
- glEndList()
- compiling_display_list = False
-
- def do_setup(self):
- """Make all the necessary OpenGL calls to compile the display list,
- except for glNewList() and glEndList() which will be called automatically
- before and after. The default implementation calls the 'setup' property."""
- setup = self._setup
- if setup:
- setup()
- else:
- raise NotImplementedError(
- "No setup function or do_setup method for GL.DisplayList")
-
-
-compiling_display_list = False
-pending_functions = []
-
-def call_when_not_compiling_display_list(func):
- #print "GLDisplayLists: entering call_when_not_compiling_display_list" ###
- if compiling_display_list:
- #print "GLDisplayLists: deferring", func ###
- pending_functions.append(func)
- else:
- #print "GLDisplayLists: immediately calling", func ###
- func()
- while pending_functions:
- #print "GLDisplayLists: calling deferred", func ###
- pending_functions.pop()()
- #print "GLDisplayLists: exiting call_when_not_compiling_display_list" ###
diff --git a/PyGUI-2.5.3/build/lib/GUI/GLShareGroups.py b/PyGUI-2.5.3/build/lib/GUI/GLShareGroups.py
deleted file mode 100644
index 8bb2cfc..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GLShareGroups.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# PyGUI - OpenGL Context Sharing - Generic
-#
-
-from weakref import WeakKeyDictionary
-
-class ShareGroup(object):
- """Object representing a shared texture and display list
- namespace for OpenGL contexts."""
-
- def __init__(self):
- self.contexts = WeakKeyDictionary()
-
- def __contains__(self, context):
- "Test whether a GLView or GLPixmap is a member of this share group."
- return context in self.contexts
-
- def __iter__(self):
- "Return an iterator over the members of this share group."
- return iter(self.contexts)
-
- def _add(self, context):
- self.contexts[context] = 1
-
- def _some_member(self, exclude = None):
- for member in self.contexts:
- if member is not exclude:
- return member
- return None
diff --git a/PyGUI-2.5.3/build/lib/GUI/GLTextures.py b/PyGUI-2.5.3/build/lib/GUI/GLTextures.py
deleted file mode 100644
index aa7c054..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GLTextures.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# PyGUI - OpenGL Textures - Cocoa
-#
-
-from AppKit import NSAlphaFirstBitmapFormat, NSFloatingPointSamplesBitmapFormat
-from OpenGL import GL
-from GUI.GGLTextures import Texture as GTexture
-
-class Texture(GTexture):
-
- def _gl_get_texture_data(self, image):
- ns_rep = image._ns_bitmap_image_rep
- if ns_rep.numberOfPlanes() <> 1:
- raise ValueError("Cannot use planar image data as GL texture")
- ns_format = ns_rep.bitmapFormat()
- if ns_format & NSAlphaFirstBitmapFormat:
- raise ValueError("Cannot use alpha-first image data as GL texture")
- fp_samples = ns_format & NSFloatingPointSamplesBitmapFormat <> 0
- bits_per_pixel = ns_rep.bitsPerPixel()
- bytes_per_row = ns_rep.bytesPerRow()
- samples_per_pixel = ns_rep.samplesPerPixel()
- if bits_per_pixel % samples_per_pixel <> 0:
- raise ValueError("Image data format not usable as GL texture")
- bits_per_sample = bits_per_pixel / samples_per_pixel
- try:
- gl_format = format_map[samples_per_pixel]
- gl_type = type_map[bits_per_sample, fp_samples]
- except KeyError:
- raise ValueError("Image data format not usable as GL texture")
- data = ns_rep.bitmapData()
- if 0:
- print "GUI.GLTexture._gl_get_texture_data_and_format:" ###
- print "format =", gl_format_map.get(gl_format) ###
- print "type =", gl_type_map.get(gl_type) ###
- print "data length =", len(data) ###
- print repr(data[:16]) ###
- GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
- return gl_format, gl_type, str(data)
-
-#------------------------------------------------------------------------------
-
-format_map = {
- 3: GL.GL_RGB,
- 4: GL.GL_RGBA,
- 1: GL.GL_LUMINANCE,
- 2: GL.GL_LUMINANCE_ALPHA,
-}
-
-type_map = {
- (8, 0): GL.GL_UNSIGNED_BYTE,
- (16, 0): GL.GL_UNSIGNED_SHORT,
- (32, 0): GL.GL_UNSIGNED_INT,
- (32, 1): GL.GL_FLOAT,
-}
-
-gl_format_map = {
- GL.GL_RGB: 'GL_RGB',
- GL.GL_RGBA: 'GL_RGBA',
- GL.GL_LUMINANCE: 'GL_LUMINANCE',
- GL.GL_LUMINANCE_ALPHA: 'GL_LUMINANCE_ALPHA',
-}
-
-gl_type_map = {
- GL.GL_UNSIGNED_BYTE: 'GL_UNSIGNED_BYTE',
- GL.GL_UNSIGNED_SHORT: 'GL_UNSIGNED_SHORT',
- GL.GL_UNSIGNED_INT: 'GL_UNSIGNED_INT',
- GL.GL_FLOAT: 'GL_FLOAT',
-}
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GL_arb.py b/PyGUI-2.5.3/build/lib/GUI/GL_arb.py
deleted file mode 100644
index 6a4d167..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GL_arb.py
+++ /dev/null
@@ -1,264 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - OpenGL - Win32
-#
-#------------------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui
-import GDIPlus as gdi
-import WGL
-from GUI.Components import win_none
-from GUI.OpenGL import WGL as wgl
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-
-win_style = wc.WS_VISIBLE | wc.WS_CLIPCHILDREN | wc.WS_CLIPSIBLINGS
-win_default_size = GGLView._default_size
-win_default_rect = (0, 0, win_default_size[0], win_default_size[1])
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- def _as_win_pixelattrs(self, mode):
- print "GLConfig._as_arb_pixelattrs: mode =", mode ###
- attrs = {}
- attrs[wgl.WGL_SUPPORT_OPENGL_ARB] = True
- if mode == 'screen' or mode == 'both':
- print "GLConfig: requesting screen drawing" ###
- attrs[wgl.WGL_DRAW_TO_WINDOW_ARB] = True
- if self._double_buffer:
- attrs[wgl.WGL_DOUBLE_BUFFER_ARB] = True
- if mode == 'pixmap' or mode == 'both':
- print "GLConfig: requesting pixmap drawing" ###
- attrs[wgl.WGL_DRAW_TO_PBUFFER_ARB] = True
- if self._stereo:
- attrs[wgl.WGL_STEREO_ARB] = True
- attrs[wgl.WGL_PIXEL_TYPE_ARB] = wgl.WGL_TYPE_RGBA_ARB
- bits = self._color_size
- attrs[wgl.WGL_RED_BITS_ARB] = bits
- attrs[wgl.WGL_GREEN_BITS_ARB] = bits
- attrs[wgl.WGL_BLUE_BITS_ARB] = bits
- if self._alpha:
- attrs[wgl.WGL_ALPHA_BITS_ARB] = self._alpha_size
- attrs[wgl.WGL_AUX_BUFFERS_ARB] = self._aux_buffers
- if self._depth_buffer:
- attrs[wgl.WGL_DEPTH_BITS_ARB] = self._depth_size
- if self._stencil_buffer:
- attrs[wgl.WGL_STENCIL_BITS_ARB] = self._stencil_size
- if self._accum_buffer:
- bits = self._accum_size
- attrs[wgl.WGL_ACCUM_RED_BITS_ARB] = bits
- attrs[wgl.WGL_ACCUM_GREEN_BITS_ARB] = bits
- attrs[wgl.WGL_ACCUM_BLUE_BITS_ARB] = bits
- return attrs
-
- def _from_win_pixelattrs(cls, attrs):
- self = cls.__new__(cls)
- self._double_buffer = attrs[wgl.WGL_DOUBLE_BUFFER_ARB]
- self._color_size = attrs[wgl.WGL_COLOR_BITS_ARB] // 3
- self._alpha_size = attrs[wgl.WGL_ALPHA_BITS_ARB]
- self._alpha = self._alpha_size > 0
- self._stereo = attrs[wgl.WGL_STEREO_ARB] #flags & wgl.PFD_STEREO != 0
- self._aux_buffers = attrs[wgl.WGL_AUX_BUFFERS_ARB] > 0
- self._depth_size = attrs[wgl.WGL_DEPTH_BITS_ARB]
- self._depth_buffer = self._depth_size > 0
- self._stencil_size = attrs[wgl.WGL_STENCIL_BITS_ARB]
- self._stencil_buffer = self._stencil_bits > 0
- self._accum_size = attrs[wgl.WGL_ACCUM_BITS_ARB] // 3
- self._accum_buffer = self._accum_size > 0
- self._multisample = False
- self._samples_per_pixel = 1
- return self
-
-# def _check_win_pixelattrs(self, attrs, mode):
-# if mode == 'screen' or mode == 'both':
-# if not attrs[wgl.WGL_DRAW_TO_WINDOW_ARB]:
-# raise GLConfigError("Rendering to screen not supported")
-# if mode == 'pixmap' or mode == 'both':
-# if not attrs[wgl.WGL_DRAW_TO_PBUFFER_ARB]:
-# raise GLConfigError("Rendering to pixmap not supported")
-# if self._alpha and attrs[wgl.WGL_ALPHA_BITS_ARB] == 0:
-# raise GLConfigError("Alpha channel not available")
-# if self._stereo and not attrs[wgl.WGL_STEREO_ARB]:
-# raise GLConfigError("Stereo buffer not available")
-# if self._aux_buffers and attrs]wgl.WGL_AUX_BUFFERS_ARB] == 0:
-# raise GLConfigError("Auxiliary buffers not available")
-# if self._depth_buffer and attrs[wgl.WGL_DEPTH_BITS_ARB] == 0:
-# raise GLConfigError("Depth buffer not available")
-# if self._stencil_buffer and attrs[wgl.WGL_STENCIL_BITS] == 0:
-# raise GLConfigError("Stencil buffer not available")
-# if self.accum_buffer and attrs[wgl.WGL_ACCUM_BITS] == 0:
-# raise GLConfigError("Accumulation buffer not available")
-
- _win_query_pixelattr_keys = [
- wgl.WGL_SUPPORT_OPENGL_ARB,
- wgl.WGL_DRAW_TO_WINDOW_ARB,
- wgl.WGL_DOUBLE_BUFFER_ARB,
- wgl.WGL_DRAW_TO_PBUFFER_ARB,
- wgl.WGL_STEREO_ARB,
- wgl.WGL_PIXEL_TYPE_ARB,
- wgl.WGL_COLOR_BITS_ARB,
- wgl.WGL_ALPHA_BITS_ARB,
- wgl.WGL_AUX_BUFFERS_ARB,
- wgl.WGL_DEPTH_BITS_ARB,
- wgl.WGL_STENCIL_BITS_ARB,
- wgl.WGL_ACCUM_BITS_ARB,
- ]
-
- def _win_supported_pixelformat(self, hdc, mode):
- req_attrs = self._as_win_pixelattrs(mode)
- print "GLConfig: Choosing pixel format for hdc", hdc ###
- print "Requested attributes:", req_attrs ###
- req_array = WGL.attr_array(req_attrs)
- print "Requested array:", req_array ###
- ipfs, nf = wgl.wglChoosePixelFormatEXT(hdc, req_array, None, 1)
- print "Pixel formats:", ipfs ###
- print "No. of formats:", nf ###
- if not ipfs:
- req_attrs[wgl.WGL_DOUBLE_BUFFER_ARB] = not self._double_buffer
- req_array = WGL.attr_array(req_attrs)
- ipfs, nf = wglChoosePixelFormatARB(hdc, req_array, None, 1)
- if not ipfs:
- return None, None
- print "GLConfig: Describing pixel format", ipf, "for hdc", hdc ###
- keys = _win_query_pixelattr_keys
- values = wglGetPixelFormatAttribivARB(hdc, ipf, 0, keys)
- print "Actual values:", values ###
- act_attrs = WGL.attr_dict(keys, values)
- print "Actual attrs:", act_attrs ###
- return ipfs[0], act_attrs
-
- def supported(self, mode = 'both'):
- dc = win_none.GetDC()
- hdc = dc.GetSafeHdc()
- ipf, act_attrs = self._win_supported_pixelformat(hdc, mode)
- win_none.ReleaseDC(dc)
- if ipf is None:
- return None
- return GLConfig._from_win_pixelattrs(act_attrs)
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- def __init__(self, config = None, share_group = None, **kwds):
- config = GLConfig._from_args(config, kwds)
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_style, win_default_rect,
- win_none, 0)
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- GLContext.__init__(self, share_group, config, hdc, 'screen')
- GGLView.__init__(self, _win = win, **kwds)
- self._with_context(hdc, self._init_context)
- win.ReleaseDC(dc)
-
- def destroy(self):
- GLContext.destroy(self)
- GGLView.destroy(self)
-
- def with_context(self, proc, flush = False):
- win = self._win
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- try:
- self._with_context(hdc, proc, flush)
- finally:
- win.ReleaseDC(dc)
-
- def OnPaint(self):
- #print "GLView.OnPaint" ###
- win = self._win
- dc, ps = win.BeginPaint()
- try:
- hdc = dc.GetSafeHdc()
- self._with_context(hdc, self.render, True)
- finally:
- win.EndPaint(ps)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
-#------------------------------------------------------------------------------
-
-#class GLPixmap(GGLPixmap):
-#
-# def __init__(self, width, height, config = None, share_group = None, **kwds):
-# print "GLPixmap:", width, height, kwds ###
-# config = GLConfig._from_args(config, kwds)
-# image = gdi.Bitmap(width, height)
-# self._win_image = image
-# graphics = gdi.Graphics.from_image(image)
-# self._win_graphics = graphics
-# hdc = graphics.GetHDC()
-# self._win_hdc = hdc
-# GLContext.__init__(self, share_group, config, hdc, 'pixmap')
-# self._with_context(hdc, self._init_context)
-# print "GLPixmap: done" ###
-#
-# def __del__(self):
-# graphics = self._win_graphics
-# graphics.ReleaseHDC(self._win_hdc)
-#
-# def with_context(self, proc, flush = False):
-# try:
-# self._with_context(self._hdc, proc, flush)
-# finally:
-# graphics.ReleaseHDC(hdc)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- print "GLPixmap:", width, height, kwds ###
- config = GLConfig._from_args(config, kwds)
- pyhdc = gui.CreateCompatibleDC(0)
- dc = ui.CreateDCFromHandle(pyhdc)
- hdc = dc.GetSafeHdc()
- hbm = gui.CreateCompatibleBitmap(hdc, width, height)
- bm = ui.CreateBitmapFromHandle(hbm)
- dc.SelectObject(bm)
- self._win_dc = dc
- self._win_hbm = hbm
- self._win_bm = bm
- GLContext.__init__(self, share_group, config, hdc, 'pixmap')
- self._with_context(hdc, self._init_context)
- print "GLPixmap: done" ###
-
- def with_context(self, proc, flush = False):
- hdc = self._win_dc.GetSafeHdc()
- self._with_context(hdc, proc, flush)
-
-#------------------------------------------------------------------------------
-
-def win_dump_pixelformat(pf):
- print "nSize =", pf.nSize
- print "nVersion =", pf.nVersion
- print "dwFlags = 0x%08x" % pf.dwFlags
- print "iPixelType =", pf.iPixelType
- print "cColorBits =", pf.cColorBits
- print "cRedBits =", pf.cRedBits
- print "cRedShift =", pf.cRedShift
- print "cGreenBits =", pf.cGreenBits
- print "cGreenShift =", pf.cGreenShift
- print "cBlueBits =", pf.cBlueBits
- print "cBlueShift =", pf.cBlueShift
- print "cAlphaBits =", pf.cAlphaBits
- print "cAlphaShift =", pf.cAlphaShift
- print "cAccumBits =", pf.cAccumBits
- print "cAccumRedBits =", pf.cAccumRedBits
- print "cAccumGreenBits =", pf.cAccumGreenBits
- print "cAccumBlueBits =", pf.cAccumBlueBits
- print "cDepthBits =", pf.cDepthBits
- print "cStencilBits =", pf.cStencilBits
- print "cAuxBuffers =", pf.cAuxBuffers
- print "iLayerType =", pf.iLayerType
- print "bReserved =", pf.bReserved
- print "dwLayerMask =", pf.dwLayerMask
- print "dwVisibleMask =", pf.dwVisibleMask
- print "dwDamageMask =", pf.dwDamageMask
diff --git a/PyGUI-2.5.3/build/lib/GUI/GL_nonarb.py b/PyGUI-2.5.3/build/lib/GUI/GL_nonarb.py
deleted file mode 100644
index 67ba5bc..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GL_nonarb.py
+++ /dev/null
@@ -1,258 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - OpenGL - Win32
-#
-#------------------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui
-import GUI.GDIPlus as gdi
-from GUI.Components import win_none
-from GUI.OpenGL import WGL as wgl
-from GUI.GGLViews import GLView as GGLView
-from GUI.GGLPixmaps import GLPixmap as GGLPixmap
-from GUI.GGLConfig import GLConfig as GGLConfig, GLConfigError
-from GUI.GLContexts import GLContext
-from GUI.GLTextures import Texture
-
-win_style = wc.WS_VISIBLE | wc.WS_CLIPCHILDREN | wc.WS_CLIPSIBLINGS
-win_default_size = GGLView._default_size
-win_default_rect = (0, 0, win_default_size[0], win_default_size[1])
-
-#------------------------------------------------------------------------------
-
-class GLConfig(GGLConfig):
-
- def _as_win_pixelformat(self, mode):
- print "GLConfig._as_win_pixelformat: mode =", mode ###
- pf = wgl.PIXELFORMATDESCRIPTOR()
- flags = wgl.PFD_SUPPORT_OPENGL
- if mode == 'screen' or mode == 'both':
- print "GLConfig: requesting screen drawing" ###
- flags |= wgl.PFD_DRAW_TO_WINDOW
- if self._double_buffer:
- flags |= wgl.PFD_DOUBLEBUFFER | wgl.PFD_SWAP_EXCHANGE
- else:
- flags |= wgl.PFD_DOUBLEBUFFER_DONTCARE
- if mode == 'pixmap' or mode == 'both':
- print "GLConfig: requesting pixmap drawing" ###
- flags |= wgl.PFD_DRAW_TO_BITMAP | wgl.PFD_SUPPORT_GDI
- if not self._depth_buffer:
- flags |= wgl.PFD_DEPTH_DONTCARE
- if self._stereo:
- flags |= wgl.PFD_STEREO
- else:
- flags |= wgl.PFD_STEREO_DONTCARE
- pf.dwFlags = flags & 0xffffffff
- pf.iPixelType = wgl.PFD_TYPE_RGBA
- #pf.cColorBits = 3 * self._color_size
- pf.cColorBits = 32 ###
- pf.cAlphaBits = 8 ###
- pf.cAlphaShift = 24 ###
- if self._alpha:
- pf.cAlphaBits = self._alpha_size
- pf.cAuxBuffers = self._aux_buffers
- if self._depth_buffer:
- pf.cDepthBits = self._depth_size
- if self._stencil_buffer:
- pf.cStencilBits = self._stencil_size
- if self._accum_buffer:
- pf.cAccumBits = 3 * self._accum_size
- pf.iLayerType = wgl.PFD_MAIN_PLANE
- return pf
-
- def _from_win_pixelformat(cls, pf):
- self = cls.__new__(cls)
- flags = pf.dwFlags
- self._double_buffer = flags & wgl.PFD_DOUBLEBUFFER != 0
- self._alpha = pf.cAlphaSize > 0
- self._color_size = pf.cColorBits
- self._alpha_size = pf.cAlphaSize
- self._stereo = flags & wgl.PFD_STEREO != 0
- self._aux_buffers = pf.cAuxBuffers
- self._depth_buffer = pf.cDepthBits > 0
- self._depth_size = pf.cDepthBits
- self._stencil_buffer = pf.cStencilBits > 0
- self._stencil_size = pf.cStencilBits
- self._accum_size = pf.cAccumBits
- self._accum_buffer = self._accum_size > 0
- self._multisample = False
- self._samples_per_pixel = 1
- return self
-
- def _check_win_pixelformat(self, pf, mode):
- flags = pf.dwFlags
- if mode == 'screen' or mode == 'both':
- if not flags & wgl.PFD_DRAW_TO_WINDOW:
- raise GLConfigError("Rendering to screen not supported")
- if mode == 'pixmap' or mode == 'both':
- if not flags & wgl.PFD_DRAW_TO_BITMAP:
- raise GLConfigError("Rendering to pixmap not supported")
- if self._alpha and pf.cAlphaBits == 0:
- raise GLConfigError("Alpha channel not available")
- if self._stereo and not flags & wgl.PFD_STEREO:
- raise GLConfigError("Stereo buffer not available")
- if self._aux_buffers and pf.cAuxBuffers == 0:
- raise GLConfigError("Auxiliary buffers not available")
- if self._depth_buffer and pf.cDepthBits == 0:
- raise GLConfigError("Depth buffer not available")
- if self._stencil_buffer and pf.cStencilBits == 0:
- raise GLConfigError("Stencil buffer not available")
- if self.accum_buffer and pf.cAccumBits == 0:
- raise GLConfigError("Accumulation buffer not available")
-
- def _win_supported_pixelformat(self, hdc, mode):
- reqpf = self._as_win_pixelformat(mode)
- print "GLConfig._win_supported_pixelformat" ###
- print "Requested format:" ###
- win_dump_pixelformat(reqpf) ###
- print "GLConfig: Choosing pixel format for hdc", hdc ###
- ipf = wgl.ChoosePixelFormat(hdc, reqpf)
- print "... result =", ipf ###
- actpf = wgl.PIXELFORMATDESCRIPTOR()
- print "GLConfig: Describing pixel format", ipf, "for hdc", hdc ###
- wgl.DescribePixelFormat(hdc, ipf, actpf.nSize, actpf)
- print "Actual format:" ###
- win_dump_pixelformat(actpf) ###
- return ipf, actpf
-
- def supported(self, mode = 'both'):
- dc = win_none.GetDC()
- hdc = dc.GetSafeHdc()
- ipf, actpf = self._win_supported_pixelformat(hdc, mode)
- win_none.ReleaseDC(dc)
- return GLConfig._from_win_pixelformat(actpf)
-
-#------------------------------------------------------------------------------
-
-class GLView(GGLView):
-
- def __init__(self, config = None, share_group = None, **kwds):
- config = GLConfig._from_args(config, kwds)
- win = ui.CreateWnd()
- win.CreateWindow(None, None, win_style, win_default_rect,
- win_none, 0)
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- GLContext.__init__(self, share_group, config, hdc, 'screen')
- GGLView.__init__(self, _win = win, **kwds)
- self._with_context(hdc, self._init_context)
- win.ReleaseDC(dc)
-
- def destroy(self):
- GLContext.destroy(self)
- GGLView.destroy(self)
-
- def with_context(self, proc, flush = False):
- win = self._win
- dc = win.GetDC()
- hdc = dc.GetSafeHdc()
- try:
- self._with_context(hdc, proc, flush)
- finally:
- win.ReleaseDC(dc)
-
- def OnPaint(self):
- #print "GLView.OnPaint" ###
- win = self._win
- dc, ps = win.BeginPaint()
- try:
- hdc = dc.GetSafeHdc()
- self._with_context(hdc, self.render, True)
- finally:
- win.EndPaint(ps)
-
- def _resized(self, delta):
- self.with_context(self._update_viewport)
-
-#------------------------------------------------------------------------------
-
-class GLPixmap(GGLPixmap):
-
- def __init__(self, width, height, config = None, share_group = None, **kwds):
- print "GLPixmap:", width, height, kwds ###
- config = GLConfig._from_args(config, kwds)
- image = gdi.Bitmap(width, height)
- self._win_image = image
- graphics = gdi.Graphics.from_image(image)
- self._win_graphics = graphics
- hdc = graphics.GetHDC()
- self._win_hdc = hdc
- GLContext.__init__(self, share_group, config, hdc, 'pixmap')
- self._with_context(hdc, self._init_context)
- print "GLPixmap: done" ###
-
- def __del__(self):
- graphics = self._win_graphics
- graphics.ReleaseHDC(self._win_hdc)
-
- def with_context(self, proc, flush = False):
- try:
- self._with_context(self._hdc, proc, flush)
- finally:
- graphics.ReleaseHDC(hdc)
-
-#------------------------------------------------------------------------------
-
-#class GLPixmap(GGLPixmap):
-#
-# def __init__(self, width, height, config = None, share_group = None, **kwds):
-# print "GLPixmap:", width, height, kwds ###
-# config = GLConfig._from_args(config, kwds)
-# dc0 = win_none.GetDC()
-# dc = dc0.CreateCompatibleDC(dc0)
-# bm = ui.CreateBitmap()
-# ###bm.CreateCompatibleBitmap(dc0, width, height)
-# bm.CreateCompatibleBitmap(dc0, 1, 1)
-# win_none.ReleaseDC(dc0)
-# dc.SelectObject(bm)
-# self._win_dc = dc
-# self._win_bm = bm
-# hdc = dc.GetSafeHdc()
-# win_dump_bitmap(bm) ###
-# GLContext.__init__(self, share_group, config, hdc, 'pixmap')
-# self._with_context(hdc, self._init_context)
-# print "GLPixmap: done" ###
-#
-# def with_context(self, proc, flush = False):
-# hdc = self._win_dc.GetSafeHdc()
-# self._with_context(hdc, proc, flush)
-
-#------------------------------------------------------------------------------
-
-def win_dump_pixelformat(pf):
- print "nSize =", pf.nSize
- print "nVersion =", pf.nVersion
- print "dwFlags = 0x%08x" % pf.dwFlags
- print "iPixelType =", pf.iPixelType
- print "cColorBits =", pf.cColorBits
- print "cRedBits =", pf.cRedBits
- print "cRedShift =", pf.cRedShift
- print "cGreenBits =", pf.cGreenBits
- print "cGreenShift =", pf.cGreenShift
- print "cBlueBits =", pf.cBlueBits
- print "cBlueShift =", pf.cBlueShift
- print "cAlphaBits =", pf.cAlphaBits
- print "cAlphaShift =", pf.cAlphaShift
- print "cAccumBits =", pf.cAccumBits
- print "cAccumRedBits =", pf.cAccumRedBits
- print "cAccumGreenBits =", pf.cAccumGreenBits
- print "cAccumBlueBits =", pf.cAccumBlueBits
- print "cDepthBits =", pf.cDepthBits
- print "cStencilBits =", pf.cStencilBits
- print "cAuxBuffers =", pf.cAuxBuffers
- print "iLayerType =", pf.iLayerType
- print "bReserved =", pf.bReserved
- print "dwLayerMask =", pf.dwLayerMask
- print "dwVisibleMask =", pf.dwVisibleMask
- print "dwDamageMask =", pf.dwDamageMask
-
-def win_dump_bitmap(bm):
- info = bm.GetInfo()
- print "bmType =", info['bmType']
- print "bmWidth =", info['bmWidth']
- print "bmHeight =", info['bmHeight']
- print "bmWidthBytes =", info['bmWidthBytes']
- print "bmPlanes =", info['bmPlanes']
- print "bmBitsPixel =", info['bmBitsPixel']
-
-
\ No newline at end of file
diff --git a/PyGUI-2.5.3/build/lib/GUI/GLabels.py b/PyGUI-2.5.3/build/lib/GUI/GLabels.py
deleted file mode 100644
index db84870..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GLabels.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Python GUI - Labels - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-
-class Label(Control):
- """A piece of static text for labelling items in a window."""
-
- _default_tab_stop = False
-
- text = overridable_property('text')
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GListButtons.py b/PyGUI-2.5.3/build/lib/GUI/GListButtons.py
deleted file mode 100644
index a811401..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GListButtons.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - Pop-up list control - Generic
-#
-#--------------------------------------------------------------
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control, application
-
-class ListButton(Control, Action):
- """A button that displays a value and provides a pop-up or
- pull-down list of choices."""
-
- titles = overridable_property('titles',
- "List of item title strings")
-
- values = overridable_property('values',
- "List of values corresponding to tiles, or None to use item index as value")
-
- def _extract_initial_items(self, kwds):
- titles = kwds.pop('titles', None) or []
- values = kwds.pop('values', None)
- return titles, values
-
- def get_titles(self):
- return self._titles
-
- def set_titles(self, x):
- self._titles = x
- self._update_items()
-
- def get_values(self):
- return self._values
-
- def set_values(self, x):
- self._values = x
-
- def get_value(self):
- i = self._get_selected_index()
- if i >= 0:
- values = self.values
- if values:
- return values[i]
- else:
- return i
-
- def set_value(self, value):
- values = self.values
- if values:
- try:
- i = values.index(value)
- except ValueError:
- i = -1
- else:
- if value is None:
- i = -1
- else:
- i = value
- self._set_selected_index(i)
-
- def do_action(self):
- try:
- Action.do_action(self)
- except:
- application().report_error()
diff --git a/PyGUI-2.5.3/build/lib/GUI/GMenus.py b/PyGUI-2.5.3/build/lib/GUI/GMenus.py
deleted file mode 100644
index 13fd7ef..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GMenus.py
+++ /dev/null
@@ -1,335 +0,0 @@
-#----------------------------------------------------------------------
-#
-# Python GUI - Menus - Generic
-#
-#----------------------------------------------------------------------
-
-from GUI import Globals
-from GUI.Properties import Properties, overridable_property
-
-#----------------------------------------------------------------------
-
-def search_list_for_key(items, char, shift, option):
- for i in xrange(len(items)-1, -1, -1):
- result = items[i]._search_for_key(char, shift, option)
- if result:
- return result
-
-#----------------------------------------------------------------------
-
-class Menu(Properties):
- """Pull-down or pop-up menu class.
-
- Menu(title, item_descriptors)
- constructs a menu with the given title and items. Each
- item_descriptor is of the form
-
- "-"
-
- for a separator,
-
- ("text/key", 'command_name')
-
- for a single menu item, or
-
- (["text/key", ...], 'command_name')
-
- for an indexed item group. An indexed group is a group
- of items sharing the same command name and distinguished
- by an integer index. Items can be added to and removed
- from the group dynamically, to implement e.g. a font
- menu or windows menu.
-
- The "key" part of the item descriptor (which is optional)
- specifies the keyboard equivalent. It should consist of
- a single character together with the following optional
- modifiers:
-
- ^ representing the Shift key
- @ representing the Alt or Option key
- """
-
- title = overridable_property('title', "Title string appearing in menu bar")
- special = overridable_property('special', "Menu appears at right end of menu bar")
-
- _flat_items = None
-
- def __init__(self, title, items, special = False, substitutions = {}, **kwds):
- self._title = title
- self._items = []
- self._special = special
- Properties.__init__(self, **kwds)
- self.extend(items, substitutions)
-
- def get_title(self):
- return self._title
-
- def get_special(self):
- return self._special
-
- def item_with_command(self, cmd):
- for item in self._items:
- if item._command_name == cmd:
- return item
- return None
-
- def append(self, item, substitutions = {}):
- items = self._items
- item = self._make_item(item, substitutions)
- if not (items and isinstance(item, MenuSeparator)
- and isinstance(items[-1], MenuSeparator)):
- items.append(item)
-
- def extend(self, items, substitutions = {}):
- for item in items:
- self.append(item, substitutions)
-
- def _make_item(self, item, substitutions):
- if isinstance(item, MenuItem):
- return item
- elif item == "-":
- return _menu_separator
- else:
- (text, cmd) = item
- if isinstance(text, basestring):
- return SingleMenuItem(text, cmd, substitutions)
- else:
- return MenuItemGroup(text, cmd)
-
- def _command_and_args_for_item(self, item_num):
- i = 1
- for item in self._items:
- n = item._num_subitems()
- if item_num < i + n:
- return item._command_and_args_for_subitem(item_num - i)
- i += n
- return '', ()
-
- def _update_platform_menu(self):
- # Called during menu setup after items have been enabled/checked.
- # Generic implementation rebuilds the whole menu from scratch.
- # Implementations may override this to be more elegant.
- self._rebuild_platform_menu()
-
- def _rebuild_platform_menu(self):
- self._clear_platform_menu()
- for item in self._items:
- item._add_to_platform_menu(self)
-
- def _search_for_key(self, char, shift, option):
- return search_list_for_key(self._items, char, shift, option)
-
- def _get_flat_items(self):
- flat = self._flat_items
- if flat is None:
- flat = []
- for item in self._items:
- item._collect_flat_items(flat)
- self._flat_items = flat
- return flat
-
- def _get_flat_item(self, i):
- return self._get_flat_items()[i]
-
-#----------------------------------------------------------------------
-
-class MenuItem(Properties):
- # Internal class representing a menu item, group or separator.
- #
- # _command_name string Internal command name
-
- def _num_subitems(self):
- return 1
-
- def _split_text(self, text):
- # Split menu text into label and key combination.
- if "/" in text:
- return text.split("/")
- else:
- return text, ""
-
- def _name(self):
- return self._label.replace("", Globals.application_name)
-
- def _collect_flat_items(self, result):
- result.append(self)
-
-#----------------------------------------------------------------------
-
-class MenuSeparator(MenuItem):
- # Internal class representing a menu separator.
-
- _command_name = ''
-
- def _add_to_platform_menu(self, menu):
- menu._add_separator_to_platform_menu()
-
- def _search_for_key(self, char, shift, option):
- pass
-
-#----------------------------------------------------------------------
-
-class SingleMenuItem(MenuItem):
- """Class representing a menu item.
-
- Properties:
- enabled boolean
- checked boolean
- """
-
- enabled = 0
- checked = 0
- _key = None
- _shift = 0
- _option = 0
- #_index = None
-
- def __init__(self, text, cmd, substitutions = {}):
- label1, keycomb1 = self._split_text(text)
- label2, keycomb2 = self._split_text(substitutions.get(cmd, ""))
- self._label = label2 or label1
- keycomb = keycomb2 or keycomb1
- for c in keycomb:
- if c == '^':
- self._shift = 1
- elif c == '@':
- self._option = 1
- else:
- self._key = c.upper()
- self._command_name = cmd
-
- def __str__(self):
- return "" % (
- self._label, self._key, self._shift, self._option, self.enabled)
-
- def _add_to_platform_menu(self, menu):
- menu._add_item_to_platform_menu(self, self._name(), self._command_name)
-
- def _command_and_args_for_subitem(self, i):
- return self._command_name, ()
-
- def _search_for_key(self, char, shift, option):
- if self._matches_key(char, shift, option):
- return self._command_name
-
- def _matches_key(self, char, shift, option):
- return self._key == char and self._shift == shift \
- and self._option == option and self.enabled
-
-#----------------------------------------------------------------------
-
-class MenuItemGroup(MenuItem):
- """Class representing a menu item group.
-
- Properties:
- enabled <- boolean Assigning to these changes the corresponding
- checked <- boolean property of all the group's items.
-
- Operators:
- group[index] -> MenuItem
-
- Methods:
- set_items(["text/key", ...])
- Replaces all the items in the group by the specified items.
- """
-
- enabled = overridable_property('enabled')
- checked = overridable_property('checked')
-
- def __init__(self, text_list, cmd):
- self.set_items(text_list)
- self._command_name = cmd
-
- def _num_subitems(self):
- return len(self._items)
-
- def _command_and_args_for_subitem(self, i):
- return self._command_name, (i,)
-
- def get_enabled(self):
- raise AttributeError("'enabled' property of MenuItemGroup is write-only")
-
- def set_enabled(self, state):
- for item in self._items:
- item.enabled = state
-
- def get_checked(self):
- raise AttributeError("'checked' property of MenuItemGroup is write-only")
-
- def set_checked(self, state):
- for item in self._items:
- item.checked = state
-
- def __getitem__(self, index):
- return self._items[index]
-
- def set_items(self, text_list):
- self._items = [SingleMenuItem(text, '') for text in text_list]
-
- def _add_to_platform_menu(self, menu):
- #for item in self._items:
- # item._add_to_platform_menu(menu)
- cmd = self._command_name
- for index, item in enumerate(self._items):
- menu._add_item_to_platform_menu(item, item._name(), cmd, index)
-
- def _search_for_key(self, char, shift, option):
- items = self._items
- for i in xrange(len(items)-1, -1, -1):
- if items[i]._matches_key(char, shift, option):
- return (self._command_name, i)
-
- def _collect_flat_items(self, result):
- for item in self._items:
- item._collect_flat_items(result)
-
-#----------------------------------------------------------------------
-
-_menu_separator = MenuSeparator()
-_dummy_menu_item = SingleMenuItem("", '')
-
-#----------------------------------------------------------------------
-
-class MenuState:
- """A MenuState object is used to enable/disable and check/uncheck
- menu items, and to add or remove items of indexed groups,
- during the menu setup phase of menu command handling.
-
- Each single menu item or item group appears as an attribute of
- the MenuState object, with the command name as the attribute name,
- allowing operations such as
-
- menu_state.copy_cmd.enabled = 1
- menu_state.font_cmd[current_font].checked = 1
-
- The command name may also be used as a mapping index.
-
- Operators:
- menu_state.command_name -> MenuItem
- menu_state['command_name'] -> MenuItem
- """
-
- def __init__(self, menu_list):
- mapping = {}
- for menu in menu_list:
- for item in menu._items:
- cmd = item._command_name
- if cmd:
- mapping[cmd] = item
- self._mapping = mapping
-
- def __getattr__(self, name):
- try:
- return self._mapping[name]
- except KeyError:
- if name.startswith("__"):
- raise AttributeError, name
- return _dummy_menu_item
-
- __getitem__ = __getattr__
-
- def reset(self):
- """Disable and uncheck all items."""
- for item in self._mapping.values():
- item.enabled = 0
- item.checked = None
diff --git a/PyGUI-2.5.3/build/lib/GUI/GMouseTrackers.py b/PyGUI-2.5.3/build/lib/GUI/GMouseTrackers.py
deleted file mode 100644
index 6644dba..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GMouseTrackers.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Python GUI - Mouse trackers - Generic
-#
-
-from GUI import application
-
-class MouseTracker(object):
- """Iterator used to track movements of the mouse following a mouse_down
- event in a Views. Each call to the next() method returns a mouse_drag
- event, except for the last one, which returns a mouse_up event."""
-
- def __init__(self, view):
- self._view = view
- self._finished = 0
-
- def __iter__(self):
- return self
-
- def next(self):
- if not self._finished:
- event = self._next_mouse_event()
- event.position = event.position_in(self._view)
- if event.kind == 'mouse_up':
- self._finished = 1
- return event
- else:
- raise StopIteration
diff --git a/PyGUI-2.5.3/build/lib/GUI/GPixmaps.py b/PyGUI-2.5.3/build/lib/GUI/GPixmaps.py
deleted file mode 100644
index af13c33..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GPixmaps.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Python GUI - Pixmap - Generic
-#
-
-from GUI import ImageBase
-
-class Pixmap(ImageBase):
- """A Pixmap is an offscreen area that can be used both as a
- destination for drawing and a source of image data for drawing
- in a View or another Pixmap.
-
- Constructor:
- Pixmap(width, height)
- """
-
- def with_canvas(self, proc):
- """Call the given procedure with a canvas suitable for drawing on
- this Pixmap. The canvas is valid only for the duration of the call,
- and should not be retained beyond it."""
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib/GUI/GPrinting.py b/PyGUI-2.5.3/build/lib/GUI/GPrinting.py
deleted file mode 100644
index 28b8ea2..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GPrinting.py
+++ /dev/null
@@ -1,167 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Generic
-#
-#------------------------------------------------------------------------------
-
-from __future__ import division
-from math import ceil
-import cPickle as pickle
-from GUI.Properties import overridable_property
-from GUI import application
-
-class PageSetup(object):
- """Holder of information specified by the "Page Setup" command."""
-
- paper_name = overridable_property('paper_name')
- paper_width = overridable_property('paper_width')
- paper_height = overridable_property('paper_height')
- left_margin = overridable_property('left_margin')
- top_margin = overridable_property('top_margin')
- right_margin = overridable_property('right_margin')
- bottom_margin = overridable_property('bottom_margin')
- orientation = overridable_property('orientation')
-
- paper_size = overridable_property('paper_size')
- margins = overridable_property('margins')
- page_width = overridable_property('page_width')
- page_height = overridable_property('page_height')
- page_size = overridable_property('page_size')
- page_rect = overridable_property('page_rect')
- printable_rect = overridable_property('printable_rect') # May not work
- printer_name = overridable_property('printer_name')
-
- _pickle_attributes = ['paper_name', 'paper_size', 'margins',
- 'printer_name', 'orientation']
-
- def __getstate__(self):
- state = {}
- for name in self._pickle_attributes:
- state[name] = getattr(self, name)
- return state
-
- def __setstate__(self, state):
- for name, value in state.iteritems():
- setattr(self, name, value)
-
- def from_string(s):
- """Restore a pickled PageSetup object from a string."""
- return pickle.loads(s)
-
- from_string = staticmethod(from_string)
-
- def to_string(self):
- """Pickle the PageSetup object and return it as a string."""
- return pickle.dumps(self, 2)
-
- def get_paper_size(self):
- return self.paper_width, self.paper_height
-
- def set_paper_size(self, x):
- self.paper_width, self.paper_height = x
-
- def get_margins(self):
- return self.left_margin, self.top_margin, self.right_margin, self.bottom_margin
-
- def set_margins(self, x):
- self.left_margin, self.top_margin, self.right_margin, self.bottom_margin = x
-
- def get_page_width(self):
- return self.paper_width - self.left_margin - self.right_margin
-
- def get_page_height(self):
- return self.paper_height - self.top_margin - self.bottom_margin
-
- def get_page_size(self):
- return (self.page_width, self.page_height)
-
- def get_page_rect(self):
- lm, tm, rm, bm = self.margins
- pw, ph = self.paper_size
- return (lm, tm, pw - rm, ph - bm)
-
-#------------------------------------------------------------------------------
-
-class Printable(object):
- """Mixin class for components implementing the "Print" command."""
-
- printable = overridable_property('printable', "Whether this component should handle the 'Print' command.")
- page_setup = overridable_property('page_setup', "The PageSetup object to use for printing.")
- print_title = overridable_property('print_title', "Title for print job.")
-
- _printable = True
-
- def get_printable(self):
- return self._printable
-
- def set_printable(self, x):
- self._printable = x
-
- def get_print_title(self):
- window = self.window
- if window:
- return window.title
- else:
- return ""
-
- def get_page_setup(self):
- result = None
- model = getattr(self, 'model', None)
- if model:
- result = getattr(model, 'page_setup', None)
- if not result:
- result = application().page_setup
- return result
-
- def setup_menus(self, m):
- if self.printable:
- m.print_cmd.enabled = True
-
- def print_cmd(self):
- if self.printable:
- page_setup = self.page_setup
- if page_setup:
- self.print_view(page_setup)
- else:
- self.pass_to_next_handler('print_cmd')
-
-#------------------------------------------------------------------------------
-
-class Paginator(object):
- """Used internally. A generic pagination algorithm for printing."""
-
- def __init__(self, view, page_setup):
- self.view = view
- extent_width, extent_height = view.get_print_extent()
- #paper_width, paper_height = page_setup.paper_size
- #lm, tm, rm, bm = page_setup.margins
- #page_width = int(paper_width - lm - rm)
- #page_height = int(paper_height - tm - bm)
- page_width, page_height = page_setup.page_size
- if page_width <= 0 or page_height <= 0:
- from AlertFunctions import stop_alert
- stop_alert("Margins are too large for the page size.")
- return
- self.extent_rect = (0, 0, extent_width, extent_height)
- self.page_width = page_width
- self.page_height = page_height
- self.left_margin = page_setup.left_margin
- self.top_margin = page_setup.top_margin
- self.pages_wide = int(ceil(extent_width / page_width))
- self.pages_high = int(ceil(extent_height / page_height))
- self.num_pages = self.pages_wide * self.pages_high
-
- def draw_page(self, canvas, page_num):
- row, col = divmod(page_num, self.pages_wide)
- view_left = col * self.page_width
- view_top = row * self.page_height
- view_right = view_left + self.page_width
- view_bottom = view_top + self.page_height
- view_rect = (view_left, view_top, view_right, view_bottom)
- dx = self.left_margin - view_left
- dy = self.top_margin - view_top
- canvas.translate(dx, dy)
- canvas.rectclip(self.extent_rect)
- canvas.rectclip(view_rect)
- canvas._printing = True
- self.view.draw(canvas, view_rect)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GRadioButtons.py b/PyGUI-2.5.3/build/lib/GUI/GRadioButtons.py
deleted file mode 100644
index 952f6d0..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GRadioButtons.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Python GUI - Radio buttons - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Control
-
-class RadioButton(Control):
- """RadioButtons are used in groups to represent a 1-of-N
- choice. A group of RadioButtons is coordinated by a
- RadioGroup object. The 'group' property indicates the
- RadioGroup to which it belongs, and the 'value' property
- is the value to which the RadioGroup's value is set
- when this RadioButton is selected."""
-
- group = overridable_property('group', """The RadioGroup to
- which this radio button belongs.""")
-
- value = overridable_property('value', """The value to which
- the associated radio group's 'value' property should be
- set when this radio button is selected.""")
-
- _group = None
- _value = None
-
- #
- # Properties
- #
-
- def get_group(self):
- return self._group
-
- def set_group(self, new_group):
- old_group = self._group
- if new_group is not old_group:
- if old_group:
- old_group._remove_item(self)
- self._group = new_group
- if new_group:
- new_group._add_item(self)
-
- def get_value(self):
- return self._value
-
- def set_value(self, new_value):
- old_value = self._value
- if new_value != old_value:
- self._value = new_value
- self._value_changed()
-
- def _value_changed(self):
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib/GUI/GRadioGroups.py b/PyGUI-2.5.3/build/lib/GUI/GRadioGroups.py
deleted file mode 100644
index a6fd792..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GRadioGroups.py
+++ /dev/null
@@ -1,87 +0,0 @@
-#
-# Python GUI - Radio groups - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-from GUI.Actions import Action
-
-class RadioGroup(Properties, Action):
- """A RadioGroup coordinates a group of RadioButtons.
- It has a 'value' property which is equal to the value
- of the currently selected RadioButton. It may be given
- an action procedure to execute when its value changes.
-
- Operations:
- iter(group)
- Returns an iterator over the items of the group.
- """
-
- value = overridable_property('value', """The value of the currently
- selected radio button.""")
-
- _items = None
- _value = None
-
- def __init__(self, items = [], **kwds):
- Properties.__init__(self, **kwds)
- self._items = []
- self.add_items(items)
-
- #
- # Operations
- #
-
- def __iter__(self):
- return iter(self._items)
-
- #
- # Properties
- #
-
- def get_value(self):
- return self._value
-
- def set_value(self, x):
- if self._value <> x:
- self._value = x
- self._value_changed()
- self.do_action()
-
- #
- # Adding and removing items
- #
-
- def add_items(self, items):
- "Add a sequence of RadioButtons to this group."
- for item in items:
- self.add_item(item)
-
- def add_item(self, item):
- "Add a RadioButton to this group."
- item.group = self
-
- def remove_items(self, items):
- "Remove a sequence of RadioButtons from this group."
- for item in items:
- item.group = None
-
- def remove_item(self, item):
- "Remove a RadioButton from this group."
- item.group = None
-
- def _add_item(self, item):
- self._items.append(item)
- self._item_added(item)
-
- def _remove_item(self, item):
- self._items.remove(item)
- self._item_removed(item)
-
- def _item_added(self, item):
- raise NotImplementedError
-
- def _item_removed(self, item):
- raise NotImplementedError
-
- def _value_changed(self):
- raise NotImplementedError
diff --git a/PyGUI-2.5.3/build/lib/GUI/GScrollableViews.py b/PyGUI-2.5.3/build/lib/GUI/GScrollableViews.py
deleted file mode 100644
index a23f442..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GScrollableViews.py
+++ /dev/null
@@ -1,168 +0,0 @@
-#
-# Python GUI - Scrollable Views - Generic
-#
-
-from GUI.Geometry import rect_sized, add_pt, sub_pt
-from GUI.Properties import overridable_property
-from GUI.Geometry import sect_rect
-from GUI import DrawableContainer
-
-default_extent = (300, 300)
-default_line_scroll_amount = (16, 16)
-default_scrolling = 'hv'
-
-class ScrollableView(DrawableContainer):
- """A ScrollableView is a 2D drawing area having its own coordinate
- system and clipping area, with support for scrolling."""
-
- scrolling = overridable_property('scrolling',
- "String containing 'h' for horizontal and 'v' for vertical scrolling.")
-
- hscrolling = overridable_property('hscrolling',
- "True if horizontal scrolling is enabled.")
-
- vscrolling = overridable_property('vscrolling',
- "True if vertical scrolling is enabled.")
-
- extent = overridable_property('extent',
- "Size of scrollable area in local coordinates.")
-
- scroll_offset = overridable_property('scroll_offset',
- "Current scrolling position.")
-
- line_scroll_amount = overridable_property('line_scroll_amount',
- "Tuple specifying horizontal and vertical line scrolling increments.")
-
- background_color = overridable_property('background_color',
- "Color with which to fill areas outside the extent, or None")
-
- #scroll_bars = overridable_property('scroll_bars',
- # "Attached ScrollBar instances.")
- #
- ## _scroll_bars [ScrollBar]
-
- def set(self, **kwds):
- if 'scrolling' in kwds:
- self.scrolling = kwds.pop('scrolling')
- DrawableContainer.set(self, **kwds)
-
- def get_scrolling(self):
- chars = []
- if self.hscrolling:
- chars.append('h')
- if self.vscrolling:
- chars.append('v')
- return ''.join(chars)
-
- def set_scrolling(self, value):
- self.hscrolling = 'h' in value
- self.vscrolling = 'v' in value
-
- def viewed_rect(self):
- """Return the rectangle in local coordinates bounding the currently
- visible part of the extent."""
- return rect_sized(self.scroll_offset, self.size)
-
- def get_print_extent(self):
- return self.extent
-
- def get_background_color(self):
- return self._background_color
-
- def set_background_color(self, x):
- self._background_color = x
- self.invalidate()
-
- #
- # Coordinate transformation
- #
-
- def local_to_container_offset(self):
- return sub_pt(self.position, self.scroll_offset)
-
- #
- # Scrolling
- #
-
- def h_line_scroll_amount(self):
- """Return the horizontal line scroll increment."""
- return self.line_scroll_amount[0]
-
- def v_line_scroll_amount(self):
- """Return the vertical line scroll increment."""
- return self.line_scroll_amount[1]
-
- def h_page_scroll_amount(self):
- """Return the horizontal page scroll increment."""
- return self.width - self.h_line_scroll_amount()
-
- def v_page_scroll_amount(self):
- """Return the vertical page scroll increment."""
- return self.height - self.v_line_scroll_amount()
-
- def scroll_by(self, dx, dy):
- """Scroll by the given amount horizontally and vertically."""
- self.scroll_offset = add_pt(self.scroll_offset, (dx, dy))
-
- def scroll_line_left(self):
- """Called by horizontal scroll bar to scroll left by one line."""
- self.scroll_by(-self.h_line_scroll_amount(), 0)
-
- def scroll_line_right(self):
- """Called by horizontal scroll bar to scroll right by one line."""
- self.scroll_by(self.h_line_scroll_amount(), 0)
-
- def scroll_line_up(self):
- """Called by vertical scroll bar to scroll up by one line."""
- self.scroll_by(0, -self.v_line_scroll_amount())
-
- def scroll_line_down(self):
- """Called by vertical scroll bar to scroll down by one line."""
- self.scroll_by(0, self.v_line_scroll_amount())
-
- def scroll_page_left(self):
- """Called by horizontal scroll bar to scroll left by one page."""
- self.scroll_by(-self.h_page_scroll_amount(), 0)
-
- def scroll_page_right(self):
- """Called by horizontal scroll bar to scroll right by one page."""
- self.scroll_by(self.h_page_scroll_amount(), 0)
-
- def scroll_page_up(self):
- """Called by vertical scroll bar to scroll up by one page."""
- self.scroll_by(0, -self.v_page_scroll_amount())
-
- def scroll_page_down(self):
- """Called by vertical scroll bar to scroll down by one page."""
- self.scroll_by(0, self.v_page_scroll_amount())
-
- #
- # Background drawing
- #
-
- def _draw_background(self, canvas, clip_rect):
- # If the view has a background color, uses it to fill the parts of the
- # clip_rect that are outside the view's extent and returns the remaining
- # rectangle. Otherwise, returns the clip_rect unchanged.
- color = self._background_color
- if color:
- vl, vt, vr, vb = clip_rect
- ew, eh = self.extent
- if vr > ew or vb > eh:
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: old backcolor =", canvas.backcolor ###
- canvas.gsave()
- canvas.backcolor = color
- if ew < vr:
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: erasing", (ew, vt, vr, vb) ###
- canvas.erase_rect((ew, vt, vr, vb))
- if eh < vb:
- if getattr(self, "_debug_bg", False): ###
- print "ScrollableView: erasing", (vl, eh, ew, vb) ###
- canvas.erase_rect((vl, eh, ew, vb))
- canvas.grestore()
- #if getattr(self, "_debug_bg", False): ###
- # print "ScrollableView: restored backcolor =", canvas.backcolor ###
- return sect_rect(clip_rect, (0, 0, ew, eh))
- return clip_rect
diff --git a/PyGUI-2.5.3/build/lib/GUI/GSliders.py b/PyGUI-2.5.3/build/lib/GUI/GSliders.py
deleted file mode 100644
index a1a9822..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GSliders.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#
-# Python GUI - Slider - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import Action
-from GUI import Control
-
-class Slider(Control, Action):
- """A control for entering a value by moving a knob along a scale.
-
- Constructor:
- Slider(orient)
- where orient = 'h' for horizontal or 'v' for vertical.
- """
-
- _default_length = 100
-
- value = overridable_property('value', "The current value of the control")
- min_value = overridable_property('min_value', "Minimum value of the control")
- max_value = overridable_property('max_value', "Maximum value of the control")
- range = overridable_property('range', "Tuple (min_value, max_value)")
- ticks = overridable_property('ticks', "Number of tick marks")
- discrete = overridable_property('discrete', "Whether to constrain value to ticks")
- live = overridable_property('live', "Whether to invoke action continuously while dragging")
-
- def get_range(self):
- return (self.min_value, self.max_value)
-
- def set_range(self, x):
- self.min_value = x[0]
- self.max_value = x[1]
diff --git a/PyGUI-2.5.3/build/lib/GUI/GStdMenus.py b/PyGUI-2.5.3/build/lib/GUI/GStdMenus.py
deleted file mode 100644
index 005984a..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GStdMenus.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#-------------------------------------------------------------------------------
-#
-# PyGUI - Standard Menus - Generic
-#
-#-------------------------------------------------------------------------------
-
-from GUI.Compatibility import set
-from GUI import Menu
-from GUI import MenuList
-
-#-------------------------------------------------------------------------------
-
-class CommandSet(set):
- """A set of menu command names.
-
- Constructors:
- CommandSet(string)
- CommandSet(sequence of strings)
-
- Operations:
- string in CommandSet
- CommandSet + x
- CommmandSet - x
- x + CommandSet
- x - CommandSet
- CommandSet += x
- CommandSet -= x
- where x is a CommandSet, a string or a sequence of strings
- """
-
- def __init__(self, arg = None):
- if arg:
- if isinstance(arg, basestring):
- arg = [arg]
- set.__init__(self, arg)
-
- def __or__(self, other):
- return set.__or__(self, as_command_set(other))
-
- __ror__ = __add__ = __radd__ = __or__
-
- def __ior__(self, other):
- return set.__ior__(self, as_command_set(other))
-
- __iadd__ = __ior__
-
- def __sub__(self, other):
- return set.__sub__(self, as_command_set(other))
-
- def __rsub__(self, other):
- return as_command_set(other) - self
-
- def __isub__(self, other):
- return set.__isub__(self, as_command_set(other))
-
-#-------------------------------------------------------------------------------
-
-def as_command_set(x):
- if not isinstance(x, CommandSet):
- if isinstance(x, basestring):
- x = [x]
- x = CommandSet(x)
- return x
-
-def filter_menu_items(items, include):
- result = []
- sep = False
- for item in items:
- if item == "-":
- sep = True
- elif item[1] in include:
- if sep:
- result.append("-")
- sep = False
- result.append(item)
- return result
-
-def build_menus(spec_list, substitutions = {}, include = None, exclude = None):
- if include is None:
- include = sum(default_includes)
- include = include + sum(always_include)
- if exclude is not None:
- include = include - exclude
- menus = []
- for title, items, special in spec_list:
- items = filter_menu_items(items, include)
- if items:
- menus.append(Menu(title, items, special = special, substitutions = substitutions))
- return MenuList(menus)
-
-#-------------------------------------------------------------------------------
-
-fundamental_cmds = CommandSet(['quit_cmd'])
-help_cmds = CommandSet(['about_cmd', 'help_cmd'])
-pref_cmds = CommandSet(['preferences_cmd'])
-file_cmds = CommandSet(['new_cmd', 'open_cmd', 'close_cmd', 'save_cmd', 'save_as_cmd', 'revert_cmd'])
-print_cmds = CommandSet(['page_setup_cmd', 'print_cmd'])
-edit_cmds = CommandSet(['undo_cmd', 'redo_cmd', 'cut_cmd', 'copy_cmd', 'paste_cmd', 'clear_cmd', 'select_all_cmd'])
-
-always_include = [fundamental_cmds, edit_cmds]
-default_includes = [help_cmds, pref_cmds, file_cmds, print_cmds]
-
-#-------------------------------------------------------------------------------
-
-if __name__ == "__main__":
- s1 = CommandSet('a')
- print "s1 =", s1
- s2 = CommandSet(['a', 'b'])
- print "s2 =", s2
- s3 = s2 + 'c'
- print "s3 =", s3
- s4 = 'd' + s3
- print "s4 =", s4
- s5 = s4 - 'b'
- print "s5 =", s5
- s6 = ['a', 'b', 'c', 'd', 'e', 'f'] - s5
- print "s6 =", s6
diff --git a/PyGUI-2.5.3/build/lib/GUI/GTasks.py b/PyGUI-2.5.3/build/lib/GUI/GTasks.py
deleted file mode 100644
index 2582c77..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GTasks.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# PyGUI - Tasks - Generic
-#
-
-from GUI.Properties import Properties, overridable_property
-
-class Task(Properties):
- """A Task represents an action to be performed after a specified
- time interval, either once or repeatedly.
-
- Constructor:
- Task(proc, interval, repeat = False, start = True)
- Creates a task to call the given proc, which should be
- a callable object of no arguments, after the specified
- interval in seconds from the time the task is scheduled.
- If repeat is true, the task will be automatically re-scheduled
- each time the proc is called. If start is true, the task will be
- automatically scheduled upon creation; otherwise the start()
- method must be called to schedule the task.
- """
-
- interval = overridable_property('interval', "Time in seconds between firings")
- repeat = overridable_property('repeat', "Whether to fire repeatedly or once only")
-
- def __del__(self):
- self.stop()
-
- scheduled = overridable_property('scheduled',
- "True if the task is currently scheduled. Read-only.")
-
- def start(self):
- """Schedule the task if it is not already scheduled."""
- raise NotImplementedError("GUI.Task.start")
-
- def stop(self):
- """Unschedules the task if it is currently scheduled."""
- raise NotImplementedError("GUI.Task.stop")
diff --git a/PyGUI-2.5.3/build/lib/GUI/GTextEditors.py b/PyGUI-2.5.3/build/lib/GUI/GTextEditors.py
deleted file mode 100644
index 58ec145..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GTextEditors.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Python GUI - Text Editor - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI import Component
-from GUI import EditCmdHandler
-from GUI.Printing import Printable
-
-class TextEditor(Component, EditCmdHandler, Printable):
- """A component for editing substantial amounts of text. The text is
- kept internally to the component and cannot be shared between views."""
-
- text = overridable_property('text', "The contents as a string.")
- text_length = overridable_property('text_length', "Number of characters in the text.")
- selection = overridable_property('selection', "Range of text selected.")
- font = overridable_property('font')
- tab_spacing = overridable_property('tab_spacing', "Distance between tab stops")
-
- def setup_menus(self, m):
- Component.setup_menus(self, m)
- EditCmdHandler.setup_menus(self, m)
- Printable.setup_menus(self, m)
-
- def key_down(self, e):
- if e.key == 'enter':
- self.pass_to_next_handler('key_down', e)
- else:
- Component.key_down(self, e)
-
- def print_view(self, page_setup):
- from TextEditorPrinting import TextEditorPrintView
- view = TextEditorPrintView(self, page_setup)
- view.print_view(page_setup)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GTextFields.py b/PyGUI-2.5.3/build/lib/GUI/GTextFields.py
deleted file mode 100644
index 8314920..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GTextFields.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# Python GUI - Text fields - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Actions import ActionBase, action_property
-from GUI import application
-from GUI import Control
-from GUI import EditCmdHandler
-
-class TextField(Control, ActionBase, EditCmdHandler):
- """A control for entering and editing small amounts of text."""
-
- text = overridable_property('text')
- selection = overridable_property('selection', "Range of text selected.")
- multiline = overridable_property('multiline', "Multiple text lines allowed.")
- password = overridable_property('password', "Display characters obfuscated.")
- enter_action = action_property('enter_action', "Action to be performed "
- "when the Return or Enter key is pressed.")
- escape_action = action_property('escape_action', "Action to be performed "
- "when the Escape key is pressed.")
-
- _may_be_password = True
-
- #_tabbable = True
- _default_tab_stop = True
- _user_tab_stop_override = False
- _enter_action = 'do_default_action'
- _escape_action = 'do_cancel_action'
-
- _intercept_tab_key = True
-
- def __init__(self, **kwds):
- self._multiline = kwds.pop('multiline')
- Control.__init__(self, **kwds)
-
- def get_multiline(self):
- return self._multiline
-
- def key_down(self, event):
- #print "GTextField.key_down for", self ###
- c = event.char
- if c == '\r':
- if event.key == 'enter' or not self._multiline:
- self.do_enter_action()
- return
- if c == '\x1b':
- self.do_escape_action()
- return
- if c == '\t':
- if self._intercept_tab_key:
- self.pass_event_to_next_handler(event)
- return
- Control.key_down(self, event)
-
- def setup_menus(self, m):
- Control.setup_menus(self, m)
- EditCmdHandler.setup_menus(self, m)
-
- def do_enter_action(self):
- self.do_named_action('enter_action')
-
- def do_escape_action(self):
- self.do_named_action('escape_action')
-
- def get_text_length(self):
- # Implementations can override this if they have a more
- # efficient way of getting the text length.
- return len(self.text)
-
- def get_value(self):
- return self.text
-
- def set_value(self, x):
- self.text = x
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GUtils.py b/PyGUI-2.5.3/build/lib/GUI/GUtils.py
deleted file mode 100644
index 768eab7..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GUtils.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Utilities - Generic
-#
-#--------------------------------------------------------------------------
-
-def splitdict(src, *names, **defaults):
- result = {}
- for name in names:
- if name in src:
- result[name] = src.pop(name)
- for name, default in defaults.iteritems():
- result[name] = src.pop(name, default)
- return result
diff --git a/PyGUI-2.5.3/build/lib/GUI/GViewBases.py b/PyGUI-2.5.3/build/lib/GUI/GViewBases.py
deleted file mode 100644
index 0274840..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GViewBases.py
+++ /dev/null
@@ -1,135 +0,0 @@
-#
-# Python GUI - View Base - Generic
-#
-
-from GUI.Properties import overridable_property
-
-class ViewBase(object):
- """ViewBase is an abstract base class for user-defined views.
- It provides facilities for handling mouse and keyboard events
- and associating the view with one or more models, and default
- behaviour for responding to changes in the models."""
-
- models = overridable_property('models',
- "List of Models being observed. Do not modify directly.")
-
- model = overridable_property('model',
- "Convenience property for views which observe only one Model.")
-
- cursor = overridable_property('cursor',
- "The cursor to display over the view.")
-
- # _models [Model]
-
- _cursor = None
-
- def __init__(self):
- self._models = []
-
- def destroy(self):
- #print "GViewBase.destroy:", self ###
- for m in self._models[:]:
- #print "GViewBase.destroy: removing model", m ###
- self.remove_model(m)
-
- def setup_menus(self, m):
- pass
-
- #
- # Getting properties
- #
-
- def get_model(self):
- models = self._models
- if models:
- return self._models[0]
- else:
- return None
-
- def get_models(self):
- return self._models
-
- #
- # Setting properties
- #
-
- def set_model(self, new_model):
- models = self._models
- if not (len(models) == 1 and models[0] == new_model):
- for old_model in models[:]:
- self.remove_model(old_model)
- if new_model:
- self.add_model(new_model)
-
- #
- # Model association
- #
-
- def add_model(self, model):
- """Add the given Model to the set of models being observed."""
- if model not in self._models:
- self._models.append(model)
- model.add_view(self)
- self.model_added(model)
-
- def remove_model(self, model):
- """Remove the given Model from the set of models being observed."""
- if model in self._models:
- self._models.remove(model)
- model.remove_view(self)
- self.model_removed(model)
-
- def model_added(self, model):
- """Called after a model has been added to the view."""
- pass
-
- def model_removed(self, model):
- """Called after a model has been removed from the view."""
- pass
-
- #
- # Input event handling
- #
-
- def track_mouse(self):
- """Following a mouse_down event, returns an iterator which can be used
- to track the movements of the mouse until the mouse is released.
- Each call to the iterator's next() method returns a mouse_drag
- event, except for the last one, which returns a mouse_up event."""
- raise NotImplementedError
-
- def targeted(self):
- """Called when the component becomes the target within its Window."""
- pass
-
- def untargeted(self):
- """Called when the component ceases to be the target within its Window."""
- pass
-
- #
- # Cursors
- #
-
- def get_cursor(self, x):
- return self._cursor
-
- def set_cursor(self, x):
- self._cursor = x
- self._cursor_changed()
-
- #
- # Callbacks
- #
-
- def model_changed(self, model, *args, **kwds):
- """Default method called by the attached Model's notify_views
- method. Default is to invalidate the whole view."""
- self.invalidate()
-
- def model_destroyed(self, model):
- """Called when an attached model is destroyed. Default is to
- destroy the window containing this view."""
- win = self.window
- if win:
- win.destroy()
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GViews.py b/PyGUI-2.5.3/build/lib/GUI/GViews.py
deleted file mode 100644
index 87e136c..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GViews.py
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Python GUI - Views - Generic
-#
-
-from GUI.Properties import overridable_property
-from GUI.Geometry import add_pt, sub_pt, rect_sized
-from GUI import DrawableContainer
-
-class View(DrawableContainer):
- """A View is a 2D drawing area having its own coordinate
- system and clipping area."""
-
- _default_size = (100, 100)
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/GWindows.py b/PyGUI-2.5.3/build/lib/GUI/GWindows.py
deleted file mode 100644
index cf03f79..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GWindows.py
+++ /dev/null
@@ -1,257 +0,0 @@
-#
-# Python GUI - Windows - Generic
-#
-
-import Exceptions
-from GUI.Properties import overridable_property
-from GUI import Container
-from GUI import application
-
-class Window(Container):
- """Top-level Container."""
-
- menus = overridable_property('menus', "Menus to be available when this window is active.")
- document = overridable_property('document', "Document with which this window is associated.")
- title = overridable_property('title', "Title of the window.")
- auto_position = overridable_property('auto_position', "Whether to position automatically when first shown.")
- target = overridable_property('target', "Current target for key events and menu messages.")
- tab_chain = overridable_property('tab_chain', "List of subcomponents in tabbing order.")
- visible = overridable_property('visible', "Whether the window is currently shown.")
-
- keeps_document_open = True
-
- _default_width = 200
- _default_height = 200
- _modal_styles = ('modal_dialog', 'alert')
- _dialog_styles = ('nonmodal_dialog', 'modal_dialog', 'alert')
-
- _menus = []
- _document = None
- _closable = 0
- _auto_position = True
- _tab_chain = None
-
- def __init__(self, style = 'standard', closable = None, **kwds):
- if closable is None:
- raise Exceptions.InternalError(
- "'closable' parameter unspecified in call to generic Window.__init__")
- Container.__init__(self, **kwds)
- self._style = style
- self._dialog_style = style.find('dialog') >= 0
- self._closable = closable
- application()._add_window(self)
-
- def destroy(self):
- """Detaches the window from document and application and removes it
- from the screen."""
- self.set_document(None)
- application()._remove_window(self)
- Container.destroy(self)
-
- #
- # Message handling
- #
-
- def next_handler(self):
- if self._document:
- return self._document
- else:
- return application()
-
- def dispatch(self, message, *args):
- self.target.handle(message, *args)
-
- #
- # Menus
- #
-
- def get_menus(self):
- return self._menus
-
- def set_menus(self, x):
- self._menus = x
-
- #
- # Document association
- #
-
- def get_document(self):
- return self._document
-
- def set_document(self, x):
- if self._document != x:
- if self._document:
- self._document._windows.remove(self)
- self._document = x
- if self._document:
- self._document._windows.append(self)
- self.update_title()
-
- #
- # Title
- #
-
- def update_title(self):
- """Update the window's title after a change in its document's title."""
- doc = self._document
- if doc:
- self.set_title(doc.title)
-
- #
- # Showing and Positioning
- #
-
- def get_auto_position(self):
- return self._auto_position
-
- def set_auto_position(self, v):
- self._auto_position = v
-
- def center(self):
- """Position the window in the centre of the screen."""
- print "GWindow.center" ###
- sl, st, sr, sb = self._screen_rect()
- w, h = self.size
- l = (sr - sl - w) // 2
- t = (sb - st - h) // 2
- self.position = (l, t)
-
- def centre(self):
- self.center()
-
- def show(self):
- if self._auto_position:
- if self._style == 'standard':
- self._stagger()
- else:
- self.center()
- self._auto_position = False
- self._show()
-
- def _stagger(self):
- pass
-
- def _show(self):
- self.visible = True
-
- def hide(self):
- self.visible = False
-
- #
- # Menu commands
- #
-
- def setup_menus(self, m):
- Container.setup_menus(self, m)
- app = application()
- if self._closable:
- m.close_cmd.enabled = 1
-
- def close_cmd(self):
- """If this window is the only window belonging to a document
- whose keeps_document_open attribute is true, then close the
- document, else destroy the window."""
-# app = application()
-# if not app._may_close_a_window():
-# #print "GWindow.close_cmd: Quitting the application" ###
-# app.quit_cmd()
-# else:
- doc = self._document
- n = 0
- if doc:
- for win in doc._windows:
- if win is not self and win.keeps_document_open:
- n += 1
- if doc and n == 0:
- doc.close_cmd()
- else:
- self.destroy()
-
- #
- # Tabbing
- #
-
- def get_tab_chain(self):
- chain = self._tab_chain
- if chain is None:
- chain = []
- self._build_tab_chain(chain)
- self._tab_chain = chain
- #print "Window.get_tab_chain:", chain ###
- return chain
-
- def _invalidate_tab_chain(self):
- self._tab_chain = None
-
- def _tab_to_next(self):
- self._tab_to(1)
-
- def _tab_to_prev(self):
- self._tab_to(-1)
-
- def _tab_to(self, direction):
- #print "GWindow._tab_to:", direction ###
- chain = self.tab_chain
- if chain:
- old_target = application().target
- new_target = None
- n = len(chain)
- try:
- i = chain.index(old_target)
- except ValueError:
- if direction > 0:
- i = -1
- else:
- i = n
- k = n
- while k:
- k -= 1
- i = (i + direction) % n
- comp = chain[i]
- if comp._is_targetable():
- new_target = comp
- break
- if new_target:
- if old_target:
- old_target._tab_out()
- new_target._tab_in()
-
- def key_down(self, event):
- #print "GWindow.key_down:", event ###
- if self._generic_tabbing and event.char == '\t':
- #print "GWindow.key_down: doing generic tabbing" ###
- if event.shift:
- self._tab_to_prev()
- else:
- self._tab_to_next()
- else:
- Container.key_down(self, event)
-
-# def _default_key_event(self, event):
-# #print "GWindow._default_key_event" ###
-# self.pass_event_to_next_handler(event)
-
- #
- # Other
- #
-
- def get_window(self):
- return self
-
- def first_dispatcher(self):
- return self
-
- def _document_needs_saving(self, state):
- pass
-
- def modal_event_loop(self):
- """Loop reading and handling events for the given window until
- exit_event_loop() is called. Interaction with other windows is prevented
- (although enabled application-wide menu commands can be used)."""
- # Implementations can override this together with exit_modal_event_loop()
- # to implement modal event loops in a different way.
- application()._event_loop(self)
-
- def exit_modal_event_loop(self):
- # Cause the current call to modal_event_loop() to exit.
- application()._exit_event_loop()
diff --git a/PyGUI-2.5.3/build/lib/GUI/Geometry.py b/PyGUI-2.5.3/build/lib/GUI/Geometry.py
deleted file mode 100644
index 3a9bd54..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Geometry.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Python GUI - Points and Rectangles - PyObjC
-#
-
-from Foundation import NSMakeRect
-from GUI.GGeometry import *
-
-def rect_to_ns_rect((l, t, r, b)):
- return NSMakeRect(l, t, r - l, b - t)
-
-def ns_rect_to_rect(((l, t), (w, h))):
- return (l, t, l + w, t + h)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Globals.py b/PyGUI-2.5.3/build/lib/GUI/Globals.py
deleted file mode 100644
index e822339..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Globals.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Generic - Global variables and functions
-#
-#--------------------------------------------------------------------
-
-import os, sys
-
-_main_file_name = os.path.basename(sys.argv[0])
-application_name = os.path.splitext(_main_file_name)[0]
-
-_application = None
-
-def application():
- """Returns the global Application object. Creates a default one if needed."""
- global _application
- print _application
- if not _application:
- from GUI import Application
- _application = Application()
- return _application
-
-def run():
- """Runs the application, retaining control until the application is quit."""
- application().run()
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/Grid.py b/PyGUI-2.5.3/build/lib/GUI/Grid.py
deleted file mode 100644
index 67bdb92..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Grid.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Grid layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Grid(Frame):
-
- def __init__(self, items, row_spacing = 5, column_spacing = 10,
- align = 'l', equalize = '', expand_row = None, expand_column = None,
- padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- num_rows = len(items)
- num_cols = max([len(row) for row in items])
- col_widths = [0] * num_cols
- row_heights = [0] * num_rows
- for i, row in enumerate(items):
- for j, item in enumerate(row):
- if item:
- row_heights[i] = max(row_heights[i], item.height)
- col_widths[j] = max(col_widths[j], item.width)
- tot_width = 0
- row_top = 0
- row_gap = 0
- vanchor = 't'
- for i, row in enumerate(items):
- row_height = row_heights[i]
- row_top += row_gap
- col_left = 0
- col_gap = 0
- hanchor = 'l'
- if i == expand_row:
- vanchor = 'tb'
- for j, item in enumerate(row):
- col_width = col_widths[j]
- col_left += col_gap
- if item:
- if 'l' in align:
- x = 0
- elif 'r' in align:
- x = col_width - item.width
- else:
- x = (col_width - item.width) // 2
- if 't' in align:
- y = 0
- elif 'b' in align:
- y = row_height - item.height
- else:
- y = (row_height - item.height) // 2
- item.position = (hpad + col_left + x, vpad + row_top + y)
- if j == expand_column:
- item.anchor = 'lr' + vanchor
- else:
- item.anchor = hanchor + vanchor
- self.add(item)
- if j == expand_column:
- hanchor = 'r'
- col_left += col_width
- col_gap = column_spacing
- tot_width = max(tot_width, col_left)
- if i == expand_row:
- vanchor = 'b'
- row_top += row_height
- row_gap = row_spacing
- tot_height = row_top
- self.size = (tot_width + 2 * hpad, tot_height + 2 * vpad)
- self.set(**kwds)
-
-export(Grid)
diff --git a/PyGUI-2.5.3/build/lib/GUI/GridView.py b/PyGUI-2.5.3/build/lib/GUI/GridView.py
deleted file mode 100644
index c201f90..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/GridView.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Grid View - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import ScrollableView, rgb
-
-class GridView(ScrollableView):
- """A ScrollableView consisting of a grid of equal-sized cells."""
-
- num_columns = overridable_property('num_columns',
- "Width of the view in columns")
-
- num_rows = overridable_property('num_rows',
- "Height of the view in rows")
-
- cell_size = overridable_property('cell_size',
- "Size of each cell")
-
- backcolor = overridable_property('backcolor',
- "Background fill colour")
-
- _cell_size = (32, 32)
- _num_rows = 0
- _num_columns = 0
- _backcolor = rgb(1, 1, 1, 1)
-
- def __init__(self, num_rows, num_columns, cell_size, **kwds):
- ScrollableView.__init__(self)
- self._num_rows = num_rows
- self._num_columns = num_columns
- self._cell_size = cell_size
- self._update_extent()
- self.set(**kwds)
-
- def get_cell_size(self):
- return self._cell_size
-
- def set_cell_size(self, x):
- self._cell_size = x
- self._update_extent()
-
- def get_num_rows(self):
- return self._num_rows
-
- def set_num_rows(self, x):
- self._num_rows = x
- self._update_extent()
-
- def get_num_columns(self):
- return self._num_columns
-
- def set_num_columns(self, x):
- self._num_columns = x
- self._update_extent()
-
- def _update_extent(self):
- cw, ch = self._cell_size
- nr = self._num_rows
- nc = self._num_columns
- self.extent = (cw * nc, ch * nr)
-
- def cell_rect(self, row, col):
- w, h = self._cell_size
- l = col * w
- t = row * h
- return (l, t, l + w, t + h)
-
- def get_backcolor(self):
- return self._backcolor
-
- def set_backcolor(self, x):
- self._backcolor = x
-
- def cell_containing_point(self, p):
- x, y = p
- cw, ch = self.cell_size
- return (int(y // ch), int(x // cw))
-
- def draw(self, canvas, update_rect):
- canvas.backcolor = self.backcolor
- canvas.erase_rect(update_rect)
- ul, ut, ur, ub = update_rect
- nr = self._num_rows
- nc = self._num_columns
- cw, ch = self.cell_size
- row0 = max(0, int(ut // ch))
- row1 = min(nr, int(ub // ch) + 1)
- col0 = max(0, int(ul // cw))
- col1 = min(nc, int(ur // cw) + 1)
- row_range = xrange(row0, row1)
- col_range = xrange(col0, col1)
- for row in row_range:
- for col in col_range:
- rect = self.cell_rect(row, col)
- self.draw_cell(canvas, row, col, rect)
-
- def draw_cell(self, canvas, row, col, rect):
- """Should draw the cell at the given row and colum inside the given rect."""
- pass
-
- def mouse_down(self, event):
- row, col = self.cell_containing_point(event.position)
- nr = self._num_rows
- nc = self._num_columns
- if 0 <= row < nr and 0 <= col < nc:
- self.click_cell(row, col, event)
-
- def click_cell(self, row, col, event):
- """Called when a mouse_down event has occured in the indicated cell."""
- pass
-
-export(GridView)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Image.py b/PyGUI-2.5.3/build/lib/GUI/Image.py
deleted file mode 100644
index a40ab1e..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Image.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Python GUI - Images - Cocoa
-#
-
-from Foundation import NSData
-from AppKit import NSImage, NSBitmapImageRep
-from GUI import export
-from GUI.GImages import Image as GImage
-
-class Image(GImage):
- # _ns_bitmap_image_rep
-
- def _init_from_file(self, file):
- #ns_image = NSImage.alloc().initWithContentsOfFile_(file)
- #if not ns_image:
- ns_data = NSData.dataWithContentsOfFile_(file)
- if not ns_data:
- raise EnvironmentError("Unable to read image file: %s" % file)
- ns_rep = NSBitmapImageRep.imageRepWithData_(ns_data)
- if not ns_rep:
- raise ValueError("Unrecognised image file type: %s" % file)
- ns_rep.setSize_((ns_rep.pixelsWide(), ns_rep.pixelsHigh()))
- self._init_from_ns_rep(ns_rep)
-
- def _init_from_ns_rep(self, ns_rep):
- ns_image = NSImage.alloc().init()
- ns_image.addRepresentation_(ns_rep)
- self._ns_bitmap_image_rep = ns_rep
- self._init_with_ns_image(ns_image, flipped = True)
-
-export(Image)
diff --git a/PyGUI-2.5.3/build/lib/GUI/ImageBase.py b/PyGUI-2.5.3/build/lib/GUI/ImageBase.py
deleted file mode 100644
index 4405648..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ImageBase.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#
-# Python GUI - Common Image/Pixmap code - Cocoa
-#
-
-from AppKit import NSCompositeSourceOver
-from GUI import export
-from GUI.Geometry import rect_to_ns_rect
-from GUI.GImageBases import ImageBase as GImageBase
-
-class ImageBase(GImageBase):
- #
- # Code common to Image, Pixmap and GLPixmap classes
-
- def _init_with_ns_image(self, ns_image, flipped):
- ns_image.setFlipped_(flipped)
- self._ns_image = ns_image
-
- def get_size(self):
- return tuple(self._ns_image.size())
-
- def get_width(self):
- return self._ns_image.size()[0]
-
- def get_height(self):
- return self._ns_image.size()[1]
-
- def draw(self, canvas, src_rect, dst_rect):
- ns_src_rect = rect_to_ns_rect(src_rect)
- ns_dst_rect = rect_to_ns_rect(dst_rect)
- self._ns_image.drawInRect_fromRect_operation_fraction_(
- ns_dst_rect, ns_src_rect, NSCompositeSourceOver, 1.0)
-
-export(ImageBase)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Label.py b/PyGUI-2.5.3/build/lib/GUI/Label.py
deleted file mode 100644
index 082f69e..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Label.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Python GUI - Labels - PyObjC
-#
-
-import AppKit
-from AppKit import NSView
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.TextFieldBasedControls import TextFieldBasedControl
-from GUI.GLabels import Label as GLabel
-
-ns_label_autoresizing_mask = (AppKit.NSViewWidthSizable
- | AppKit.NSViewHeightSizable)
-
-class Label(TextFieldBasedControl, GLabel):
-
- def __init__(self, text = "New Label", font = system_font, **kwds):
- ns_textfield = self._create_ns_textfield(editable = False,
- text = text, font = font)
-# width, height = ns_textfield.frame().size
-# ns_view = NSView.alloc().initWithFrame_(((0, 0), (width, height + 5)))
-# ns_view.addSubview_(ns_textfield)
-# ns_textfield.setFrameOrigin_((0, 2))
-# ns_textfield.setAutoresizingMask_(ns_label_autoresizing_mask)
- ns_view = ns_textfield
- GLabel.__init__(self, _ns_view = ns_view, _ns_inner_view = ns_textfield, **kwds)
-
-export(Label)
diff --git a/PyGUI-2.5.3/build/lib/GUI/LayoutUtils.py b/PyGUI-2.5.3/build/lib/GUI/LayoutUtils.py
deleted file mode 100644
index 6b49662..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/LayoutUtils.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Utilities for use by layout components - Generic
-#
-#---------------------------------------------------------------------------
-
-def equalize_components(items, flags):
- if items:
- if 'w' in flags:
- width = max([item.width for item in items if item])
- for item in items:
- if item:
- item.width = width
- if 'h' in flags:
- height = max([item.height for item in items if item])
- for item in items:
- if item:
- item.height = height
diff --git a/PyGUI-2.5.3/build/lib/GUI/ListButton.py b/PyGUI-2.5.3/build/lib/GUI/ListButton.py
deleted file mode 100644
index 671a8a8..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ListButton.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - Pop-up list control - Cocoa
-#
-#--------------------------------------------------------------
-
-from AppKit import NSPopUpButton
-from GUI import export
-from GUI.GListButtons import ListButton as GListButton
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, \
- ns_set_action, ns_size_to_fit
-
-class ListButton(GListButton):
-
- _ns_handle_mouse = True
-
- def __init__(self, **kwds):
- titles, values = self._extract_initial_items(kwds)
- self._titles = titles
- self._values = values
- frame = ((0, 0), (100, 20))
- ns = PyGUI_NSPopUpButton.alloc().initWithFrame_pullsDown_(frame, False)
- ns.pygui_component = self
- ns_set_action(ns, 'doAction:')
- self._ns_update_items(ns)
- ns_size_to_fit(ns)
- GListButton.__init__(self, _ns_view = ns, **kwds)
-
- def _update_items(self):
- self._ns_update_items(self._ns_view)
-
- def _ns_update_items(self, ns):
- ns.removeAllItems()
- ns.addItemsWithTitles_(self._titles)
-
- def _get_selected_index(self):
- return self._ns_view.indexOfSelectedItem()
-
- def _set_selected_index(self, i):
- self._ns_view.selectItemAtIndex_(i)
-
-#--------------------------------------------------------------
-
-class PyGUI_NSPopUpButton(NSPopUpButton, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(ListButton)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Menu.py b/PyGUI-2.5.3/build/lib/GUI/Menu.py
deleted file mode 100644
index 6a82454..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Menu.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Python GUI - Menus - PyObjC
-#
-
-from AppKit import NSMenu, NSMenuItem, NSOnState, \
- NSCommandKeyMask, NSShiftKeyMask, NSAlternateKeyMask
-from GUI import export
-from GUI import Globals
-from GUI.GMenus import Menu as GMenu, MenuItem
-
-#_ns_standard_actions = {
-# 'undo_cmd': 'undo:',
-# 'redo_cmd': 'redo:',
-# 'cut_cmd': 'cut:',
-# 'copy_cmd': 'copy:',
-# 'paste_cmd': 'paste:',
-# 'clear_cmd': 'clear:',
-# 'select_all_cmd': 'selectAll:',
-#}
-
-class Menu(GMenu):
-
- def __init__(self, title, items, **kwds):
- #print "Menu: creating with items", items ###
- GMenu.__init__(self, title, items, **kwds)
- ns_menu = NSMenu.alloc().initWithTitle_(title)
- ns_menu.setAutoenablesItems_(False)
- ns_menu.setDelegate_(Globals.ns_application)
- self._ns_menu = ns_menu
-
- def _clear_platform_menu(self):
- ns_menu = self._ns_menu
- n = ns_menu.numberOfItems()
- while n:
- n -= 1
- ns_menu.removeItemAtIndex_(n)
-
- def _add_separator_to_platform_menu(self):
- ns_item = NSMenuItem.separatorItem()
- self._ns_menu.addItem_(ns_item)
-
- def _add_item_to_platform_menu(self, item, name, command = None, index = None):
- key = item._key or ""
- if item._shift:
- key = key.upper()
- else:
- key = key.lower()
- ns_item = NSMenuItem.alloc()
- #ns_action = _ns_standard_actions.get(command, 'menuSelection:')
- ns_action = 'menuSelection:'
- ns_item.initWithTitle_action_keyEquivalent_(name, ns_action, key)
- ns_item.setEnabled_(item.enabled)
- if item.checked:
- ns_item.setState_(NSOnState)
- ns_modifiers = NSCommandKeyMask
- if item._option:
- ns_modifiers |= NSAlternateKeyMask
- ns_item.setKeyEquivalentModifierMask_(ns_modifiers)
- ns_item.setRepresentedObject_(command)
- if index is not None:
- ns_tag = index
- else:
- ns_tag = -1
- ns_item.setTag_(ns_tag)
- self._ns_menu.addItem_(ns_item)
-
-export(Menu)
diff --git a/PyGUI-2.5.3/build/lib/GUI/MenuList.py b/PyGUI-2.5.3/build/lib/GUI/MenuList.py
deleted file mode 100644
index 16892c3..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/MenuList.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Python GUI - Menu Lists - Generic
-#
-
-from GUI import export
-
-class MenuList(list):
- """A MenuList is a sequence of Menus with methods for finding
- menus and menu items by command."""
-
- def menu_with_command(self, cmd):
- """Returns the menu containing the given command, or None
- if there is no such menu in the list."""
- for menu in self:
- if menu.item_with_command(cmd):
- return menu
- return None
-
- def item_with_command(self, cmd):
- """Returns the menu item having the given command, or None
- if there is no such item."""
- for menu in self:
- item = menu.item_with_command(cmd)
- if item:
- return item
- return None
-
-export(MenuList)
diff --git a/PyGUI-2.5.3/build/lib/GUI/MessageHandler.py b/PyGUI-2.5.3/build/lib/GUI/MessageHandler.py
deleted file mode 100644
index 2407b90..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/MessageHandler.py
+++ /dev/null
@@ -1,140 +0,0 @@
-#
-# Python GUI - Message handlers - Generic
-#
-
-from GUI import export
-
-class MessageHandler(object):
- """A MessageHandler is an object which can form part of the
- message handling hierarchy. This hierarchy is used to handle
- keyboard events, menu commands, and action messages generated
- by buttons or other components.
-
- At any given moment, one of the application's windows is the
- 'target window' for messages. Within the target window, some
- component is designated as the 'target object', or just 'target'.
-
- Messages are initially delivered to the target object, and
- passed up the hierarchy using the handle() method. At each step,
- if the object has a method with the same name as the message, it
- is called with the message's arguments. Otherwise the message is
- passed on to the object determined by the next_handler() method.
- Usually this is the object's container, but need not be.
-
- The become_target() method is used to make a component the target
- within its window. The targeted() and untargeted() methods are
- called to notify a component when it has become or ceased to be
- the target. The is_target() method can be used to test whether a
- component is currently the target."""
-
- #----- Event handling -----
-
- def handle_event_here(self, event):
- """Send an event message to this object, ignoring the event if
- there is no method to handle it."""
- self.handle_here(event.kind, event)
-
- def handle_event(self, event):
- """Send an event message up the message path until a method
- is found to handle it."""
- self.handle(event.kind, event)
-
- #----- Message handling -----
-
- def handle_here(self, message, *args):
- """If there is a method with the same name as the message, call
- it with the given args. Otherwise, ignore the message."""
- method = getattr(self, message, None)
- if method:
- method(*args)
-
- def handle(self, message, *args):
- """If there is a method with the same name as the message, call
- it with the given args. Otherwise, pass the message up to the
- next handler."""
- #print "MessageHandler: handling", message, "for", self ###
- method = getattr(self, message, None)
- if method:
- #print "MessageHandler: calling method from", method.im_func.func_code.co_filename ###
- method(*args)
- else:
- #print "MessageHandler: passing to next handler" ###
- self.pass_to_next_handler(message, *args)
-
- def pass_event_to_next_handler(self, event):
- """Pass the given event on to the next handler, if any."""
- self.pass_to_next_handler(event.kind, event)
-
- def pass_to_next_handler(self, message, *args):
- """Pass the given message on to the next handler, if any."""
- next = self.next_handler()
- if next:
- next.handle(message, *args)
-
- def next_handler(self):
- """Return the object, if any, to which messages not handled
- by this object should be passed on."""
- return None
-
- #----- Default handlers and callbacks -----
-
- def _setup_menus(self, m):
- self.pass_to_next_handler('_setup_menus', m)
- #print "MessageHandler._setup_menus: calling setup_menus for", self ###
- self.setup_menus(m)
-
- def setup_menus(self, m):
- """Called before a menu is pulled down, to allow the Component to
- enable menu commands that it responds to."""
- pass
-
- _pass_key_events_to_platform = False
-
- def _default_key_event(self, event):
- #print "MessageHandler._default_key_event for", self ###
- #print "...originator =", event._originator ###
- if event._originator is self and self._pass_key_events_to_platform:
- #print "...passing to platform" ###
- event._not_handled = True
- else:
- self.pass_event_to_next_handler(event)
-
- def _default_mouse_event(self, event):
- event._not_handled = True
-
- def _event_custom_handled(self, event):
- # Give custom event handlers of this component a chance to handle
- # the event. If it reaches a default event method of this component,
- # the event is not passed to the next handler and false is returned.
- # If it is handled by an overridden method or explicitly passed to
- # the next handler, true is returned.
- event._originator = self
- self.handle_event(event)
- return not event._not_handled
-
- def key_down(self, event):
- #print "MessageHandler.key_down for", self ###
- self._default_key_event(event)
-
- def key_up(self, event):
- self._default_key_event(event)
-
- def mouse_down(self, event):
- self._default_mouse_event(event)
-
- def mouse_drag(self, event):
- self._default_mouse_event(event)
-
- def mouse_up(self, event):
- self._default_mouse_event(event)
-
- def mouse_move(self, event):
- self._default_mouse_event(event)
-
- def mouse_enter(self, event):
- self._default_mouse_event(event)
-
- def mouse_leave(self, event):
- self._default_mouse_event(event)
-
-export(MessageHandler)
diff --git a/PyGUI-2.5.3/build/lib/GUI/ModalDialog.py b/PyGUI-2.5.3/build/lib/GUI/ModalDialog.py
deleted file mode 100644
index c0d7922..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ModalDialog.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Python GUI - Modal Dialogs - Generic
-#
-
-from GUI import application, export
-from GUI import Dialog
-
-class ModalDialog(Dialog):
-
- def __init__(self, style = 'modal_dialog', **kwds):
- Dialog.__init__(self, style = style, **kwds)
-
- def present(self):
- self._result = None
- self._dismissed = 0
- self.show()
- app = application()
- try:
- while not self._dismissed:
- self.modal_event_loop()
- finally:
- self.hide()
- return self._result
-
- def dismiss(self, result = 0):
- self._result = result
- self._dismissed = 1
- self.exit_modal_event_loop()
-
- def close_cmd(self):
- self.dismiss()
-
- def next_handler(self):
- return None
-
- def ok(self):
- self.dismiss(True)
-
- def cancel(self):
- self.dismiss(False)
-
-export(ModalDialog)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Model.py b/PyGUI-2.5.3/build/lib/GUI/Model.py
deleted file mode 100644
index ff69691..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Model.py
+++ /dev/null
@@ -1,126 +0,0 @@
-#
-# Python GUI - Models - Generic
-#
-
-import weakref
-from GUI import export
-from GUI.Properties import Properties, overridable_property
-
-# List of views for a model is kept separately so that models
-# can be pickled without fear of accidentally trying to pickle
-# the user interface.
-
-_model_views = weakref.WeakKeyDictionary() # {Model: [object]}
-
-class Model(Properties):
- """A Model represents an application object which can appear in a View.
- Each Model can have any number of Views attached to it. When a Model is
- changed, it should notify all of its Views so that they can update
- themselves.
-
- The 'parent' attribute of a Model is treated specially when pickling.
- If it refers to an object having a 'pickle_as_parent_model' attribute
- whose value is false, the 'parent' attribute is not pickled. This allows
- a Model to have a Document as a parent without the Document being pickled
- along with the Model.
- """
-
- views = overridable_property('views',
- "List of objects observing this model. Do not modify directly.")
-
- parent = None # Model
-
- def __init__(self, parent = None, **kwds):
- Properties.__init__(self, **kwds)
- if parent:
- self.parent = parent
-
- def destroy(self):
- """All views currently observing this model are removed, and their
- 'model_destroyed' methods, if any, are called with the model as
- an argument."""
- for view in self.views[:]:
- self.remove_view(view)
- self._call_if_present(view, 'model_destroyed', self)
-
- #
- # Properties
- #
-
- def get_views(self):
- views = _model_views.get(self)
- if views is None:
- views = []
- _model_views[self] = views
- return views
-
- #
- # Pickling behaviour
- #
-
- def __getstate__(self):
- state = self.__dict__
- parent = self.parent
- if not getattr(parent, 'pickle_as_parent_model', True):
- state = state.copy()
- del state['parent']
- return state
-
- def __setstate__(self, state):
- self.__dict__.update(state)
-
- #
- # Adding and removing views
- #
-
- def add_view(self, view):
- """Add the given object as an observer of this model. The view will
- typically be a View subclass, but need not be. If the view is not
- already an observer of this model and defines an 'add_model' method,
- this method is called with the model as an argument."""
- views = self.views
- if view not in views:
- views.append(view)
- self._call_if_present(view, 'add_model', self)
-
- def remove_view(self, view):
- """If the given object is currently an observer of this model, it
- is removed, and if it defines a 'remove_model' method, this method
- is called with the model as an argument."""
- views = self.views
- if view in views:
- views.remove(view)
- self._call_if_present(view, 'remove_model', self)
-
- #
- # View notification
- #
-
- def notify_views(self, message = 'model_changed', *args, **kwds):
- """For each observer, if the observer defines a method with the name of the
- message, call it with the given arguments. Otherwise, if it defines a
- method called 'model_changed', call it with no arguments. Otherwise,
- do nothing for that observer."""
- for view in self.views:
- if not self._call_if_present(view, message, self, *args, **kwds):
- self._call_if_present(view, 'model_changed', self)
-
- def _call_if_present(self, obj, method_name, *args, **kwds):
- method = getattr(obj, method_name, None)
- if method:
- method(*args, **kwds)
- return 1
- else:
- return 0
-
- #
- # Marking as changed
- #
-
- def changed(self):
- "Mark the containing Document as changed."
- parent = self.parent
- if parent:
- parent.changed()
-
-export(Model)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Numerical.py b/PyGUI-2.5.3/build/lib/GUI/Numerical.py
deleted file mode 100644
index f53f3ba..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Numerical.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - NumPy interface - Cocoa
-#
-#--------------------------------------------------------------
-
-from AppKit import NSBitmapImageRep, \
- NSAlphaNonpremultipliedBitmapFormat, NSCalibratedRGBColorSpace
-from GUI import Image
-
-# HACK! PyObjC 2.3 incorrectly wraps the following method, so we change the
-# signature and pass the bitmap data in using ctypes.
-NSBitmapImageRep.__dict__['initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_'].signature = '@52@0:4^v8i12i16i20i24c28c32@36I40i44i48'
-import ctypes
-planes_t = ctypes.c_void_p * 5
-
-def image_from_ndarray(array, format, size = None):
- """
- Creates an Image from a numpy ndarray object. The format
- may be 'RGB' or 'RGBA'. If a size is specified, the array
- will be implicitly reshaped to that size, otherwise the size
- is inferred from the first two dimensions of the array.
- """
- if array.itemsize <> 1:
- raise ValueError("Color component size must be 1 byte")
- if size is not None:
- width, height = size
- data_size = array.size
- pixel_size = data_size // (width * height)
- if pixel_size <> len(format):
- raise ValueError("Array has wrong shape for specified size and format")
- else:
- height, width, pixel_size = array.shape
- if pixel_size <> len(format):
- raise ValueError("Array has wrong shape for specified format")
- bps = 8
- spp = pixel_size
- alpha = format.endswith("A")
- csp = NSCalibratedRGBColorSpace
- bpp = bps * spp
- bpr = width * pixel_size
- fmt = NSAlphaNonpremultipliedBitmapFormat
- ns_rep = NSBitmapImageRep.alloc()
- planes = planes_t(array.ctypes.data, 0, 0, 0, 0)
- ns_rep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(
- ctypes.addressof(planes), width, height, bps, spp, alpha, False, csp, fmt, bpr, bpp)
- image = Image.__new__(Image)
- image._init_from_ns_rep(ns_rep)
- image._data = array
- return image
diff --git a/PyGUI-2.5.3/build/lib/GUI/PIL.py b/PyGUI-2.5.3/build/lib/GUI/PIL.py
deleted file mode 100644
index 31f223b..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/PIL.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#--------------------------------------------------------------
-#
-# PyGUI - PIL interface - Cocoa
-#
-#--------------------------------------------------------------
-
-import ctypes
-from AppKit import NSBitmapImageRep, \
- NSAlphaNonpremultipliedBitmapFormat, NSFloatingPointSamplesBitmapFormat, \
- NSDeviceCMYKColorSpace, NSCalibratedRGBColorSpace
-from GUI import Image
-
-def hack_objc_sig():
- #print "GUI[Cocoa].PIL: Hacking objc method signature" ###
- # HACK! PyObjC 2.3 incorrectly wraps the following method, so we change the
- # signature and pass the bitmap data in using ctypes.
- NSBitmapImageRep.__dict__['initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_'].signature = '@52@0:4^v8i12i16i20i24c28c32@36I40i44i48'
-
-planes_t = ctypes.c_char_p * 5
-
-debug_pil = False
-
-def image_from_pil_image(pil_image):
- """Creates an Image from a Python Imaging Library (PIL)
- Image object."""
- mode = pil_image.mode
- w, h = pil_image.size
- data = pil_image.tostring()
- alpha = False
- cmyk = False
- floating = False
- if mode == "1":
- bps = 1; spp = 1
- elif mode == "L":
- bps = 8; spp = 1
- elif mode == "RGB":
- bps = 8; spp = 3
- elif mode == "RGBA":
- bps = 8; spp = 4; alpha = True
- elif mode == "CMYK":
- bps = 8; spp = 4; cmyk = True
- elif mode == "I":
- bps = 32; spp = 1
- elif mode == "F":
- bps = 32; spp = 1; floating = True
- else:
- raise ValueError("Unsupported PIL image mode '%s'" % mode)
- if cmyk:
- csp = NSDeviceCMYKColorSpace
- else:
- csp = NSCalibratedRGBColorSpace
- fmt = NSAlphaNonpremultipliedBitmapFormat
- if floating:
- fmt |= NSFloatingPointSamplesBitmapFormat
- bpp = bps * spp
- bpr = w * ((bpp + 7) // 8)
- if debug_pil:
- print "GUI.PIL:"
- print "image size =", (w, h)
- print "data size =", len(data)
- print "bits per sample =", bps
- print "samples per pixel =", spp
- print "bits per pixel =", bpp
- print "bytes per row =", bpr
- hack_objc_sig()
- ns_rep = NSBitmapImageRep.alloc()
- planes = planes_t(data, "", "", "", "")
- ns_rep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel_(
- ctypes.addressof(planes), w, h, bps, spp, alpha, False, csp, fmt, bpr, bpp)
-# planes = (data, "", "", "", "")
-# ns_rep.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(
-# planes, w, h, bps, spp, alpha, False, csp, bpr, bpp)
- image = Image.__new__(Image)
- image._init_from_ns_rep(ns_rep)
- image._data = data
- return image
-
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/PaletteView.py b/PyGUI-2.5.3/build/lib/GUI/PaletteView.py
deleted file mode 100644
index 9387afa..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/PaletteView.py
+++ /dev/null
@@ -1,144 +0,0 @@
-#--------------------------------------------------------------------------
-#
-# PyGUI - Palette View - Generic
-#
-#--------------------------------------------------------------------------
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import StdColors, GridView
-from GUI.GUtils import splitdict
-
-class PaletteView(GridView):
- """A GridView whose cells are identified by a linear index from
- left to right and top to bottom. Also provides support for
- highlighting one or more selected cells."""
-
- num_items = overridable_property('num_items',
- "Total number of items")
-
- items_per_row = overridable_property('items_per_row',
- "Number of items displayed in one row")
-
- highlight_style = overridable_property('highlight_style',
- "Style of selection highlighting")
-
- highlight_color = overridable_property('highlight_color',
- "Color of selection highlighting")
-
- highlight_thickness = overridable_property('highlight_thickness',
- "Width of selection highlighting for 'frame' highlight mode")
-
- _highlight_style = 'fill'
- _highlight_color = StdColors.selection_backcolor
- _highlight_thickness = 4
-
- def __init__(self, num_items, items_per_row, cell_size,
- scrolling = '', **kwds):
- base_kwds = splitdict(kwds, 'border', scrolling = '')
- GridView.__init__(self, num_rows = 0, num_columns = 0,
- cell_size = cell_size, **base_kwds)
- self._num_items = num_items
- self._items_per_row = items_per_row
- self._update_num_rows_and_columns()
- ew, eh = self.extent
- if not self.hscrolling:
- self.content_width = ew
- if not self.vscrolling:
- self.content_height = eh
- self.set(**kwds)
-
- def get_num_items(self):
- return self._num_items
-
- def set_num_items(self, n):
- self._num_items = n
- self._update_num_rows_and_columns()
-
- def get_items_per_row(self):
- return self.num_columns
-
- def set_items_per_row(self, n):
- self._items_per_row = n
- self._update_num_rows_and_columns()
-
- def _update_num_rows_and_columns(self):
- nc = self._items_per_row
- nr = (self._num_items + nc - 1) // nc
- self._num_columns = nc
- self._num_rows = nr
- self._update_extent()
-
- def get_highlight_style(self):
- return self._highlight_style
-
- def set_highlight_style(self, x):
- self._highlight_style = x
-
- def get_highlight_color(self):
- return self._highlight_color
-
- def set_highlight_color(self, x):
- self._highlight_color = x
-
- def get_highlight_color(self):
- return self._highlight_color
-
- def set_highlight_color(self, x):
- self._highlight_color = x
-
- def item_no_of_cell(self, row, col):
- i = row * self._items_per_row + col
- if 0 <= i < self._num_items:
- return i
-
- def cell_of_item_no(self, item_no):
- if 0 <= item_no < self._num_items:
- return divmod(item_no, self._items_per_row)
-
- def item_rect(self, item_no):
- cell = self.cell_of_item_no(item_no)
- if cell:
- return self.cell_rect(*cell)
-
- def draw_cell(self, canvas, row, col, rect):
- i = self.item_no_of_cell(row, col)
- if i is not None:
- highlight = self.item_is_selected(i)
- self.draw_item_and_highlight(canvas, i, rect, highlight)
-
- def draw_item_and_highlight(self, canvas, item_no, rect, highlight):
- """Draw the specified item, with selection highlighting if highlight
- is true."""
- if highlight:
- style = self.highlight_style
- if style:
- canvas.gsave()
- if style == 'fill':
- canvas.fillcolor = self.highlight_color
- canvas.fill_rect(rect)
- else:
- canvas.pencolor = self.highlight_color
- canvas.pensize = self.highlight_thickness
- canvas.frame_rect(rect)
- canvas.grestore()
- self.draw_item(canvas, item_no, rect)
-
- def draw_item(self, canvas, item_no, rect):
- """Should draw the specified item in the given rect."""
- pass
-
- def click_cell(self, row, col, event):
- i = self.item_no_of_cell(row, col)
- if i is not None:
- self.click_item(i, event)
-
- def click_item(self, item_no, event):
- """Called when a mouse_down event has occurred in the indicated item."""
- pass
-
- def item_is_selected(self, item_no):
- """Should return true if the indicated item is to be drawn highlighted."""
- return False
-
-export(PaletteView)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Picture.py b/PyGUI-2.5.3/build/lib/GUI/Picture.py
deleted file mode 100644
index 2a58b65..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Picture.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Python GUI - Picture class - Generic
-#
-
-from GUI import export
-from GUI.Properties import overridable_property
-from GUI import View
-
-class Picture(View):
-
- image = overridable_property('image', "The image to display")
-
- _image = None
-
- def __init__(self, image = None, file = None, **kwds):
- if file:
- from Images import Image
- image = Image(file)
- View.__init__(self, **kwds)
- if image:
- self.size = image.size
- self._image = image
-
- def get_image(self):
- return self._image
-
- def set_image(self, x):
- self._image = x
- self.invalidate()
-
- def draw(self, canvas, rect):
- image = self._image
- if image:
- w, h = self.size
- image.draw(canvas, image.bounds, (0, 0, w, h))
-
-export(Picture)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Pixmap.py b/PyGUI-2.5.3/build/lib/GUI/Pixmap.py
deleted file mode 100644
index 3b3a4a2..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Pixmap.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# Python GUI - Pixmaps - Cocoa
-#
-
-from Foundation import NSSize
-from AppKit import NSImage, NSCachedImageRep, NSBitmapImageRep, \
- NSCalibratedRGBColorSpace, NSImageCacheNever, NSGraphicsContext, \
- NSAffineTransform
-from GUI import export
-from GUI import Canvas
-from GUI.GPixmaps import Pixmap as GPixmap
-
-class Pixmap(GPixmap):
- # _ns_bitmap_image_rep NSBitmapImageRep
-
- def __init__(self, width, height):
- GPixmap.__init__(self)
- #ns_size = NSSize(width, height)
- #ns_image = NSImage.alloc().initWithSize_(ns_size)
- ns_image = NSImage.alloc().init()
- ns_image.setCacheMode_(NSImageCacheNever)
- row_bytes = 4 * width
- ns_bitmap = NSBitmapImageRep.alloc().\
- initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_(
- None, width, height, 8, 4, True, False, NSCalibratedRGBColorSpace, row_bytes, 32)
- ns_image.addRepresentation_(ns_bitmap)
- ns_bitmap_context = NSGraphicsContext.graphicsContextWithBitmapImageRep_(ns_bitmap)
- ns_graphics_context = FlippedNSGraphicsContext.alloc().initWithBase_(ns_bitmap_context)
- ns_tr = NSAffineTransform.transform()
- ns_tr.translateXBy_yBy_(0.0, height)
- ns_tr.scaleXBy_yBy_(1.0, -1.0)
- # Using __class__ to get +saveGraphicsState instead of -saveGraphicsState
- NSGraphicsContext.__class__.saveGraphicsState()
- try:
- NSGraphicsContext.setCurrentContext_(ns_graphics_context)
- ns_tr.concat()
- finally:
- NSGraphicsContext.__class__.restoreGraphicsState()
- self._init_with_ns_image(ns_image, flipped = True) #False)
- self._ns_bitmap_image_rep = ns_bitmap
- self._ns_graphics_context = ns_graphics_context
-
- def with_canvas(self, proc):
- NSGraphicsContext.__class__.saveGraphicsState()
- NSGraphicsContext.setCurrentContext_(self._ns_graphics_context)
- try:
- canvas = Canvas()
- proc(canvas)
- finally:
- NSGraphicsContext.__class__.restoreGraphicsState()
-
-class FlippedNSGraphicsContext(NSGraphicsContext):
-
- def initWithBase_(self, base):
- self.base = base
- self.graphics_port = base.graphicsPort()
- return self
-
- def isFlipped(self):
- return True
-
- def graphicsPort(self):
- return self.graphics_port
-
- def isDrawingToScreen(self):
- return self.base.isDrawingToScreen()
-
- def setCompositingOperation_(self, x):
- self.base.setCompositingOperation_(x)
-
- def focusStack(self):
- return self.base.focusStack()
-
- def saveGraphicsState(self):
- return self.base.saveGraphicsState()
-
- def restoreGraphicsState(self):
- return self.base.restoreGraphicsState()
-
-export(Pixmap)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Printing.py b/PyGUI-2.5.3/build/lib/GUI/Printing.py
deleted file mode 100644
index 21aba9f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Printing.py
+++ /dev/null
@@ -1,132 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Printing - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from AppKit import NSPrintInfo, NSPageLayout, NSPrintOperation, \
- NSKeyedArchiver, NSKeyedUnarchiver, NSData, NSAutoPagination, \
- NSPortraitOrientation, NSLandscapeOrientation, NSOKButton
-from GUI.GPrinting import PageSetup as GPageSetup, Printable as GPrintable
-
-ns_to_generic_orientation = {
- NSPortraitOrientation: 'portrait',
- NSLandscapeOrientation: 'landscape',
-}
-
-generic_to_ns_orientation = {
- 'portrait': NSPortraitOrientation,
- 'landscape': NSLandscapeOrientation,
-}
-
-#------------------------------------------------------------------------------
-
-class PageSetup(GPageSetup):
-
- def __init__(self):
- ns_pi = NSPrintInfo.sharedPrintInfo().copy()
- ns_pi.setLeftMargin_(36)
- ns_pi.setTopMargin_(36)
- ns_pi.setRightMargin_(36)
- ns_pi.setBottomMargin_(36)
- ns_pi.setHorizontalPagination_(NSAutoPagination)
- self._ns_print_info = ns_pi
-
- def __getstate__(self):
- state = GPageSetup.__getstate__(self)
- data = NSKeyedArchiver.archivedDataWithRootObject_(self._ns_print_info)
- state['_ns_print_info'] = data.bytes()
- return state
-
- def __setstate__(self, state):
- bytes = state.pop('_ns_print_info', None)
- if bytes:
- data = NSData.dataWithBytes_length_(bytes, len(bytes))
- self._ns_print_info = NSKeyedArchiver.unarchiveObjectWithData_(data)
- else:
- GPageSetup.__setstate__(self, state)
-
- def copy(self, other):
- result = PageSetup.__new__()
- result._ns_print_info = other._ns_print_info.copy()
-
- def get_paper_name(self):
- return self._ns_print_info.paperName()
-
- def set_paper_name(self, x):
- self._ns_print_info.setPaperName_(x)
-
- def get_paper_size(self):
- return tuple(self._ns_print_info.paperSize())
-
- def set_paper_size(self, x):
- self._ns_print_info.setPaperSize_(x)
-
- def get_paper_width(self):
- return self.paper_size[0]
-
- def set_paper_width(self, x):
- self.paper_size = x, self.paper_height
-
- def get_paper_height(self):
- return self.paper_size[1]
-
- def set_paper_height(self, x):
- self.paper_size = self.paper_width, x
-
- def get_left_margin(self):
- return self._ns_print_info.leftMargin()
-
- def set_get_left_margin(self, x):
- self._ns_print_info.setLefMargin_(x)
-
- def get_right_margin(self):
- return self._ns_print_info.rightMargin()
-
- def set_get_right_margin(self, x):
- self._ns_print_info.setRightMargin_(x)
-
- def get_top_margin(self):
- return self._ns_print_info.topMargin()
-
- def set_get_top_margin(self, x):
- self._ns_print_info.setTopMargin_(x)
-
- def get_bottom_margin(self):
- return self._ns_print_info.bottomMargin()
-
- def set_get_bottom_margin(self, x):
- self._ns_print_info.setBottomMargin_(x)
-
- def get_orientation(self):
- return ns_to_generic_orientation[self._ns_print_info.orientation()]
-
- def set_orientation(self, x):
- nso = generic_to_ns_orientation.get(x, 'portrait')
- self._ns_print_info.setOrientation_(nso)
-
- def get_printable_rect(self):
- l, b, w, h = self._ns_print_info.imageablePageBounds()
- return (l, b - h, l + w, b)
-
- def get_printer_name(self):
- return self._ns_print_info.printer().name()
-
- def set_printer_name(self, x):
- self._ns_print_info.setPrinter_(NSPrinter.printerWithName_(x))
-
-#------------------------------------------------------------------------------
-
-class Printable(GPrintable):
-
- def print_view(self, page_setup, prompt = True):
- ns_op = NSPrintOperation.printOperationWithView_printInfo_(
- self._ns_inner_view, page_setup._ns_print_info)
- ns_op.setShowsPrintPanel_(prompt)
- ns_op.runOperation()
-
-#------------------------------------------------------------------------------
-
-def present_page_setup_dialog(page_setup):
- result = NSPageLayout.pageLayout().runModalWithPrintInfo_(page_setup._ns_print_info)
- return result == NSOKButton
diff --git a/PyGUI-2.5.3/build/lib/GUI/Properties.py b/PyGUI-2.5.3/build/lib/GUI/Properties.py
deleted file mode 100644
index 5fa0811..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Properties.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Properties - Generic
-#
-#------------------------------------------------------------------------------
-
-class Properties(object):
- """
- This class implements the standard interface for initialising
- properties using keyword arguments.
- """
-
- def __init__(self, **kw):
- "Properties(name=value, ...) passes the given arguments to the set() method."
- self.set(**kw)
-
- def set(self, **kw):
- """set(name=value, ...) sets property values according to the given
- keyword arguments. Will only set attributes for which a descriptor exists."""
- cls = self.__class__
- for name, value in kw.iteritems():
- try:
- s = getattr(cls, name).__set__
- except AttributeError:
- raise TypeError("%s object has no writable property %r" % (
- self.__class__.__name__, name))
- s(self, value)
-
-#------------------------------------------------------------------------------
-
-def overridable_property(name, doc = None):
- """Creates a property which calls methods get_xxx and set_xxx of
- the underlying object to get and set the property value, so that
- the property's behaviour may be easily overridden by subclasses."""
-
- getter_name = intern('get_' + name)
- setter_name = intern('set_' + name)
- return property(
- lambda self: getattr(self, getter_name)(),
- lambda self, value: getattr(self, setter_name)(value),
- None,
- doc)
diff --git a/PyGUI-2.5.3/build/lib/GUI/RadioButton.py b/PyGUI-2.5.3/build/lib/GUI/RadioButton.py
deleted file mode 100644
index 4b77a54..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/RadioButton.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Python GUI - Radio buttons - PyObjC
-#
-
-import AppKit
-from AppKit import NSOnState, NSOffState
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.ButtonBasedControls import ButtonBasedControl
-from GUI.GRadioButtons import RadioButton as GRadioButton
-
-class RadioButton(ButtonBasedControl, GRadioButton):
-
- def __init__(self, title = "New Radio Button", font = system_font, **kwds):
- ns_button = self._create_ns_button(title = title, font = font,
- ns_button_type = AppKit.NSRadioButton,
- ns_bezel_style = AppKit.NSRoundedBezelStyle)
- GRadioButton.__init__(self, _ns_view = ns_button, **kwds)
-
- def do_action(self):
- if self._group:
- self._group.value = self._value
- else:
- self._ns_view.setState_(NSOffState)
-
- def _value_changed(self):
- self._update()
-
- def _update(self):
- if self._group and self._value == self._group._value:
- state = NSOnState
- else:
- state = NSOffState
- self._ns_view.setState_(state)
-
-export(RadioButton)
diff --git a/PyGUI-2.5.3/build/lib/GUI/RadioGroup.py b/PyGUI-2.5.3/build/lib/GUI/RadioGroup.py
deleted file mode 100644
index 985990b..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/RadioGroup.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Python GUI - Radio groups - PyObjC
-#
-
-from GUI import export
-from GUI.GRadioGroups import RadioGroup as GRadioGroup
-
-class RadioGroup(GRadioGroup):
-
- def __init__(self, items = [], **kwds):
- GRadioGroup.__init__(self, items, **kwds)
-
- def _item_added(self, item):
- item._update()
-
- def _item_removed(self, item):
- pass
-
- def _value_changed(self):
- for item in self._items:
- item._update()
-
-export(RadioGroup)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources.py b/PyGUI-2.5.3/build/lib/GUI/Resources.py
deleted file mode 100644
index 91d570d..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# PyGUI - Resources - Generic
-#
-
-import os
-
-resource_path = []
-resource_cache = {}
-
-class ResourceNotFoundError(ValueError):
-
- def __init__(self, name, type, path):
- name = _append_type(name, type)
- ValueError.__init__(self, "Resource %r not found in %s" % (name, path))
-
-def _append_type(name, type):
- if type:
- name = "%s.%s" % (os.path.splitext(name)[0], type)
- return name
-
-def _add_directory_path(dir, up = 0):
- # Add the given directory to the resource path if it exists.
- dir = os.path.abspath(dir)
- while up > 0:
- dir = os.path.dirname(dir)
- up -= 1
- resdir = os.path.join(dir, "Resources")
- #print "GUI.Resources: Checking for directory", repr(resdir) ###
- if os.path.isdir(resdir):
- resource_path.insert(0, resdir)
-
-def _add_file_path(file, up = 0):
- # Add the directory containing the given file to the resource path.
- #print "GUI.Resources: Adding path for file", repr(file) ###
- dir = os.path.dirname(os.path.abspath(file))
- _add_directory_path(dir, up)
-
-def _add_module_path(module, up = 0):
- # Add the directory containing the given module to the resource path.
- if hasattr(module, '__file__'):
- _add_file_path(module.__file__, up)
-
-def lookup_resource(name, type = None):
- """
- Return the full pathname of a resource given its relative name
- using '/' as a directory separator. If a type is specified, any
- dot-suffix on the name is replaced with '.type'. Returns None if
- no matching file is found on the resource search path.
- """
- name = _append_type(name, type)
- relpath = os.path.join(*name.split("/"))
- for dir in resource_path:
- path = os.path.join(dir, relpath)
- if os.path.exists(path):
- return path
- return None
-
-def find_resource(name, type = None):
- """
- Returns the full pathname of a resource as per lookup_resource(), but
- raises ResourceNotFoundError if the resource is not found.
- """
- path = lookup_resource(name, type)
- if not path:
- raise ResourceNotFoundError(name, type, resource_path)
- return path
-
-def get_resource(loader, name, type = None, default = None, **kwds):
- """
- Find a resource and load it using the specified loader function.
- The loader is called as: loader(path, **kwds) where path is the full
- pathname of the resource. The loaded resource is cached, and subsequent
- calls referencing the same resource will return the cached value.
- If the resource is not found, the specified default is returned if any,
- otherwise ResourceNotFoundError is raised.
- """
- path = lookup_resource(name, type)
- if path:
- result = resource_cache.get(path)
- if result is None:
- result = loader(path, **kwds)
- resource_cache[path] = result
- else:
- if default is not None:
- result = default
- else:
- raise ResourceNotFoundError(name, type, resource_path)
- return result
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/arrow.hot b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/arrow.hot
deleted file mode 100644
index 8835c07..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/arrow.hot
+++ /dev/null
@@ -1 +0,0 @@
-4 4
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/arrow.tiff b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/arrow.tiff
deleted file mode 100644
index 2232993..0000000
Binary files a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/arrow.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/crosshair.hot b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/crosshair.hot
deleted file mode 100644
index 11c8dd7..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/crosshair.hot
+++ /dev/null
@@ -1 +0,0 @@
-7 7
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/crosshair.tiff b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/crosshair.tiff
deleted file mode 100644
index e15aa9d..0000000
Binary files a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/crosshair.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/finger.hot b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/finger.hot
deleted file mode 100644
index e846a7c..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/finger.hot
+++ /dev/null
@@ -1 +0,0 @@
-5 0
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/finger.tiff b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/finger.tiff
deleted file mode 100644
index 55e059c..0000000
Binary files a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/finger.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/fist.hot b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/fist.hot
deleted file mode 100644
index 99ca153..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/fist.hot
+++ /dev/null
@@ -1 +0,0 @@
-8 8
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/fist.tiff b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/fist.tiff
deleted file mode 100644
index 961b33d..0000000
Binary files a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/fist.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/hand.hot b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/hand.hot
deleted file mode 100644
index 99ca153..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/hand.hot
+++ /dev/null
@@ -1 +0,0 @@
-8 8
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/hand.tiff b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/hand.tiff
deleted file mode 100644
index 2441917..0000000
Binary files a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/hand.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/ibeam.hot b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/ibeam.hot
deleted file mode 100644
index 1a99162..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/ibeam.hot
+++ /dev/null
@@ -1 +0,0 @@
-4 5
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/ibeam.tiff b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/ibeam.tiff
deleted file mode 100644
index 70d7462..0000000
Binary files a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/ibeam.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/poof.hot b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/poof.hot
deleted file mode 100644
index b0597be..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/poof.hot
+++ /dev/null
@@ -1 +0,0 @@
-11 4
diff --git a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/poof.tiff b/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/poof.tiff
deleted file mode 100644
index c8cc981..0000000
Binary files a/PyGUI-2.5.3/build/lib/GUI/Resources/cursors/poof.tiff and /dev/null differ
diff --git a/PyGUI-2.5.3/build/lib/GUI/Row.py b/PyGUI-2.5.3/build/lib/GUI/Row.py
deleted file mode 100644
index 25b6fc3..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Row.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#---------------------------------------------------------------------------
-#
-# PyGUI - Row layout component - Generic
-#
-#---------------------------------------------------------------------------
-
-from LayoutUtils import equalize_components
-from GUI import Frame, export
-
-class Row(Frame):
-
- def __init__(self, items, spacing = 10, align = 'c', equalize = '',
- expand = None, padding = (0, 0), **kwds):
- Frame.__init__(self)
- hpad, vpad = padding
- if expand is not None and not isinstance(expand, int):
- expand = items.index(expand)
- equalize_components(items, equalize)
- height = 0
- for item in items:
- if item:
- height = max(height, item.height)
- x = hpad
- gap = 0
- hanchor = 'l'
- vanchor = align
- for i, item in enumerate(items):
- x += gap;
- if item:
- if 't' in align:
- y = 0
- if 'b' in align:
- item.height = height
- elif align == 'b':
- y = height - item.height
- else:
- y = (height - item.height) // 2
- item.position = (x, y + vpad)
- if i == expand:
- item.anchor = 'lr' + vanchor
- else:
- item.anchor = hanchor + vanchor
- x += item.width;
- if i == expand:
- hanchor = 'r'
- gap = spacing
- self.size = (x + hpad, height + 2 * vpad)
- self.add(items)
- self.set(**kwds)
-
-export(Row)
diff --git a/PyGUI-2.5.3/build/lib/GUI/ScrollableView.py b/PyGUI-2.5.3/build/lib/GUI/ScrollableView.py
deleted file mode 100644
index c6bdd83..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ScrollableView.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Python GUI - Scrollable Views - PyObjC
-#
-
-from Foundation import NSPoint, NSMakeRect
-from AppKit import NSScrollView
-from GUI import export
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount, default_scrolling
-from GUI.Geometry import ns_rect_to_rect
-
-class ScrollableView(GScrollableView):
-
- _ns_scrollable = True
-
- def __init__(self, extent = default_extent,
- line_scroll_amount = default_line_scroll_amount,
- scrolling = default_scrolling,
- **kwds):
- GScrollableView.__init__(self,
- extent = extent, line_scroll_amount = line_scroll_amount,
- scrolling = scrolling, **kwds)
-
- def get_hscrolling(self):
- return self._ns_view.hasHorizontalScroller()
-
- def set_hscrolling(self, value):
- self._ns_view.setHasHorizontalScroller_(value)
-
- def get_vscrolling(self):
- return self._ns_view.hasVerticalScroller()
-
- def set_vscrolling(self, value):
- self._ns_view.setHasVerticalScroller_(value)
-
-# def get_extent(self):
-# (l, t), (w, h) = self._ns_inner_view.bounds()
-# return (l, t, l + w, t + h)
-
- def get_extent(self):
- return self._ns_inner_view.bounds().size
-
-# def set_extent(self, (l, t, r, b)):
-# w = r - l
-# h = b - t
-# ns_docview = self._ns_inner_view
-# ns_docview.setFrame_(NSMakeRect(0, 0, w, h))
-# ns_docview.setBounds_(NSMakeRect(l, t, w, h))
-# self.invalidate()
-
- def set_extent(self, (w, h)):
- r = NSMakeRect(0, 0, w, h)
- ns_docview = self._ns_inner_view
- ns_docview.setFrame_(r)
- ns_docview.setBounds_(r)
- self.invalidate()
-
- def get_content_size(self):
- return self._ns_view.contentSize()
-
- def set_content_size(self, size):
- ns = self._ns_view
- self.size = NSScrollView.\
- frameSizeForContentSize_hasHorizontalScroller_hasVerticalScroller_borderType_(
- size, ns.hasHorizontalScroller(), ns.hasVerticalScroller(), ns.borderType())
-
- def get_scroll_offset(self):
- ns_clip_view = self._ns_view.contentView()
- x, y = ns_clip_view.bounds().origin
- return x, y
-
- def set_scroll_offset(self, (x, y)):
- ns_view = self._ns_view
- ns_clip_view = ns_view.contentView()
- new_pt = ns_clip_view.constrainScrollPoint_(NSPoint(x, y))
- ns_clip_view.scrollToPoint_(new_pt)
- ns_view.reflectScrolledClipView_(ns_clip_view)
-
- def get_line_scroll_amount(self):
- ns_view = self._ns_view
- x = ns_view.horizontalLineScroll()
- y = ns_view.verticalLineScroll()
- return x, y
-
- def set_line_scroll_amount(self, (x, y)):
- ns_view = self._ns_view
- ns_view.setHorizontalLineScroll_(x)
- ns_view.setVerticalLineScroll_(y)
- ns_view.setHorizontalPageScroll_(x)
- ns_view.setVerticalPageScroll_(y)
-
- def viewed_rect(self):
- ns_rect = self._ns_view.contentView().documentVisibleRect()
- return ns_rect_to_rect(ns_rect)
-
-export(ScrollableView)
diff --git a/PyGUI-2.5.3/build/lib/GUI/ScrollableView_mfc.py b/PyGUI-2.5.3/build/lib/GUI/ScrollableView_mfc.py
deleted file mode 100644
index 07d1b16..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ScrollableView_mfc.py
+++ /dev/null
@@ -1,128 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - ScrollableView - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui
-from GUI.Components import win_none
-from GUI.Canvases import Canvas
-from GUI.GScrollableViews import ScrollableView as GScrollableView, \
- default_extent, default_line_scroll_amount
-from GUI.Geometry import add_pt, sub_pt, offset_rect, offset_rect_neg
-
-win_style = ui.AFX_WS_DEFAULT_VIEW
-
-#print "ScrollableViews: Creating dummy doc"
-# PyWin32 insists on being given a CDocument when creating a CScrollView,
-# and doesn't provide any way of creating a real one without using a resource.
-
-if 1:
- # The following uses a resource included in win32ui.pyd.
- import pywin.mfc.object
- win_dummy_doc_template = pywin.mfc.object.CmdTarget(
- ui.CreateDocTemplate(ui.IDR_PYTHONTYPE))
- ui.GetApp().AddDocTemplate(win_dummy_doc_template)
- def win_get_dummy_doc():
- return win_dummy_doc_template.DoCreateDoc()
-else:
- # The following hack creates something that looks enough
- # like a CDocument to keep it happy. But it doesn't work with
- # pywin32 builds later than 212.
- win_dummy_doc = ui.CreateRichEditView().GetDocument()
- def win_get_dummy_doc():
- return win_dummy_doc
-
-class ScrollableView(GScrollableView):
-
- _line_scroll_amount = default_line_scroll_amount
-
- def __init__(self, **kwds):
- kwds.setdefault('extent', default_extent)
- doc = win_get_dummy_doc()
- win = ui.CreateView(doc)
- #win.CreateWindow(win_none, 0, win_style, (0, 0, 100, 100))
- win.CreateWindow(win_none, ui.AFX_IDW_PANE_FIRST, win_style, (0, 0, 100, 100))
- GScrollableView.__init__(self, _win = win)
- self.set(**kwds)
-
- def get_hscrolling(self):
- return self._win.GetStyle() & wc.WS_HSCROLL != 0
-
- def get_vscrolling(self):
- return self._win.GetStyle() & wc.WS_VSCROLL != 0
-
- def set_hscrolling(self, x):
- self._win_set_flag(x, wc.WS_HSCROLL)
-
- def set_vscrolling(self, x):
- self._win_set_flag(x, wc.WS_VSCROLL)
-
- def get_line_scroll_amount(self):
- return self._line_scroll_amount
-
- def get_extent(self):
- return self._win.GetTotalSize()
-
- def set_extent(self, extent):
- self._win_update_scroll_sizes(extent)
-
- def get_scroll_offset(self):
- return self._win.GetScrollPosition()
-
- def set_scroll_offset(self, p):
- px, py = p
- ex, ey = self.extent
- vx, vy = self.content_size
- xmax = max(0, ex - vx)
- ymax = max(0, ey - vy)
- x = max(0, min(px, xmax))
- y = max(0, min(py, ymax))
- self._win.ScrollToPosition((x, y))
-
- def set_bounds(self, bounds):
- GScrollableView.set_bounds(self, bounds)
- extent = self._win.GetTotalSize()
- self._win_update_scroll_sizes(extent)
-
- def _invalidate_rect(self, r):
- win = self._win
- s = win.GetScrollPosition()
- self._win.InvalidateRect(offset_rect_neg(r, s))
-
- def local_to_global(self, p):
- win = self._win
- q = sub_pt(p, win.GetScrollPosition())
- return win.ClientToScreen(q)
-
- def global_to_local(self, g):
- win = self._win
- q = win.ScreenToClient(g)
- return add_pt(q, win.GetScrollPosition())
-
-# def global_to_local(self, g):
-# win = self._win
-# l = win.ScreenToClient(g)
-# s = win.GetScrollPosition()
-# q = add_pt(l, s)
-# print "ScrollableView.global_to_local: g =", g, "l =", l, "s =", s, "q =", q ###
-# return q
-
- def _win_update_scroll_sizes(self, extent):
- ph = self.h_page_scroll_amount()
- pv = self.v_page_scroll_amount()
- ls = self.line_scroll_amount
- self._win.SetScrollSizes(wc.MM_TEXT, extent, (ph, pv), ls)
-
- def OnDraw(self, dc):
- #print "ScrollableView.OnDraw" ###
- update_rect = dc.GetClipBox()
- canvas = Canvas._from_win_dc(dc)
- self.draw(canvas, update_rect)
-
- def _win_prepare_dc(self, dc, pinfo = None):
- self._win.OnPrepareDC(dc, None)
-
-
-
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/Slider.py b/PyGUI-2.5.3/build/lib/GUI/Slider.py
deleted file mode 100644
index d8c1ad2..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Slider.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Slider - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from AppKit import NSSlider
-from GUI import export
-from GUI.StdFonts import system_font
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, \
- ns_set_action, ns_size_to_fit
-from GUI.GSliders import Slider as GSlider
-
-class Slider(GSlider):
-
- _ns_handle_mouse = True
-
- def __init__(self, orient = 'h', ticks = 0, **kwds):
- length = 100
- if ticks:
- breadth = 30
- else:
- breadth = 22 # Same as default height of a text-containing control
- if orient == 'h':
- ns_frame = ((0, 0), (length, breadth))
- elif orient == 'v':
- ns_frame = ((0, 0), (breadth, length))
- else:
- raise ValueError("Invalid orientation, should be 'h' or 'v'")
- ns_slider = PyGUI_NSSlider.alloc().initWithFrame_(ns_frame)
- ns_slider.pygui_component = self
- ns_set_action(ns_slider, 'doAction:')
- GSlider.__init__(self, _ns_view = ns_slider, **kwds)
- self.set_ticks(ticks)
- self._last_value = None
-
- def get_min_value(self):
- return self._ns_view.minValue()
-
- def set_min_value(self, x):
- self._ns_view.setMinValue_(x)
-
- def get_max_value(self):
- return self._ns_view.maxValue()
-
- def set_max_value(self, x):
- self._ns_view.setMaxValue_(x)
-
- def get_value(self):
- return self._ns_view.doubleValue()
-
- def set_value(self, x):
- self._ns_view.setDoubleValue_(x)
-
- def get_ticks(self):
- return self._ns_view.numberOfTickMarks()
-
- def set_ticks(self, x):
- self._ns_view.setNumberOfTickMarks_(x)
-
- def get_discrete(self):
- return self._ns_view.allowsTickMarkValuesOnly()
-
- def set_discrete(self, x):
- self._ns_view.setAllowsTickMarkValuesOnly_(x)
-
- def get_live(self):
- return self._ns_view.isContinuous()
-
- def set_live(self, x):
- self._ns_view.setContinuous_(x)
-
- def do_action(self):
- value = self._ns_view.doubleValue()
- if value <> self._last_value:
- self._last_value = value
- GSlider.do_action(self)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSSlider(NSSlider, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(Slider)
diff --git a/PyGUI-2.5.3/build/lib/GUI/StdButtons.py b/PyGUI-2.5.3/build/lib/GUI/StdButtons.py
deleted file mode 100644
index f448461..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/StdButtons.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Python GUI - Standard Buttons
-#
-
-from GUI import Button
-
-class DefaultButton(Button):
-
- def __init__(self, title = "OK", **kwds):
- kwds.setdefault('style', 'default')
- kwds.setdefault('action', 'do_default_action')
- Button.__init__(self, title = title, **kwds)
-
-class CancelButton(Button):
-
- def __init__(self, title = "Cancel", **kwds):
- kwds.setdefault('style', 'cancel')
- kwds.setdefault('action', 'do_cancel_action')
- Button.__init__(self, title = title, **kwds)
diff --git a/PyGUI-2.5.3/build/lib/GUI/StdColors.py b/PyGUI-2.5.3/build/lib/GUI/StdColors.py
deleted file mode 100644
index f7701b4..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/StdColors.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Python GUI - Standard Colors - Generic
-#
-
-from GUI.Colors import rgb, selection_forecolor, selection_backcolor
-
-black = rgb(0, 0, 0)
-dark_grey = rgb(0.25, 0.25, 0.25)
-grey = rgb(0.5, 0.5, 0.5)
-light_grey = rgb(0.75, 0.75, 0.75)
-white = rgb(1, 1, 1)
-red = rgb(1, 0, 0)
-green = rgb(0, 1, 0)
-blue = rgb(0, 0, 1)
-yellow = rgb(1, 1, 0)
-cyan = rgb(0, 1, 1)
-magenta = rgb(1, 0, 1)
-clear = rgb(0, 0, 0, 0)
diff --git a/PyGUI-2.5.3/build/lib/GUI/StdCursors.py b/PyGUI-2.5.3/build/lib/GUI/StdCursors.py
deleted file mode 100644
index e26c851..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/StdCursors.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Python GUI - Standard Cursors - Cocoa
-#
-
-from AppKit import NSCursor
-from GUI import Cursor
-
-__all__ = [
- 'arrow',
- 'ibeam',
- 'crosshair',
- 'fist',
- 'hand',
- 'finger',
- 'invisible',
-]
-
-_empty_cursor = None
-
-def _make_empty_cursor():
- global _empty_cursor
- if not _empty_cursor:
- from AppKit import NSCursor, NSImage, NSBitmapImageRep, NSDeviceRGBColorSpace
- from GUI import Cursor
- import sys
- if sys.version_info >= (3, 0):
- b = bytes([0])
- else:
- b = "\x00"
- d = b * 1024
- ns_bitmap = NSBitmapImageRep.alloc().\
- initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel_\
- ((d, d, d, d, d), 16, 16, 8, 4, True, False, NSDeviceRGBColorSpace, 64, 32)
- ns_image = NSImage.alloc().initWithSize_((16, 16))
- ns_image.addRepresentation_(ns_bitmap)
- ns_cursor = NSCursor.alloc().initWithImage_hotSpot_(ns_image, (0, 0))
- _empty_cursor = Cursor._from_ns_cursor(ns_cursor)
- _empty_cursor._data = d
- return _empty_cursor
-
-arrow = Cursor._from_ns_cursor(NSCursor.arrowCursor())
-ibeam = Cursor._from_ns_cursor(NSCursor.IBeamCursor())
-crosshair = Cursor._from_ns_cursor(NSCursor.crosshairCursor())
-fist = Cursor._from_ns_cursor(NSCursor.closedHandCursor())
-hand = Cursor._from_ns_cursor(NSCursor.openHandCursor())
-finger = Cursor._from_ns_cursor(NSCursor.pointingHandCursor())
-invisible = _make_empty_cursor()
-
-mac_poof = Cursor._from_ns_cursor(NSCursor.disappearingItemCursor())
-
-del NSCursor
-del Cursor
-del _make_empty_cursor
-
-def empty_cursor():
- return invisible
diff --git a/PyGUI-2.5.3/build/lib/GUI/StdFonts.py b/PyGUI-2.5.3/build/lib/GUI/StdFonts.py
deleted file mode 100644
index 91aa2ca..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/StdFonts.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Python GUI - Standard Fonts - PyObjC
-#
-
-from AppKit import NSFont
-from GUI import Font
-
-system_font = Font._from_ns_font(NSFont.systemFontOfSize_(0))
-application_font = Font._from_ns_font(NSFont.userFontOfSize_(0))
diff --git a/PyGUI-2.5.3/build/lib/GUI/StdMenus.py b/PyGUI-2.5.3/build/lib/GUI/StdMenus.py
deleted file mode 100644
index 1b1fe3f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/StdMenus.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# Python GUI - Standard Menus - PyObjC
-#
-
-from GUI.GStdMenus import build_menus, \
- fundamental_cmds, help_cmds, pref_cmds, file_cmds, print_cmds, edit_cmds
-
-fundamental_cmds += ['hide_app_cmd', 'hide_other_apps_cmd', 'show_all_apps_cmd']
-
-_appl_menu_items = [
- ("About ", 'about_cmd'),
- "-",
- ("Preferences...", 'preferences_cmd'),
- "-",
- ("Hide /H", 'hide_app_cmd'),
- ("Hide Others", 'hide_other_apps_cmd'),
- ("Show All", 'show_all_apps_cmd'),
- "-",
- ("Quit /Q", 'quit_cmd'),
-]
-
-_file_menu_items = [
- ("New/N", 'new_cmd'),
- ("Open.../O", 'open_cmd'),
- ("Close/W", 'close_cmd'),
- "-",
- ("Save/S", 'save_cmd'),
- ("Save As...", 'save_as_cmd'),
- ("Revert", 'revert_cmd'),
- "-",
- ("Page Setup...", 'page_setup_cmd'),
- ("Print.../P", 'print_cmd'),
-]
-
-_edit_menu_items = [
- ("Undo/Z", 'undo_cmd'),
- ("Redo/^Z", 'redo_cmd'),
- "-",
- ("Cut/X", 'cut_cmd'),
- ("Copy/C", 'copy_cmd'),
- ("Paste/V", 'paste_cmd'),
- ("Delete", 'clear_cmd'),
- "-",
- ("Select All/A", 'select_all_cmd'),
-]
-
-_help_menu_items = [
- ("Help", 'help_cmd'),
-]
-
-#------------------------------------------------------------------------------
-
-def basic_menus(substitutions = {}, include = None, exclude = None):
- return build_menus([
- ("@", _appl_menu_items, False),
- ("File", _file_menu_items, False),
- ("Edit", _edit_menu_items, False),
- ("Help", _help_menu_items, True),
- ],
- substitutions = substitutions,
- include = include,
- exclude = exclude)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Task.py b/PyGUI-2.5.3/build/lib/GUI/Task.py
deleted file mode 100644
index 9ad5a3e..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Task.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# PyGUI - Tasks - Cocoa
-#
-
-import sys
-from weakref import WeakValueDictionary
-from Foundation import NSTimer, NSRunLoop, NSDefaultRunLoopMode
-from AppKit import NSEventTrackingRunLoopMode, NSModalPanelRunLoopMode
-from GUI import export
-from GUI import Globals
-from GUI.GTasks import Task as GTask
-
-#----------------------------------------------------------------------
-#
-# Doing things this convoluted way to work around a memory
-# leak in PyObjC. Need to avoid having the NSTimer trigger
-# creation of a bound method each time it fires or the bound
-# methods leak. Also can't use the userInfo of the NSTimer as
-# it seems to leak too.
-
-ns_timer_to_task = WeakValueDictionary()
-
-class TaskTrigger(object):
- pass
-
-def fire_(ns_timer):
- ns_timer_to_task[ns_timer]._ns_fire()
-
-trigger = TaskTrigger()
-trigger.fire_ = fire_
-
-#----------------------------------------------------------------------
-
-class Task(GTask):
-
- def __init__(self, proc, interval, repeat = 0, start = 1):
- self._proc = proc
- self._interval = interval
- self._repeat = repeat
- self._ns_timer = None
- if start:
- self.start()
-
- def destroy(self):
- #print "Task.destroy:", self ###
- self.stop()
-
- def get_scheduled(self):
- return self._ns_timer is not None
-
- def get_interval(self):
- return self._interval
-
- def get_repeat(self):
- return self._repeat
-
- def start(self):
- self.stop()
- #ns_timer = \
- # NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
- # self._interval, self._target, '_ns_fire', None, self._repeat)
- ns_timer = \
- NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
- self._interval, trigger, 'fire:', None, self._repeat)
- self._ns_timer = ns_timer
- ns_timer_to_task[ns_timer] = self
- ns_run_loop = NSRunLoop.currentRunLoop()
- ns_run_loop.addTimer_forMode_(
- ns_timer, NSDefaultRunLoopMode)
- ns_run_loop.addTimer_forMode_(
- ns_timer, NSEventTrackingRunLoopMode)
- ns_run_loop.addTimer_forMode_(
- ns_timer, NSModalPanelRunLoopMode)
-
- def stop(self):
- ns_timer = self._ns_timer
- if ns_timer:
- ns_timer.invalidate()
- del ns_timer_to_task[ns_timer]
- self._ns_timer = None
-
- def _ns_fire(self):
- try:
- self._proc()
- except:
- Globals.pending_exception = sys.exc_info()
- self.stop()
-
-export(Task)
diff --git a/PyGUI-2.5.3/build/lib/GUI/TextEditor.py b/PyGUI-2.5.3/build/lib/GUI/TextEditor.py
deleted file mode 100644
index 501e260..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/TextEditor.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Text Editor - Cocoa
-#
-#------------------------------------------------------------------------------
-
-from AppKit import NSTextView, NSScrollView, NSViewWidthSizable, \
- NSMutableParagraphStyle
-from GUI import export
-from GUI import StdFonts
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler
-from GUI.GTextEditors import TextEditor as GTextEditor
-
-NUM_TAB_STOPS = 32
-
-class TextEditor(GTextEditor):
-
- _ns_handle_mouse = True
-
- def __init__(self, scrolling = 'hv', **kwds):
- width = 100
- height = 100
- frame = ((0, 0), (width, height))
- ns_outer = NSScrollView.alloc().initWithFrame_(frame)
- ns_outer.setHasHorizontalScroller_('h' in scrolling)
- ns_outer.setHasVerticalScroller_('v' in scrolling)
- if 'h' in scrolling:
- cwidth = 2000
- else:
- cwidth = ns_outer.contentSize()[0]
- frame = ((0, 0), (cwidth, height))
- ns_inner = PyGUI_NSTextView.alloc().initWithFrame_(frame)
- ns_inner.pygui_component = self
- ps = NSMutableParagraphStyle.alloc().init()
- ps.setDefaultTabInterval_(ps.tabStops()[0].location())
- ps.setTabStops_([])
- ns_inner.setDefaultParagraphStyle_(ps)
- ns_inner.setAllowsUndo_(True)
- ns_outer.setDocumentView_(ns_inner)
- if 'h' not in scrolling:
- ns_inner.setAutoresizingMask_(NSViewWidthSizable)
- if 'font' not in kwds:
- kwds['font'] = StdFonts.application_font
- GTextEditor.__init__(self, ns_outer,
- _ns_inner_view = ns_inner, **kwds)
-
- def get_text(self):
- return self._ns_inner_view.string()
-
- def set_text(self, value):
- self._ns_inner_view.setString_(value)
- self._ns_apply_style()
-
- def get_text_length(self):
- return self._ns_inner_view.textStorage().length()
-
- def get_selection(self):
- start, length = self._ns_inner_view.selectedRanges()[0].rangeValue()
- return (start, start + length)
-
- def set_selection(self, value):
- start, stop = value
- self._ns_inner_view.setSelectedRange_((start, stop - start))
-
- def get_font(self):
- return self._font
-
- def set_font(self, font):
- self._font = font
- self._ns_inner_view.setFont_(font._ns_font)
-
- def get_tab_spacing(self):
- #ns_storage = self._ns_inner_view.textStorage()
- #ps, _ = ns_storage.attribute_atIndex_effectiveRange_("NSParagraphStyle", 0)
- ps = self._ns_inner_view.defaultParagraphStyle()
- return ps.defaultTabInterval()
-
- def set_tab_spacing(self, x):
- ps = NSMutableParagraphStyle.alloc().init()
- ps.setTabStops_([])
- ps.setDefaultTabInterval_(x)
- self._ns_inner_view.setDefaultParagraphStyle_(ps)
- self._ns_apply_style()
-
- def paste_cmd(self):
- GTextEditor.paste_cmd(self)
- self._ns_apply_style()
-
- def _ns_apply_style(self):
- ns_textview = self._ns_inner_view
- ps = ns_textview.defaultParagraphStyle()
- font = ns_textview.font()
- ns_storage = self._ns_inner_view.textStorage()
- ns_storage.setAttributes_range_(
- {"NSParagraphStyle": ps, "NSFont": font},
- (0, self.text_length))
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSTextView(NSTextView, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
-export(TextEditor)
diff --git a/PyGUI-2.5.3/build/lib/GUI/TextEditorPrinting.py b/PyGUI-2.5.3/build/lib/GUI/TextEditorPrinting.py
deleted file mode 100644
index d3afe19..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/TextEditorPrinting.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - TextEditor Printing - Generic
-#
-#------------------------------------------------------------------------------
-
-import re
-from GUI import View
-
-class TextEditorPrintView(View):
-
- def __init__(self, base_view, page_setup):
- print "TextEditorPrintView:" ###
- print "...paper_size =", page_setup.paper_size ###
- print "...margins =", page_setup.margins ###
- print "...page_size =", page_setup.page_size ###
- View.__init__(self)
- self.base_view = base_view
- self.width = page_setup.page_width
- self.page_height = page_setup.page_height
- self.lay_out_text()
- lines_per_page = int(page_setup.page_height / base_view.font.line_height)
- self.lines_per_page = lines_per_page
- num_lines = len(self.lines)
- self.num_pages = (num_lines + lines_per_page - 1) // lines_per_page
- self.height = self.num_pages * self.page_height
-
- def lay_out_text(self):
- base_view = self.base_view
- font = base_view.font
- space_width = font.width(" ")
- tab_spacing = base_view.tab_spacing
- page_width = self.width
- pat = re.compile(r"[ \t]|[^ \t]+")
- lines = []
- line = []
- x = 0
- for text_line in base_view.text.splitlines():
- for match in pat.finditer(text_line):
- item = match.group()
- if item == " ":
- item_width = space_width
- item = ""
- elif item == "\t":
- item_width = tab_spacing - x % tab_spacing
- item = ""
- else:
- item_width = font.width(item)
- if x + item_width > page_width and x > 0:
- lines.append(line); line = []; x = 0
- line.append((x, item))
- x += item_width
- lines.append(line); line = []; x = 0
- self.lines = lines
-
- def draw(self, canvas, page_rect):
- l, t, r, b = page_rect
- page_no = int(t / self.page_height)
- n = self.lines_per_page
- i = page_no * n
- font = self.base_view.font
- y = t + font.ascent
- dy = font.line_height
- for line in self.lines[i : i + n]:
- for x, item in line:
- canvas.moveto(x, y)
- canvas.show_text(item)
- y += dy
diff --git a/PyGUI-2.5.3/build/lib/GUI/TextField.py b/PyGUI-2.5.3/build/lib/GUI/TextField.py
deleted file mode 100644
index bfc4587..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/TextField.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# Python GUI - Text Fields - PyObjC
-#
-
-from Foundation import NSRange
-from GUI import export
-from GUI.StdFonts import system_font #application_font
-from GUI import EditCmdHandler
-from GUI.TextFieldBasedControls import TextFieldBasedControl
-from GUI.GTextFields import TextField as GTextField
-
-class TextField(TextFieldBasedControl, GTextField):
-
- #_vertical_padding = 5
- _intercept_tab_key = False
-
- def __init__(self, text = "", font = system_font,
- multiline = False, password = False, border = True, **kwds):
- ns_textfield = self._create_ns_textfield(editable = True,
- multiline = multiline, password = password,
- text = text, font = font, border = border)
- GTextField.__init__(self, _ns_view = ns_textfield,
- multiline = multiline, **kwds)
-
- def get_selection(self):
- ns_editor = self._ns_editor()
- if ns_editor:
- start, length = ns_editor.selectedRange()
- return (start, start + length)
- else:
- return (0, 0)
-
- def set_selection(self, (start, end)):
- self.become_target()
- ns_editor = self._ns_editor()
- if ns_editor:
- ns_editor.setSelectedRange_(NSRange(start, end - start))
-
- def select_all(self):
- self.become_target()
- self._ns_view.selectText_(None)
-
- def _ns_editor(self):
- return self._ns_view.currentEditor()
-
- def _ns_edit_cmd_target(self):
- return self._ns_editor()
-
-export(TextField)
diff --git a/PyGUI-2.5.3/build/lib/GUI/TextFieldBasedControls.py b/PyGUI-2.5.3/build/lib/GUI/TextFieldBasedControls.py
deleted file mode 100644
index 9bafabf..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/TextFieldBasedControls.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# Python GUI - PyObjC
-#
-# Base class for controls based on an NSTextField
-#
-
-from Foundation import NSRect, NSPoint, NSSize
-from AppKit import NSTextField, NSSecureTextField, NSTextFieldCell
-from GUI.Utils import NSMultiClass
-from GUI import Color
-from GUI.Utils import ns_size_to_fit, PyGUI_NS_EventHandler
-from GUI.StdFonts import system_font
-
-class TextFieldBasedControl(object):
-
- _ns_handle_mouse = True
-
- def _create_ns_textfield(self, editable, text, font,
- multiline = False, password = False, border = False,
- padding = (0, 0)):
- self._ns_is_password = password
- if password:
- ns_class = PyGUI_NSSecureTextField
- else:
- ns_class = PyGUI_NSTextField
- ns_frame = NSRect(NSPoint(0, 0), NSSize(20, 10))
- ns_textfield = ns_class.alloc().initWithFrame_(ns_frame)
- ns_textfield.pygui_component = self
- if multiline and not password:
- ns_textfield.pygui_multiline = True
- # Be careful here -- calling setBordered_ seems to affect isBezeled as well
- if editable:
- ns_textfield.setBezeled_(border)
- else:
- ns_textfield.setBordered_(border)
- if not editable:
- ns_textfield.setDrawsBackground_(False)
- ns_textfield.setEditable_(editable)
- ns_textfield.setSelectable_(editable)
- ns_textfield.setFont_(font._ns_font)
- ns_textfield.setStringValue_(text)
- ns_size_to_fit(ns_textfield, padding = padding)
- return ns_textfield
-
- def get_border(self):
- ns_textfield = self._ns_inner_view
- if ns_textfield.isEditable():
- return ns_textfield.isBezeled()
- else:
- return ns_textfield.isBordered()
-
- def set_border(self, border):
- ns_textfield = self._ns_inner_view
- if ns_textfield.isEditable():
- ns_textfield.setBezeled_(border)
- else:
- ns_textfield.setBordered_(border)
-
- def get_text(self):
- return self._ns_inner_view.stringValue()
-
- def set_text(self, v):
- self._ns_inner_view.setStringValue_(v)
-
- def get_color(self):
- return Color._from_ns_color(self._ns_inner_view.textColor())
-
- def set_color(self, v):
- self._ns_inner_view.setTextColor_(v._ns_color)
-
- def _get_vertical_padding(self):
- if self.border:
- return 5
- else:
- return 0
-
- _vertical_padding = property(_get_vertical_padding)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSTextField(NSTextField): #, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
-
- pygui_multiline = False
-
-class PyGUI_NSSecureTextField(NSSecureTextField): #, PyGUI_NS_EventHandler):
- __metaclass__ = NSMultiClass
-
- pygui_multiline = False
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/Utils.py b/PyGUI-2.5.3/build/lib/GUI/Utils.py
deleted file mode 100644
index c83e90c..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Utils.py
+++ /dev/null
@@ -1,198 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Utilities - PyObjC
-#
-#------------------------------------------------------------------------------
-
-from math import ceil
-from inspect import getmro
-from Foundation import NSObject
-from AppKit import NSView
-from GUI import Event, Globals
-
-def NSMultiClass(name, bases, dic):
- # Workaround for PyObjC classes not supporting
- # multiple inheritance properly. Note: MRO is
- # right to left across the bases.
- main = bases[0]
- slots = list(dic.get('__slots__', ()))
- dic2 = {}
- for mix in bases[1:]:
- for cls in getmro(mix)[::-1]:
- slots2 = cls.__dict__.get('__slots__')
- if slots2:
- for slot in slots2:
- if slot not in slots:
- slots.append(slot)
- dic2.update(cls.__dict__)
- dic2.update(dic)
- if slots:
- dic2['__slots__'] = slots
- cls = type(main)(name, (main,), dic2)
- return cls
-
-#------------------------------------------------------------------------------
-
-class PyGUI_Flipped_NSView(NSView):
- # An NSView with a flipped coordinate system.
-
- def isFlipped(self):
- return True
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSActionTarget(NSObject):
- # A shared instance of this class is used as the target of
- # all action messages from the NSViews of Components. It
- # performs the action by calling the similarly-named method of
- # the corresponding Component.
-
- def doAction_(self, ns_sender):
- self.call_method('do_action', ns_sender)
-
- def call_method(self, method_name, ns_sender):
- component = Globals._ns_view_to_component.get(ns_sender)
- if component:
- getattr(component, method_name)()
-
-_ns_action_target = PyGUI_NSActionTarget.alloc().init()
-
-def ns_set_action(ns_control, method_name):
- # Arrange for the 'action' message of the NSControl to
- # invoke the indicated method of its associated Component.
- ns_control.setAction_(method_name)
- ns_control.setTarget_(_ns_action_target)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NS_EventHandler:
- # Methods to be mixed in with NSView subclasses that are
- # to relay mouse and keyboard events to a Component.
- #
- # pygui_component Component
-
- def mouseDown_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseUp_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseDragged_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def rightMouseDown_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def rightMouseUp_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def rightMouseDragged_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def otherMouseDown_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def otherMouseUp_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def otherMouseDragged_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseMoved_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseEntered_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def mouseExited_(self, ns_event):
- self._ns_mouse_event(ns_event)
-
- def keyDown_(self, ns_event):
- #print "PyGUI_NS_EventHandler.keyDown_:", repr(ns_event.characters()), \
- # "for", object.__repr__(self) ###
- self._ns_other_event(ns_event)
-
- def keyUp_(self, ns_event):
- #print "PyGUI_NS_EventHandler.keyUp_ for", self ###
- self._ns_other_event(ns_event)
-
- def _ns_mouse_event(self, ns_event):
- #print "PyGUI_NS_EventHandler._ns_mouse_event" ###
- event = self._ns_mouse_event_to_event(ns_event)
- #print "...sending to", self.pygui_component ###
- component = self.pygui_component
- if component:
- component.handle_event_here(event)
-
- def _ns_mouse_event_to_event(self, ns_event):
- event = Event(ns_event)
- event.position = tuple(self._ns_event_position(ns_event))
- return event
-
- def _ns_event_position(self, ns_event):
- #print "PyGUI_NS_EventHandler._ns_event_position:", self ###
- #print "...mro =", self.__class__.__mro__ ###
- ns_win_pos = ns_event.locationInWindow()
- return self.convertPoint_fromView_(ns_win_pos, None)
-
- def _ns_other_event(self, ns_event):
- #print "PyGUI_NS_EventHandler._ns_other_event for", self ###
- event = Event(ns_event)
- component = self.pygui_component
- if component:
- #print "...passing", event.kind, "to", component ###
- component.handle_event(event)
-
- def acceptsFirstResponder(self):
- ###return True
- return self.pygui_component._ns_accept_first_responder
-
-# def canBecomeKeyView(self):
-# return self.pygui_component._tab_stop
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NS_ViewBase(PyGUI_NS_EventHandler):
- # Methods to be mixed in with PyGUI_NSView classes.
- #
- # pygui_component ViewBase
-
- __slots__ = ['tracking_rect']
-
-# tracking_rect = None
-
- def becomeFirstResponder(self):
- self.pygui_component.targeted()
- return True
-
- def resignFirstResponder(self):
- self.pygui_component.untargeted()
- return True
-
- def resetCursorRects(self):
- #print "PyGUI_NS_ViewBase: resetCursorRects" ###
- self.removeCursorRects()
- self.tracking_rect = self.addTrackingRect_owner_userData_assumeInside_(
- self.visibleRect(), self, 0, False)
- self.pygui_component._ns_reset_cursor_rects()
-
- def removeCursorRects(self):
- #print "PyGUI_NS_ViewBase: removeCursorRects" ###
- tag = getattr(self, 'tracking_rect', None)
- if tag:
- self.removeTrackingRect_(tag)
- self.tracking_rect = None
-
-#------------------------------------------------------------------------------
-
-def ns_size_to_fit(ns_control, padding = (0, 0), height = None):
- # Set size of control to fit its contents, plus the given padding.
- # Height may be overridden, because some controls don't seem to
- # calculate it properly.
- # Auto sizing can result in fractional sizes, which seems to cause
- # problems when NS autoresizing occurs later. So we round the size up
- # to whole numbers of pixels.
- ns_control.sizeToFit()
- w, h = ns_control.frame().size
- pw, ph = padding
- ns_control.setFrameSize_((ceil(w + pw), ceil((height or h) + ph)))
diff --git a/PyGUI-2.5.3/build/lib/GUI/Version.py b/PyGUI-2.5.3/build/lib/GUI/Version.py
deleted file mode 100644
index 326513e..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Version.py
+++ /dev/null
@@ -1 +0,0 @@
-version = '2.5.3'
diff --git a/PyGUI-2.5.3/build/lib/GUI/View.py b/PyGUI-2.5.3/build/lib/GUI/View.py
deleted file mode 100644
index 74a13e8..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/View.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# Python GUI - Views - PyObjC
-#
-
-from GUI import export
-from GUI.GViews import View as GView
-
-class View(GView):
-
- _ns_scrollable = False
-
-export(View)
diff --git a/PyGUI-2.5.3/build/lib/GUI/ViewBase.py b/PyGUI-2.5.3/build/lib/GUI/ViewBase.py
deleted file mode 100644
index 0cf6d05..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/ViewBase.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Python GUI - View Base - PyObjC
-#
-
-import Foundation
-import AppKit
-from GUI import Globals, export
-from GUI.Properties import overridable_property
-from GUI import Event
-from GUI.Utils import PyGUI_NS_EventHandler
-from GUI.GViewBases import ViewBase as GViewBase
-
-ns_tracking_mask = (
- AppKit.NSLeftMouseDraggedMask |
- AppKit.NSRightMouseDraggedMask |
- AppKit.NSOtherMouseDraggedMask |
- AppKit.NSLeftMouseUpMask |
- AppKit.NSRightMouseUpMask |
- AppKit.NSOtherMouseUpMask)
-
-# Need to use NSDefaultRunLoopMode here otherwise timers don't fire.
-ns_tracking_mode = Foundation.NSDefaultRunLoopMode # AppKit.NSEventTrackingRunLoopMode
-
-ns_distant_future = Foundation.NSDate.distantFuture()
-
-
-class ViewBase(GViewBase):
-
- def _change_container(self, new_container):
- self._ns_inner_view.removeCursorRects()
- super(ViewBase, self)._change_container(new_container)
-
- def _ns_track_mouse(self, ns_view):
- ns_app = Globals.ns_application
- tracking = True
- while tracking:
- ns_event = ns_app.nextEventMatchingMask_untilDate_inMode_dequeue_(
- ns_tracking_mask, ns_distant_future, ns_tracking_mode, True)
- event = ns_view._ns_mouse_event_to_event(ns_event)
- yield event
- tracking = event.kind <> 'mouse_up'
-
- def _cursor_changed(self):
- #print "ViewBase._cursor_changed:", self ###
- ns_view = self._ns_view
- ns_window = ns_view.window()
- if ns_window:
- # invalidateCursorRectsForView_ doesn't seem to trigger
- # resetCursorRects on the view.
- #ns_window.invalidateCursorRectsForView_(ns_view)
- ns_window.resetCursorRects()
-
- def _ns_reset_cursor_rects(self):
- #print "ViewBase._ns_reset_cursor_rects:", self ###
- cursor = self._cursor
- if cursor:
- ns_view = self._ns_inner_view
- ns_rect = ns_view.visibleRect()
- ns_view.addCursorRect_cursor_(ns_rect, cursor._ns_cursor)
-
-export(ViewBase)
diff --git a/PyGUI-2.5.3/build/lib/GUI/WGL.py b/PyGUI-2.5.3/build/lib/GUI/WGL.py
deleted file mode 100644
index de26d95..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/WGL.py
+++ /dev/null
@@ -1,22 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - WGL - Win32
-#
-#------------------------------------------------------------------------------
-
-from ctypes import *
-gdi32 = windll.gdi32
-
-def SetPixelFormat(hdc, ipf):
- gdi32.SetPixelFormat(hdc, ipf, None)
-
-def attr_array(d):
- a = []
- for k, v in d.iteritems():
- a.append(k)
- a.append(v)
- a.append(0)
- return a
-
-def attr_dict(keys, values):
- return dict(zip(keys, values))
diff --git a/PyGUI-2.5.3/build/lib/GUI/WinComboBox.py b/PyGUI-2.5.3/build/lib/GUI/WinComboBox.py
deleted file mode 100644
index 2cd9941..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/WinComboBox.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - ComboBox
-#
-#--------------------------------------------------------------------
-
-import win32ui as ui, win32con as wc, win32gui as gui
-
-class ComboBox(object):
-
- def __init__(self, parent, pos, size, style = wc.CBS_DROPDOWNLIST):
- parent_hwnd = parent.GetSafeHwnd()
- self.hwnd = gui.CreateWindow("COMBOBOX", "Blarg",
- wc.WS_CHILD | wc.CBS_DROPDOWNLIST,
- pos[0], pos[1], size[0], size[1],
- parent_hwnd, 0, 0, None)
- self.pycwnd = ui.CreateWindowFromHandle(self.hwnd)
- print "ComboBox: pycwnd =", self.pycwnd ###
-
- def __del__(self):
- gui.DestroyWindow(self.hwnd)
-
- def ShowWindow(self):
- gui.ShowWindow(self.hwnd, wc.SW_SHOW)
-
- def AddString(self, text):
- print "ComboBox: Adding string %r" % text ###
- gui.SendMessage(self.hwnd, wc.CB_ADDSTRING, 0, text)
-
-
-def CreateComboBox(parent, pos, size, style = wc.CBS_DROPDOWNLIST):
- parent_hwnd = parent.GetSafeHwnd()
- hwnd = gui.CreateWindow("COMBOBOX", "Blarg",
- wc.WS_CHILD | wc.CBS_DROPDOWNLIST,
- pos[0], pos[1], size[0], size[1],
- parent_hwnd, 0, 0, None)
- return ui.CreateWindowFromHandle(hwnd)
diff --git a/PyGUI-2.5.3/build/lib/GUI/WinEvents.py b/PyGUI-2.5.3/build/lib/GUI/WinEvents.py
deleted file mode 100644
index 70ab715..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/WinEvents.py
+++ /dev/null
@@ -1,109 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Event utilities - Win32
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32api as api, win32gui as gui, win32ui as ui
-from GUI import Event
-
-win_message_map = {
- wc.WM_KEYDOWN: ('key_down', None),
- wc.WM_KEYUP: ('key_up', None),
- wc.WM_SYSKEYDOWN: ('key_down', None),
- wc.WM_SYSKEYUP: ('key_up', None),
- wc.WM_MOUSEMOVE: ('mouse_move', None),
- wc.WM_LBUTTONDOWN: ('mouse_down', 'left'),
- wc.WM_LBUTTONDBLCLK: ('mouse_down', 'left'),
- wc.WM_LBUTTONUP: ('mouse_up', 'left'),
- wc.WM_MBUTTONDOWN: ('mouse_down', 'middle'),
- wc.WM_MBUTTONDBLCLK: ('mouse_down', 'middle'),
- wc.WM_MBUTTONUP: ('mouse_up', 'middle'),
- wc.WM_RBUTTONDOWN: ('mouse_down', 'right'),
- wc.WM_RBUTTONDBLCLK: ('mouse_down', 'right'),
- wc.WM_RBUTTONUP: ('mouse_up', 'right'),
-}
-
-win_special_keys = {
- 0x70: 'f1',
- 0x71: 'f2',
- 0x72: 'f3',
- 0x73: 'f4',
- 0x74: 'f5',
- 0x75: 'f6',
- 0x76: 'f7',
- 0x77: 'f8',
- 0x78: 'f9',
- 0x79: 'f10',
- 0x7a: 'f11',
- 0x7b: 'f12',
- 0x91: 'f14',
- 0x13: 'f15',
- #0x2d: 'help',
- 0x2d: 'insert',
- 0x2e: 'delete',
- 0x24: 'home',
- 0x23: 'end',
- 0x21: 'page_up',
- 0x22: 'page_down',
- 0x25: 'left_arrow',
- 0x27: 'right_arrow',
- 0x26: 'up_arrow',
- 0x28: 'down_arrow',
-}
-
-win_button_flags = wc.MK_LBUTTON | wc.MK_MBUTTON | wc.MK_RBUTTON
-win_prev_key_state = 1 << 30
-
-win_last_mouse_down = None
-win_dbl_time = gui.GetDoubleClickTime() / 1000.0 # 0.25
-win_dbl_xdist = api.GetSystemMetrics(wc.SM_CXDOUBLECLK)
-win_dbl_ydist = api.GetSystemMetrics(wc.SM_CYDOUBLECLK)
-
-def win_message_to_event(message, target = None):
- hwnd, msg, wParam, lParam, milliseconds, gpos = message
- kind, button = win_message_map[msg]
- time = milliseconds / 1000.0
- if kind == 'mouse_move' and wParam & win_button_flags <> 0:
- kind = 'mouse_drag'
- if target:
- lpos = target.global_to_local(gpos)
- else:
- lpos = gpos
- event = Event()
- event.kind = kind
- event.global_position = gpos
- event.position = lpos
- event.time = time
- event.button = button
- shift = api.GetKeyState(wc.VK_SHIFT) & 0x80 <> 0
- control = api.GetKeyState(wc.VK_CONTROL) & 0x80 <> 0
- option = api.GetKeyState(wc.VK_MENU) & 0x80 <> 0
- event.shift = event.extend_contig = shift
- event.control = event.extend_noncontig = control
- event.option = option
- vkey = None
- if kind == 'mouse_down':
- global win_last_mouse_down
- last = win_last_mouse_down
- if last and last.button == button and time - last.time <= win_dbl_time:
- x0, y0 = last.global_position
- x1, y1 = gpos
- if abs(x1 - x0) <= win_dbl_xdist and abs(y1 - y0) <= win_dbl_ydist:
- event.num_clicks = last.num_clicks + 1
- win_last_mouse_down = event
- elif kind == 'key_down' or kind == 'key_up':
- event.unichars = ui.TranslateVirtualKey(wParam)
- event.char = event.unichars.decode('ascii')
- event._keycode = wParam
- if wParam == 0x0d:
- if (lParam & 0x1000000):
- event.key = 'enter'
- else:
- event.key = 'return'
- else:
- event.key = win_special_keys.get(wParam) or event.char
- if kind == 'key_down':
- event.auto = lParam & win_prev_key_state <> 0
- return event
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/WinMenus.py b/PyGUI-2.5.3/build/lib/GUI/WinMenus.py
deleted file mode 100644
index c08c29d..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/WinMenus.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Menu utilities - Win32
-#
-#--------------------------------------------------------------------
-
-from weakref import WeakKeyDictionary, WeakValueDictionary
-import win32con as wc, win32ui as ui
-from GUI import application
-
-win_command_map = {}
-win_command_list = []
-
-def win_command_to_id(name, index = None):
- if index is not None:
- key = (name, index)
- else:
- key = name
- id = win_command_map.get(key)
- if not id:
- id = len(win_command_list) + 1
- win_command_map[key] = id
- win_command_list.append(key)
- application()._win_app.HookCommandUpdate(win_command_update, id)
- return id
-
-def win_command_update(cmd):
- win_menu = cmd.m_pMenu
- if win_menu:
- menu = win_get_menu_for_hmenu(win_menu.GetHandle())
- if menu:
- item = menu._get_flat_item(cmd.m_nIndex)
- cmd.Enable(item.enabled)
- cmd.SetCheck(bool(item.checked))
-
-def win_id_to_command(id):
- if 1 <= id <= len(win_command_list):
- return win_command_list[id - 1]
-
-win_hmenu_to_menubar = WeakValueDictionary()
-
-def win_get_menu_for_hmenu(hmenu):
- menubar = win_hmenu_to_menubar.get(hmenu)
- if menubar:
- return menubar.hmenu_to_menu.get(hmenu)
-
-#--------------------------------------------------------------------
-
-class MenuBar(object):
- # Wrapper around a PyCMenu
-
- def __init__(self):
- self.win_menu = ui.CreateMenu()
- self.hmenu_to_menu = {}
-
- def append_menu(self, menu):
- win_menu = menu._win_create_menu()
- hmenu = win_menu.Detach()
- self.win_menu.AppendMenu(wc.MF_POPUP | wc.MF_STRING, hmenu, menu.title)
- win_hmenu_to_menubar[hmenu] = self
- self.hmenu_to_menu[hmenu] = menu
-
diff --git a/PyGUI-2.5.3/build/lib/GUI/WinPageSetup.py b/PyGUI-2.5.3/build/lib/GUI/WinPageSetup.py
deleted file mode 100644
index 0c026ad..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/WinPageSetup.py
+++ /dev/null
@@ -1,168 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Win32 API - Page setup dialog
-#
-#------------------------------------------------------------------------------
-
-from ctypes import *
-from ctypes.wintypes import *
-
-comdlg32 = windll.comdlg32
-kernel32 = windll.kernel32
-
-CCHDEVICENAME = 32
-CCHFORMNAME = 32
-
-PSD_MARGINS = 0x2
-PSD_INTHOUSANDTHSOFINCHES = 0x4
-PSD_RETURNDEFAULT = 0x400
-
-LPPAGESETUPHOOK = c_void_p
-LPPAGEPAINTHOOK = c_void_p
-
-class PAGESETUPDLG(Structure):
- _fields_ = [
- ('lStructSize', DWORD),
- ('hwndOwner', HWND),
- ('hDevMode', HGLOBAL),
- ('hDevNames', HGLOBAL),
- ('Flags', DWORD),
- ('ptPaperSize', POINT),
- ('rtMinMargin', RECT),
- ('rtMargin', RECT),
- ('hInstance', HINSTANCE),
- ('lCustData', LPARAM),
- ('lpfnPageSetupHook', LPPAGESETUPHOOK),
- ('lpfnPagePaintHook', LPPAGEPAINTHOOK),
- ('lpPageSetupTemplateName', LPCSTR),
- ('hPageSetupTemplate', HGLOBAL),
- ]
-
- def __del__(self):
- print "PAGESETUPDLG.__del__" ###
- GlobalFree(self.hDevMode)
- GlobalFree(self.hDevNames)
-
-class DEVMODE(Structure):
- _fields_ = [
- ('dmDeviceName', c_char * CCHDEVICENAME),
- ('dmSpecVersion', WORD),
- ('dmDriverVersion', WORD),
- ('dmSize', WORD),
- ('dmDriverExtra', WORD),
- ('dmFields', DWORD),
- ('dmOrientation', c_short),
- ('dmPaperSize', c_short),
- ('dmPaperLength', c_short),
- ('dmPaperWidth', c_short),
- ('dmScale', c_short),
- ('dmCopies', c_short),
- ('dmDefaultSource', c_short),
- ('dmPrintQuality', c_short),
- ('dmColor', c_short),
- ('dmDuplex', c_short),
- ('dmYResolution', c_short),
- ('dmTTOption', c_short),
- ('dmCollate', c_short),
- ('dmFormName', c_char * CCHFORMNAME),
- ('dmLogPixels', WORD),
- ('dmBitsPerPel', DWORD),
- ('dmPelsWidth', DWORD),
- ('dmPelsHeight', DWORD),
- ('dmDisplayFlags', DWORD),
- ('dmDisplayFrequency', DWORD),
- ('dmICMMethod', DWORD),
- ('dmICMIntent', DWORD),
- ('dmMediaType', DWORD),
- ('dmDitherType', DWORD),
- ('dmReserved1', DWORD),
- ('dmReserved2', DWORD),
- ('dmPanningWidth', DWORD),
- ('dmPanningHeight', DWORD),
- ]
-
-class DEVNAMES(Structure):
- _fields_ = [
- ('wDriverOffset', WORD),
- ('wDeviceOffset', WORD),
- ('wOutputOffset', WORD),
- ('wDefault', WORD),
- ]
-
-_PageSetupDlg = comdlg32.PageSetupDlgA
-_PageSetupDlg.argtypes = [POINTER(PAGESETUPDLG)]
-
-GlobalAlloc = kernel32.GlobalAlloc
-GlobalAlloc.argtypes = [UINT, DWORD]
-
-GlobalSize = kernel32.GlobalSize
-GlobalSize.argtypes = [HGLOBAL]
-
-GlobalLock = kernel32.GlobalLock
-GlobalLock.argtypes = [HGLOBAL]
-
-GlobalUnlock = kernel32.GlobalUnlock
-GlobalUnlock.argtypes = [HGLOBAL]
-
-GlobalFree = kernel32.GlobalFree
-GlobalFree.argtypes = [HGLOBAL]
-
-def PageSetupDlg(psd):
- psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS
- return bool(_PageSetupDlg(psd))
-
-def get_handle_contents(h):
- n = GlobalSize(h)
- p = GlobalLock(h)
- data = string_at(p, n)
- GlobalUnlock(h)
- return data
-
-def handle_with_contents(data):
- n = len(data)
- h = GlobalAlloc(n)
- p = GlobalLock(h)
- memmove(p, data, n)
- GlobalUnlock(h)
- return h
-
-def lock_devmode_handle(h):
- p = c_void_p(GlobalLock(h))
- dmp = cast(p, POINTER(DEVMODE))
- return dmp[0]
-
-class DevNames(object):
-
- def __init__(self, hdevnames):
- a = GlobalLock(hdevnames)
- p = c_void_p(a)
- dnp = cast(p, POINTER(DEVNAMES))
- dn = dnp[0]
- self.driver = c_char_p(a + dn.wDriverOffset).value
- self.device = c_char_p(a + dn.wDeviceOffset).value
- self.output = c_char_p(a + dn.wOutputOffset).value
- self.default = dn.wDefault
- GlobalUnlock(hdevnames)
-
-def get_defaults():
- psd = PAGESETUPDLG()
- psd.lStructSize = sizeof(PAGESETUPDLG)
- psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_RETURNDEFAULT
- _PageSetupDlg(psd)
- return psd
-
-if __name__ == "__main__":
- def dump_psd(header, psd):
- print "%s:" % header, psd
- for name, _ in PAGESETUPDLG._fields_:
- print " %s = %r" % (name, getattr(psd, name))
- psd = PAGESETUPDLG()
- psd.lStructSize = sizeof(PAGESETUPDLG)
- dump_psd("Initial psd", psd)
- result = _PageSetupDlg(psd)
- print "Result:", result
- dump_psd("Final psd", psd)
- #print "DevMode:", repr(get_handle_contents(psd.hDevMode)[:sizeof(DEVMODE)])
- dm = lock_devmode_handle(psd.hDevMode)
- print "dmDeviceName:", dm.dmDeviceName
- #print "DevNames:", repr(get_handle_contents(psd.hDevNames))
diff --git a/PyGUI-2.5.3/build/lib/GUI/WinPrint.py b/PyGUI-2.5.3/build/lib/GUI/WinPrint.py
deleted file mode 100644
index 054bebe..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/WinPrint.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# PyGUI - Win32 API - Printing
-#
-#------------------------------------------------------------------------------
-
-from ctypes import *
-from ctypes.wintypes import *
-
-comdlg32 = windll.comdlg32
-gdi32 = windll.gdi32
-
-PD_ALLPAGES = 0x0
-PD_RETURNDC = 0x100
-
-LOGPIXELSX = 88
-LOGPIXELSY = 90
-PHYSICALOFFSETX = 112
-PHYSICALOFFSETY = 113
-
-LPDWORD = POINTER(DWORD)
-LPHANDLE = POINTER(HANDLE)
-LPPOINT = POINTER(POINT)
-LPPRINTHOOKPROC = c_void_p
-LPSETUPHOOKPROC = c_void_p
-ABORTPROC = CFUNCTYPE(c_int, HDC, c_int)
-LPPRINTER_DEFAULTS = c_void_p
-
-class PRINTDLG(Structure):
-
- _pack_ = 2
- _fields_ = [
- ('lStructSize', DWORD),
- ('hwndOwner', HWND),
- ('hDevMode', HGLOBAL),
- ('hDevNames', HGLOBAL),
- ('hDC', HDC),
- ('Flags', DWORD),
- ('nFromPage', WORD),
- ('nToPage', WORD),
- ('nMinPage', WORD),
- ('nMaxPage', WORD),
- ('nCopies', WORD),
- ('hInstance', HINSTANCE),
- ('lCustData', LPARAM),
- ('lpfnPrintHook', LPPRINTHOOKPROC),
- ('lpfnSetupHook', LPSETUPHOOKPROC),
- ('lpPrintTemplateName', LPCSTR),
- ('lpSetupTemplateName', LPCSTR),
- ('hPrintTemplate', HGLOBAL),
- ('hSetupTemplate', HGLOBAL),
- ]
-
- def __init__(self):
- self.lStructSize = sizeof(PRINTDLG)
-
-class DOCINFO(Structure):
-
- _fields_ = [
- ('cbSize', c_int),
- ('lpszDocName', LPCSTR),
- ('lpszOutput', LPCSTR),
- ('lpszDatatype', LPCSTR),
- ('fwType', DWORD),
- ]
-
- def __init__(self):
- self.cbSize = sizeof(DOCINFO)
-
-class FORM_INFO_1_W(Structure):
-
- _fields_ = [
- ('Flags', DWORD),
- ('pName', LPWSTR),
- ('Size', SIZEL),
- ('ImageableArea', RECTL),
- ]
-
-_PrintDlg = comdlg32.PrintDlgA
-_PrintDlg.argtypes = [POINTER(PRINTDLG)]
-
-SetAbortProc = gdi32.SetAbortProc
-SetAbortProc.argtypes = [HDC, ABORTPROC]
-
-StartDoc = gdi32.StartDocA
-StartDoc.argtypes = [HDC, POINTER(DOCINFO)]
-
-StartPage = gdi32.StartPage
-StartPage.argtypes = [HDC]
-
-EndPage = gdi32.EndPage
-EndPage.argtypes = [HDC]
-
-EndDoc = gdi32.EndDoc
-EndDoc.argtypes = [HDC]
-
-DeleteDC = gdi32.DeleteDC
-DeleteDC.argtypes = [HDC]
-
-CommDlgExtendedError = comdlg32.CommDlgExtendedError
-CommDlgExtendedError.argtypes = []
-
-def PrintDlg(pd):
- pd.nFromPage = pd.nMinPage
- pd.nToPage = pd.nMaxPage
- pd.Flags = PD_RETURNDC
- #if pd.nMaxPage > pd.nMinPage:
- # pd.Flags |= PD_PAGENUMS
- result = _PrintDlg(pd)
- if result == 0:
- err = CommDlgExtendedError()
- if err <> 0:
- raise EnvironmentError("Common Dialog error %s" % err)
- return bool(result)
-
-def GetPrintingOffset(hdc):
- dpix = gdi32.GetDeviceCaps(hdc, LOGPIXELSX)
- dpiy = gdi32.GetDeviceCaps(hdc, LOGPIXELSY)
- offx = gdi32.GetDeviceCaps(hdc, PHYSICALOFFSETX)
- offy = gdi32.GetDeviceCaps(hdc, PHYSICALOFFSETY)
- return 72.0 * offx / dpix, 72.0 * offy / dpiy
-
-def abort_proc(hdc, err):
- return printing_aborted
-
-def install_abort_proc(hdc):
- global printing_aborted
- printing_aborted = False
- SetAbortProc(hdc, ABORTPROC(abort_proc))
diff --git a/PyGUI-2.5.3/build/lib/GUI/WinUtils.py b/PyGUI-2.5.3/build/lib/GUI/WinUtils.py
deleted file mode 100644
index eb28d2f..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/WinUtils.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Win32 - Utilities
-#
-#--------------------------------------------------------------------
-
-import win32con as wc, win32ui as ui, win32gui as gui, win32api as api
-from win32api import HIWORD, LOWORD
-from GUI import application
-from GUI.Exceptions import Cancel, InternalError
-
-win_dlog_class = "#32770"
-win_color3dhilight = api.GetSysColor(wc.COLOR_3DHILIGHT)
-win_color3dlight = api.GetSysColor(wc.COLOR_3DLIGHT)
-win_color3dface = api.GetSysColor(wc.COLOR_3DFACE)
-win_color3dshadow = api.GetSysColor(wc.COLOR_3DSHADOW)
-win_menubar_height = api.GetSystemMetrics(wc.SM_CYMENU)
-win_bg_color = api.GetSysColor(wc.COLOR_3DFACE)
-win_screen_width = api.GetSystemMetrics(wc.SM_CXFULLSCREEN)
-win_screen_height = api.GetSystemMetrics(wc.SM_CYFULLSCREEN)
-win_screen_rect = (0, 0, win_screen_width, win_screen_height)
-
-#win_bg_brush = ui.CreateBrush(wc.BS_SOLID, win_color3dface, 0)
-#win_bg_hbrush = win_bg_brush.GetSafeHandle()
-
-# An empty brush for not painting anything with
-win_null_brush = ui.CreateBrush(wc.BS_NULL, 0, 0)
-win_null_hbrush = win_null_brush.GetSafeHandle()
-
-# All components hook the following messages
-
-win_event_messages = (
- wc.WM_KEYDOWN, wc.WM_KEYUP,
- wc.WM_SYSKEYDOWN, wc.WM_SYSKEYUP,
- wc.WM_MOUSEMOVE,
- wc.WM_LBUTTONDOWN, wc.WM_LBUTTONDBLCLK, wc.WM_LBUTTONUP,
- wc.WM_MBUTTONDOWN, wc.WM_MBUTTONDBLCLK, wc.WM_MBUTTONUP,
- wc.WM_RBUTTONDOWN, wc.WM_RBUTTONDBLCLK, wc.WM_RBUTTONUP,
- #wc.WM_MOUSELEAVE,
-)
-
-# Dummy CWnd for use as parent of containerless components.
-# Also used as the main frame of the CWinApp.
-
-win_none = ui.CreateFrame()
-win_none.CreateWindow(None, "", 0, (0, 0, 10, 10))
-
-win_plain = ui.CreateWnd()
-win_plain.CreateWindow(None, None, 0, (0, 0, 10, 10), win_none, 0)
-win_plain_class = gui.GetClassName(win_plain.GetSafeHwnd())
-
-#--------------------------------------------------------------------
-
-win_command_map = {
- 0: '_win_bn_clicked', # BN_CLICKED
- wc.CBN_SELCHANGE: '_cbn_sel_change',
-}
-
-class WinMessageReflector(object):
-
- def _win_install_event_hooks(self, win):
- win.HookMessage(self._win_wm_scroll, wc.WM_HSCROLL)
- win.HookMessage(self._win_wm_scroll, wc.WM_VSCROLL)
-
-#
-# Disabled for now because overriding control colours
-# doesn't seem to work properly on XP.
-#
-# def OnCtlColor(self, dc, comp, typ):
-# #print "WinMessageReflector.OnCtlColor" ###
-# meth = getattr(comp, '_win_on_ctlcolor', None)
-# if meth:
-# return meth(dc, typ)
-
- def _win_wm_scroll(self, message):
- #print "WinMessageReflector._win_wm_scroll:", self, message ###
- wParam = message[2]
- code = wParam & 0xffff
- lParam = message[3]
- self._forward_reflected_message(lParam, '_win_wm_scroll', code)
-
- def OnCommand(self, wParam, lParam):
- #print "WinMessageReflector.OnCommand: code = 0x%04x 0x%04x lParam = 0x%08x" % (
- # HIWORD(wParam), LOWORD(wParam), lParam)
- try:
- code = HIWORD(wParam)
- id = LOWORD(wParam)
- if id:
- self._win_menu_command(id)
- else:
- name = win_command_map.get(code)
- if name:
- self._forward_reflected_message(lParam, name)
- except Cancel:
- pass
- except:
- application().report_error()
-
- def _forward_reflected_message(self, lParam, method_name, *args):
- wnd = ui.CreateWindowFromHandle(lParam)
- meth = getattr(wnd, method_name, None)
- if meth:
- meth(*args)
-
- def _win_menu_command(self, id):
- raise InternalError("_win_menu_command called on non-window: %r" % self)
-
-win_none_wrapper = WinMessageReflector()
-win_none_wrapper._win = win_none
-win_none_wrapper._win_install_event_hooks(win_none)
-win_none.AttachObject(win_none_wrapper)
-
-#--------------------------------------------------------------------
-#
-# Debugging routines
-#
-
-win_message_names = {}
-
-win_exclude_names = ["WM_MOUSEFIRST"]
-
-for name, value in wc.__dict__.iteritems():
- if name.startswith("WM_") and name not in win_exclude_names:
- win_message_names[value] = name
-
-def win_message_name(num):
- return win_message_names.get(num) or num
-
-def dump_flags(flags):
- for name in wc.__dict__.iterkeys():
- if name.startswith("WS_") and not name.startswith("WS_EX"):
- value = wc.__dict__[name]
- if flags & value:
- print "%20s = 0x%08x" % (name, value & 0xffffffffL)
-
-def win_deconstruct_style(flags):
- win_do_deconstruct_style(flags, "WS_", "WS_EX_")
-
-def win_deconstruct_style_ex(flags):
- win_do_deconstruct_style(flags, "WS_EX_")
-
-def win_do_deconstruct_style(flags, prefix, not_prefix = None):
- d = wc.__dict__
- for name in d.iterkeys():
- if name.startswith(prefix):
- if not not_prefix or not name.startswith(not_prefix):
- value = d[name]
- if value and flags & value == value:
- print "%25s 0x%08x" % (name, value)
diff --git a/PyGUI-2.5.3/build/lib/GUI/Window.py b/PyGUI-2.5.3/build/lib/GUI/Window.py
deleted file mode 100644
index 62d4037..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/Window.py
+++ /dev/null
@@ -1,292 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Python GUI - Windows - PyObjC version
-#
-#------------------------------------------------------------------------------
-
-from Foundation import NSRect, NSPoint, NSSize, NSObject
-import AppKit
-from AppKit import NSWindow, NSScreen, NSTextView, NSMenu
-from GUI import export
-from GUI import Globals
-from GUI.Utils import NSMultiClass, PyGUI_NS_EventHandler, PyGUI_Flipped_NSView
-from GUI import application
-from GUI import Event
-from GUI.GWindows import Window as GWindow
-
-_default_options_for_style = {
- 'standard':
- {'movable': 1, 'closable': 1, 'hidable': 1, 'resizable': 1},
- 'nonmodal_dialog':
- {'movable': 1, 'closable': 0, 'hidable': 1, 'resizable': 0},
- 'modal_dialog':
- {'movable': 1, 'closable': 0, 'hidable': 0, 'resizable': 0},
- 'alert':
- {'movable': 1, 'closable': 0, 'hidable': 0, 'resizable': 0},
- 'fullscreen':
- {'movable': 0, 'closable': 0, 'hidable': 0, 'resizable': 0},
- #{'movable': 1, 'closable': 1, 'hidable': 1, 'resizable': 1},
-}
-
-#------------------------------------------------------------------------------
-
-class Window(GWindow):
- # _ns_window PyGUI_NSWindow
- # _ns_style_mask int
-
- def __init__(self, style = 'standard', zoomable = None, **kwds):
- # We ignore zoomable, since it's the same as resizable.
- self._style = style
- options = dict(_default_options_for_style[style])
- for option in ['movable', 'closable', 'hidable', 'resizable']:
- if option in kwds:
- options[option] = kwds.pop(option)
- self._ns_style_mask = self._ns_window_style_mask(**options)
- if style == 'fullscreen':
- ns_rect = NSScreen.mainScreen().frame()
- else:
- ns_rect = NSRect(NSPoint(0, 0), NSSize(self._default_width, self._default_height))
- ns_window = PyGUI_NSWindow.alloc()
- ns_window.initWithContentRect_styleMask_backing_defer_(
- ns_rect, self._ns_style_mask, AppKit.NSBackingStoreBuffered, True)
- ns_content = PyGUI_NS_ContentView.alloc()
- ns_content.initWithFrame_(NSRect(NSPoint(0, 0), NSSize(0, 0)))
- ns_content.pygui_component = self
- ns_window.setContentView_(ns_content)
- ns_window.setAcceptsMouseMovedEvents_(True)
- ns_window.setDelegate_(ns_window)
- ns_window.pygui_component = self
- self._ns_window = ns_window
- GWindow.__init__(self, style = style, closable = options['closable'],
- _ns_view = ns_window.contentView(), _ns_responder = ns_window,
- _ns_set_autoresizing_mask = False,
- **kwds)
-
- def _ns_window_style_mask(self, movable, closable, hidable, resizable):
- if movable or closable or hidable or resizable:
- mask = AppKit.NSTitledWindowMask
- if closable:
- mask |= AppKit.NSClosableWindowMask
- if hidable:
- mask |= AppKit.NSMiniaturizableWindowMask
- if resizable:
- mask |= AppKit.NSResizableWindowMask
- else:
- mask = AppKit.NSBorderlessWindowMask
- return mask
-
- def destroy(self):
- #print "Window.destroy:", self ###
- self.hide()
- app = application()
- if app._ns_key_window is self:
- app._ns_key_window = None
- GWindow.destroy(self)
- # We can't drop all references to the NSWindow yet, because this method
- # can be called from its windowShouldClose: method, and allowing an
- # NSWindow to be released while executing one of its own methods seems
- # to be a very bad idea (Cocoa hangs). So we hide the NSWindow and store
- # a reference to it in a global. It will be released the next time a
- # window is closed and the global is re-used.
- global _ns_zombie_window
- _ns_zombie_window = self._ns_window
- self._ns_window.pygui_component = None
- #self._ns_window = None
-
- def get_bounds(self):
- ns_window = self._ns_window
- ns_frame = ns_window.frame()
- (l, y), (w, h) = ns_window.contentRectForFrameRect_styleMask_(
- ns_frame, self._ns_style_mask)
- b = Globals.ns_screen_height - y
- result = (l, b - h, l + w, b)
- return result
-
- def set_bounds(self, (l, t, r, b)):
- y = Globals.ns_screen_height - b
- ns_rect = NSRect(NSPoint(l, y), NSSize(r - l, b - t))
- ns_window = self._ns_window
- ns_frame = ns_window.frameRectForContentRect_styleMask_(
- ns_rect, self._ns_style_mask)
- ns_window.setFrame_display_(ns_frame, False)
-
- def get_title(self):
- return self._ns_window.title()
-
- def set_title(self, v):
- self._ns_window.setTitle_(v)
-
- def get_visible(self):
- return self._ns_window.isVisible()
-
- def set_visible(self, v):
- # At some mysterious time between creating a window and showing
- # it for the first time, Cocoa adjusts its position so that it
- # doesn't extend above the menu bar. This is a nuisance for
- # our fullscreen windows, so we need to readjust the position
- # before showing.
- if v:
- if self._style == 'fullscreen':
- self._ns_window.setFrameOrigin_(NSPoint(0, 0))
- self._ns_window.orderFront_(None)
- else:
- self._ns_window.orderOut_(None)
-
- def _show(self):
- self.visible = True
- self._ns_window.makeKeyWindow()
-
- def get_target(self):
- ns_window = self._ns_window
- ns_view = ns_window.firstResponder()
- while ns_view and ns_view is not ns_window:
- component = Globals._ns_view_to_component.get(ns_view)
- if component:
- return component
- ns_view = ns_view.superview()
- return self
-
- def center(self):
- self._ns_window.center()
-
- def _stagger(self):
- key_win = application()._ns_key_window
- if key_win:
- (x, y), (w, h) = key_win._ns_window.frame()
- p = self._ns_window.cascadeTopLeftFromPoint_(NSPoint(x, y + h))
- self._ns_window.setFrameTopLeftPoint_(p)
- else:
- (x, y), (w, h) = NSScreen.mainScreen().visibleFrame()
- ns_vis_topleft = NSPoint(x, y + h)
- self._ns_window.setFrameTopLeftPoint_(ns_vis_topleft)
-
- def _document_needs_saving(self, state):
- self._ns_window.setDocumentEdited_(state)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NSWindow(NSWindow, PyGUI_NS_EventHandler):
- # pygui_component Window
- # resize_delta point or None
-
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component', 'resize_delta', 'pygui_field_editor']
-
-# pygui_component = None
-# resize_delta = None
-# pygui_field_editor = None
-
- def _ns_event_position(self, ns_event):
- return ns_event.locationInWindow()
-
- def windowShouldClose_(self, sender):
- # We use this to detect when the Aqua window closing button
- # is pressed, and do the closing ourselves.
- self.pygui_component.close_cmd()
- return False
-
- # The NSWindow is made its own delegate.
-
- def windowWillResize_toSize_(self, ns_win, new_ns_size):
- w0, h0 = self.frame().size
- w1, h1 = new_ns_size
- self.resize_delta = (w1 - w0, h1 - h0)
- return new_ns_size
-
- def windowDidResize_(self, notification):
- delta = getattr(self, 'resize_delta', None)
- if delta:
- self.pygui_component._resized(delta)
- self.resize_delta = None
-
- def windowDidBecomeKey_(self, notification):
- app = application()
- app._ns_key_window = self.pygui_component
- app._update_menubar()
-
- def windowDidResignKey_(self, notification):
- app = application()
- app._ns_key_window = None
- app._update_menubar()
-
- def windowWillReturnFieldEditor_toObject_(self, ns_window, ns_obj):
- # Return special field editor for newline handling in text fields.
- #print "Window: Field editor requested for", object.__repr__(ns_obj) ###
- #editor = self.pygui_field_editor
- #if not editor:
- try:
- editor = self.pygui_field_editor
- except AttributeError:
- #print "...creating new field editor" ###
- editor = PyGUI_FieldEditor.alloc().initWithFrame_(
- NSRect(NSPoint(0, 0), NSSize(0, 0)))
- editor.setFieldEditor_(True)
- editor.setDrawsBackground_(False)
- self.pygui_field_editor = editor
- return editor
-
- # Need the following two methods so that a fullscreen window can become
- # the main window. Otherwise it can't, because it has no title bar.
-
- def canBecomeKeyWindow(self):
- return self.isVisible()
-
- def canBecomeMainWindow(self):
- #print "PyGUI_NSWindow.canBecomeMainWindow"
- return self.isVisible()
-
- def windowDidBecomeMain_(self, notification):
- #print "PyGUI_NSWindow.windowDidBecomeMain_:", self.pygui_component.title ###
- comp = self.pygui_component
- if comp and comp._style == 'fullscreen':
- #print "...hiding menu bar" ###
- NSMenu.setMenuBarVisible_(False)
- #self.setFrameOrigin_(NSPoint(0, 0))
-
- def windowDidResignMain_(self, notification):
- #print "PyGUI_NSWindow.windowDidResignMain_:", self.pygui_component.title ###
- comp = self.pygui_component
- if comp and comp._style == 'fullscreen':
- #print "...showing menu bar" ###
- NSMenu.setMenuBarVisible_(True)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_NS_ContentView(PyGUI_Flipped_NSView, PyGUI_NS_EventHandler):
- # pygui_component Window
-
- __metaclass__ = NSMultiClass
- __slots__ = ['pygui_component']
-
- def acceptsFirstResponder(self):
- return False
-
-#------------------------------------------------------------------------------
-
-class PyGUI_FieldEditorBase(NSTextView):
- # Special field editor for use by TextFields. Intercepts
- # return key events and handles them our own way.
-
- def keyDown_(self, ns_event):
- #print "PyGUI_FieldEditorBase.keyDown_ for", self.pygui_component ###
- if ns_event.characters() == "\r":
- if self.pygui_component._multiline:
- self.insertText_("\n")
- return
- NSTextView.keyDown_(self, ns_event)
-
-#------------------------------------------------------------------------------
-
-class PyGUI_FieldEditor(PyGUI_FieldEditorBase, PyGUI_NS_EventHandler):
-
- __metaclass__ = NSMultiClass
-
- def get_pygui_component(self):
- pygui_nstextfield = self.superview().superview()
- component = pygui_nstextfield.pygui_component
- component._ns_responder = self
- return component
-
- pygui_component = property(get_pygui_component)
-
-export(Window)
diff --git a/PyGUI-2.5.3/build/lib/GUI/__init__.py b/PyGUI-2.5.3/build/lib/GUI/__init__.py
deleted file mode 100644
index 5dc533b..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/__init__.py
+++ /dev/null
@@ -1,94 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Top level package initialisation
-#
-#--------------------------------------------------------------------
-
-import sys, types
-
-# The first item of each of the following pairs is the name of a module
-# to try to import. If the import is successful, the platform-dependent
-# directory named by the second item is used.
-
-_versions = [
- ("objc", "Cocoa"),
- ("nt", "Win32"),
- ("gi.repository.Gtk", "GtkGI"),
- ("gtk", "Gtk"),
-]
-
-#
-# The following function exports a class or function from a submodule in
-# such a way that it appears to have been defined directly at the top
-# level of the package. By giving the submodule that defines the class the
-# same name as the class, this provides an autoloading facility that is
-# friendly to application bundling tools.
-#
-
-_preserve = [] # Keeps references to replaced modules so they aren't cleared
-
-def export(obj):
- qname = "%s.%s" % (__name__, obj.__name__)
- obj.__module__ = __name__
- mod = sys.modules[qname]
- _preserve.append(mod)
- sys.modules[qname] = obj
-
-#
-# The environment variable PYGUI_IMPLEMENTATION may be set to the
-# name of one of the platform-dependent directories to force that
-# implementation to be used. This can be useful if more than one
-# PyGUI implementation is usable on your setup.
-#
-
-from os import environ as _env
-_platdir = _env.get("PYGUI_IMPLEMENTATION")
-if not _platdir:
- for _testmod, _platdir in _versions:
- try:
- __import__(_testmod)
- break
- except ImportError:
- continue
- else:
- raise ImportError("Unable to find an implementation of PyGUI for this installation")
-
-if _env.get("PYGUI_IMPLEMENTATION_DEBUG"):
- sys.stderr.write("PyGUI: Using implementation: %s\n" % _platdir)
-
-#
-# Append the chosen platform-dependent directory to the search
-# path for submodules of this package.
-#
-
-from os.path import join as _join
-_here = __path__[0]
-__path__.append(_join(_here, _platdir))
-__path__.append(_join(_here, "Generic"))
-
-#
-# Import global functions
-#
-
-from GUI.Globals import application, run
-from GUI.Colors import rgb
-
-#
-# Set up initial resource search path
-#
-
-from GUI import Resources
-Resources._add_file_path(__file__)
-_main_dir = sys.path[0]
-Resources._add_directory_path(_main_dir)
-Resources._add_directory_path(_main_dir, 1)
-#import __main__
-#Resources._add_module_path(__main__)
-#Resources._add_module_path(__main__, 1)
-#print "GUI: resource_path =", Resources.resource_path ###
-
-#
-# Perform global initialisation
-#
-
-import GUI.Application
diff --git a/PyGUI-2.5.3/build/lib/GUI/py2exe.py b/PyGUI-2.5.3/build/lib/GUI/py2exe.py
deleted file mode 100644
index 8c6541b..0000000
--- a/PyGUI-2.5.3/build/lib/GUI/py2exe.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#--------------------------------------------------------------------
-#
-# PyGUI - Fix py2exe to handle dynamic pywin32 module search paths
-#
-#--------------------------------------------------------------------
-
-import sys
-
-# py2exe 0.6.4 introduced a replacement modulefinder.
-# This means we have to add package paths there, not to the built-in
-# one. If this new modulefinder gets integrated into Python, then
-# we might be able to revert this some day.
-# if this doesn't work, try import modulefinder
-try:
- import py2exe.mf as modulefinder
-except ImportError:
- import modulefinder
-import win32com
-for p in win32com.__path__[1:]:
- modulefinder.AddPackagePath("win32com", p)
-for extra in ["win32com.shell"]: #,"win32com.mapi"
- __import__(extra)
- m = sys.modules[extra]
- for p in m.__path__[1:]:
- modulefinder.AddPackagePath(extra, p)
diff --git a/PyGUI-2.5.3/distutils_extensions.py b/PyGUI-2.5.3/distutils_extensions.py
deleted file mode 100644
index 093d038..0000000
--- a/PyGUI-2.5.3/distutils_extensions.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#------------------------------------------------------------------------
-#
-# PyGUI - Distutils hackery
-#
-#------------------------------------------------------------------------
-
-import os, sys
-from glob import glob
-from distutils.dist import Distribution
-
-if sys.version_info >= (3, 0):
- try:
- from distutils.command.build_py import build_py_2to3 as build_py
- except ImportError:
- raise ImportError("build_py_2to3 not found in distutils - it is required for Python 3.x")
-else:
- from distutils.command.build_py import build_py
-
-#------------------------------------------------------------------------
-
-class pygui_build_py(build_py):
- """
- An extension of the distutils build_py command that supports
- gathering .py files for a package from multiple source directories.
-
- It provides a new option 'package_subdirs' that is a mapping from
- a package name to a list of directory paths:
-
- package_subdirs = {'package_name': ['source_dir', ...], ...}
-
- The directory paths are interpreted relative to the primary source
- directory for the package. In addition to .py files from the primary
- source directory, any .py files from the specified directories will be
- copied into the package during installation.
- """
-
- Distribution.package_subdirs = {}
-
- def initialize_options(self):
- build_py.initialize_options(self)
- self.package_subdirs = {}
-
- def finalize_options(self):
- build_py.finalize_options(self)
- self.package_subdirs = self.distribution.package_subdirs
-
- def find_package_modules(self, package, package_dir):
- #print "distutils_extensions: Searching subdirectories of package", repr(package) ###
- modules = build_py.find_package_modules(self, package, package_dir)
- subdirs = self.package_subdirs.get(package, ())
- for subdir in subdirs:
- #print "Looking in subdir", repr(subdir), "of", repr(package_dir) ###
- module_files = glob(os.path.join(package_dir, subdir, "*.py"))
- for f in module_files:
- module = os.path.splitext(os.path.basename(f))[0]
- #print "Found module", repr(module), "in", repr(f) ###
- modules.append((package, module, f))
- return modules
diff --git a/PyGUI-2.5.3/distutils_extensions.pyc b/PyGUI-2.5.3/distutils_extensions.pyc
deleted file mode 100644
index 15bb45e..0000000
Binary files a/PyGUI-2.5.3/distutils_extensions.pyc and /dev/null differ
diff --git a/PyGUI-2.5.3/setup.cfg b/PyGUI-2.5.3/setup.cfg
deleted file mode 100755
index c030aad..0000000
--- a/PyGUI-2.5.3/setup.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-[build]
-force=1
-[bdist_wininst]
-user_access_control=auto
-
diff --git a/PyGUI-2.5.3/setup.py b/PyGUI-2.5.3/setup.py
deleted file mode 100755
index c0b2bb9..0000000
--- a/PyGUI-2.5.3/setup.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#-------------------------------------------------------------------------
-#
-# PyGUI - Distutils Setup Script
-#
-#-------------------------------------------------------------------------
-
-import os, sys
-from glob import glob
-from distutils.core import setup
-#from distutils.extension import Extension
-from distutils.sysconfig import get_python_lib
-from distutils_extensions import pygui_build_py
-
-#
-# PyPI Classifiers
-#
-
-CLASSIFIERS = """\
-Development Status :: 3 - Alpha
-Environment :: MacOS X :: Cocoa
-Environment :: Win32 (MS Windows)
-Environment :: X11 Applications :: GTK
-Intended Audience :: Developers
-Operating System :: MacOS :: MacOS X
-Operating System :: POSIX :: Linux
-Operating System :: Microsoft :: Windows
-Programming Language :: Python
-Topic :: Software Development :: User Interfaces
-""" #Programming Language :: Python :: 3
-
-#
-# Python 3 Conversion
-#
-
-if sys.version_info >= (3,0): #automatically convert to Python 3 syntax while installing
-# #build_py_2to3 now imported in distutils_extensions
-# try:
-# from distutils.command.build_py import build_py_2to3 as build_py
-# except ImportError:
-# raise ImportError("build_py_2to3 not found in distutils - it is required for Python 3.x")
-## # exclude fixers that break already compatible code
-## from lib2to3.refactor import get_fixers_from_package
-## fixers = get_fixers_from_package('lib2to3.fixes')
-## for skip_fixer in ['import']:
-## fixers.remove('lib2to3.fixes.fix_' + skip_fixer)
-## build_py.fixer_names = fixers
- print('Installing for Python3')
-# else: # install Python 2.x version
-# from distutils.command.build_py import build_py
-
-#
-# Installation parameters
-#
-
-cmd_class = {'build_py': pygui_build_py}
-ext_modules = []
-
-version = ''
-version_file = os.path.join("GUI", "Version.py")
-# get accurate version sring by running Version.py
-exec(compile(open(version_file,'r').read(), version_file, 'exec'))
-
-#
-# Find which implementation to install
-#
-
-plat = sys.platform
-if plat.startswith("darwin"):
- platdir = "Cocoa"
-elif plat.startswith("linux"):
- platdir = "Gtk"
-elif plat.startswith("win"):
- platdir = "Win32"
-else:
- sys.stderr.write(
- "Don't know which backend to install for platform '%s'.\n"
- % plat)
- sys.exit(1)
-
-sys.stdout.write("Installing backend %s\n" % platdir)
-
-#
-# Pyrex
-#
-
-#have_pyrex = 0
-
-#try:
-# import Pyrex.Distutils
-# print "Pyrex available"
-# have_pyrex = 1
-# cmdclass = {'build_ext': Pyrex.Distutils.build_ext}
-#except ImportError:
-# pass
-
-#if sys.platform == "darwin":
-# if have_pyrex:
-# agl_source = "GUI/Mac/AGL.pyx"
-# else:
-# agl_source = "GUI/Mac/AGL.c"
-# agl_module = Extension("GUI.Mac.AGL", [agl_source],
-# include_dirs = ["/System/Library/Frameworks/AGL.framework/Headers"],
-# extra_link_args = ["-Wl,-w", "-framework", "AGL", "-framework", "Carbon"])
-# ext_modules.append(agl_module)
-
-#
-# Setup
-#
-
-setup(
- cmdclass = cmd_class,
- name = "PyGUI",
- version = version,
- description = "Pythonic Cross-Platform GUI Framework",
- author = "Gregory Ewing",
- author_email = "greg.ewing@canterbury.ac.nz",
- url = "http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui",
- #download_url=DOWNLOAD_URL,
- long_description = open('README.txt').read(),
- platforms = ["Linux", "MacOS X", "Windows"],
- packages = ["GUI"],
- package_subdirs = {"GUI": ["Generic", platdir]},
- package_data = {"GUI": [os.path.join("Resources", "*", "*")]},
- ext_modules = ext_modules,
- #maintainer=MAINTAINER,
- #maintainer_email=MAINTAINER_EMAIL,
- keywords = 'GUI Cross-Platform',
- license = 'This is free software. You are welcome to use it however you want.'
-)