Author: aschnell Date: Tue Apr 8 22:27:29 2008 New Revision: 46261 URL: http://svn.opensuse.org/viewcvs/yast?rev=46261&view=rev Log: - extended Greasemonkey Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp branches/tmp/aschnell/part-redesign/storage/src/include/ep-settings.ycp branches/tmp/aschnell/part-redesign/storage/src/modules/Greasemonkey.ycp Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-all.ycp Tue Apr 8 22:27:29 2008 @@ -55,22 +55,23 @@ list table_list = StorageFields::TableContents(fields, target_map, predicate_all); UI::ReplaceWidget(`tree_panel, + Greasemonkey::Transform( `VBox( `Left(`Heading("Available Storage on pandora")), `HBox(`HStretch(), - `ComboBox(`id(`filter), `opt(`notify), "Show", - SelectOne([`item(`id(`all), "All"), - `item(`id(`disks), "Hard Disks"), - `item(`id(`lvm), "Volume Management"), - `item(`id(`raid), "RAID"), - `item(`id(`loop), "Crypt Files"), - `item(`id(`dm), "Device Mapper"), - `item(`id(`nfs), "NFS"), - `item(`id(`unused), "Unused Devices")], - `id(filter_)))), + `ComboBoxSelected(`id(`filter), `opt(`notify), "Show", + [`item(`id(`all), "All"), + `item(`id(`disks), "Hard Disks"), + `item(`id(`lvm), "Volume Management"), + `item(`id(`raid), "RAID"), + `item(`id(`loop), "Crypt Files"), + `item(`id(`dm), "Device Mapper"), + `item(`id(`nfs), "NFS"), + `item(`id(`unused), "Unused Devices")], + `id(filter_))), `Table(`id(`table), `opt(`keepSorting), header, table_list) - )); + ))); Wizard::RestoreHelp("Help about view with all devices"); } Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-main.ycp Tue Apr 8 22:27:29 2008 @@ -15,14 +15,6 @@ import "StorageFields"; - // useful for e.g. ComboBox, SelectionBox and DumbTab - // terms must be of form: `item(`id(any), any, ...) - list<term> SelectOne(list<term> items, any id) - { - return maplist(term item, items, { return `item(item[0]:nil, item[1]:nil, item[0]:nil == id); }); - } - - void UpdateNavigationTree(any new_focus); Modified: branches/tmp/aschnell/part-redesign/storage/src/include/ep-settings.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/include/ep-settings.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/include/ep-settings.ycp Tue Apr 8 22:27:29 2008 @@ -35,30 +35,34 @@ void CreateSettingsPanel(any user_data) { UI::ReplaceWidget(`tree_panel, + Greasemonkey::Transform( `VBox( `Left(`Heading("Settings")), `VBox( - `ComboBox(`id(`preferred_displayname), "Preferred Display Name", - SelectOne([`item(`id(`name), "Device Name"), - `item(`id(`id), "Device ID"), - `item(`id(`path), "Device Path")], - `id(preferred_displayname))), - `ComboBox(`id(`default_mountby), "Default Mount by", - SelectOne([`item(`id(`name), "Device Name"), - `item(`id(`label), "Volume Label"), - `item(`id(`uuid), "UUID"), - `item(`id(`id), "Device ID"), - `item(`id(`path), "Device Path")], - `id(default_mountby))), - `ComboBox(`id(`default_fs), "Default Filesystem", - SelectOne([`item(`id(`ext2), "Ext2"), - `item(`id(`ext3), "Ext3"), - `item(`id(`reiserfs), "ReiserFS"), - `item(`id(`xfs), "XFS")], - `id(default_fs))) + `ComboBoxSelected(`id(`preferred_displayname), + "Preferred Display Name", + [`item(`id(`name), "Device Name"), + `item(`id(`id), "Device ID"), + `item(`id(`path), "Device Path")], + `id(preferred_displayname)), + `ComboBoxSelected(`id(`default_mountby), + "Default Mount by", + [`item(`id(`name), "Device Name"), + `item(`id(`label), "Volume Label"), + `item(`id(`uuid), "UUID"), + `item(`id(`id), "Device ID"), + `item(`id(`path), "Device Path")], + `id(default_mountby)), + `ComboBoxSelected(`id(`default_fs), + "Default Filesystem", + [`item(`id(`ext2), "Ext2"), + `item(`id(`ext3), "Ext3"), + `item(`id(`reiserfs), "ReiserFS"), + `item(`id(`xfs), "XFS")], + `id(default_fs)) ), `VStretch() - )); + ))); Wizard::RestoreHelp("Settings help"); } Modified: branches/tmp/aschnell/part-redesign/storage/src/modules/Greasemonkey.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/aschnell/part-redesign/sto... ============================================================================== --- branches/tmp/aschnell/part-redesign/storage/src/modules/Greasemonkey.ycp (original) +++ branches/tmp/aschnell/part-redesign/storage/src/modules/Greasemonkey.ycp Tue Apr 8 22:27:29 2008 @@ -10,9 +10,9 @@ module "Greasemonkey"; - term VStackFrames(term t) + term VStackFrames(term old) { - list<term> frames = (list<term>) argsof(t); + list<term> frames = (list<term>) argsof(old); map info = UI::GetDisplayInfo(); boolean textmode = info["TextMode"]:false; @@ -28,7 +28,7 @@ } - term SizeUnit(term t) + term SizeUnit(term old) { return `HBox(`MinWidth(15, `InputField(`id(`size), `opt(`shrinkable), "Size")), `ComboBox(`id(`unit), "Unit", [ "Cyl", "MB", "GB", "TB" ])); @@ -36,6 +36,35 @@ /* + * ComboBoxSelected + * + * `ComboBoxSelected(`id(`wish), `opt(`notify), "Wish", + * [ `item(`id(`time), "Time"), + * `item(`id(`love), "Love"), + * `item(`id(`money), "Money") ], + * `id(`love)) + * + * `ComboBox(`id(`wish), `opt(`notify), "Wish", + * [ `item(`id(`time), "Time", false), + * `item(`id(`love), "Love", true), + * `item(`id(`money), "Money", false) ]) + */ + term ComboBoxSelected(term old) + { + list args = argsof(old); + + // YCP has no function to slice a list + list tmp = remove(remove(args, size(args)-1), size(args)-2); + list<term> items = args[size(args)-2]:[]; + term id = args[size(args)-1]:`id(); + + items = maplist(term item, items, { return `item(item[0]:nil, item[1]:nil, item[0]:nil == id); }); + + return toterm(`ComboBox, add(tmp, items)); + } + + + /* * LeftRadioButton * * `LeftRadioButton(`id(), `opt(), "text") @@ -60,11 +89,11 @@ */ term LeftRadioButtonWithAttachment(term old) { - list l = argsof(old); + list args = argsof(old); // YCP has no function to slice a list - list tmp1 = remove(l, size(l)-1); - any tmp2 = l[size(l)-1]:nil; + list tmp1 = remove(args, size(args)-1); + any tmp2 = args[size(args)-1]:nil; if (tmp2 == `Empty()) return `VBox(toterm(`LeftRadioButton, tmp1)); @@ -77,6 +106,7 @@ map<symbol, term(term)> handlers = $[ `VStackFrames : VStackFrames, `SizeUnit : SizeUnit, + `ComboBoxSelected : ComboBoxSelected, `LeftRadioButton : LeftRadioButton, `LeftRadioButtonWithAttachment : LeftRadioButtonWithAttachment ]; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org