예제 #1
0
파일: checkBox.py 프로젝트: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        self.box = CheckBox("Print Results?")
        self.box.addClickListener(getattr(self, "onClick"))

        self.add(self.box)
예제 #2
0
    def __init__(self):
        SimplePanel.__init__(self)

        contents = HTML("""<h3>The Zen of Python, by Tim Peters</h3>
<p>Beautiful is better than ugly.<br />
Explicit is better than implicit.<br />
Simple is better than complex.<br />
Complex is better than complicated.<br />
Flat is better than nested.<br />
Sparse is better than dense.<br />
Readability counts.<br />
Special cases aren't special enough to break the rules.<br />
Although practicality beats purity.<br />
Errors should never pass silently.<br />
Unless explicitly silenced.<br />
In the face of ambiguity, refuse the temptation to guess.<br />
There should be one-- and preferably only one --obvious way to do it.<br />
Although that way may not be obvious at first unless you're Dutch.<br />
Now is better than never.<br />
Although never is often better than *right* now.<br />
If the implementation is hard to explain, it's a bad idea.<br />
If the implementation is easy to explain, it may be a good idea.<br />
Namespaces are one honking great idea -- let's do more of those!</p>
""")

        panel = CaptionPanel("Caption-Panel", contents,
                             Width="300px")

        self.add(panel)
예제 #3
0
파일: flexTable.py 프로젝트: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        self._table = FlexTable(BorderWidth=1, Width="100%")

        cellFormatter = self._table.getFlexCellFormatter()
        rowFormatter = self._table.getRowFormatter()

        self._table.setHTML(0, 0, "<b>Mammals</b>")
        self._table.setText(1, 0, "Cow")
        self._table.setText(1, 1, "Rat")
        self._table.setText(1, 2, "Dog")

        cellFormatter.setColSpan(0, 0, 3)
        cellFormatter.setHorizontalAlignment(0, 0, HasAlignment.ALIGN_CENTER)

        self._table.setWidget(2, 0, Button("Hide", getattr(self, "hideRows")))
        self._table.setText(2, 1, "1,1")
        self._table.setText(2, 2, "2,1")
        self._table.setText(3, 0, "1,2")
        self._table.setText(3, 1, "2,2")

        cellFormatter.setRowSpan(2, 0, 2)
        cellFormatter.setVerticalAlignment(2, 0, HasAlignment.ALIGN_MIDDLE)

        self._table.setWidget(4, 0, Button("Show", getattr(self, "showRows")))

        cellFormatter.setColSpan(4, 0, 3)

        rowFormatter.setVisible(4, False)

        self.add(self._table)
예제 #4
0
파일: frame.py 프로젝트: ygyangguang/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        frame = Frame("http://pyjs.org",
                      Width="100%",
                      Height="200px")
        self.add(frame)
    def __init__(self,
                 autoHide=False,
                 modal=True,
                 rootpanel=None,
                 glass=False,
                 **kwargs):

        self.popupListeners = []
        self.showing = False
        self.autoHide = autoHide
        kwargs['Modal'] = kwargs.get('Modal', modal)

        if rootpanel is None:
            rootpanel = RootPanel()
        self.rootpanel = rootpanel

        self.glass = glass
        if self.glass:
            self.glass = DOM.createDiv()
            if not 'GlassStyleName' in kwargs:
                kwargs['GlassStyleName'] = "gwt-PopupPanelGlass"

        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')
        else:
            element = self.createElement()
        DOM.setStyleAttribute(element, "position", "absolute")

        SimplePanel.__init__(self, element, **kwargs)

        if glass:
            self.setGlassEnabled(True)
            if 'GlassStyleName' in kwargs:
                self.setGlassStyleName(kwargs.pop('GlassStyleName'))
예제 #6
0
    def __init__(self):
        SimplePanel.__init__(self)

        field = TextArea()
        field.setCharacterWidth(20)
        field.setVisibleLines(4)
        self.add(field)
예제 #7
0
 def __init__(self, **kwargs):
     SimplePanel.__init__(self, **kwargs)
     self.pp = None
     self.messages = []
     self.active_patient_id = None
     self.TEXT_WAITING = "Waiting for response..."
     HTTPUILoader(self).load("gnumedweb.xml")  # calls onUILoaded when done
