Exemplo n.º 1
0
    def loadChapters(self):

        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()

        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        #self.nf = NamedFrame("section")
        #self.nf.setWidth("100%")
        #self.nf.setHeight("10000")

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("100%")
        self.sp.setHeight("100%")

        #self.sp.setTopWidget(self.sinkContainer)
        #self.sp.setBottomWidget(self.nf)
        #self.sp.setSplitPosition(10000) # deliberately high - max out.

        vp = VerticalPanel()
        vp.setWidth("99%")
        vp.setHeight("100%")
        vp.add(self.description)
        vp.add(self.sp)

        authors = [("2008, 2009", "Kenneth Casson Leighton", "*****@*****.**")]
        for years, name, email in authors:
            authors_html = \
            '&copy; %s <a href="mailto:%s">%s</a><br />' %\
            (years, email, name)
        authors_panel = HTML()
        authors_panel.setStyleName("ks-Authors")
        authors_panel.setHTML(authors_html[:-6])

        left_panel = DockPanel(Height="100%")
        left_panel.add(self.sink_list, DockPanel.NORTH)
        left_panel.add(authors_panel, DockPanel.SOUTH)

        self.description.setStyleName("ks-Intro")

        self.panel.add(left_panel, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")
        self.panel.setCellHeight(vp, "100%")

        Window.addWindowResizeListener(self)

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Exemplo n.º 2
0
    def __init__(self):
        Sink.__init__(self)
        self.fPasswordText = PasswordTextBox()
        self.fTextArea = TextArea()
        self.fTextBox = TextBox()

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.add(HTML("Normal text box:"))
        panel.add(self.createTextThing(self.fTextBox))
        panel.add(HTML("Password text box:"))
        panel.add(self.createTextThing(self.fPasswordText))
        panel.add(HTML("Text area:"))
        panel.add(self.createTextThing(self.fTextArea))

        panel.add(
            HTML("""Textarea below demos oninput event. oninput allows
to detect when the content of an element has changed. This is different
from examples above, where changes are detected only if they are made with
keyboard. oninput occurs when the content is changed through any user
interface(keyboard, mouse, etc.). For example, at first type few chars, but
then paste some text to the text areas above and below by selecting 'Paste'
command from context menu or by dragging&dropping and see the difference.
oninput is similar to onchange event, but onchange event fires only when a
text-entry widget loses focus."""))
        vp = VerticalPanel()
        self.echo = HTML()
        textArea = TextArea()
        vp.add(textArea)
        vp.add(self.echo)
        textArea.addInputListener(self)
        panel.add(vp)

        self.initWidget(panel)
Exemplo n.º 3
0
    def __init__(self):
        SimplePanel.__init__(self)
        vert = VerticalPanel()
        vert.setSpacing("10px")
        self.add(vert)

        panel = ScrollPanel(Size=("300px", "100px"))

        contents = HTML("<b>Tao Te Ching, Chapter One</b><p>" +
                        "The Way that can be told of is not an unvarying " +
                        "way;<p>The names that can be named are not " +
                        "unvarying names.<p>It was from the Nameless that " +
                        "Heaven and Earth sprang;<p>The named is but the " +
                        "mother that rears the ten thousand creatures, " +
                        "each after its kind.")
        panel.add(contents)
        vert.add(panel)

        container = SimplePanel(Width="400px", Height="200px")
        contents2 = HTML(
            50 *
            "Dont forget to grab the css for SuperScrollPanel in Showcase.css! "
        )
        panel2 = SuperScrollPanel(contents2)
        container.add(panel2)
        vert.add(container)
Exemplo n.º 4
0
    def onModuleLoad(self):

        dock = DockPanel(Width="100%")
        self.header = HTML(Width="100%", Height="220px")
        self.footer = HTML(Width="100%")
        self.sidebar = HTML(Width="200px", Height="100%", StyleName="sidebar")
        self.fTabs = DecoratedTabPanel(Size=("100%", "100%"), StyleName="tabs")

        #dp = DecoratorTitledPanel("Tabs", "bluetitle", "bluetitleicon",
        #              ["bluetop", "bluetop2", "bluemiddle", "bluebottom"])
        #dp.add(self.fTabs)

        dock.add(self.header, DockPanel.NORTH)
        dock.add(self.footer, DockPanel.SOUTH)
        dock.add(self.sidebar, DockPanel.EAST)
        dock.add(self.fTabs, DockPanel.CENTER)
        dock.setCellVerticalAlignment(self.fTabs, HasAlignment.ALIGN_TOP)
        #dock.setCellHorizontalAlignment(self.fTabs, HasAlignment.ALIGN_CENTER)
        dock.setCellWidth(self.header, "100%")
        dock.setCellHeight(self.header, "220px")
        dock.setCellWidth(self.footer, "100%")
        dock.setCellWidth(self.sidebar, "200px")

        RootPanel().add(dock)
        self.dock = dock

        self.loadPageList()

        Window.addWindowResizeListener(self)

        DeferredCommand.add(self)
Exemplo n.º 5
0
    def __init__(self):

        Composite.__init__(self)

        self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>")
        self.aboutLink = HTML("<a href='javascript:;'>About</a>")

        outer = HorizontalPanel()
        inner = VerticalPanel()

        outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)

        links = HorizontalPanel()
        links.setSpacing(4)
        links.add(self.signOutLink)
        links.add(self.aboutLink)

        outer.add(inner)
        inner.add(HTML("<b>Welcome back, [email protected]</b>"))
        inner.add(links)

        self.signOutLink.addClickListener(self)
        self.aboutLink.addClickListener(self)

        self.initWidget(outer)
        inner.setStyleName("mail-TopPanel")
        links.setStyleName("mail-TopPanelLinks")
