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

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

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

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

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        #self.sp = VerticalSplitPanel()
        self.sp.setWidth("98%")
        self.sp.setHeight("%dpx" % (height - 200))

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

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

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

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

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

        Window.addWindowResizeListener(self)

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

        self.onWindowResized(Window.getClientWidth(), Window.getClientHeight())
Exemplo n.º 2
0
    def apply_transform(self):
        rot_string = "rotate(%f)" % self.rot_deg
        scale_string = "scale(%f)" % self.scale
        translate_string = "translate(%f," % self.x_translate
        translate_string += "%f)" % self.y_translate

        transform_string = rot_string
        transform_string = transform_string + " " + scale_string
        transform_string = transform_string + " " + translate_string

        svg_g = self.svg_area.contentDocument.getElementById(
            "svg_transform_element")
        RootPanel().add(HTML("transform_string = %s" % transform_string))
        transform = svg_g.getAttribute("transform")
        svg_g.setAttribute("transform", transform_string)
Exemplo n.º 3
0
    def onModuleLoad(self):

        text = TextBox()
        df1 = DateField()
        df2 = DateField(format='%Y/%m/%d')
        b = Button("Show Calendar", self)
        self.cal = Calendar(MinDate=(2012, 5, 10), MaxDate=(2014, 6, 8))

        vp = VerticalPanel()
        vp.setSpacing(10)
        vp.add(df1)
        vp.add(b)
        vp.add(df2)

        RootPanel().add(vp)
    def hide(self, autoClosed=False):
        self.showing = False

        self.hideGlass()

        DOM.removeEventPreview(self)

        RootPanel().remove(self)
        self.onHideImpl(self.getElement())
        DOM.releaseCapture(self.getElement())
        for listener in self.glassListeners:
            if hasattr(listener, 'onGlassHide'):
                listener.onGlassHide(self, autoClosed)
            else:
                listener(self, autoClosed)
Exemplo n.º 5
0
    def onModuleLoad(self):

        GMWevents.init_events()
        GMWevents.events.addLoginListener(self) # want to receive onLogin

        self.TEXT_ERROR = "Server Error"
        self.loginpanel = cLoginPanel() # fires logged out on UI load
        self.afterloginpanel = cMainPanel()

        self.maindisplay = DockPanel(
                          HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                          VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                          BorderWidth=1,
                          Padding=8,
                          Width="100%") 

        RootPanel().add(self.maindisplay)
Exemplo n.º 6
0
    def onModuleLoad(self):

        text = TextBox()
        df1 = DateField()
        df2 = DateField(format='%Y/%m/%d')
        b = Button("Show Calendar", self)
        self.cal = Calendar()
        df3 = MonthField()

        vp = VerticalPanel()
        vp.setSpacing(10)
        vp.add(df1)
        vp.add(b)
        vp.add(df2)
        vp.add(df3)

        RootPanel().add(vp)
Exemplo n.º 7
0
    def onModuleLoad(self):
        '''Create initial view of the panel.
        '''
        # Container that keeps everything
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)

        # Create list of projects 
        proj_list = ListBox(Height='34px')
       
        proj_list.addItem('')
       
        proj_list.setVisibleItemCount(0)
        proj_list.addChangeListener(getattr(self, 'on_project_changed'))
        proj_list.setStyleName('form-control input-lg')
        
        self.proj_row = Form_Row('Select project',
                            proj_list,
                            help='project, status of which you want to report')
        
        # Project-specific container
        self.project_panel = VerticalPanel()

        # Submit report button
        self.submit_btn = Button('Submit report', getattr(self, 'send_data'))
        self.submit_btn.setStyleName('btn btn-primary btn-lg')
        self.submit_btn.setEnabled(False)

        self.msg_lbl = HTMLPanel('', Width='475px')

        # Add controls here
        self.panel.add(self.proj_row.panel())
        self.panel.add(self.project_panel)
        self.panel.add(Label(Height='20px'))
        self.panel.add(self.msg_lbl)
        btn_holder = HorizontalPanel()
        btn_holder.add(self.submit_btn)
        help_btn = HTMLPanel('')

        help_btn.setHTML(MODAL_PNL)
        btn_holder.add(Label(Width='10px'))
        btn_holder.add(help_btn)
        self.panel.add(btn_holder)
        
        self.root = RootPanel('report')
        self.root.add(self.panel)