예제 #8
0
파일: Calendar.py 프로젝트: jwashin/pyjs
 def __init__(self, c):
     PopupPanel.__init__(self, True)
     p = SimplePanel()
     p.add(c)
     c.show(10, 10)
     p.setWidth("100%")
     self.setWidget(p)
예제 #9
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)
예제 #10
0
    def drawFull(self, month, year):
        # should be called only once when we draw the calendar for
        # the first time
        self.vp = VerticalPanel()
        self.vp.setSpacing(2)
        self.vp.addStyleName("calendarbox calendar-module calendar")
        self.setWidget(self.vp)
        self.setVisible(False)
        #
        mth = int(month)
        yr = int(year)

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

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

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

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

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

        self.vp.add(tvp)

        # done with top panel

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

        self._gridShortcutsLinks()
        self._gridCancelLink()
        #
        # add code to test another way of doing the layout
        #
        self.setVisible(True)
        return
예제 #11
0
    def __init__(self):
        SimplePanel.__init__(self)

        field = TextArea()
        field.setCharacterWidth(20)
        field.setVisibleLines(4)
        self.add(field)
예제 #12
0
파일: Calendar.py 프로젝트: jwashin/pyjs
    def drawFull(self, month, year):
        # should be called only once when we draw the calendar for
        # the first time
        self.vp = VerticalPanel()
        self.vp.setSpacing(2)
        self.vp.addStyleName("calendarbox calendar-module calendar")
        self.setWidget(self.vp)
        self.setVisible(False)
        #
        mth = int(month)
        yr = int(year)

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

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

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

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

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

        self.vp.add(tvp)

        # done with top panel

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

        self._gridShortcutsLinks()
        self._gridCancelLink()
        #
        # add code to test another way of doing the layout
        #
        self.setVisible(True)
        return
예제 #13
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)
예제 #14
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = VerticalPanel()
        panel.setBorderWidth(1)

        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)

        part1 = Label("Part 1")
        part2 = Label("Part 2")
        part3 = Label("Part 3")
        part4 = Label("Part 4")

        panel.add(part1)
        panel.add(part2)
        panel.add(part3)
        panel.add(part4)

        panel.setCellHeight(part1, "10%")
        panel.setCellHeight(part2, "70%")
        panel.setCellHeight(part3, "10%")
        panel.setCellHeight(part4, "10%")

        panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT)

        panel.setWidth("50%")
        panel.setHeight("300px")

        self.add(panel)
예제 #15
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)
예제 #16
0
파일: oldExample.py 프로젝트: Afey/pyjs
    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=[]
예제 #17
0
 def __init__(self, **kwargs):
     SimplePanel.__init__(self, **kwargs)
     self.pp = None
     self.active_patient_messages = []
     self.active_patient_id = None
     self.TEXT_WAITING = "Waiting for response..."
     HTTPUILoader(self).load("gnumedweb.xml")  # calls onUILoaded when done
예제 #18
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)
예제 #19
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)
예제 #20
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = VerticalPanel(BorderWidth=1,
                              HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                              VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                              Width="50%",
                              Height="300px")

        part1 = Label("Part 1")
        part2 = Label("Part 2")
        part3 = Label("Part 3")
        part4 = Label("Part 4")

        panel.add(part1)
        panel.add(part2)
        panel.add(part3)
        panel.add(part4)

        panel.setCellHeight(part1, "10%")
        panel.setCellHeight(part2, "70%")
        panel.setCellHeight(part3, "10%")
        panel.setCellHeight(part4, "10%")

        panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT)

        self.add(panel)
 def newPositioner(self, context):
     
     # Use two widgets so that setPixelSize() consistently affects dimensions
     outer = SimplePanel() 
     outer.addStyleName(CSS_DRAGDROP_POSITIONER)
     
     # place off screen for border calculation
     RootPanel.get().add(outer, -500, -500) 
     
     # Ensure IE quirks mode returns valid outer.offsetHeight, and thus valid
     outer.setWidget(self.DUMMY_LABEL_IE_QUIRKS_MODE_OFFSET_HEIGHT)
     width = 0
     height = 0
     if isinstance(self.dropTarget,HorizontalPanel):
         for widget in context.selectedWidgets:
             width += widget.getOffsetWidth()
             height = Math.max(height, widget.getOffsetHeight())
     else:
         for widget in context.selectedWidgets:
             width = Math.max(width, widget.getOffsetWidth())
             height += widget.getOffsetHeight()
     inner = SimplePanel()
     inner.setPixelSize(
         width - DOMUtil.getHorizontalBorders(outer), height - DOMUtil.getVerticalBorders(outer))
     outer.setWidget(inner)
     return outer