Exemplo n.º 6
0
    def onModuleLoad(self):

        #red = PrettyTab("1638", "images/user_red.png")
        #red.setStyleName('gwt-TabBarItem')

        #green = PrettyTab("1640", "images/user_green.png")
        #red.setStyleName('gwt-TabBarItem')
        red = "1638"
        green = "1640"

        self.fTabs = DecoratedTabPanel(Size=("600px", "100%"))
        self.fTabs.add(self.createImage("rembrandt/JohannesElison.jpg"), red,
                       True)
        self.fTabs.add(self.createImage("rembrandt/SelfPortrait1640.jpg"),
                       green, True)
        self.fTabs.add(self.createImage("rembrandt/LaMarcheNocturne.jpg"),
                       "1642")
        self.fTabs.add(
            self.createImage("rembrandt/TheReturnOfTheProdigalSon.jpg"),
            "1662")
        self.fTabs.add(HTML("shouldn't be here!"), None)
        self.fTabs.add(HTML("This is a Test.<br />Tab should be on right"),
                       "Test")
        self.fTabs.selectTab(0)

        dp = DecoratorTitledPanel(
            "Tabs", "bluetitle", "bluetitleicon",
            ["bluetop", "bluetop2", "bluemiddle", "bluebottom"])
        dp.add(self.fTabs)
        RootPanel().add(dp)
Exemplo n.º 7
0
 def draw(self):
     Popup.draw(self)
     
     namePanel = HorizontalPanel()
     #namePanel.add(Label('Crie um arquivo'))     
     if self.title == 'Abrir':
         self.enableOkButton(False)
         namePanel.add(HTML("""<div class=""gwt-Label"" style=""white-space: normal;"">
         Abra o arquivo salvo, copie<br>e cole aqui o conteudo:</div>"""))  
         
         self.field = FileUpload()
         self.field.setName('file')
         self.field.setID('files')
         self.center.add(self.field)        
         element = self.field.getElement()   
         
         JS("""function handleFileSelect(evt) {@{{self}}.enableOkButton(evt.target.files[0]!=null);} 
         @{{element}}.addEventListener('change', handleFileSelect, false);""")
         
         
         #http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
     else:
         namePanel.add(HTML("""<div class=""gwt-Label"" style=""white-space: normal;"">
         Crie um arquivo txt e copie<br>e cole o conteudo a seguir:</div>"""))   
                  
         self.textBox = TextBox()
         self.textBox.setStyleAttribute('marginLeft', 10)
         namePanel.add(self.textBox)
         self.center.add(namePanel)
         
         self.textBox.addInputListener(self)    
         self.onInput()
Exemplo n.º 8
0
    def __init__(self, **kwargs):

        if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-TabBar"

        # this is awkward: HorizontalPanel is the composite,
        # so we either the element here, and pass it in to HorizontalPanel.
        element = None
        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')

        self.panel = HorizontalPanel(Element=element)
        self.selectedTab = None
        self.tabListeners = []

        self.panel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)

        first = HTML("&nbsp;", True)
        rest = HTML("&nbsp;", True)
        first.setStyleName("gwt-TabBarFirst")
        rest.setStyleName("gwt-TabBarRest")
        first.setHeight("100%")
        rest.setHeight("100%")

        self.panel.add(first)
        self.panel.add(rest)
        first.setHeight("100%")
        self.panel.setCellHeight(first, "100%")
        self.panel.setCellWidth(rest, "100%")

        Composite.__init__(self, self.panel, **kwargs)
        self.sinkEvents(Event.ONCLICK)
Exemplo n.º 9
0
    def display_value(self):

        key = self.kbox.getText()

        RootPanel().add(HTML("Value using python:"))
        RootPanel().add(HTML(self.r.python_get_value(key)))
        RootPanel().add(HTML("Value using javascript:"))
        RootPanel().add(HTML(self.r.javascript_get_value(key)))
Exemplo n.º 10
0
    def __init__(self):

        # layed out in a grid with odd rows a different color for
        # visual separation
        grid = Grid(4, 3, CellPadding=50, CellSpacing=0)
        rf = grid.getRowFormatter()
        rf.setStyleName(1, 'oddrow')
        rf.setStyleName(3, 'oddrow')

        # the clock
        clock = Clock()
        grid.setWidget(
            0, 0, CaptionPanel('Using notify()',
                               clock.button,
                               StyleName='left'))
        grid.setWidget(0, 1, clock.datelabel)
        grid.setWidget(0, 2, HTML(Clock.__doc__, StyleName='desc'))

        # popup timer buttons
        ptb = PopupTimerButton(5)
        grid.setWidget(
            1, 0, CaptionPanel('Subclassing Timer()', ptb, StyleName='left'))
        grid.setWidget(1, 1, ptb.box)
        grid.setWidget(1, 2, HTML(PopupTimerButton.__doc__, StyleName='desc'))

        # the second instance
        ptb = PopupTimerButton(15)
        grid.setWidget(
            2, 0,
            CaptionPanel('Subclassing Timer()&nbsp;&nbsp;(<em>again</em>)',
                         ptb,
                         StyleName='left'))
        grid.setWidget(2, 1, ptb.box)
        grid.setWidget(
            2, 2,
            HTML('''This is the same as the previous
                                  example and is here to demonstrate
                                  creating multiple timers (each with
                                  their own state) which is difficult
                                  to do without sublcassing''',
                 StyleName='desc'))

        # random color
        randomcolor = RandomColor()
        grid.setWidget(
            3, 0,
            CaptionPanel('Using onTimer()',
                         randomcolor.hpanel,
                         StyleName='left'))
        grid.setWidget(3, 1, randomcolor.colorpanel)
        grid.setWidget(3, 2, HTML(RandomColor.__doc__, StyleName='desc'))

        # add it all to the root panel
        RootPanel().add(grid)

        # kickstart the slider handle (see above concerning a
        # potential bug)
        randomcolor.initialize()
