コード例 #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
コード例 #2
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
コード例 #3
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
コード例 #4
0
def setup(text):
    """Create window for Find"""
    root = text._root()
    engine = searchengine.get(root)
    if not hasattr(engine, "_searchdialog"):
        engine._searchdialog = SearchDialog(root, engine)
    return engine._searchdialog
コード例 #5
0
ファイル: search.py プロジェクト: 1st1/cpython
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
コード例 #6
0
ファイル: search.py プロジェクト: JasonZhou0/CM01
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
コード例 #7
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)
コード例 #8
0
ファイル: grep.py プロジェクト: JSMSC/cpython
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)
コード例 #9
0
def replace(text):
    """Create window for Replace"""
    root = text._root()
    engine = searchengine.get(root)
    if not hasattr(engine, "_replacedialog"):
        engine._replacedialog = ReplaceDialog(root, engine)
    dialog = engine._replacedialog
    dialog.open(text)
コード例 #10
0
ファイル: replace.py プロジェクト: Darkness0ut/cpython
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)
コード例 #11
0
ファイル: replace.py プロジェクト: iflat/idlecn
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)
コード例 #12
0
    def __init__(self, parent):
        import re
        from idlelib import searchengine

        self.root = parent
        self.engine = searchengine.get(parent)
        self.create_widgets()
        print(parent.geometry())
        width,height, x,y = list(map(int, re.split('[x+]', parent.geometry())))
        self.top.geometry("+%d+%d" % (x + 40, y + 175))
コード例 #13
0
ファイル: searchbase.py プロジェクト: 1st1/cpython
    def __init__(self, parent):
        import re
        from idlelib import searchengine

        self.root = parent
        self.engine = searchengine.get(parent)
        self.create_widgets()
        print(parent.geometry())
        width,height, x,y = list(map(int, re.split('[x+]', parent.geometry())))
        self.top.geometry("+%d+%d" % (x + 40, y + 175))
コード例 #14
0
ファイル: search.py プロジェクト: BingoTop/Bookmark
def _setup(text):
    """Return the new or existing singleton SearchDialog instance.

    The singleton dialog saves user entries and preferences
    across instances.

    Args:
        text: Text widget containing the text to be searched.
    """
    root = text._root()
    engine = searchengine.get(root)
    if not hasattr(engine, "_searchdialog"):
        engine._searchdialog = SearchDialog(root, engine)
    return engine._searchdialog
コード例 #15
0
ファイル: search.py プロジェクト: willingc/cpython
def _setup(text):
    """Return the new or existing singleton SearchDialog instance.

    The singleton dialog saves user entries and preferences
    across instances.

    Args:
        text: Text widget containing the text to be searched.
    """
    root = text._root()
    engine = searchengine.get(root)
    if not hasattr(engine, "_searchdialog"):
        engine._searchdialog = SearchDialog(root, engine)
    return engine._searchdialog
コード例 #16
0
def replace(text):
    """Create or reuse a singleton ReplaceDialog instance.

    The singleton dialog saves user entries and preferences
    across instances.

    Args:
        text: Text widget containing the text to be searched.
    """
    root = text._root()
    engine = searchengine.get(root)
    if not hasattr(engine, "_replacedialog"):
        engine._replacedialog = ReplaceDialog(root, engine)
    dialog = engine._replacedialog
    dialog.open(text)
コード例 #17
0
ファイル: replace.py プロジェクト: willingc/cpython
def replace(text):
    """Create or reuse a singleton ReplaceDialog instance.

    The singleton dialog saves user entries and preferences
    across instances.

    Args:
        text: Text widget containing the text to be searched.
    """
    root = text._root()
    engine = searchengine.get(root)
    if not hasattr(engine, "_replacedialog"):
        engine._replacedialog = ReplaceDialog(root, engine)
    dialog = engine._replacedialog
    dialog.open(text)
コード例 #18
0
def grep(text, io=None, flist=None):
    """Create or find singleton GrepDialog instance.

    Args:
        text: Text widget that contains the selected text for
              default search phrase.
        io: iomenu.IOBinding instance with default path to search.
        flist: filelist.FileList instance for OutputWindow parent.
    """

    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)
コード例 #19
0
ファイル: grep.py プロジェクト: zhangzhao2014/cpython
def grep(text, io=None, flist=None):
    """Open the Find in Files dialog.

    Module-level function to access the singleton GrepDialog
    instance and open the dialog.  If text is selected, it is
    used as the search phrase; otherwise, the previous entry
    is used.

    Args:
        text: Text widget that contains the selected text for
              default search phrase.
        io: iomenu.IOBinding instance with default path to search.
        flist: filelist.FileList instance for OutputWindow parent.
    """
    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)