def __init__(self, tabBar=None, **kwargs):
        self.children = [] # TODO: can self.children be used instead?
        self.tab_names = {} 
        self.deck = kwargs.pop('Deck', None)
        floatingtab = kwargs.pop('FloatingTab', False)
        if self.deck is None:
            self.deck = DeckPanel(StyleName="gwt-TabPanelBottom")
        if tabBar is None:
            self.tabBar = TabBar()
        else:
            self.tabBar = tabBar
        self.tabListeners = []

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

        panel = VerticalPanel(Element=element)
        if not floatingtab:
            panel.add(self.tabBar)
        if self.deck.getParent() is None:
            panel.add(self.deck)
            panel.setCellHeight(self.deck, "100%")
        self.tabBar.setWidth("100%")
        self.tabBar.addTabListener(self)

        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-TabPanel")

        PanelBase.__init__(self)
        Composite.__init__(self, panel, **kwargs)
Пример #2
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)
Пример #3
0
    def __init__(self, tabBar=None, **kwargs):
        self.children = [] # TODO: can self.children be used instead?
        self.tab_names = {} 
        self.deck = kwargs.pop('Deck', None)
        floatingtab = kwargs.pop('FloatingTab', False)
        if self.deck is None:
            self.deck = DeckPanel(StyleName="gwt-TabPanelBottom")
        if tabBar is None:
            self.tabBar = TabBar()
        else:
            self.tabBar = tabBar
        self.tabListeners = []

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

        panel = VerticalPanel(Element=element)
        if not floatingtab:
            panel.add(self.tabBar)
        if self.deck.getParent() is None:
            panel.add(self.deck)
            panel.setCellHeight(self.deck, "100%")
        self.tabBar.setWidth("100%")
        self.tabBar.addTabListener(self)

        kwargs['StyleName'] = kwargs.get('StyleName', "gwt-TabPanel")

        PanelBase.__init__(self)
        Composite.__init__(self, panel, **kwargs)
