def testExplicitAssemblyLoad(self): """Test explicit assembly loading using standard CLR tools.""" from CLR.System.Reflection import Assembly from CLR import System import sys assembly = Assembly.LoadWithPartialName('System.Data') self.failUnless(assembly != None) import CLR.System.Data self.failUnless(sys.modules.has_key('System.Data')) assembly = Assembly.LoadWithPartialName('SpamSpamSpamSpamEggsAndSpam') self.failUnless(assembly == None)
def test_explicit_assembly_load(): """Test explicit assembly loading using standard CLR tools.""" from CLR.System.Reflection import Assembly from CLR import System import sys assembly = Assembly.LoadWithPartialName('System.Data') assert assembly is not None import CLR.System.Data assert 'System.Data' in sys.modules assembly = Assembly.LoadWithPartialName('SpamSpamSpamSpamEggsAndSpam') assert assembly is None
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import time from mousecontrol import MouseControl from perspective import Perspective import sys if sys.platform == 'win32': import CLR from CLR.System.Reflection import Assembly Assembly.LoadFrom("WiimoteLib.dll") Wiimote = CLR.WiimoteLib.Wiimote else: from linuxWiimoteLib import Wiimote class Options: #constants LCLICK = 0 RCLICK = 1 SCROLL = 2 TOGGLETOUCHPAD = 3 NONE = 4 DCLICK = 5 MCLICK = 6
#python defaults to ascii, so switch the console to unicode import sys, codecs sys.stdout = codecs.getwriter('utf-8')(sys.stdout) #this is the python.net piece that interfaces us to the .net #FieldWorks libraries import clr from CLR.System.Reflection import Assembly #FDO (FieldWorks Data Objects) is the #Object-Relational-Mapper layer of FieldWorks fdo = Assembly.LoadWithPartialName("FDO") from CLR.SIL.FieldWorks.FDO import FdoCache #open up a language project to work on db = FdoCache.Create("TestLangProj") lp = db.LangProject vern = lp.DefaultVernacularWritingSystem analysisWs = lp.DefaultAnalysisWritingSystem lexicon = lp.LexDbOA for e in lexicon.EntriesOC: print "\lx " + e.LexemeFormOA.Form.GetAlternative(vern) for sense in e.SensesOS: print "\ge " + sense.Gloss.GetAlternative(analysisWs) if sense.MorphoSyntaxAnalysisRA <> None: print "\pos " + sense.MorphoSyntaxAnalysisRA.InterlinearAbbr print
import sys path = u'K:\\ObjectARX 2013\\inc\\' sys.path.append(path) import clr from CLR.System.Reflection import Assembly Assembly.LoadFrom(path + 'AcDbMgd.dll') Assembly.LoadFrom(path + 'AcCoreMgd.dll') Assembly.LoadFrom(path + 'AcMgd.dll') import Autodesk.AutoCAD.DatabaseServices as ads import Autodesk import Autodesk.AutoCAD.Runtime as ar import Autodesk.AutoCAD.ApplicationServices as aas import Autodesk.AutoCAD.DatabaseServices as ads import Autodesk.AutoCAD.Geometry as ag import Autodesk.AutoCAD.Internal as ai from Autodesk.AutoCAD.Internal import Utils def msg(): doc = aas.Application.DocumentManager.MdiActiveDocument ed = doc.Editor ed.WriteMessage("\nOur test command works!") cc = ai.CommandCallback(msg) #n = "msg" #Utils.AddCommand('pycmds', n, n, ar.CommandFlags.Modal, cc) doc = aas.Application.DocumentManager.MdiActiveDocument