Esempio n. 1
0
    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
Esempio n. 2
0
 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)
Esempio n. 3
0
    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
Esempio n. 4
0
 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)
Esempio n. 5
0
 def viewport_created(self):
     wrappermap.add(self.tableview, self)
     self._do_layout()
     self._add_views()
     if self.is_tree():
         self.notifications.connect(self.on_expanded,
             'NSOutlineViewItemDidExpandNotification')
         self.notifications.connect(self.on_collapsed,
             'NSOutlineViewItemDidCollapseNotification')
         self.notifications.connect(self.on_selection_change,
                 'NSOutlineViewSelectionDidChangeNotification')
         self.notifications.connect(self.on_column_resize,
                 'NSOutlineViewColumnDidResizeNotification')
     else:
         self.notifications.connect(self.on_selection_change,
                 'NSTableViewSelectionDidChangeNotification')
         self.notifications.connect(self.on_column_resize,
                 'NSTableViewColumnDidResizeNotification')
     self.tableview.recalcTrackingRects()
Esempio n. 6
0
 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)