def __init__(self, title, rect): signals.SignalEmitter.__init__(self) self.create_signal('active-change') self.create_signal('will-close') self.create_signal('did-move') self.create_signal('key-press') self.create_signal('show') self.create_signal('hide') self.nswindow = MiroWindow.alloc().initWithContentRect_styleMask_backing_defer_( rect.nsrect, self.get_style_mask(), NSBackingStoreBuffered, NO) self.nswindow.setTitle_(title) self.nswindow.setMinSize_(NSSize(800, 600)) self.nswindow.setReleasedWhenClosed_(NO) self.content_view = FlippedView.alloc().initWithFrame_(rect.nsrect) self.content_view.setAutoresizesSubviews_(NO) self.nswindow.setContentView_(self.content_view) self.content_widget = None self.view_notifications = NotificationForwarder.create(self.content_view) self.view_notifications.connect(self.on_frame_change, 'NSViewFrameDidChangeNotification') self.window_notifications = NotificationForwarder.create(self.nswindow) self.window_notifications.connect(self.on_activate, 'NSWindowDidBecomeMainNotification') self.window_notifications.connect(self.on_deactivate, 'NSWindowDidResignMainNotification') self.window_notifications.connect(self.on_did_move, 'NSWindowDidMoveNotification') self.window_notifications.connect(self.on_will_close, 'NSWindowWillCloseNotification') wrappermap.add(self.nswindow, self) alive_windows.add(self)
def append_tab(self, child_widget, label, image): item = NSTabViewItem.alloc().init() item.setLabel_(label) item.setView_(FlippedView.alloc().init()) self.view.addTabViewItem_(item) self.children.append(child_widget) self.child_added(child_widget) self.item_to_child[item] = child_widget
def __init__(self, horizontal, vertical): Bin.__init__(self) self.view = MiroScrollView.alloc().init() self.view.setAutohidesScrollers_(YES) self.view.setHasHorizontalScroller_(horizontal) self.view.setHasVerticalScroller_(vertical) self.document_view = FlippedView.alloc().init() self.view.setDocumentView_(self.document_view)
def init(self): self = super(ExpanderView, self).init() self.label_rect = None self.content_view = None self.button = NSButton.alloc().init() self.button.setState_(NSOffState) self.button.setTitle_("") self.button.setBezelStyle_(NSDisclosureBezelStyle) self.button.setButtonType_(NSPushOnPushOffButton) self.button.sizeToFit() self.addSubview_(self.button) self.button.setTarget_(self) self.button.setAction_('buttonChanged:') self.content_view = FlippedView.alloc().init() return self
def build_window(self): self.content_widget = self.build_content() width, height = self.content_widget.get_size_request() width = max(width, 400) window = NSPanel.alloc() window.initWithContentRect_styleMask_backing_defer_( NSMakeRect(400, 400, width, height), NSTitledWindowMask, NSBackingStoreBuffered, NO ) view = FlippedView.alloc().initWithFrame_(NSMakeRect(0, 0, width, height)) window.setContentView_(view) window.setTitle_(self.title) self.content_widget.place(view.frame(), view) if self.buttons: self.buttons[0].make_default() return window
def build_window(self): self.content_widget = self.build_content() width, height = self.content_widget.get_size_request() width = max(width, 400) window = MiroPanel.alloc() window.initWithContentRect_styleMask_backing_defer_( NSMakeRect(400, 400, width, height), NSTitledWindowMask, NSBackingStoreBuffered, NO) view = FlippedView.alloc().initWithFrame_( NSMakeRect(0, 0, width, height)) window.setContentView_(view) window.setTitle_(self.title) self.content_widget.place(view.frame(), view) if self.buttons: self.buttons[0].make_default() return window
def __init__(self, title, rect): signals.SignalEmitter.__init__(self) self.create_signal('active-change') self.create_signal('will-close') self.create_signal('did-move') self.create_signal('key-press') self.create_signal('show') self.create_signal('hide') self.create_signal('on-shown') self.nswindow = MainMiroWindow.alloc( ).initWithContentRect_styleMask_backing_defer_(rect.nsrect, self.get_style_mask(), NSBackingStoreBuffered, NO) self.nswindow.setTitle_(title) self.nswindow.setMinSize_(NSSize(800, 600)) self.nswindow.setReleasedWhenClosed_(NO) self.content_view = FlippedView.alloc().initWithFrame_(rect.nsrect) self.content_view.setAutoresizesSubviews_(NO) self.nswindow.setContentView_(self.content_view) self.content_widget = None self.view_notifications = NotificationForwarder.create( self.content_view) self.view_notifications.connect(self.on_frame_change, 'NSViewFrameDidChangeNotification') self.window_notifications = NotificationForwarder.create(self.nswindow) self.window_notifications.connect(self.on_activate, 'NSWindowDidBecomeMainNotification') self.window_notifications.connect(self.on_deactivate, 'NSWindowDidResignMainNotification') self.window_notifications.connect(self.on_did_move, 'NSWindowDidMoveNotification') self.window_notifications.connect(self.on_will_close, 'NSWindowWillCloseNotification') wrappermap.add(self.nswindow, self) alive_windows.add(self)
def __init__(self, color=None): SimpleBin.__init__(self) self.view = FlippedView.alloc().init() if color is not None: self.set_background_color(color)