Beispiel #1
0
 def __init__(self, SW, SH):
     HorizontalPanel.__init__(self)
     self.SW = SW
     self.SH = SH
     self.context = GWTCanvas(SW, SH, SW, SH)
     self.context.addStyleName("gwt-canvas")
     self.add(self.context)
Beispiel #2
0
    def __init__(self, tabBar=None, *kwargs):
        TabPanel.__init__(self, tabBar, *kwargs)
        self.parent_buoy = None

        self.tabs = [{'hovertype' : ListBox(), 'name' : 'Cost'},
                     {'hovertype' : ListBox(), 'name' : 'Speed'}]

        self.cost = self.tabs[0]['hovertype']
        items = ['cheap','next to cheap','average','above average','expensive','if you have to ask']
        self.cost.setVisibleItemCount(len(items))
        for item in items:
            self.cost.addItem(item)
        self.cost.addChangeListener(self)

        self.speed = self.tabs[1]['hovertype']
        items = ['very slow','slow','average','above average','fast','quick','hyper','turbo','lightening','light']
        self.speed.setVisibleItemCount(len(items))
        for item in items:
            self.speed.addItem(item)
        self.speed.addChangeListener(self)

        for tab in self.tabs:
            h = HorizontalPanel()
            h.add(tab['hovertype'])
            self.add(h, tab['name'])
Beispiel #3
0
    def __init__(self, theorem, **kwargs):
        DialogWindow.__init__(self, modal=True, close=True)
        self.theorem=theorem
        v = VerticalPanel()
        v.setWidth(300)
        # v.setHeight(500)
        self.setText("save")
        self.setPopupPosition(100, 100)
        self.setStyleAttribute("background-color", "#ffffff")
        self.setStyleAttribute("color", "red")
        self.setStyleAttribute("border-width", "5px")
        self.setStyleAttribute("border-style", "solid")
        self.im=Image()
        self.im.setUrl(latex_to_url(self.theorem.formula.to_latex()))
        v.add(self.im)
        h=HorizontalPanel()
        self.radio=RadioButton("group1", "Existing folder:")
        h.add(self.radio)
        self.list = ListBox()
        self.list.setVisibleItemCount(1)
        for f in Theorem.get_all_folders():
            self.list.addItem(f)

        h.add(self.list)
        v.add(h)
        h=HorizontalPanel()
        h.add(RadioButton("group1", "New folder:"))
        self.radio.setChecked(True)
        self.textbox=TextBox()
        h.add(self.textbox)
        v.add(h)
        v.add(Button("Done",self.done_click))
        self.add(v)
Beispiel #4
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        self.geocoder = Geocoder()

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        self.address = TextBox()
        self.address.setText("Sydney, NSW")
        self.address.addChangeListener(self.codeAddress)

        topPanel.add(self.address)

        button = Button("Geocode")
        button.addClickListener(self.codeAddress)

        topPanel.add(button)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('600', '400')
        self.add(mapPanel, DockPanel.CENTER)

        options = MapOptions(zoom=8, center=LatLng(-34.397, 150.644),
                           mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)
Beispiel #5
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
Beispiel #6
0
    def __init__(self):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.hpanel = HorizontalPanel(Width='475px')
        self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)
        
        self.name = TextBox()
        self.name.setStyleName('form-control')
        
        self.status = ListBox()
        self.status.addItem('Active')
        self.status.addItem('Inactive')
        self.status.setVisibleItemCount(0)
        self.status.setStyleName('form-control input-lg')
        self.status.setSize('100px', '34px')
        
        lbl = Label('', Width='10px')

        self.add_btn = Button('Add')
        self.add_btn.setStyleName('btn btn-primary')
        self.del_btn = Button('Delete')
        self.del_btn.setStyleName('btn btn-danger')

        self.hpanel.add(self.name)
        self.hpanel.add(lbl)
        self.hpanel.add(self.status)
        self.hpanel.add(self.add_btn)
        self.hpanel.add(self.del_btn)
Beispiel #7
0
class Site:
    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()
Beispiel #8
0
    def __init__(self):

        Sink.__init__(self)

        self.formula = AX_REG
        self.image1 = Image(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
        self.cnf=self.formula.simplify().to_cnf()
        self.image2 = Image(latex_to_url(self.cnf.to_latex()))
        self.vars=self.cnf.get_vars()

        self.vars_with_proto = [{"var": var, "proto": Proto(var.name)} for var in self.vars]
        self.fProto = [
            Proto("Beethoven", [x["proto"] for x in self.vars_with_proto])
        ]

        self.fTree = Tree()

        for i in range(len(self.fProto)):
            self.createItem(self.fProto[i])
            self.fTree.addItem(self.fProto[i].item)

        self.fTree.addTreeListener(self)

        self.panel = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_TOP)
        self.panel.setSpacing(40)
        self.panel.add(self.fTree)

        self.panel.add(self.image1)
        self.panel.add(self.image2)

        self.initWidget(self.panel)
 def _createButtonPanel(self):
     hp = HorizontalPanel()
     self.okBtn = Button('OK', self.onOk, StyleName=self.baseStyleName + '-button')
     self.cancelBtn = Button('Cancel', self.onCancel, StyleName=self.baseStyleName + '-button')
     hp.add(self.okBtn)
     hp.add(self.cancelBtn)
     return hp
