Example #1
0
    def onModuleLoad(self):
        self.panel = VerticalPanel()
        self.player = self.getPlayer()

        # Add the Player to the Panel
        self.panel.add(self.player)
        RootPanel().add(self.panel)
Example #2
0
    def __init__(self):
        """ Constructs a new EditPanel.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        #        self.remote_py = RegionNamesServicePython()

        self.panel = VerticalPanel()

        top_panel = HorizontalPanel()
        top_panel.setSpacing(8)
        self.panel.add(top_panel)

        refresh = Button("Refresh", self)
        top_panel.add(refresh)

        self.status = Label()
        top_panel.add(self.status)

        edit_panel = HorizontalPanel()
        self.panel.add(edit_panel)

        self.tree = Tree()
        self.tree.addTreeListener(self)
        edit_panel.add(self.tree)

        upload_item = TreeItem("Upload")
        self.tree.add(upload_item)
        map_item = TreeItem("Map")
        self.tree.add(map_item)
Example #3
0
class FlowPanelDemo:
    """Demos the flow panel. Because of how the Flow Panel works, all elements have to be inline elements.
        Divs, tables, etc. can't be used, unless specified with CSS that they are inline or inline-block.

        Because of how Vertical Panels work (with tables), we use CSS to display tables as inline-blocks.
        IE, excluding IE8, doesn't support inline-blocks, so we have to use a CSS hack
        (see http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/ for more on the hack)
        However, we use spans instead of divs for the Label by providing an 'element' argument."""
    def __init__(self):
        self.root = RootPanel()
        #Flow panel taking up 70% of the page.  CSS centers it.
        self.flow = FlowPanel(Width="70%", StyleName='flow-panel')

        for x in range(0, 10):
            self.panel = VerticalPanel()
            #Label each image with its number in the sequence
            title = Label("Item %s" % x,
                          Element=DOM.createElement('span'),
                          StyleName="title item")
            #Add a neat-o image.
            image = Image('images/pyjamas.png',
                          Width="200px",
                          Height="200px",
                          StyleName="cat-image cat-item")
            #Add to the Vertical Panel the image title
            self.panel.add(title)
            self.panel.add(image)

            self.flow.add(self.panel)

        self.root.add(self.flow)
Example #4
0
 def __init__(self,
              subCategoryName='',
              subCategoryClassName='',
              openList=True):
     self.list = VerticalPanel(StyleName='block_list')
     self.list.setStyleAttribute("display", "block")
     VerticalPanel.__init__(self, StyleName='SubCategoryPanel')
     self.subCategoryName = subCategoryName
     if subCategoryName != '':
         self.title = Element(Element=DOM.createElement('dt'),
                              StyleName=subCategoryClassName)
         DOM.setInnerHTML(self.title.getElement(), self.subCategoryName)
         self.collapse = FocusWidget(Element=DOM.createDiv(),
                                     StyleName='collapse close_up')
         self.collapse.addClickListener(self.showHide)
         self.title.add(self.collapse)
         self.add(self.title)
         if openList:
             self.list.setStyleAttribute("display", "block")
             self.collapse.setStyleName('collapse close_up')
         else:
             self.list.setStyleAttribute("display", "none")
             self.collapse.setStyleName('collapse open_down')
     self.add(self.list)
     self.blocks = []
     self.count = 0
Example #5
0
    def makeBox(self, label):
        wrapper = VerticalPanel(BorderWidth=1)
        wrapper.add(HTML(label))
        DOM.setAttribute(wrapper.getTable(), "cellPadding", "10")
        DOM.setAttribute(wrapper.getTable(), "bgColor", "#C3D9FF")

        return wrapper
Example #6
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())
Example #7
0
    def __init__(self, calendar):
        Composite.__init__(self)
    
        self.calendar = calendar
        self.dayCheckBoxListener = DayCheckBoxListener(calendar)
        self.outer = VerticalPanel()
        self.initWidget(self.outer)
        self.setStyleName("DynaTable-DayFilterWidget")
        self.outer.add(DayCheckBox(self, "Sunday", 0))
        self.outer.add(DayCheckBox(self, "Monday", 1))
        self.outer.add(DayCheckBox(self, "Tuesday", 2))
        self.outer.add(DayCheckBox(self, "Wednesday", 3))
        self.outer.add(DayCheckBox(self, "Thursday", 4))
        self.outer.add(DayCheckBox(self, "Friday", 5))
        self.outer.add(DayCheckBox(self, "Saturday", 6))

        self.buttonAll = Button("All", self)
        self.buttonNone = Button("None", self)

        hp = HorizontalPanel()
        hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        hp.add(self.buttonAll)
        hp.add(self.buttonNone)
        
        self.outer.add(hp)
        self.outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM)
        self.outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER)
Example #8
0
class SinkList(Composite):
    def __init__(self):
        Composite.__init__(self)
        self.vp_list = VerticalPanel()
        self.sinks = []
        self.selectedSink = -1

        self.initWidget(self.vp_list)
        self.setStyleName("ks-List")

    def addSink(self, info):
        name = info.getName()
        link = Hyperlink(name, False, TargetHistoryToken=name)
        link.setStyleName("ks-SinkItem")
        self.vp_list.add(link)
        self.sinks.append(info)

    def find(self, sinkName):
        for info in self.sinks:
            if info.getName() == sinkName:
                return info
        return None

    def setSinkSelection(self, name):
        if self.selectedSink <> -1:
            self.vp_list.getWidget(
                self.selectedSink).removeStyleName("ks-SinkItem-selected")

        for i in range(len(self.sinks)):
            info = self.sinks[i]
            if (info.getName() == name):
                self.selectedSink = i
                widget = self.vp_list.getWidget(self.selectedSink)
                widget.addStyleName("ks-SinkItem-selected")
                return
Example #9
0
    def __init__(self):
        Sink.__init__(self)
        colour_grid = ColourGridCanvas()
        rotated = RotatedCanvas()       
        spheres = SpheresCanvas()
        #pattern = PatternCanvas()
        spiro = SpiroCanvas()
        self.solar = SolarCanvas()
        
        row0 = HorizontalPanel()
        row0.setSpacing(8)
        row0.add(colour_grid)
        row0.add(rotated)
        row0.add(spheres)
        #row0.add(pattern)
        
        row1 = HorizontalPanel()
        row1.setSpacing(8)
        row1.add(self.solar)
        row1.add(spiro)

        panel = VerticalPanel()
        panel.add(row0)
        panel.add(row1)

        self.setWidget(panel)
Example #10
0
	def __init__(self):
		self.form = FormPanel()
		self.form.setAction("/Accession/searchByName/")
		
		# Because we're going to add a FileUpload widget, we'll need to set the
		# form to use the POST method, and multipart MIME encoding.
		self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
		self.form.setMethod(FormPanel.METHOD_POST)
		
		# Create a panel to hold all of the form widgets.
		vpanel = VerticalPanel()
		self.form.setWidget(vpanel)
		
		self.colour_input = AutoCompleteByURLTextBox('/Accession/autoComplete')
		
		hpanel = HorizontalPanel()
		hpanel.add(HTML("Enter an ecotype name: "))
		hpanel.add(self.colour_input)

		hpanel.setSpacing(8)
		# Add a 'submit' button.
		hpanel.add(Button("Submit", self))

		vpanel.add(hpanel)
		
		# Add an event handler to the form.
		self.form.addFormHandler(self)
		
		self.setWidget(self.form)
Example #11
0
class Contacts(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.contacts = []
        self.contacts.append(Contact("Benoit Mandelbrot",
                                     "*****@*****.**"))
        self.contacts.append(Contact("Albert Einstein", "*****@*****.**"))
        self.contacts.append(Contact("Rene Descartes", "*****@*****.**"))
        self.contacts.append(Contact("Bob Saget", "*****@*****.**"))
        self.contacts.append(
            Contact("Ludwig von Beethoven", "*****@*****.**"))
        self.contacts.append(Contact("Richard Feynman", "*****@*****.**"))
        self.contacts.append(Contact("Alan Turing", "*****@*****.**"))
        self.contacts.append(Contact("John von Neumann", "*****@*****.**"))

        self.panel = VerticalPanel()

        # Add all the contacts to the list.
        i = 0
        while (i < len(self.contacts)):
            self.addContact(self.contacts[i])
            i = i + 1

        self.initWidget(self.panel)
        self.setStyleName("mail-Contacts")

    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)
Example #12
0
    def __init__(self):
        Composite.__init__(self)

        self.contacts = []
        self.contacts.append(Contact("Benoit Mandelbrot",
                                     "*****@*****.**"))
        self.contacts.append(Contact("Albert Einstein", "*****@*****.**"))
        self.contacts.append(Contact("Rene Descartes", "*****@*****.**"))
        self.contacts.append(Contact("Bob Saget", "*****@*****.**"))
        self.contacts.append(
            Contact("Ludwig von Beethoven", "*****@*****.**"))
        self.contacts.append(Contact("Richard Feynman", "*****@*****.**"))
        self.contacts.append(Contact("Alan Turing", "*****@*****.**"))
        self.contacts.append(Contact("John von Neumann", "*****@*****.**"))

        self.panel = VerticalPanel()

        # Add all the contacts to the list.
        i = 0
        while (i < len(self.contacts)):
            self.addContact(self.contacts[i])
            i = i + 1

        self.initWidget(self.panel)
        self.setStyleName("mail-Contacts")
Example #13
0
    def onModuleLoad(self):
        try:
            setCookie(COOKIE_NAME, "setme", 100000)
        except:
            pass

        self.status = Label()
        self.text_area = TextArea()
        self.text_area.setText(r"Me eat cookie!")
        self.text_area.setCharacterWidth(80)
        self.text_area.setVisibleLines(8)
        self.button_py_set = Button("Set Cookie", self)
        self.button_py_read = Button("Read Cookie ", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_py_set)
        buttons.add(self.button_py_read)
        buttons.setSpacing(8)
        info = r'This demonstrates setting and reading information using cookies.'
        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(self.text_area)
        panel.add(buttons)
        panel.add(self.status)

        RootPanel().add(panel)
Example #14
0
class SinkList(Composite):
    def __init__(self):
        Composite.__init__(self)
        self.vp_list=VerticalPanel()
        self.sinks=[]
        self.selectedSink=-1
        
        self.initWidget(self.vp_list)
        self.setStyleName("ks-List")

    def addSink(self, info):
        name = info.getName()
        link = Hyperlink(name, False, TargetHistoryToken=name)
        link.setStyleName("ks-SinkItem")
        self.vp_list.add(link)
        self.sinks.append(info)

    def find(self, sinkName):
        for info in self.sinks:
            if info.getName()==sinkName:
                return info
        return None

    def setSinkSelection(self, name):
        if self.selectedSink <> -1:
            self.vp_list.getWidget(self.selectedSink).removeStyleName("ks-SinkItem-selected")

        for i in range(len(self.sinks)):
            info = self.sinks[i]
            if (info.getName()==name):
                self.selectedSink = i
                widget=self.vp_list.getWidget(self.selectedSink)
                widget.addStyleName("ks-SinkItem-selected")
                return
Example #15
0
    def onModuleLoad(self):

        self.label = Label("Not set yet")

        self.button = Button("Probe button", self)
        self.image_up = Image("./images/logo.png")
        self.image_up3 = Image("./images/logo.png")
        self.image_down = Image("./images/logo.png")
        self.image_down3 = Image("./images/logo.png")
        self.toggle = ToggleButton(self.image_up, self.image_down, self)
        self.toggle2 = ToggleButton("up", "down", getattr(self, "onToggleUD"))
        self.push = PushButton(self.image_up3, self.image_down3)

        self.vpanel = VerticalPanel()
        self.togglePanel = HorizontalPanel()
        self.togglePanel.setSpacing(10)

        self.togglePanel.add(self.toggle)
        self.togglePanel.add(self.toggle2)
        self.togglePanel.add(self.push)

        self.vpanel.add(self.label)
        self.vpanel.add(self.button)
        self.vpanel.add(self.togglePanel)

        RootPanel().add(self.vpanel)
        self.i = False
Example #16
0
 def __init__(self):
     # Record the image url for easy access
     self.IMAGES_URL = "http://www.cse.nd.edu/~cmc/teaching/cse30332_sp15/images"
     # The title label is intially empty but will be filled with the top
     # recommended movie by the time the page is viewed
     self.title_l = Label("", StyleName="teststyle")
     self.up_b = Button("UP", post_vote)
     self.down_b = Button("DOWN", post_vote)
     self.rating_l = Label("", StyleName="teststyle")
     self.img = Image("")
     # Construct three vertical panels to make he display slightly columnar
     self.leftVertPanel = VerticalPanel()
     self.midlVertPanel = VerticalPanel()
     self.riteVertPanel = VerticalPanel()
     self.horizontalizer = HorizontalPanel()
     # Add the buttons to the correct vertical panels!!!
     self.midlVertPanel.add(self.title_l)
     self.midlVertPanel.add(self.img)
     self.midlVertPanel.add(self.rating_l)
     self.riteVertPanel.add(self.down_b)
     self.leftVertPanel.add(self.up_b)
     # Add all the panels to the horizontal panel
     self.horizontalizer.add(self.leftVertPanel)
     self.horizontalizer.add(self.midlVertPanel)
     self.horizontalizer.add(self.riteVertPanel)
     # Add the horizontal panel to the vertical one
     RootPanel().add(self.horizontalizer)
     # Get the first recommendation
     get_recommendation()
Example #17
0
	def __init__(self):
		AbsolutePanel.__init__(self)
		
		self.app = CompaniesApp()
		
		self.history = []
		
		self.save = Button("save", self)
		self.selectDepartment = Button("select", self)
		self.selectEmployee = Button("select", self)
		self.edit = Button("edit", self)
		self.cut = Button("cut", self)
		self.back = Button("back", self)
		
		self.name = TextBox()
		self.address = TextBox()
		self.manager = TextBox()
		self.departments = ListBox(Size=("100%"), VisibleItemCount="5")
		self.employees = ListBox(Size=("100%"), VisibleItemCount="5")
		self.total = TextBox()

		self.errors = VerticalPanel()
		
		self.grid = Grid()
		self.allPanels = VerticalPanel()
		self.allPanels.add(self.grid)
		self.allPanels.add(self.errors)
		self.add(self.allPanels)
		
		self.initCompanyGUI()
Example #18
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")
Example #19
0
    def __init__(self):
        Sink.__init__(self)
        colour_grid = ColourGridCanvas()
        rotated = RotatedCanvas()
        spheres = SpheresCanvas()
        pattern = PatternCanvas()
        spiro = SpiroCanvas()
        self.solar = SolarCanvas()

        row0 = HorizontalPanel()
        row0.setSpacing(8)
        row0.add(colour_grid)
        row0.add(rotated)
        row0.add(spheres)
        row0.add(pattern)

        row1 = HorizontalPanel()
        row1.setSpacing(8)
        row1.add(self.solar)
        row1.add(spiro)

        panel = VerticalPanel()
        panel.add(row0)
        panel.add(row1)

        self.setWidget(panel)
    def __init__(self, ws):

        VerticalPanel.__init__(self, Width='100%', Height='100%')

        self.codeTextArea = Element(Element=DOM.createDiv(),
                                    StyleName='codePanel')
        self.codeTextArea.setID('clip_text')
        #self.codeTextArea.setReadonly(True)
        #self.codeTextArea.addClickListener(listener=lambda:self.codeTextArea.selectAll())
        ws.setCodePanel(self.codeTextArea)

        self.header = Header(self.changeLanguage)
        getWorkspace().setHeaderPanel(self.header)

        self.blockList = BlockList()
        self.hardwareList = HardwareList()
        self.hardwareList.addStyleName('invisible')
        self.left = Element(Element=DOM.createDiv(),
                            Width='100%',
                            Height='100%')
        ws.setBlockList(self.blockList)
        ws.setHardwaresList(self.hardwareList)

        self.serialMonitor = Element(Element=DOM.createDiv(),
                                     StyleName='serialMonitor')

        self.blocksPad = BlocksPad()
        self.hardwaresPad = HardwaresPad()
        self.hardwaresPad.addStyleName('invisible')
        self.middle = Element(Element=DOM.createDiv(),
                              Width='100%',
                              Height='100%')
        ws.setBlocksPad(self.blocksPad)
        ws.setHardwaresPad(self.hardwaresPad)
Example #21
0
class Dashboard(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.outer = VerticalPanel()
        self.outer.setSpacing("20px")
        self.outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER)
        
        self.display_panel = DisplayPanel()
        self.screen = Screen()
        self.screen.base = self
        self.screen.display_panel = self.display_panel
        self.control_panel = ControlPanel()
        self.control_panel.base = self
        
        self.initWidget(self.outer)
        self.outer.add(self.display_panel)
        self.outer.add(self.screen)
        self.outer.add(self.control_panel)

        self.initDashboard()

    def initDashboard(self):
        self.screen.resize(4,4)
        self.screen.shuffle()

    def incrCount(self):
        self.display_panel.incrCount()
Example #22
0
    def __init__(self):

        Sink.__init__(self)

        self.vp = VerticalPanel()
        self.initWidget(self.vp)
        self.loaded = False
Example #23
0
 def __init__(self):
     layout = VerticalPanel()
     layout.add(
         HTML(
             "<b style=\"color:#f00;\">Stroke Gradients currently not working correctly in IE. RadialGradients are not supported in VML. Contributor assistance welcome :).</b>"
         ))
     Composite.__init__(self, layout)
class AlgorithmList(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.vp_list=VerticalPanel()
        self.Algorithms=[]
        self.selectedAlgorithm=-1
        
        self.initWidget(self.vp_list)
        self.setStyleName("ks-List")

    def addAlgorithm(self, info):
        name = info.getName()
        link = Hyperlink(name, False, TargetHistoryToken=name)
        link.setStyleName("ks-AlgorithmItem")
        self.vp_list.add(link)
        self.Algorithms.append(info)

    def find(self, AlgorithmName):
        for info in self.Algorithms:
            if info.getName()==AlgorithmName:
                return info
        return None

    def setAlgorithmSelection(self, name):
        if self.selectedAlgorithm <> -1:
            self.vp_list.getWidget(self.selectedAlgorithm).removeStyleName("ks-AlgorithmItem-selected")

        for i in range(len(self.Algorithms)):
            info = self.Algorithms[i]
            if (info.getName()==name):
                self.selectedAlgorithm = i
                widget=self.vp_list.getWidget(self.selectedAlgorithm)
                widget.addStyleName("ks-AlgorithmItem-selected")
                return
Example #25
0
 def __init__(self, userListPanel, tabPanel, topPanel):
     VerticalPanel.__init__(self, StyleName='large-avatar-panel')
     self.userListPanel = userListPanel
     self.tabPanel = tabPanel
     self.topPanel = topPanel
     upperPanel = HorizontalPanel(StyleName='large-avatar-upper-panel',
                                  Spacing=8)
     self.image = Image(StyleName='large-avatar')
     self.upperText = HTML(StyleName='large-avatar-upper-text')
     upperPanel.add(self.image)
     upperPanel.add(self.upperText)
     self.add(upperPanel)
     self.lowerText = HTML(StyleName='large-avatar-lower-text')
     self.add(self.lowerText)
     self.followButton = None
     self.user = None
     insertPanel = HorizontalPanel(Spacing=3)
     insertPanel.add(Label('Use name: '))
     if tabPanel.tabName == 'simple':
         b1 = Button('upper', SimpleInserter(self, 'upper'))
         b2 = Button('lower', SimpleInserter(self, 'lower'))
         insertPanel.add(b1)
         insertPanel.add(b2)
     else:
         b1 = Button('or', QueryInserter(self, 'or'))
         b2 = Button('and', QueryInserter(self, 'and'))
         b3 = Button('except', QueryInserter(self, 'except'))
         insertPanel.add(b1)
         insertPanel.add(b2)
         insertPanel.add(b3)
     self.add(insertPanel)
Example #26
0
class FlowPanelDemo:
    """Demos the flow panel. Because of how the Flow Panel works, all elements have to be inline elements.
        Divs, tables, etc. can't be used, unless specified with CSS that they are inline or inline-block.

        Because of how Vertical Panels work (with tables), we use CSS to display tables as inline-blocks.
        IE, excluding IE8, doesn't support inline-blocks, so we have to use a CSS hack
        (see http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/ for more on the hack)
        However, we use spans instead of divs for the Label by providing an 'element' argument."""
       
    def __init__(self):
        self.root = RootPanel()
        #Flow panel taking up 70% of the page.  CSS centers it.
        self.flow = FlowPanel(Width="70%", StyleName='flow-panel')
       
       
        for x in range(0, 10):
            self.panel = VerticalPanel()
            #Label each image with its number in the sequence
            title = Label("Item %s" % x, element=DOM.createElement('span'), StyleName="title item")
            #Add a neat-o image.
            image = Image('images/pyjamas.png', Width="200px", Height="200px", StyleName="cat-image cat-item")
            #Add to the Vertical Panel the image title
            self.panel.add(title)
            self.panel.add(image)

            self.flow.add(self.panel)

        self.root.add(self.flow)
Example #27
0
	def themesPanel(self, themes=None):
		Window.alert('line:111')
		themes = None
		if not themes: themes=['0','1', 'cms', 'pypress']

		vPanel = VerticalPanel()
		for i in range(len(themes)):
			"""
			a_n = location.getPathName().split('/')[1]
			lambda1 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/'+x+'/')+'?theme='+x
        	lambda2 = lambda x: w_l.pathname.replace('/'+a_n+'/', '/a/')+'?theme='+x
			href = {
				'cms' : lambda1, 
				'pypress' : lambda1,
				'o' : lambda2, 
				'1' : lambda2 
			}.get(themes[i], lambda2)(themes[i])
			"""

			a=Button('theme '+themes[i], 
					lambda x: location.setSearchDict({'theme': x.getID()}), 
					StyleName='link')
			a.setID(themes[i])
			vPanel.add(a)
	
		return vPanel
    def __init__(self):
        VerticalPanel.__init__(self)
        self.remoteproxy = JsonTaoggregatorService()
        self.totalitemcount = 0
        self.idToCallbackMap = {}

        createToolbar = lambda: HorizontalToolbar(self.onRequestMore, self.onCollapseAll, self.onExpandAll)
        topbar = createToolbar()
        self.add(topbar)

        self.contentpanel = ContentPanel(self.onCIPublish,
                                         lambda sen, ci: self.onCIAdjustLike(sen, ci, 1),
                                         lambda sen, ci: self.onCIAdjustLike(sen, ci, -1),
                                         self.onSort,
                                         self.onFilter)
        self.add(self.contentpanel)

        botbar = createToolbar()
        self.add(botbar)

        self.horiztoolbars = [topbar, botbar]

        self.lastOnSortArgs = None
        self.lastOnFilterArgs = None
        self.requestDownloadedContentCount()
        self.onRequestMore(None)
Example #29
0
    def make_panel(self):
        message = Label(
            'The configuration has been changed.\n'
            'You must apply the changes in order for them to take effect.')
        DOM.setStyleAttribute(message.getElement(), "whiteSpace", 'pre')

        msgbox = Grid(1, 2, StyleName='changes')
        msgbox.setWidget(0, 0, Image('icons/exclam.png'))
        msgbox.setWidget(0, 1, message)
        msgbox.getCellFormatter().setStyleName(0, 0, 'changes-image')
        msgbox.getCellFormatter().setStyleName(0, 1, 'changes-text')

        button = Button('apply changes')
        button.addClickListener(self.apply_clicked)

        self.changes = VerticalPanel()
        self.changes.setHorizontalAlignment('right')
        self.changes.setVisible(False)
        self.changes.add(msgbox)
        self.changes.add(button)

        panel = VerticalPanel()
        panel.setSpacing(10)
        panel.add(self.table)
        panel.add(self.status)
        panel.add(self.changes)

        return panel
Example #30
0
    def makeBox(self, label):
        wrapper = VerticalPanel(BorderWidth=1)
        wrapper.add(HTML(label))
        DOM.setAttribute(wrapper.getTable(), "cellPadding", "10")
        DOM.setAttribute(wrapper.getTable(), "bgColor", "#C3D9FF")

        return wrapper
Example #31
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)
        self.url = "http://localhost/pyjamas_upload_demo"
        self.form.setAction(self.url)
        self.form.setTarget("results")

        vPanel = VerticalPanel()

        hPanel = HorizontalPanel()
        hPanel.setSpacing(5)
        hPanel.add(Label("Upload file:"))

        self.field = FileUpload()
        self.field.setName("file")
        hPanel.add(self.field)

        hPanel.add(Button("Submit", getattr(self, "onBtnClick")))
        vPanel.add(hPanel)

        self.simple = CheckBox("Simple mode?  ")
        #self.simple.setChecked(True)
        vPanel.add(self.simple)
        self.progress = Label('0%')

        results = NamedFrame("results")
        vPanel.add(results)
        vPanel.add(self.progress)

        self.form.add(vPanel)
        self.add(self.form)
Example #32
0
 def __init__(self, start_date, can_delete=True):
     # We need to use old form of inheritance because of pyjamas
     SimplePanel.__init__(self)
     self.vpanel = VerticalPanel()
     desc_panel = VerticalPanel()
     self.desc_box = TextBox()
     self.desc_box.setVisibleLength(44)
     self.desc_box.setStyleName('form-control')
     desc_lbl = Label('impediment description')
     desc_lbl.setStyleName('text-muted')
     desc_panel.add(self.desc_box)
     desc_panel.add(desc_lbl)
     # Set to False if loaded from database
     self.can_delete = can_delete
     
     status_panel = VerticalPanel()
     self.status_lst = ListBox(Height='34px')
     self.status_lst.setStyleName('form-control input-lg')
     self.status_lst.addItem('Open')
     self.status_lst.addItem('Closed')
     # we put date here
     
     self.status_lbl = Label('')
     self.set_start_date(start_date)
     self.status_lbl.setStyleName('text-muted')
     status_panel = VerticalPanel()
     status_panel.add(self.status_lst)
     status_panel.add(self.status_lbl)
     self.comment = Text_Area_Row('', 'why it exists or is being closed')
     hpanel = HorizontalPanel()
     hpanel.add(desc_panel)
     hpanel.add(Label(Width='10px'))
     hpanel.add(status_panel)
     self.vpanel.add(hpanel)
     self.vpanel.add(self.comment.panel())
Example #33
0
    def __init__(self,parent):
        AbsolutePanel.__init__(self)

        self.roleList = ListBox()
        self.roleList.setWidth('300px')
        self.roleList.setVisibleItemCount(6)
        self.roleList.addChangeListener(self.onListChange)
        #self.roleList.addKeyboardListener(self)
        self.roleCombo = ListBox()
        self.roleCombo.addKeyboardListener(self)
        self.roleCombo.addChangeListener(self.onComboChange)
        self.addBtn = Button("Add")
        self.addBtn.setEnabled(False)
        self.removeBtn = Button("Remove")
        self.removeBtn.setEnabled(False)

        vpanel = VerticalPanel()
        vpanel.add(self.roleList)
        hpanel = HorizontalPanel()
        hpanel.add(self.roleCombo)
        hpanel.add(self.addBtn)
        hpanel.add(self.removeBtn)
        vpanel.add(hpanel)

        self.add(vpanel)
        self.clearForm()
        return
Example #34
0
class Form_Row(SimplePanel):
    '''
    Create row that will be put in the Form
    '''
    def __init__(self, name, widget, help=''):
        SimplePanel.__init__(self)
        # Container
        self.mainpanel = VerticalPanel()

        self.lbl = Label(name)
        self.hlp = Label(help)
        self.lbl.setStyleName('h3')
        self.hlp.setStyleName('text-muted')
        
        self.wdg = widget
        self.mainpanel.add(self.lbl)
        self.mainpanel.add(self.wdg)
        self.mainpanel.add(self.hlp)
        
    def panel(self):
        return self.mainpanel

    def widget(self):
        return self.wdg

    def help(self):
        return self.hlp
Example #35
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)
        self.form.setAction("http://nonexistent.com")
        self.form.setTarget("results")

        vPanel = VerticalPanel()

        hPanel = HorizontalPanel()
        hPanel.setSpacing(5)
        hPanel.add(Label("Upload file:"))

        self.field = FileUpload()
        self.field.setName("file")
        hPanel.add(self.field)

        hPanel.add(Button("Submit", getattr(self, "onBtnClick")))

        vPanel.add(hPanel)

        results = NamedFrame("results")
        vPanel.add(results)

        self.form.add(vPanel)
        self.add(self.form)
Example #36
0
 def get_case_panel(self):
     panel = VerticalPanel()
     title = HTML("""Case""")
     panel.add(title)
     tree = self.get_case_tree()
     panel.add(tree)
     return panel
Example #37
0
    def onModuleLoad(self):
        self.remote = DataService()
        vPanel = VerticalPanel()


        # create div to hold map
        mapPanel = SimplePanel()
        mapPanel.setSize('700px','400px')

        # initiate getting gps data from web2py
        self.remote.getPoints(self)

        # create slider div
        slider = SimplePanel()
        self.slider = slider

        # add map and slide to main panel
        vPanel.add(mapPanel)
        vPanel.add(slider)

        # add everything to page's GreedyPyJs div
        root = RootPanelCls(DOM.getElementById("GreedPyJs"))
        root.add(vPanel)

        # Create initial google map
        self.map = GMap2(mapPanel.getElement())
        self.map.setCenter(GLatLng(37.4419, -122.1419), 13)


        # create place to hold gps positions
        # these will be in tuples: (date, latitude, longitude)
        self.positions=[]
Example #38
0
class Contacts(Composite):
    def __init__(self):
        Composite.__init__(self)

        self.contacts = []
        self.contacts.append(Contact("Benoit Mandelbrot", "*****@*****.**"))
        self.contacts.append(Contact("Albert Einstein", "*****@*****.**"))
        self.contacts.append(Contact("Rene Descartes", "*****@*****.**"))
        self.contacts.append(Contact("Bob Saget", "*****@*****.**"))
        self.contacts.append(Contact("Ludwig von Beethoven", "*****@*****.**"))
        self.contacts.append(Contact("Richard Feynman", "*****@*****.**"))
        self.contacts.append(Contact("Alan Turing", "*****@*****.**"))
        self.contacts.append(Contact("John von Neumann", "*****@*****.**"))

        self.panel = VerticalPanel()

        # Add all the contacts to the list.
        i = 0
        while (i < len(self.contacts)):
            self.addContact(self.contacts[i])
            i =  i + 1

        self.initWidget(self.panel)
        self.setStyleName("mail-Contacts")

    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)
Example #39
0
 def __init__(self, hendler = None):
     VerticalPanel.__init__(self,
                            #HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                            #VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                            Width="100%",
                            #Height="100%",
                            Spacing=5)
                            
     self.remote = DataService(['getaccounts'])        
                            
     self.grid = Grid(1, 3,
                 BorderWidth=1,
                 CellPadding=4,
                 CellSpacing=1,
                 StyleName="grid")
     self.grid.setText(0, 0, u"Number")
     self.grid.setText(0, 1, u"Type")
     self.grid.setText(0, 2, u"Balance")
     
     formatter = self.grid.getRowFormatter()
     formatter.setStyleName(0, "grid-header")
     
     self.add(Label(u"Accounts"))
     
     self.add(self.grid)
Example #40
0
    def __init__(self):
        Composite.__init__(self)
        self.vp_list = VerticalPanel()
        self.sinks = []
        self.selectedSink = -1

        self.initWidget(self.vp_list)
        self.setStyleName("ks-List")
Example #41
0
 def __init__(self):
     VerticalPanel.__init__(self,
                            HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                            VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                            Width="100%",
                            Height="100%",
                            Spacing=5)
     self.add(Label(JS('gettext("Hello, \%username\%!")')))
Example #42
0
 def onModuleLoad(self):
     
     self.remote_py = MyBlogService()
     
     # Create a FormPanel and point it at a service.
     self.form = FormPanel()
     
     # Create a panel to hold all of the form widgets.
     vp=VerticalPanel(BorderWidth=0,HorizontalAlignment=HasAlignment.ALIGN_CENTER,VerticalAlignment=HasAlignment.ALIGN_MIDDLE,Width="100%",Height="150px")
     self.form.setWidget(vp)
     
     header=HTML("<h2>LOGIN TO YOUR ACCOUNT</h2>")
     part1=header
           
     # Create a TextBox, giving it a name so that it will be submitted.
     self.userName = TextBox()
     self.userName.setName("userNameFormElement")
     self.userName.setPlaceholder("User Name")
     part2=self.userName
     
     self.password = PasswordTextBox()
     self.password.setName("passwordFormElement")
     self.password.setPlaceholder("Password")
     part3=self.password
     
     self.errorInfoLabel = Label()
     self.errorInfoLabel.setStyleName('error-info')
     part4=self.errorInfoLabel
     part4.setStyleName("errorlabel")
     
      # Add a 'submit' button.
     hpanel = HorizontalPanel(BorderWidth=0,HorizontalAlignment=HasAlignment.ALIGN_CENTER,VerticalAlignment=HasAlignment.ALIGN_MIDDLE,Width="100%",Height="50px")
     
     partb=Button("Login", self)
     partb.setStyleName('btn')
     
     image=Label("Don''t have account? Sign up")
     anchor = Anchor(Widget=image, Href='/signup.html')
     parta=anchor
     
          
     hpanel.add(partb)
     hpanel.add(parta)
    
     part5=hpanel 
     part5.setStyleName("hpanel")
     
     vp.add(part1)
     vp.add(part2)
     vp.add(part3)
     vp.add(part4)
     vp.add(part5)
     vp.setStyleName("signup")
     
     # Add an event handler to the form.
     self.form.addFormHandler(self)
     RootPanel().add(self.form)
Example #43
0
 def __init__ (self, tags = None, width = 300, selected = None, myid = None):
     VerticalPanel.__init__(self)
     self.s2 = Select2TaggingComponent(tags, width, selected, myid)
     self.reset_button = Button("Reset", self)
     self.show_values_button = Button("Show", self)
     self.add(self.s2)
     self.add(self.reset_button)
     self.add(self.show_values_button)
     self.s2.change = self.change
Example #44
0
 def __init__(self):
     """ Standard initialiser.
     """
     VerticalPanel.__init__(self)
     self.canvas = Raphael(900,700)
     self.add(self.canvas)
     x = DOM.getAbsoluteLeft(self.canvas.getElement())
     y = DOM.getAbsoluteTop(self.canvas.getElement())
     self.offset = (x,y)
Example #45
0
    def __init__(self,onClick):
        ScrollPanel.__init__(self, Size=("630px", "500px"))
        self.checkbox_list = []
        self.hpanel_list = []
        self.image_list = []

        self.pok = VerticalPanel()
        self.add(self.pok)
        self.onclick=onClick
Example #46
0
class EditPanel:
    """ Defines a panel for editing data store objects.
    """
    def __init__(self):
        """ Constructs a new EditPanel.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        #        self.remote_py = RegionNamesServicePython()

        self.panel = VerticalPanel()

        top_panel = HorizontalPanel()
        top_panel.setSpacing(8)
        self.panel.add(top_panel)

        refresh = Button("Refresh", self)
        top_panel.add(refresh)

        self.status = Label()
        top_panel.add(self.status)

        edit_panel = HorizontalPanel()
        self.panel.add(edit_panel)

        self.tree = Tree()
        self.tree.addTreeListener(self)
        edit_panel.add(self.tree)

        upload_item = TreeItem("Upload")
        self.tree.add(upload_item)
        map_item = TreeItem("Map")
        self.tree.add(map_item)

    def onTreeItemSelected(self, item):
        pass

    def onTreeItemStateChanged(self, item):
        child = item.getChild(0)

    def onClick(self, sender):
        self.status.setText(self.TEXT_WAITING)
        if self.remote_py.get_geographical_region_names(self) < 0:
            self.status.setText(self.TEXT_ERROR)

    def onRemoteResponse(self, response, request_info):
        for name in response:
            item = TreeItem(name)
            item.addItem(PendingItem())
            self.tree.addItem(item)

        self.status.setText('')

    def onRemoteError(self, code, message, request_info):
        self.status.setText("Server Error or Invalid Response: ERROR " + code +
                            " - " + message)
