atkvfs

package module
v0.0.0-...-a776a6f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

README

This is a addon package for atk that wrapping TCL FileSystem API to mount fs.FS as virtual filesystem.

Features:

  • Embed TCL/TK stdlib to build a standalone GUI app without installing libtcl/libtk.
  • Mount/Unmount fs.FS as virtual filesystem.

Status

  • Linux is available via cgo.

    • To build a fully standalone app, you need to install TCL/TK from source staticlly.
      # build libtcl staticlly
      cd tcl8.6.10/unix && \
      ./configure --disable-shared && \
      make && \
      make install
      
      # build libtk staticlly
      cd tk8.6.10/unix && \
      ./configure --disable-shared && \
      make && \
      make install
      
      # soft link lib path
      cd /usr/local/lib
      ln -s libtcl8.6.a libtcl.a
      ln -s libtk8.6.a libtk.a
      
  • Windows is still planning.

  • Mac OS has no plan because it can package libs into an app.

Usage

Embed TCL/TK stdlib

import github.com/jopbrown/atkvfs/stdlib/v8.6.10/embed as the blank identifier.

Sample:

package main

import (
	_ "github.com/jopbrown/atkvfs/stdlib/v8.6.10/embed"
	"github.com/visualfc/atk/tk"
)

type Window struct {
	*tk.Window
}

func NewWindow() *Window {
	mw := &Window{tk.RootWindow()}
	lbl := tk.NewLabel(mw, "Hello World!")
	btn := tk.NewButton(mw, "Quit")
	btn.OnCommand(func() {
		tk.Quit()
	})
	tk.NewVPackLayout(mw).AddWidgets(lbl, tk.NewLayoutSpacer(mw, 0, true), btn)
	mw.ResizeN(300, 200)
	return mw
}

func main() {
	tk.MainLoop(func() {
		mw := NewWindow()
		mw.SetTitle("Hello World")
		mw.Center()
		mw.ShowNormal()
	})
}

Mount/Unmount virtual filesystem.

//go:embde myvfs
var myvfs embed.FS

atkvfs.Mount("/myvfs", myvfs)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(prefix string, fs fs.FS)

func Unmount

func Unmount(prefix string)

Types

This section is empty.

Directories

Path Synopsis
stdlib

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL