Commit d484691c authored by Russ Fish's avatar Russ Fish

-

Resizing the window, and moving the splitter between the HyperViewer canvas and
controls panel, now work.

 . Resizing of GLCanvas for HyperViewer.  EVT_SIZE(self.hypView, self.OnResizeCanvas)

 . Control the size of the controls panel.
		 EVT_SIZE(self.window_1, self.OnResizeWindow)
		 EVT_SPLITTER_SASH_POS_CHANGED(self.window_1, -1, self.OnSashChanged)

 . Keep dragging of the window divider outside the window from blanking the
   HyperViewer canvas or controls panel.         self.window_1.SetMinimumPaneSize(21)
parent c89c8d3d
......@@ -141,7 +141,7 @@ class hvFrameUI(wxFrame):
self.LabelNodeName = wxStaticText(self.Controls, -1, "Node name:")
self.NodeName = wxTextCtrl(self.Controls, -1, "", style=wxTE_PROCESS_ENTER)
self.LabelChildCount = wxStaticText(self.Controls, -1, "Child count: ")
self.ChildCount = wxStaticText(self.Controls, -1, " 0")
self.ChildCount = wxStaticText(self.Controls, -1, " 0 ")
self.LabelLinksIn = wxStaticText(self.Controls, -1, "Non-tree Links in: 0")
self.ShowLinksIn = wxButton(self.Controls, -1, "show")
self.HideLinksIn = wxButton(self.Controls, -1, "hide")
......@@ -175,8 +175,6 @@ class hvFrameUI(wxFrame):
# begin wxGlade: hvFrameUI.__set_properties
self.SetTitle("wxHyperViewer")
self.SetSize((760, 651))
self.hypView.SetSize((559, 693))
self.panel_1.SetSize((517, 615))
self.ShowLinksIn.Enable(0)
self.HideLinksIn.Enable(0)
self.DescendLinksIn.SetValue(1)
......@@ -199,8 +197,9 @@ class hvFrameUI(wxFrame):
self.AnimStepCount.SetToolTipString("Number of frames per second in animated moves")
self.label_6.SetToolTipString("Number of frames per animation")
self.window_1.SetSize((760, 619))
self.window_1.SplitVertically(self.panel_1, self.Controls)
self.window_1.SplitVertically(self.panel_1, self.Controls, 560)
# end wxGlade
self.window_1.SetMinimumPaneSize(21) # Keep the controls or viewer from disappearing.
def __do_layout(self):
# begin wxGlade: hvFrameUI.__do_layout
......@@ -217,9 +216,11 @@ class hvFrameUI(wxFrame):
sizer_7 = wxBoxSizer(wxHORIZONTAL)
sizer_6 = wxBoxSizer(wxHORIZONTAL)
sizer_3 = wxBoxSizer(wxVERTICAL)
sizer_3.Add(self.hypView, 99, 0, 0)
sizer_3.Add(self.hypView, 99, wxEXPAND, 0)
self.panel_1.SetAutoLayout(1)
self.panel_1.SetSizer(sizer_3)
sizer_3.Fit(self.panel_1)
sizer_3.SetSizeHints(self.panel_1)
Nodes.Add(self.GoToTop, 0, 0, 15)
sizer_6.Add(self.LabelNodeName, 0, 0, 10)
sizer_6.Add(self.NodeName, 1, wxLEFT|wxEXPAND, 5)
......
<?xml version="1.0"?>
<!-- generated by wxGlade 0.3.1 on Fri Aug 6 15:02:00 2004 -->
<!-- generated by wxGlade 0.3.1 on Fri Aug 6 18:00:26 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">
......@@ -39,15 +39,16 @@
<object class="wxSplitterWindow" name="window_1" base="EditSplitterWindow">
<style>wxSP_3D</style>
<orientation>wxSPLIT_VERTICAL</orientation>
<sash_pos>560</sash_pos>
<window_2>Controls</window_2>
<window_1>panel_1</window_1>
<size>760, 619</size>
<object class="wxPanel" name="panel_1" base="EditPanel">
<style>wxTAB_TRAVERSAL</style>
<size>517, 615</size>
<object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<flag>wxEXPAND</flag>
<border>0</border>
<option>99</option>
<object class="hvGLCanvas" name="hypView" base="CustomWidget">
......@@ -55,7 +56,6 @@
<argument>$parent</argument>
<argument>$id</argument>
</arguments>
<size>559, 693</size>
</object>
</object>
</object>
......
......@@ -130,8 +130,11 @@ class hvFrame(hvFrameUI):
def __init__(self, *args, **kwds):
# Set up the wxGlade part.
hvFrameUI.__init__(self, *args, **kwds)
# Remember the original width of the controls panel in the splitter.
self.controlsWidth = self.window_1.GetSize().width - self.window_1.GetSashPosition()
self.vwr = None # Load data under the File menu and create the viewer there.
self.vwr = None # Load data and create the viewer later in ReadTopFile.
self.currNode = None # Nothing selected at first.
# Control events. (HyperViewer events are connected after loading data.)
......@@ -163,6 +166,8 @@ class hvFrame(hvFrameUI):
EVT_SLIDER(self.AnimStepCount, -1, self.OnAnimStepCount) # GTK
# Other events.
EVT_SIZE(self.window_1, self.OnResizeWindow)
EVT_SPLITTER_SASH_POS_CHANGED(self.window_1, -1, self.OnSashChanged)
EVT_CLOSE(self, self.OnExit)
# These do nothing until the vwr is instantiated below.
EVT_IDLE(self.hypView, self.OnIdle)
......@@ -226,6 +231,7 @@ class hvFrame(hvFrameUI):
EVT_MIDDLE_DOWN(self.hypView, self.OnClick)
EVT_MIDDLE_UP(self.hypView, self.OnClick)
EVT_MOTION(self.hypView, self.OnMove)
EVT_SIZE(self.hypView, self.OnResizeCanvas)
self.OnGoToTop(None) # Show info for the top node.
......@@ -236,7 +242,7 @@ class hvFrame(hvFrameUI):
def DrawGL(self):
##print "in DrawGL"
self.vwr.drawFrame()
pass
pass
##
# The GUI displays information about the currently selected node.
......@@ -479,7 +485,7 @@ class hvFrame(hvFrameUI):
pass
##
# Mouse motion events.
# Mouse motion events in the HyperViewer canvas.
def OnMove(self, mouseEvent):
# Hyperviewer calls motion when a mouse button is clicked "active"
if mouseEvent.LeftIsDown() or mouseEvent.MiddleIsDown():
......@@ -492,6 +498,31 @@ class hvFrame(hvFrameUI):
self.vwr.redraw()
pass
##
# Resizing for the splitter window.
def OnResizeWindow(self, sizeEvent):
# Keep the width of the controls panel in the splitter constant.
self.window_1.SetSashPosition(self.window_1.GetSize().width - self.controlsWidth)
pass
def OnSashChanged(self, splitterEvent):
# Remember an intentional change in the controls panel width.
self.controlsWidth = self.window_1.GetSize().width - splitterEvent.GetSashPosition()
pass
##
# Resizing for the HyperViewer canvas.
def OnResizeCanvas(self, sizeEvent):
# Tie the size of the canvas to the panel it's in.
size = self.panel_1.GetSize()
# We get two resize events: one with a width of 20. Ignore it.
if size.width >= 20:
self.hypView.SetSize(size)
# Tell HyperViewer about the change.
self.vwr.reshape(size.width, size.height)
pass
##
# Other events generated by the event toploop and window system interface.
def OnIdle(self, idleEvent):
......
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