Beispiel #10
0
    def __init__(self, milestone_names, milestone_dates):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.milestone_dates = milestone_dates
       
        self.hpanel = HorizontalPanel()
        self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_TOP)
        self.name = ListBox(Height='34px', Width='208px')
        self.name.setStyleName('form-control input-lg')
        self.name.addChangeListener(getattr(self, 'on_milestone_changed'))
       
        for m in milestone_names:
            self.name.addItem(m) 
        if len(self.milestone_dates) > 0:
            self.planned_completion = Label(self.milestone_dates[0])
        else:
            self.planned_completion = Label('Undefined')
            
        self.planned_completion.setStyleName('form-control text-normal')

        self.expected_completion = Report_Date_Field(cal_ID='end')
        self.expected_completion.getTextBox().setStyleName('form-control')
        self.expected_completion.setRegex(DATE_MATCHER)
        self.expected_completion.appendValidListener(self._display_ok)
        self.expected_completion.appendInvalidListener(self._display_error)
        self.expected_completion.validate(None)

        self.hpanel.add(self.name)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.planned_completion)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.expected_completion)
Beispiel #11
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)
Beispiel #12
0
    def _add_statusbar ( self ):
        """ Adds a statusbar to the dialog.
        """
        if self.ui.view.statusbar is not None:
            control = HorizontalPanel()
#            control.setSizeGripEnabled(self.ui.view.resizable)
            listeners = []
            for item in self.ui.view.statusbar:
                # Create the status widget with initial text
                name = item.name
                item_control = Label()
                item_control.setText(self.ui.get_extended_value(name))

                # Add the widget to the control with correct size
#                width = abs(item.width)
#                stretch = 0
#                if width <= 1.0:
#                    stretch = int(100 * width)
#                else:
#                    item_control.setMinimumWidth(width)
                control.add(item_control)

                # Set up event listener for updating the status text
                col = name.find('.')
                obj = 'object'
                if col >= 0:
                    obj = name[:col]
                    name = name[col+1:]
                obj = self.ui.context[obj]
                set_text = self._set_status_text(item_control)
                obj.on_trait_change(set_text, name, dispatch='ui')
                listeners.append((obj, set_text, name))

            self.master.add(control)
            self.ui._statusbar = listeners
Beispiel #13
0
 def __init__(self, row, column=0):
     super(Game, self).__init__(StyleName='game')
     self.sinkEvents(Event.ONCONTEXTMENU)  # to disable right click
     
     self.row = row
     self.column = column or row
     self.level = 1
     self.toppers = [[], [], []]  # storage for top scorers for 3 levels.
     self.remote = DataService()
     self.remote_handler = RemoteHandler(self)
     self.remote.get_scores(self.remote_handler)
     
     # contents of Game
     menubar = MineMenuBar(self)
     score_board = HorizontalPanel(StyleName='score-board')
     self.grid_panel = SimplePanel(StyleName='grid-panel')
     
     self.add(menubar)
     self.add(score_board)
     self.add(self.grid_panel)
     
     # contents of score_board
     self.counter = Label('000', StyleName='digit counter')
     self.face = Smiley(self)
     self.timer = Label('000', StyleName='digit timer')
     
     for one in (self.counter, self.face, self.timer):
         score_board.add(one)
     score_board.setCellWidth(self.face, '100%')
     
     self.create_grid()
     self.start()
    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)