Exemplo n.º 8
0
    def onModuleLoad(self):
        '''Create initial view of the panel.
        '''
        # Container that keeps everything
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)

        spacer1 = Label()
        spacer1.setHeight('10px')
        spacer2 = Label()
        spacer2.setHeight('10px')
        
        self.tbl_panel = VerticalPanel(Width='755px')
        # First is a row count
        self.grid = Reports_Grid()
        self.grid.create_grid(1, 4, ['Milestone Name', 'Milestone State', 'Start Date', 'End Date'])
        self.tbl_panel.add(self.grid)

        self.editor = Milestones_Editor()
        self.submit_btn = Button('Submit', getattr(self, 'send_data'))
        self.submit_btn.setStyleName('btn btn-primary btn-lg')

        hpanel = HorizontalPanel()
        hpanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT)
        hpanel.add(self.submit_btn)

        self.msg_lbl = HTMLPanel('', Width='755px')

        self.root = RootPanel('projects_')
        self.root.add(spacer1)
        self.root.add(self.editor.hpanel)
        self.root.add(spacer2)
        self.root.add(self.tbl_panel)

        spacer3 = Label()
        spacer3.setHeight('20px')

        self.root.add(self.msg_lbl)
        self.root.add(spacer3)
        self.root.add(hpanel)
        self.root.add(Label(Height='20px'))
        

        # Add listeners and initialize components
        self._add_listeners()
        self._iniate_states()
Exemplo n.º 9
0
    def onModuleLoad(self):
        self.status = Label()
        self.button = Button(
            "Display list of all published memories and fields", self)
        self.buttonupdate = Button("Update data from AMS publisher", self)

        buttons = HorizontalPanel()
        buttons.add(self.button)
        buttons.add(self.buttonupdate)
        buttons.setSpacing(8)

        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""

        self.panel = VerticalPanel()
        self.panel.add(HTML(info))
        self.panel.add(buttons)
        self.panel.add(self.status)
        RootPanel().add(self.panel)
        self.commobj = AMS_Comm()
        self.tree = None
        if AMSJavascript.sent > AMSJavascript.recv:
            self.status.setText('Press button again: AMSJavascript.sent ' +
                                str(AMSJavascript.sent) +
                                ' AMSJavascript.recv ' +
                                str(AMSJavascript.recv))
            return
        if self.commobj.commname == 'No AMS publisher running':
            self.status.setText(self.commobj.commname)
        else:
            self.status.setText('Memories for AMS Comm: ' +
                                str(AMSJavascript.sent) +
                                str(AMSJavascript.recv) +
                                self.commobj.commname)
            result = self.commobj.get_memory_list()
            if self.tree: self.panel.remove(self.tree)
            self.tree = Tree()
            for i in result:
                subtree = TreeItem(i)
                memory = self.commobj.memory_attach(i)
                fields = memory.get_field_list()
                for j in fields:
                    field = memory.get_field_info(j)
                    subtree.addItem(j + ' = ' + str(field[4]))
                self.tree.addItem(subtree)
                self.panel.add(self.tree)
Exemplo n.º 10
0
    def onModuleLoad(self):
        self.panel = VerticalPanel()
        self.panel.setSpacing(10)
        RootPanel().add(self.panel)

        self.swfUpload = self.getSWFUpload()
        self.panel.add(self.swfUpload)

        self.fileids = []
        self.queue = VerticalPanel()
        self.panel.add(self.queue)

        startButton = Button('Start Upload')
        startButton.addClickListener(getattr(self, 'onStartUpload'))
        self.panel.add(startButton)

        self.progress = Label()
        self.panel.add(self.progress)
Exemplo n.º 11
0
    def onModuleLoad(self):

        p = HorizontalPanel()
        p.setSpacing(10)
        p.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)

        sc = SliderClass(False)
        p.add(sc)
        sc = SliderClass(True)
        p.add(sc)
        sc = SliderClass(True)
        p.add(sc)
        sc = HorizontalSliderClass(False)
        p.add(sc)
        sc = HorizontalSliderClass(True)
        p.add(sc)

        RootPanel().add(p)