Exemplo n.º 11
0
	def OnGameLoad(self):
		self.NameScore.setText(0, 0, "Player ID")
		self.NameScore.setText(0, 1, "Score")

		self.NameScore.setCellSpacing(10)       
		self.NameScore.setCellPadding(10)
		self.NameScore.setBorderWidth(2)
		self.NameScore.setVisible(False)

		self.TempBoard.setText(0, 0, "Player's Turn")
		self.TempBoard.setText(0, 1, "Temporary Score")
		self.TempBoard.setText(1, 0, "X")
		self.TempBoard.setText(1, 1, "0") 

		self.TempBoard.setCellSpacing(10)       
		self.TempBoard.setCellPadding(10)
		self.TempBoard.setBorderWidth(2)
		self.TempBoard.setVisible(False)	
		#Adding StartButton to Dock panel
		self.DPanel.add(self.StartButton, DockPanel.EAST)
		self.DPanel.setCellHeight(self.StartButton, "200px")    
		self.DPanel.setCellWidth(self.StartButton, "20px") 
		Txt = HTML("<center><b>Enter Number of Players (between 2 & 6)</b><center>")#Adding playernumber and winscore textbox to Horizontal Panel
		Txt1 = HTML("<left><b>Enter Target Score (between 10 & 100)</b><left>")
		self.HPanel1.add(Txt)
		self.HPanel1.add(self.PlayerNum)
		self.HPanel1.add(Txt1)
		self.HPanel1.add(self.WinScore)
		self.HPanel1.add(self.StartButton)
		self.HPanel1.setSpacing(20)	
		#Adding Horizontal panel containing playernumber and winscore textbox to Dock Panel
		self.DPanel.add(self.HPanel1, DockPanel.NORTH)
		self.DPanel.setCellHeight(self.HPanel1, "30px")    
		self.DPanel.setCellWidth(self.HPanel1, "2000px")
		self.TxtInstructions = HTML("<b><u><center>Instructions</center></u><ul><li>Pig is game for 2 to 6 Players.</li><li>Players take turns rolling a dice as many times as they like. </li><li>If a roll is 2, 3, 4, 5 or 6, the player adds that many points to their score for the turn. </li><li>A player may choose to end their turn at any time and 'bank' their points.</li><li>If a player rolls a 1, they lose all their unbanked points and their turn is over.</li><li>The first player to score the target or more wins.</li></ul></b>")
		self.TxtInstructions.setStyleName("TxtInstructions")
		self.DPanel.add(self.TxtInstructions, DockPanel.CENTER)
		self.DPanel.add(self.NameScore, DockPanel.WEST)		#Adding main scoreboard to Dock Panel
		self.DPanel.setCellHeight(self.NameScore, "300px")    
		self.DPanel.setCellWidth(self.NameScore, "100px")
		self.DPanel.setSpacing(10)
		self.DPanel.setPadding(2)
		#Adding Tempboard and BankButton to Horizontal Panel
		self.HPanel.add(self.TempBoard)	
		#Adding BankButton and RollButton to vertical panel	
		self.VPanel.add(self.RollButton) 		
		self.RollButton.setVisible(False)
		self.VPanel.add(self.BankButton) 
		self.BankButton.setVisible(False)    
		self.VPanel.setSpacing(10)
		#Adding Vertical panel containing BankButton and RollButton to Horizontal Panel
		self.HPanel.add(self.VPanel) 		
		self.HPanel.setSpacing(40)
		#Adding Horizontal panel containing Tempboard and vertical panel containing BankButton and RollButton to Dock Panel
		self.DPanel.add(self.HPanel, DockPanel.SOUTH)		
		self.DPanel.setCellHeight(self.HPanel, "20px")    
		self.DPanel.setCellWidth(self.HPanel, "2000px")
		RootPanel().add(self.DPanel)
Exemplo n.º 12
0
 def __init__(self):
     self.b = Button(_("Click me"), self.greet, StyleName='teststyle')
     self.h = HTML(_("<b>Hello World</b> (html)"), StyleName='teststyle')
     self.l = Label(_("Hello World (label)"), StyleName='teststyle')
     self.base = HTML(_("Hello from %s") % pygwt.getModuleBaseURL(),
                      StyleName='teststyle')
     RootPanel().add(self.b)
     RootPanel().add(self.h)
     RootPanel().add(self.l)
     RootPanel().add(self.base)
Exemplo n.º 13
0
    def get_home_panel(self):
        panel = VerticalPanel()

        title = HTML("""OpenPowerSystem""")
        panel.add(title)

        subtitle = HTML("""The Open Power System data repository.""")
        panel.add(subtitle)

        return panel
Exemplo n.º 14
0
    def __init__(self):
        SimplePanel.__init__(self)

        tabs = TabPanel(Width="100%", Height="250px")
        tabs.add(HTML("The quick brown fox jumps over the lazy dog."), "Tab 1")
        tabs.add(HTML("The early bird catches the worm."), "Tab 2")
        tabs.add(HTML("The smart money is on the black horse."), "Tab 3")

        tabs.selectTab(0)

        self.add(tabs)
