Update filter.py for wrapped text and keyworded string input
Updated filter.py to used the new TextFieldWrapped class; added keywords for defining TextFieldWrapped line, width, and default value attributes to replace strValSize, strVal, and strSize optionTypes. String input fields can now defined with: ("optionName", "string") OR ("optionName", ("string", "lines=", "width=", "value=")) Conflicts: editortools/filter.py
This commit is contained in:
parent
cdea40b4b3
commit
8bf1695154
@ -13,7 +13,7 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE."""
|
||||||
import os
|
import os
|
||||||
import traceback
|
import traceback
|
||||||
from albow import FloatField, IntField, AttrRef, Row, Label, Widget, TabPanel, TextField, CheckBox, Column, Button
|
from albow import FloatField, IntField, AttrRef, Row, Label, Widget, TabPanel, CheckBox, Column, Button, TextFieldWrapped
|
||||||
from editortools.blockview import BlockButton
|
from editortools.blockview import BlockButton
|
||||||
from editortools.editortool import EditorTool
|
from editortools.editortool import EditorTool
|
||||||
from glbackground import Panel
|
from glbackground import Panel
|
||||||
@ -113,32 +113,48 @@ class FilterModuleOptions(Widget):
|
|||||||
|
|
||||||
if isinstance(optionType[0], (str, unicode)):
|
if isinstance(optionType[0], (str, unicode)):
|
||||||
isChoiceButton = False
|
isChoiceButton = False
|
||||||
if len(optionType) == 3:
|
|
||||||
a,b,c = optionType
|
|
||||||
if a == "strValSize":
|
|
||||||
field = TextField(value=b, width=c)
|
|
||||||
page.optionDict[optionName] = AttrRef(field, 'value')
|
|
||||||
|
|
||||||
row = Row((Label(optionName), field))
|
if optionType[0] == "string":
|
||||||
rows.append(row)
|
kwds = []
|
||||||
else:
|
wid = None
|
||||||
isChoiceButton = True
|
lin = None
|
||||||
elif len(optionType) == 2:
|
val = None
|
||||||
a,b = optionType
|
for keyword in optionType:
|
||||||
if a == "strVal":
|
if isinstance(keyword, (str, unicode)) and keyword != "string":
|
||||||
field = TextField(value=b, width=200)
|
kwds.append(keyword)
|
||||||
page.optionDict[optionName] = AttrRef(field, 'value')
|
for keyword in kwds:
|
||||||
|
splitWord = keyword.split('=')
|
||||||
|
if len(splitWord) > 1:
|
||||||
|
v = None
|
||||||
|
key = None
|
||||||
|
|
||||||
row = Row((Label(optionName), field))
|
try:
|
||||||
rows.append(row)
|
v = int(splitWord[1])
|
||||||
elif a == "strSize":
|
except:
|
||||||
field = TextField(value="Input String Here", width=b)
|
pass
|
||||||
page.optionDict[optionName] = AttrRef(field, 'value')
|
|
||||||
|
|
||||||
row = Row((Label(optionName), field))
|
key = splitWord[0]
|
||||||
rows.append(row)
|
if v is not None:
|
||||||
else:
|
if key == "lines":
|
||||||
isChoiceButton = True
|
lin = v
|
||||||
|
elif key == "width":
|
||||||
|
wid = v
|
||||||
|
else:
|
||||||
|
if key == "value":
|
||||||
|
val = splitWord[1]
|
||||||
|
|
||||||
|
if lin is None:
|
||||||
|
lin = 1
|
||||||
|
if val is None:
|
||||||
|
val = "Input String Here"
|
||||||
|
if wid is None:
|
||||||
|
wid = 200
|
||||||
|
|
||||||
|
field = TextFieldWrapped(value=val, width=wid,lines=lin)
|
||||||
|
page.optionDict[optionName] = AttrRef(field, 'value')
|
||||||
|
|
||||||
|
row = Row((Label(optionName), field))
|
||||||
|
rows.append(row)
|
||||||
else:
|
else:
|
||||||
isChoiceButton = True
|
isChoiceButton = True
|
||||||
|
|
||||||
@ -171,7 +187,7 @@ class FilterModuleOptions(Widget):
|
|||||||
rows.append(wrapped_label(optionName, 50))
|
rows.append(wrapped_label(optionName, 50))
|
||||||
|
|
||||||
elif optionType == "string":
|
elif optionType == "string":
|
||||||
field = TextField(value="Input String Here", width=200)
|
field = TextFieldWrapped(value="Input String Here", width=200, lines=1)
|
||||||
page.optionDict[optionName] = AttrRef(field, 'value')
|
page.optionDict[optionName] = AttrRef(field, 'value')
|
||||||
|
|
||||||
row = Row((Label(optionName), field))
|
row = Row((Label(optionName), field))
|
||||||
|
Reference in New Issue
Block a user