1 | ############################################################################ |
---|
2 | # |
---|
3 | # SAGE UI - A Graphical User Interface for SAGE |
---|
4 | # Copyright (C) 2005 Electronic Visualization Laboratory, |
---|
5 | # University of Illinois at Chicago |
---|
6 | # |
---|
7 | # All rights reserved. |
---|
8 | # |
---|
9 | # Redistribution and use in source and binary forms, with or without |
---|
10 | # modification, are permitted provided that the following conditions are met: |
---|
11 | # |
---|
12 | # * Redistributions of source code must retain the above copyright |
---|
13 | # notice, this list of conditions and the following disclaimer. |
---|
14 | # * Redistributions in binary form must reproduce the above |
---|
15 | # copyright notice, this list of conditions and the following disclaimer |
---|
16 | # in the documentation and/or other materials provided with the distribution. |
---|
17 | # * Neither the name of the University of Illinois at Chicago nor |
---|
18 | # the names of its contributors may be used to endorse or promote |
---|
19 | # products derived from this software without specific prior written permission. |
---|
20 | # |
---|
21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
25 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
26 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
27 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
28 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
29 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
30 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
31 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | # |
---|
33 | # Direct questions, comments etc about SAGE UI to www.evl.uic.edu/cavern/forum |
---|
34 | # |
---|
35 | # Author: Ratko Jagodic |
---|
36 | # |
---|
37 | ############################################################################ |
---|
38 | |
---|
39 | import wx.lib.dialogs |
---|
40 | from globals import * |
---|
41 | from wx.lib import layoutf |
---|
42 | |
---|
43 | # a list of IDs for all the help text |
---|
44 | FILE_LIBRARY = 9000 |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | allHelpStrings = {} # help strings keyed by the above IDs |
---|
50 | |
---|
51 | # checks if the event that triggered this is a EVT_CHAR and it comes from an F1 key |
---|
52 | def ShowHelp(event): |
---|
53 | if hasattr(event,"GetKeyCode") and not event.GetKeyCode() == wx.WXK_F1: |
---|
54 | event.Skip() #propagate the event further cause someone else might need it |
---|
55 | else: |
---|
56 | dlg = ScrolledMessageDialog(None, allHelpStrings[event.GetId()], "Help", size=(500,400)) |
---|
57 | dlg.ShowModal() |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | class ScrolledMessageDialog(wx.Dialog): |
---|
62 | def __init__(self, parent, msg, caption, |
---|
63 | pos=wx.DefaultPosition, size=(500,300), |
---|
64 | style=wx.DEFAULT_DIALOG_STYLE): |
---|
65 | wx.Dialog.__init__(self, parent, -1, caption, pos, size, style) |
---|
66 | self.SetBackgroundColour(dialogColor) |
---|
67 | self.SetForegroundColour(wx.WHITE) |
---|
68 | x, y = pos |
---|
69 | if x == -1 and y == -1: |
---|
70 | self.CenterOnScreen(wx.BOTH) |
---|
71 | |
---|
72 | text = wx.TextCtrl(self, -1, msg, |
---|
73 | style=wx.TE_MULTILINE | wx.TE_READONLY) |
---|
74 | #text.SetBackgroundColour(appPanelColor) |
---|
75 | #text.SetDefaultStyle(wx.TextAttr(wx.WHITE, appPanelColor)) |
---|
76 | ok = wx.Button(self, wx.ID_OK, "OK") |
---|
77 | ok.SetDefault() |
---|
78 | lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)) |
---|
79 | text.SetConstraints(lc) |
---|
80 | |
---|
81 | lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h*', (self,)) |
---|
82 | ok.SetConstraints(lc) |
---|
83 | |
---|
84 | self.SetAutoLayout(1) |
---|
85 | self.Layout() |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | |
---|
90 | allHelpStrings[ FILE_LIBRARY ]='''File Library Help\n-------------------------\n |
---|
91 | All the files are organized by their type and for each type there is a directory. Under each directory you can have multiple sub-directories to help you organize the files better. The tree you see is a direct representation of the actual directory tree on the server, except from the "favorites" which is explained later. You can add files, delete them, move them, create and delete directories, view previews and show files on the tiled display. |
---|
92 | |
---|
93 | |
---|
94 | NOTE: Most of the following actions directly affect the files and directories on the server. |
---|
95 | |
---|
96 | SEARCH: |
---|
97 | - you can search as you type. By pressing ENTER or RETURN in the search box you search for the next occurence of the same string. "Find Again" button performs the same action.\n |
---|
98 | REFRESH: |
---|
99 | - this refreshes the whole directory tree to bring it up to date with any changes other users made. The tree will be automatically refreshed if a file could not be found in any of the below operations.\n |
---|
100 | ADD FILES: |
---|
101 | - just drag and drop a file from your computer anywhere on the tree (or use the "Browse for Files). The file will be uploaded to the server automatically and initially stored in the directory that matches its type. If a file with the same filename and file size exists, it will not be uploaded.\n |
---|
102 | DELETE FILES: |
---|
103 | - right click on a file you wish to delete and click "Delete File". The file will be permanently deleted from the server.\n |
---|
104 | MOVE FILES: |
---|
105 | - to organize your files you can move them from one directory to another (but only within the same "type" folder). To move a file just drag and drop it where you want it. You can even drop the file on another file and it will be moved to the same folder as that file. Note however, that directories cannot be moved nor can favorite files. If you drop the file on a wrong place the move will be ignored.\n |
---|
106 | CREATE DIRECTORY: |
---|
107 | - to create a sub-directory right click on any directory and click "New Folder". A new directory will be created as a sub-dir of the clicked one. You can then populate this new directory with files.\n |
---|
108 | DELETE DIRECTORY: |
---|
109 | - to delete a directory and all the files in it right click on a directory and click "Delete Folder".\n |
---|
110 | VIEW PREVIEW: |
---|
111 | - previews are automatically shown when a file is clicked on. However, previews are only available for images.\n |
---|
112 | SHOW FILE: |
---|
113 | - Simply double-click on a file and it will be shown. Another way is when a file is selected the show button is enabled and you can click it to show the file. The execution information (app name, params...) used for showing the file is retrieved from the server which in turn reads it from a config file.\n\n |
---|
114 | FAVORITES: |
---|
115 | ----------------- |
---|
116 | - the last outermost folder is called "favorites" and this is where you can store your favorite files (think of them as bookmarks or symbolic links). This whole folder and the files in it are just virtual and do not really exist on the server or your computer. However, the list of files in there is automatically stored on your local computer whenever there is a change and they are automatically reloaded upon startup.\n |
---|
117 | ADD FILES TO FAVORITES: |
---|
118 | - drag and drop a file from anywhere to anywhere in the favorites part of the tree. The file link will be automatically put under the correct type. The file itself will not be moved on the server, just a symbolic link will be created so when original files location changes this link will be invalid.\n |
---|
119 | REMOVE FILES FROM FAVORITES: |
---|
120 | - right click on a file and select "Remove From Favorites". This action will not remove the file from the server.\n |
---|
121 | SHOW A FILE FROM FAVORITES: |
---|
122 | - the same procedure as above (double-click or "Show" button) |
---|
123 | |
---|
124 | NOTE: You cannot create new folders or move files within the favorites folder. Also, these files might become invalid if the orginal files that they point to have been moved/removed. In that case remove the file from favorites and add it again. |
---|
125 | ''' |
---|