class HorizontalToolbar(SimplePanel):
    def __init__(self, onRequestMore=None, onCollapseAll=None, onExpandAll=None, onSort=None):
        super(HorizontalToolbar, self).__init__(StyleName=Styles.TOOLBAR_HORIZONTAL)
        self.content = HorizontalPanel()

        self.requestMoreButton = Button('More', onRequestMore, StyleName=Styles.TOOLBAR_BUTTON)
        self.content.add(self.requestMoreButton)

        self.itemsShowingLabel = Label(StyleName=Styles.TOOLBAR_TEXT)
        self.content.add(self.itemsShowingLabel)
        self.setNumberOfItemsShowingText(0, 0)

        self.collapseAllButton = Button('Collapse All', onCollapseAll, StyleName=Styles.TOOLBAR_BUTTON)
        self.content.add(self.collapseAllButton)
        self.expandAllButton = Button('Expand All', onExpandAll, StyleName=Styles.TOOLBAR_BUTTON)
        self.content.add(self.expandAllButton)

        if onSort:
            self.content.add(SortPanel(onSort))

        self.setWidget(self.content)
        return
    def setNumberOfItemsShowingText(self, number, total):
        self.itemsShowingLabel.setText('Showing %s of %s total items.' % (number, total))
        return
 def __init__(self, labelname, contenthtml, labelnamesuffix=': ', ensure_labelnamesuffix=True):
     HorizontalPanel.__init__(self)
     if ensure_labelnamesuffix and not labelname.endswith(labelnamesuffix):
         labelname += labelnamesuffix
     self.add(Label(labelname, StyleName=Styles.CONTENTITEM_COMPONENT_LABEL))
     self.add(HTML(contenthtml, StyleName=Styles.CONTENTITEM_COMPONENT_CONTENT))
     return
Beispiel #17
0
    def __init__(self, left = 50, top = 50):
        DialogBox.__init__(self, modal = False)

        self.setPopupPosition(left, top)
        self.setText("Preferences")
        ftable = FlexTable()
        ftableFormatter = ftable.getFlexCellFormatter()
        row = 0

        try:
            self.fileLocation = getCookie("fileLocation")
        except:
            self.fileLocation = None

        row += 1
        ftable.setWidget(row, 0, Label("Sheet loaded on startup", wordWrap=False))
        self.fileLocationInput = TextBox()
        self.fileLocationInput.addChangeListener(self.checkValid)
        self.fileLocationInput.addKeyboardListener(self)
        self.fileLocationInput.setVisibleLength(30)
        self.fileLocationInput.setText(self.fileLocation)
        ftable.setWidget(row, 1, self.fileLocationInput)

        row += 1
        hpanel = HorizontalPanel()
        self.saveBtn = Button("Save", self.onSave)
        self.saveBtn.setEnabled(False)
        hpanel.add(self.saveBtn)
        self.cancelBtn = Button("Cancel", self.onCancel)
        hpanel.add(self.cancelBtn)
        ftable.setWidget(row, 0, hpanel)
        ftableFormatter.setColSpan(row, 0, 2)

        self.setWidget(ftable)
 def __init__(self):
     HorizontalPanel.__init__(self, StyleName="type_block select_block")
     self.add(Label('Tipo:'))       
     
     fake = Element(Element=DOM.createDiv())
     
     self.booleanBlock = getattr(ArduinoBlocks, 'logicType')('logica', 'red', off=True)
     fake.append(self.booleanBlock)
     self.logicType = RadioButton("group1", fake.getElement().innerHTML, True)
     self.logicType.addClickListener(getattr(self, "onClickLogicType"))
     self.add(self.logicType)
     fake.removeAll()
     
     self.numberBlock = getattr(ArduinoBlocks, 'numericType')('numerica', 'red', off=True)
     fake.append(self.numberBlock)
     self.numericType = RadioButton("group1", fake.getElement().innerHTML, True)
     self.numericType.setChecked(True)
     self.numericType.addClickListener(getattr(self, "onClickNumericType"))
     self.add(self.numericType)
     fake.removeAll()
     
     self.stringBlock = getattr(ArduinoBlocks, 'alphaNumericType')('alfanumerica', 'red', off=True)
     fake.append(self.stringBlock)
     self.alphaNumericType = RadioButton("group1", fake.getElement().innerHTML, True)
     self.alphaNumericType.addClickListener(getattr(self, "onClickAlphanumericType"))
     self.add(self.alphaNumericType)
     
     self.onClickNumericType()
Beispiel #19
0
 def InitialiseScreen(self):
     hpanel = HorizontalPanel()
     self.add(hpanel)
     vpanelMenu = VerticalPanel()
     hpanel.add(vpanelMenu)
     self.addbutton = Button("Add Triangle")
     vpanelMenu.add(self.addbutton)
     self.addbutton.addClickListener(getattr(self, "addtriangle"))
     self.canvas = GWTCanvas(self.CANVAS_WIDTH, self.CANVAS_HEIGHT)
     vpanelCanvas = VerticalPanel()
     self.canvas.setWidth(self.CANVAS_WIDTH)
     self.canvas.setHeight(self.CANVAS_HEIGHT)
     hpanel.add(vpanelCanvas)
     vpanelCanvas.add(self.canvas)
     self.canvas.addMouseListener(self)
     self.selecteditem = None
     self.selectedhandle = None
     self.mouseisdown = False
     dc = DocumentCollection.documentcollection
     DocumentCollection.documentcollection.edgelistener = self.EdgeListener
     if len(dc.documentsbyclass[model.Drawing.__name__]) == 0:
         drawing = model.Drawing(None)
         dc.AddDocumentObject(drawing)
         EdgePoster([a.asDict() for a in drawing.history.GetAllEdges()])
     else:
         for k,v in dc.documentsbyclass[model.Drawing.__name__].iteritems():
             drawing = v
     self.drawingid = drawing.id
     self.Draw()
