Re: Re: 6.0 Standard Packages?, New Style Documentation?
- To: mathgroup at smc.vnet.net
- Subject: [mg77942] Re: [mg77517] Re: 6.0 Standard Packages?, New Style Documentation?
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Wed, 20 Jun 2007 05:32:20 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <f4dspd$hiv$1@smc.vnet.net> <200706110826.EAA21182@smc.vnet.net>
- Reply-to: murray at math.umass.edu
I added Saveable->True as an option in the CreatePalette function below, but still after I create the palette and close it, I do NOT get a prompt to save it. So how do I save it as a palette?? David Reiss wrote: > here is some code that "improves" upon the other code in these > postings. I have put a notebook linked to the WorkLife FrameWork blog > from a posting on this at: > > http://scientificarts.com/worklife/wlfwblog/index.html > > wiht a permalink at > > http://scientificarts.com/worklife/wlfwblog/BE3390503366/BE3390503366.html > > --David > > > One comment--the use of Quiet in this is to surprss some no context > messages that are generated because the contexts of many of these > packages do not reflect the directrly structure that they exist in. > So the packages, I beleive, load properly, but the contexts that they > end up existing in are not the same as those of the artument to the > Needs statements that load them. > > Here's he code (I am sure that it can be further improved upon-- > remember of course that this is intended for Mathematica 6), I hope > that it is useful... > > > ClearAll[StandardPackagesPalette]; > > StandardPackagesPalette::usage = > "StandardPackagesPalette[], generates a palette of pull-down menus > that allow you to load the standard > packages. StandardPackagesPalette[\"LegacyPackages\"] does the same > for those legacy packages that are included in the Mathematica > distribution. Similarly for StandardPackagesPalette[\"ExtraPackages > \"]. "; > > > StandardPackagesPalette[ > root : "Packages" | "LegacyPackages" | "ExtraPackages"] := > > Module[{directories, context, packageFiles, packageData, toMenuData, > menuData, menus}, > > context[dir_] := > > StringReplace[ > dir, {DirectoryName[dir] -> "", $PathnameSeparator -> ""}]; > > packageFiles[dir_] := > DeleteCases[StringDrop[ > StringReplace[#, DirectoryName[#] -> ""] & /@ > FileNames[{"*.m"}, {dir}], > -2], > "PacletInfo" | "Usage", \[Infinity]]; > > directories = FileNames[{"*"}, > {ToFileName[{$InstallationDirectory, "AddOns", root}]}]; > > directories = Select[directories, FileType[#] === Directory &]; > > packageData = {context[#], packageFiles[#]} & /@ directories; > > packageData = DeleteCases[packageData, {_, {}}]; > > toMenuData[{cont_, files_}] := > > With[{topContext = cont <> "`"}, > > {cont, # :> Quiet[Needs[topContext <> # <> "`"]] & /@ files} > ]; > > menuData = toMenuData /@ packageData; > > menus = ActionMenu[Sequence @@ #, > BaseStyle -> {FontSize -> 10, FontFamily -> "Helvetica"}, > FieldSize -> 12, > Background -> Blue] & /@ menuData; > > > CreatePalette[ > Column[Flatten[{ > Button["Close", NotebookClose[ButtonNotebook[]], > BaseStyle -> {FontSize -> 10, FontFamily -> "Helvetica", > FontColor -> RGBColor[.4, 0, 0]}, Appearance -> "Palette"], > menus}]], > WindowSize -> {All, 350}, > WindowElements -> {"VerticalScrollBar", "StatusArea"}, > WindowTitle -> "Load " <> root, > WindowMargins -> {{Automatic, 10}, {Automatic, 5}}] > > ]; > > StandardPackagesPalette[] := StandardPackagesPalette["Packages"]; -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Re: 6.0 Standard Packages?, New Style Documentation?
- From: David Reiss <dbreiss@gmail.com>
- Re: 6.0 Standard Packages?, New Style Documentation?