def run(self): self.window = self.build_window() wrappermap.add(self.window, self) self.hookup_content_widget_signals() self.running = True if self.sheet_parent is None: response = NSApp().runModalForWindow_(self.window) if self.window: self.window.close() else: delegate = SheetDelegate.alloc().init() NSApp().beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_( self.window, self.sheet_parent.nswindow, delegate, 'sheetDidEnd:returnCode:contextInfo:', 0) response = NSApp().runModalForWindow_(self.window) if self.window: # self.window won't be around if we call destroy() to cancel # the dialog self.window.orderOut_(nil) self.running = False self.unhook_content_widget_signals() if response < 0: return -1 return response
def run(self): self.window = self.build_window() wrappermap.add(self.window, self) self.hookup_content_widget_signals() self.running = True if self.sheet_parent is None: response = NSApp().runModalForWindow_(self.window) if self.window: self.window.close() else: delegate = SheetDelegate.alloc().init() NSApp( ).beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_( self.window, self.sheet_parent.nswindow, delegate, 'sheetDidEnd:returnCode:contextInfo:', 0) response = NSApp().runModalForWindow_(self.window) if self.window: # self.window won't be around if we call destroy() to cancel # the dialog self.window.orderOut_(nil) self.running = False self.unhook_content_widget_signals() if response < 0: return -1 return response
def set_widget(self, widget): self._widget = widget wrappermap.add(self._widget, self) if self.should_connect_to_hierarchy_changed(): self.wrapped_widget_connect("hierarchy_changed", self.on_hierarchy_changed) self.wrapped_widget_connect("size-allocate", self.on_size_allocate) self.wrapped_widget_connect("key-press-event", self.on_key_press) self.wrapped_widget_connect("focus-out-event", self.on_focus_out) self.use_custom_style_callback = None
def set_widget(self, widget): self._widget = widget wrappermap.add(self._widget, self) if self.should_connect_to_hierarchy_changed(): self.wrapped_widget_connect('hierarchy_changed', self.on_hierarchy_changed) self.wrapped_widget_connect('size-allocate', self.on_size_allocate) self.wrapped_widget_connect('key-press-event', self.on_key_press) self.wrapped_widget_connect('focus-out-event', self.on_focus_out) self.use_custom_style_callback = None
def __init__(self, title, description=None): """Create a dialog.""" DialogBase.__init__(self) self.create_signal("open") self.create_signal("close") self.set_window(gtk.Dialog(title)) self._window.set_default_size(425, -1) self.extra_widget = None self.buttons_to_add = [] wrappermap.add(self._window, self) self.description = description
def __init__(self, title, description=None): """Create a dialog.""" DialogBase.__init__(self) self.create_signal('open') self.create_signal('close') self.set_window(gtk.Dialog(title)) self._window.set_default_size(425, -1) self.extra_widget = None self.buttons_to_add = [] wrappermap.add(self._window, self) self.description = description
def place(self, rect, containing_view): """Place this widget on a view. """ if self.viewport is None: if self.CREATES_VIEW: self.viewport = Viewport(self.view, rect) containing_view.addSubview_(self.view) wrappermap.add(self.view, self) else: self.viewport = BorrowedViewport(containing_view, rect) self.viewport_created() else: if not self.viewport.at_position(rect): self.viewport.reposition(rect) self.viewport_repositioned() self.emit('size-allocated', rect.size.width, rect.size.height)
def __init__(self, title, rect=None): 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.create_signal('file-drag-motion') self.create_signal('file-drag-received') self.create_signal('file-drag-leave') self.is_closing = False if rect is None: rect = Rect(0, 0, 470, 600) self.nswindow = MainMiroWindow.alloc( ).initWithContentRect_styleMask_backing_defer_(rect.nsrect, self.get_style_mask(), NSBackingStoreBuffered, NO) self.nswindow.setTitle_(title) self.nswindow.setMinSize_(NSSize(470, 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, title, rect=None): 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.create_signal('file-drag-motion') self.create_signal('file-drag-received') self.create_signal('file-drag-leave') self.is_closing = False if rect is None: rect = Rect(0, 0, 470, 600) self.nswindow = MainMiroWindow.alloc().initWithContentRect_styleMask_backing_defer_( rect.nsrect, self.get_style_mask(), NSBackingStoreBuffered, NO) self.nswindow.setTitle_(title) self.nswindow.setMinSize_(NSSize(470, 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): self._renderer = GTKCustomCellRenderer() self.want_hover = False wrappermap.add(self._renderer, self)
def __init__(self): signals.SignalEmitter.__init__(self) self.create_signal("clicked") self._renderer = GTKCheckboxCellRenderer() wrappermap.add(self._renderer, self) self.want_hover = False
def set_window(self, window): self._window = window window.connect("style-set", self.on_style_set) wrappermap.add(window, self) self.calc_use_custom_style()
def set_window(self, window): self._window = window window.connect('style-set', self.on_style_set) wrappermap.add(window, self) self.calc_use_custom_style()