[PD-cvs] SF.net SVN: pure-data: [9396] tags/extensions
zmoelnig at users.sourceforge.net
zmoelnig at users.sourceforge.net
Fri Feb 8 13:46:05 CET 2008
Revision: 9396
http://pure-data.svn.sourceforge.net/pure-data/?rev=9396&view=rev
Author: zmoelnig
Date: 2008-02-08 04:46:04 -0800 (Fri, 08 Feb 2008)
Log Message:
-----------
reorganized
Added Paths:
-----------
tags/extensions/gripd-0.1.1/
tags/extensions/gripd-0.1.1/.xvpics/
tags/extensions/gripd-0.1.1/README.txt
tags/extensions/gripd-0.1.1/connect.xpm
tags/extensions/gripd-0.1.1/connectX.xpm
tags/extensions/gripd-0.1.1/examples/
tags/extensions/gripd-0.1.1/gripd
tags/extensions/gripd-0.1.1/gripd.opt
tags/extensions/gripd-0.1.1/gripd.py
tags/extensions/gripd-0.1.1/gripd.spec
tags/extensions/gripd-0.1.1/gripdControls.py
tags/extensions/gripd-0.1.1/gripdFunctions.py
tags/extensions/gripd-0.1.1/gripdMain.py
tags/extensions/gripd-0.1.1/icon.pic
tags/extensions/gripd-0.1.1/joystick.xpm
tags/extensions/gripd-0.1.1/joystickA.xpm
tags/extensions/gripd-0.1.1/joystickX.xpm
tags/extensions/gripd-0.1.1/log.txt
tags/extensions/gripd-0.1.1/midi.xpm
tags/extensions/gripd-0.1.1/midiA.xpm
tags/extensions/gripd-0.1.1/midiX.xpm
tags/extensions/gripd-0.1.1/src/
Removed Paths:
-------------
tags/extensions/gripd-0.1.1/.xvpics/
tags/extensions/gripd-0.1.1/README.txt
tags/extensions/gripd-0.1.1/connect.xpm
tags/extensions/gripd-0.1.1/connectX.xpm
tags/extensions/gripd-0.1.1/examples/
tags/extensions/gripd-0.1.1/gripd
tags/extensions/gripd-0.1.1/gripd.opt
tags/extensions/gripd-0.1.1/gripd.py
tags/extensions/gripd-0.1.1/gripd.spec
tags/extensions/gripd-0.1.1/gripdControls.py
tags/extensions/gripd-0.1.1/gripdFunctions.py
tags/extensions/gripd-0.1.1/gripdMain.py
tags/extensions/gripd-0.1.1/icon.pic
tags/extensions/gripd-0.1.1/joystick.xpm
tags/extensions/gripd-0.1.1/joystickA.xpm
tags/extensions/gripd-0.1.1/joystickX.xpm
tags/extensions/gripd-0.1.1/log.txt
tags/extensions/gripd-0.1.1/midi.xpm
tags/extensions/gripd-0.1.1/midiA.xpm
tags/extensions/gripd-0.1.1/midiX.xpm
tags/extensions/gripd-0.1.1/src/
Copied: tags/extensions/gripd-0.1.1 (from rev 9389, tags/TODO/version_0_1_1/extensions/gripd)
Copied: tags/extensions/gripd-0.1.1/.xvpics (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/.xvpics)
Deleted: tags/extensions/gripd-0.1.1/README.txt
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/README.txt 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/README.txt 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,181 +0,0 @@
-GrIPD: Graphical Interface for Pure Data
-----------------------------------------
-
-v0.1.1
-
--What is GrIPD-
-GrIPD is a cross-platform extension to Miller Puckette's Pure Data
-software that allows the one to design custom graphical user
-interfaces for Pd patches. GrIPD is not a replacement for the Pd
-Tcl/Tk GUI, but instead is intended to allow one to create a front end
-to a Pd patch. The concept is to create your PD patch normally and
-then your GUI using GrIPD. You can then lauch Pd using the -nogui
-command line argument (although this is certainly not necessary) so
-only your custom front end will be displayed. GrIPD, itself, consists
-of two parts: the "gripd" Pd object and an external GUI
-window/editor. The Pd object was written in C and the external GUI was
-written in Python using the wxWindows. GrIPD is released under the
-GNU General Public License.
-
-
--How GrIPD works-
-The two parts of GrIPD communicate via TCP/IP sockets so they can run
-on one machine or on separate machines over a network; so, for
-example, the GUI could be on a laptop on stage controlling or
-displaying info from the Pd audio engine in the house next to the
-mixer. The communication works through Pd's implimentation of
-"send" and "receive" objects. Basically, each GrIPD control object has
-a send and receive symbol associated with it.
-
-
--Supported platforms-
-GrIPD is currently available for Linux/GTK+ and MS Windows
-platforms. It may work on other Unix's, but as of yet it has not been
-tested. Since wxPython and C are both highly portable, most of GrIPD
-is as well. The only issues should be the C socket and multi-process
-code.
-
-
--Requirements-
- For Win32:
- * Pd
- For Linux:
- * Pd
- * GTK+
-
- To compile under Win32:
- * Python (v2.2 or later)
- * wxPython- wxWindows for Python (v2.4.0 or later)
- * a C/C++ compiler
- * to make a stand-alone .exe file you'll also need
- py2exe v0.3.1 (http://starship.python.net/crew/theller/py2exe/)
-
- To compile under Linux:
- * Python (v2.2 or later)
- * wxPython- wxWindows for Python (v2.4.0 or later)
- * GTK+ and wxGTK
- * C/C++ compiler
- * to make a stand-alone binary executable you'll also need
- Installer v5b4 (http://www.mcmillan-inc.com/install5_ann.html)
-
-All of the above are, of course, free.
-For Windows: the package includes compiled binaries of the gripd.dll Pd object
- and the gripd.exe GUI executeable.
-For Linux: stand-alone binary packages are available for x86 the architecture
- with either OSS or ALSA MIDI support.
-
-
--Installation-
-
-Windows:
- 1) Unzip contents of gripd-*.zip to .\pd\gripd\
- 2) Put gripd.dll where Pd can find it
- To compile from source
- 1) In .\pd\gripd\src:
- a) edit makefile
- b) run: nmake gripd_nt
- 2) gripd.exe is included, but to recompile run:
- python gripdSetup.py py2exe -w -O2 --icon icon.pic
-
-Linux:
- 1) Ungzip/untar contents of gripd-*.tar.gz to ./pd/gripd/
- 2) Put gripd.pd_linux where Pd can find it
- To compile from source:
- 2) In ./pd/gripd/src
- a) edit makefile
- b) run: make gripd_linux
- 3) to build a stand-alone binary executable of the GrIPD GUI run:
- python -OO Build.py gripd.spec (Build.py is part of Installer v5b4)
-
-Be sure to have gripd.dll or gripd.pd_linux in your Pd path
-
--Using GrIPD-
-To use GrIPD, launch Pd with the -lib gripd command line
-argument, and put the gripd Pd object on your patch; it's scope will be
-global throughout all canvases. Then send it an "open <optional
-filename>" message to launch the GUI (gripd.exe or gripd.py).
-You can also send a "open_locked <filename>" message which will open the
-GUI in locked mode. This will prevent any changes from being made to
-the GUI itself.
-
-You may need to set the path to gripd.py or gripd.exe by sending a
-"set_path <path>" message to the gripd Pd object. For Windows users not using
-gripd.exe, you may also have to set the path to python.exe by sending a
-"set_python_path <path>" message.
-
-You may also send a "connect" message to set the gripd Pd object to wait for
-an incomming connection and launch gripd.exe or gripd.py separately.
-
-If the path supplied to either an "open" message or a "set_path" message
-is relative (i.e. begins with ./ or ../) they will be considered relative
-to the directory containing the Pd executable file (pd.exe for Windows and
-pd for Linux). This keeps behavior consistent no matter where Pd is launched
-from.
-
-If the GUI is launched from PD, When the GUI window is closed you can re-open
-it by sending the gripd Pd object a "show" message. You can also hide it by
-sending the gripd Pd object a "hide" message.
-
-The GrIPD GUI itself has two modes: "Performance Mode" and "Edit
-Mode". In "Edit Mode" you can add and remove controls using the
-"Edit" menu, move them around by selecting them and dragging them by
-their tag with the mouse or use the arrow keys (note: ctrl+<arrow key>
-will move controls a greater distance). You can edit a controls
-properties by either selecting "Edit" from the "Edit" menu or
-right-clicking the control's tab. In "Performance Mode" the controls
-properties are locked and when activated (e.g. clicked, slid, checked,
-etc.) they will send a message via their send symbol. Conversely,
-they will receive messages sent within the Pd patch using their
-receive symbol. Look at gripd.pd and gripdExamples.pd.
-
-GrIPD can forward MIDI input to Pd from up to two devices. To enable MIDI
-function, select "Enable MIDI" from the "Configure" menu. GrIPD will send
-note information via the "midi<n>note" symbol where <n> is either 0 or 1.
-It will also send controller information via "midi<n>ctl" and program change
-information via "midi<n>pgm".
-
-GrIPD also allows for the use of up to two joysticks. To enable joystick
-function, select "Enable Joystick" from the "Configure" menu. Joystick
-axis and button information are sent to Pd with the send symbols
-"joy<n>axis<m>" and "joy<n>button<m>" where <n> is 0 or 1 and ,<m> is
-0,1,... for the number of axes and buttons your joystick supports. For
-example, to read from joystick 0 axis 0, put a "r joy0axis0" object in your
-Pd patch. Axes will send integers in a range that will depend on your
-joystick, and buttons will send 1 when depressed and 0 when released.
-
-GrIPD will also catch keystrokes and send the ASCII value to Pd while in
-performance mode via a "keystroke" send symbol. Simply put a "r keystroke"
-object in your Pd patch.
-
-Note about duplicating radio buttons:
-When creating radio buttons, the first button created in a group is the
-group marker. Duplicating any of the buttons in a group other than the
-group marker button will add a button of the last group created.
-Duplicating the group marker button will start a new group.
-
-Note about image paths:
-When a path to an image is relative (i.e. begins with ./ or ../), it is
-considered relative to the .gpd file containing the image. If no file
-has been opened or saved, the path is considered relative to the directory
-containing the gripd executable file (gripd.exe for Windows and gripd.py
-for Linux). It is therefore recommended that all images used in a GUI be
-placed in a directory directly lower than the directory containing the .gpd
-file. For example if your .gpd file is in c:\pd-guis put all images in
-c:\pd-guis\images. This will make distributing GUIs much simpler.
-
-Note about MIDI and joystick input:
-If problems occur due to MIDI or joystick input, you can disable them by
-editing gripd.opt
-
--New in 0.1.1
-Added graph control
-Added openpanel and savepanel
-added MIDI and joystick activity blinking
-Fixed zombie bug
-Fixed multiple opens bug
-Fixed checkbox and radio buttons bug
-Fixed rectangle redrawing problem
-Fixed selecting inside rectangle problem
-
--Contact-
-Drop me a line at jsarlo at ucsd.edu
Copied: tags/extensions/gripd-0.1.1/README.txt (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/README.txt)
===================================================================
--- tags/extensions/gripd-0.1.1/README.txt (rev 0)
+++ tags/extensions/gripd-0.1.1/README.txt 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,181 @@
+GrIPD: Graphical Interface for Pure Data
+----------------------------------------
+
+v0.1.1
+
+-What is GrIPD-
+GrIPD is a cross-platform extension to Miller Puckette's Pure Data
+software that allows the one to design custom graphical user
+interfaces for Pd patches. GrIPD is not a replacement for the Pd
+Tcl/Tk GUI, but instead is intended to allow one to create a front end
+to a Pd patch. The concept is to create your PD patch normally and
+then your GUI using GrIPD. You can then lauch Pd using the -nogui
+command line argument (although this is certainly not necessary) so
+only your custom front end will be displayed. GrIPD, itself, consists
+of two parts: the "gripd" Pd object and an external GUI
+window/editor. The Pd object was written in C and the external GUI was
+written in Python using the wxWindows. GrIPD is released under the
+GNU General Public License.
+
+
+-How GrIPD works-
+The two parts of GrIPD communicate via TCP/IP sockets so they can run
+on one machine or on separate machines over a network; so, for
+example, the GUI could be on a laptop on stage controlling or
+displaying info from the Pd audio engine in the house next to the
+mixer. The communication works through Pd's implimentation of
+"send" and "receive" objects. Basically, each GrIPD control object has
+a send and receive symbol associated with it.
+
+
+-Supported platforms-
+GrIPD is currently available for Linux/GTK+ and MS Windows
+platforms. It may work on other Unix's, but as of yet it has not been
+tested. Since wxPython and C are both highly portable, most of GrIPD
+is as well. The only issues should be the C socket and multi-process
+code.
+
+
+-Requirements-
+ For Win32:
+ * Pd
+ For Linux:
+ * Pd
+ * GTK+
+
+ To compile under Win32:
+ * Python (v2.2 or later)
+ * wxPython- wxWindows for Python (v2.4.0 or later)
+ * a C/C++ compiler
+ * to make a stand-alone .exe file you'll also need
+ py2exe v0.3.1 (http://starship.python.net/crew/theller/py2exe/)
+
+ To compile under Linux:
+ * Python (v2.2 or later)
+ * wxPython- wxWindows for Python (v2.4.0 or later)
+ * GTK+ and wxGTK
+ * C/C++ compiler
+ * to make a stand-alone binary executable you'll also need
+ Installer v5b4 (http://www.mcmillan-inc.com/install5_ann.html)
+
+All of the above are, of course, free.
+For Windows: the package includes compiled binaries of the gripd.dll Pd object
+ and the gripd.exe GUI executeable.
+For Linux: stand-alone binary packages are available for x86 the architecture
+ with either OSS or ALSA MIDI support.
+
+
+-Installation-
+
+Windows:
+ 1) Unzip contents of gripd-*.zip to .\pd\gripd\
+ 2) Put gripd.dll where Pd can find it
+ To compile from source
+ 1) In .\pd\gripd\src:
+ a) edit makefile
+ b) run: nmake gripd_nt
+ 2) gripd.exe is included, but to recompile run:
+ python gripdSetup.py py2exe -w -O2 --icon icon.pic
+
+Linux:
+ 1) Ungzip/untar contents of gripd-*.tar.gz to ./pd/gripd/
+ 2) Put gripd.pd_linux where Pd can find it
+ To compile from source:
+ 2) In ./pd/gripd/src
+ a) edit makefile
+ b) run: make gripd_linux
+ 3) to build a stand-alone binary executable of the GrIPD GUI run:
+ python -OO Build.py gripd.spec (Build.py is part of Installer v5b4)
+
+Be sure to have gripd.dll or gripd.pd_linux in your Pd path
+
+-Using GrIPD-
+To use GrIPD, launch Pd with the -lib gripd command line
+argument, and put the gripd Pd object on your patch; it's scope will be
+global throughout all canvases. Then send it an "open <optional
+filename>" message to launch the GUI (gripd.exe or gripd.py).
+You can also send a "open_locked <filename>" message which will open the
+GUI in locked mode. This will prevent any changes from being made to
+the GUI itself.
+
+You may need to set the path to gripd.py or gripd.exe by sending a
+"set_path <path>" message to the gripd Pd object. For Windows users not using
+gripd.exe, you may also have to set the path to python.exe by sending a
+"set_python_path <path>" message.
+
+You may also send a "connect" message to set the gripd Pd object to wait for
+an incomming connection and launch gripd.exe or gripd.py separately.
+
+If the path supplied to either an "open" message or a "set_path" message
+is relative (i.e. begins with ./ or ../) they will be considered relative
+to the directory containing the Pd executable file (pd.exe for Windows and
+pd for Linux). This keeps behavior consistent no matter where Pd is launched
+from.
+
+If the GUI is launched from PD, When the GUI window is closed you can re-open
+it by sending the gripd Pd object a "show" message. You can also hide it by
+sending the gripd Pd object a "hide" message.
+
+The GrIPD GUI itself has two modes: "Performance Mode" and "Edit
+Mode". In "Edit Mode" you can add and remove controls using the
+"Edit" menu, move them around by selecting them and dragging them by
+their tag with the mouse or use the arrow keys (note: ctrl+<arrow key>
+will move controls a greater distance). You can edit a controls
+properties by either selecting "Edit" from the "Edit" menu or
+right-clicking the control's tab. In "Performance Mode" the controls
+properties are locked and when activated (e.g. clicked, slid, checked,
+etc.) they will send a message via their send symbol. Conversely,
+they will receive messages sent within the Pd patch using their
+receive symbol. Look at gripd.pd and gripdExamples.pd.
+
+GrIPD can forward MIDI input to Pd from up to two devices. To enable MIDI
+function, select "Enable MIDI" from the "Configure" menu. GrIPD will send
+note information via the "midi<n>note" symbol where <n> is either 0 or 1.
+It will also send controller information via "midi<n>ctl" and program change
+information via "midi<n>pgm".
+
+GrIPD also allows for the use of up to two joysticks. To enable joystick
+function, select "Enable Joystick" from the "Configure" menu. Joystick
+axis and button information are sent to Pd with the send symbols
+"joy<n>axis<m>" and "joy<n>button<m>" where <n> is 0 or 1 and ,<m> is
+0,1,... for the number of axes and buttons your joystick supports. For
+example, to read from joystick 0 axis 0, put a "r joy0axis0" object in your
+Pd patch. Axes will send integers in a range that will depend on your
+joystick, and buttons will send 1 when depressed and 0 when released.
+
+GrIPD will also catch keystrokes and send the ASCII value to Pd while in
+performance mode via a "keystroke" send symbol. Simply put a "r keystroke"
+object in your Pd patch.
+
+Note about duplicating radio buttons:
+When creating radio buttons, the first button created in a group is the
+group marker. Duplicating any of the buttons in a group other than the
+group marker button will add a button of the last group created.
+Duplicating the group marker button will start a new group.
+
+Note about image paths:
+When a path to an image is relative (i.e. begins with ./ or ../), it is
+considered relative to the .gpd file containing the image. If no file
+has been opened or saved, the path is considered relative to the directory
+containing the gripd executable file (gripd.exe for Windows and gripd.py
+for Linux). It is therefore recommended that all images used in a GUI be
+placed in a directory directly lower than the directory containing the .gpd
+file. For example if your .gpd file is in c:\pd-guis put all images in
+c:\pd-guis\images. This will make distributing GUIs much simpler.
+
+Note about MIDI and joystick input:
+If problems occur due to MIDI or joystick input, you can disable them by
+editing gripd.opt
+
+-New in 0.1.1
+Added graph control
+Added openpanel and savepanel
+added MIDI and joystick activity blinking
+Fixed zombie bug
+Fixed multiple opens bug
+Fixed checkbox and radio buttons bug
+Fixed rectangle redrawing problem
+Fixed selecting inside rectangle problem
+
+-Contact-
+Drop me a line at jsarlo at ucsd.edu
Deleted: tags/extensions/gripd-0.1.1/connect.xpm
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/connect.xpm 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/connect.xpm 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,27 +0,0 @@
-/* XPM */
-static char * connect_xpm[] = {
-"21 16 8 1",
-" c None",
-". c #000000",
-"+ c #00FF04",
-"@ c #BFBFBF",
-"# c #FEFEFE",
-"$ c #00FEFE",
-"% c #FF0000",
-"& c #0000FE",
-" .. ........ ",
-" .+. .@@@@@@@@.",
-" .....++. . at ......@.",
-" .+++++++.. at .##$$. at .",
-" .+...++. . at .#%&#. at .",
-" .+. .+. . at .$#%#. at .",
-" .+. .. . at ......@.",
-" ........ .@@@@@@@@.",
-".@@@@@@@@. ........ ",
-". at ......@. .. .+. ",
-". at .#&$$. at . .+. .+. ",
-". at .#%&#. at . .++...+. ",
-". at .$###. at ..+++++++. ",
-". at ......@. .++..... ",
-".@@@@@@@@. .+. ",
-" ........ .. "};
Copied: tags/extensions/gripd-0.1.1/connect.xpm (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/connect.xpm)
===================================================================
--- tags/extensions/gripd-0.1.1/connect.xpm (rev 0)
+++ tags/extensions/gripd-0.1.1/connect.xpm 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,27 @@
+/* XPM */
+static char * connect_xpm[] = {
+"21 16 8 1",
+" c None",
+". c #000000",
+"+ c #00FF04",
+"@ c #BFBFBF",
+"# c #FEFEFE",
+"$ c #00FEFE",
+"% c #FF0000",
+"& c #0000FE",
+" .. ........ ",
+" .+. .@@@@@@@@.",
+" .....++. . at ......@.",
+" .+++++++.. at .##$$. at .",
+" .+...++. . at .#%&#. at .",
+" .+. .+. . at .$#%#. at .",
+" .+. .. . at ......@.",
+" ........ .@@@@@@@@.",
+".@@@@@@@@. ........ ",
+". at ......@. .. .+. ",
+". at .#&$$. at . .+. .+. ",
+". at .#%&#. at . .++...+. ",
+". at .$###. at ..+++++++. ",
+". at ......@. .++..... ",
+".@@@@@@@@. .+. ",
+" ........ .. "};
Deleted: tags/extensions/gripd-0.1.1/connectX.xpm
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/connectX.xpm 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/connectX.xpm 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,24 +0,0 @@
-/* XPM */
-static char * connectX_xpm[] = {
-"21 16 5 1",
-" c None",
-". c #000000",
-"+ c #BFBFBF",
-"@ c #FF0000",
-"# c #3F3F3F",
-" ........ ",
-" .. .++++++++.",
-" ....@@. .+......+.",
-" .@@@@@. .+.####.+.",
-" . at ..@@. .+.####.+.",
-" . at . .. .+.####.+.",
-" . at . .+......+.",
-" ........ .++++++++.",
-".++++++++. ........ ",
-".+......+. . at . ",
-".+.####.+. .. . at . ",
-".+.####.+. .@@.. at . ",
-".+.####.+. .@@@@@. ",
-".+......+. .@@.... ",
-".++++++++. .. ",
-" ........ "};
Copied: tags/extensions/gripd-0.1.1/connectX.xpm (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/connectX.xpm)
===================================================================
--- tags/extensions/gripd-0.1.1/connectX.xpm (rev 0)
+++ tags/extensions/gripd-0.1.1/connectX.xpm 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,24 @@
+/* XPM */
+static char * connectX_xpm[] = {
+"21 16 5 1",
+" c None",
+". c #000000",
+"+ c #BFBFBF",
+"@ c #FF0000",
+"# c #3F3F3F",
+" ........ ",
+" .. .++++++++.",
+" ....@@. .+......+.",
+" .@@@@@. .+.####.+.",
+" . at ..@@. .+.####.+.",
+" . at . .. .+.####.+.",
+" . at . .+......+.",
+" ........ .++++++++.",
+".++++++++. ........ ",
+".+......+. . at . ",
+".+.####.+. .. . at . ",
+".+.####.+. .@@.. at . ",
+".+.####.+. .@@@@@. ",
+".+......+. .@@.... ",
+".++++++++. .. ",
+" ........ "};
Copied: tags/extensions/gripd-0.1.1/examples (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/examples)
Deleted: tags/extensions/gripd-0.1.1/gripd
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/gripd 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/gripd 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,42 +0,0 @@
-#!/usr/bin/python -OO
-
-## GrIPD v0.1.1 - Graphical Interface for Pure Data
-## Copyright (C) 2003 Joseph A. Sarlo
-##
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; either version 2
-## of the License, or (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-##
-## jsarlo at ucsd.edu
-
-from wxPython.wx import *
-from gripdMain import *
-import sys
-import signal
-import os
-
-def signalHandler(sigNum, frame):
- print 'Caught signal', sigNum
- try:
- app.frame.eClose(wxEvent())
- except:
- app.ExitMainLoop()
-if (os.name == "posix"):
- signal.signal(signal.SIGQUIT, signalHandler)
- signal.signal(signal.SIGINT, signalHandler)
- signal.signal(signal.SIGTERM, signalHandler)
-app = mainApp(sys.argv)
-app.MainLoop()
-
-
-
Copied: tags/extensions/gripd-0.1.1/gripd (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/gripd)
===================================================================
--- tags/extensions/gripd-0.1.1/gripd (rev 0)
+++ tags/extensions/gripd-0.1.1/gripd 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,42 @@
+#!/usr/bin/python -OO
+
+## GrIPD v0.1.1 - Graphical Interface for Pure Data
+## Copyright (C) 2003 Joseph A. Sarlo
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## jsarlo at ucsd.edu
+
+from wxPython.wx import *
+from gripdMain import *
+import sys
+import signal
+import os
+
+def signalHandler(sigNum, frame):
+ print 'Caught signal', sigNum
+ try:
+ app.frame.eClose(wxEvent())
+ except:
+ app.ExitMainLoop()
+if (os.name == "posix"):
+ signal.signal(signal.SIGQUIT, signalHandler)
+ signal.signal(signal.SIGINT, signalHandler)
+ signal.signal(signal.SIGTERM, signalHandler)
+app = mainApp(sys.argv)
+app.MainLoop()
+
+
+
Deleted: tags/extensions/gripd-0.1.1/gripd.opt
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/gripd.opt 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/gripd.opt 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,2 +0,0 @@
-joystick = TRUE
-midi = TRUE
Copied: tags/extensions/gripd-0.1.1/gripd.opt (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/gripd.opt)
===================================================================
--- tags/extensions/gripd-0.1.1/gripd.opt (rev 0)
+++ tags/extensions/gripd-0.1.1/gripd.opt 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,2 @@
+joystick = TRUE
+midi = TRUE
Deleted: tags/extensions/gripd-0.1.1/gripd.py
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/gripd.py 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/gripd.py 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,43 +0,0 @@
-#!/usr/bin/python -OO
-
-## GrIPD v0.1.1 - Graphical Interface for Pure Data
-## Copyright (C) 2003 Joseph A. Sarlo
-##
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; either version 2
-## of the License, or (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-##
-## jsarlo at ucsd.edu
-
-from wxPython.wx import *
-from gripdMain import *
-import sys
-import signal
-import os
-
-def signalHandler(sigNum, frame):
- print 'Caught signal', sigNum
- try:
- app.frame.eClose(wxEvent())
- except:
- app.ExitMainLoop()
-if (os.name == "posix"):
- signal.signal(signal.SIGQUIT, signalHandler)
- signal.signal(signal.SIGINT, signalHandler)
- signal.signal(signal.SIGTERM, signalHandler)
-app = mainApp(sys.argv)
-app.MainLoop()
-
-
-
-
Copied: tags/extensions/gripd-0.1.1/gripd.py (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/gripd.py)
===================================================================
--- tags/extensions/gripd-0.1.1/gripd.py (rev 0)
+++ tags/extensions/gripd-0.1.1/gripd.py 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,43 @@
+#!/usr/bin/python -OO
+
+## GrIPD v0.1.1 - Graphical Interface for Pure Data
+## Copyright (C) 2003 Joseph A. Sarlo
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## jsarlo at ucsd.edu
+
+from wxPython.wx import *
+from gripdMain import *
+import sys
+import signal
+import os
+
+def signalHandler(sigNum, frame):
+ print 'Caught signal', sigNum
+ try:
+ app.frame.eClose(wxEvent())
+ except:
+ app.ExitMainLoop()
+if (os.name == "posix"):
+ signal.signal(signal.SIGQUIT, signalHandler)
+ signal.signal(signal.SIGINT, signalHandler)
+ signal.signal(signal.SIGTERM, signalHandler)
+app = mainApp(sys.argv)
+app.MainLoop()
+
+
+
+
Deleted: tags/extensions/gripd-0.1.1/gripd.spec
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/gripd.spec 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/gripd.spec 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,16 +0,0 @@
-a = Analysis(['../../support/_mountzlib.py',
- '../../support/useUnicode.py',
- 'src/gripd.py'],
- pathex=[])
-pyz = PYZ(a.pure)
-exe = EXE(pyz,
- a.scripts + [('OO','','OPTION')] + [('f','','OPTION')],
- exclude_binaries=1,
- name='buildgripd/gripd',
- debug=0,
- strip=1,
- console=1 )
-coll = COLLECT( exe,
- a.binaries,
- strip=1,
- name='distgripd')
Copied: tags/extensions/gripd-0.1.1/gripd.spec (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/gripd.spec)
===================================================================
--- tags/extensions/gripd-0.1.1/gripd.spec (rev 0)
+++ tags/extensions/gripd-0.1.1/gripd.spec 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,16 @@
+a = Analysis(['../../support/_mountzlib.py',
+ '../../support/useUnicode.py',
+ 'src/gripd.py'],
+ pathex=[])
+pyz = PYZ(a.pure)
+exe = EXE(pyz,
+ a.scripts + [('OO','','OPTION')] + [('f','','OPTION')],
+ exclude_binaries=1,
+ name='buildgripd/gripd',
+ debug=0,
+ strip=1,
+ console=1 )
+coll = COLLECT( exe,
+ a.binaries,
+ strip=1,
+ name='distgripd')
Deleted: tags/extensions/gripd-0.1.1/gripdControls.py
===================================================================
--- tags/TODO/version_0_1_1/extensions/gripd/gripdControls.py 2008-02-08 11:30:38 UTC (rev 9389)
+++ tags/extensions/gripd-0.1.1/gripdControls.py 2008-02-08 12:46:04 UTC (rev 9396)
@@ -1,1675 +0,0 @@
-## GrIPD v0.1.1 - Graphical Interface for Pure Data
-## Copyright (C) 2003 Joseph A. Sarlo
-##
-## This program is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License
-## as published by the Free Software Foundation; either version 2
-## of the License, or (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-##
-## jsarlo at ucsd.edu
-
-from wxPython.wx import *
-from string import *
-from gripdFunctions import *
-import os
-import math
-
-MBUTTONTYPE = 0
-MTOGGLETYPE = 1
-MVSLIDERTYPE = 2
-MHSLIDERTYPE = 3
-MRECTTYPE = 4
-MTEXTTYPE = 5
-MVGAUGETYPE = 6
-MHGAUGETYPE = 7
-MCHECKBOXTYPE = 8
-MTEXTBOXTYPE = 9
-MSPINBUTTONTYPE = 10
-MMOUSEAREATYPE = 11
-MRADIOBUTTONTYPE = 12
-MRADIONEWTYPE = 13
-MIMAGETYPE = 14
-MGRAPHTYPE = 15
-PAIRSEPCHAR = chr(29)
-SYMMSGSEP = chr(31)
-DEFCONTROLID = -1
-DEFEDITPOS = (5,7)
-DEFSLIDERVALUE = 0
-DEFSLIDERMIN = 0
-DEFSLIDERMAX = 100
-DEFVSLIDERSIZE = (30, 80)
-DEFHSLIDERSIZE = (80, 30)
-DEFRECTSIZE = (200, 200)
-DEFVGAUGESIZE = (30, 80)
-DEFHGAUGESIZE = (80, 30)
-DEFGAUGEMIN = 0
-DEFGAUGEMAX = 100
-DEFTAGSIZE = 9
-RESIZETAGCOLOR = "#555555"
-DEFMOUSEAREASIZE = 100
-SETRCVRCOMMAND = "!setRcvr"
-SETARRAYCOMMAND = "!setArray"
-TEXTEDITINPUT = 0
-FONTEDITINPUT = 1
-COLOREDITINPUT = 2
-FILEEDITINPUT = 3
-DROPDOWNEDITINPUT = 4
-MAXARRAYSENDSIZE = 2000
-
-lastEditWindowPosition = (-1, -1)
-
-# Abstract class for controls (buttons, sliders, etc)
-class mControl(wxControl):
- def __init__(self, parentApp, type, sSym, rSym, cnxtn):
- self.editMode = False
- self.selected = False
- self.parentApp = parentApp
- self.type = type
- self.sendSymbol = sSym
- self.receiveSymbol = rSym
- self.connection = cnxtn
- self.resetBackground = False
- self.updateRSym()
- self.clickedOn = False
- self.grabbed = False
- self.setEditMode(True)
- EVT_CHAR(self, self.eChar)
- EVT_KEY_UP(self, self.parentApp.eKeyUp)
- EVT_KEY_DOWN(self, self.parentApp.eKeyDown)
- def mDestroy(self):
- if (self.editMode):
- self.moveTag.Destroy()
- self.BLResizeTag.Destroy()
- self.BRResizeTag.Destroy()
- self.TRResizeTag.Destroy()
- self.Destroy()
- def select(self):
- if (not self.selected):
- self.relocateTags()
- self.moveTag.Show(True)
- self.BLResizeTag.Show(True)
- self.BRResizeTag.Show(True)
- self.TRResizeTag.Show(True)
- self.parentApp.selectedControlList.append(self)
- # To keep tags above controls in Windows, repaints tags in idle time
- # (i.e. after everything else has bee repainted)
- self.selected = True
- self.Connect(-1, -1, EVT_RAISE_TAGS_ID, self.eRepaintControlTags)
- wxPostEvent(self, RaiseTagsEvent())
- def deselect(self):
- if (self.selected):
- self.moveTag.Show(False)
- self.BLResizeTag.Show(False)
- self.BRResizeTag.Show(False)
- self.TRResizeTag.Show(False)
- self.parentApp.selectedControlList.remove(self)
- self.Disconnect(-1, EVT_RAISE_TAGS_ID)
- self.selected = False
- def isSelected(self):
- return self.selected
- def grab(self):
- if (not self.grabbed):
- self.grabbed = True
- self.parentApp.dragging = True
- EVT_MOTION(self.moveTag, self.moveTag.eMove)
- self.moveTag.lastPos = wxGetMousePosition()
- self.moveTag.SetCursor(wxStockCursor(self.moveTag.pointerStyle))
- self.parentApp.startMoveControls()
- self.moveTag.CaptureMouse()
- def ungrab(self):
- if (self.grabbed):
- self.grabbed = False
- self.parentApp.dragging = False
- self.moveTag.ReleaseMouse()
- # this doesn't seem to actually disconnect
- self.moveTag.Disconnect(-1, wxEVT_MOTION)
- self.moveTag.SetCursor(wxSTANDARD_CURSOR)
- self.parentApp.endDragMoveControls()
- self.parentApp.mainFrame.mainPanel.Refresh()
- self.Refresh()
- def updateRSym(self):
- self.connection.send(SETRCVRCOMMAND + SYMMSGSEP + \
- self.receiveSymbol + PAIRSEPCHAR)
- def sendMessage(self, message):
- try:
- self.connection.send(self.sendSymbol + SYMMSGSEP + \
- message + PAIRSEPCHAR)
- except:
- pass
- def PDAction(self, value):
- self.SetLabel(value)
- def relocateTags(self):
- self.moveTag.relocate()
- self.BLResizeTag.relocate()
- self.BRResizeTag.relocate()
- self.TRResizeTag.relocate()
- def refreshTags(self):
- self.moveTag.Show(True)
- self.BLResizeTag.Show(True)
- self.BRResizeTag.Show(True)
- self.TRResizeTag.Show(True)
- self.moveTag.Refresh()
- self.BLResizeTag.Refresh()
- self.BRResizeTag.Refresh()
- self.TRResizeTag.Refresh()
- def startMove(self):
- self.TRResizeTag.Show(False)
- self.BRResizeTag.Show(False)
- self.BLResizeTag.Show(False)
- def move(self, deltaPos):
- if (self.editMode and self.isSelected()):
- xPos = self.GetPosition()[0] + deltaPos[0]
- yPos = self.GetPosition()[1] + deltaPos[1]
- deltaPosMTX = xPos - self.GetPosition()[0]
- deltaPosMTY = yPos - self.GetPosition()[1]
- xMTPos = self.moveTag.GetPosition()[0] + deltaPosMTX
- yMTPos = self.moveTag.GetPosition()[1] + deltaPosMTY
- self.MoveXY(xPos, yPos)
- self.moveTag.MoveXY(xMTPos, yMTPos)
- def endMove(self):
- self.relocateTags()
- self.TRResizeTag.Show(True)
- self.BRResizeTag.Show(True)
- self.BLResizeTag.Show(True)
- def endDragMove(self):
- if (self.parentApp.snapToGrid):
- self.setPosition( \
- self.parentApp.getNearestGridPoint(self.GetPosition()))
- self.endMove()
- def resize(self, deltaPos):
- if (self.editMode):
- xSize = self.GetSize()[0] + deltaPos[0]
- ySize = self.GetSize()[1] + deltaPos[1]
- if (xSize > 0 and ySize > 0):
- self.setSize((xSize, ySize))
- def setEditMode(self, mode):
- if (mode):
- if (not self.editMode):
- EVT_LEFT_DOWN(self, self.eLeftDown)
- EVT_RIGHT_DOWN(self, self.eRightDown)
- self.moveTag = controlEditTag(self,
- (0,0),
- wxBLACK,
- wxCURSOR_CROSS)
- self.BLResizeTag = controlResizeTag(self,
- (1,0),
- RESIZETAGCOLOR,
- wxCURSOR_SIZEWE)
- self.TRResizeTag = controlResizeTag(self,
- (0,1),
- RESIZETAGCOLOR,
- wxCURSOR_SIZENS)
- self.BRResizeTag = controlResizeTag(self,
- (1,1),
- RESIZETAGCOLOR,
- wxCURSOR_SIZENWSE)
- self.editMode = True
- elif (self.editMode):
- self.deselect()
- self.moveTag.Destroy()
- self.BLResizeTag.Destroy()
- self.TRResizeTag.Destroy()
- self.BRResizeTag.Destroy()
- self.Disconnect(-1, wxEVT_LEFT_DOWN)
- self.Disconnect(-1, wxEVT_RIGHT_DOWN)
- self.editMode = False
- def getEditMode(self):
- return self.editMode
- def setSendSymbol(self, sym):
- self.sendSymbol = sym
- def getSendSymbol(self):
- return self.sendSymbol
- def setReceiveSymbol(self, sym):
- self.receiveSymbol = sym
- self.updateRSym()
- def getReceiveSymbol(self):
- return self.receiveSymbol
- def setConnection(self, cnxtn):
- self.connection = cnxtn
- def getConnection(self):
- return self.connection
- def getType(self):
- return self.type
- def setPosition(self, pos):
- self.MoveXY(pos[0], pos[1])
- self.relocateTags()
- def setSize(self, size):
- self.SetSize(size)
- if (self.selected):
- self.relocateTags()
- # catch GTK bug
- def GetBackgroundColour(self):
- color = wxControl.GetBackgroundColour(self)
- if (not color.Ok()):
- color = wxBLACK
- return color
- def editCallback(self, editValues):
- try:
- self.setPosition((atoi(editValues[0]), atoi(editValues[1])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Position",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.setSize(wxSize(atoi(editValues[2]), atoi(editValues[3])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.setSendSymbol(editValues[4])
- self.setReceiveSymbol(editValues[5])
- self.SetLabel(editValues[6])
- self.SetForegroundColour(editValues[7])
- self.SetBackgroundColour(editValues[8])
- self.SetFont(editValues[9])
- def eEdit(self, event):
- editor = controlEditor(self)
- editor.addEditItem("X Position:",
- TEXTEDITINPUT,
- self.GetPosition()[0])
- editor.addEditItem("Y Position:",
- TEXTEDITINPUT,
- self.GetPosition()[1])
- editor.addEditItem("Width:",
- TEXTEDITINPUT,
- self.GetSize()[0])
- editor.addEditItem("Height:",
- TEXTEDITINPUT,
- self.GetSize()[1])
- editor.addEditItem("S Symbol:",
- TEXTEDITINPUT,
- self.getSendSymbol())
- editor.addEditItem("R Symbol:",
- TEXTEDITINPUT,
- self.getReceiveSymbol())
- editor.addEditItem("Label:",
- TEXTEDITINPUT,
- self.GetLabel())
- editor.addEditItem("F Color:",
- COLOREDITINPUT,
- self.GetForegroundColour())
- editor.addEditItem("B Color:",
- COLOREDITINPUT,
- self.GetBackgroundColour())
- editor.addEditItem("Font:",
- FONTEDITINPUT,
- self.GetFont())
- editor.edit()
- def eChar(self, event):
- self.parentApp.eChar(event)
- def eLeftDown(self, event):
- if (self.editMode):
- if (event.ControlDown()):
- if (self.isSelected()):
- self.deselect()
- else:
- self.select()
- else:
- self.parentApp.deselectOthers(self.GetId())
- self.select()
- else:
- event.Skip()
- def eRightDown(self, event):
- if (self.editMode):
- self.parentApp.deselectOthers(self.GetId())
- self.select()
- self.eEdit(event)
- else:
- event.Skip()
- def eRepaintControlTags(self, event):
- self.refreshTags()
-
-# Class for little box user grabs to move/edit control
-class controlEditTag(wxPanel):
- def __init__(self, parentControl, position, color, pointerStyle):
- wxPanel.__init__(self,
- parentControl.parentApp.mainFrame.mainPanel,
- -1, (0,0),
- (DEFTAGSIZE, DEFTAGSIZE), 0)
- self.SetBackgroundColour(color)
- self.parentControl = parentControl
- self.pointerStyle = pointerStyle
- self.leftDownOnTag = False
- self.position = position
- EVT_CHAR(self, self.parentControl.parentApp.eChar)
- EVT_KEY_UP(self, self.parentControl.parentApp.eKeyUp)
- EVT_KEY_DOWN(self, self.parentControl.parentApp.eKeyDown)
- EVT_LEFT_DOWN(self, self.eLeftDown)
- EVT_LEFT_UP(self, self.eRelease)
- EVT_RIGHT_DOWN(self, self.eRightDown)
- EVT_ENTER_WINDOW(self, self.eEnter)
- EVT_LEAVE_WINDOW(self, self.eLeave)
- self.Show(False)
- def relocate(self):
- nuPos = [0,0]
- parentPos = self.parentControl.GetPosition()
- parentSize = self.parentControl.GetSize()
- if (self.position[0]):
- nuPos[0] = parentPos[0] + parentSize[0]
- else:
- nuPos[0] = parentPos[0] - DEFTAGSIZE
- if (self.position[1]):
- nuPos[1] = parentPos[1] + parentSize[1]
- else:
- nuPos[1] = parentPos[1] - DEFTAGSIZE
- self.MoveXY(nuPos[0], nuPos[1])
- def eLeftDown(self, event):
- self.leftDownOnTag = True
- if (self.parentControl.grabbed):
- self.parentControl.ungrab()
- self.parentControl.deselect()
- self.parentControl.parentApp.deselectOthers(-1)
- else:
- self.parentControl.grab()
- def eRightDown(self, event):
- if (not self.parentControl.grabbed):
- self.parentControl.eEdit(event)
- def eMove(self, event):
- if (self.parentControl.grabbed):
- self.newPos = wxGetMousePosition()
- deltaPos = (self.newPos[0] - self.lastPos[0],
- self.newPos[1] - self.lastPos[1])
- self.lastPos = self.newPos
- self.parentControl.parentApp.moveSelectedControls(deltaPos)
- def eRelease(self, event):
- self.leftDownOnTag = False
- self.parentControl.ungrab()
- def eEnter(self, event):
- self.SetCursor(wxStockCursor(self.pointerStyle))
- def eLeave(self, event):
- self.SetCursor(wxSTANDARD_CURSOR)
-# Class for little box user grabs to resize control
-class controlResizeTag(controlEditTag):
- def eLeftDown(self, event):
- EVT_MOTION(self, self.eMove)
- self.leftDownOnTag = True
- self.lastPos = wxGetMousePosition()
- self.SetCursor(wxStockCursor(self.pointerStyle))
- self.CaptureMouse()
- def eMove(self, event):
- if (event.LeftIsDown() and self.leftDownOnTag):
- self.newPos = wxGetMousePosition()
- deltaPos = ((self.newPos[0] - self.lastPos[0]) * self.position[0],
- (self.newPos[1] - self.lastPos[1]) * self.position[1])
- self.lastPos = self.newPos
- self.parentControl.parentApp.resizeSelectedControls(deltaPos)
- def eRelease(self, event):
- self.ReleaseMouse()
- self.Disconnect(-1, wxEVT_MOTION)
- self.SetCursor(wxSTANDARD_CURSOR)
- self.leftDownOnTag = False
- self.parentControl.parentApp.mainFrame.mainPanel.Refresh()
-
-# Class for regular buttons
-class mButton(mControl, wxButton):
- def __init__(self, parentApp, type, id, text, pos, sSym, rSym, conn):
- wxButton.__init__(self, parentApp.mainFrame.mainPanel,
- id, text, pos)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- EVT_BUTTON(parentApp.mainFrame.mainPanel,
- self.GetId(), self.eClicked)
- def eClicked(self, event):
- if (not self.editMode):
- self.sendMessage("bang")
-
-# Class for toggle buttons
-# Problem with grabbing clicks with EVT_*_DOWN mouse events
-# in GTK on toggle button, seems to be a wxWindows thing
-class mToggle(mButton, wxToggleButton, wxButton):
- def __init__(self, parentApp, type, id, text, pos, sSym, rSym, conn):
- wxToggleButton.__init__(self, parentApp.mainFrame.mainPanel,
- id, text, pos)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- EVT_TOGGLEBUTTON(parentApp.mainFrame.mainPanel,
- self.GetId(), self.eClicked)
- def toggle(self):
- self.SetValue(1 - self.GetValue())
- def PDAction(self, value):
- try:
- num = atof(value)
- if (num == 0):
- self.SetValue(0)
- else:
- self.SetValue(1)
- except:
- if (value == "bang"):
- self.toggle()
- else:
- self.SetLabel(value)
- def eClicked(self, event):
- # checking edit mode due to above-mentioned problem
- # checking for ctrl key (308)
- if (self.editMode):
- try:
- self.parentApp.keysDown.index(308)
- if (self.selected):
- self.deselect()
- else:
- self.select()
- except:
- self.parentApp.deselectOthers(-1)
- self.select()
- else:
- self.sendMessage(repr(event.IsChecked()))
-
-# Class for sliders
-# Screwyness since wxSliders have a maximum at down position.
-# No way to change as far as I can tell.
-class mSlider(mControl, wxSlider):
- def __init__(self, parentApp, type, id, label,
- pos, style, sSym, rSym, conn):
- if (style & wxSL_HORIZONTAL):
- sSize = DEFHSLIDERSIZE
- if (style & wxSL_VERTICAL):
- sSize = DEFVSLIDERSIZE
- if (isinstance(label, list)):
- try:
- value = atoi(label[0])
- except:
- value = 0
- min = label[1]
- max = label[2]
- dir = label[3]
- else:
- try:
- value = atoi(label)
- except:
- value = 0
- min = DEFSLIDERMIN
- max = DEFSLIDERMAX
- dir = 1
- wxSlider.__init__(self, parentApp.mainFrame.mainPanel,
- id, value, min, max, pos, sSize, style)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- EVT_COMMAND_SCROLL(parentApp, self.GetId(), self.eScrolled)
- self.lastValue = value
- self.setDirection(dir)
- self.resetBackground = True
- self.setSliderValue(value)
- def PDAction(self, value):
- try:
- num = atof(value)
- self.setSliderValue(num)
- except:
- pass
- def setDirection(self, val):
- if (val == 0):
- self.direction = 0
- else:
- self.direction = 1
- def getDirection(self):
- return self.direction
- def getSliderValue(self):
- direction = self.direction
- styleFlag = self.GetWindowStyleFlag()
- if (((direction) and (styleFlag & wxSL_VERTICAL)) \
- or ((not direction) and (styleFlag & wxSL_HORIZONTAL))):
- value = self.GetMax() - self.GetValue() + self.GetMin()
- else:
- value = self.GetValue()
- return value
- def setSliderValue(self, num):
- if (((self.direction == 1) and (self.GetWindowStyleFlag() \
- & wxSL_VERTICAL)) \
- or ((self.direction == 0) \
- and (self.GetWindowStyleFlag() \
- & wxSL_HORIZONTAL))):
- value = self.GetMax() - num + self.GetMin()
- else:
- value = num
- self.SetValue(value)
- def GetLabel(self):
- return repr(self.getSliderValue())
- def SetLabel(self, value):
- try:
- self.setSliderValue(atoi(value))
- except:
- pass
- def editCallback(self, editValues):
- try:
- self.setPosition((atoi(editValues[0]), atoi(editValues[1])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Position",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.setSize(wxSize(atoi(editValues[2]), atoi(editValues[3])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.setSendSymbol(editValues[4])
- self.setReceiveSymbol(editValues[5])
- self.SetForegroundColour(editValues[6])
- self.SetBackgroundColour(editValues[7])
- try:
- self.SetRange(atoi(editValues[8]),
- atoi(editValues[9]))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Range",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- if (editValues[10] == "Up"):
- self.setDirection(1)
- elif (editValues[10] == "Down"):
- self.setDirection(0)
- def eEdit(self, event):
- editor = controlEditor(self)
- editor.addEditItem("X Position:",
- TEXTEDITINPUT,
- self.GetPosition()[0])
- editor.addEditItem("Y Position:",
- TEXTEDITINPUT,
- self.GetPosition()[1])
- editor.addEditItem("Width:",
- TEXTEDITINPUT,
- self.GetSize()[0])
- editor.addEditItem("Height:",
- TEXTEDITINPUT,
- self.GetSize()[1])
- editor.addEditItem("S Symbol:",
- TEXTEDITINPUT,
- self.getSendSymbol())
- editor.addEditItem("R Symbol:",
- TEXTEDITINPUT,
- self.getReceiveSymbol())
- editor.addEditItem("F Color:",
- COLOREDITINPUT,
- self.GetForegroundColour())
- editor.addEditItem("B Color:",
- COLOREDITINPUT,
- self.GetBackgroundColour())
- editor.addEditItem("Minimum:",
- TEXTEDITINPUT,
- self.GetMin())
- editor.addEditItem("Maximum:",
- TEXTEDITINPUT,
- self.GetMax())
- if (self.getDirection() == 1):
- ddValues = ["Up", "Down"]
- else:
- ddValues = ["Down", "Up"]
- editor.addEditItem("Direction:",
- DROPDOWNEDITINPUT,
- ddValues)
- editor.edit()
- def eScrolled(self, event):
- if (not self.editMode):
- value = self.getSliderValue()
- if (self.lastValue != value):
- self.lastValue = value
- self.sendMessage(repr(value))
-
-#class for `decorative' rectangle
-class mRectangle(mControl, wxStaticBox):
- def __init__(self, parentApp, type, id, text, pos, sSym, rSym, conn):
- wxStaticBox.__init__(self, parentApp.mainFrame.mainPanel,
- id, text, pos, DEFRECTSIZE)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.resetBackground = True
- def SetValue(self, value):
- self.SetLabel(value)
- def eLeftDown(self, event):
- if (self.editMode):
- if (event.GetPosition()[0] < 20 or \
- event.GetPosition()[1] < 20 or \
- event.GetPosition()[0] > self.GetSize()[0] - 20 or\
- event.GetPosition()[1] > self.GetSize()[1] - 20):
- if (event.ControlDown()):
- if (self.isSelected()):
- self.deselect()
- else:
- self.select()
- else:
- self.parentApp.deselectOthers(self.GetId())
- self.select()
- else:
- self.parentApp.eLeftDown(event)
- else:
- event.Skip()
-
-
-# Class for `decorative' text
-class mText(mControl, wxStaticText):
- def __init__(self, parentApp, type, id, text, pos, sSym, rSym, conn):
- wxStaticText.__init__(self, parentApp.mainFrame.mainPanel,
- id, text, pos, wxDefaultSize,
- wxALIGN_CENTRE | wxST_NO_AUTORESIZE)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.resetBackground = True
- def SetValue(self, value):
- self.SetLabel(value)
- self.Refresh()
-
-#Class for gauges
-class mGauge(wxGauge, mSlider):
- def __init__(self, parentApp, type, id, label, pos,
- style, sSym, rSym, conn):
- if (style & wxGA_HORIZONTAL):
- size = DEFHGAUGESIZE
- else:
- size = DEFVGAUGESIZE
- if (isinstance(label, list)):
- try:
- value = atoi(label[0])
- except:
- value = 0
- max = label[2]
- else:
- try:
- value = atoi(label)
- except:
- value = 0
- max = DEFSLIDERMAX
- wxGauge.__init__(self, parentApp.mainFrame.mainPanel,
- id, max, pos, size, style | wxGA_SMOOTH)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- try:
- self.SetValue(value)
- except:
- pass
- def GetMin(self):
- return 0
- def GetMax(self):
- return self.GetRange()
- def SetRange(self, min, max):
- wxGauge.SetRange(self, max)
- def getDirection(self):
- return 0
- def setDirection(self, x):
- pass
- def GetLabel(self):
- return repr(self.GetValue())
- def SetLabel(self, value):
- try:
- self.SetValue(atoi(value))
- except:
- pass
- def PDAction(self, value):
- try:
- num = atof(value)
- if (num > self.GetMax()):
- num = self.GetMax()
- if (num < 0):
- num = 0
- self.SetValue(num)
- except:
- self.SetLabel(value)
- def editCallback(self, editValues):
- try:
- self.setPosition((atoi(editValues[0]), atoi(editValues[1])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Position",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.setSize(wxSize(atoi(editValues[2]), atoi(editValues[3])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.setSendSymbol(editValues[4])
- self.setReceiveSymbol(editValues[5])
- try:
- self.SetRange(0,
- atoi(editValues[6]))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Maximum",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.SetForegroundColour(editValues[7])
- self.SetBackgroundColour(editValues[8])
- def eEdit(self, event):
- editor = controlEditor(self)
- editor.addEditItem("X Position:",
- TEXTEDITINPUT,
- self.GetPosition()[0])
- editor.addEditItem("Y Position:",
- TEXTEDITINPUT,
- self.GetPosition()[1])
- editor.addEditItem("Width:",
- TEXTEDITINPUT,
- self.GetSize()[0])
- editor.addEditItem("Height:",
- TEXTEDITINPUT,
- self.GetSize()[1])
- editor.addEditItem("S Symbol:",
- TEXTEDITINPUT,
- self.getSendSymbol())
- editor.addEditItem("R Symbol:",
- TEXTEDITINPUT,
- self.getReceiveSymbol())
- editor.addEditItem("Maximum:",
- TEXTEDITINPUT,
- self.GetMax())
- editor.addEditItem("F Color:",
- COLOREDITINPUT,
- self.GetForegroundColour())
- editor.addEditItem("B Color:",
- COLOREDITINPUT,
- self.GetBackgroundColour())
- editor.edit()
-
-# Class for checkboxes
-class mCheckBox(wxCheckBox, mToggle):
- def __init__(self, parentApp, type, id, text, pos, sSym, rSym, conn):
- wxCheckBox.__init__(self, parentApp.mainFrame.mainPanel,
- id, text, pos)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.resetBackground = True
- EVT_CHECKBOX(parentApp.mainFrame.mainPanel,
- self.GetId(), self.eClicked)
-
-# Class for radio buttons
-class mRadioButton(wxRadioButton, mToggle):
- def __init__(self, parentApp, type, id, text,
- pos, sSym, rSym, style, conn):
- wxRadioButton.__init__(self, parentApp.mainFrame.mainPanel,
- id, text, pos, wxDefaultSize, style)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.resetBackground = True
- EVT_RADIOBUTTON(parentApp.mainFrame.mainPanel,
- self.GetId(), self.eClicked)
- self.SetValue(False)
- def eClicked(self, event):
- if (not self.editMode and (self.GetValue() > 0)):
- self.sendMessage("bang")
-
-# Class for textboxes
-class mTextBox(mControl, wxTextCtrl):
- def __init__(self, parentApp, type, id, label, pos, sSym, rSym, conn):
- wxTextCtrl.__init__(self, parentApp.mainFrame.mainPanel,
- id, "", pos, wxDefaultSize,
- wxTE_PROCESS_ENTER)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.SetValue(label)
- EVT_TEXT_ENTER(parentApp.mainFrame.mainPanel, self.GetId(), self.eEnter)
- def PDAction(self, value):
- if (value == "bang"):
- self.SetValue("")
- else:
- self.SetValue(value)
- def GetLabel(self):
- return self.GetValue()
- def SetLabel(self, value):
- self.SetValue(value)
- def eEnter(self, event):
- value = self.GetValue()
- if (not self.editMode):
- self.sendMessage(value)
-
-# Class for spin buttons
-class mSpinButton(wxSpinButton, mSlider):
- def __init__(self, parentApp, type, id, label, pos, sSym, rSym, conn):
- wxSpinButton.__init__(self, parentApp.mainFrame.mainPanel,
- id, pos, wxDefaultSize,
- wxSP_VERTICAL)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- try:
- self.SetValue(atoi(label))
- except:
- pass
- EVT_SPIN(parentApp.mainFrame.mainPanel, self.GetId(), self.eSpin)
- def getDirection(self):
- return 0
- def setDirection(self, x):
- pass
- def PDAction(self, value):
- try:
- num = atof(value)
- if (num > self.GetMax()):
- num = self.GetMax()
- if (num < 0):
- num = 0
- self.SetValue(num)
- except:
- self.SetLabel(value)
- def GetLabel(self):
- return repr(self.GetValue())
- def SetLabel(self, value):
- try:
- self.SetValue(atoi(value))
- except:
- pass
- def eSpin(self, event):
- value = repr(self.GetValue())
- if (not self.editMode):
- self.sendMessage(value)
- def editCallback(self, editValues):
- try:
- self.setPosition((atoi(editValues[0]), atoi(editValues[1])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Position",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.setSize(wxSize(atoi(editValues[2]), atoi(editValues[3])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.setSendSymbol(editValues[4])
- self.setReceiveSymbol(editValues[5])
- try:
- self.SetRange(atoi(editValues[6]),
- atoi(editValues[7]))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Range",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.SetForegroundColour(editValues[8])
- self.SetBackgroundColour(editValues[9])
- def eEdit(self, event):
- editor = controlEditor(self)
- editor.addEditItem("X Position:",
- TEXTEDITINPUT,
- self.GetPosition()[0])
- editor.addEditItem("Y Position:",
- TEXTEDITINPUT,
- self.GetPosition()[1])
- editor.addEditItem("Width:",
- TEXTEDITINPUT,
- self.GetSize()[0])
- editor.addEditItem("Height:",
- TEXTEDITINPUT,
- self.GetSize()[1])
- editor.addEditItem("S Symbol:",
- TEXTEDITINPUT,
- self.getSendSymbol())
- editor.addEditItem("R Symbol:",
- TEXTEDITINPUT,
- self.getReceiveSymbol())
- editor.addEditItem("Minimum:",
- TEXTEDITINPUT,
- self.GetMin())
- editor.addEditItem("Maximum:",
- TEXTEDITINPUT,
- self.GetMax())
- editor.addEditItem("F Color:",
- COLOREDITINPUT,
- self.GetForegroundColour())
- editor.addEditItem("B Color:",
- COLOREDITINPUT,
- self.GetBackgroundColour())
- editor.edit()
-
-# Class for mouse capture area
-class mMouseArea(wxPanel, mControl):
- def __init__(self, parentApp, type, id, pos, sSym, rSym, conn):
- wxPanel.__init__(self, parentApp.mainFrame.mainPanel, -1, pos,
- (DEFMOUSEAREASIZE, DEFMOUSEAREASIZE), wxBORDER)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.mouseCaptured = False
- EVT_MIDDLE_DOWN(self, self.eMiddleDown)
- EVT_MIDDLE_UP(self, self.eMiddleUp)
- EVT_RIGHT_UP(self, self.eRightUp)
- def sendMouseInfo(self, xPos, yPos, buttonNum, buttonStatus):
- xPosStr = repr(xPos)
- yPosStr = repr(yPos)
- if (buttonNum > -1):
- buttonNumStr = repr(buttonNum)
- buttonStatusStr = repr(buttonStatus)
- self.sendMessage(xPosStr + " " + \
- yPosStr + " " + \
- buttonNumStr + " " + \
- buttonStatusStr)
- else:
- self.sendMessage(xPosStr + " " + yPosStr)
- def editCallback(self, editValues):
- try:
- self.setPosition((atoi(editValues[0]), atoi(editValues[1])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Position",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.setSize(wxSize(atoi(editValues[2]), atoi(editValues[3])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.setSendSymbol(editValues[4])
- self.setReceiveSymbol(editValues[5])
- self.SetBackgroundColour(editValues[6])
- def eEdit(self, event):
- editor = controlEditor(self)
- editor.addEditItem("X Position:",
- TEXTEDITINPUT,
- self.GetPosition()[0])
- editor.addEditItem("Y Position:",
- TEXTEDITINPUT,
- self.GetPosition()[1])
- editor.addEditItem("Width:",
- TEXTEDITINPUT,
- self.GetSize()[0])
- editor.addEditItem("Height:",
- TEXTEDITINPUT,
- self.GetSize()[1])
- editor.addEditItem("S Symbol:",
- TEXTEDITINPUT,
- self.getSendSymbol())
- editor.addEditItem("R Symbol:",
- TEXTEDITINPUT,
- self.getReceiveSymbol())
- editor.addEditItem("Color:",
- COLOREDITINPUT,
- self.GetBackgroundColour())
- editor.edit()
- def eLeftDown(self, event):
- if (self.editMode):
- if (event.ControlDown()):
- if (self.isSelected()):
- self.deselect()
- else:
- self.select()
- else:
- self.parentApp.deselectOthers(self.GetId())
- self.select()
- else:
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- 0,
- 1)
- event.Skip()
- self.eStartCapture(event)
- def eRightDown(self, event):
- if (self.editMode):
- self.parentApp.deselectOthers(self.GetId())
- self.select()
- self.eEdit(event)
- else:
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- 2,
- 1)
- def eRightUp(self, event):
- if (not self.editMode):
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- 2,
- 0)
- def eMiddleDown(self, event):
- if (not self.editMode):
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- 1,
- 1)
- def eMiddleUp(self, event):
- if (not self.editMode):
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- 1,
- 0)
- def eStartCapture(self, event):
- if (not self.mouseCaptured):
- self.CaptureMouse()
- self.mouseCaptured = True
- EVT_LEFT_UP(self, self.eEndCapture)
- EVT_MOTION(self, self.eCaptureMouse)
- def eEndCapture(self, event):
- if (self.mouseCaptured):
- self.ReleaseMouse()
- self.mouseCaptured = False
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- 0,
- 0)
- self.Disconnect(-1, wxEVT_MOTION)
- self.Disconnect(-1, wxEVT_LEFT_UP)
- def eCaptureMouse(self, event):
- if (event.LeftIsDown() and self.mouseCaptured):
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- -1,
- -1)
-
-class mGraph(wxPanel, mSlider):
- def __init__(self, parentApp, type, id, label, pos, sSym, rSym, conn):
- wxPanel.__init__(self, parentApp.mainFrame.mainPanel, -1, pos,
- (DEFMOUSEAREASIZE, DEFMOUSEAREASIZE), wxSIMPLE_BORDER)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.arrayLength = 0
- self.arrayRawData = []
- self.arrayDrawData = []
- self.min = -1
- self.max = 1
- self.mouseCaptured = False
- if (isinstance(label, list)):
- try:
- value = atoi(label[0])
- except:
- value = 0
- self.min = label[1]
- self.max = label[2]
- aData = label[3]
- self.arrayLength = aData[0]
- self.arrayRawData = aData[1:]
- if (self.arrayLength == 0):
- self.arrayLength = 100
- for i in range(0, 100):
- self.arrayRawData.append(0)
- for i in range(0, self.arrayLength):
- drawData = self.getDrawData(i, 0)
- self.arrayDrawData.append(drawData)
- EVT_PAINT(self, self.ePaint)
- def GetMin(self):
- return self.min
- def GetMax(self):
- return self.max
- def getDirection(self):
- return [self.arrayLength] + self.arrayRawData
- def PDAction(self, value):
- value = strip(value)
- if (lower(value) == "bang"):
- self.Refresh()
- else:
- isAnInt = False
- try:
- aLen = atoi(value)
- isAnInt = True
- except:
- pass
- if (isAnInt):
- if (aLen > self.arrayLength):
- for i in range(self.arrayLength, aLen):
- self.arrayRawData.append(0)
- self.arrayDrawData.append(self.getDrawData(i, 0))
- elif (aLen < self.arrayLength):
- del self.arrayRawData[aLen:]
- del self.arrayDrawData[aLen:]
- self.arrayLength = aLen
- for i in range(0, self.arrayLength):
- self.arrayDrawData[i] = self.getDrawData(i,
- self.arrayRawData[i])
- else:
- try:
- [aIndex, aValue] = split(value, ' ')
- aIndex = atoi(aIndex)
- aValue = atof(aValue)
- if (self.arrayRawData[aIndex] != aValue and \
- aIndex >= 0 and \
- aIndex < self.arrayLength):
- self.arrayRawData[aIndex] = aValue
- self.arrayDrawData[aIndex] = self.getDrawData(aIndex,
- aValue)
- except:
- pass
- self.Refresh()
- def getDrawData(self, index, value):
- (xSize, ySize) = self.GetSize()
- div = float(self.arrayLength - 1)
- if (div != 0):
- xScale = xSize / div
- else:
- xScale = 1
- div = float(self.max - self.min)
- if (div != 0):
- yScale = ySize / div
- else:
- yScale = 1
- yOffset = int(self.max * yScale)
- x = int(xScale * index)
- y = yOffset - int(yScale * value)
- pnt = (x,y)
- return pnt
- def setSize(self, size):
- self.SetSize(size)
- if (self.selected):
- self.relocateTags()
- for i in range(0, len(self.arrayRawData)):
- self.arrayDrawData[i] = self.getDrawData(i,
- self.arrayRawData[i])
- self.Refresh()
- def editCallback(self, editValues):
- try:
- self.setPosition((atoi(editValues[0]), atoi(editValues[1])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Position",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.setSize(wxSize(atoi(editValues[2]), atoi(editValues[3])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.min = atof(editValues[6])
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Minimum",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.max = atof(editValues[7])
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Maximum",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.setSendSymbol(editValues[4])
- self.setReceiveSymbol(editValues[5])
- self.SetBackgroundColour(editValues[8])
- self.SetForegroundColour(editValues[9])
- def eEdit(self, event):
- editor = controlEditor(self)
- editor.addEditItem("X Position:",
- TEXTEDITINPUT,
- self.GetPosition()[0])
- editor.addEditItem("Y Position:",
- TEXTEDITINPUT,
- self.GetPosition()[1])
- editor.addEditItem("Width:",
- TEXTEDITINPUT,
- self.GetSize()[0])
- editor.addEditItem("Height:",
- TEXTEDITINPUT,
- self.GetSize()[1])
- editor.addEditItem("S Symbol:",
- TEXTEDITINPUT,
- self.getSendSymbol())
- editor.addEditItem("R Symbol:",
- TEXTEDITINPUT,
- self.getReceiveSymbol())
- editor.addEditItem("Minumum:",
- TEXTEDITINPUT,
- repr(self.min))
- editor.addEditItem("Maximum:",
- TEXTEDITINPUT,
- repr(self.max))
- editor.addEditItem("B Color:",
- COLOREDITINPUT,
- self.GetBackgroundColour())
- editor.addEditItem("F Color:",
- COLOREDITINPUT,
- self.GetForegroundColour())
- editor.edit()
- def ePaint(self, event):
- event.Skip()
- myDC = wxPaintDC(self)
- myDC.BeginDrawing()
- myDC.SetPen(wxPen(self.GetForegroundColour(), 1, wxSOLID))
- myDC.SetBrush(wxBrush("#000000", wxTRANSPARENT))
- myDC.DrawLines(self.arrayDrawData)
- myDC.EndDrawing()
- def eDrawMotion(self, event):
- if (self.mouseCaptured):
- (mouseX, mouseY) = event.GetPosition()
- div = float(self.arrayLength - 1)
- if (div != 0):
- xScale = self.GetSize()[0] / div
- else:
- xScale = 1
- div = float(self.max - self.min)
- if (div != 0):
- yScale = self.GetSize()[1] / div
- else:
- yScale = 1
- yOffset = int(self.max * yScale)
- if (xScale != 0):
- x = int(mouseX / xScale)
- else:
- x = 0
- if (yScale != 0):
- y = self.max - (mouseY / yScale)
- else:
- y = 0
- if (x >= 0 and x < self.arrayLength and \
- y >= self.min and y <= self.max):
- self.arrayRawData[x] = y
- self.arrayDrawData[x] = self.getDrawData(x, y)
- self.Refresh()
- self.sendMessage(repr(x) + " " + repr(y))
- def eLeftDown(self, event):
- if (self.editMode):
- if (event.ControlDown()):
- if (self.isSelected()):
- self.deselect()
- else:
- self.select()
- else:
- self.parentApp.deselectOthers(self.GetId())
- self.select()
- else:
- event.Skip()
- self.eStartCapture(event)
- def eStartCapture(self, event):
- if (not self.mouseCaptured):
- self.CaptureMouse()
- self.mouseCaptured = True
- EVT_LEFT_UP(self, self.eEndCapture)
- EVT_MOTION(self, self.eDrawMotion)
- def eEndCapture(self, event):
- if (self.mouseCaptured):
- self.ReleaseMouse()
- self.mouseCaptured = False
- self.Disconnect(-1, wxEVT_MOTION)
- self.Disconnect(-1, wxEVT_LEFT_UP)
- def eCaptureMouse(self, event):
- pass
-
-# Class for clickable image
-# seems to have problems capturing the mouse?
-class mImage(mMouseArea, wxStaticBitmap):
- def __init__(self, parentApp, type, id, filepath,
- pos, sSym, rSym, conn):
- self.filename = filepath
- self.image = wxImage(self.filename,
- wxBITMAP_TYPE_ANY)
- tempBitmap = self.image.ConvertToBitmap()
- if (not tempBitmap.Ok()):
- raise Exception
- wxStaticBitmap.__init__(self, parentApp.mainFrame.mainPanel, id,
- tempBitmap, pos, wxDefaultSize)
- mControl.__init__(self, parentApp, type, sSym, rSym, conn)
- self.resetBackground = True
- self.mouseCaptured = False
- EVT_LEFT_DOWN(self, self.eLeftDown)
- EVT_MIDDLE_DOWN(self, self.eMiddleDown)
- EVT_MIDDLE_UP(self, self.eMiddleUp)
- EVT_RIGHT_UP(self, self.eRightUp)
- def sendMouseInfo(self, xPos, yPos, buttonNum, buttonStatus):
- xPosStr = repr(xPos)
- yPosStr = repr(yPos)
- if (buttonNum > -1):
- buttonNumStr = repr(buttonNum)
- buttonStatusStr = repr(buttonStatus)
- self.sendMessage(xPosStr + " " + \
- yPosStr + " " + \
- buttonNumStr + " " + \
- buttonStatusStr)
- else:
- self.sendMessage(xPosStr + " " + yPosStr)
- def resize(self, deltaPos):
- if (self.editMode):
- xSize = self.GetSize()[0] + deltaPos[0]
- ySize = self.GetSize()[1] + deltaPos[1]
- if (xSize > 0 and ySize > 0):
- if (xSize <= self.image.GetWidth() and
- ySize <= self.image.GetHeight()):
- self.setSize((xSize, ySize))
- elif (xSize <= self.image.GetWidth()):
- self.setSize((xSize, self.GetSize()[1]))
- elif (ySize <= self.image.GetHeight()):
- self.setSize((self.GetSize()[0], ySize))
- def setSize(self, size):
- self.SetSize(size)
- if (self.selected):
- self.relocateTags()
- newImage = self.image.GetSubImage((0,0,size[0],size[1]))
- newBitmap = newImage.ConvertToBitmap()
- self.SetBitmap(newBitmap)
- def setEditMode(self, mode):
- if (mode):
- if (not self.editMode):
- EVT_RIGHT_DOWN(self, self.eRightDown)
- self.moveTag = controlEditTag(self,
- (0,0),
- wxBLACK,
- wxCURSOR_CROSS)
- self.BLResizeTag = controlResizeTag(self,
- (1,0),
- RESIZETAGCOLOR,
- wxCURSOR_SIZEWE)
- self.TRResizeTag = controlResizeTag(self,
- (0,1),
- RESIZETAGCOLOR,
- wxCURSOR_SIZENS)
- self.BRResizeTag = controlResizeTag(self,
- (1,1),
- RESIZETAGCOLOR,
- wxCURSOR_SIZENWSE)
- self.editMode = True
- else:
- if (self.editMode):
- self.Disconnect(-1, wxEVT_RIGHT_DOWN)
- self.deselect()
- self.moveTag.Destroy()
- self.BLResizeTag.Destroy()
- self.TRResizeTag.Destroy()
- self.BRResizeTag.Destroy()
- self.editMode = False
- def Refresh(self):
- if (self.filename != self.GetLabel()):
- self.SetLabel(self.filename)
- wxStaticBitmap.Refresh(self)
- wxYield()
- self.parentApp.mainFrame.mainPanel.Refresh()
- def SetLabel(self, label):
- self.filename = label
- self.image = wxImage(self.filename,
- wxBITMAP_TYPE_ANY)
- tempBitmap = self.image.ConvertToBitmap()
- self.SetBitmap(tempBitmap)
- self.setSize((self.image.GetWidth(), self.image.GetHeight()))
- wxStaticBitmap.Refresh(self)
- self.parentApp.mainFrame.mainPanel.Refresh()
- def GetLabel(self):
- return self.filename
- def PDAction(self, value):
- if (value[0:4] == "hide"):
- self.Show(False)
- # self.parentApp.mainFrame.mainPanel.Refresh()
- elif (value[0:4] == "show"):
- self.Show(True)
- # self.parentApp.mainFrame.mainPanel.Refresh()
- elif (value[0:6] == "rotate"):
- theta = atof(value[6:len(value)]) * math.pi / 180
- tempImage = wxImage(self.filename,wxBITMAP_TYPE_ANY)
- bgColor = self.parentApp.mainFrame.mainPanel.GetBackgroundColour()
- tempImage.SetMaskColour(bgColor.Red(),
- bgColor.Green(),
- bgColor.Blue())
- rotateImage = tempImage.Rotate(theta, (0,0), True)
- bgColor = self.parentApp.mainFrame.mainPanel.GetBackgroundColour()
- self.SetBitmap(rotateImage.ConvertToBitmap())
- wxStaticBitmap.Refresh(self)
- self.parentApp.mainFrame.mainPanel.Refresh()
- else:
- if (value[0:2] == "./" or
- value[0:3] == "../"):
- value = scrubPath(self.parentApp.filepath + value)
- self.SetLabel(value)
- def editCallback(self, editValues):
- try:
- self.setPosition((atoi(editValues[0]), atoi(editValues[1])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- try:
- self.setSize(wxSize(atoi(editValues[2]), atoi(editValues[3])))
- except:
- dlg = wxMessageDialog(self.parentApp.mainFrame,
- "Invalid Size",
- "Edit Error",
- wxOK)
- dlg.ShowModal()
- dlg.Destroy()
- self.setSendSymbol(editValues[4])
- self.setReceiveSymbol(editValues[5])
- self.SetLabel(editValues[6])
- def eEdit(self, event):
- editor = controlEditor(self)
- editor.addEditItem("X Position:",
- TEXTEDITINPUT,
- self.GetPosition()[0])
- editor.addEditItem("Y Position:",
- TEXTEDITINPUT,
- self.GetPosition()[1])
- editor.addEditItem("width:",
- TEXTEDITINPUT,
- self.GetSize()[0])
- editor.addEditItem("Height:",
- TEXTEDITINPUT,
- self.GetSize()[1])
- editor.addEditItem("S Symbol:",
- TEXTEDITINPUT,
- self.getSendSymbol())
- editor.addEditItem("R Symbol:",
- TEXTEDITINPUT,
- self.getReceiveSymbol())
- editor.addEditItem("File:",
- FILEEDITINPUT,
- self.GetLabel())
- editor.edit()
- def eStartCapture(self, event):
- if (not self.mouseCaptured):
- self.mouseCaptured = True
- EVT_LEFT_UP(self, self.eEndCapture)
- EVT_MOTION(self, self.eCaptureMouse)
- def eEndCapture(self, event):
- if (self.mouseCaptured):
- self.mouseCaptured = False
- self.sendMouseInfo(event.GetPosition()[0],
- event.GetPosition()[1],
- 0,
- 0)
- self.Disconnect(-1, wxEVT_MOTION)
- self.Disconnect(-1, wxEVT_LEFT_UP)
-
-class editItem:
- def __init__(self, title, dataType, value):
- self.title = title
- self.dataType = dataType
- self.value = value
- def setValue(self, value):
- self.value = value
-
-class editSetButton(wxButton):
- def __init__(self, parent, position, size, value):
- wxButton.__init__(self, parent, -1, "Set", position, size)
- self.parent = parent
- self.value = value
- EVT_BUTTON(parent, self.GetId(), self.eClick)
- def GetValue(self):
- return self.value
-
-class editSetFontButton(editSetButton):
- def eClick(self, event):
- self.value = getFontFromDialog(self.parent, self.value)
-
-class editSetColorButton(editSetButton):
- def eClick(self, event):
- self.value = getColorFromDialog(self.parent, self.value)
-
-class editSetFileButton(editSetButton):
- def eClick(self, event):
- tempFile = getFileFromDialog(self.parent, self.value)
- if (tempFile):
- self.value = tempFile
-
-class editDropdown(wxComboBox):
- def __init__(self, parent, position, size, values):
- wxComboBox.__init__(self,
- parent,
- -1,
- values[0],
- position,
- size,
- values,
- wxCB_READONLY)
- self.parent = parent
-
-class controlEditor:
- def __init__(self, control):
- self.control = control
- self.editItems = []
- self.valueControls = []
- def addEditItem(self, title, dataType, value):
- self.editItems.append(editItem(title, dataType, value))
- def edit(self):
- global lastEditWindowPosition
- if (lastEditWindowPosition == (-1, -1)):
- lastEditWindowPosition = ( \
- self.control.parentApp.mainFrame.GetPosition()[0] + 20,
- self.control.parentApp.mainFrame.GetPosition()[1] + 20)
- self.editFrame = wxMiniFrame(self.control,
- -1,
- "Edit Control",
- lastEditWindowPosition,
- (100, 200),
- wxCAPTION | wxSTAY_ON_TOP)
- self.editFrame.editPanel = wxPanel(self.editFrame, -1, (0,0), (-1, -1))
- labels = []
- self.valueControls = []
- count = 0
- newLabel = wxStaticText(self.editFrame.editPanel,
- -1,
- self.editItems[0].title,
- DEFEDITPOS)
- labels.append(newLabel)
- if (type(self.editItems[0].value) == type(0)):
- value = repr(self.editItems[0].value)
- else:
- value = self.editItems[0].value
- if (self.editItems[0].dataType == TEXTEDITINPUT):
- newControl = wxTextCtrl(self.editFrame.editPanel,
- -1,
- value,
- (labels[0].GetPosition()[0] \
- + 65,
- labels[0].GetPosition()[1] - 2),
- (60,-1))
- if (self.editItems[0].dataType == FONTEDITINPUT):
- newControl = editSetFontButton(self.editFrame.editPanel,
- (labels[0].GetPosition()[0] + 65,
- labels[0].GetPosition()[1] - 2),
- (60, -1),
- self.editItems[0].value)
- if (self.editItems[0].dataType == COLOREDITINPUT):
- newControl = editSetColorButton(self.editFrame.editPanel,
- (labels[0].GetPosition()[0] + 65,
- labels[0].GetPosition()[1] - 2),
- (60, -1),
- self.editItems[0].value)
- if (self.editItems[0].dataType == FILEEDITINPUT):
- newControl = editSetFileButton(self.editFrame.editPanel,
- (labels[0].GetPosition()[0] + 65,
- labels[0].GetPosition()[1] - 2),
- (60, -1),
- self.editItems[0].value)
- if (self.editItems[0].dataType == DROPDOWNEDITINPUT):
- newControl = editDropdown(self.editFrame.editPanel,
- labels[0].GetPosition()[0] + 65,
- labels[0].GetPosition()[1] - 2,
- (60, -1),
- self.editItems[0].value)
- self.valueControls.append(newControl)
- for i in self.editItems[1:]:
- count = count + 1
- if (type(i.value) == type(0)):
- value = repr(i.value)
- else:
- value = i.value
- newLabel = wxStaticText(self.editFrame.editPanel,
- -1,
- i.title,
- (labels[count - 1].GetPosition()[0],
- self.valueControls[count - 1].GetPosition()[1] \
- + self.valueControls[count - 1].GetSize()[1] + 10))
- labels.append(newLabel)
- if (i.dataType == TEXTEDITINPUT):
- newControl = wxTextCtrl(self.editFrame.editPanel,
- -1,
- value,
- (self.valueControls[count - 1].GetPosition()[0],
- labels[count].GetPosition()[1] - 2),
- self.valueControls[count - 1].GetSize())
- if (self.editItems[count].dataType == FONTEDITINPUT):
- newControl = editSetFontButton(self.editFrame.editPanel,
- (self.valueControls[count - 1].GetPosition()[0],
- labels[count].GetPosition()[1] - 2),
- self.valueControls[count - 1].GetSize(),
- self.editItems[count].value)
- if (self.editItems[count].dataType == COLOREDITINPUT):
- newControl = editSetColorButton(self.editFrame.editPanel,
- (self.valueControls[count - 1].GetPosition()[0],
- labels[count].GetPosition()[1] - 2),
- self.valueControls[count - 1].GetSize(),
- self.editItems[count].value)
- if (self.editItems[count].dataType == FILEEDITINPUT):
- newControl = editSetFileButton(self.editFrame.editPanel,
- (self.valueControls[count - 1].GetPosition()[0],
- labels[count].GetPosition()[1] - 2),
- self.valueControls[count - 1].GetSize(),
- self.editItems[count].value)
- if (self.editItems[count].dataType == DROPDOWNEDITINPUT):
- newControl = editDropdown(self.editFrame.editPanel,
- (self.valueControls[count - 1].GetPosition()[0],
- labels[count].GetPosition()[1] - 2),
- self.valueControls[count - 1].GetSize(),
- self.editItems[count].value)
- self.valueControls.append(newControl)
- line = wxStaticLine(self.editFrame.editPanel, -1,
- (0, self.valueControls[-1].GetPosition()[1] \
- + self.valueControls[-1].GetSize()[1] + 20),
- (self.valueControls[0].GetPosition()[0] \
- + self.valueControls[0].GetSize()[0] + 10, 1))
- okButton = wxButton(self.editFrame.editPanel, -1, "OK",
- (labels[0].GetPosition()[0],
- line.GetPosition()[1] + 15),
- (self.valueControls[0].GetPosition()[0] \
- + self.valueControls[0].GetSize()[0], -1))
- self.editFrame.SetSize((okButton.GetPosition()[0] + \
- okButton.GetSize()[0] + 10,
- okButton.GetPosition()[1] + okButton.GetSize()[1] \
- + (okButton.GetPosition()[1] - line.GetPosition()[1]) \
- + 20))
- self.editFrame.editPanel.SetSize(self.editFrame.GetSize())
- EVT_BUTTON(self.editFrame.editPanel,
- okButton.GetId(),
- self.eOk)
- self.editFrame.Show(True)
- self.editFrame.MakeModal(True)
- def eOk(self, event):
- global lastEditWindowPosition
- returnValues = []
- for i in range(0, len(self.valueControls)):
- returnValues.append(self.valueControls[i].GetValue())
- lastEditWindowPosition = self.editFrame.GetPosition()
- self.editFrame.MakeModal(False)
- self.editFrame.Destroy()
- self.control.editCallback(returnValues)
-
Copied: tags/extensions/gripd-0.1.1/gripdControls.py (from rev 9392, tags/TODO/version_0_1_1/extensions/gripd/gripdControls.py)
===================================================================
--- tags/extensions/gripd-0.1.1/gripdControls.py (rev 0)
+++ tags/extensions/gripd-0.1.1/gripdControls.py 2008-02-08 12:46:04 UTC (rev 9396)
@@ -0,0 +1,1675 @@
+## GrIPD v0.1.1 - Graphical Interface for Pure Data
+## Copyright (C) 2003 Joseph A. Sarlo
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 2
+## of the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## jsarlo at ucsd.edu
+
+from wxPython.wx import *
+from string import *
+from gripdFunctions import *
+import os
+import math
+
+MBUTTONTYPE = 0
+MTOGGLETYPE = 1
+MVSLIDERTYPE = 2
+MHSLIDERTYPE = 3
+MRECTTYPE = 4
+MTEXTTYPE = 5
+MVGAUGETYPE = 6
+MHGAUGETYPE = 7
+MCHECKBOXTYPE = 8
+MTEXTBOXTYPE = 9
+MSPINBUTTONTYPE = 10
+MMOUSEAREATYPE = 11
+MRADIOBUTTONTYPE = 12
+MRADIONEWTYPE = 13
+MIMAGETYPE = 14
+MGRAPHTYPE = 15
+PAIRSEPCHAR = chr(29)
+SYMMSGSEP = chr(31)
+DEFCONTROLID = -1
+DEFEDITPOS = (5,7)
+DEFSLIDERVALUE = 0
+DEFSLIDERMIN = 0
+DEFSLIDERMAX = 100
+DEFVSLIDERSIZE = (30, 80)
+DEFHSLIDERSIZE = (80, 30)
+DEFRECTSIZE = (200, 200)
+DEFVGAUGESIZE = (30, 80)
+DEFHGAUGESIZE = (80, 30)
+DEFGAUGEMIN = 0
+DEFGAUGEMAX = 100
+DEFTAGSIZE = 9
+RESIZETAGCOLOR = "#555555"
+DEFMOUSEAREASIZE = 100
+SETRCVRCOMMAND = "!setRcvr"
+SETARRAYCOMMAND = "!setArray"
+TEXTEDITINPUT = 0
+FONTEDITINPUT = 1
+COLOREDITINPUT = 2
+FILEEDITINPUT = 3
+DROPDOWNEDITINPUT = 4
+MAXARRAYSENDSIZE = 2000
+
+lastEditWindowPosition = (-1, -1)
+
+# Abstract class for controls (buttons, sliders, etc)
+class mControl(wxControl):
+ def __init__(self, parentApp, type, sSym, rSym, cnxtn):
+ self.editMode = False
+ self.selected = False
+ self.parentApp = parentApp
+ self.type = type
+ self.sendSymbol = sSym
+ self.receiveSymbol = rSym
+ self.connection = cnxtn
+ self.resetBackground = False
+ self.updateRSym()
+ self.clickedOn = False
+ self.grabbed = False
+ self.setEditMode(True)
+ EVT_CHAR(self, self.eChar)
+ EVT_KEY_UP(self, self.parentApp.eKeyUp)
+ EVT_KEY_DOWN(self, self.parentApp.eKeyDown)
+ def mDestroy(self):
+ if (self.editMode):
+ self.moveTag.Destroy()
+ self.BLResizeTag.Destroy()
+ self.BRResizeTag.Destroy()
+ self.TRResizeTag.Destroy()
+ self.Destroy()
+ def select(self):
+ if (not self.selected):
+ self.relocateTags()
+ self.moveTag.Show(True)
+ self.BLResizeTag.Show(True)
+ self.BRResizeTag.Show(True)
+ self.TRResizeTag.Show(True)
+ self.parentApp.selectedControlList.append(self)
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Pd-cvs
mailing list