def __getattr__(name): name = utils.python_name_to_csharp_name(name) _original_class = getattr(System.Windows.Forms, name) _original_clr_class = clr.GetClrType(_original_class) if not _original_clr_class.IsSubclassOf(System.Windows.Forms.Control) \ or _original_clr_class.IsSubclassOf(System.Windows.Forms.Form): # This isn't a control, or its a Form (which are found in forms.py) raise AttributeError(name) return get_wrapper_class(_original_class)
def __getattr__(name): name = utils.python_name_to_csharp_name(name) _original_class = getattr(System.Windows.Forms, name, getattr(System.ComponentModel, name)) _original_clr_class = clr.GetClrType(_original_class) # Is this a component, but not a control (which are available in controls.py or forms.py)? if not _original_clr_class.IsSubclassOf(System.ComponentModel.Component) \ or _original_clr_class.IsSubclassOf(System.Windows.Forms.Control): # This isn't a control, or its a Form (which are found in forms.py) raise AttributeError(name) return get_wrapper_class(_original_class)
def __getattr__(name): name = utils.python_name_to_csharp_name(name) _original_class = getattr(System.Windows.Forms, name) _original_clr_class = GetClrType(_original_class) if (_original_clr_class.IsSubclassOf(System.Windows.Forms.Control) and not _original_clr_class.IsSubclassOf(System.Windows.Forms.Form)) \ or _original_clr_class.IsSubclassOf(System.ComponentModel.Component): # Either this is a control that isn't a form (which are available in controls.py), # or its a component (which are available in components.py). raise AttributeError(name) return get_wrapper_class(_original_class)
class Form(get_wrapper_class(System.Windows.Forms.Form)): """By default, we just want to send a call down the initialize_components stack""" def __init__(self, *args, **kwargs): super(Form, self).__init__(*args, **kwargs) self.initialize_components() def initialize_components(self): self.initialize_component() def initialize_component(self): self.InitializeComponent() def InitializeComponent(self): pass
def __getattr__(name): name = utils.python_name_to_csharp_name(name) _original_class = getattr(System.Drawing, name) return get_wrapper_class(_original_class)