예제 #22
0
파일: PopupPanel.py 프로젝트: Afey/pyjs
    def __init__(self, autoHide=False, modal=True, rootpanel=None, glass=False,
                **kwargs):

        self.popupListeners = []
        self.showing = False
        self.autoHide = autoHide
        kwargs['Modal'] = kwargs.get('Modal', modal)

        if rootpanel is None:
            rootpanel = RootPanel()
        self.rootpanel = rootpanel

        self.glass = glass
        if self.glass:
            self.glass = DOM.createDiv()
            if not 'GlassStyleName' in kwargs:
                kwargs['GlassStyleName'] = "gwt-PopupPanelGlass"

        if kwargs.has_key('Element'):
            element = kwargs.pop('Element')
        else:
            element = self.createElement()
        DOM.setStyleAttribute(element, "position", "absolute")

        SimplePanel.__init__(self, element, **kwargs)

        if glass:
            self.setGlassEnabled(True)
            if 'GlassStyleName' in kwargs:
                self.setGlassStyleName(kwargs.pop('GlassStyleName'))
예제 #23
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()
예제 #24
0
파일: Upload.py 프로젝트: brodybits/pyjs
    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)
예제 #25
0
    def __init__(self):
        SimplePanel.__init__(self)

        frame = Frame("http://google.com",
                      Width="100%",
                      Height="200px")
        self.add(frame)
예제 #26
0
파일: form.py 프로젝트: mcsquaredjr/Reports
 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())
예제 #27
0
파일: fileUpload.py 프로젝트: Afey/pyjs
    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)
예제 #28
0
    def __init__(self):
        SimplePanel.__init__(self)

        self._table = FlexTable(BorderWidth=1, Width="100%")

        cellFormatter = self._table.getFlexCellFormatter()
        rowFormatter = self._table.getRowFormatter()

        self._table.setHTML(0, 0, "<b>Mammals</b>")
        self._table.setText(1, 0, "Cow")
        self._table.setText(1, 1, "Rat")
        self._table.setText(1, 2, "Dog")

        cellFormatter.setColSpan(0, 0, 3)
        cellFormatter.setHorizontalAlignment(0, 0, HasAlignment.ALIGN_CENTER)

        self._table.setWidget(2, 0, Button("Hide", getattr(self, "hideRows")))
        self._table.setText(2, 1, "1,1")
        self._table.setText(2, 2, "2,1")
        self._table.setText(3, 0, "1,2")
        self._table.setText(3, 1, "2,2")

        cellFormatter.setRowSpan(2, 0, 2)
        cellFormatter.setVerticalAlignment(2, 0, HasAlignment.ALIGN_MIDDLE)

        self._table.setWidget(4, 0, Button("Show", getattr(self, "showRows")))

        cellFormatter.setColSpan(4, 0, 3)

        rowFormatter.setVisible(4, False)

        self.add(self._table)
예제 #29
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = VerticalPanel()
        panel.setBorderWidth(1)

        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)

        part1 = Label("Part 1")
        part2 = Label("Part 2")
        part3 = Label("Part 3")
        part4 = Label("Part 4")

        panel.add(part1)
        panel.add(part2)
        panel.add(part3)
        panel.add(part4)

        panel.setCellHeight(part1, "10%")
        panel.setCellHeight(part2, "70%")
        panel.setCellHeight(part3, "10%")
        panel.setCellHeight(part4, "10%")

        panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT)

        panel.setWidth("50%")
        panel.setHeight("300px")

        self.add(panel)
