示例#1
0
def show_tk_ctp():
    global stop
    global tkf

    if not mutex.locked():
        mutex.acquire()
        loop = asyncio.get_event_loop()
        event_connect.clear()
        stop = False
        """Create a Tk window and embed it in Excel as a Custom Task Pane."""
        # reading the settings in the configuration file
        # Create the top level Tk window
        window = tk.Toplevel()
        # window = tk.Tk()
        window.title("MQTT-Broker settings")
        tkf = MQTTSettingsFrame(master=window)
        tkf.bind("<Destroy>", on_closing)
        # Add the widget to Excel as a Custom Task Pane

        create_ctp(window, width=300, position=CTPDockPositionRight)
        # Run the code until completing all task
        # if not loop.is_running():
        loop.run_until_complete(main(window, loop))
        stop = False
        mutex.release()
示例#2
0
def open_jupyter_notebook(*args):
    """Ribbon action function for opening the Jupyter notebook
    browser control.
    """
    from pyxll import create_ctp

    # Create the Qt Application
    app = get_qt_app()

    # The create the widget and add it as an Excel CTP
    path = get_notebook_path()
    widget = JupyterQtWidget(initial_path=path)

    create_ctp(widget, width=800)
def show_wx_ctp():
    if not mutex.locked():
        mutex.acquire()
        # Make sure the wx App has been created
        app = wx.App.Get()
        if app is None:
            app = wx.App()
        # Create the frame to use as the Custom Task Pane
        controller = Controller()
        frame = WxCustomTaskPane("MQTT-Broker settings", controller)
        mqtt = Mqtt(controller)
        controller.mqtt = mqtt
        controller.view = frame.control
        # Add the frame to Excel
        create_ctp(frame, width=300, height=500, position=CTPDockPositionRight)
        asyncio.run_coroutine_threadsafe(mqtt.main(), controller.loop)
示例#4
0
def show_wx_ctp():
    global mqtt
    global frame
    global app

    if not mutex.locked():
        mutex.acquire()
        # Make sure the wx App has been created
        app = wx.App.Get()
        if app is None:
            app = wx.App()
        # Create the frame to use as the Custom Task Pane
        frame = WxCustomTaskPane("MQTT-Broker settings")
        mqtt.frame = frame.control
        # Add the frame to Excel
        create_ctp(frame, width=300, height=500, position=CTPDockPositionRight)
        asyncio.run_coroutine_threadsafe(mqtt.main(), mqtt.loop)
示例#5
0
def show_tk_ctp():
    global window
    if not mutex.locked():
        mutex.acquire()
        """Create a Tk window and embed it in Excel as a Custom Task Pane."""
        # Create the top level Tk window
        window = tk.Toplevel()
        # window = tk.Tk()
        window.title("MQTT-Broker settings")
        controller.window = window
        controller.frame = Frame(master=window)
        # Add the widget to Excel as a Custom Task Pane

        create_ctp(window, width=300, position=CTPDockPositionRight)
        # pyxll.schedule_call(controller.main())
        controller.loop.run_until_complete(controller.main())
        mutex.release()
示例#6
0
def open_jupyter_notebook(*args, initial_path=None, notebook_path=None):
    """Ribbon action function for opening the Jupyter notebook
    browser control in a custom task pane.

    :param initial_path: Path to open Jupyter in.
    :param notebook_path: Path of Jupyter notebook to open.
    """
    from pyxll import create_ctp

    # Get the Qt Application
    app = _get_qt_app()

    # Create the Jupyter web browser widget
    kwargs = _get_notebook_kwargs(initial_path=initial_path,
                                  notebook_path=notebook_path)
    widget = JupyterQtWidget(**kwargs)

    # Show it in a CTP
    create_ctp(widget, width=800)
示例#7
0
def open_jupyter_notebook(*args, initial_path=None, notebook_path=None):
    """Ribbon action function for opening the Jupyter notebook
    browser control.

    :param initial_path: Path to open Jupyter in.
    :param notebook_path: Path of Jupyter notebook to open.
    """
    from pyxll import create_ctp

    if initial_path is not None and notebook_path is not None:
        raise RuntimeError(
            "'initial_path' and 'notebook_path' cannot both be set.")

    if notebook_path is not None:
        if not os.path.exists(notebook_path):
            raise RuntimeError("Notebook path '%s' not found." % notebook_path)
        if not os.path.isfile(notebook_path):
            raise RuntimeError("Notebook path '%s' is not a file." %
                               notebook_path)
        notebook_path = os.path.abspath(notebook_path)

    # Create the Qt Application
    app = _get_qt_app()

    # The create the widget and add it as an Excel CTP
    cfg = get_config()
    timeout = _get_jupyter_timeout(cfg)

    if notebook_path is None and initial_path is None:
        initial_path = _get_notebook_path(cfg)
    if initial_path and not os.path.exists(initial_path):
        raise RuntimeError("Directory '%s' does not exist.")
    if initial_path and not os.path.isdir(initial_path):
        raise RuntimeError("Path '%s' is not a directory.")

    widget = JupyterQtWidget(initial_path=initial_path,
                             timeout=timeout,
                             notebook_path=notebook_path)

    create_ctp(widget, width=800)