How to use gui - 10 common examples

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 / __tests__ / app.js View on Github external
height: 1000,
          }}
        >
          {ITEMS.map(i =&gt; <label>)}
        
      
      <label> */}
    
  )
}

// Create a window and a root container:
const win = gui.Window.create({})
win.setContentSize({ width: 400, height: 250 })

const contentView = gui.Container.create()
contentView.setStyle({ flexDirection: 'row' })
win.setContentView(contentView)
win.center()
win.activate()

// Create your react elements and render them:
render(, contentView)

// Start your app
if (!process.versions.yode) {
  gui.MessageLoop.run()
  process.exit(0)
}
</label></label>
github oyyd / react-yue / src / __tests__ / app.js View on Github external
}}
          style={{
            flex: 1,
            height: 1000,
          }}
        &gt;
          {ITEMS.map(i =&gt; <label>)}
        
      
      <label> */}
    
  )
}

// Create a window and a root container:
const win = gui.Window.create({})
win.setContentSize({ width: 400, height: 250 })

const contentView = gui.Container.create()
contentView.setStyle({ flexDirection: 'row' })
win.setContentView(contentView)
win.center()
win.activate()

// Create your react elements and render them:
render(, contentView)

// Start your app
if (!process.versions.yode) {
  gui.MessageLoop.run()
  process.exit(0)
}</label></label>
github oyyd / react-yue / src / __tests__ / app.js View on Github external
// Create a window and a root container:
const win = gui.Window.create({})
win.setContentSize({ width: 400, height: 250 })

const contentView = gui.Container.create()
contentView.setStyle({ flexDirection: 'row' })
win.setContentView(contentView)
win.center()
win.activate()

// Create your react elements and render them:
render(, contentView)

// Start your app
if (!process.versions.yode) {
  gui.MessageLoop.run()
  process.exit(0)
}
github oyyd / react-yue / src / components / __tests__ / scroll.spec.js View on Github external
render(ele, container => {
        const scroll = container.childAt(0)
        expect(scroll instanceof gui.Scroll).toBeTruthy()
        const size = scroll.getContentSize()
        // NOTE: The value may be not accurate in windows
        if (!win32) {
          expect(size.width).toBe(contentSize.width)
          expect(size.height).toBe(contentSize.height)
        }
        // expect(scroll.isOverlayScrollbar()).toBe(overlayScrollbar)
        const policies = scroll.getScrollbarPolicy()
        expect(policies[0]).toBe(hpolicy)
        // TODO: not work for vpolicy
        // expect(policies[1]).toBe(vpolicy)
        done()
      })
    })
