Skip to content

Instantly share code, notes, and snippets.

@laynor
Created March 24, 2016 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laynor/f10de9a06119a36e55f9 to your computer and use it in GitHub Desktop.
Save laynor/f10de9a06119a36e55f9 to your computer and use it in GitHub Desktop.
import clr
clr.AddReference('Caliburn.Micro')
clr.AddReference('MesaGrid.Core')
clr.AddReferenceByName("PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
clr.AddReferenceByName("PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
import Caliburn.Micro as caliburn
import com.mesaideas.MesaGrid.ViewModels as viewModels
import com.mesaideas.MesaGrid.Core as core
from System import TimeSpan
from System.Windows.Media import Colors
def getShell():
caliburn.IoC.Get[viewModels.ShellViewModel]()
def reloadInit():
execfile(core.SharedConstants.ProductUserDirectory + r'\init.py')
def message(string, timeout=5000, color=Colors.Red):
statusbar = caliburn.IoC.Get[viewModels.StatusBarViewModel]()
statusbar.Message(string, TimeSpan.FromMilliseconds(timeout), color)
def newCommand(name, action, guard):
return viewModels.Commands.SimpleCommand(name, '', action, guard)
def switchToDocument(name):
items = [item for item in getShell().Items if item.DisplayName == name]
if items:
getShell().ActiveItem = items[0]
def currentEditor():
return getShell().ActiveItem
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment