commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue-designer/src/base/tools SchemaNavigator.py


From: Jason Cater
Subject: gnue-designer/src/base/tools SchemaNavigator.py
Date: Thu, 10 Jul 2003 18:15:36 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-designer
Branch:         
Changes by:     Jason Cater <address@hidden>    03/07/10 18:15:36

Modified files:
        src/base/tools : SchemaNavigator.py 

Log message:
        force the scrollbar to appear on the schema navigator.  It's still 
fscked up beyond usability (wx issues, not gnue), so I'm committing prior to 
gutting this control and using another wx widget

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-designer/src/base/tools/SchemaNavigator.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gnue-designer/src/base/tools/SchemaNavigator.py
diff -c gnue-designer/src/base/tools/SchemaNavigator.py:1.7 
gnue-designer/src/base/tools/SchemaNavigator.py:1.8
*** gnue-designer/src/base/tools/SchemaNavigator.py:1.7 Thu Jun 12 17:02:55 2003
--- gnue-designer/src/base/tools/SchemaNavigator.py     Thu Jul 10 18:15:36 2003
***************
*** 72,96 ****
      self.connectionNames.sort()
      self.connectionCache = {}
  
!     EVT_SIZE(self, self.__OnSize)
  
      self.current = None
  
!     self.scroller = self.scroll = scroll = wxSplitterScrolledWindow(self, -1,
!                  style=wxVSCROLL|wxNO_BORDER|wxCLIP_CHILDREN)
!     self.splitter = splitter = wxThinSplitterWindow(scroll, -1,
!                  style=wxSP_3DBORDER|wxCLIP_CHILDREN)
      splitter.SetSashSize(2)
-     self.tree = tree = TreeCtrl(splitter)
-     list = ListWindow(splitter, -1,
-                  style=wxNO_BORDER|wxTR_EDIT_LABELS )
  
  
-     splitter.SplitVertically(self.tree, list)
-     scroll.SetTargetWindow(tree)
-     scroll.EnableScrolling(1, 1)
-     list.SetTreeCtrl(self.tree)
-     tree.SetCompanionWindow(list)
  
      # EventAware provided by ToolBase
  ##    self.registerEventListeners({
--- 72,112 ----
      self.connectionNames.sort()
      self.connectionCache = {}
  
! ##    EVT_SIZE(self, self.__OnSize)
  
      self.current = None
  
! 
!     self.scroller = scroller = wxSplitterScrolledWindow(self, -1, #(50,50), 
(350, 250),
!                                       style=wxNO_BORDER | wxCLIP_CHILDREN | 
wxVSCROLL)
!     self.splitter = splitter = wxThinSplitterWindow(scroller, -1, 
style=wxSP_3DBORDER | wxCLIP_CHILDREN)
      splitter.SetSashSize(2)
  
+     print dir(scroller)
+ 
+     self.tree = tree = TreeCtrl(splitter, self)
+     root = self.tree.AddRoot('Schema')
+     tree.SetItemHasChildren(root, 1)
+     tree.SetPyData(root, self)
+     for connection in self.connectionNames:
+        ConnectionNode(self, tree, root, connection=connection)
+     tree.Expand(root)
+ 
+ 
+     valueWindow = ListWindow(splitter)
+ 
+     splitter.SplitVertically(tree, valueWindow, 150)
+     scroller.SetTargetWindow(tree)
+     scroller.EnableScrolling(False, False)
+ 
+     valueWindow.SetTreeCtrl(tree)
+     tree.SetCompanionWindow(valueWindow)
+ 
+     sizer = wxBoxSizer(wxVERTICAL)
+     sizer.Add(scroller, 1, wxEXPAND|wxALL, 0)
+     self.SetAutoLayout(True)
+     self.SetSizer(sizer)
  
  
      # EventAware provided by ToolBase
  ##    self.registerEventListeners({
***************
*** 100,130 ****
  ##                       'ObjectDeleted'       : self.onDeleteObject,
  ##                      })
  
-     root = self.tree.AddRoot('Schema')
-     tree.SetItemHasChildren(root, 1)
-     tree.SetPyData(root, self)
      self.expanded = 1
      EVT_TREE_BEGIN_DRAG(self, self.tree.GetId(), self.OnBeginDrag)
      EVT_TREE_BEGIN_RDRAG(self, self.tree.GetId(), self.OnBeginRDrag)
-     EVT_TREE_BEGIN_RDRAG(self, self.tree.GetId(), self.OnBeginRDrag)
  
-     for connection in self.connectionNames:
-        ConnectionNode(self, tree, root, connection=connection)
- 
-     splitter.SetSashPosition(100)
-     tree.Expand(root)
  
    def createToolbar(self, parent):
      return _SchemaToolbar(parent, self.instance)
  
    def __OnSize(self, event):
!     self.scroll.SetSize(self.GetClientSize())
! ##    self.scroller.SetScrollbars(10,10,10,10)
      # This is some hackery since the earlier
      # SetSashPosition is doing absolutely no good :(
      if self.splitter.GetSashPosition() < 30:
        self.splitter.SetSashPosition(int(self.splitter.GetSizeTuple()[0]*.6))
  
    # Since this class is the root node, we need to
    # emulate part of the Node class
    def getColumn(self, i=0):
--- 116,139 ----
  ##                       'ObjectDeleted'       : self.onDeleteObject,
  ##                      })
  
      self.expanded = 1
      EVT_TREE_BEGIN_DRAG(self, self.tree.GetId(), self.OnBeginDrag)
      EVT_TREE_BEGIN_RDRAG(self, self.tree.GetId(), self.OnBeginRDrag)
  
  
    def createToolbar(self, parent):
      return _SchemaToolbar(parent, self.instance)
  
    def __OnSize(self, event):
! #    self.scroll.SetSize(self.GetClientSize())
! #    self.scroller.SetScrollbars(10,10,10,10)
      # This is some hackery since the earlier
      # SetSashPosition is doing absolutely no good :(
      if self.splitter.GetSashPosition() < 30:
        self.splitter.SetSashPosition(int(self.splitter.GetSizeTuple()[0]*.6))
  
+     event.Skip()
+ 
    # Since this class is the root node, we need to
    # emulate part of the Node class
    def getColumn(self, i=0):
***************
*** 205,219 ****
  
  class TreeCtrl(wxRemotelyScrolledTreeCtrl):
  
!   def __init__(self, parent):
      wxRemotelyScrolledTreeCtrl.__init__(self, parent, -1,
!            style=wxTR_HAS_BUTTONS|wxTR_NO_LINES|
                   wxTR_ROW_LINES|wxNO_BORDER|wxTR_MULTIPLE)
  
!     EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.OnExpand)
  
  
!   def OnExpand(self, event):
      parent = event.GetItem()
      if self.GetChildrenCount(parent) > 0:
        return
--- 214,229 ----
  
  class TreeCtrl(wxRemotelyScrolledTreeCtrl):
  
!   def __init__(self, parent, tool):
      wxRemotelyScrolledTreeCtrl.__init__(self, parent, -1,
!            style=wxTR_HAS_BUTTONS|wxTR_NO_LINES| #wxTR_HIDE_ROOT|
                   wxTR_ROW_LINES|wxNO_BORDER|wxTR_MULTIPLE)
  
!     self.tool = tool
!     EVT_TREE_ITEM_EXPANDING(self, self.GetId(), self.__OnExpand)
  
  
!   def __OnExpand(self, event):
      parent = event.GetItem()
      if self.GetChildrenCount(parent) > 0:
        return
***************
*** 221,254 ****
      node = self.GetPyData(parent)
      if node and not node.expanded:
        node.expand()
  
      event.Skip()
  
  
  
  class ListWindow(wxTreeCompanionWindow):
!   def __init__(self, *args, **parms):
!     wxTreeCompanionWindow.__init__(self, *args, **parms)
      self.SetBackgroundColour("WHITE")
  
    # This method is called to draw each item in the value window
    def DrawItem(self, dc, itemId, rect):
      tree = self.GetTreeCtrl()
      if tree:
!       try:
!         text = tree.GetPyData(itemId).getColumn()
!         pen = wxPen(wxSystemSettings_GetSystemColour(wxSYS_COLOUR_3DLIGHT), 
1, wxSOLID)
!         dc.SetPen(pen)
!         dc.SetBrush(wxBrush(self.GetBackgroundColour(), wxSOLID))
!         dc.DrawRectangle(rect.x, rect.y, rect.width+1, rect.height+1)
!         dc.SetTextForeground("BLACK")
!         dc.SetBackgroundMode(wxTRANSPARENT)
!         tw, th = dc.GetTextExtent(text)
!         x = 5
!         y = rect.y + max(0, (rect.height - th) / 2)
!         dc.DrawText(text, x, y)
!       except:
!         raise
  
  
  
--- 231,269 ----
      node = self.GetPyData(parent)
      if node and not node.expanded:
        node.expand()
+       self.tool.scroller.AdjustScrollbars()
+       self.tool.splitter.Refresh()
  
      event.Skip()
  
  
  
  class ListWindow(wxTreeCompanionWindow):
!   def __init__(self, parent):
!     wxTreeCompanionWindow.__init__(self, parent, -1,
!                  style=wxNO_BORDER )
      self.SetBackgroundColour("WHITE")
+ ##    EVT_ERASE_BACKGROUND(self, self._OnEraseBackground)
+ 
+   def _OnEraseBackground(self, evt):
+     pass
+ 
  
    # This method is called to draw each item in the value window
    def DrawItem(self, dc, itemId, rect):
      tree = self.GetTreeCtrl()
      if tree:
!       text = tree.GetPyData(itemId).getColumn()
!       pen = wxPen(wxSystemSettings_GetSystemColour(wxSYS_COLOUR_3DLIGHT), 1, 
wxSOLID)
!       dc.SetPen(pen)
!       dc.SetBrush(wxBrush(self.GetBackgroundColour(), wxSOLID))
!       dc.DrawRectangle(rect.x, rect.y, rect.width+1, rect.height+1)
!       dc.SetTextForeground("BLACK")
!       dc.SetBackgroundMode(wxTRANSPARENT)
!       tw, th = dc.GetTextExtent(text)
!       x = 5
!       y = rect.y + max(0, (rect.height - th) / 2)
!       dc.DrawText(text, x, y)
  
  
  
***************
*** 308,314 ****
      tree = self.tree
      schemas = self.dataObject.getSchemaList(self.type)
      if not schemas:
!       return 
      schemas.sort()
      for schema in schemas:
        TableNode(self.navigator, self.tree, self.node,
--- 323,329 ----
      tree = self.tree
      schemas = self.dataObject.getSchemaList(self.type)
      if not schemas:
!       return
      schemas.sort()
      for schema in schemas:
        TableNode(self.navigator, self.tree, self.node,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]