Beispiel #20
0
 def __init__(self, chart):
     self.chart = chart
     self.canvas = chart.canvas
     
     self.b2 = Button("Compositing", self)
     self.b3 = Button("Paths & shapes", self)
     self.b4 = Button("Arcs & circles", self)
     self.b1 = Button("Bezier curves", self)
     self.b6 = Button("Colors", self)
     self.b7 = Button("Translating", self)
     self.b8 = Button("Scaling", self)
     self.b5 = Button("Rotating", self)
     self.b10 = Button("Transparency", self)
     self.b11 = Button("Lines", self)
     self.b9 = Button("Animations", self)
     
     hp = HorizontalPanel()
     vp = VerticalPanel()
     vp.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
     vp.add(Label("MENU"))
     vp.setSpacing(6)
     vp.add(self.b2)
     vp.add(self.b3)
     vp.add(self.b4)
     vp.add(self.b1)
     vp.add(self.b6)
     vp.add(self.b7)
     vp.add(self.b8)
     vp.add(self.b5)
     vp.add(self.b10)
     vp.add(self.b11)
     vp.add(self.b9)
     hp.add(vp)
     
     Composite.__init__(self, hp)
Beispiel #21
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)
Beispiel #22
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)
Beispiel #23
0
    def __init__(self, chart):
        self.chart = chart
        self.canvas = chart.canvas

        self.b2 = Button("Compositing", self)
        self.b3 = Button("Paths & shapes", self)
        self.b4 = Button("Arcs & circles", self)
        self.b1 = Button("Bezier curves", self)
        self.b6 = Button("Colors", self)
        self.b7 = Button("Translating", self)
        self.b8 = Button("Scaling", self)
        self.b5 = Button("Rotating", self)
        self.b10 = Button("Transparency", self)
        self.b11 = Button("Lines", self)
        self.b9 = Button("Animations", self)

        hp = HorizontalPanel()
        vp = VerticalPanel()
        vp.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
        vp.add(Label("MENU"))
        vp.setSpacing(6)
        vp.add(self.b2)
        vp.add(self.b3)
        vp.add(self.b4)
        vp.add(self.b1)
        vp.add(self.b6)
        vp.add(self.b7)
        vp.add(self.b8)
        vp.add(self.b5)
        vp.add(self.b10)
        vp.add(self.b11)
        vp.add(self.b9)
        hp.add(vp)

        Composite.__init__(self, hp)
Beispiel #24
0
    def __init__(self, app):
        self.app = app
        DialogWindow.__init__(
            self, modal=False,
            minimize=True, maximize=True, close=True,
        )
        self.closeButton = Button("Close", self)
        self.saveButton = Button("Save", self)
        self.setText("Sample DialogWindow with embedded image")
        self.msg = HTML("", True)

        global _editor_id
        _editor_id += 1
        editor_id = "editor%d" % _editor_id

        #self.ht = HTML("", ID=editor_id)
        self.txt = TextArea(Text="", VisibleLines=30, CharacterWidth=80,
                        ID=editor_id)
        dock = DockPanel()
        dock.setSpacing(4)

        hp = HorizontalPanel(Spacing="5")
        hp.add(self.saveButton)
        hp.add(self.closeButton)

        dock.add(hp, DockPanel.SOUTH)
        dock.add(self.msg, DockPanel.NORTH)
        dock.add(self.txt, DockPanel.CENTER)

        dock.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_RIGHT)
        dock.setCellWidth(self.txt, "100%")
        dock.setWidth("100%")
        self.setWidget(dock)
        self.editor_id = editor_id
        self.editor_created = False
