def _create_ns_textfield(self, editable, text, font,
         multiline = False, password = False, border = False,
         padding = (0, 0)):
     self._ns_is_password = password
     if password:
         ns_class = PyGUI_NSSecureTextField
     else:
         ns_class = PyGUI_NSTextField
     ns_frame = NSRect(NSPoint(0, 0), NSSize(20, 10))
     ns_textfield = ns_class.alloc().initWithFrame_(ns_frame)
     ns_textfield.pygui_component = self
     if multiline and not password:
         ns_textfield.pygui_multiline = True
     # Be careful here -- calling setBordered_ seems to affect isBezeled as well
     if editable:
         ns_textfield.setBezeled_(border)
     else:
         ns_textfield.setBordered_(border)
     if not editable:
         ns_textfield.setDrawsBackground_(False)
     ns_textfield.setEditable_(editable)
     ns_textfield.setSelectable_(editable)
     ns_textfield.setFont_(font._ns_font)
     ns_textfield.setStringValue_(text)
     ns_size_to_fit(ns_textfield, padding = padding)
     return ns_textfield
예제 #2
0
 def _create_ns_textfield(self, editable, text, font,
         multiline = False, password = False, border = False,
         padding = (0, 0)):
     self._ns_is_password = password
     if password:
         ns_class = PyGUI_NSSecureTextField
     else:
         ns_class = PyGUI_NSTextField
     ns_frame = NSRect(NSPoint(0, 0), NSSize(20, 10))
     ns_textfield = ns_class.alloc().initWithFrame_(ns_frame)
     ns_textfield.pygui_component = self
     if multiline and not password:
         ns_textfield.pygui_multiline = True
     # Be careful here -- calling setBordered_ seems to affect isBezeled as well
     if editable:
         ns_textfield.setBezeled_(border)
     else:
         ns_textfield.setBordered_(border)
     if not editable:
         ns_textfield.setDrawsBackground_(False)
     ns_textfield.setEditable_(editable)
     ns_textfield.setSelectable_(editable)
     ns_textfield.setFont_(font._ns_font)
     ns_textfield.setStringValue_(text)
     ns_size_to_fit(ns_textfield, padding = padding)
     return ns_textfield
예제 #3
0
 def __init__(self, **kwds):
     titles, values = self._extract_initial_items(kwds)
     self._titles = titles
     self._values = values
     frame = ((0, 0), (100, 20))
     ns = PyGUI_NSPopUpButton.alloc().initWithFrame_pullsDown_(frame, False)
     ns.pygui_component = self
     ns_set_action(ns, 'doAction:')
     self._ns_update_items(ns)
     ns_size_to_fit(ns)
     GListButton.__init__(self, _ns_view = ns, **kwds)
 def _create_ns_button(self, title, font, ns_button_type, ns_bezel_style,
         padding = (0, 0)):
     ns_button = PyGUI_NSButton.alloc().init()
     ns_button.pygui_component = self
     ns_button.setButtonType_(ns_button_type)
     ns_button.setBezelStyle_(ns_bezel_style)
     ns_button.setTitle_(title)
     ns_button.setFont_(font._ns_font)
     num_lines = title.count("\n") + 1
     ns_size_to_fit(ns_button, padding = padding,
         height = font.line_height * num_lines + 5)
     ns_set_action(ns_button, 'doAction:')
     return ns_button
예제 #5
0
	def _create_ns_button(self, title, font, ns_button_type, ns_bezel_style,
			padding = (0, 0)):
		ns_button = PyGUI_NSButton.alloc().init()
		ns_button.pygui_component = self
		ns_button.setButtonType_(ns_button_type)
		ns_button.setBezelStyle_(ns_bezel_style)
		ns_button.setTitle_(title)
		ns_button.setFont_(font._ns_font)
		num_lines = title.count("\n") + 1
		ns_size_to_fit(ns_button, padding = padding,
			height = font.line_height * num_lines + 5)
		ns_set_action(ns_button, 'doAction:')
		return ns_button