예제 #1
0
    def __init__(self):
        Sink.__init__(self)
        colour_grid = ColourGridCanvas()
        rotated = RotatedCanvas()
        spheres = SpheresCanvas()
        pattern = PatternCanvas()
        spiro = SpiroCanvas()
        self.solar = SolarCanvas()

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

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

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

        self.setWidget(panel)
예제 #2
0
    def __init__(self):

        Composite.__init__(self)

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

        outer = HorizontalPanel()
        inner = VerticalPanel()

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

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

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

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

        self.initWidget(outer)
        inner.setStyleName("mail-TopPanel")
        links.setStyleName("mail-TopPanelLinks")
예제 #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)
예제 #4
0
 def __init__(self, **kwargs):
     DialogWindow.__init__(self, modal=True, close=True)
     v = VerticalPanel()
     v.setWidth(300)
     # v.setHeight(500)
     self.setText("definition")
     self.setPopupPosition(100, 100)
     self.setStyleAttribute("background-color", "#ffffff")
     self.setStyleAttribute("color", "#9847a2")
     self.setStyleAttribute("border-width", "5px")
     self.setStyleAttribute("border-style", "solid")
     h = HorizontalPanel()
     self.textbox_name = TextBox()
     h.add(Label("name"))
     h.add(self.textbox_name)
     v.add(h)
     h = HorizontalPanel()
     self.textbox_scheme = TextBox()
     h.add(Label("print scheme"))
     h.add(self.textbox_scheme)
     v.add(h)
     self.add(v)
     self.theorems = list()
     self.radios = list()
     for t in Theorem.theorems:
         if t.formula.is_in_unique_form():
             self.theorems.append(t)
             self.radios.append(RadioButton("group1", ""))
             h = HorizontalPanel()
             h.add(self.radios[-1])
             im = Image()
             im.setUrl(latex_to_url(t.formula.to_latex()))
             h.add(im)
             v.add(h)
     v.add(Button("Done", self.done_click))
예제 #5
0
    def __init__(self):
        """ Constructs a new EditPanel.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        #        self.remote_py = RegionNamesServicePython()

        self.panel = VerticalPanel()

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

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

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

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

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

        upload_item = TreeItem("Upload")
        self.tree.add(upload_item)
        map_item = TreeItem("Map")
        self.tree.add(map_item)
예제 #6
0
파일: TestPanel.py 프로젝트: weeksjm/gnumed
    def __init__(self, **kwargs):
        VerticalPanel.__init__(self, **kwargs)

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

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

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

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

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

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

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

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

        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(HTML("Primary key of the patient in the database:"))
        panel.add(self.dockey)
        panel.add(method_panel)
        panel.add(buttons)
        panel.add(self.status)
        self.add(panel)
예제 #7
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)
예제 #8
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)
예제 #9
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
예제 #10
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)
예제 #11
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)
예제 #12
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)
예제 #13
0
    def onModuleLoad(self):
        try:
            setCookie(COOKIE_NAME, "setme", 100000)
        except:
            pass

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

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

        RootPanel().add(panel)
예제 #14
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)
예제 #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
    def draw(self):
        Popup.draw(self)

        namePanel = HorizontalPanel()
        namePanel.add(Label(_('Name') + ':'))
        self.textBox = TextBox()
        self.textBox.setMaxLength(15)
        self.textBox.setStyleAttribute('marginLeft', 10)
        namePanel.add(self.textBox)
        self.center.add(namePanel)

        self.choose = ChooseTypeVarPanel()
        self.center.add(self.choose)

        self.textBox.addInputListener(self)

        self.message = Element(Element=DOM.createDiv())
        self.message.add(Widget(Element=DOM.createDiv(),
                                StyleName='not_image'))
        self.message.add(
            Label(text=_('Name already used'),
                  wordWrap=False,
                  StyleName='not_message'))

        self.onInput()
예제 #17
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)
예제 #18
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)
예제 #19
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
예제 #20
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()
예제 #21
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)
예제 #22
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = HorizontalPanel()
        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.setCellWidth(part1, "10%")
        panel.setCellWidth(part2, "70%")
        panel.setCellWidth(part3, "10%")
        panel.setCellWidth(part4, "10%")

        panel.setCellVerticalAlignment(part3, HasAlignment.ALIGN_BOTTOM)

        panel.setWidth("100%")
        panel.setHeight("200px")

        self.add(panel)
예제 #23
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)
예제 #24
0
    def set_variables(self, no_of_vars, x=True):
        def name(n):
            return "var" + str(n)

        def print_scheme(n):
            return ["\\alpha", "\\beta", "\\gamma", "\\delta", "\\epsilon"][n]

        def button_click(n):
            def sopa():
                if not self.is_clicked[n]:
                    v = Operation(name(n), 0, self.textbox[n].getText(),
                                  name(n), Operation.VARIABLE)
                    self.var[n] = v
                    self.textbox[n].setEnabled(False)
                    self.is_clicked[n] = True
                self.add_op(self.var[n])

            return sopa

        for i in range(no_of_vars):
            h = HorizontalPanel()
            b = Button("variable", button_click(i))
            h.add(b)
            self.is_clicked.append(False)
            self.var.append(None)
            t = TextBox()
            self.textbox.append(t)
            t.setText(print_scheme(i))
            h.add(t)
            self.add_button(h)
예제 #25
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()
예제 #26
0
파일: Trees.py 프로젝트: vizafogo123/pokpok
    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)
예제 #27
0
파일: Navigate.py 프로젝트: wkornewald/pyjs
    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'])
예제 #28
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()
예제 #29
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)
예제 #30
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())