How to use the gui.Button 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 oyyd / react-yue / src / components / __tests__ / button.spec.js View on Github external
render(ele, container => {
        const button = container.childAt(0)
        expect(button instanceof gui.Button).toBeTruthy()
        expect(button.getTitle()).toBe(title)
        expect(button.isChecked()).toBe(checked)
        expect(button.getImage()).toBe(image)
        done()
      })
    })
github yue / wey / lib / view / accounts-panel.js View on Github external
createAddButton() {
    const addButton = gui.Button.create('+')
    addButton.setStyle({minWidth: 40, marginTop: 14})
    addButton.onClick = () => {
      const services = accountManager.getServices()
      const menu = gui.Menu.create(services.map((s) => {
        return {label: s.name, onClick: s.login.bind(s)}
      }))
      menu.popup()
    }
    return addButton
  }
github yue / wey / lib / service / slack / index.js View on Github external
teams.push({user: info.user, name: info.team, token})
        } catch (e) {
        }
      }
    } catch (e) {
      fetchButton.setTitle('Retry (Failed to fetch tokens)')
      return
    } finally {
      fetchButton.setEnabled(true)
    }
    if (teams.length == 0) {
      fetchButton.setTitle('Retry (No valid Slack tokens found)')
      return
    }
    for (const team of teams) {
      const button = gui.Button.create(`Login to ${team.name} as ${team.user}`)
      button.setStyle({
        width: '100%',
        marginTop: 10,
      })
      button.onClick = this.loginWithToken.bind(this, team.token, button)
      this.loginWindow.getContentView().addChildView(button)
    }
    fetchButton.setVisible(false)
    this.adujstLoginWindowSize()
  }
}
github yue / wey / lib / service / slack / index.js View on Github external
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)

    const loginButton = gui.Button.create('Login')
    loginButton.setStyle({marginBottom: 10})
    loginButton.onClick = this.exchangeToken.bind(this, teamInput, emailInput, passInput)
    passInput.onActivate = this.exchangeToken.bind(this, teamInput, emailInput, passInput, loginButton)
    contentView.addChildView(loginButton)

    contentView.addChildView(gui.Label.create('----------- OR -----------'))
    const fetchButton = gui.Button.create(FETCH_BUTTON_TEXT)
    fetchButton.setStyle({marginTop: 10})
    fetchButton.onClick = this.fetchSlackTokens.bind(this)
    contentView.addChildView(fetchButton)

    this.adujstLoginWindowSize()
  }