Exemplo n.º 15
0
 def parseAlbums(self, items):
     album_list = json.loads(items)
     self.albums = []
     for al in album_list:
         analbum = {}
         analbum['title'] = HTML(al[u"title"][u"$t"])
         analbum['thumb'] = HTML(
             '<img src="' +
             al[u"media$group"][u"media$thumbnail"][0][u"url"] + '"/>')
         url = al[u"id"][u"$t"]
         analbum['id'] = url.split(u'albumid/')[1].split(u'?alt')[0]
         self.albums.append(analbum)
Exemplo n.º 16
0
    def __init__(self):
        SimplePanel.__init__(self)

        stack = StackPanel(Width="100%", Height="300px")

        stack.add(HTML('The quick<br>brown fox<br>jumps over the<br>lazy dog.'),
                  "Stack 1")
        stack.add(HTML('The<br>early<br>bird<br>catches<br>the<br>worm.'),
                  "Stack 2")
        stack.add(HTML('The smart money<br>is on the<br>black horse.'),
                  "Stack 3")

        self.add(stack)
Exemplo n.º 17
0
 def parseAlbums(self, items):
     album_list = json.loads(items)
     self.albums = []
     for i in range(len(album_list)):
         index = "%s" % i
         analbum = {}
         analbum['title'] = HTML(album_list[index]["title"]["$t"])
         analbum['thumb'] = HTML('<img src="' +
                                 album_list[index]["media$group"]
                                 ["media$thumbnail"]["0"]["url"] + '"/>')
         url = album_list[index]["id"]["$t"]
         analbum['id'] = url.split('albumid/')[1].split('?alt')[0]
         self.albums.append(analbum)
Exemplo n.º 18
0
    def __init__(self, **kwargs):
        VerticalPanel.__init__(self, **kwargs)

        info = """<h2>JSON-RPC Example</h2>
        #<p>This example demonstrates the calling of server services with
        #   <a href="http://json-rpc.org/">JSON-RPC</a>.
        #</p>
        #<p>Choose a service below, and press a the "call service" button to initiate it. An echo service simply sends the exact same text back that it receives.
        #   </p>"""

        self.status = Label()
        self.dockey = TextBox(Text="12")
        self.TEXT_WAITING = "Waiting for response..."

        self.METHOD_ECHO = "Echo"
        self.METHOD_DOCTYPES = "get doc types"
        self.METHOD_UPPERCASE = "get schema"
        self.METHOD_GETINBOX = "get inbox"
        self.METHOD_GETDOCS = "get documents"
        self.methods = [
            self.METHOD_ECHO, self.METHOD_DOCTYPES, self.METHOD_UPPERCASE,
            self.METHOD_GETINBOX, self.METHOD_GETDOCS
        ]

        self.method_list = ListBox()
        self.method_list.setName("hello")
        self.method_list.setVisibleItemCount(1)

        for method in self.methods:
            self.method_list.addItem(method)
        self.method_list.setSelectedIndex(0)

        method_panel = HorizontalPanel()
        method_panel.add(HTML("Remote string method to call: "))
        method_panel.add(self.method_list)
        method_panel.setSpacing(8)

        self.button_action = Button("Call Service", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_action)
        buttons.setSpacing(8)

        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(HTML("Primary key of the patient in the database:"))
        panel.add(self.dockey)
        panel.add(method_panel)
        panel.add(buttons)
        panel.add(self.status)
        self.add(panel)
Exemplo n.º 19
0
def queuereduce(sender, maxlines=1000):
    showOutputMeta("Reducing...")

    outputPanel.add(HTML("&nbsp;"))
    outputPanel.add(HTML("&nbsp;"))
    outputPanel.add(
        HTML("""
    <p>Takes too long? Try the <a href="https://bitbucket.org/bgeron
    </continuation-calculus-paper/">Python evaluator.</a>.</p>
    """.strip()))

    # Schedule reduceterm(maxlines) really soon.
    timer = Timer(notify=functools.partial(reduceterm, maxlines=maxlines))
    timer.schedule(50)  # after 50 milliseconds