Пример #4
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)
Пример #5
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)
Пример #6
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)
Пример #7
0
class ContainerUCA(VerticalPanel):
    def __init__(self, ws):

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

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

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

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

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

        self.blocksPad = BlocksPad()
        self.hardwaresPad = HardwaresPad()
        self.hardwaresPad.addStyleName('invisible')
        self.middle = Element(Element=DOM.createDiv(),
                              Width='100%',
                              Height='100%')
        ws.setBlocksPad(self.blocksPad)
        ws.setHardwaresPad(self.hardwaresPad)

    def onLoad(self):
        self.add(self.header)
        self.setCellHeight(self.header, '38px')

        self.left.add(self.blockList)
        self.left.add(self.hardwareList)
        self.mainPanel = HorizontalPanel(Width='100%', Height='100%')
        self.mainPanel.add(self.left)
        self.mainPanel.setCellWidth(self.left, '250')

        self.middle.add(self.blocksPad)
        self.middle.add(self.hardwaresPad)
        self.center = VerticalPanel(Width='100%',
                                    Height='100%',
                                    StyleName="center_panel")
        self.center.add(self.middle)

        #---------------------------------------------------------------------------------------------------------
        bottom = Element(Element=DOM.createDiv(), StyleName='drawer_bottom')

        self.showHideLeft = FocusWidget(Element=DOM.createDiv(),
                                        StyleName='control_bar close_left')
        self.showHideLeft.addClickListener(self.showHidePanelLeft)
        self.showHideLeft.setStyleAttribute('float', 'lef')
        bottom.add(self.showHideLeft)

        self.showHideRight = FocusWidget(Element=DOM.createDiv(),
                                         StyleName='control_bar')
        self.showHideRight.addClickListener(self.showHidePanelRight)
        bottom.add(self.showHideRight)

        self.showHideMonitor = FocusWidget(Element=DOM.createDiv(),
                                           StyleName='control_bar')
        self.showHideMonitor.addClickListener(self.showHidePanelMonitor)
        bottom.add(self.showHideMonitor)

        self.resizeMonitor = ResizeWidget(self.serialMonitor,
                                          100,
                                          400,
                                          invert=True,
                                          horizontal=False)
        DOM.setStyleAttribute(self.resizeMonitor.getElement(), "display",
                              "none")
        bottom.add(self.resizeMonitor)

        self.center.add(bottom)
        self.center.setCellHeight(bottom, '20px')

        usbFlash = FocusWidget(Element=DOM.createDiv())
        usbFlash.setID('cb_cf')
        DOM.setElemAttribute(usbFlash.getElement(), 'data-sections',
                             'usbflash serialmonitor')
        self.serialMonitor.add(usbFlash)

        progress = Element(Element=DOM.createDiv(),
                           StyleName='progress progress-striped active')
        progress.setID('progress')
        DOM.setStyleAttribute(progress.getElement(), "display", "none")
        progress_val = Element(Element=DOM.createDiv(), StyleName='bar')
        progress_val.setID('progress_val')
        progress.add(progress_val)
        self.serialMonitor.add(progress)

        monitor = Element(Element=DOM.createDiv())
        monitor.setID('monitor')
        self.serialMonitor.add(monitor)

        self.center.add(self.serialMonitor)
        self.center.setCellHeight(self.serialMonitor, '100')
        self.showHidePanelMonitor()
        #---------------------------------------------------------------------------------------------------------

        self.mainPanel.add(self.center)

        #---------------------------------------------------------------------------------------------------------
        self.cod = VerticalPanel(Width='100%',
                                 Height='100%',
                                 StyleName="right_panel")

        divCode = Element(Element=DOM.createDiv(),
                          Width='100%',
                          Height='100%',
                          StyleName="download-button-container")
        divCode.add(self.codeTextArea)
        divButtonDownload = FocusWidget(Element=DOM.createDiv(),
                                        StyleName="download-button")
        #divButtonDownload.addClickListener(listener=lambda:exportWiringCode(self.codeTextArea.getText()))
        divButtonDownload.addClickListener(listener=lambda: exportWiringCode())
        DOM.setInnerText(divButtonDownload.getElement(), 'download')
        divCode.add(divButtonDownload)

        self.cod.add(divCode)
        bot = Element(Element=DOM.createDiv(), StyleName='drawer_bottom')
        res = ResizeWidget(self.cod, 100, 500, invert=True)
        res.setStyleAttribute('float', 'left')
        bot.append(res)
        self.cod.add(bot)
        self.cod.setCellHeight(bot, '20px')
        self.mainPanel.add(self.cod)
        self.mainPanel.setCellWidth(self.cod, '200')
        self.showHidePanelRight()

        self.header.buttonBlocks.addClickListener(self.showBlocksList)
        self.header.buttonHarwares.addClickListener(self.showHardwaresList)
        self.header.buttonTranslate.addClickListener(self.showPanelRight)
        #self.header.buttonReload.addClickListener(self.hidePanelRight)

        #---------------------------------------------------------------------------------------------------------

        self.add(self.mainPanel)

        stateChange()

        self.changeLanguage('pt_BR')
        #https://groups.google.com/forum/?fromgroups=#!topic/pyjamas-dev/a-u8hWZ6W0o
        #JS('''setOperationProgress(50);''')
        #JS('''$("#operation_output").html("Working...");''')
        #-------------------------------------------------------------------------------------------------------------

        #dynamic.ajax_import("jquery.min.js")
        #dynamic.ajax_import("lawnchair-0.6.1.min.js")
        #dynamic.ajax_import("BrowserDetect.js")
        #dynamic.ajax_import("compilerflasher.js", names = ['initializePlugin'])
        #JS("""@{{!initializePlugin}}();""")

        #dynamic.ajax_import("src-noconflict/ace.js", names = ['addPluginAce'])
        #JS("""@{{!addPluginAce}}();""")
        #JS("""addPluginAce();""")

        #JS("""var editor = ace.edit("editor");
        #      editor.setTheme("ace/theme/textmate");
        #      editor.getSession().setMode("ace/mode/c_cpp");
        #      alert();""")

    def changeLanguage(self, language):
        i18n.load(base_url='../lang',
                  lang=language,
                  onCompletion=self.changeTexts)

    def changeTexts(self):
        getWorkspace().getBlockList().changeTexts()
        #getWorkspace().getBlocksPad().changeTexts() nao pega os subblocks!
        for block in getWorkspace().getBlocks():
            block.changeTexts()
        getWorkspace().getHeaderPanel().changeTexts()
        getWorkspace().getHardwaresList().changeTexts()
        getWorkspace().getHardwaresPad().changeTexts()

    def showBlocksList(self):
        self.hardwareList.addStyleName('invisible')
        self.blockList.removeStyleName('invisible')
        self.hardwaresPad.addStyleName('invisible')
        self.blocksPad.removeStyleName('invisible')
        self.blockList.refreshComponentBlocks(self.hardwaresPad.children)

    def showHardwaresList(self):
        self.blockList.addStyleName('invisible')
        self.hardwareList.removeStyleName('invisible')
        self.blocksPad.addStyleName('invisible')
        self.hardwaresPad.removeStyleName('invisible')

    def hidePanelRight(self):
        if DOM.getStyleAttribute(
                self.mainPanel.getWidgetTd(self.cod),
                'display') == '':  # bug: "block" in <td> not work's on firefox
            DOM.setStyleAttribute(self.mainPanel.getWidgetTd(self.cod),
                                  "display", "none")
            self.showHideRight.setStyleName('control_bar open_left')

    def showPanelRight(self):
        if DOM.getStyleAttribute(self.mainPanel.getWidgetTd(self.cod),
                                 'display') == 'none':
            DOM.setStyleAttribute(self.mainPanel.getWidgetTd(self.cod),
                                  "display", "")
            self.showHideRight.setStyleName('control_bar close_right')

    def showHidePanelLeft(self):
        if DOM.getStyleAttribute(self.mainPanel.getWidgetTd(self.left),
                                 'display') == '':
            DOM.setStyleAttribute(self.mainPanel.getWidgetTd(self.left),
                                  "display", "none")
            self.showHideLeft.setStyleName('control_bar open_right')
        else:
            DOM.setStyleAttribute(self.mainPanel.getWidgetTd(self.left),
                                  "display", "")
            self.showHideLeft.setStyleName('control_bar close_left')

    def showHidePanelMonitor(self):
        if DOM.getStyleAttribute(
                DOM.getParent(self.center.getWidgetTd(self.serialMonitor)),
                'display') == 'none':
            DOM.setStyleAttribute(
                DOM.getParent(self.center.getWidgetTd(self.serialMonitor)),
                "display", "")
            self.showHideMonitor.setStyleName('collapse open_down')
            #JS("""addCodeBenderPlugin();@{{!addCodeBenderPlugin}}();""")
            DOM.setStyleAttribute(self.resizeMonitor.getElement(), "display",
                                  "")
        else:
            DOM.setStyleAttribute(
                DOM.getParent(self.center.getWidgetTd(self.serialMonitor)),
                "display", "none")
            self.showHideMonitor.setStyleName('collapse close_up')
            DOM.setStyleAttribute(self.resizeMonitor.getElement(), "display",
                                  "none")

    def showHidePanelRight(self):
        if DOM.getStyleAttribute(self.mainPanel.getWidgetTd(self.cod),
                                 'display') == 'none':
            DOM.setStyleAttribute(self.mainPanel.getWidgetTd(self.cod),
                                  "display", "")
            self.showHideRight.setStyleName('control_bar close_right')
        else:
            DOM.setStyleAttribute(self.mainPanel.getWidgetTd(self.cod),
                                  "display", "none")
            self.showHideRight.setStyleName('control_bar open_left')