Exemplo n.º 12
0
    def __init__(self):
        """ Constructs a new OpenPowerSystem instance.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        self.base_panel = HorizontalPanel()

        self.tab_panel = TabPanel()
        self.tab_panel.add(self.get_upload_panel(), "Upload")
        #        self.tab_panel.add(self.get_home_panel(), "OpenPowerSystem")
        #        self.tab_panel.add(self.get_map_panel(), "Map")
        #        self.tab_panel.add(self.get_edit_panel(), "Edit")
        self.tab_panel.selectTab(0)

        self.base_panel.add(self.tab_panel)

        RootPanel().add(self.base_panel)
Exemplo n.º 13
0
    def __init__(self):
        self.root = RootPanel()
        #Flow panel taking up 70% of the page.  CSS centers it.
        self.flow = FlowPanel(Width="70%", StyleName='flow-panel')
       
       
        for x in range(0, 10):
            self.panel = VerticalPanel()
            #Label each image with its number in the sequence
            title = Label("Item %s" % x, element=DOM.createElement('span'), StyleName="title item")
            #Add a neat-o image.
            image = Image('images/pyjamas.png', Width="200px", Height="200px", StyleName="cat-image cat-item")
            #Add to the Vertical Panel the image title
            self.panel.add(title)
            self.panel.add(image)

            self.flow.add(self.panel)

        self.root.add(self.flow)
Exemplo n.º 14
0
    def onModuleLoad(self):
        self.status=Label()
        self.button = Button("Display list of all published memories and fields", self)
        self.buttonupdate = Button("Update data from AMS publisher", self)

        buttons = HorizontalPanel()
        buttons.add(self.button)
        buttons.add(self.buttonupdate)
        buttons.setSpacing(8)

        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""

        self.panel = VerticalPanel()
        self.panel.add(HTML(info))
        self.panel.add(buttons)
        self.panel.add(self.status)
        RootPanel().add(self.panel)
        self.commobj = AMS_Comm()
        self.tree = None
Exemplo n.º 15
0
    def onModuleLoad(self):
        global statusbar
        statusbar = Label()
        self.button = Button("Display Current Stack Frames", self)
        self.buttonupdate = Button("Update data from AMS publisher", self)

        buttons = HorizontalPanel()
        buttons.add(self.button)
        buttons.add(self.buttonupdate)
        buttons.setSpacing(8)

        info = """<p>This example demonstrates the calling of the Memory Snooper in PETSc with Pyjamas and <a href="http://json-rpc.org/">JSON-RPC</a>.</p>"""

        self.panel = VerticalPanel()
        self.panel.add(HTML(info))
        self.panel.add(buttons)
        self.panel.add(statusbar)
        RootPanel().add(self.panel)
        self.commobj = AMS.AMS_Comm()
        self.textarea = None
Exemplo n.º 16
0
    def onModuleLoad(self):
        self.remote = DataService()
        panel = VerticalPanel()

        self.todoTextBox = TextBox()
        self.todoTextBox.addKeyboardListener(self)

        self.todoList = ListBox()
        self.todoList.setVisibleItemCount(7)
        self.todoList.setWidth("200px")
        self.todoList.addClickListener(self)

        panel.add(Label("Add New Todo:"))
        panel.add(self.todoTextBox)
        panel.add(Label("Click to Remove:"))
        panel.add(self.todoList)

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

        RootPanel().add(panel)
Exemplo n.º 17
0
    def onModuleLoad(self):

        text = TextBox()
        df1 = DateField()
        df2 = DateField(format='%Y/%m/%d')
        b = Button("Show Calendar", self)
        self.cal = Calendar()
        df3 = MonthField()

        vp = VerticalPanel()
        vp.setSpacing(10)
        vp.add(df1)
        vp.add(b)
        vp.add(df2)
        vp.add(df3)

        RootPanel().add(vp)

        for obj in [self.cal, df1, df2, df3]:
            obj.addSelectedDateListener(self, dobj=True)
            obj.addSelectedDateListener(getattr(self, "onYMDSelected"))
Exemplo n.º 18
0
    def onModuleLoad(self):

        self.layout = HorizontalPanel()

        # Each demo will set their own dimensions, so it doesn't matter
        # what we initialize the canvas to.
        canvas = GWTCanvas(400,400)

        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()
Exemplo n.º 19
0
    def onModuleLoad(self):
        self.curInfo = ''
        self.curSink = None
        self.description = HTML()
        self.sink_list = SinkList()
        self.panel = DockPanel()
        self.b = Button("load", self)

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

        height = Window.getClientHeight()

        self.sp = ScrollPanel(self.sinkContainer)
        self.sp.setWidth("100%")
        self.sp.setHeight("%dpx" % (height - 110))

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

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

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

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

        Window.addWindowResizeListener(self)

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

        self.loadSinks()
Exemplo n.º 20
0
    def onModuleLoad(self):
        # Create a FormPanel and point it at a service.
        self.form = FormPanel()
        self.form.setAction("/chat-service/test/")

        # 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.
        panel = VerticalPanel()
        self.form.setWidget(panel)

        # Create a TextBox, giving it a name so that it will be submitted.
        self.tb = TextBox()
        self.tb.setName("textBoxFormElement")
        panel.add(self.tb)

        # Create a ListBox, giving it a name and some values to be associated with
        # its options.
        lb = ListBox()
        lb.setName("listBoxFormElement")
        lb.addItem("foo", "fooValue")
        lb.addItem("bar", "barValue")
        lb.addItem("baz", "bazValue")
        panel.add(lb)

        # Create a FileUpload widget.
        upload = FileUpload()
        upload.setName("uploadFormElement")
        panel.add(upload)

        # Add a 'submit' button.
        panel.add(Button("Submit", self))

        # Add an event handler to the form.
        self.form.addFormHandler(self)

        RootPanel().add(self.form)
Exemplo n.º 21
0
    def onModuleLoad(self):
        # build image display
        img = Image("babykatie_small.jpg", width="300px", height="300px")
        img.element.setAttribute("usemap", "#themap")
        img.element.setAttribute("ismap", "1")
        imagepanel = ScrollPanel()
        imagepanel.add(img)

        # build message display
        msgpanel = VerticalPanel()
        msgpanel.add(
            Label("move mouse over baby katie's eyes, nose and mouth."))
        msgarea1 = Label("movement messages")
        msgpanel.add(msgarea1)
        msgarea2 = Label("click messages")
        msgpanel.add(msgarea2)

        imageClickHandler = MapClickHandler(msgarea1, msgarea2)

        # build imagemap
        map = ImageMap("themap", width="300px", height="300px")
        areas = [ \
            NamedMapArea("right eye", "circle", "73, 97, 7"),
            NamedMapArea("left eye", "circle", "116, 88, 5"),
            NamedMapArea("nose", "rect", "88, 97, 115, 115", href="http://lkcl.net"),
            NamedMapArea("mouth", "polygon", "82, 129, 102, 124, 119, 119, 121, 125, 103, 132, 79, 133"),
            ]
        for nma in areas:
            nma.addMouseListener(imageClickHandler)
            nma.addClickListener(imageClickHandler)
            map.add(nma)

        # layout page
        hpanel = HorizontalPanel()
        hpanel.add(map)
        hpanel.add(imagepanel)
        hpanel.add(msgpanel)

        RootPanel().add(hpanel)
Exemplo n.º 22
0
    def onModuleLoad(self):

        v = VerticalPanel(Spacing=10)

        p = HorizontalPanel(Spacing=10,
                            VerticalAlignment=HasAlignment.ALIGN_BOTTOM)

        sc = SliderClass(False)
        p.add(CaptionPanel("clickable only", sc))
        sc = SliderClass(True)
        p.add(CaptionPanel("draggable", sc))
        sc = SliderClass(True)
        p.add(CaptionPanel("draggable", sc))

        v.add(CaptionPanel("Vertical Sliders with inputboxes", p))

        p = HorizontalPanel()
        p.setSpacing(10)
        p.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)

        sc = HSliderClass(False)
        p.add(CaptionPanel("clickable only", sc))
        sc = HSliderClass(True)
        p.add(CaptionPanel("draggable", sc))

        v.add(CaptionPanel("Horizontal Sliders with inputboxes", p))

        p = HorizontalPanel()
        p.setSpacing(10)
        p.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)

        sc = ASliderClass(False)
        p.add(CaptionPanel("clickable only", sc))
        sc = ASliderClass(True)
        p.add(CaptionPanel("draggable", sc))

        v.add(CaptionPanel("2D Controls: Inputboxes are draggable as well", p))

        RootPanel().add(v)
Exemplo n.º 23
0
 def __init__(self, handle):
     self.log = logging.getConsoleLogger(type(self).__name__, lev)
     self.log.disabled = False
     self.log.debug('__init__: Instantiation')
     self._cacheBreaker = 0
     self._handle = handle 
     self.remoteService=DiagramService(handle.spinner)
     labelDisplay = Label('Diagram')
     self.display = HTMLPanel('No circuit created.')
     self.latex = TextArea()
     
     buttonPanel =  HorizontalPanel()
     
     labelFormatting = Label('Formatting')
     labelCheckbox = Label('Show: ')
     self.checkboxValue = CheckBox('value')
     self.checkboxValue.setID('CBXV1')
     self.checkboxValue.addClickListener(self.onCirctuiTikzClick)
     self.checkboxSymbol = CheckBox('symbol')
     self.checkboxSymbol.setID('CBXS1')
     self.checkboxSymbol.addClickListener(self.onCirctuiTikzClick)
     checkboxPanel =  HorizontalPanel()
     checkboxPanel.add(labelCheckbox)
     checkboxPanel.add(self.checkboxSymbol)
     checkboxPanel.add(self.checkboxValue)
     
     #layout
     self.layout=VerticalPanel(HorizontalAlignment=HasAlignment.ALIGN_LEFT, Spacing=10)
     self.layout.add(labelDisplay)
     self.layout.add(self.display)
     self.layout.add(Label('Circuitikz Markup'))
     self.layout.add(self.latex)
     self.layout.add(buttonPanel)
     self.layout.add(labelFormatting)
     self.layout.add(checkboxPanel)
     RootPanel().add(self.layout)
     
     #Set Default view
     self.actCircuitTikzLock(lock = True)
Exemplo n.º 24
0
    def onModuleLoad(self):

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

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

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

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

        self.fTabs.addTabListener(self)
Exemplo n.º 25
0
    def __init__(self):

        self.GridTest = None

        self.screen = Screen(Window.getClientWidth(), Window.getClientHeight())
        w = text_app()
        a = self.screen.add_app(w, "text 1", 400, 300)
        a.show()
        w = text_app()
        a = self.screen.add_app(w, "text 2", 400, 300)
        a.show()
        w = slider_app()
        a = self.screen.add_app(w, "s", 20, 100)
        a.show()

        RootPanel().add(self.screen)

        self.loading_apps = []
        self.loading_app = None
        self.loading_desc = None

        self.load_app('../../gridtest/output/', 'GridTest', 'grid test')
        self.load_app('../../widgets/output/', 'Widgets', 'clock')
Exemplo n.º 26
0
    def setup_before_data(self):
        self.button_test = Button("dojdojdoj", self.button_test_click)
        self.button_hide = Button("hide", self.hide_formulas)
        self.button_unhide = Button("unhide all", self.unhide_all)
        self.button_save = Button("save", self.button_save_click)
        self.button_defi = Button("definition", self.button_defi_click)
        self.label_done = Label("loading")

        def pok(n):
            def soa():
                r = {
                    "and_first": Rules[2],
                    "and_second": Rules[3],
                    "gen": Rules[0],
                    "exists": Rules[1],
                    "split": Rules[4],
                    "contra": Rules[5],
                    "assumption": Rules[6],
                    "deduction": Rules[7]
                }
                proof.take_recommended_action(n, r, self.refresh)

            return soa

        self.FormulaListPanel = FormulaListPanel(pok)

        for r in Rules:
            RootPanel().add(
                Button(r.name,
                       self.button_rule_click(r),
                       StyleName='teststyle'))
        RootPanel().add(self.button_test)
        RootPanel().add(self.button_hide)
        RootPanel().add(self.button_unhide)
        RootPanel().add(self.button_save)
        RootPanel().add(self.button_defi)
        RootPanel().add(self.label_done)
Exemplo n.º 27
0
    def onModuleLoad(self):

        self.r = Rect(0.0, 0.0)

        self.xbox = TextBox()
        self.ybox = TextBox()
        self.addbutton = Button("Click to add x and y to Rectangle")
        self.addbutton.addClickListener(self)

        self.xbox.setText("2")
        self.ybox.setText("5")

        RootPanel().add(HTML("X Value:"))
        RootPanel().add(self.xbox)
        RootPanel().add(HTML("Y Value:"))
        RootPanel().add(self.ybox)
        RootPanel().add(self.addbutton)

        RootPanel().add(
            HTML("Current value: %d %d" % (self.r.get_x(), self.r.get_y())))
Exemplo n.º 28
0
    def onModuleLoad(self):
        loggedInUser = getCookie("LoggedInUser")
        loggedInUserJsonData = json.loads(loggedInUser)

        self.username = loggedInUserJsonData["username"]

        self.remote_py = MyBlogService()

        dockPanel = DockPanel(BorderWidth=0,
                              Padding=0,
                              HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                              VerticalAlignment=HasAlignment.ALIGN_MIDDLE)

        dockPanel.setSize('100%', '100%')

        headerDockPanel = DockPanel(
            BorderWidth=0,
            Padding=0,
            HorizontalAlignment=HasAlignment.ALIGN_LEFT,
            VerticalAlignment=HasAlignment.ALIGN_CENTER)
        headerDockPanel.setStyleName('header')
        headerDockPanel.setWidth('100%')

        dockPanel.add(headerDockPanel, DockPanel.NORTH)
        dockPanel.setCellHeight(headerDockPanel, '60px')

        self.siteImage = Image("/images/Testware_logo.png")
        self.siteImage.setStyleName('logo-image')
        headerDockPanel.add(self.siteImage, DockPanel.WEST)
        headerDockPanel.setCellWidth(self.siteImage, '30%')

        self.pageTitle = Label('New Blog')
        self.pageTitle.setStyleName('center-header')
        headerDockPanel.add(self.pageTitle, DockPanel.CENTER)
        headerDockPanel.setCellWidth(self.pageTitle, '40%')

        rightHeaderPanel = VerticalPanel(StyleName='right-header')
        headerDockPanel.add(rightHeaderPanel, DockPanel.EAST)
        headerDockPanel.setCellWidth(rightHeaderPanel, '30%')

        welcomeNoteLabel = Label('Hi %s %s!' %
                                 (loggedInUserJsonData["first_name"],
                                  loggedInUserJsonData["last_name"]))
        rightHeaderPanel.add(welcomeNoteLabel)

        logoutAnchor = Anchor(Widget=HTML('Logout'), Href='/', Title='Logout')
        logoutAnchor.setStyleName('logout')
        rightHeaderPanel.add(logoutAnchor)

        panel = HorizontalPanel(StyleName="header2")
        dockPanel.add(panel, DockPanel.NORTH)
        dockPanel.setCellHeight(panel, '50px')

        self.blogTitle = TextBox()
        self.blogTitle.setStyleName('blog-title')
        self.blogTitle.setPlaceholder("Blog Title")
        panel.add(self.blogTitle)

        self.blogContent = TextArea()
        self.blogContent.setStyleName('blog-content')

        dockPanel.add(self.blogContent, DockPanel.CENTER)
        createBlogButton = Button("Create Blog", self)
        createBlogButton.setStyleName('btn')
        panel.add(createBlogButton)

        RootPanel().add(dockPanel)
Exemplo n.º 29
0
    def onModuleLoad(self):
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"
        self.METHOD_ECHO = "Echo"
        self.METHOD_REVERSE = "Reverse"
        self.METHOD_UPPERCASE = "UPPERCASE"
        self.METHOD_LOWERCASE = "lowercase"
        self.METHOD_NONEXISTANT = "Non existant"
        self.methods = [
            self.METHOD_ECHO, self.METHOD_REVERSE, self.METHOD_UPPERCASE,
            self.METHOD_LOWERCASE, self.METHOD_NONEXISTANT
        ]

        self.remote_php = EchoServicePHP()
        self.remote_py = EchoServicePython()

        self.status = Label()
        self.text_area = TextArea()
        self.text_area.setText("""{'Test'} [\"String\"]
\tTest Tab
Test Newline\n
after newline
""" + r"""Literal String:
{'Test'} [\"String\"]
""")
        self.text_area.setCharacterWidth(80)
        self.text_area.setVisibleLines(8)

        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_php = Button("Send to PHP Service", self)
        self.button_py = Button("Send to Python Service", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_php)
        buttons.add(self.button_py)
        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 some text below, and press a button to send the text
           to an Echo service on your server. An echo service simply sends the exact same text back that it receives.
           </p>"""

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

        RootPanel().add(panel)
Exemplo n.º 30
0
def mouseMoved():
    global p, nX, nY
    nX = p.mouseX
    nY = p.mouseY


class ProcessingCanvas(GWTCanvas):
    def __init__(self):
        GWTCanvas.__init__(self, 150, 150, 150, 150)
        self.c = self.getCanvasElement()
        self.p = Processing(self.c)
        global p
        p = self.p


if __name__ == '__main__':
    note = HTML("""
Note that this is an example of using processing.js.<br>
See <a href=http://ejohn.org/blog/processingjs/>http://ejohn.org/blog/processingjs/</a> for more info.<br>
Since processing.js is built for state-of-the-art browser<br>
that properly implement canvas, IE is not supported.<br>
<br>
""")
    RootPanel().add(note)
    PC = ProcessingCanvas()
    PC.p.setup = setup
    PC.p.draw = draw
    PC.p.mouseMoved = mouseMoved
    PC.p.init()
    RootPanel().add(PC)