Re: 6.0 Standard Packages?, New Style Documentation?
- To: mathgroup at smc.vnet.net
- Subject: [mg78081] Re: 6.0 Standard Packages?, New Style Documentation?
- From: David Reiss <dbreiss at gmail.com>
- Date: Fri, 22 Jun 2007 06:46:00 -0400 (EDT)
- References: <f4dspd$hiv$1@smc.vnet.net><200706110826.EAA21182@smc.vnet.net>
It turns out that the notebook needs to "think" that it has been altered in order for it to prompt you to save lt. One trivial way to ahve this happen is to move the palette's position (this changes some internal optoins that specify its position). Then clicking on the close field (not the "Close" botton which doesn't care) will bring up the file save dialog. Another way is to execute nb = StandardPackagesPalette[] and then execute NotebookSave[nb] which also will bring up the save dialog. If, once this has been done, you wish for the palette to remember where it was the last time you opened it, you should add the option ClosingAutoSave->True to the code as well. On Jun 20, 5:42 am, Murray Eisenberg <mur... at math.umass.edu> wrote: > 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?? > > > > DavidReisswrote: > > 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... > > > --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 mur... 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?