示例#1
0
def create_workspace(config: CoreConfig, device: LocalDevice, name: str,
                     **kwargs) -> None:
    """
    Create a new workspace for the given device.
    """
    with cli_exception_handler(config.debug):
        trio_run(_create_workspace, config, device, EntryName(name))
示例#2
0
def bootstrap_organization(config, addr, password, force, **kwargs):
    """
    Configure the organization and register it first user&device.
    """
    with cli_exception_handler(config.debug):
        # Disable task monitoring given user prompt will block the coroutine
        trio_run(_bootstrap_organization, config, addr, password, force)
示例#3
0
    def run_dialog():
        modal = InviteDeviceWidget(parent=d_w,
                                   jobs_ctx=d_w.jobs_ctx,
                                   core=d_w.core)
        modal.show()
        assert not modal.line_edit_token.text()
        assert not modal.line_edit_url.text()
        aqtbot.qtbot.keyClicks(modal.line_edit_device_name, "new_device")
        aqtbot.qtbot.mouseClick(modal.button_register, QtCore.Qt.LeftButton)
        assert modal.line_edit_url.text()
        assert modal.line_edit_device_name.text() == "new_device"
        assert modal.line_edit_token.text()
        url = BackendOrganizationClaimDeviceAddr.from_url(
            modal.line_edit_url.text())

        with aqtbot.qtbot.waitSignal(modal.device_registered):
            trio_run(
                _claim_device,
                modal.line_edit_token.text(),
                url.to_organization_addr(),
                url.device_id,
                "P@ssw0rd!",
                logged_gui.config,
            )
        assert len(autoclose_dialog.dialogs) == 1

        assert autoclose_dialog.dialogs[0][0] == ""
        assert autoclose_dialog.dialogs[0][1].label_message.text() == ""
示例#4
0
def share_workspace(
    config: CoreConfig,
    device: LocalDevice,
    workspace_name: str,
    user_id: Optional[UserID],
    recipiant: Optional[str],
    role: RealmRole,
    **kwargs,
) -> None:
    """
    Share a workspace with someone
    """
    role = WORKSPACE_ROLE_CHOICES[role]
    with cli_exception_handler(config.debug):
        trio_run(_share_workspace, config, device, workspace_name, user_id,
                 recipiant, role)
示例#5
0
def run_mountpoint(
    config: CoreConfig,
    device: LocalDevice,
    mountpoint: Path,
    timestamp: Optional[DateTime],
    **kwargs,
) -> None:
    """
    Expose device's parsec drive on the given mountpoint.
    """
    config = config.evolve(mountpoint_enabled=True)
    if mountpoint:
        config = config.evolve(mountpoint_base_dir=Path(mountpoint))
    with cli_exception_handler(config.debug):
        try:
            trio_run(_run_mountpoint, config, device, timestamp)
        except KeyboardInterrupt:
            click.echo("bye ;-)")
示例#6
0
def bootstrap_organization(config: CoreConfig,
                           addr: BackendOrganizationBootstrapAddr,
                           device_label: Optional[DeviceLabel],
                           human_label: Optional[str],
                           human_email: Optional[str],
                           save_device_with_selected_auth: Callable,
                           **kwargs) -> None:
    """
    Configure the organization and register it first user&device.
    """
    with cli_exception_handler(config.debug):
        # Disable task monitoring given user prompt will block the coroutine
        trio_run(
            _bootstrap_organization,
            config,
            addr,
            device_label,
            human_label,
            human_email,
            save_device_with_selected_auth,
        )