Exemplo n.º 1
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)
Exemplo n.º 2
0
 def set_item(self, item_info, callback, errback, force_subtitles=False):
     threads.warn_if_not_on_main_thread('quicktime.Player.set_item')
     self.reset()
     qtmovie = self.get_movie_from_file(item_info.filename)
     self.callback = callback
     self.errback = errback
     self.force_subtitles = force_subtitles
     if qtmovie is not None:
         self.item_info = item_info
         self.movie = qtmovie
         self.movie_notifications = NotificationForwarder.create(self.movie)
         self.movie_notifications.connect(self.handle_movie_notification,
                                          QTMovieDidEndNotification)
         load_state = qtmovie.attributeForKey_(
             QTMovieLoadStateAttribute).longValue()
         # Only setup a deferred notification if we are unsure of status
         # anything else in movie_load_state_changed().
         if load_state in (QTMovieLoadStateLoading, QTMovieLoadStateLoaded):
             self.movie_notifications.connect(
                 self.handle_movie_notification,
                 QTMovieLoadStateDidChangeNotification)
         else:
             # Playable right away or error - just call and don't disconnect
             # notification because it wasn't connected in the first place.
             self.movie_load_state_changed(disconnect=False)
     else:
         threads.call_on_ui_thread(errback)
Exemplo n.º 3
0
 def set_item(self, item_info, callback, errback, force_subtitles=False):
     threads.warn_if_not_on_main_thread('quicktime.Player.set_item')
     self.reset()
     qtmovie = self.get_movie_from_file(item_info.video_path)
     self.callback = callback
     self.errback = errback
     self.force_subtitles = force_subtitles
     if qtmovie is not None:
         self.item_info = item_info
         self.movie = qtmovie
         self.movie_notifications = NotificationForwarder.create(self.movie)
         self.movie_notifications.connect(self.handle_movie_notification,
             QTMovieDidEndNotification)
         load_state = qtmovie.attributeForKey_(
             QTMovieLoadStateAttribute).longValue()
         # Only setup a deferred notification if we are unsure of status
         # anything else in movie_load_state_changed().
         if load_state in (QTMovieLoadStateLoading,
                             QTMovieLoadStateLoaded):
             self.movie_notifications.connect(
                 self.handle_movie_notification,
                 QTMovieLoadStateDidChangeNotification)
         else:
             # Playable right away or error - just call and don't disconnect
             # notification because it wasn't connected in the first place.
             self.movie_load_state_changed(disconnect=False)
     else:
         threads.call_on_ui_thread(errback)
Exemplo n.º 4
0
 def __init__(self, title):
     Window.__init__(self, title, Rect(0, 0, 640, 440))
     self.panels = dict()
     self.identifiers = list()
     self.first_show = True
     self.nswindow.setShowsToolbarButton_(NO)
     self.nswindow.setReleasedWhenClosed_(NO)
     self.app_notifications = NotificationForwarder.create(NSApp())
     self.app_notifications.connect(self.on_app_quit, "NSApplicationWillTerminateNotification")
Exemplo n.º 5
0
 def __init__(self, title):
     Window.__init__(self, title, Rect(0, 0, 640, 440))
     self.panels = dict()
     self.identifiers = list()
     self.first_show = True
     self.nswindow.setShowsToolbarButton_(NO)
     self.nswindow.setReleasedWhenClosed_(NO)
     self.app_notifications = NotificationForwarder.create(NSApp())
     self.app_notifications.connect(
         self.on_app_quit, 'NSApplicationWillTerminateNotification')
Exemplo n.º 6
0
 def __init__(self, initial_text=None):
     Widget.__init__(self)
     if initial_text is None:
         initial_text = ""
     self.view = NSTextView.alloc().initWithFrame_(NSRect((0,0),(50,50)))
     self.view.setMaxSize_((1.0e7, 1.0e7))
     self.view.setHorizontallyResizable_(NO)
     self.view.setVerticallyResizable_(YES)
     self.notifications = NotificationForwarder.create(self.view)
     if initial_text is not None:
         self.set_text(initial_text)
     self.set_size(widgetconst.SIZE_NORMAL)
