mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 15:22:38 -04:00
IDisplay
This commit is contained in:
parent
aabe83c444
commit
7c3abe7ba7
2 changed files with 40 additions and 33 deletions
|
|
@ -1,46 +1,20 @@
|
|||
import textwrap
|
||||
|
||||
import dialog
|
||||
import zope.interface
|
||||
|
||||
from letsencrypt.client import interfaces
|
||||
|
||||
|
||||
WIDTH = 72
|
||||
HEIGHT = 20
|
||||
|
||||
|
||||
class Display(object):
|
||||
"""Generic display."""
|
||||
|
||||
def generic_notification(self, message):
|
||||
raise NotImplementedError()
|
||||
|
||||
def generic_menu(self, message, choices, input_text=""):
|
||||
raise NotImplementedError()
|
||||
|
||||
def generic_input(self, message):
|
||||
raise NotImplementedError()
|
||||
|
||||
def generic_yesno(self, message, yes_label="Yes", no_label="No"):
|
||||
raise NotImplementedError()
|
||||
|
||||
def filter_names(self, names):
|
||||
raise NotImplementedError()
|
||||
|
||||
def success_installation(self, domains):
|
||||
raise NotImplementedError()
|
||||
|
||||
def display_certs(self, certs):
|
||||
raise NotImplementedError()
|
||||
|
||||
def confirm_revocation(self, cert):
|
||||
raise NotImplementedError()
|
||||
|
||||
def more_info_cert(self, cert):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class NcursesDisplay(Display):
|
||||
class NcursesDisplay(object):
|
||||
zope.interface.implements(interfaces.IDisplay)
|
||||
|
||||
def __init__(self, width=WIDTH, height=HEIGHT):
|
||||
super(NcursesDisplay, self).__init__()
|
||||
self.dialog = dialog.Dialog()
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
|
@ -112,9 +86,11 @@ class NcursesDisplay(Display):
|
|||
self.dialog.msgbox(text, width=self.width, height=self.height)
|
||||
|
||||
|
||||
class FileDisplay(Display):
|
||||
class FileDisplay(object):
|
||||
zope.interface.implements(interfaces.IDisplay)
|
||||
|
||||
def __init__(self, outfile):
|
||||
super(FileDisplay, self).__init__()
|
||||
self.outfile = outfile
|
||||
|
||||
def generic_notification(self, message):
|
||||
|
|
|
|||
|
|
@ -103,6 +103,37 @@ class IConfigurator(zope.interface.Interface):
|
|||
"""Cleanup configuration changes from challenge."""
|
||||
|
||||
|
||||
class IDisplay(zope.interface.Interface):
|
||||
"""Generic display."""
|
||||
|
||||
def generic_notification(message):
|
||||
pass
|
||||
|
||||
def generic_menu(message, choices, input_text=""):
|
||||
pass
|
||||
|
||||
def generic_input(message):
|
||||
pass
|
||||
|
||||
def generic_yesno(message, yes_label="Yes", no_label="No"):
|
||||
pass
|
||||
|
||||
def filter_names(names):
|
||||
pass
|
||||
|
||||
def success_installation(domains):
|
||||
pass
|
||||
|
||||
def display_certs(certs):
|
||||
pass
|
||||
|
||||
def confirm_revocation(cert):
|
||||
pass
|
||||
|
||||
def more_info_cert(cert):
|
||||
pass
|
||||
|
||||
|
||||
class IValidator(object):
|
||||
"""Configuration validator."""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue