Skip to content

Commit

Permalink
#34 - **kwargs to split panels
Browse files Browse the repository at this point in the history
git-svn-id: https://pyjamas.svn.sourceforge.net/svnroot/pyjamas/trunk@876 7a2bd370-bda8-463c-979e-2900ccfb811e
  • Loading branch information
lkcl committed Jul 10, 2009
1 parent 9e1915f commit 3319c55
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
4 changes: 4 additions & 0 deletions examples/splitpanel/SplitPanel.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pyjd # dummy in pyjs

from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.Label import Label
Expand Down Expand Up @@ -34,5 +36,7 @@ def onModuleLoad(self):


if __name__ == '__main__':
pyjd.setup("./public/SplitPanel.html")
app = SplitPanel()
app.onModuleLoad()
pyjd.run()
8 changes: 4 additions & 4 deletions library/pyjamas/ui/horizsplitpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ class HorizontalSplitPanel(SplitPanel):
its parent vertically and horizontally [this is NOT normal!]
"""

def __init__(self):
def __init__(self, **kwargs):
""" Creates an empty horizontal split panel.
"""

if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-HorizontalSplitPanel"
SplitPanel.__init__(self, DOM.createDiv(),
DOM.createDiv(),
self.preventBoxStyles(DOM.createDiv()),
self.preventBoxStyles(DOM.createDiv()))
self.preventBoxStyles(DOM.createDiv()),
**kwargs)

self.container = self.preventBoxStyles(DOM.createDiv())

self.buildDOM()

self.setStyleName("gwt-HorizontalSplitPanel")

self.impl = ImplHorizontalSplitPanel(self)

# By default the panel will fill its parent vertically and horizontally.
Expand Down
7 changes: 4 additions & 3 deletions library/pyjamas/ui/splitpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,23 @@ class SplitPanel(Panel):
{@link VerticalSplitPanel}.
"""

def __init__(self, mainElem, splitElem, headElem, tailElem):
def __init__(self, mainElem, splitElem, headElem, tailElem, **kwargs):
""" Initializes the split panel.
@param mainElem the root element for the split panel
@param splitElem the element that acts as the splitter
@param headElem the element to contain the top or left most widget
@param tailElem the element to contain the bottom or right most widget
"""

Panel.__init__(self)

self.widgets = [None, None]
self.elements = [headElem, tailElem]
self.isResizing = False

self.setElement(mainElem)
self.splitElem = splitElem

Panel.__init__(self, **kwargs)

self.sinkEvents(Event.MOUSEEVENTS)

def addAbsolutePositoning(self, elem):
Expand Down
8 changes: 4 additions & 4 deletions library/pyjamas/ui/vertsplitpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,19 @@ class VerticalSplitPanel(SplitPanel):
decorated with scrollbars when necessary.
"""

def __init__(self):
def __init__(self, **kwargs):
""" Creates an empty vertical split panel.
"""
if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-VerticalSplitPanel"
SplitPanel.__init__(self, DOM.createDiv(),
DOM.createDiv(),
self.preventBoxStyles(DOM.createDiv()),
self.preventBoxStyles(DOM.createDiv()))
self.preventBoxStyles(DOM.createDiv()),
**kwargs)

self.container = self.preventBoxStyles(DOM.createDiv())
self.buildDOM()

self.setStyleName("gwt-VerticalSplitPanel")

self.impl = ImplVerticalSplitPanel(self)

self.setSplitPosition("50%")
Expand Down

0 comments on commit 3319c55

Please sign in to comment.