예제 #30
0
    def __init__(self):
        SimplePanel.__init__(self)
        self.setSize('100%', '100%')

        options = MapOptions(
            zoom=4, center=LatLng(-25.363882, 131.044922),
            mapTypeId=MapTypeId.ROADMAP,

            mapTypeControl=True,
            mapTypeControlOptions=MapTypeControlOptions(
                style=MapTypeControlStyle.DROPDOWN_MENU),

            navigationControl=True,
            navigationControlOptions=NavigationControlOptions(
                style=NavigationControlStyle.SMALL))
        # the same, in a extensive way:

        #options = MapOptions()

        #options.zoom = 4
        #options.center = LatLng(-25.363882, 131.044922)
        #options.mapTypeId = MapTypeId.ROADMAP

        #options.mapTypeControl = True
        #options.mapTypeControlOptions = MapTypeControlOptions()
        #options.mapTypeControlOptions.style =
        #   MapTypeControlStyle.DROPDOWN_MENU

        #options.navigationControl = True
        #options.navigationControlOptions = NavigationControlOptions()
        #options.navigationControlOptions.style = \
        #    NavigationControlStyle.SMALL

        self.map = Map(self.getElement(), options)
예제 #31
0
파일: form.py 프로젝트: mcsquaredjr/Reports
    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)
예제 #32
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = HorizontalPanel(BorderWidth=1,
                                HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                                VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                                Width="100%",
                                Height="200px")

        part1 = Label("Part 1")
        part2 = Label("Part 2")
        part3 = Label("Part 3")
        part4 = Label("Part 4")

        panel.add(part1)
        panel.add(part2)
        panel.add(part3)
        panel.add(part4)

        panel.setCellWidth(part1, "10%")
        panel.setCellWidth(part2, "70%")
        panel.setCellWidth(part3, "10%")
        panel.setCellWidth(part4, "10%")

        panel.setCellVerticalAlignment(part3, HasAlignment.ALIGN_BOTTOM)

        self.add(panel)
예제 #33
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.box = CheckBox("Print Results?")
        self.box.addClickListener(getattr(self, "onClick"))

        self.add(self.box)
예제 #34
0
    def __init__(self):
        SimplePanel.__init__(self)

        field = TextBox()
        field.setVisibleLength(20)
        field.setMaxLength(10)

        self.add(field)
예제 #35
0
파일: textBox.py 프로젝트: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        field = TextBox()
        field.setVisibleLength(20)
        field.setMaxLength(10)

        self.add(field)
예제 #36
0
파일: Calendar.py 프로젝트: jwashin/pyjs
    def _gridCancelLink(self):
        bh4 = Hyperlink(self.cancel)
        bh4.addClickListener(getattr(self, 'onCancel'))

        b2 = SimplePanel()
        b2.add(bh4)
        b2.addStyleName("calendar-cancel")
        self.vp.add(b2)
예제 #37
0
    def __init__(self, panel):
        ScrollPanel.__init__(self)
        self.setHeight("100%")
        self.setStyleName("SuperScrollPanelOuter")

        self.inner = SimplePanel(Height="100%")
        self.add(self.inner)
        self.inner.setStyleName("SuperScrollPanelInner")
        self.inner.add(panel)
예제 #38
0
def provider(content, cache=None):
    cont = SimplePanel(StyleName="aur-content-boundary")
    home = VerticalPanel.VerticalPanel(
        Width="100%", Height="100%", HorizontalAlignment="center", VerticalAlignment="middle"
    )
    content.setWidget(cont)
    cont.setWidget(home)
    doBuildContent(home)
    return cont
예제 #39
0
파일: absolutePanel.py 프로젝트: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        panel = AbsolutePanel(Width="100%", Height="100px")

        panel.add(self.makeBox("Child 1"), 20, 10)
        panel.add(self.makeBox("Child 2"), 30, 30)

        self.add(panel)
예제 #40
0
    def __init__(self, **kwargs):
        """ pass in Widget={the widget} so that Applier will call setWidget.  
        """

        SimplePanel.__init__(self, Focus.createFocusable(), **kwargs)
        FocusHandler.__init__(self)
        KeyboardHandler.__init__(self)
        ClickHandler.__init__(self)
        MouseHandler.__init__(self)
