Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 60532 Details for
Bug 94942
New version of dialog.py to allow for form widgets.
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
GLIDialog.py
GLIDialog.py (text/plain), 1.69 KB, created by
Christopher Hotchkiss
on 2005-06-03 12:09:58 UTC
(
hide
)
Description:
GLIDialog.py
Filename:
MIME Type:
Creator:
Christopher Hotchkiss
Created:
2005-06-03 12:09:58 UTC
Size:
1.69 KB
patch
obsolete
>class GLIDialog(Dialog): > def __init__(self, dialog="dialog", DIALOGRC=None, compat="dialog", use_stdout=None): > super.__init__(self, dialog="dialog", DIALOGRC=None, compat="dialog", use_stdout=None) > def form(self, formtitle, fields, **kwargs): > """Display a set of form fields. > > formtitle -- Title of the form > fields -- ('Field Label', 'Max length,', 'Default Value') > Field Label -- The label displayed before the input box > Max Length -- The maximum size the input box should be > Default Value -- A default value for the field (Optional) > > The form dialog allows one to build multiple inputs into one dialog box. > Just like a web based form you use TAB to move between fields and ENTER > to submit the dialog. > > It returns a tuple containing the form data. > > Typical usage: > data = d.form(('Interface',5,'eth0'),('IP Address', 15), ('Netmask', 15)) > """ > > #Find the maximum size of the labels and boxes > maxoptlen = 0 > maxinputlen = 0 > for field in fields: > if len(field[0]) > maxoptlen: > maxoptlen = len(field[0]) > > if int(field[1]) > maxinputlen: > maxinputlen = int(field[1]) > > #Set the starting args > formargs = ["--form", formtitle, len(fields), maxinputlen + maxoptlen + 12] > > #Make the args for the fields > counter = 1 > for field in fields: > formargs.append(field[0]) > formargs.append(counter) > > if len(field) > 2: > formargs.append(field[2]) > > formargs.append(counter) > formargs.append(maxoptlen+5) > formargs.append(int(field[1])+1) > fromargs.append(field[1]) > > counter = counter + 1 > > #Run the dialog program > (code, output) = self._perform( *(formargs),**kwargs) > > output = self._strip_xdialog_newline(output) > > return (code, output)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 94942
:
60531
|
60532
|
60533
|
60536
|
60539
|
60540
|
61246