当前位置: 首页>>代码示例>>Python>>正文


Python System.Type方法代码示例

本文整理汇总了Python中System.Type方法的典型用法代码示例。如果您正苦于以下问题:Python System.Type方法的具体用法?Python System.Type怎么用?Python System.Type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CreateAssemblyGenerator

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def CreateAssemblyGenerator(path, name):
    dir = IO.Path.GetDirectoryName(path)
    file = IO.Path.GetFileName(path)

    aname = Reflection.AssemblyName(name)
    domain = System.AppDomain.CurrentDomain
    ab = domain.DefineDynamicAssembly(aname, Emit.AssemblyBuilderAccess.RunAndSave, dir, None)
    mb = ab.DefineDynamicModule(file, file, True);

    ab.DefineVersionInfoResource()

    constructor = clr.GetClrType(Diagnostics.DebuggableAttribute).GetConstructor(MakeArray(System.Type, clr.GetClrType(Diagnostics.DebuggableAttribute.DebuggingModes)))
    attributeValue = MakeArray(System.Object,
        Diagnostics.DebuggableAttribute.DebuggingModes.Default |
        Diagnostics.DebuggableAttribute.DebuggingModes.DisableOptimizations |
        Diagnostics.DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints
    )
    cab = Emit.CustomAttributeBuilder(constructor, attributeValue)

    ab.SetCustomAttribute(cab)
    mb.SetCustomAttribute(cab)

    return AssemblyGenerator(file, ab, mb, None) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:25,代码来源:test_missing.py

示例2: test_methods_from_generic_class

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def test_methods_from_generic_class(self):
        import System
        from Merlin.Testing.BaseClass import Class320
        class C(Class320[int]): pass
        x = C()
        self.assertEqual(x.m320(1), 11)
        self.assertRaises(TypeError, x.m320, 'abc')

        self.assertEqual(C.m320(x, 1), 11)
        self.assertEqual(Class320[int].m320(x, 1), 11)
        
        C.m320 = lambda self, arg: 100
        self.assertEqual(x.m320(1), 100)
        self.assertEqual(C.m320(x, 1), 100)
        self.assertEqual(Class320[int].m320(x, 1), 11)

        # ref type
        class C(Class320[System.Type]): pass
        x = C()
        self.assertRaises(TypeError, x.m320, 1)
        self.assertEqual(x.m320(None), 11)
        
        C.m320 = lambda self: 200
        self.assertEqual(x.m320(), 200) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:26,代码来源:test_method_override.py

示例3: test_neg_clrtype_returns_nonsense_values

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def test_neg_clrtype_returns_nonsense_values(self):
        '''
        The __clrtype__ implementation returns invalid values.
        '''
        global called
        import System
        
        for x, expected_msg in [[[], "expected Type, got list"], 
                                [(None,), "expected Type, got tuple"], 
                                [True, "expected Type, got bool"], 
                                [False, "expected Type, got bool"], 
                                [3.14, "expected Type, got float"], 
                                ["a string", "expected Type, got str"],
                                [System.UInt16(32), "expected Type, got UInt16"],
                                [1L, "expected Type, got long"],
                    ]: 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:18,代码来源:test___clrtype__.py

示例4: on_close

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def on_close(self, sender, args):
            def _shutdown():
                if is_cef:
                    CEF.shutdown()
                WinForms.Application.Exit()

            if is_cef:
                CEF.close_window(self.uid)

            del BrowserView.instances[self.uid]

            # during tests windows is empty for some reason. no idea why.
            if self.pywebview_window in windows:
                windows.remove(self.pywebview_window)

            self.closed.set()

            if len(BrowserView.instances) == 0:
                self.Invoke(Func[Type](_shutdown)) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:21,代码来源:winforms.py

示例5: GetWinApiFunctionImpl

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def GetWinApiFunctionImpl(
                functionName,
                moduleName,
                charSet,
                returnType,
                *parameterTypes
        ):
        tbuilder = MODULE_BUILDER.DefineType("WIN_API_TYPE" + "_" + moduleName + "_" + functionName)
        mbuilder = tbuilder.DefinePInvokeMethod(
                        functionName,
                        moduleName,
                        PINVOKE_METHOD_ATTRIBUTES,
                        Refl.CallingConventions.Standard,
                        clr.GetClrType(returnType),
                        [clr.GetClrType(t) for t in parameterTypes].ToArray[System.Type](),
                        WIN_API_CALLING_CONVENTION,
                        charSet
                )
        mbuilder.SetImplementationFlags(mbuilder.MethodImplementationFlags | Refl.MethodImplAttributes.PreserveSig)
        winApiType = tbuilder.CreateType()
        methodInfo = winApiType.GetMethod(functionName, PUBLIC_STATIC_BINDING_FLAGS)
        def WinApiFunction(*parameters):
                return methodInfo.Invoke(None, parameters.ToArray[System.Object]())
        return WinApiFunction 