Exemplo n.º 20
0
    def onClick(self, sender):

        x = int(self.xbox.getText())
        y = int(self.ybox.getText())

        r = Rect(x, y)

        self.r.add(r)

        RootPanel().add(HTML("New value: %d" % (self.r.get_x())))
        RootPanel().add(HTML("New value: %d" % (self.r.get_y())))
        RootPanel().add(
            HTML("New value: %d %d" % (self.r.get_x(), self.r.get_y())))
        RootPanel().add(HTML("New Area: %d" % self.r.area()))
Exemplo n.º 21
0
    def __init__(self):
        Sink.__init__(self)
        self.fPasswordText = PasswordTextBox()
        self.fTextArea = TextArea()
        self.fTextBox = TextBox()

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.add(HTML("Normal text box:"))
        panel.add(self.createTextThing(self.fTextBox))
        panel.add(HTML("Password text box:"))
        panel.add(self.createTextThing(self.fPasswordText))
        panel.add(HTML("Text area:"))
        panel.add(self.createTextThing(self.fTextArea))
        self.initWidget(panel)
Exemplo n.º 22
0
 def __init__(self):
     AddablePanel.__init__(self, Element=DOM.createElement('div'))
     self.setID('toc')
     img = '<img id="logo" src="pyjamas.png">'
     self.add(HTML('<h1>%s</h1>' % (self.title % img, )))
     self.add(
         HTML("""
         <p>This page is a reimagining of
         <a href="http://decafbad.com/2009/07/drag-and-drop/api-demos.html">
         http://decafbad.com/2009/07/drag-and-drop/api-demos.html</a> using
         pyjamas.</p>
         <p>
         <p>This page offers a few demonstrations and experiments, mostly
         as a test tool for the background implementation.</p>
         """))
Exemplo n.º 23
0
    def onUILoaded(self, text):
        self.b = Builder(text)
        self.mp = self.b.createInstance("MainPanel", self)

        # tab panel
        self.mp.fTabs.add(cPatientsummaryPanel(), "Patient summary")
        self.mp.fTabs.add(HTML("Panel 2"), "Tab2")
        self.mp.fTabs.add(HTML(""), None)  # spacer
        self.mp.fTabs.add(cTestPanel(), "RPC Test")
        self.mp.fTabs.add(HTML("This is a Test.<br />Tab should be on right"),
                          "Test")
        self.mp.fTabs.selectTab(0)

        self.searchpanel = cPatientsearchPanel()
        self.mp.insert(self.searchpanel, 1)
Exemplo n.º 24
0
    def drawFull(self, month, year):
        # should be called only once when we draw the calendar for
        # the first time
        self.vp = VerticalPanel()
        self.vp.setSpacing(2)
        self.vp.addStyleName("calendarbox calendar-module calendar")
        self.setWidget(self.vp)
        self.setVisible(False)
        #
        mth = int(month)
        yr = int(year)

        tp = HorizontalPanel()
        tp.addStyleName("calendar-top-panel")
        tp.setSpacing(5)

        h1 = Hyperlink('<<')
        h1.addClickListener(getattr(self, 'onPreviousYear'))
        h2 = Hyperlink('<')
        h2.addClickListener(getattr(self, 'onPreviousMonth'))
        h4 = Hyperlink('>')
        h4.addClickListener(getattr(self, 'onNextMonth'))
        h5 = Hyperlink('>>')
        h5.addClickListener(getattr(self, 'onNextYear'))

        tp.add(h1)
        tp.add(h2)

        # titlePanel can be changed, whenever we draw, so keep the reference
        txt = "<b>"
        txt += self.getMonthsOfYear()[mth - 1] + " " + str(yr)
        txt += "</b>"
        self.titlePanel = SimplePanel()
        self.titlePanel.setWidget(HTML(txt))
        self.titlePanel.setStyleName("calendar-center")

        tp.add(self.titlePanel)
        tp.add(h4)
        tp.add(h5)
        tvp = VerticalPanel()
        tvp.setSpacing(10)
        tvp.add(tp)

        self.vp.add(tvp)

        # done with top panel

        self.middlePanel = SimplePanel()
        grid = self.drawGrid(mth, yr)
        self.middlePanel.setWidget(grid)
        self.vp.add(self.middlePanel)
        self.defaultGrid = grid

        self._gridShortcutsLinks()
        self._gridCancelLink()
        #
        # add code to test another way of doing the layout
        #
        self.setVisible(True)
        return
