Esempio n. 1
0
 def test_get(self):
     saved_Engine = se.SearchEngine
     se.SearchEngine = Mock
     try:
         root = Mock()
         engine = se.get(root)
         self.assertIsInstance(engine, se.SearchEngine)
         self.assertIs(root._searchengine, engine)
         self.assertIs(se.get(root), engine)
     finally:
         se.SearchEngine = saved_Engine
 def test_get(self):
     saved_Engine = se.SearchEngine
     se.SearchEngine = Mock  # monkey-patch class
     try:
         root = Mock()
         engine = se.get(root)
         self.assertIsInstance(engine, se.SearchEngine)
         self.assertIs(root._searchengine, engine)
         self.assertIs(se.get(root), engine)
     finally:
         se.SearchEngine = saved_Engine  # restore class to module
Esempio n. 3
0
 def test_get(self):
     saved_Engine = se.SearchEngine
     se.SearchEngine = Mock
     try:
         root = Mock()
         engine = se.get(root)
         self.assertIsInstance(engine, se.SearchEngine)
         self.assertIs(root._searchengine, engine)
         self.assertIs(se.get(root), engine)
     finally:
         se.SearchEngine = saved_Engine
Esempio n. 4
0
 def test_get(self):
     saved_Engine = se.SearchEngine
     se.SearchEngine = Mock  # monkey-patch class
     try:
         root = Mock()
         engine = se.get(root)
         self.assertIsInstance(engine, se.SearchEngine)
         self.assertIs(root._searchengine, engine)
         self.assertIs(se.get(root), engine)
     finally:
         se.SearchEngine = saved_Engine  # restore class to module
Esempio n. 5
0
def replace(text):
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, "_replacedialog"):
        engine._replacedialog = ReplaceDialog(root, engine)
    dialog = engine._replacedialog
    dialog.open(text)
Esempio n. 6
0
def replace(text):
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, "_replacedialog"):
        engine._replacedialog = ReplaceDialog(root, engine)
    dialog = engine._replacedialog
    dialog.open(text)
Esempio n. 7
0
def _setup(text):
    "Create or find the singleton SearchDialog instance."
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, "_searchdialog"):
        engine._searchdialog = SearchDialog(root, engine)
    return engine._searchdialog
Esempio n. 8
0
def grep(text, io=None, flist=None):
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, "_grepdialog"):
        engine._grepdialog = GrepDialog(root, engine, flist)
    dialog = engine._grepdialog
    searchphrase = text.get("sel.first", "sel.last")
    dialog.open(text, searchphrase, io)
Esempio n. 9
0
def grep(text, io=None, flist=None):
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, '_grepdialog'):
        engine._grepdialog = GrepDialog(root, engine, flist)
    dialog = engine._grepdialog
    searchphrase = text.get('sel.first', 'sel.last')
    dialog.open(text, searchphrase, io)
Esempio n. 10
0
def replace(text):
    """Returns a singleton ReplaceDialog instance.The single dialog
     saves user entries and preferences across instances."""
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, "_replacedialog"):
        engine._replacedialog = ReplaceDialog(root, engine)
    dialog = engine._replacedialog
    dialog.open(text)
Esempio n. 11
0
def replace(text):
    """Returns a singleton ReplaceDialog instance.The single dialog
     saves user entries and preferences across instances."""
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, "_replacedialog"):
        engine._replacedialog = ReplaceDialog(root, engine)
    dialog = engine._replacedialog
    dialog.open(text)
Esempio n. 12
0
def _setup(text):
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, "_searchdialog"):
        engine._searchdialog = SearchDialog(root, engine)
    return engine._searchdialog
Esempio n. 13
0
def _setup(text):
    root = text._root()
    engine = SearchEngine.get(root)
    if not hasattr(engine, '_searchdialog'):
        engine._searchdialog = SearchDialog(root, engine)
    return engine._searchdialog