This repository holds the GUI frontend code for the OMGUI library.
The OMGUI frontend is written in Vue.js with Vite as build tool, using the composition API with TypeScript and SCSS. The molecule viewer relies on RDKit for 2D visualization and Miew for rendering interactive 3D molecules. It's based on the Carbon Design System.
To run the frontend development server, you first need to launch the OMGUI server.
pip install omguiimport omgui
omgui.launch()Now launch the development server in a separate terminal.
npm run devOMGUI supports a custom base path. To pull this off, the frontend build is exported with a hardcoded __BASE_PATH__ which is replaced on the fly by the server. The base path is set in index-build.html as a <base> tag, which takes care of native browser URLS, and in vite.config.ts from where it's loaded into the Vue router, taking care of all Vue-managed links.
To build locally:
npm run build- Publish a new release on GitHub, respecting semantic versioning
- The release-build.yaml action will run the build script and store the build files as
dist.tar.gzalongside the source code of your release. It will take 1-2 minutes to appear, you can follow the process under the Actions tab. - In the OMGUI repo, update the
OMGUI_FRONTEND_VERSIONenvironment variable to the new version number (exluding the 'v' prefix) in both your.envand the.env-examplefile. - OMGUI will automatically download the frontend code on the first launch, and will update it whenever a new version number has been detected. The installation process extracts the contents of
dist.tar.gzand stored them under/omgui/gui/client.
- OMGUI - File and directory information & content is read by
_compile_filedir_obj()and compiled into a data object representing the file or directory. - The data object will look something like this:
{
"_meta": {
"errCode": null,
"ext": "txt",
"ext2": null,
"fileType": "text",
"size": 120,
"timeCreated": 1724857839569.6558,
"timeEdited": 1724856402224.3848
},
"data": "hello, world",
"filename": "example.txt",
"path": "foobar/example.txt",
"pathAbsolute": "/Users/johndoe/.omgui/workspaces/DEFAULT/foobar/example.txt"
}- Depending on the file type, the
dataattribute will contain a string (for text-based files) or an object (for structured data files). - Different file types (as defined by the file extension) will open in different file viewers. In
ViewerDispatch.vuethe correct viewer is loaded byloadModule()and then the file data is transferred into the appropriate viewer store byparseRoute(). To see how file extensions are mapped to the appropriate file viewer, see below.- Molecule viewer: For displaying
.smol.jsonfiles, which contain an OMGUI-native molecule object. Industry-standard molecules file formats like.pdband.molare translated on-the-fly and will also open in the molecule viewer. - Molecule set viewer: For displaying
molset.jsonfiles, which contain a list of OMGUI-native molecule objects. Industry-standard molecule set files like.sdfor.smiare translated on-the-fly and will also open in the molecule set viewer. - Data viewer: For
.csvfiles and Jupyter dataframes. - Text viewer: For text-based files like
.txt,.mdand.yml - JSON viewer: For
.jsonfiles - All other files (eg.
.pdf) will be opened by the native application of your operating system (eg. Preview on macOS).
- Molecule viewer: For displaying
- OMGUI - On-the-fly translation of file formats happens bt
_attach_file_data(). - The file object and its data is then consumed by
loadItem()in the FileStore.
- OMGUI - Add the file extension to
_get_file_type(). - Add the display name and correct viewer to
_map_FileTypeinsrc/utils/maps.ts
- Update
parseRoute()inViewerDispatch.vueto ensure the filetype results into the correct loading of data into the store. - Update
setMolData()inMolViewerStore.tsif needed. - Update
actionSaveAs()inOverflowMenuMol.vueto ensure the correct options are displayed in the overflow menu, and ensure the delete option is also included.