hvFrameUI.py 13.1 KB
Newer Older
1 2
#!/usr/bin/env python
# generated by wxGlade 0.3.1 on Fri May 14 10:24:08 2004
3 4
#
# Copyright (c) 2004 University of Utah and the Flux Group.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Russ Fish's avatar
Russ Fish committed
24
#
25
from wxPython.wx import *
Russ Fish's avatar
Russ Fish committed
26 27 28 29 30 31 32 33 34 35 36 37
from wxPython.glcanvas import *

class hvGLCanvas(wxGLCanvas):
    def __init__(self, *args, **kwds):
        ## The PyOpenGL canvas initialization is broken.
        ## The following doesn't yet work on Windows, although
        ## it is needed for picking, and seg-faults on FreeBSD.
        ##kwds["attribList"] = [WX_GL_DOUBLEBUFFER, WX_GL_RGBA,
        ##                      WX_GL_DEPTH_SIZE, 32, 0]
        wxGLCanvas.__init__(self, *args, **kwds)
        pass
    pass
38 39 40 41 42 43

class UsageDialogUI(wxDialog):
    def __init__(self, *args, **kwds):
        # begin wxGlade: UsageDialogUI.__init__
        kwds["style"] = wxDEFAULT_DIALOG_STYLE
        wxDialog.__init__(self, *args, **kwds)
44
        self.Usage = wxStaticText(self, -1, "\n  HyperViewer mouse usage:\n  -----------------------------------\n\n  Objects close to the center of the sphere are largest.  \n\n  Left mouse drag: X,Y movement in hyperbolic space.  \n\n  Control- or Shift- Left mouse, or Middle mouse, drag:\n  Rotate the hyperbolic space.  \n\n  Pickable nodes under the cursor turn bright  green.    \n  Left-click to bring them to the center.  \n\n")
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: UsageDialogUI.__set_properties
        self.SetTitle("wxHyperViewer usage")
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: UsageDialogUI.__do_layout
        sizer_5 = wxBoxSizer(wxVERTICAL)
        sizer_5.Add(self.Usage, 0, 0, 10)
        sizer_5.Add(20, 1, 0, 0, 0)
        self.SetAutoLayout(1)
        self.SetSizer(sizer_5)
        sizer_5.Fit(self)
        sizer_5.SetSizeHints(self)
        self.Layout()
        # end wxGlade

# end of class UsageDialogUI


class OpenDialogUI(wxDialog):
    def __init__(self, *args, **kwds):
        # begin wxGlade: OpenDialogUI.__init__
73
        kwds["style"] = wxCAPTION|wxRESIZE_BORDER|wxTHICK_FRAME
74
        wxDialog.__init__(self, *args, **kwds)
75
        self.FileToOpen = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
76
        self.OpenFile = wxButton(self, -1, "Open Data File")
77
        self.FileMsg = wxStaticText(self, -1, "")
78 79
        self.label_3 = wxStaticText(self, -1, "SSH login name:", style=wxALIGN_RIGHT)
        self.LoginName = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
80
        self.label_2 = wxStaticText(self, -1, "Project name:", style=wxALIGN_RIGHT)
81
        self.ProjectName = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
82
        self.label_7 = wxStaticText(self, -1, "Experiment name:")
83
        self.ExperimentName = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
84
        self.label_8 = wxStaticText(self, -1, "Root (optional):")
85
        self.ExperimentRoot = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
86
        self.OpenExperiment = wxButton(self, -1, "Retrieve experiment")
Russ Fish's avatar
Russ Fish committed
87
        self.ExperimentMsg = wxStaticText(self, -1, " \n ")
88 89 90 91 92 93 94 95

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: OpenDialogUI.__set_properties
        self.SetTitle("Open HyperViewer Data")
96
        self.SetSize((430, 372))
97
        self.FileToOpen.SetFocus()
98 99 100 101 102 103
        # end wxGlade

    def __do_layout(self):
        # begin wxGlade: OpenDialogUI.__do_layout
        sizer_4 = wxBoxSizer(wxVERTICAL)
        ExperimentOpening = wxStaticBoxSizer(wxStaticBox(self, -1, "Experiment to retrieve:"), wxVERTICAL)
104
        grid_sizer_1 = wxFlexGridSizer(4, 2, 10, 10)
105
        FileOpening = wxStaticBoxSizer(wxStaticBox(self, -1, "File for HyperViewer data:"), wxVERTICAL)
