Permalink
Browse files

move kitchensink sink in as a pyjamas widget

  • Loading branch information...
1 parent f2c9e11 commit 46bb9016ccd59977ce9ac64cc88c310ef181e1ad Luke Leighton committed Mar 24, 2012
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Button import Button
from pyjamas.ui.CheckBox import CheckBox
from pyjamas.ui.VerticalPanel import VerticalPanel
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Frame import Frame
class Frames(Sink):
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.DockPanel import DockPanel
from pyjamas.ui.Image import Image
from pyjamas.ui.VerticalPanel import VerticalPanel
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.HTML import HTML
class Info(Sink):
@@ -8,7 +8,7 @@
from pyjamas.ui.Hyperlink import Hyperlink
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas import Window
-from SinkList import SinkList
+from pyjamas.ui.Sink import SinkList
from pyjamas import History
import Info
import Buttons
@@ -94,25 +94,23 @@ def show(self, info, affectHistory):
self.curSink.onShow()
def loadSinks(self):
- self.sink_list.addSink(Info.init())
- self.sink_list.addSink(Buttons.init())
- self.sink_list.addSink(Menus.init())
- self.sink_list.addSink(Images.init())
- self.sink_list.addSink(Layouts.init())
- self.sink_list.addSink(Lists.init())
- self.sink_list.addSink(Popups.init())
- self.sink_list.addSink(Tables.init())
- self.sink_list.addSink(Text.init())
- self.sink_list.addSink(Trees.init())
- self.sink_list.addSink(Frames.init())
- self.sink_list.addSink(Tabs.init())
+ self.sink_list.add(Info.init())
+ self.sink_list.add(Buttons.init())
+ self.sink_list.add(Menus.init())
+ self.sink_list.add(Images.init())
+ self.sink_list.add(Layouts.init())
+ self.sink_list.add(Lists.init())
+ self.sink_list.add(Popups.init())
+ self.sink_list.add(Tables.init())
+ self.sink_list.add(Text.init())
+ self.sink_list.add(Trees.init())
+ self.sink_list.add(Frames.init())
+ self.sink_list.add(Tabs.init())
def showInfo(self):
self.show(self.sink_list.find("Info"), False)
-
-
if __name__ == '__main__':
pyjd.setup("public/KitchenSink.html")
app = KitchenSink()
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Button import Button
from pyjamas.ui.CheckBox import CheckBox
from pyjamas.ui.VerticalPanel import VerticalPanel
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.ListBox import ListBox
from pyjamas.ui.HorizontalPanel import HorizontalPanel
from pyjamas.ui.VerticalPanel import VerticalPanel
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.MenuBar import MenuBar
from pyjamas.ui.MenuItem import MenuItem
from pyjamas import Window
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Button import Button
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.PopupPanel import PopupPanel
@@ -1,36 +0,0 @@
-from pyjamas.ui.Composite import Composite
-
-class Sink(Composite):
- def __init__(self):
- Composite.__init__(self)
-
- def onHide(self):
- pass
-
- def onShow(self):
- pass
-
- def baseURL(self):
- return ""
-
-class SinkInfo:
- def __init__(self, name, desc, object_type):
- self.name=name
- self.description=desc
- self.object_type=object_type
- self.instance=None
-
- def createInstance(self):
- return self.object_type()
-
- def getDescription(self):
- return self.description
-
- def getInstance(self):
- if self.instance is None:
- self.instance = self.createInstance()
- return self.instance
-
- def getName(self):
- return self.name
-
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Grid import Grid
from pyjamas.ui.FlexTable import FlexTable
from pyjamas.ui import HasHorizontalAlignment
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.TabPanel import TabPanel
from pyjamas.ui import HasAlignment
from pyjamas.ui.Image import Image
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Button import Button
from pyjamas.ui.HorizontalPanel import HorizontalPanel
from pyjamas.ui.HTML import HTML
@@ -1,4 +1,4 @@
-from Sink import Sink, SinkInfo
+from pyjamas.ui.Sink import Sink, SinkInfo
from pyjamas.ui.Tree import Tree
from pyjamas.ui.TreeItem import TreeItem
@@ -1,7 +1,6 @@
from pyjamas.ui.Composite import Composite
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.Hyperlink import Hyperlink
-from Logger import Logger
class SinkList(Composite):
def __init__(self):
@@ -14,7 +13,7 @@ def __init__(self):
self.initWidget(self.vp_list)
self.setStyleName("ks-List")
- def addSink(self, info):
+ def add(self, info):
name = info.getName()
link = Hyperlink(name, False, TargetHistoryToken=name)
link.setStyleName("ks-SinkItem")
@@ -40,3 +39,37 @@ def setSinkSelection(self, name):
return
+class Sink(Composite):
+ def __init__(self):
+ Composite.__init__(self)
+
+ def onHide(self):
+ pass
+
+ def onShow(self):
+ pass
+
+ def baseURL(self):
+ return ""
+
+class SinkInfo:
+ def __init__(self, name, desc, object_type):
+ self.name=name
+ self.description=desc
+ self.object_type=object_type
+ self.instance=None
+
+ def createInstance(self):
+ return self.object_type()
+
+ def getDescription(self):
+ return self.description
+
+ def getInstance(self):
+ if self.instance is None:
+ self.instance = self.createInstance()
+ return self.instance
+
+ def getName(self):
+ return self.name
+

0 comments on commit 46bb901

Please sign in to comment.