예제 #41
0
 def __init__(self, disclosurePanel, **kwargs):
     element = kwargs.pop('Element', DOM.createAnchor())
     SimplePanel.__init__(self, element)
     self.disclosurePanel = disclosurePanel
     element = self.getElement()
     DOM.setAttribute(element, "href", "javascript:void(0);")
     DOM.setStyleAttribute(element, "display", "block")
     self.sinkEvents(Event.ONCLICK)
     self.setStyleName("header")
예제 #42
0
파일: image.py 프로젝트: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        # We display the "myImage.jpg" file, stored in the "public/images"
        # directory, where "public" is in the application's source directory.

        img = Image("images/myImage.jpg")
        img.addClickListener(getattr(self, "onImageClicked"))
        self.add(img)
예제 #43
0
 def __init__(self, disclosurePanel, **kwargs):
     element = kwargs.pop('Element', DOM.createAnchor())
     SimplePanel.__init__(self, element)
     self.disclosurePanel = disclosurePanel
     element = self.getElement()
     DOM.setAttribute(element, "href", "javascript:void(0);");
     DOM.setStyleAttribute(element, "display", "block")
     self.sinkEvents(Event.ONCLICK)
     self.setStyleName("header")
예제 #44
0
    def __init__(self, **kwargs):
        """ pass in Widget={the widget} so that Applier will call setWidget.  
        """

        SimplePanel.__init__(self, Focus.createFocusable(), **kwargs)
        FocusHandler.__init__(self)
        KeyboardHandler.__init__(self)
        ClickHandler.__init__(self)
        MouseHandler.__init__(self)
예제 #45
0
    def __init__(self):
        SimplePanel.__init__(self)

        # We display the "myImage.jpg" file, stored in the "public/images"
        # directory, where "public" is in the application's source directory.

        img = Image("images/myImage.jpg")
        img.addClickListener(getattr(self, "onImageClicked"))
        self.add(img)
예제 #46
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = AbsolutePanel(Width="100%", Height="100px")

        panel.add(self.makeBox("Child 1"), 20, 10)
        panel.add(self.makeBox("Child 2"), 30, 30)

        self.add(panel)
예제 #47
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()
예제 #48
0
    def __init__(self, child=None, **kwargs):
        self.scrollListeners = []

        if child is not None:
            kwargs['Widget'] = child
        if not kwargs.has_key('AlwaysShowScrollBars'):
            kwargs['AlwaysShowScrollBars'] = False

        SimplePanel.__init__(self, **kwargs)
        self.sinkEvents(Event.ONSCROLL)
예제 #49
0
 def __init__(self, splitPanel, **kwargs):
     # keep a ref to our parent panel for event callback
     self._splitpanel = splitPanel
     SimplePanel.__init__(self, **kwargs)
     MouseHandler.__init__(self)
     self.addMouseListener(self)
     # set some constant styles
     elem = self.getElement()
     # the following allows splitter to be small enough in IE
     DOM.setStyleAttribute(elem, "overflow", "hidden")
 def __init__(self, splitPanel, **kwargs):
     # keep a ref to our parent panel for event callback
     self._splitpanel = splitPanel
     SimplePanel.__init__(self, **kwargs)
     MouseHandler.__init__(self)
     self.addMouseListener(self)
     # set some constant styles
     elem = self.getElement()
     # the following allows splitter to be small enough in IE
     DOM.setStyleAttribute(elem, "overflow", "hidden")
예제 #51
0
def provider(content, cache=None):
    if cache is not None:
        content.setWidget(cache)
        return cache
    cont = SimplePanel(StyleName='aur-content-boundary')
    home = VerticalPanel.VerticalPanel(Width='100%', Height='100%', HorizontalAlignment='center', VerticalAlignment='middle')
    content.setWidget(cont)
    cont.setWidget(home)
    doBuildContent(home)
    return cont
예제 #52
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()
예제 #53
0
    def __init__(self):
        SimplePanel.__init__(self)

        vPanel = VerticalPanel(Spacing=4)

        self._btn = Button("Click Me", getattr(self, "showPopup"))

        vPanel.add(HTML("Click on the button below to display the popup."))
        vPanel.add(self._btn)

        self.add(vPanel)
예제 #54
0
    def __init__(self):
        SimplePanel.__init__(self)

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

        tabs.selectTab(0)

        self.add(tabs)