Ejemplo n.º 1
0
 def performFindPanelAction_(self, sender):
     # frustrating bug:
     # when the find bar is dismissed with esc, the *other* textview becomes
     # first responder. the `solution' here is to monitor the find bar's field
     # editor and notice when it is detached from the view hierarchy. it then
     # re-sets itself as first responder
     super(OutputTextView, self).performFindPanelAction_(sender)
     if self._findTimer:
         self._findTimer.invalidate()
     self._findEditor = self.window().firstResponder().superview().superview()
     self._findTimer = set_timeout(self, 'stillFinding:', 0.05, repeat=True)
Ejemplo n.º 2
0
 def performFindPanelAction_(self, sender):
     # frustrating bug:
     # when the find bar is dismissed with esc, the *other* textview becomes
     # first responder. the `solution' here is to monitor the find bar's field
     # editor and notice when it is detached from the view hierarchy. it then
     # re-sets itself as first responder
     super(OutputTextView, self).performFindPanelAction_(sender)
     if self._findTimer:
         self._findTimer.invalidate()
     self._findEditor = self.window().firstResponder().superview(
     ).superview()
     self._findTimer = set_timeout(self, 'stillFinding:', 0.05, repeat=True)
Ejemplo n.º 3
0
    def awakeFromNib(self):
        self.webview = DraggyWebView.alloc().initWithFrame_(self.bounds())
        self.webview.setAllowsUndo_(False)
        self.webview.setFrameLoadDelegate_(self)
        self.webview.setUIDelegate_(self)
        self.addSubview_(self.webview)
        self.webview.setHidden_(True)

        html = bundle_path(rsrc='ui/editor.html')
        ui = file(html).read().decode('utf-8')
        baseurl = NSURL.fileURLWithPath_(os.path.dirname(html))
        self.webview.mainFrame().loadHTMLString_baseURL_(ui, baseurl)

        # set a theme-derived background for the webview's clipview
        docview = self.webview.mainFrame().frameView().documentView()
        clipview = docview.superview()
        scrollview = clipview.superview()
        if clipview is not None:
            bgcolor = editor_info('colors')['background']
            clipview.setDrawsBackground_(True)
            clipview.setBackgroundColor_(bgcolor)
            scrollview.setVerticalScrollElasticity_(1)
            scrollview.setScrollerKnobStyle_(2)

        nc = NSNotificationCenter.defaultCenter()
        nc.addObserver_selector_name_object_(self, "themeChanged",
                                             "ThemeChanged", None)
        nc.addObserver_selector_name_object_(self, "fontChanged",
                                             "FontChanged", None)
        nc.addObserver_selector_name_object_(self, "bindingsChanged",
                                             "BindingsChanged", None)
        nc.addObserver_selector_name_object_(self, "insertDroppedFiles:",
                                             "DropOperation", self.webview)
        self._wakeup = set_timeout(self, '_jostle', .05, repeat=True)
        self._queue = []
        self._edits = 0
        self.themeChanged()
        self.fontChanged()
        self.bindingsChanged()

        mm = NSApp().mainMenu()
        self._doers = mm.itemWithTitle_('Edit').submenu().itemArray()[1:3]
        self._undo_mgr = None
Ejemplo n.º 4
0
    def awakeFromNib(self):
        self.webview = DraggyWebView.alloc().initWithFrame_(self.bounds())
        self.webview.setAllowsUndo_(False)
        self.webview.setFrameLoadDelegate_(self)
        self.webview.setUIDelegate_(self)
        self.addSubview_(self.webview)
        self.webview.setHidden_(True)

        html = bundle_path(rsrc='ui/editor.html')
        ui = file(html).read().decode('utf-8')
        baseurl = NSURL.fileURLWithPath_(os.path.dirname(html))
        self.webview.mainFrame().loadHTMLString_baseURL_(ui, baseurl)

        # set a theme-derived background for the webview's clipview
        docview = self.webview.mainFrame().frameView().documentView()
        clipview = docview.superview()
        scrollview = clipview.superview()
        if clipview is not None:
            bgcolor = editor_info('colors')['background']
            clipview.setDrawsBackground_(True)
            clipview.setBackgroundColor_(bgcolor)
            scrollview.setVerticalScrollElasticity_(1)
            scrollview.setScrollerKnobStyle_(2)

        nc = NSNotificationCenter.defaultCenter()
        nc.addObserver_selector_name_object_(self, "themeChanged", "ThemeChanged", None)
        nc.addObserver_selector_name_object_(self, "fontChanged", "FontChanged", None)
        nc.addObserver_selector_name_object_(self, "bindingsChanged", "BindingsChanged", None)
        nc.addObserver_selector_name_object_(self, "insertDroppedFiles:", "DropOperation", self.webview)
        self._wakeup = set_timeout(self, '_jostle', .05, repeat=True)
        self._queue = []
        self._edits = 0
        self.themeChanged()
        self.fontChanged()
        self.bindingsChanged()

        mm=NSApp().mainMenu()
        self._doers = mm.itemWithTitle_('Edit').submenu().itemArray()[1:3]
        self._undo_mgr = None
Ejemplo n.º 5
0
 def begin(self, frames=None, pages=None):
     from plotdevice.gui import set_timeout
     self.total = frames if frames is not None else pages
     self.poll = set_timeout(self, "update:", 0.1, repeat=True)
Ejemplo n.º 6
0
 def begin(self, frames=None, pages=None):
     from plotdevice.gui import set_timeout
     self.total = frames if frames is not None else pages
     self.poll = set_timeout(self, "update:", 0.1, repeat=True)