Example #47
0
    def __init__(self):

        Sink.__init__(self)

        text = "<div class='infoProse'>This is the Kitchen Sink sample.  "

        self.vp = VerticalPanel()
        self.initWidget(self.vp)
        self.loaded = False
Example #48
0
class pjBallot:
    
    def __init__(self):
        self.mainPanel = VerticalPanel()
        self.contest = HorizontalPanel()
        self.contest.setStyleName('words')
        self.selection = HorizontalPanel()
        self.selection.setStyleName('words')
        self.button = Button('test', self.test)
        self.x = 1
    
    def test(self):
        self.button.setText("No, really click me!")
#        Window.alert("Hello, AJAAAX!")
        self.contest.add(HTML('yay'))

    def nextContest(self):
        self.x += 1
        self.contest.clear()
        self.contest.add(HTML('<b /> Contest: %d' % self.x))

    def nextSelection(self):
        self.x += 1
        self.selection.clear()
        self.selection.add(HTML('<b /> Selection: %d' % self.x))
    
    def onKeyDown(self, sender, keycode, modifiers):
        pass

    def onKeyUp(self, sender, keycode, modifiers):
        pass

    def onKeyPress(self, sender, keycode, modifiers):
        DOM.eventPreventDefault(DOM.eventGetCurrentEvent()) #not needed
        if keycode == KeyboardListener.KEY_UP:
            self.nextContest()
        if keycode == KeyboardListener.KEY_DOWN:
            self.nextContest()
        if keycode == KeyboardListener.KEY_LEFT:
            self.nextSelection()
        if keycode == KeyboardListener.KEY_RIGHT:
            self.nextSelection()

    def onModuleLoad(self):
        h = HTML("<b />Contest: ")
        self.contest.add(h)
        l = HTML("<b />Selection: ")
        self.selection.add(l)