106
        FileOpening.Add(self.FileToOpen, 0, wxTOP|wxEXPAND, 5)
107
        FileOpening.Add(self.OpenFile, 0, wxTOP|wxALIGN_CENTER_HORIZONTAL, 10)
108
        FileOpening.Add(self.FileMsg, 0, 0, 0)
109
        sizer_4.Add(FileOpening, 0, wxALL|wxEXPAND, 10)
110 111 112
        grid_sizer_1.Add(self.label_3, 0, wxALIGN_CENTER_VERTICAL, 0)
        grid_sizer_1.Add(self.LoginName, 0, wxTOP|wxEXPAND, 5)
        grid_sizer_1.Add(self.label_2, 0, wxALIGN_CENTER_VERTICAL, 0)
113
        grid_sizer_1.Add(self.ProjectName, 0, wxEXPAND, 0)
114
        grid_sizer_1.Add(self.label_7, 0, wxALIGN_CENTER_VERTICAL, 0)
115
        grid_sizer_1.Add(self.ExperimentName, 0, wxEXPAND, 0)
116
        grid_sizer_1.Add(self.label_8, 0, wxALIGN_CENTER_VERTICAL, 0)
117 118
        grid_sizer_1.Add(self.ExperimentRoot, 0, wxEXPAND, 0)
        grid_sizer_1.AddGrowableCol(1)
119
        ExperimentOpening.Add(grid_sizer_1, 0, wxEXPAND, 0)
120
        ExperimentOpening.Add(self.OpenExperiment, 0, wxTOP|wxALIGN_CENTER_HORIZONTAL, 10)
121
        ExperimentOpening.Add(self.ExperimentMsg, 0, 0, 0)
122
        sizer_4.Add(ExperimentOpening, 0, wxALL|wxEXPAND, 10)
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
        self.SetAutoLayout(1)
        self.SetSizer(sizer_4)
        self.Layout()
        # end wxGlade

# end of class OpenDialogUI