Exemplo n.º 25
0
 def __init__(self, ctype, data):
     Label.__init__(self)
     AddablePanel.__init__(self)
     self.setStyleName('content_text')
     self.setText("'%s' content:" % ctype)
     self.content = HTML(data, StyleName='content')
     self.append(self.content)
Exemplo n.º 26
0
    def addContact(self, contact):
        link = HTML("<a href='javascript:;'>" + contact.name + "</a>")
        self.panel.add(link)

        # Add a click listener that displays a ContactPopup when it is clicked.
        listener = ContactListener(contact, link)
        link.addClickListener(listener)
Exemplo n.º 27
0
    def onModuleLoad(self):
        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()

        self.loadSinks()
        self.sinkContainer = DockPanel()
        self.sinkContainer.setStyleName("ks-Sink")

        vp = VerticalPanel()
        vp.setWidth("100%")
        vp.add(self.description)
        vp.add(self.sinkContainer)

        self.description.setStyleName("ks-Info")

        self.panel.add(self.sink_list, DockPanel.WEST)
        self.panel.add(vp, DockPanel.CENTER)

        self.panel.setCellVerticalAlignment(self.sink_list,
                                            HasAlignment.ALIGN_TOP)
        self.panel.setCellWidth(vp, "100%")

        History.addHistoryListener(self)
        RootPanel().add(self.panel)

        initToken = History.getToken()
        if len(initToken):
            self.onHistoryChanged(initToken)
        else:
            self.showIntro()
Exemplo n.º 28
0
 def onCellClicked(self, sender, row, col):
     if self.drill == 0:
         self.drill += 1
         self.vp.clear()
         self.grid.clear()
         self.vp.add(self.up)
         self.vp.add(self.grid)
         gridcols = self.grid.getColumnCount()
         album = self.albums[row + col + (row * (gridcols - 1))]
         url = "http://picasaweb.google.com/data/feed/base/user/" + self.userid + "/albumid/" + album[
             "id"] + "?alt=json-in-script&kind=photo&hl=en_US&callback=restCb"
         self.doRESTQuery(url, self.timer)
     elif self.drill == 1:
         self.drill += 1
         gridcols = self.grid.getColumnCount()
         self.pos = row + col + (row * (gridcols - 1))
         photo = self.photos[self.pos]
         self.vp.clear()
         self.fullsize = HTML('<img src="' + photo["full"] + '"/>')
         hp = HorizontalPanel()
         hp.add(self.up)
         hp.add(self.prev)
         hp.add(self.next)
         hp.setSpacing(8)
         self.vp.add(hp)
         self.vp.add(self.fullsize)
Exemplo n.º 29
0
    def __init__(self, autoHide=None, modal=True, centered=False, **kwargs):
        # Init section
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.child = None
        self.panel = FlexTable(
            Height="100%",
            BorderWidth="0",
            CellPadding="0",
            CellSpacing="0",
        )
        cf = self.panel.getCellFormatter()
        cf.setHeight(1, 0, "100%")
        cf.setWidth(1, 0, "100%")
        cf.setAlignment(
            1,
            0,
            HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE,
        )

        # Arguments section
        self.modal = modal
        self.caption = HTML()
        self.panel.setWidget(0, 0, self.caption)
        self.caption.setStyleName("Caption")
        self.caption.addMouseListener(self)

        # Finalize
        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DialogBox")
        PopupPanel.__init__(self, autoHide, modal, **kwargs)
        PopupPanel.setWidget(self, self.panel)

        self.centered = centered
Exemplo n.º 30
0
 def get_case_panel(self):
     panel = VerticalPanel()
     title = HTML("""Case""")
     panel.add(title)
     tree = self.get_case_tree()
     panel.add(tree)
     return panel