nicolargo / glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
http://nicolargo.github.io/glances/
Other
26.24k stars 1.49k forks source link

Create an universal GUI based on Web technologies #869

Open nicolargo opened 8 years ago

nicolargo commented 8 years ago

Description

The goal is to create an universal (Linux/BSD/Mac/Win) GUI based Web technologies (HTML/CSS/JS)

Example:

nicolargo commented 8 years ago

@nclsHart / @notFloran : any glue on it ?

nicolargo commented 7 years ago

Test of Pywebview.

Install (on Ubuntu):

sudo apt install python-gi gir1.2-webkit-3.0
sudo pip install pywebview

Note: Python-gi is only available for Python 2 on my Ubuntu 16.04 LTS...

Change the glances_bottle.py start function:

def start(self, stats):
    """Start the bottle."""
    # Init stats
    self.stats = stats

    # Init plugin list
    self.plugins_list = self.stats.getAllPlugins()

    # Bind the Bottle TCP address/port
    bindurl = 'http://{}:{}/'.format(self.args.bind_address,
                                     self.args.port)
    bindmsg = 'Glances web server started on {}'.format(bindurl)
    logger.info(bindmsg)
    print(bindmsg)
    # if self.args.open_web_browser:
    #     # Implementation of the issue #946
    #     # Try to open the Glances Web UI in the default Web browser if:
    #     # 1) --open-web-browser option is used
    #     # 2) Glances standalone mode is running on Windows OS
    #     webbrowser.open(bindurl,
    #                     new=2,
    #                     autoraise=1)
    import threading
    thread = threading.Thread(target=self._app.run, kwargs=dict(
        host=self.args.bind_address, port=self.args.port, quiet=not self.args.debug))
    thread.start()
    # self._app.run(host=self.args.bind_address,
    #               port=self.args.port, quiet=not self.args.debug)
    if self.args.open_web_browser:
        import webview
        webview.create_window(
            "Not a browser, honest!", bindurl,
            width=1024, height=768, resizable=False)

Result is great and multi platform:

selection_271

Todo:

slamp commented 7 years ago

electron is really too heavy. I hope pywebview is better