Пример #8
0
    def onModuleLoad(self):
        self.form = FormPanel()
        self.remote_py = MyBlogService()

        self.form.setAction("/index.html")

        vp = VerticalPanel(BorderWidth=0,
                           HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                           VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                           Width="100%",
                           Height="150px")
        self.form.setWidget(vp)

        header = HTML(
            "<h2>CREATE MY ACCOUNT</h2><h3>Welcome to signup form</h3>")
        part1 = header

        hpn = HorizontalPanel(BorderWidth=0,
                              HorizontalAlignment=HasAlignment.ALIGN_LEFT,
                              VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                              Width="92%",
                              Height="60px")

        self.fname = TextBox()
        self.fname.setName("fname")
        self.fname.setPlaceholder("First Name")
        hpn.add(self.fname)

        self.lname = TextBox()
        self.lname.setName("lname")
        self.lname.setPlaceholder("Last Name")
        hpn.add(self.lname)
        hpn.setCellWidth(self.fname, "70%")
        hpn.setCellWidth(self.lname, "30%")
        part2 = hpn

        self.uname = TextBox()
        self.uname.setName("uname")
        self.uname.setPlaceholder("User Name")
        part3 = self.uname

        self.password = PasswordTextBox()
        self.password.setName("passsignup")
        self.password.setPlaceholder("Choose a password")
        part4 = self.password

        self.rpassword = PasswordTextBox()
        self.rpassword.setName("rpasssignup")
        self.rpassword.setPlaceholder("Confirm your password")
        part5 = self.rpassword

        self.email = TextBox()
        self.email.setName("emailsignup")
        self.email.setPlaceholder("Enter your email address ")
        part6 = self.email

        self.errorlabel = Label()
        self.errorlabel.setStyleName("errorlabel")
        part7 = self.errorlabel

        hpanel = HorizontalPanel(BorderWidth=0,
                                 HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                                 VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                                 Width="100%",
                                 Height="50px")

        partb = Button("Signup", self)
        partb.setStyleName('btn')
        image = Label("Already have account! Sign in")
        anchor = Anchor(Widget=image, Href='/index.html')
        parta = anchor

        hpanel.add(partb)
        hpanel.add(parta)
        hpanel.setStyleName("hpanel")

        part8 = hpanel

        vp.add(part1)
        vp.add(part2)
        vp.add(part3)
        vp.add(part4)
        vp.add(part5)
        vp.add(part6)
        vp.add(part7)
        vp.add(part8)

        vp.setCellHeight(part1, "5%")
        vp.setCellHeight(part2, "10%")
        vp.setCellHeight(part3, "10%")
        vp.setCellHeight(part4, "10%")
        vp.setCellHeight(part5, "10%")
        vp.setCellHeight(part6, "10%")
        vp.setCellHeight(part7, "10%")
        vp.setCellHeight(part8, "10%")

        vp.setStyleName("signup")

        self.form.addFormHandler(self)
        RootPanel().add(self.form)