Commit c81e9477 authored by Russ Fish's avatar Russ Fish

A couple of tweaks in response to Rob's installation experience on Windows:

       . Add an EMULAB_PROJECT environment variable to set the default project.
       . Expose the EMULAB_USER login name for SSH on the Open/Experiment dialog.
parent 4941fe52
......@@ -67,6 +67,8 @@ class OpenDialogUI(wxDialog):
self.FileToOpen = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
self.OpenFile = wxButton(self, -1, "Open Data File")
self.FileMsg = wxStaticText(self, -1, "")
self.label_3 = wxStaticText(self, -1, "SSH login name:", style=wxALIGN_RIGHT)
self.LoginName = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
self.label_2 = wxStaticText(self, -1, "Project name:", style=wxALIGN_RIGHT)
self.ProjectName = wxTextCtrl(self, -1, "", style=wxTE_PROCESS_ENTER)
self.label_7 = wxStaticText(self, -1, "Experiment name:")
......@@ -83,7 +85,7 @@ class OpenDialogUI(wxDialog):
def __set_properties(self):
# begin wxGlade: OpenDialogUI.__set_properties
self.SetTitle("Open HyperViewer Data")
self.SetSize((387, 351))
self.SetSize((430, 372))
self.FileToOpen.SetFocus()
# end wxGlade
......@@ -91,17 +93,19 @@ class OpenDialogUI(wxDialog):
# begin wxGlade: OpenDialogUI.__do_layout
sizer_4 = wxBoxSizer(wxVERTICAL)
ExperimentOpening = wxStaticBoxSizer(wxStaticBox(self, -1, "Experiment to retrieve:"), wxVERTICAL)
grid_sizer_1 = wxFlexGridSizer(3, 2, 10, 10)
grid_sizer_1 = wxFlexGridSizer(4, 2, 10, 10)
FileOpening = wxStaticBoxSizer(wxStaticBox(self, -1, "File for HyperViewer data:"), wxVERTICAL)
FileOpening.Add(self.FileToOpen, 0, wxEXPAND, 0)
FileOpening.Add(self.FileToOpen, 0, wxTOP|wxEXPAND, 5)
FileOpening.Add(self.OpenFile, 0, wxTOP|wxALIGN_CENTER_HORIZONTAL, 10)
FileOpening.Add(self.FileMsg, 0, 0, 0)
sizer_4.Add(FileOpening, 0, wxALL|wxEXPAND, 10)
grid_sizer_1.Add(self.label_2, 0, 0, 0)
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)
grid_sizer_1.Add(self.ProjectName, 0, wxEXPAND, 0)
grid_sizer_1.Add(self.label_7, 0, 0, 0)
grid_sizer_1.Add(self.label_7, 0, wxALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.ExperimentName, 0, wxEXPAND, 0)
grid_sizer_1.Add(self.label_8, 0, 0, 0)
grid_sizer_1.Add(self.label_8, 0, wxALIGN_CENTER_VERTICAL, 0)
grid_sizer_1.Add(self.ExperimentRoot, 0, wxEXPAND, 0)
grid_sizer_1.AddGrowableCol(1)
ExperimentOpening.Add(grid_sizer_1, 0, wxEXPAND, 0)
......
<?xml version="1.0"?>
<!-- generated by wxGlade 0.3.1 on Fri Aug 6 18:00:26 2004 -->
<!-- generated by wxGlade 0.3.1 on Tue Aug 10 18:24:57 2004 -->
<application path="hvFrameUI.py" name="hvGui" class="hvApp" option="0" language="python" top_window="" encoding="US-ASCII" use_gettext="0" overwrite="0">
<object class="hvFrameUI" name="MainWindow" base="EditFrame">
......@@ -120,7 +120,7 @@
<option>0</option>
<object class="wxStaticText" name="ChildCount" base="EditStaticText">
<attribute>1</attribute>
<label> 0</label>
<label> 0 </label>
</object>
</object>
</object>
......@@ -403,7 +403,7 @@
<object class="OpenDialogUI" name="OpenDialog" base="EditDialog">
<style>wxCAPTION|wxRESIZE_BORDER|wxTHICK_FRAME</style>
<title>Open HyperViewer Data</title>
<size>387, 351</size>
<size>430, 372</size>
<object class="wxBoxSizer" name="sizer_4" base="EditBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
......@@ -414,8 +414,8 @@
<orient>wxVERTICAL</orient>
<label>File for HyperViewer data:</label>
<object class="sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<flag>wxTOP|wxEXPAND</flag>
<border>5</border>
<option>0</option>
<object class="wxTextCtrl" name="FileToOpen" base="EditTextCtrl">
<style>wxTE_PROCESS_ENTER</style>
......@@ -453,11 +453,30 @@
<option>0</option>
<object class="wxFlexGridSizer" name="grid_sizer_1" base="EditFlexGridSizer">
<hgap>10</hgap>
<rows>3</rows>
<rows>4</rows>
<growable_cols>1</growable_cols>
<cols>2</cols>
<vgap>10</vgap>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL</flag>
<border>0</border>
<option>0</option>
<object class="wxStaticText" name="label_3" base="EditStaticText">
<style>wxALIGN_RIGHT</style>
<attribute>1</attribute>
<label>SSH login name:</label>
</object>
</object>
<object class="sizeritem">
<flag>wxTOP|wxEXPAND</flag>
<border>5</border>
<option>0</option>
<object class="wxTextCtrl" name="LoginName" base="EditTextCtrl">
<style>wxTE_PROCESS_ENTER</style>
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL</flag>
<border>0</border>
<option>0</option>
<object class="wxStaticText" name="label_2" base="EditStaticText">
......@@ -475,6 +494,7 @@
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL</flag>
<border>0</border>
<option>0</option>
<object class="wxStaticText" name="label_7" base="EditStaticText">
......@@ -491,6 +511,7 @@
</object>
</object>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL</flag>
<border>0</border>
<option>0</option>
<object class="wxStaticText" name="label_8" base="EditStaticText">
......
......@@ -42,8 +42,10 @@ class hvApp(wxApp):
# The app initialization.
def OnInit(self):
# Given command-line argument(s), attempt to read in a topology.
filename = filearg = project = experiment = root = None
filename = filearg = default_project = project = experiment = root = None
if os.environ.has_key("EMULAB_PROJECT"): # Default project name to use.
default_project = project = os.environ["EMULAB_PROJECT"]
# Any dash argument prints a usage message and exits.
if len(sys.argv) == 2 and sys.argv[1][0] == '-':
print '''Hyperviewer usage:
......@@ -58,6 +60,7 @@ class hvApp(wxApp):
sys.exit()
pass
# Given command-line argument(s), attempt to read in a topology.
# One command-line argument: read from a .hyp file.
# (File/experiment input is also in the OnOpenFile and OnOpenExperiment methods.)
elif len(sys.argv) == 2:
......@@ -68,6 +71,8 @@ class hvApp(wxApp):
# Two args: read an experiment from the DB via XML-RPC, and make a .hyp file.
elif len(sys.argv) == 3:
project = sys.argv[1]
if project == "":
project = default_project
experiment = sys.argv[2]
print "Getting project:", project + ", experiment:", experiment
filename = exptToHv.getExperiment(project, experiment)
......@@ -76,6 +81,8 @@ class hvApp(wxApp):
# Three args: experiment from database, with optional graph root node.
elif len(sys.argv) == 4:
project = sys.argv[1]
if project == "":
project = default_project
experiment = sys.argv[2]
root = sys.argv[3]
print "Getting project:", project + ", experiment:", experiment \
......@@ -93,15 +100,18 @@ class hvApp(wxApp):
# Initialize the text fields in the File/Open dialog.
if filearg:
self.openDialog.FileToOpen.SetValue(filearg)
self.openDialog.LoginName.SetValue(exptToHv.login_id)
if project:
self.openDialog.ProjectName.SetValue(project)
elif default_project:
self.openDialog.ProjectName.SetValue(default_project)
if experiment:
self.openDialog.ExperimentName.SetValue(experiment)
self.openDialog.ExperimentName.SetFocus()
if root:
self.openDialog.ExperimentRoot.SetValue(root)
# Make it visible.
# Make the top-level window visible.
self.frame.Show()
self.SetTopWindow(self.frame)
......@@ -557,6 +567,7 @@ class hvOpen(OpenDialogUI):
EVT_TEXT_ENTER(self.FileToOpen, -1, self.OnOpenFile)
EVT_BUTTON(self.OpenExperiment, -1, self.OnOpenExperiment)
EVT_TEXT_ENTER(self.LoginName, -1, self.OnLoginName)
EVT_TEXT_ENTER(self.ProjectName, -1, self.OnOpenExperiment)
EVT_TEXT_ENTER(self.ExperimentName, -1, self.OnOpenExperiment)
EVT_TEXT_ENTER(self.ExperimentRoot, -1, self.OnOpenExperiment)
......@@ -587,6 +598,12 @@ class hvOpen(OpenDialogUI):
pass
pass
##
# Change the SSH login name.
def OnLoginName(self, cmdEvent):
exptToHv.login_id = self.LoginName.GetLineText(0)
pass
##
# Get topology data for an experiment from the database via XML-RPC.
def OnOpenExperiment(self, cmdEvent):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment