Skip to content

Commit

Permalink
plugin 0.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Nov 14, 2024
1 parent 4b73b36 commit e814768
Show file tree
Hide file tree
Showing 31 changed files with 1,703 additions and 0 deletions.
57 changes: 57 additions & 0 deletions plugin/IGS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#! python3
# venv: brg-csd
# r: compas_session>=0.4.5, compas_ags>=1.3.1

import pathlib

import Eto.Drawing # type: ignore
import Eto.Forms # type: ignore
import Rhino # type: ignore
import Rhino.UI # type: ignore
import System # type: ignore

pluginfile = Rhino.PlugIns.PlugIn.PathFromId(System.Guid("ea785b43-c1c1-43da-b896-69df6c0e4b19"))
shared = pathlib.Path(str(pluginfile)).parent / "shared"


class SplashForm(Eto.Forms.Dialog[bool]):
def __init__(self, title, url, width=800, height=400):
super().__init__()

self.Title = title
self.Padding = Eto.Drawing.Padding(0)
self.Resizable = False
self.ClientSize = Eto.Drawing.Size(width, height)
# self.WindowStyle = Eto.Forms.WindowStyle.NONE # type: ignore

webview = Eto.Forms.WebView()
webview.Size = Eto.Drawing.Size(width, height)
webview.Url = System.Uri(url)
webview.BrowserContextMenuEnabled = False
webview.DocumentLoading += self.action

layout = Eto.Forms.DynamicLayout()
layout.BeginVertical()
layout.AddRow(webview)
layout.EndVertical()
self.Content = layout

def action(self, sender, e):
if e.Uri.Scheme == "action" and e.Uri.Host == "close":
self.Close()

def show(self):
return self.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)


def RunCommand():
form = SplashForm(title="COMPAS IGS", url=str(shared / "index.html"))
form.show()


# =============================================================================
# Main
# =============================================================================

if __name__ == "__main__":
RunCommand()
Loading

0 comments on commit e814768

Please sign in to comment.