import urwid

from arthur.ui import DIVIDER


class SearchTool(object):
    name = u"Mission search"
    position = ("relative", 20), 30, "middle", 10

    def __init__(self):
        title = urwid.Text(u"Mission search")
        search = urwid.Edit(u"Search terms: ", multiline=False)
        self.pile = urwid.Pile([title, DIVIDER, search])
        self.widget = urwid.LineBox(urwid.Filler(self.pile))

from arthur.ui import Prompt


class SearchTool(Prompt):
    position = ("relative", 20), 30, "middle", 10

    def __init__(self):
        Prompt.__init__(self, u"Mission search", u"Search terms: ")

Refactor search tool in terms of prompt
Refactor search tool in terms of prompt

- import urwid
- 
- from arthur.ui import DIVIDER
+ from arthur.ui import Prompt
  
  
- class SearchTool(object):
+ class SearchTool(Prompt):
-     name = u"Mission search"
      position = ("relative", 20), 30, "middle", 10
  
      def __init__(self):
+         Prompt.__init__(self, u"Mission search", u"Search terms: ")
-         title = urwid.Text(u"Mission search")
-         search = urwid.Edit(u"Search terms: ", multiline=False)
-         self.pile = urwid.Pile([title, DIVIDER, search])
-         self.widget = urwid.LineBox(urwid.Filler(self.pile))
  
Refactor search tool in terms of prompt
## Code Before:
import urwid

from arthur.ui import DIVIDER


class SearchTool(object):
    name = u"Mission search"
    position = ("relative", 20), 30, "middle", 10

    def __init__(self):
        title = urwid.Text(u"Mission search")
        search = urwid.Edit(u"Search terms: ", multiline=False)
        self.pile = urwid.Pile([title, DIVIDER, search])
        self.widget = urwid.LineBox(urwid.Filler(self.pile))

## Instruction:
Refactor search tool in terms of prompt
## Code After:
from arthur.ui import Prompt


class SearchTool(Prompt):
    position = ("relative", 20), 30, "middle", 10

    def __init__(self):
        Prompt.__init__(self, u"Mission search", u"Search terms: ")
