def draw(self):
     self.title = Element(Element=DOM.createSpan(), StyleName='title')
     DOM.setInnerHTML(self.title.getElement(), self.text)
     self.add(self.title)
     self.tip = PopupPanel(Element=DOM.createElement('code'), autoHide=True, modal=False, rootpanel=self)
     div = Element(Element=DOM.createElement('div'), StyleName='joyride-tip-guide')
     div.add(Widget(Element=DOM.createSpan(), StyleName='joyride-nub left'))
     self.tipItens = Element(Element=DOM.createElement('div'), StyleName='tip-itens')
     div.add(self.tipItens)
     self.tip.add(div)
예제 #2
0
class PopupNewVar(Popup):
    def __init__(self, okClick, cancelClick):
        Popup.__init__(self, '<b>Nova Vari&aacute;vel</b>', okClick,
                       cancelClick, CONFIRM_CANCEL)

    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()

    def onInput(self, sender):
        if self.textBox.getText().count(' ') == len(self.textBox.getText()):
            self.okButton.addStyleName('disabled')
            self.south.remove(self.message)
        elif self.textBox.getText() in vars or self.textBox.getText(
        ) in createdBlocks:
            self.okButton.addStyleName('disabled')
            self.south.add(self.message)
        else:
            self.okButton.removeStyleName('disabled')
            self.south.remove(self.message)

    def myOkClick(self):
        if 'disabled' not in self.okButton.getStyleName():
            Popup.myOkClick(self)
            self.okClick(self.textBox.getText(), self.choose.selectedType)

    def myCancelClick(self):
        Popup.myCancelClick(self)
        if self.cancelClick is not None: self.cancelClick()

    def show(self):
        Popup.show(self)
        self.textBox.setFocus(True)
예제 #3
0
 def addBlock(self, block, left, top, original):
     if original:
         block.original = False
         getWorkspace().addBlock(block)
         if isinstance(block, MainBlock):
             getWorkspace().setMainBlock(block)
             getWorkspace().getBlockList().hideMainBlock(
             )  # passar para dentro do setMainBlock
     else:
         block.removeFromParent()
     block.setStyleAttribute({'left': left, 'top': top})
     block.blockPad = self
     Element.add(self, block)
예제 #4
0
def addArgument(s, arg):
    mode = 'input' if s.mode == INPUT else 'output'
    row = Element(Element=DOM.createTR(), StyleName='simple_hardware_pin')
    td = Element(Element=DOM.createTD(), StyleName='simple_hardware_pin_left')
    row.append(td)
    td = Element(Element=DOM.createTD(),
                 StyleName='simple_hardware_pin_label simple_' + mode + '_pin')
    DOM.setInnerText(td.getElement(), arg.label)
    row.append(td)
    td = Element(Element=DOM.createTD(),
                 StyleName='dropdown_holder simple_' + mode + '_pin')
    td.add(arg)
    row.append(td)
    s.bodyArguments.append(row)
