From 2a2ddb344a6c76497b62978a74c634be378be8ec Mon Sep 17 00:00:00 2001 From: KaboPC Date: Tue, 11 Sep 2012 04:41:49 -0300 Subject: [PATCH] Update filter.py to Allow String Input for Filters The proposed change takes advantage of the TextField class in the albow package to allow filters to accept string input from the user. May be of use to filter creators. --- editortools/filter.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/editortools/filter.py b/editortools/filter.py index 71af69c..c9ce581 100644 --- a/editortools/filter.py +++ b/editortools/filter.py @@ -1,15 +1,15 @@ -"""Copyright (c) 2010-2012 David Rio Vierra - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +"""Copyright (c) 2010-2012 David Rio Vierra + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.""" from toolbasics import * from albow.dialogs import wrapped_label @@ -79,6 +79,13 @@ class FilterModuleOptions(Widget): elif optionType == "label": rows.append(wrapped_label(optionName, 50)) + elif optionType == "string": + field = TextField(value="string") + self.optionDict[optionName] = AttrRef(field, 'value') + + row = Row((Label(optionName), field)) + rows.append(row) + else: raise ValueError(("Unknown option type", optionType))