Exemplo n.º 7
0
 def __init__(self, initial_text=None):
     Widget.__init__(self)
     if initial_text is None:
         initial_text = ""
     self.view = NSTextView.alloc().initWithFrame_(NSRect((0, 0), (50, 50)))
     self.view.setMaxSize_((1.0e7, 1.0e7))
     self.view.setHorizontallyResizable_(NO)
     self.view.setVerticallyResizable_(YES)
     self.notifications = NotificationForwarder.create(self.view)
     self.create_signal('changed')
     if initial_text is not None:
         self.set_text(initial_text)
     self.set_size(widgetconst.SIZE_NORMAL)
Exemplo n.º 8
0
 def set_item(self, item_info, callback, errback, force_subtitles=False):
     threads.warn_if_not_on_main_thread('quicktime.Player.set_item')
     qtmovie = self.get_movie_from_file(item_info.video_path)
     self.reset()
     if qtmovie is not None:
         self.movie = qtmovie
         self.item_info = item_info
         self.movie_notifications = NotificationForwarder.create(self.movie)
         self.movie_notifications.connect(self.handle_movie_notification, QTMovieDidEndNotification)
         self.setup_subtitles(force_subtitles)
         callback()
     else:
         errback()
Exemplo n.º 9
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)
Exemplo n.º 10
0
    def __init__(self, initial_text=None):
        SizedControl.__init__(self)
        self.view = self.make_view()
        self.font = NSFont.systemFontOfSize_(NSFont.systemFontSize())
        self.view.setFont_(self.font)
        self.view.setEditable_(YES)
        self.view.cell().setScrollable_(YES)
        self.view.cell().setLineBreakMode_(NSLineBreakByClipping)
        self.sizer_cell = self.view.cell().copy()
        if initial_text:
            self.view.setStringValue_(initial_text)
            self.set_width(len(initial_text))
        else:
            self.set_width(10)

        self.notifications = NotificationForwarder.create(self.view)

        self.create_signal('activate')
        self.create_signal('changed')
        self.create_signal('validate')
Exemplo n.º 11
0
    def __init__(self, initial_text=None):
        SizedControl.__init__(self)
        self.view = self.make_view()
        self.font = NSFont.systemFontOfSize_(NSFont.systemFontSize())
        self.view.setFont_(self.font)
        self.view.setEditable_(YES)
        self.view.cell().setScrollable_(YES)
        self.view.cell().setLineBreakMode_(NSLineBreakByClipping)
        self.sizer_cell = self.view.cell().copy()
        if initial_text:
            self.view.setStringValue_(initial_text)
            self.set_width(len(initial_text))
        else:
            self.set_width(10)

        self.notifications = NotificationForwarder.create(self.view)

        self.create_signal('activate')
        self.create_signal('changed')
        self.create_signal('validate')
Exemplo n.º 12
0
 def __init__(self, model):
     Widget.__init__(self)
     self.create_signal('selection-changed')
     self.create_signal('hotspot-clicked')
     self.create_signal('row-double-clicked')
     # row-activated is never emitted, but it should be
     # when space or enter is pressed with a row selected. --Kaz
     self.create_signal('row-activated')
     self.model = model
     self.columns = []
     self.drag_source = None
     self.context_menu_callback = None
     if self.is_tree():
         self.create_signal('row-expanded')
         self.create_signal('row-collapsed')
         self.tableview = MiroOutlineView.alloc().init()
         self.data_source = tablemodel.MiroOutlineViewDataSource.alloc()
     else:
         self.tableview = MiroTableView.alloc().init()
         self.data_source = tablemodel.MiroTableViewDataSource.alloc()
     self.view = self.tableview
     self.data_source.initWithModel_(self.model)
     self.tableview.setDataSource_(self.data_source)
     self.tableview.setVerticalMotionCanBeginDrag_(YES)
     self.set_columns_draggable(False)
     self.set_auto_resizes(False)
     self.draws_selection = True
     self.row_height_set = False
     self.set_fixed_height(False)
     self.auto_resizing = False
     self.header_view = MiroTableHeaderView.alloc().initWithFrame_(
         NSMakeRect(0, 0, 0, HEADER_HEIGHT))
     self.set_show_headers(True)
     self.notifications = NotificationForwarder.create(self.tableview)
     self._selected_before_change = None
     self.model.connect_weak('row-changed', self.on_row_change)
     self.model.connect_weak('structure-will-change',
             self.on_model_structure_change)
     self.iters_to_update = []
     self.height_changed = self.reload_needed = False