예제 #5
0
class SubCategoryPanel(VerticalPanel):
    def __init__(self,
                 subCategoryName='',
                 subCategoryClassName='',
                 openList=True):
        self.list = VerticalPanel(StyleName='block_list')
        self.list.setStyleAttribute("display", "block")
        VerticalPanel.__init__(self, StyleName='SubCategoryPanel')
        self.subCategoryName = subCategoryName
        if subCategoryName != '':
            self.title = Element(Element=DOM.createElement('dt'),
                                 StyleName=subCategoryClassName)
            DOM.setInnerHTML(self.title.getElement(), self.subCategoryName)
            self.collapse = FocusWidget(Element=DOM.createDiv(),
                                        StyleName='collapse close_up')
            self.collapse.addClickListener(self.showHide)
            self.title.add(self.collapse)
            self.add(self.title)
            if openList:
                self.list.setStyleAttribute("display", "block")
                self.collapse.setStyleName('collapse close_up')
            else:
                self.list.setStyleAttribute("display", "none")
                self.collapse.setStyleName('collapse open_down')
        self.add(self.list)
        self.blocks = []
        self.count = 0

    def changeTexts(self):
        if self.subCategoryName != '':
            DOM.setInnerHTML(self.title.getElement(), _(self.subCategoryName))
            self.title.add(self.collapse)
        for block in self.blocks:
            block.changeTexts()

    def addBlock(self, block, classHelp='help_default', beforeIndex=None):
        panel = HorizontalPanel()
        panel.add(block)
        info = Label('i', StyleName='info_btn')
        info.block = block
        info.classHelp = classHelp
        info.addClickListener(self.showInfo)
        panel.add(info)
        if beforeIndex is not None:
            self.list.insert(panel, self.list.getBody(), 0)  #deprecated
        else:
            self.list.add(panel)
        self.list.setStyleName(self.list.getWidgetTd(panel), 'block_info')
        self.blocks.append(block)

        if block.name in [
                'commandType', 'numericType', 'logicType', 'alphaNumericType'
        ]:
            panel.add(self.getRemoveCustomBlock(block))
            info.addMouseListener(TooltipListener("Editar"))
        else:
            info.addMouseListener(TooltipListener("Ajuda"))

    def getRemoveCustomBlock(self, block):
        remove = Label('x', StyleName='remove_btn')
        remove.addMouseListener(TooltipListener("Remover"))
        remove.block = block
        remove.addClickListener(self.RemoveCustomBlock)
        return remove

    def RemoveCustomBlock(self, sender):
        self.list.remove(sender.block.getParent())
        self.blocks.remove(sender.block)
        if len(self.blocks) == 0:
            self.getParent().reload()
        del createdBlocks[sender.block.varName]
        stateChange()

    def removeBlock(self, block):
        self.list.remove(block.getParent())
        self.blocks.remove(block)

    def removeAllBlocks(self):
        while len(self.blocks) > 0:
            self.removeBlock(self.blocks[0])

    def addWidget(self, widget):
        self.list.add(widget)

    def showInfo(self, sender):
        if sender.block.name in [
                'commandType', 'numericType', 'logicType', 'alphaNumericType'
        ]:
            createdBlocks[sender.block.varName].show()
        else:
            popup = Popup('<b>' + _('Help') + '</b>', None, None)
            popup.center.append(
                Widget(Element=DOM.createDiv(), StyleName=sender.classHelp))
            popup.caption.setStyleAttribute('text-align', 'center')
            popup.show()

    def showHide(self):
        if self.list.getStyleAttribute('display') == 'none':
            self.list.setStyleAttribute("display", "block")
            self.collapse.setStyleName('collapse close_up')
        else:
            self.list.setStyleAttribute("display", "none")
            self.collapse.setStyleName('collapse open_down')

    def changeTitle(self, count):  # faz perder o collapse
        DOM.setInnerHTML(self.title.getElement(),
                         _(self.subCategoryName) + ': #' + str(count))
        self.title.add(self.collapse)
        self.count = count
예제 #6
0
    def __init__(self, changeLanguage, **kwargs):
        FlowPanel.__init__(self, **kwargs)
        self.setID('header')

        #---------------------------------------------------------------------------------------------------
        div = Element(Element=DOM.createDiv(), StyleName='btn-group2')

        self.buttonBlocks = Button(_('Blocks'),
                                   self.showBlocks,
                                   classIcon="icon-selected")
        div.add(self.buttonBlocks)

        self.buttonHarwares = Button(_('Components'),
                                     self.showHardwares,
                                     classIcon="icon-deselected")
        div.add(self.buttonHarwares)

        self.add(div)
        #---------------------------------------------------------------------------------------------------
        div = Element(Element=DOM.createDiv(),
                      StyleName='btn-group2 groupHidden')

        self.buttonMakeBlock = Button(_('Building Block'),
                                      self.makeBlock,
                                      classIcon="icon-buildBlock")
        div.add(self.buttonMakeBlock)

        #self.dropdownMakeBlock = Dropdown('', None, self.makeBlockItemClick, StyleName='dropdown_btn', rootPanel=div)
        #self.dropdownMakeBlock.addValue('Importar Bloco', 'icon-ImportBlock')
        #self.dropdownMakeBlock.addValue('Exportar Bloco', 'icon-ExportBlock')
        #div.add(self.dropdownMakeBlock)

        self.add(div)

        #---------------------------------------------------------------------------------------------------
        #div = Element(Element=DOM.createDiv(), StyleName='btn-group2')

        #self.buttonReload = Button(_('Reload'), self.reloadClick, classIcon="icon-repeat")
        #div.add(self.buttonReload)

        #self.add(div)

        #---------------------------------------------------------------------------------------------------
        div = Element(Element=DOM.createDiv(),
                      StyleName='btn-group2 groupHidden')

        self.buttonUndo = Button(_('Undo'), undo, classIcon="icon-undo")
        div.add(self.buttonUndo)

        self.buttonRedo = Button(_('Redo'), redo, classIcon="icon-redo")
        div.add(self.buttonRedo)

        self.add(div)

        #self.buttonUndo2 = Button("Desfazer2", self.undo2)
        #self.add(self.buttonUndo2)

        #self.buttonRedo2 = Button("Refazer2", self.redo2)
        #self.add(self.buttonRedo2)

        #---------------------------------------------------------------------------------------------------
        div = Element(Element=DOM.createDiv(),
                      StyleName='btn-group2 groupHidden')

        self.buttonOpen = Button(_('Open'), loadState, classIcon="icon-open")
        div.add(self.buttonOpen)

        self.buttonSave = Button(_('Save'),
                                 saveState,
                                 classIcon="icon-download")
        self.buttonSave.setID("btnSave")
        div.add(self.buttonSave)

        self.add(div)

        #---------------------------------------------------------------------------------------------------
        div = Element(Element=DOM.createDiv(), StyleName='btn-group')

        self.codeGenerator = GenerateCodeButtonListener(
            getWorkspace().getCodePanel())
        self.buttonTranslate = Button(_("Translate"), self.codeGenerator)
        self.buttonTranslate.addMouseListener(self)
        div.add(self.buttonTranslate)

        self.dropdownTranslate = Dropdown('',
                                          None,
                                          self.translateItemClick,
                                          StyleName='dropdown_btn',
                                          rootPanel=div)
        self.isAutomatic = False
        self.dropdownTranslate.addValue(gettext_noop('Manual'),
                                        'icon-selected')
        self.dropdownTranslate.addValue(gettext_noop('Automatic'),
                                        'icon-deselected')
        div.add(self.dropdownTranslate)

        self.add(div)

        #---------------------------------------------------------------------------------------------------
        div = Element(Element=DOM.createDiv(), StyleName='btn-group2')

        self.changeLanguage = changeLanguage
        self.dropdownFlag = Dropdown('',
                                     None,
                                     self.flagItemClick,
                                     StyleName='dropdown_btn flag',
                                     classIcon='icon-pt_BR')
        self.dropdownFlag.addValue('Portugu&ecirc;s', 'icon-pt_BR')
        self.dropdownFlag.addValue('English', 'icon-en_US')
        self.dropdownFlag.addValue('Espa&ntilde;ol', 'icon-es_ES')
        self.dropdownFlag.addValue('Italiano', 'icon-it_IT')
        self.dropdownFlag.addMouseListener(TooltipListener("Idioma"))
        div.add(self.dropdownFlag)

        self.add(div)
        #---------------------------------------------------------------------------------------------------

        self.mainStack = []
예제 #7
0
class Popup(DialogBox, KeyboardHandler):
  
    def __init__(self, title, okClick=None, cancelClick=None, options=-1, hasBackground=True):
        DialogBox.__init__(self, autoHide=False, modal=hasBackground, centered=True, StyleName='dialog')
        KeyboardHandler.__init__(self)
        self.addKeyboardListener(self)#n�o funciona fora do input
        self.title = title
        self.okClick = okClick
        self.cancelClick = cancelClick
        self.options = options
        self.hasBackground = hasBackground
        self.center = VerticalPanel(StyleName='dialog_center')
        self.draw()
    
    def setPopupPosition(self, left, top):
        if top + self.getOffsetHeight() > Window.getClientHeight():
            top = Window.getClientHeight() - self.getOffsetHeight()
        if left + self.getOffsetWidth() > Window.getClientWidth():
            left = Window.getClientWidth() - self.getOffsetWidth()    
        DialogBox.setPopupPosition(self, left, top)    
            
    def onKeyUp(self, sender, keycode, modifiers):
        if keycode == KeyboardListener.KEY_ESCAPE: self.myCancelClick()
        elif keycode == KeyboardListener.KEY_ENTER: self.myOkClick()
    
    def draw(self):
        self.setHTML(self.title)
        panelSouth = VerticalPanel(StyleName='dialog_south')
        self.south = Element(Element=DOM.createDiv(), Width='100%')     
        
        if (self.options == CONFIRM_CANCEL):
            cancel = Button(_('Cancel'), self.myCancelClick, classIcon="icon-cancel")
            cancel.addStyleName('float_right')
            self.south.add(cancel)
             
        self.okButton = Button(_('Confirm'), self.myOkClick, classIcon="icon-ok")
        self.okButton.addStyleName('float_right')
        self.south.add(self.okButton)
        
        panelSouth.add(self.south)
        panelSouth.setCellHorizontalAlignment(self.south, HasHorizontalAlignment.ALIGN_RIGHT)
        
        widget = VerticalPanel(Width='100%')
        widget.add(self.center)
        widget.add(panelSouth)
        self.setWidget(widget)
    
    def myOkClick(self):
        self.hide()
        
    def myCancelClick(self):
        self.hide()
        
    def hide(self, autoClosed=False):
        if self.hasBackground: RootPanel().remove(self.background)
        return DialogBox.hide(self, autoClosed=autoClosed)
            
    def show(self):
        if self.hasBackground:
            self.background = Widget(Element=DOM.createDiv(), StyleName='diaglog_coverup')
            self.background.setHeight(RootPanel().getOffsetHeight())
            RootPanel().add(self.background)
        DialogBox.show(self)
        
예제 #8
0
 def add(self, widget):  # substituir para addBlock
     if isinstance(widget, Block):
         Element.add(self, widget)
         widget.blockPad = self
예제 #9
0
    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')
예제 #10
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')