#        self.mainPanel.add(self.button)
        self.mainPanel.add(self.contest)
        self.mainPanel.add(self.selection)
        
        panel = FocusPanel(Widget=self.mainPanel)
        gp = RootPanelListener(panel)
        manageRootPanel(gp)
        RootPanel().add(panel)
        panel.setFocus(True)
Example #49
0
    def __init__(self):
        VerticalPanel.__init__(self, Width="500px", Height="300px")

        table = FlexTable()

        for i, sentence in enumerate(["The dog is red", "The cat is blue", "The bear is green"]):
            table.setWidget(i, 0, CodeSwitchingSentence(sentence))

        self.add(table)
Example #50
0
 def __init__(self, tabPanel, topPanel, **kwargs):
     VerticalPanel.__init__(self, StyleName='user-list-panel', **kwargs)
     self.tabPanel = tabPanel
     self.topPanel = topPanel
     self.iconAdder = None
     self.iconPanel = None
     self.nSelected = 0
     self.leftPanelWidth = 340
     self.widthFudgeFactor = 25
Example #51
0
    def __init__(self, *args, **kwargs):

        self.handlers = []
        self.content = None
        self.images = False

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

        # process the passed arguments
        headerText = headerWidget = None
        isOpen = False
        if len(args) == 1:
            header = args[0]
        if len(args) == 2:
            header, isOpen = args[:2]
        # apparently "basestring" is not understood
        if isinstance(header, basestring):
            headerText = header
        else:
            headerWidget = header
        isOpen = kwargs.pop('isOpen', isOpen)
        headerText = kwargs.pop('header', headerText)
        headerWidget = kwargs.pop('header', headerWidget)
        # TODO: add ImageBundle
        # images = kwargs.pop('images', None)

        # If both headerText and headerWidget are arguments, headerText will
        # be used to preserve API compatibility.
        headerContent = headerWidget
        if headerText is not None or headerContent is None:
            if headerText is None:
                headerText = ""
            headerContent = DefaultHeader(headerText)

        self.mainPanel = VerticalPanel(Element=element)

        self._init_header(headerContent)

        self.contentWrapper = SimplePanel()
        self.mainPanel.add(self.header)
        self.mainPanel.add(self.contentWrapper)
        DOM.setStyleAttribute(self.contentWrapper.getElement(), "padding",
                              "0px")
        DOM.setStyleAttribute(self.contentWrapper.getElement(), "overflow",
                              "hidden")

        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-DisclosurePanel")
        Composite.__init__(self, self.mainPanel, **kwargs)

        # Must call setOpen after creating the initializing the object
        self.isOpen = None
        self.setOpen(isOpen)

        self.setContentDisplay()