class hvFrameUI(wxFrame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: hvFrameUI.__init__
        kwds["style"] = wxDEFAULT_FRAME_STYLE
        wxFrame.__init__(self, *args, **kwds)
        self.window_1 = wxSplitterWindow(self, -1)
        self.Controls = wxPanel(self.window_1, -1)
        self.panel_1 = wxPanel(self.window_1, -1)
        
        # Menu Bar
        self.Menu = wxMenuBar()
        self.SetMenuBar(self.Menu)
        wxglade_tmp_menu = wxMenu()
        wxglade_tmp_menu.Append(1, "&Open...\tCtrl+O", "", wxITEM_NORMAL)
        wxglade_tmp_menu.Append(2, "E&xit\tCtrl+Q", "", wxITEM_NORMAL)
        self.Menu.Append(wxglade_tmp_menu, "&File")
        wxglade_tmp_menu = wxMenu()
        wxglade_tmp_menu.Append(3, "&Usage\tCtrl+H", "", wxITEM_NORMAL)
        self.Menu.Append(wxglade_tmp_menu, "&Help")
        # Menu Bar end
Russ Fish's avatar
Russ Fish committed
151
        self.hypView = hvGLCanvas(self.panel_1, -1)
152
        self.GoToTop = wxButton(self.Controls, -1, "go to top")
153
        self.LabelNodeName = wxStaticText(self.Controls, -1, "Node name:")
154
        self.NodeName = wxTextCtrl(self.Controls, -1, "", style=wxTE_PROCESS_ENTER)
155
        self.LabelChildCount = wxStaticText(self.Controls, -1, "Child count:  ")
Russ Fish's avatar
-  
Russ Fish committed
156
        self.ChildCount = wxStaticText(self.Controls, -1, " 0  ")
157
        self.LabelLinksIn = wxStaticText(self.Controls, -1, "Non-tree Links in:   0")
158 159 160
        self.ShowLinksIn = wxButton(self.Controls, -1, "show")
        self.HideLinksIn = wxButton(self.Controls, -1, "hide")
        self.DescendLinksIn = wxCheckBox(self.Controls, -1, "descend")
161
        self.LabelLinksOut = wxStaticText(self.Controls, -1, "Non-tree Links out:  0")
162 163 164 165 166 167 168 169 170
        self.ShowLinksOut = wxButton(self.Controls, -1, "show")
        self.HideLinksOut = wxButton(self.Controls, -1, "hide")
        self.DescendLinksOut = wxCheckBox(self.Controls, -1, "descend")
        self.static_line_1 = wxStaticLine(self.Controls, -1)
        self.DrawSphere = wxCheckBox(self.Controls, -1, "Draw sphere")
        self.DrawNodes = wxCheckBox(self.Controls, -1, "Draw nodes")
        self.DrawLinks = wxCheckBox(self.Controls, -1, "Draw links")
        self.KeepAspect = wxCheckBox(self.Controls, -1, "Keep aspect")
        self.LabelToRight = wxCheckBox(self.Controls, -1, "Label to right")
171
        self.LabelsMode = wxChoice(self.Controls, -1, choices=["None", "Short", "Long"])
172 173 174 175 176
        self.label_3 = wxStaticText(self.Controls, -1, "  Labels")
        self.CountGenNode = wxSpinCtrl(self.Controls, -1, "30", min=1, max=30)
        self.label_4 = wxStaticText(self.Controls, -1, "  Node depth")
        self.CountGenLink = wxSpinCtrl(self.Controls, -1, "30", min=1, max=30)
        self.label_5 = wxStaticText(self.Controls, -1, "  Link depth")
Russ Fish's avatar
Russ Fish committed
177
        self.AnimStepCount = wxSlider(self.Controls, -1, 12, 1, 100, style=wxSL_HORIZONTAL|wxSL_LABELS)
178 179 180 181 182 183 184 185 186 187 188
        self.label_6 = wxStaticText(self.Controls, -1, "    Animation frames")
        self.static_line_2 = wxStaticLine(self.Controls, -1)
        self.HelpButton = wxButton(self.Controls, -1, "Help")

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

    def __set_properties(self):
        # begin wxGlade: hvFrameUI.__set_properties
        self.SetTitle("wxHyperViewer")
189 190 191
        self.SetSize((760, 651))
        self.ShowLinksIn.Enable(0)
        self.HideLinksIn.Enable(0)
192
        self.DescendLinksIn.SetValue(1)
193 194
        self.ShowLinksOut.Enable(0)
        self.HideLinksOut.Enable(0)
195 196 197 198 199
        self.DescendLinksOut.SetValue(1)
        self.DrawSphere.SetValue(1)
        self.DrawNodes.SetValue(1)
        self.DrawLinks.SetValue(1)
        self.KeepAspect.SetValue(1)
200
        self.LabelsMode.SetSize((70, 25))
201
        self.LabelsMode.SetSelection(2)
202
        self.CountGenNode.SetSize((70, 25))
203 204
        self.CountGenNode.SetToolTipString("Generation Node Limit")
        self.label_4.SetToolTipString("Generation Link Limit")
205
        self.CountGenLink.SetSize((70, 25))
206 207 208
        self.CountGenLink.SetToolTipString("Generation Link Limit")
        self.label_5.SetToolTipString("Generation Link Limit")
        self.AnimStepCount.SetSize((150, 40))
Russ Fish's avatar
Russ Fish committed
209
        self.AnimStepCount.SetToolTipString("Number of frames per second in animated moves")
210
        self.label_6.SetToolTipString("Number of frames per animation")
211
        self.window_1.SetSize((760, 619))
Russ Fish's avatar
-  
Russ Fish committed
212
        self.window_1.SplitVertically(self.panel_1, self.Controls, 560)
213
        # end wxGlade
Russ Fish's avatar
-  
Russ Fish committed
214
        self.window_1.SetMinimumPaneSize(21) # Keep the controls or viewer from disappearing.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230

    def __do_layout(self):
        # begin wxGlade: hvFrameUI.__do_layout
        sizer_1 = wxBoxSizer(wxVERTICAL)
        sizer_2 = wxBoxSizer(wxVERTICAL)
        Modes = wxBoxSizer(wxVERTICAL)
        AnimSteps = wxBoxSizer(wxVERTICAL)
        GenLinkLimit = wxBoxSizer(wxHORIZONTAL)
        GenNodeLimit = wxBoxSizer(wxHORIZONTAL)
        Labels = wxBoxSizer(wxHORIZONTAL)
        Nodes = wxBoxSizer(wxVERTICAL)
        sizer_9 = wxBoxSizer(wxHORIZONTAL)
        sizer_8 = wxBoxSizer(wxHORIZONTAL)
        sizer_7 = wxBoxSizer(wxHORIZONTAL)
        sizer_6 = wxBoxSizer(wxHORIZONTAL)
        sizer_3 = wxBoxSizer(wxVERTICAL)
Russ Fish's avatar
-  
Russ Fish committed
231
        sizer_3.Add(self.hypView, 99, wxEXPAND, 0)
232 233
        self.panel_1.SetAutoLayout(1)
        self.panel_1.SetSizer(sizer_3)
Russ Fish's avatar
-  
Russ Fish committed
234 235
        sizer_3.Fit(self.panel_1)
        sizer_3.SetSizeHints(self.panel_1)
236 237 238
        Nodes.Add(self.GoToTop, 0, 0, 15)
        sizer_6.Add(self.LabelNodeName, 0, 0, 10)
        sizer_6.Add(self.NodeName, 1, wxLEFT|wxEXPAND, 5)
239
        Nodes.Add(sizer_6, 1, wxEXPAND, 0)
240
        sizer_7.Add(self.LabelChildCount, 0, 0, 10)
241 242
        sizer_7.Add(self.ChildCount, 0, 0, 0)
        Nodes.Add(sizer_7, 1, wxEXPAND, 0)
243 244
        Nodes.Add(self.LabelLinksIn, 0, 0, 10)
        sizer_8.Add(self.ShowLinksIn, 0, wxLEFT, 15)
245
        sizer_8.Add(self.HideLinksIn, 0, 0, 0)
246
        Nodes.Add(sizer_8, 1, 0, 0)
247
        Nodes.Add(self.DescendLinksIn, 0, wxALIGN_CENTER_HORIZONTAL, 0)
248 249
        Nodes.Add(self.LabelLinksOut, 0, wxTOP, 10)
        sizer_9.Add(self.ShowLinksOut, 0, wxLEFT, 15)
250
        sizer_9.Add(self.HideLinksOut, 0, 0, 0)
251
        Nodes.Add(sizer_9, 1, 0, 0)
252
        Nodes.Add(self.DescendLinksOut, 0, wxALIGN_CENTER_HORIZONTAL, 0)
253 254 255
        sizer_2.Add(Nodes, 0, wxALL|wxEXPAND, 10)
        sizer_2.Add(self.static_line_1, 0, wxEXPAND, 10)
        Modes.Add(self.DrawSphere, 0, 0, 10)
256 257 258
        Modes.Add(self.DrawNodes, 0, 0, 0)
        Modes.Add(self.DrawLinks, 0, 0, 0)
        Modes.Add(self.KeepAspect, 0, 0, 0)
259
        Modes.Add(self.LabelToRight, 0, wxTOP, 10)
260 261 262
        Labels.Add(self.LabelsMode, 0, 0, 0)
        Labels.Add(self.label_3, 0, 0, 0)
        Modes.Add(Labels, 0, 0, 0)
263
        GenNodeLimit.Add(self.CountGenNode, 0, 0, 10)
264
        GenNodeLimit.Add(self.label_4, 0, 0, 0)
265
        Modes.Add(GenNodeLimit, 0, wxTOP, 15)
266 267 268 269 270
        GenLinkLimit.Add(self.CountGenLink, 0, 0, 0)
        GenLinkLimit.Add(self.label_5, 0, 0, 0)
        Modes.Add(GenLinkLimit, 0, 0, 0)
        AnimSteps.Add(self.AnimStepCount, 0, wxBOTTOM, 0)
        AnimSteps.Add(self.label_6, 0, 0, 0)
271 272 273 274
        Modes.Add(AnimSteps, 0, wxTOP, 10)
        sizer_2.Add(Modes, 0, wxALL, 10)
        sizer_2.Add(self.static_line_2, 0, wxTOP|wxBOTTOM|wxEXPAND, 10)
        sizer_2.Add(self.HelpButton, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 10)
275 276 277 278 279 280 281 282 283 284 285 286 287
        self.Controls.SetAutoLayout(1)
        self.Controls.SetSizer(sizer_2)
        sizer_2.Fit(self.Controls)
        sizer_2.SetSizeHints(self.Controls)
        sizer_1.Add(self.window_1, 1, wxEXPAND, 0)
        self.SetAutoLayout(1)
        self.SetSizer(sizer_1)
        self.Layout()
        # end wxGlade

# end of class hvFrameUI