github stephomi / sculptgl / src / gui / GuiScene.js View on Github external
init(guiParent) {
    var menu = this._menu = guiParent.addMenu(TR('sceneTitle'));

    // scene
    menu.addButton(TR('sceneReset'), this, 'clearScene' /*, 'CTRL+ALT+N'*/ );
    menu.addButton(TR('sceneAddSphere'), this._main, 'addSphere');
    menu.addButton(TR('sceneAddCube'), this._main, 'addCube');
    menu.addButton(TR('sceneAddCylinder'), this._main, 'addCylinder');
    menu.addButton(TR('sceneAddTorus'), this._main, 'addTorus');

    // menu.addTitle(TR('Torus'));
    // menu.addSlider(TR('Arc'), this._main._torusRadius, this.updateTorusRadius.bind(this), 0.01, Math.PI * 2, 0.001);
    // this.ctrlWI = menu.addSlider(TR('Width'), this._main._torusWidth, this.updateTorusWidth.bind(this), 0.01, 0.5, 0.01);
    // this.ctrlLE = menu.addSlider(TR('Length'), this._main._torusLength, this.updateTorusLength.bind(this), 0.2, 2.0, 0.01);
    // menu.addSlider(TR('Radial'), this._main._torusRadial, this.updateTorusRadial.bind(this), 3, 64, 1);
    // menu.addSlider(TR('Tubular'), this._main._torusTubular, this.updateTorusTubular.bind(this), 3, 256, 1);

    // this.ctrlValidate = menu.addButton(TR('Validate !'), this, 'validatePreview');
    // this.ctrlValidate.setVisibility(false);
    // this.ctrlDiscard = menu.addButton(TR('Discard !'), this, 'discardPreview');
    // this.ctrlDiscard.setVisibility(false);
github stephomi / sculptgl / src / gui / GuiBackground.js View on Github external
init(guiParent) {
    // background fold
    var menu = this._menu = guiParent.addMenu(TR('backgroundTitle'));

    this._bg = this._main.getBackground();

    var types = ['Image', 'Environment', 'Ambient env'];
    menu.addCombobox('Type', this._bg._type, this.onBackgroundType.bind(this), types);
    this._ctrlBlur = menu.addSlider('Blur', this._bg._blur, this.onEnvBlur.bind(this), 0.0, 1.0, 0.01);
    this._ctrlBlur.setVisibility(this._bg._type === 1);

    menu.addTitle('Image');
    menu.addButton(TR('backgroundReset'), this, 'resetBackground');
    menu.addButton(TR('backgroundImport'), this, 'importBackground');
    menu.addCheckbox(TR('backgroundFill'), this._main.getBackground()._fill, this.updateFill.bind(this));
  }
github stephomi / sculptgl / src / gui / GuiTablet.js View on Github external
init(guiParent) {
    // Pen tablet ui stuffs
    var menu = this._menu = guiParent.addMenu(TR('pressureTitle'));

    menu.addTitle(TR('pressureRadius'));
    menu.addSlider('', Tablet, 'radiusFactor', 0, 1, 0.01);

    menu.addTitle(TR('pressureIntensity'));
    menu.addSlider('', Tablet, 'intensityFactor', 0, 1, 0.01);
  }
}
github stephomi / sculptgl / src / gui / GuiSculpting.js View on Github external
init(guiParent) {
    var menu = this._menu = guiParent.addMenu(TR('sculptTitle'));
    menu.open();

    menu.addTitle(TR('sculptTool'));

    // sculpt tool
    var optTools = [];
    for (var i = 0, nbTools = Tools.length; i &lt; nbTools; ++i) {
      if (Tools[i]) optTools[i] = TR(Tools[i].uiName);
    }
    this._ctrlSculpt = menu.addCombobox(TR('sculptTool'), this._sculptManager.getToolIndex(), this.onChangeTool.bind(this), optTools);

    GuiSculptingTools.initGuiTools(this._sculptManager, this._menu, this._main);

    this._ctrlTitleCommon = menu.addTitle(TR('sculptCommon'));
    // symmetry
    this._ctrlSymmetry = menu.addCheckbox(TR('sculptSymmetry'), this._sculptManager._symmetry, this.onSymmetryChange.bind(this));
github yue / wey / lib / view / notification-center.js View on Github external
constructor() {
    this.isRead = true
    this.mentions = 0

    if (process.platform !== 'darwin') {
      // Listen for new instances.
      singleInstance.listen(this.activateApp.bind(this))

      // Create tray icon.
      this.trayIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'icon.png')))
      this.attentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'attention.png')))
      this.mentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'mention.png')))
      this.tray = gui.Tray.createWithImage(this.trayIcon)
      this.tray.onClick = this.activateApp.bind(this)

      const menu = gui.Menu.create([
        {
          label: 'Show',
          onClick: this.activateApp.bind(this)
        },
        {
          label: 'Quit',
          onClick() { windowManager.quit() }
        },
      ])
      this.tray.setMenu(menu)
    }

    this.subscription = {
      onUpdateReadState: accountManager.onUpdateReadState.add(this.updateReadState.bind(this)),
      onUpdateMentions: accountManager.onUpdateMentions.add(this.updateMentions.bind(this)),
    }
github yue / wey / lib / view / notification-center.js View on Github external
constructor() {
    this.isRead = true
    this.mentions = 0

    if (process.platform !== 'darwin') {
      // Listen for new instances.
      singleInstance.listen(this.activateApp.bind(this))

      // Create tray icon.
      this.trayIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'icon.png')))
      this.attentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'attention.png')))
      this.mentionIcon = gui.Image.createFromPath(fs.realpathSync(path.join(__dirname, 'tray', 'mention.png')))
      this.tray = gui.Tray.createWithImage(this.trayIcon)
      this.tray.onClick = this.activateApp.bind(this)

      const menu = gui.Menu.create([
        {
          label: 'Show',
          onClick: this.activateApp.bind(this)
        },
        {
          label: 'Quit',
          onClick() { windowManager.quit() }
        },
      ])
      this.tray.setMenu(menu)