Example #52
0
    def __init__(self):
        VerticalPanel.__init__(self)
        self.setSpacing("10px")

        field = TextArea()
        field.setCharacterWidth(20)
        field.setVisibleLines(4)
        self.add(field)

        self.add(AutoTextArea(self))
Example #53
0
    def __init__(self):
        VerticalPanel.__init__(self)
        self.setSpacing("10px")

        field = TextArea()
        field.setCharacterWidth(20)
        field.setVisibleLines(4)
        self.add(field)

        self.add(AutoTextArea(self))
Example #54
0
    def __init__(self, *args, **kwargs):
        super(Sidebar, self).__init__(*args, **kwargs)

        if self.getStylePrimaryName() is None:
            self.addStyleName("sidebar")

        vp = VerticalPanel(Size=("100%", "100%"))
        self._layers_panel = LayersPanel(Width="100%")
        vp.add(self._layers_panel)
        self.setWidget(vp)
Example #55
0
def border(contents):
    """ Draw a border around the given contents.

        We return a Panel which wraps up the given contents and draws a border
        around it.
    """
    wrapper = VerticalPanel()
    wrapper.add(contents)
    wrapper.setBorderWidth(1)
    return wrapper
Example #56
0
 def __init__(self, remove_callback):
     self._remove_callback = remove_callback
     self.panel = VerticalPanel()
     self.panel.add(HTML(self.desc(), StyleName='DisplayMath'))
     self.value_arrays = []
     for va in self._gen_arrays():
         self.value_arrays.append(va)
         self.panel.add(va.panel)
     link = Hyperlink("remove", StyleName="action")
     link.addClickListener(getattr(self, '_remove'))
     self.panel.add(link)
Example #57
0
 def __init__(self, min_age, max_age, id):
     self.min_age = min_age
     self.max_age = max_age
     VerticalPanel.__init__(self)
     DropWidget.__init__(self)
     DragContainer.__init__(self)
     self.setID(id)
     self.setWidth(200)
     self.setHeight(300)
     self.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP)
     self.setStyleName('drophere2')
     self.addTitle()
Example #58
0
 def __init__(self):
     VerticalPanel.__init__(self)
     self.width = '100%'
     self.setID('content')
     self.add(TopVerbage())
     self.add(NewSchool())
     self.add(Delegated())
     self.add(ImageDrop())
     self.add(DataTransferDemo())
     self.add(DragEffects())
     self.add(AbsolutePosition())
     self.add(MultiTargetDemo())