# # Copyright (c) Microsoft Corporation. All rights reserved. # # This source code is subject to terms and conditions of the Microsoft Public License. A # copy of the license can be found in the License.html file at the root of this distribution. If # you cannot locate the Microsoft Public License, please send an email to # [email protected]. By using this source code in any fashion, you are agreeing to be bound # by the terms of the Microsoft Public License. # # You must not remove this notice, or any other, from this software. # # ##################################################################################### import clr clr.AddReferenceByPartialName("System.Drawing") clr.AddReferenceByPartialName("System.Windows.Forms") clr.AddReferenceByPartialName("Microsoft.DirectX") clr.AddReferenceByPartialName("Microsoft.DirectX.Direct3D") clr.AddReferenceByPartialName("Microsoft.DirectX.Direct3DX") import System from System import Drawing from System.Windows import Forms from Microsoft import DirectX from Microsoft.DirectX import Direct3D def Vectorize(v): if type(v) == list: v = DirectX.Vector3(v[0], v[1], v[2])
__author__ = 'DreTaX' __version__ = '1.8.2' import clr clr.AddReferenceByPartialName("Pluton") clr.AddReferenceByPartialName("Assembly-CSharp") import Pluton import System from System import * import math import BasePlayer """ Class """ Pending = [] class TpFriend: def On_PlayerConnected(self, Player): usedtp = DataStore.Get("tpfriendusedtp", Player.SteamID) if usedtp is None: DataStore.Add("tpfriendusedtp", Player.SteamID, 0) def On_PlayerDisconnected(self, Player): self.KillJob(Player) def On_PluginInit(self): DataStore.Flush("tpfriendpending") DataStore.Flush("tpfriendpending2")
cfgfile = open(home + "\\STVTools.ini", 'r') config = ConfigParser.ConfigParser() config.read(home + "\\STVTools.ini") # Master Path syspath1 = config.get('SysDir', 'MasterPackage') sys.path.append(syspath1) # Built Path syspath2 = config.get('SysDir', 'SecondaryPackage') sys.path.append(syspath2) import Selection clr.AddReference('System') from Autodesk.Revit.DB import Document, FilteredElementCollector, Transaction, BuiltInCategory,\ ElementId, View, ViewSheet from pyrevit import revit, DB, forms clr.AddReferenceByPartialName('PresentationCore') clr.AddReferenceByPartialName('PresentationFramework') clr.AddReferenceByPartialName('System.Windows.Forms') import System.Windows.Forms uidoc = __revit__.ActiveUIDocument doc = __revit__.ActiveUIDocument.Document import os from pyrevit import revit, DB from pyrevit import forms #sel_sheets = forms.select_sheets(title='Select Sheets', use_selection=True) sheets = FilteredElementCollector(doc).OfClass(ViewSheet).ToElements() #print(os.getenv('APPDATA') + "\\pyRevit\\pyRevit_config.ini") #print("Q101" > "Q301")
# -*- coding: UTF-8 -*- import clr import sys clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("Feng.Base") clr.AddReferenceByPartialName("Feng.Model") clr.AddReferenceByPartialName("Feng.Net") clr.AddReferenceByPartialName("HtmlAgilityPack") import System import Feng import Feng.Net import HtmlAgilityPack class BaseShipCompany: def __init__(self): self.companyName_zh_cn = None #船公司中文名 self.companyName_us_en = None #船公司英文名 self.searchMode = "get" #查询方式get、post self.search_url = None #根据提单号、箱号查询地址 self.postString = None #Post查询 self.yjdgTime_Node_Xpath = None #预计到港时间节点 self.vessel_Node_Xpath = None #船名节点
__author__ = 'DreTaX' __version__ = '3.6.1' import clr clr.AddReferenceByPartialName("Fougerite") import Fougerite import re """ Class """ class DeathMSG: """ Methods """ red = "[color #FF0000]" green = "[color #009900]" deathmsgname = None bullet = None animal = None suicide = None huntingbow = None sleeper = None tpamsg = None banmsg = None spike = None explosion = None bleeding = None kl = None
# -*- coding: UTF-8 -*- import clr clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("System.Windows.Forms") clr.AddReferenceByPartialName("System.Drawing") clr.AddReferenceByPartialName("NHibernate") clr.AddReferenceByPartialName("Feng.Base") clr.AddReferenceByPartialName("Feng.Model") clr.AddReferenceByPartialName("Feng.Windows.Forms") clr.AddReferenceByPartialName("Feng.Windows.Application") clr.AddReferenceByPartialName("Cd.Model.Yw") clr.AddReferenceByPartialName("Hd.Model.Base") clr.AddReferenceByPartialName("Hd.Model.Dao") import System; import System.Windows.Forms; import NHibernate; import Feng; import Feng.Windows.Forms; import Cd.Model; import Hd.Model; def execute(masterForm): lt = masterForm.DisplayManager.CurrentItem; if (lt == None): return; dao = Hd.Model.HdBaseDao[Cd.Model.非业务车辆费用](); item = Cd.Model.非业务车辆费用(); with Feng.ServiceProvider.GetService[Feng.IRepositoryFactory]().GenerateRepository[Cd.Model.车辆轮胎]() as rep: try: rep.BeginTransaction();
# -*- coding: UTF-8 -*- import clr import sys clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("NHibernate") clr.AddReferenceByPartialName("Feng.Base") clr.AddReferenceByPartialName("Feng.Model") clr.AddReferenceByPartialName("Feng.Windows.Model") clr.AddReferenceByPartialName("Feng.Windows.Application") clr.AddReferenceByPartialName("Hd.NetRead") clr.AddReferenceByPartialName("Cd.Model.Yw") import System import NHibernate import Feng import Hd.NetRead import Cd.Model import time def execute(): #sys.stdin.readline(); read = Hd.NetRead.npediRead() print "读取提箱时间" while (True): count = 0 with Feng.ServiceProvider.GetService[Feng.IRepositoryFactory]( ).GenerateRepository[Cd.Model.任务]() as rep: try: rep.BeginTransaction() tasks = rep.Session.CreateCriteria[Cd.Model.任务]() \
# # Copyright (c) Microsoft Corporation. All rights reserved. # # This source code is subject to terms and conditions of the Apache License, Version 2.0. A # copy of the license can be found in the License.html file at the root of this distribution. If # you cannot locate the Apache License, Version 2.0, please send an email to # [email protected]. By using this source code in any fashion, you are agreeing to be bound # by the terms of the Apache License, Version 2.0. # # You must not remove this notice, or any other, from this software. # # ##################################################################################### import clr clr.AddReferenceByPartialName("System.Windows.Forms") clr.AddReferenceByPartialName("System.Drawing") clr.AddReferenceByPartialName("IronPython") clr.AddReferenceByPartialName("Microsoft.Scripting") from System.Drawing import Size from System.Windows.Forms import Form, Application from System.Threading import Thread from System.Threading import ThreadStart from System.Threading import AutoResetEvent import IronPython # We support interactive development of Windows Forms by creating another # thread on which we execute all of the IronPython console's input. This # allows the form to execute on another thread where a message pump can # independently handle input and allow the form to repaint. To make this work
# -*- coding: UTF-8 -*- import clr clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("System.Windows.Forms") clr.AddReferenceByPartialName("System.Drawing") clr.AddReferenceByPartialName("Feng.Base") clr.AddReferenceByPartialName("Feng.Windows.Forms") clr.AddReferenceByPartialName("Feng.Windows.Application") clr.AddReferenceByPartialName("Hd.Report") import Feng import Feng.Windows.Forms import System import System.Windows.Forms import Hd.Report def execute(masterForm): entity = masterForm.DisplayManager.CurrentItem if (entity == None): Feng.MessageForm.ShowInfo("请选择要查看的报表") else: Feng.Utils.ReportGenerator.OpenReports(entity) if __name__ == "<module>" or __name__ == "__builtin__": execute(masterForm)
import unittest import sys import os sys.path.append(os.getcwd() + '\\src\\bin') import System import clr clr.AddReferenceByPartialName("System.Core") clr.AddReferenceByPartialName("System.Configuration") from System.Configuration import * from System.Collections import IDictionary from System.Collections.Generic import IDictionary, IList clr.AddReferenceToFile('App.dll') import App.Core.Models as Models import App.Core.DataAccess as DataAccess class DataAccessTests(unittest.TestCase): CONN_NAME = "Northwind" CONN_STRING = "Server=localhost;Database=northwinddb;Uid=springqa;Pwd=springqa;Convert Zero Datetime=true;Allow Zero Datetime=false" CONN_PROVIDER = "MySql.Data.MySqlClient" def test_can_get_a_customer_from_db(self): dao = DataAccess.CustomersDao(self.CONN_NAME, self.CONN_STRING, self.CONN_PROVIDER)
import clr clr.AddReferenceByPartialName('UnityEngine') import UnityEngine import sys sys.path.append(UnityEngine.Application.dataPath + '/../Python/Lib') # 迷路のサイズ SIZE = 5 # 状態遷移確率 TRANS = 0.8 # 観測確率 KANSOKU = 0.7 # パーティクル数 PA = 50 # 壁情報 WALLS = [ "1101", "1011", "1010", "1100", "1101", "0001", "1010", "1010", "0100", "0101", "0101", "1011", "1100", "0011", "0100", "0011", "1000", "0100", "1001", "0110", "1011", "0110", "0111", "0011", "1110" ]
def main(): import generator3.core import generator3.extra from generator3.clr_tools import get_namespace_by_name from generator3.constants import Timer from generator3.core import version, GenerationStatus, SkeletonGenerator from generator3.util_methods import set_verbose, say, note, print_profile args = parse_args(version()) generator3.core.quiet = args.quiet set_verbose(args.verbose) if args.roots: for p in args.roots: if p and p not in sys.path: # we need this to make things in additional dirs importable sys.path.append(p) note("Altered sys.path: %r", sys.path) if args.state_file: # We can't completely shut off stdin in case Docker-based interpreter to use # json.load() and have to retreat to reading the content line-wise if args.state_file.name == '<stdin>': state_json = json.loads(sys.stdin.readline()) # utf-8 by default else: with args.state_file as f: state_json = json.loads(f.read().decode(encoding='utf-8')) else: state_json = None target_roots = _cleanup_sys_path() if args.list_sources_mode: say(version()) generator3.extra.list_sources(target_roots) sys.exit(0) if args.zip_sources_archive: generator3.extra.zip_sources(args.zip_sources_archive) sys.exit(0) if args.zip_roots_archive: generator3.extra.zip_stdlib(target_roots, args.zip_roots_archive) sys.exit(0) generator = SkeletonGenerator(output_dir=args.output_dir, roots=target_roots, state_json=state_json, write_state_json=bool(args.init_state_file or args.state_file)) timer = Timer() if not args.mod_name: generator.discover_and_process_all_modules( name_pattern=args.name_pattern, builtins_only=args.builtins_only) sys.exit(0) if sys.platform == 'cli': # noinspection PyUnresolvedReferences import clr for ref in args.clr_assemblies: clr.AddReferenceByPartialName(ref) if args.run_clr_profiler: atexit.register(print_profile) # We take module name from import statement args.mod_name = get_namespace_by_name(args.mod_name) if generator.process_module(args.mod_name, args.mod_path) == GenerationStatus.FAILED: sys.exit(1) say("Generation completed in %d ms", timer.elapsed())
/target:winexe Generate windows executable stub for startup in addition to dll. /? /h This message EXE/WinEXE specific options: /main:main_file.py Main file of the project (module to be executed first) /platform:x86 Compile for x86 only /platform:x64 Compile for x64 only Example: ipy.exe pyc.py /main:Program.py Form.py /target:winexe """ import sys import clr clr.AddReferenceByPartialName("IronPython") from System.Collections.Generic import List import IronPython.Hosting as Hosting from IronPython.Runtime.Operations import PythonOps import System from System.Reflection import Emit, Assembly from System.Reflection.Emit import OpCodes, AssemblyBuilderAccess from System.Reflection import AssemblyName, TypeAttributes, MethodAttributes def GenerateExe(name, targetKind, platform, machine, main_module): """generates the stub .EXE file for starting the app""" aName = AssemblyName(System.IO.FileInfo(name).Name) ab = PythonOps.DefineDynamicAssembly(aName, AssemblyBuilderAccess.RunAndSave)
import clr import sys import System clr.AddReferenceByPartialName('System.Web') clr.AddReferenceToFile('interfaces.dll') clr.AddReferenceToFile('cms.dll') clr.AddReferenceToFile('umbraco.dll') import umbraco.cms.businesslogic import System.Web def renderControl(controlToRender): sw = System.IO.StringWriter() writer = System.Web.UI.HtmlTextWriter(sw) controlToRender.Render(writer) return sw.ToString()
__author__ = 'DreTaX' __version__ = '1.1' __about__ = 'Communication on server, with the Pluton Staff' import clr clr.AddReferenceByPartialName("Pluton") import Pluton import sys import socket import re path = Util.GetPublicFolder() sys.path.append(path + "\\Python\\Lib\\") try: import threading import random except ImportError: raise ImportError("Download the extralibs!") """ Global Variables """ sysname = "PluIRC" server = "irc.freenode.net" channel = "#pluton" PlayersWithThreads = {} PlayersWithSockets = {}
# -*- coding: UTF-8 -*- import clr clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("System.Windows.Forms") clr.AddReferenceByPartialName("NHibernate") clr.AddReferenceByPartialName("Feng.Base") clr.AddReferenceByPartialName("Feng.Windows") clr.AddReferenceByPartialName("Feng.Data") clr.AddReferenceByPartialName("Hd.Model.Jk") clr.AddReferenceByPartialName("Hd.Model.Dao") import sys; import System; import System.Windows.Forms; import NHibernate; import Feng; import Feng.Data; import Hd.Model.Jk; import time; def execute(): db = Feng.Data.DbHelper.Instance.CreateDatabase("DataConnectionString"); while (True): try: hd_boxList = db.ExecuteDataView("select 箱Id,箱号 from 视图查询_箱信息_进口 where 到港时间 >= dateadd(month,-2,getdate()) and 承运人 = '900001' and 操作完全标志 = 0 and (提箱时间 is null or 拉箱时间 is null or 还箱时间 is null or 卸货时间 is null)"); cd_boxList = db.ExecuteDataView("select * from 视图查询交互_车队任务 where 拉箱时间 >= dateadd(month,-2,getdate())"); print "Hd:" + str(hd_boxList.Count) + "\tCd:" + str(cd_boxList.Count); time.sleep(2); if (hd_boxList.Count == 0 or cd_boxList.Count == 0): return; hd_dataReader = hd_boxList.Table.CreateDataReader();
from System.Windows.Forms import TextBox, Button, ComboBox, FlowLayoutPanel, Panel, Label, ComboBoxStyle from System.IO import Path, FileInfo SCRIPTDIRECTORY = FileInfo(__file__).DirectoryName PROFILEFILE = Path.Combine(SCRIPTDIRECTORY, "losettingsx.dat") ICON = Path.Combine(SCRIPTDIRECTORY, "libraryorganizer.ico") UNDOFILE = Path.Combine(SCRIPTDIRECTORY, "undo.dat") VERSION = 2.1 clr.AddReferenceByPartialName('ComicRack.Engine') from cYo.Projects.ComicRack.Engine import MangaYesNo, YesNo startbooks = {} endbooks = {} name_to_field = {"Added Date" : "AddedDate", "Age Rating" : "AgeRating", "Alternate Count" : "AlternateCount", "Alternate Number" : "AlternateNumber", "Alternate Series" : "AlternateSeries", "Black And White" : "BlackAndWhite", "Characters" : "Characters", "Colorist" : "Colorist", "Counter" : "Counter", "Count" : "ShadowCount",
# coding: cp932 # # This codes is licensed under CC0 1.0 Universal # このcsvhelper.pyはただのサンプルコードです。ご自由にお使いください。 # # 途中エラーでもクリアしておかねばならない CsvAllData = [] RowCount = 0 import clr import sys sys.path.append(hm.Macro.Var["currentmacrodirectory"]) clr.AddReferenceByPartialName( "CsvHelper") clr.AddReferenceByPartialName( "System.Windows.Forms" ) import System.IO import System.Text import System.Collections.Generic from CsvHelper import * # デバッグ用途 __PYDEBUG__ = 0 if __PYDEBUG__: class HM: def debuginfo(self, str): print(str+"\n")
# TODO: # Add method for append # Add R/O tests (take a populated stream, restricted set of actions) # Verify data from read # - allocate buffer for read # - compare them import clr import System from System import Array, Random from System.Diagnostics import Stopwatch from System.IO import Stream, MemoryStream, FileStream, Path, SeekOrigin, FileMode, File from System.Security.Cryptography import SHA512Managed from System.Text import StringBuilder clr.AddReferenceByPartialName('Esent.Interop') from Microsoft.Isam.Esent.Interop import ( Api, ColumnStream, CommitTransactionGrbit, CreateDatabaseGrbit, Instance, JET_COLUMNDEF, JET_coltyp, JET_prep, OpenTableGrbit, Session, ) import random
# Copyright (c) Microsoft Corporation. All rights reserved. # # This source code is subject to terms and conditions of the Apache License, Version 2.0. A # copy of the license can be found in the License.html file at the root of this distribution. If # you cannot locate the Apache License, Version 2.0, please send an email to # [email protected]. By using this source code in any fashion, you are agreeing to be bound # by the terms of the Apache License, Version 2.0. # # You must not remove this notice, or any other, from this software. # # ##################################################################################### import clr clr.AddReferenceByPartialName("WindowsBase") clr.AddReferenceByPartialName("PresentationCore") clr.AddReferenceByPartialName("PresentationFramework") clr.AddReferenceByPartialName("IronPython") clr.AddReferenceByPartialName("System.Windows.Forms") from System import * from System.Threading import Thread, ThreadStart, AutoResetEvent, ApartmentState from System.Windows import Application from System.Windows.Threading import Dispatcher, DispatcherPriority import IronPython from uilogic import IronDiskUsage def appStart():
"Only module_name or module_name and file_name should be specified; got %d args", len(args)) sys.exit(1) name = args[0] if len(args) == 2: mod_file_name = args[1] else: mod_file_name = None refs = opts.get('-c', '') if sys.platform == 'cli': #noinspection PyUnresolvedReferences import clr if refs: for ref in refs.split(';'): clr.AddReferenceByPartialName(ref) if '-p' in opts: atexit.register(print_profile) # We take module name from import statement name = get_namespace_by_name(name) if not process_one(name, mod_file_name, False, subdir): sys.exit(1) say("Generation completed in %d ms", timer.elapsed())
# -*- coding: utf-8 -*- # Notifications.py # Copyright © Masaaki Kawata All rights reserved. import clr clr.AddReferenceByPartialName("mscorlib") clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("PresentationFramework") clr.AddReferenceByPartialName("Apricot") from System import Object, UInt32, Double, Char, String, StringComparison, Uri, DateTime, Array, BitConverter, Convert, Action, Func from System.Collections.Generic import List, Dictionary from System.IO import Stream, StreamReader from System.Diagnostics import Trace from System.Globalization import CultureInfo, NumberStyles from System.Text import StringBuilder, Encoding from System.Threading.Tasks import Task, TaskContinuationOptions, TaskScheduler from System.Net import HttpListener, HttpListenerContext, WebRequestMethods, HttpStatusCode from System.Windows import Application from Apricot import Script, Entry, Sequence # http://www.json.org/ class JsonDecoder(Object): TOKEN_NONE = 0 TOKEN_CURLY_OPEN = 1 TOKEN_CURLY_CLOSE = 2 TOKEN_SQUARED_OPEN = 3 TOKEN_SQUARED_CLOSE = 4 TOKEN_COLON = 5 TOKEN_COMMA = 6
import clr # dllname= r"C:\z\_a\nsbd\调试报告\src\sft.ipy\STDLIB.DLL" dllname = r"""StdLibALLs.DLL""" # clr.LoadAssemblyFromFileWithPath(dllname) clr.AddReferenceToFile(dllname) import math import csv import os import datetime import random import codecs import clr from System.Runtime.InteropServices import Marshal clr.AddReferenceByPartialName("Microsoft.Office.Interop.Excel") from Microsoft.Office.Interop.Excel import ApplicationClass import XLSCombine import datetime def CombineProcXls(path, Prefix, filenameTpl="Tem_"): ##filenameTpl+2016年10月16日14_42_12.xlsx tpl = "{:}_{:}_{:0>4}年{:0>2}月{:0>2}日{:0>2}_{:0>2}_{:0>2}.xls" curDt = datetime.datetime.now() filename = tpl.format(Prefix, filenameTpl, curDt.year, curDt.month, curDt.day, curDt.hour, curDt.minute, curDt.second) filename1 = os.path.join(path, filename) xlsCombinerocObj = XLSCombine.xlsCombinerocCls() print()
# -*- coding: utf-8 -*- #***************************************************************************** # Copyright (C) 2006 Jorgen Stenarson. <*****@*****.**> # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #***************************************************************************** import clr clr.AddReferenceByPartialName("System.Windows.Forms") import System.Windows.Forms.Clipboard as cb def GetClipboardText(): text="" if cb.ContainsText(): text=cb.GetText() return text def SetClipboardText(text): cb.SetText(text) if __name__ == '__main__': txt=GetClipboardText() # display last text clipped print txt
# -*- coding: utf-8 -*- __doc__ = 'Parse elements IDs from Warnings reports\nShift+Click - do not save selection' __title__ = 'SelManyIDs' from scriptutils import logger import os import re import os.path as op import pickle as pl import clr clr.AddReferenceByPartialName('System.Windows.Forms') clr.AddReferenceByPartialName('System.Drawing') from Autodesk.Revit.DB import BuiltInCategory, ElementId from System.Windows.Forms import Application, Button, Form, Label, CheckBox, DialogResult, TextBox, RadioButton, FormBorderStyle from System.Drawing import Point, Icon, Size from System.Collections.Generic import List from Autodesk.Revit.UI import TaskDialog,TaskDialogCommonButtons uidoc = __revit__.ActiveUIDocument doc = __revit__.ActiveUIDocument.Document usertemp = os.getenv('Temp') prjname = op.splitext(op.basename(doc.PathName))[0] datafile = usertemp + '\\' + prjname + '_pySaveRevitSelection.pym' def addtoclipboard(text): logger.debug('Copying IDs to clipboard') command = 'echo ' + text.strip() + '| clip' os.system(command) logger.debug('Copying IDs to clipboard - OK')
import clr import sys clr.AddReferenceByPartialName("UnityEngine") clr.AddReferenceByPartialName("Fougerite") import UnityEngine import Fougerite class Test2: def TestSharedFunction(self, str1, str2): Plugin.Log ("thisisatest", str1 + " " + str2)
# -*- coding: UTF-8 -*- import clr import sys clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("NHibernate") clr.AddReferenceByPartialName("Feng.Base") clr.AddReferenceByPartialName("Feng.Model") clr.AddReferenceByPartialName("Feng.Windows") clr.AddReferenceByPartialName("Feng.Windows.Model") clr.AddReferenceByPartialName("Feng.Windows.Application") clr.AddReferenceByPartialName("Hd.Service") clr.AddReferenceByPartialName("Hd.Model.Jk") import System import NHibernate import Feng import Hd.Service import Hd.Model.Jk import time def execute(): while (True): with Feng.ServiceProvider.GetService[Feng.IRepositoryFactory]( ).GenerateRepository[Hd.Model.Jk.进口票]() as rep: try: tasks = rep.Session.CreateCriteria[Hd.Model.Jk.进口票]() \ .Add(NHibernate.Criterion.Expression.Eq("货物类别", "废纸")) \ .Add(NHibernate.Criterion.Expression.Eq("Submitted", True)) \ .Add(NHibernate.Criterion.Expression.Eq("允许应收对账", False)) \ .List[Hd.Model.Jk.进口票]()
# -*- coding: UTF-8 -*- import clr clr.AddReferenceByPartialName("System") clr.AddReferenceByPartialName("Hd.Service") import System import Hd.Service def execute(): path = "\\\\192.168.0.10\\2版电子文档\\2版商检发票号" wat = Hd.Service.ForWatcher(path, "Hd.Model.Jk.进口票", "结汇单接受人") while (True): try: #print "开始监视一遍:\t" + path; wat.Run() except System.Exception, ex: print "服务_循环监视读取扫描件_商检发票号 Error:" + ex.Message continue if __name__ == "__main__": execute() if __name__ == "<module>" or __name__ == "__builtin__": execute()
import clr clr.AddReferenceByPartialName("System.Core") clr.AddReferenceByPartialName("IrrlichtLime") import System from System import * from System.Collections.Generic import * from System.Linq import * from System.Text import * from IrrlichtLime import * from IrrlichtLime.Core import * from IrrlichtLime.Video import * from IrrlichtLime.Scene import * from IrrlichtLime.GUI import * class Program(object): def Main(args): ok, driverType = Program.AskUserForDriver() if not ok: return device = IrrlichtDevice.CreateDevice(driverType, Dimension2Di(640, 480)) if device == None: return driver = device.VideoDriver smgr = device.SceneManager env = device.GUIEnvironment driver.SetTextureCreationFlag(TextureCreationFlag.Always32Bit, True) # add irrlicht logo env.AddImage(driver.GetTexture("../../media/irrlichtlogoalpha2.tga"), Vector2Di(10)) # add camera camera = smgr.AddCameraSceneNodeFPS() camera.Position = Vector3Df(-200, 200, -200)
for name in names: ok = process_one(name, None, True, subdir) and ok if not ok: sys.exit(1) else: if len(args) > 2: report("Only module_name or module_name and file_name should be specified; got %d args", len(args)) sys.exit(1) name = args[0] if len(args) == 2: mod_file_name = args[1] else: mod_file_name = None if sys.platform == 'cli': #noinspection PyUnresolvedReferences import clr refs = opts.get('-c', '') if refs: for ref in refs.split(';'): clr.AddReferenceByPartialName(ref) if '-p' in opts: atexit.register(print_profile) if not process_one(name, mod_file_name, False, subdir): sys.exit(1) say("Generation completed in %d ms", timer.elapsed())