How to use the gui.Label function in gui

To help you get started, we’ve selected a few gui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yue / wey / lib / service / slack / index.js View on Github external
async loginWithToken(token, button) {
    // Set loading information.
    if (button) {
      button.setTitle("Loading...")
      button.setEnabled(false)
    } else {
      this.loginWindow.setContentView(gui.Label.create('Loading...'))
    }
    try {
      // Test the token.
      const client = new WebClient(token)
      const data = await client.auth.test()
      this.createAccount(data.team_id, data.team, token)
      // Succeeded.
      if (button) {
        this.loginWindow.getContentView().removeChildView(button)
        this.adujstLoginWindowSize()
      } else {
        this.loginWindow.close()
      }
    } catch (e) {
      // Report error.
      const message = e.message.startsWith('An API error occurred: ') ?  e.message.substr(23) : e.message
github oyyd / react-yue / src / components / __tests__ / label.spec.js View on Github external
render(ele, container => {
        const label = container.childAt(0)
        expect(label instanceof gui.Label).toBeTruthy()
        expect(label.getText()).toBe(text)
        done()
      })
    })
github oyyd / react-yue / src / apply_styles.js View on Github external
module.exports = function applyStyles (view, styles = {}) {
  view.setStyle(styles)
  
  if (view instanceof gui.Label || view instanceof gui.Entry) {
    applyTextStyles(view, styles)
  }

  if (styles.backgroundColor) {
    view.setBackgroundColor(resolveColor(styles.backgroundColor))
  }

  let color = styles.color || 'black'
  if (color) {
    view.setColor(resolveColor(color))
  }
}
github yue / wey / lib / service / slack / index.js View on Github external
this.loginWindow.setContentView(contentView)

    const row1 = this.createRow(contentView)
    const label11 = gui.Label.create('Workspace')
    row1.addChildView(label11)
    const labelWidth = label11.getBounds().width + 5
    label11.setAlign('start')
    label11.setStyle({minWidth: labelWidth})
    const teamInput = gui.Entry.create()
    teamInput.setStyle({flex: 1})
    row1.addChildView(teamInput)
    const label12 = gui.Label.create('.slack.com')
    row1.addChildView(label12)

    const row2 = this.createRow(contentView)
    const label21 = gui.Label.create('E-mail')
    label21.setAlign('start')
    label21.setStyle({minWidth: labelWidth})
    row2.addChildView(label21)
    const emailInput = gui.Entry.create()
    emailInput.setStyle({flex: 1})
    row2.addChildView(emailInput)

    const row3 = this.createRow(contentView)
    const label31 = gui.Label.create('Password')
    label31.setAlign('start')
    label31.setStyle({minWidth: labelWidth})
    row3.addChildView(label31)
    const passInput = gui.Entry.createType('password')
    passInput.setStyle({flex: 1})
    row3.addChildView(passInput)