Beispiel #25
0
    def __init__(self, owner):
        Composite.__init__(self)
        self.owner = owner
        self.bar = DockPanel()
        self.gotoFirst = Button("&lt;&lt;", self)
        self.gotoNext = Button("&gt;", self)
        self.gotoPrev = Button("&lt;", self)
        self.status = HTML()

        self.initWidget(self.bar)
        self.bar.setStyleName("navbar")
        self.status.setStyleName("status")

        buttons = HorizontalPanel()
        buttons.add(self.gotoFirst)
        buttons.add(self.gotoPrev)
        buttons.add(self.gotoNext)
        self.bar.add(buttons, DockPanel.EAST)
        self.bar.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT)
        self.bar.add(self.status, DockPanel.CENTER)
        self.bar.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        self.bar.setCellHorizontalAlignment(self.status, HasAlignment.ALIGN_RIGHT)
        self.bar.setCellVerticalAlignment(self.status, HasAlignment.ALIGN_MIDDLE)
        self.bar.setCellWidth(self.status, "100%")

        self.gotoPrev.setEnabled(False)
        self.gotoFirst.setEnabled(False)
Beispiel #26
0
    def onModuleLoad(self):
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        self.remote = JSONProxy("../api", ["hello"])

        self.status = Label()
        self.text_box = TextBox()

        self.button_send = Button("Send", self)

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

        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>Enter your name below.</p>"""

        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(self.text_box)
        #panel.add(method_panel)
        panel.add(buttons)
        panel.add(self.status)

        RootPanel().add(panel)
Beispiel #27
0
    def __init__(self):
        HorizontalPanel.__init__(self)

        History.newItem("test")
        show = Button("Show deep link", self.showDL)
        setDL = Button("Set deep link to 'pyjamas'", self.setDL)
        self.add(setDL)
        self.add(show)
Beispiel #28
0
 def __init__(self, token_index, target_word):
     HorizontalPanel.__init__(self)
     self.token_index = token_index
     self.table = FlexTable()
     self.label = Label(target_word)
     self.textbox = TextBox()
     self.add(self.label)
     self.add(self.textbox)
Beispiel #29
0
 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
Beispiel #30
0
    def __init__(self):
        HorizontalPanel.__init__(self)

        History.newItem("test")
        show = Button("Show deep link", self.showDL)
        setDL = Button("Set deep link to 'pyjamas'", self.setDL)
        self.add(setDL)
        self.add(show)
Beispiel #31
0
    def __init__(self,parent):
        AbsolutePanel.__init__(self)
        ftable = FlexTable()

        ftable.setWidget(0, 0, Label("First Name", wordWrap=False))
        ftableFormatter = ftable.getFlexCellFormatter()
        self.firstInput = TextBox()
        self.firstInput.addChangeListener(self.checkValid)
        self.firstInput.addKeyboardListener(self)
        ftable.setWidget(0, 1, self.firstInput)

        ftable.setWidget(1, 0, Label("Last Name", wordWrap=False))
        self.lastInput = TextBox()
        self.lastInput.addChangeListener(self.checkValid)
        self.lastInput.addKeyboardListener(self)
        ftable.setWidget(1, 1, self.lastInput)

        ftable.setWidget(2, 0, Label("Email", wordWrap=False))
        self.emailInput = TextBox()
        self.emailInput.addChangeListener(self.checkValid)
        self.emailInput.addKeyboardListener(self)
        ftable.setWidget(2, 1, self.emailInput)

        ftable.setWidget(3, 0, Label("Username", wordWrap=False))
        self.usernameInput = TextBox()
        self.usernameInput.addChangeListener(self.checkValid)
        self.usernameInput.addKeyboardListener(self)
        ftable.setWidget(3, 1, self.usernameInput)

        ftable.setWidget(4, 0, Label("Password", wordWrap=False))
        self.passwordInput = PasswordTextBox()
        self.passwordInput.addChangeListener(self.checkValid)
        self.passwordInput.addKeyboardListener(self)
        ftable.setWidget(4, 1, self.passwordInput)

        ftable.setWidget(5, 0, Label("Confirm", wordWrap=False))
        self.confirmInput = PasswordTextBox()
        self.confirmInput.addChangeListener(self.checkValid)
        self.confirmInput.addKeyboardListener(self)
        ftable.setWidget(5, 1, self.confirmInput)

        ftable.setWidget(6, 0, Label("Department", wordWrap=False))
        self.departmentCombo = ListBox()
        self.departmentCombo.addChangeListener(self.checkValid)
        self.departmentCombo.addKeyboardListener(self)
        ftable.setWidget(6, 1, self.departmentCombo)

        hpanel = HorizontalPanel()
        self.addBtn = Button("Add User", self.onAdd)
        self.addBtn.setEnabled(False)
        hpanel.add(self.addBtn)
        self.cancelBtn = Button("Cancel", self.onCancel)
        hpanel.add(self.cancelBtn)
        ftable.setWidget(7, 0, hpanel)
        ftableFormatter.setColSpan(7, 0, 2)

        self.add(ftable)
        return
Beispiel #32
0
 def __init__(self):
     HorizontalPanel.__init__(self, Spacing=4)
     self.add(Label('Directly add in bulk:', StyleName='section'))
     self.names = TextArea(VisibleLines=5)
     self.add(self.names)
     self.update = Button('Add', self)
     self.add(self.update)
     self.err = HTML()
     self.add(self.err)
Beispiel #33
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)
Beispiel #34
0
 def __init__(self, query, nUsers, tabName, topPanel):
     HorizontalPanel.__init__(self)
     self.button = Button('Compose tweet', self,
                          StyleName='compose-tweet-button')
     self.add(self.button)        
     self.link = HTML()
     self.add(self.link)
     self.popup = TweetPopup(self.__class__.__name__,
                             query, nUsers, tabName, self, topPanel)
     self.popup.setText('Compose a tweet')
Beispiel #35
0
 def __init__(self, token_index, target_word, options):
     HorizontalPanel.__init__(self)
     self.token_index = token_index
     self.table = FlexTable()
     self.label = Label(target_word + ":\t")
     self.dropdown = ListBox()
     for option in options:
         self.dropdown.addItem(option)
     self.add(self.label)
     self.add(self.dropdown)
	def __init__( self ) :
		self.mainPanel = VerticalPanel()
		self.echo = HTML('Initiating')
		self.launchButton=Button("Update")
		controlPanel=HorizontalPanel()
		controlPanel.add(self.launchButton)
		controlPanel.add(self.echo)
		self.mainPanel.add(controlPanel)
		self.resultGrids={}
		self.resultLabels={}
Beispiel #37
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)
Beispiel #38
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)
Beispiel #39
0
    def __init__(self):
        DockPanel.__init__(self)
        self.setSize('100%', '100%')

        # widgets

        topPanel = HorizontalPanel()
        self.add(topPanel, DockPanel.NORTH)

        places = {
            "chicago, il": "Chicago",

            "st louis, mo": "St Louis",
            "joplin, mo": "Joplin, MO",
            "oklahoma city, ok": "Oklahoma City",
            "amarillo, tx": "Amarillo",
            "gallup, nm": "Gallup, NM",
            "flagstaff, az": "Flagstaff, AZ",

            "winona, az": "Winona",
            "kingman, az": "Kingman",
            "barstow, ca": "Barstow",
            "san bernardino, ca": "San Bernardino",
            "los angeles, ca": "Los Angeles"}

        self.start = ListBox()
        self.end = ListBox()

        for value in places:
            self.start.addItem(places[value], value)
            self.end.addItem(places[value], value)

        self.start.addChangeListener(self.calcRoute)
        self.end.addChangeListener(self.calcRoute)

        topPanel.add(self.start)
        topPanel.add(self.end)

        # now, the map

        mapPanel = SimplePanel()
        mapPanel.setSize('800', '500')
        self.add(mapPanel, DockPanel.CENTER)

        chigado = LatLng(41.850033, -87.6500523)
        options = MapOptions(zoom=7, center=chigado,
                           mapTypeId=MapTypeId.ROADMAP)

        self.map = Map(mapPanel.getElement(), options)

        # initialize the renderer
        self.directionsDisplay = DirectionsRenderer()
        self.directionsDisplay.setMap(self.map)

        self.directionsService = DirectionsService()
Beispiel #40
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)
Beispiel #41
0
    def __init__(self, text, imageUrl):

        DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL)
        p = HorizontalPanel()
        p.setSpacing(3)
        self.img = Image(imageUrl)
        self.txt = HTML(text)
        p.add(self.img)
        p.add(self.txt)

        self.add(p)
Beispiel #42
0
 def __init__(self, chart, **kwargs):
     self.chart = chart
     HorizontalPanel.__init__(self, **kwargs)
     self.bzoomIn = Button("<big>+</big>", self)
     self.bzoomOut = Button("<big>-</big>", self)
     self.bzoomIn.setTitle(
     "Zoom in (expands selected region so it fills plot area)")
     self.bzoomOut.setTitle(
     "Zoom out (shrinks plot area so it fits in selected region)")
     self.add(self.bzoomIn)
     self.add(self.bzoomOut)
Beispiel #43
0
    def __init__(self):
        HorizontalPanel.__init__(self)
        #self.setSpacing('10px')

        pool = StudentContainer(1, 20, 'pool_1')
        for item in [['Fred', 12], ['Jane', 10], ['Sam', 18], ['Ginger', 8],
                     ['Mary', 4]]:
            pool.addStudent(name=item[0], age=item[1])
        self.append(pool)
        self.append(StudentContainer(6, 13, 'pool_2'))
        self.append(StudentContainer(11, 20, 'pool_3'))
        self.setSpacing('10px')
Beispiel #44
0
 def __init__(self, chart):
     self.chart = chart
     HorizontalPanel.__init__(self)
     # y-changing, x,y coordinate displaying, widget
     self.incrementY = Button("Increment Y")
     self.coordinates = HTML("")
     # x,y of selected point
     self.decrementY = Button("Decrement Y")
     self.incrementY.addClickListener(self)
     self.decrementY.addClickListener(self)
     self.add(self.incrementY)
     self.add(self.coordinates)
     self.add(self.decrementY)
Beispiel #45
0
    def onModuleLoad(self):
        self.crumbs = HorizontalPanel(StyleName='breadcrumbs')
        self.crumbs.add(HTML('Home'))
        RootPanel().add(self.crumbs)

        self.buoy = BuoyService('Navigator', crumb='Home')
        self.buoy.add_flare_listener(self)
        self.buoy.set_titles_listener(self)
        self.buoy.set_breadcrumbs_listener(self)
        self.toplevel = TopNav()
        self.toplevel.set(self.buoy)
        self.buoy.cast_off()
        RootPanel().add(self.toplevel)
Beispiel #46
0
    def onModuleLoad(self):

        self.remote = InfoServicePython()

        self.tree_width = 200

        self.tp = HorizontalPanel()
        self.tp.setWidth("%dpx" % (self.tree_width))
        self.treeview = Trees()
        self.treeview.fTree.addTreeListener(self)
        self.sp = ScrollPanel()
        self.tp.add(self.treeview)
        self.sp.add(self.tp)
        self.sp.setHeight("100%")

        self.horzpanel1 = HorizontalPanel()
        self.horzpanel1.setSize("100%", "100%")
        self.horzpanel1.setBorderWidth(1)
        self.horzpanel1.setSpacing("10px")

        self.rp = RightPanel()
        self.rps = ScrollPanel()
        self.rps.add(self.rp)
        self.rps.setWidth("100%")
        self.rp.setWidth("100%")

        self.cp1 = CollapserPanel(self)
        self.cp1.setWidget(self.sp)
        self.cp1.setHTML("&nbsp;")


        self.midpanel = MidPanel(self)
        self.cp2 = CollapserPanel(self)
        self.cp2.setWidget(self.midpanel)
        self.cp2.setHTML("&nbsp;")

        self.horzpanel1.add(self.cp1)
        self.horzpanel1.add(self.cp2)
        self.horzpanel1.add(self.rps)

        self.cp1.setInitialWidth("%dpx" % self.tree_width)
        self.cp2.setInitialWidth("200px")

        RootPanel().add(self.horzpanel1)

        width = Window.getClientWidth()
        height = Window.getClientHeight()

        self.onWindowResized(width, height)
        Window.addWindowResizeListener(self)
Beispiel #47
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)
Beispiel #48
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()
Beispiel #49
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)
Beispiel #50
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)
Beispiel #51
0
    def __init__(self):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.hpanel = HorizontalPanel(Width='755px')
        self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_TOP)
        
        self.name = TextBox()
        self.name.setStyleName('form-control')

        self.start = Report_Date_Field(cal_ID='start')
        
        self.start.getTextBox().setStyleName('form-control')
        self.start.setRegex(DATE_MATCHER)
        self.start.appendValidListener(self._display_ok)
        self.start.appendInvalidListener(self._display_error)
        self.start.validate(None)

        self.end = Report_Date_Field(cal_ID='end')
        self.end.getTextBox().setStyleName('form-control')
        self.end.setRegex(DATE_MATCHER)
        self.end.appendValidListener(self._display_ok)
        self.end.appendInvalidListener(self._display_error)
        self.end.validate(None)

        self.status = ListBox()
        self.status.addItem('Active')
        self.status.addItem('Inactive')
        self.status.setVisibleItemCount(0)
        self.status.setStyleName('form-control input-lg')
        self.status.setSize('100px', '34px')
        
        spacer1 = Label(Width='10px')
        spacer2 = Label(Width='10px')
        spacer3 = Label(Width='10px')

        self.add_btn = Button('Add')
        self.add_btn.setStyleName('btn btn-primary')
        self.del_btn = Button('Delete')
        self.del_btn.setStyleName('btn btn-danger')

        self.hpanel.add(self.name)
        self.hpanel.add(spacer1)
        self.hpanel.add(self.status)
        self.hpanel.add(spacer2)
        self.hpanel.add(self.start)
        #self.hpanel.add(spacer3)
        self.hpanel.add(self.end)
        self.hpanel.add(self.add_btn)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.del_btn)
Beispiel #52
0
class GWTCanvasDemo:

    # can be overriden to use another canvas class
    def _get_canvas(self):
        return GWTCanvas(400, 400)

    def onModuleLoad(self):

        self.layout = HorizontalPanel()

        # Each demo will set their own dimensions, so it doesn't matter
        # what we initialize the canvas to. Use the overrideable.
        canvas = self._get_canvas()
        canvas.addStyleName("gwt-canvas")

        self.demos = []
        # Create demos
        self.demos.append(StaticDemo(canvas))
        self.demos.append(LogoDemo(canvas))
        self.demos.append(ParticleDemo(canvas))
        self.demos.append(GradientDemo(canvas))
        self.demos.append(SuiteDemo(canvas))

        # Add them to the selection list box
        lb = ListBox()
        lb.setStyleName("listBox")

        for i in range(len(self.demos)):
            lb.addItem(self.demos[i].getName())

        lb.addChangeListener(self)

        # start off with the first demo
        self.currentDemo = self.demos[0]

        # Add widgets to self.layout and RootPanel
        vp = VerticalPanel()
        vp.add(lb)
        vp.add(canvas)
        self.layout.add(vp)
        if self.currentDemo.getControls() is not None:
            self.layout.add(self.currentDemo.getControls())

        RootPanel().add(self.layout)
        self.currentDemo.drawDemo()

    def onChange(self, listBox):
        choice = listBox.getSelectedIndex()
        self.swapDemo(self.demos[choice])

    """
    * Changes the current demo for the input demo
    """

    def swapDemo(self, newDemo):
        self.currentDemo.stopDemo()
        self.layout.remove(self.currentDemo.getControls())
        self.currentDemo = newDemo
        self.layout.add(self.currentDemo.getControls())
        self.currentDemo.drawDemo()
Beispiel #53
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())
Beispiel #54
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
Beispiel #55
0
    def __init__(self, **kwargs):
        GMWevents.events.addPatientSelectedListener(self)
        HorizontalPanel.__init__(self, **kwargs)

        self.patientphoto = Image("images/empty-face-in-bust.png")
        self.searchbox = TextBox(Text="<search patient here>")
        self.search_button = Button("Search", self)
        self.lblcave = Label()
        self.lblcave.setText("cave")
        self.allergybox = TextBox(Text="allergies")
        self.add(self.patientphoto)
        self.add(self.searchbox)
        self.add(self.search_button)
        self.add(self.lblcave)
        self.add(self.allergybox)
Beispiel #56
0
    def __init__(self):
        SimplePanel.__init__(self)

        History.addHistoryListener(self)

        vPanel = VerticalPanel()

        self.stateDisplay = Label()
        vPanel.add(self.stateDisplay)

        hPanel = HorizontalPanel(Spacing=5)
        hPanel.add(Hyperlink("State 1", False, "state number 1"))
        hPanel.add(Hyperlink("State 2", False, "state number 2"))

        vPanel.add(hPanel)
        self.add(vPanel)
Beispiel #57
0
    def _gridShortcutsLinks(self):
        bh1 = Hyperlink(_("Current"))
        bh1.addClickListener(getattr(self, 'onToday'))

        b2 = Button(_("Choose"), self.onMonthSelected)

        bh3 = Hyperlink(self.cancel)
        bh3.addClickListener(getattr(self, 'onCancel'))

        b = HorizontalPanel()
        b.addStyleName("calendar-shortcuts")
        b.add(bh1)
        b.add(b2)
        b.add(bh3)

        self.vp.add(b)
Beispiel #58
0
    def __init__(self, latsize):
        self._latsize = latsize
        self.panel = HorizontalPanel(Spacing=8)

        self.panel.add(
            HTML(r"<strong>Generating vector</strong> (\(\boldsymbol a\)): ",
                 StyleName="CaptionLabel"))
        self._array = TextBoxArray('1', show_indices=False)
        self.panel.add(self._array.panel)

        link = Hyperlink("Korobov...", StyleName="action")
        link.addClickListener(getattr(self, 'show_korobov_dialog'))
        self.panel.add(link)

        self._korobov_dialog, self._korobov_param = self._create_korobov_dialog(
        )
Beispiel #59
0
    def __init__(self):

        # create the label and slider
        self.__label = Label('OFF')
        self.slider = slider = HorizontalSlider(0,
                                                5,
                                                step=1,
                                                StyleName="slider")
        slider.setDragable(True)
        slider.addControlValueListener(self)

        # put them in a hpanel
        self.hpanel = hpanel = HorizontalPanel(Spacing=10)
        hpanel.add(slider)
        hpanel.add(self.__label)

        # create the color panel and give it color
        self.colorpanel = CaptionPanel('Color:',
                                       SimplePanel(StyleName='colorpanel'))
        self.randomcolor()

        # we're initially off
        self.value = 0
        # create our timer
        self.timer = Timer(notify=self)