开发者ID:bvn-architecture,项目名称:RevitBatchProcessor,代码行数:26,代码来源:win32_pinvoke.py

示例6: __init__

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def __init__(self, dot_net_dict, path):
        """Contains the namespace_ modules, classes and `System.Type`_ objects of a .NET Assembly.

        Do not instantiate this class directly.

        .. _namespace: https://msdn.microsoft.com/en-us/library/z2kcy19k.aspx
        .. _System.Type: https://msdn.microsoft.com/en-us/library/system.type(v=vs.110).aspx
        """
        self.__dict__.update(dot_net_dict)
        self._path = path 
开发者ID:MSLNZ,项目名称:msl-loadlib,代码行数:12,代码来源:load_library.py

示例7: DefineMethod

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def DefineMethod(self, name, attributes, returnType, parameterTypes):
        params = MakeArray(System.Type, parameterTypes)
        mb = self.tb.DefineMethod(name, attributes, returnType, params)
        ilg = mb.GetILGenerator()
        return CodeGenerator(self, mb, ilg) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:7,代码来源:test_missing.py

示例8: evaluate_js

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def evaluate_js(self, script):
            def _evaluate_js():
                self.browser.evaluate_js(script)

            self.loaded.wait()
            self.Invoke(Func[Type](_evaluate_js))
            self.browser.js_result_semaphore.acquire()

            return self.browser.js_result 
开发者ID:r0x0r,项目名称:pywebview,代码行数:11,代码来源:winforms.py

示例9: load_html

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def load_html(self, content, base_uri):
            def _load_html():
                 self.browser.load_html(content, base_uri)

            self.Invoke(Func[Type](_load_html)) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:7,代码来源:winforms.py

示例10: load_url

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def load_url(self, url):
            def _load_url():
                self.browser.load_url(url)

            self.Invoke(Func[Type](_load_url)) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:7,代码来源:winforms.py

示例11: hide

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def hide(self):
            self.Invoke(Func[Type](self.Hide)) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:4,代码来源:winforms.py

示例12: toggle_fullscreen

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def toggle_fullscreen(self):
            def _toggle():
                screen = WinForms.Screen.FromControl(self)

                if not self.is_fullscreen:
                    self.old_size = self.Size
                    self.old_state = self.WindowState
                    self.old_style = self.FormBorderStyle
                    self.old_location = self.Location
                    self.FormBorderStyle = 0  # FormBorderStyle.None
                    self.Bounds = WinForms.Screen.PrimaryScreen.Bounds
                    self.WindowState = WinForms.FormWindowState.Maximized
                    self.is_fullscreen = True
                    windll.user32.SetWindowPos(self.Handle.ToInt32(), None, screen.Bounds.X, screen.Bounds.Y,
                                            screen.Bounds.Width, screen.Bounds.Height, 64)
                else:
                    self.Size = self.old_size
                    self.WindowState = self.old_state
                    self.FormBorderStyle = self.old_style
                    self.Location = self.old_location
                    self.is_fullscreen = False

            if self.InvokeRequired:
                self.Invoke(Func[Type](_toggle))
            else:
                _toggle() 
开发者ID:r0x0r,项目名称:pywebview,代码行数:28,代码来源:winforms.py

示例13: on_top

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def on_top(self, on_top):
            def _set():
                z_order = -1 if on_top is True else -2
                SWP_NOSIZE = 0x0001  # Retains the current size
                windll.user32.SetWindowPos(self.Handle.ToInt32(), z_order, self.Location.X, self.Location.Y, None, None, SWP_NOSIZE)
            if self.InvokeRequired:
                self.Invoke(Func[Type](_set))
            else:
                _set() 
开发者ID:r0x0r,项目名称:pywebview,代码行数:11,代码来源:winforms.py

示例14: minimize

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def minimize(self):
            def _minimize():
                self.WindowState = WinForms.FormWindowState.Minimized

            self.Invoke(Func[Type](_minimize)) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:7,代码来源:winforms.py

示例15: restore

# 需要导入模块: import System [as 别名]
# 或者: from System import Type [as 别名]
def restore(self):
            def _restore():
                self.WindowState = WinForms.FormWindowState.Normal

            self.Invoke(Func[Type](_restore)) 
开发者ID:r0x0r,项目名称:pywebview,代码行数:7,代码来源:winforms.py


注:本文中的System.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。