本文整理汇总了Python中dialog.Dialog.set_background_title方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.set_background_title方法的具体用法?Python Dialog.set_background_title怎么用?Python Dialog.set_background_title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialog.Dialog
的用法示例。
在下文中一共展示了Dialog.set_background_title方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ask
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
def ask(self):
if hasattr(self.port, 'config'):
dialog = Dialog(dialog='dialog')
dialog.set_background_title('Conguration for {PORTNAME}'.format(PORTNAME=self.port.portname))
portchoices = []
for option, optvalues in self.port.config.items():
self.port.config[option]['user_choice'] = False
portchoices.append((option, optvalues['description'], optvalues['default']))
code, tags = dialog.checklist(
'Choose your Configuration for {PORTNAME}'.format(PORTNAME=self.port.portname),
choices=portchoices, title="Port configuration")
if code == dialog.OK:
for tag in tags:
self.port.config[tag]['user_choice'] = True
print('\n')
示例2: main
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
def main():
d = Dialog(dialog="dialog",autowidgetsize=True)
d.set_background_title("Monitman LLC -> Baba Yaga PWN")
code, tag = d.menu("Pick your poison:",
choices=[("1", "Wireless Tools"),
("2", "About PWN"),
("->", "Exit")
])
if code == d.OK:
if tag == "->":
print "Have a good day..."
sys.exit(0)
elif tag == "2":
d.msgbox("This application was written and is maintained by Monitman LLC. Send any queries, patches or suggestions to [email protected]")
main()
示例3: mainmenu
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
def mainmenu():
# NCurses Dialog Main Menu
d = Dialog(dialog="dialog", autowidgetsize="true")
d.set_background_title("Funtoo Updater 0.1")
code, tag = d.menu(
":: Choose an option ::",
choices=[
("(1)", "sync overlays"),
("(2)", "update packages"),
("(3)", "etc-update"),
("(4)", "module rebuild"),
("(5)", "preserved rebuild"),
("(6)", "check reverse dependencies"),
("(7)", "perl cleanup"),
("(8)", "kernel upgrader"),
],
)
if code == d.OK:
pass
if tag == "(1)":
eixsync()
mainmenu()
elif tag == "(2)":
updatepackages()
mainmenu()
elif tag == "(3)":
configfileupdate()
mainmenu()
elif tag == "(4)":
modulerebuild()
mainmenu()
elif tag == "(5)":
preservedrebuild()
mainmenu()
elif tag == "(6)":
checkingdependencies()
mainmenu()
elif tag == "(7)":
perlcleaner()
mainmenu()
elif tag == "(8)":
kernelupgrader()
mainmenu()
示例4: clearquit
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
text = Constants.TXT_NETWORK_CFG_ERROR
code = d.msgbox(text + results['output'])
clearquit()
# some sanity checks here, sudo only
locale.setlocale(locale.LC_ALL, '')
if os.getuid() != 0:
print(Constants.TXT_ERR_ROOT_REQUIRED)
sys.exit(1)
# display available interfaces to configure
interfaces = Interfaces()
d = Dialog(dialog='dialog', autowidgetsize=True)
d.set_background_title(Constants.TXT_BACKGROUND_TITLE)
code = d.yesno(Constants.TXT_WELCOME_TITLE,
height="15", width=65, yes_label="OK", no_label="Cancel")
if (code == Dialog.CANCEL or code == Dialog.ESC):
clearquit()
available_adapters = []
available_iface_list = run_process("ifconfig -a | grep eth")['output']
for line in available_iface_list.splitlines():
elems = line.split(' ', 1)
iface = Iface(elems[0].strip(), elems[1].strip())
available_adapters.append(iface)
示例5: commandline
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
def commandline():
TXT_WELCOME_TITLE = 'Yet Another Common Criteria Parser and Checklist Generator!\n\nThis tool helps you to generate a quick workunit checklist.\n\nUse by your own risk'
locale.setlocale(locale.LC_ALL, '')
# You may want to use 'autowidgetsize=True' here (requires pythondialog >= 3.1)
d = Dialog(dialog="dialog")
#d = Dialog(dialog='dialog', autowidgetsize=True)
# Dialog.set_background_title() requires pythondialog 2.13 or later
d.set_background_title(TXT_WELCOME_TITLE)
# For older versions, you can use:
# d.add_persistent_args(["--backtitle", "My little program"])
# In pythondialog 3.x, you can compare the return code to d.OK, Dialog.OK or
# "ok" (same object). In pythondialog 2.x, you have to use d.DIALOG_OK, which
# is deprecated since version 3.0.0.
code = d.yesno(TXT_WELCOME_TITLE,
height="15", width="65", yes_label="OK", no_label="Cancel")
if (code == Dialog.CANCEL or code == Dialog.ESC):
clearquit()
else:
code, tag = d.menu("OK, then you have four options:",
choices=[("(1)", "Parse CC into a Database"),
("(2)", "Export CC"),
("(3)", "Parse and Export"),
("(4)", "Generate Checklist")])
if code == d.OK:
if tag == "(1)":
os.system('clear')
if not (os.path.isfile("doc/cc3R4.xml")):
d.msgbox("Error loading cc3R4.xml",height="10", width="45")
sys.exit(1)
os.system("python CCParser.py -ask doc/cc3R4.xml")
d.msgbox("Generated database in data/ccdb.sqlite3",height="10", width="45")
quit()
elif tag == "(2)":
os.system('clear')
if not (os.path.isfile("data/ccdb.sqlite3")):
d.msgbox("Error loading database. Must run CCParser.py first",height="10", width="45")
sys.exit(1)
os.system("python CChtmlExport.py -ask data/ccdb.sqlite3")
d.msgbox("Generated export in output/",height="10", width="45")
quit()
elif tag == "(3)":
os.system('clear')
if not (os.path.isfile("doc/cc3R4.xml")):
d.msgbox("Error loading cc3R4.xml",height="10", width="45")
sys.exit(1)
os.system("python CCParser.py doc/cc3R4.xml && python CChtmlExport.py -ask data/ccdb.sqlite3")
d.msgbox("Generated database in data/ccdb.sqlite3 and export in output/",height="10", width="75")
quit()
elif tag == "(4)":
if not (os.path.isfile("data/ccdb.sqlite3")):
d.msgbox("Error loading database. Must run CCParser.py first",height="10", width="45")
sys.exit(1)
code, tag = d.menu("Evaluation Assurance Level:",
choices=[("(EAL1)", "Evaluation Assurance Level 1"),
("(EAL2)", "Evaluation Assurance Level 2"),
("(EAL3)", "Evaluation Assurance Level 3"),
("(EAL4)", "Evaluation Assurance Level 4"),
("(EAL5)", "Evaluation Assurance Level 5"),
("(EAL6)", "Evaluation Assurance Level 6"),
("(EAL7)", "Evaluation Assurance Level 7")])
if code == d.OK:
if tag == "(EAL1)": EALSELECTED = "EAL1"
if tag == "(EAL2)": EALSELECTED = "EAL2"
if tag == "(EAL3)": EALSELECTED = "EAL3"
if tag == "(EAL4)": EALSELECTED = "EAL4"
if tag == "(EAL5)": EALSELECTED = "EAL5"
if tag == "(EAL6)": EALSELECTED = "EAL6"
if tag == "(EAL7)": EALSELECTED = "EAL7"
code, tags = d.checklist("Family",
choices=[("ACO_DEV.1", "", False),
("ACO_DEV.2", "", False),
("ACO_DEV.3", "", False),
("ACO_REL.1", "", False),
("ACO_REL.2", "", False),
("ACO_CTT.1", "", False),
("ACO_CTT.2", "", False),
("ACO_VUL.1", "", False),
("ACO_VUL.2", "", False),
("ACO_VUL.3", "", False),
("ADV_ARC.1", "", False),
("ADV_FSP.2", "", False),
("ADV_FSP.3", "", False),
("ADV_FSP.4", "", False),
("ADV_FSP.5", "", False),
("ADV_FSP.6", "", False),
("ADV_IMP.1", "", False),
("ADV_IMP.2", "", False),
("ADV_INT.1", "", False),
#.........这里部分代码省略.........
示例6: setup_mixer
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
def setup_mixer():
for key, value in mixer_settings.items():
set_alsa_mixer(key, value)
def quit():
if d.yesno('Do you really want to quit?') == d.OK:
sys.exit(0)
def complete():
d.msgbox('Setup complete.', title="Done!");
call('/usr/bin/clear')
sys.exit(0)
d = Dialog()
d.set_background_title('UDRC Setup Utility')
welcome_text = """
Welcome to the Universal Digital Radio Controller setup utility. This program will assist \
you in the initial setup of your UDRC.
If you would like to set up a D-STAR repeater using the UDRC, this program can help you \
get things initially set up. This verbiage is going to need some work.
"""
menu_text = """
Select a type of install. You may choose to install the OpenDV components \
(ircDDBGateway and DStarRepeater) to implement a D-STAR repeater, or to just do the \
basic setup for the UDRC.
"""
d.msgbox(welcome_text, title='Welcome!', height=20, width=60)
示例7: here
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
#! /usr/bin/env python2.7
import locale
from dialog import Dialog
# This is almost always a good thing to do at the beginning of your programs.
locale.setlocale(locale.LC_ALL, "")
# You may want to use 'autowidgetsize=True' here (requires pythondialog >= 3.1)
d = Dialog(dialog="dialog")
# Dialog.set_background_title() requires pythondialog 2.13 or later
d.set_background_title("My little program")
# For older versions, you can use:
# d.add_persistent_args(["--backtitle", "My little program"])
# In pythondialog 3.x, you can compare the return code to d.OK, Dialog.OK or
# "ok" (same object). In pythondialog 2.x, you have to use d.DIALOG_OK, which
# is deprecated since version 3.0.0.
if d.yesno("Are you REALLY sure you want to see this?") == d.OK:
d.msgbox("You have been warned...")
# We could put non-empty items here (not only the tag for each entry)
code, tags = d.checklist(
"What sandwich toppings do you like?",
choices=[
("Catsup", "", False),
("Mustard", "", False),
("Pesto", "", False),
("Mayonnaise", "", True),
("Horse radish", "", True),
("Sun-dried tomatoes", "", True),
示例8: Dialog
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
#! python3 # this probably doesn't work. I could make it work for UNIX-like stuff, but nooooo we gotta use Windows
from header import *
from dialog import Dialog
from random import randrange
# import multiprocessing as mp
version = 0.0
d = Dialog(dialog="dialog") # change this to point to your dialog install if it is not in $PATH
d.set_background_title("PhysTools version "+str(version)+" :D")
d.autowidgetsize = True
# cpu_count = mp.cpu_count() # for future multithreading, possible Julia delegation
# are you ready for the ugliest function you've ever seen? get hype
# if you're just starting out go look at the header file, it actually has useful stuff and is organized
while True: # this whole thing is probably hacky af, especially with flow control
code, tag = d.menu("Choose an option. Charge units are "+chargeUnit.describe()+" and angle units are "+
angleUnit.describe()+".",
choices=[("Help", "show help information"),
("Print", "print the active objects"),
("Add", "add an object"),
("Remove", "remove an object"),
("Test", "test the field at a point"),
("Configure", "set options and modes"),
("Save", "save the active objects"),
("Load", "load objects from a file"),
("Exit", "exit")],
title="Main Menu")
if code != d.OK or tag == "Exit":
示例9: catch_ctrl_c
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
import locale
from dialog import Dialog
import shelve
import signal
import sys
#disable ctrl+c so that it will be passed to the container/vm. It will exit from either killing the process over ssh or a button in the main menu.
def catch_ctrl_c(sig, frame):
pass
signal.signal(signal.SIGINT, catch_ctrl_c)
locale.setlocale(locale.LC_ALL, '')
d = Dialog(dialog="dialog",autowidgetsize=True)
d.set_background_title("PVE Virtual Console")
action = ''
vmid = ''
ip = ''
while True:
code, action = d.menu("Choose action:",
choices=[("Connect to a VM/CT", ""),
("Get VM/CT list", ""),
("Configure Tool", ""),
("Exit Tool", "")])
if action == "Connect to a VM/CT":
with shelve.open('pvcdb') as db:
data = db['vmctlist']
示例10: call
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
d.gauge_start("Installing...")
call(["apt-get", "upgrade"])
packages = ["git", "mercurial", "subversion", "mariadb-client", "libapache2-mod-php5",
"php5-curl", "php5-mysql", "php5-cli", "git-daemon-run", "gitweb", "php-pear", "patch", "mariadb-server",
"libapache2-mod-svn"]
percent = 0
i = 0.0
for package in packages:
d.gauge_update(percent, "Installing " + package, update_text=True)
install_package(package)
i += 1.0
percent = int((i / len(packages)) * 100)
d.gauge_stop()
d.set_background_title("Srchub Installer")
d.msgbox("""This will guide you through installing srchub
Any comments should be directed towards
[email protected]""")
with open('/etc/issue', 'r') as content_file:
issue_file = content_file.read()
if "Debian" in issue_file or "Ubuntu" in issue_file:
distro = "Debian"
else:
code = d.yesno("""This script was designed for Debian/Ubuntu but it seems you are using a different distro.\n
However - you may still attempt to run it if you know what you are doing.\n\n
I recommend canceling and emailing the author and telling them the name of your distro which is:\n """ + issue_file)
示例11: Dialog
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
# This program is in the public domain.
from __future__ import unicode_literals
import sys, locale
from dialog import Dialog
# This is almost always a good thing to do at the beginning of your programs.
locale.setlocale(locale.LC_ALL, '')
# Initialize a dialog.Dialog instance
#
# With the 'autowidgetsize' option enabled, pythondialog's widget-producing
# methods behave as if width=0, height=0, etc. had been passed, except where
# these parameters are explicitely specified with different values.
d = Dialog(dialog="dialog", autowidgetsize=True)
d.set_background_title("A Simple Example")
# *****************************************************************************
# * 'msgbox' example *
# *****************************************************************************
d.msgbox("""\
This is a very simple example of a program using pythondialog.
Contrary to what is done in demo.py, the Dialog exit code for the Escape key \
is not checked after every call, therefore it is not so easy to exit from \
this program as it is for the demo. The goal here is to show basic \
pythondialog usage in its simplest form.
With not too old versions of dialog, the size of dialog boxes is \
automatically computed when one passes width=0 and height=0 to the \
示例12: main
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
def main():
player = auth()
game(player)
if __name__ == '__main__':
# Check for first launch...
if not os.path.exists("./databases"):
init()
print("Le logiciel est initialisé correctement !")
print("Lancement en cours...")
time.sleep(1)
d = Dialog(dialog="dialog", autowidgetsize=True) # , autowidgetsize=True
d.set_background_title("TheoRPG")
client = Client('https://49aa914786e14bd693802f876db91c13:[email protected]/70494')
try:
main()
except Exception as e:
os.system('cls' if os.name == 'nt' else 'clear') # Efface l'écran
print("Malheureusement, une erreur est survenue (" + str(e) + "). Nous nous en excusons. Veuillez envoyer le rapport d'erreur suivant ainsi qu'un bref résumé des vos actions sur GitHub en suivant le lien suivant : https://github.com/paris-ci/projet-isn/issues")
#client.user_context({
# 'last_steps': input("Que venez vous de faire juste avant l'erreur ? >")
#})
time.sleep(2)
print("=== DEBUT RAPPORT ERREUR ENVOYE AUTOMATIQUEMENT===")
client.captureException()
raise
示例13: DialogCommunicator
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
class DialogCommunicator(QuietCommunicator):
def __init__(self):
# some constant definitions to avoid using magic numbers
# for the DialogCommunicator mixedgauge dialog
self.WAIT = 7
self.DONE = 0
self.FAIL = 1
self.d = Dialog(dialog="dialog")
self.d.set_background_title("kotnetcli")
self.netlogin = self.WAIT
self.kuleuven = self.WAIT
self.invoeren = self.WAIT
self.opsturen = self.WAIT
self.download = self.WAIT
self.upload = self.WAIT
self.overal = 0
self.update()
def update(self):
self.d.mixedgauge("",
title="kotnetcli",
percent= self.overal,
elements= [ ("Netlogin openen", self.netlogin),
("KU Leuven kiezen", self.kuleuven),
("Gegevens invoeren", self.invoeren),
("Gegevens opsturen", self.opsturen),
("", ""),
("Download", self.download),
("Upload", self.upload)
])
def eventPingFailure(self):
self.d.infobox("Niet verbonden met het KU Leuven-netwerk.", 5, 30)
def eventPingAlreadyOnline(self):
self.d.infobox("U bent al online.", 5, 30)
def eventNetloginSuccess(self):
self.netlogin = self.DONE
self.overal = 40
self.update()
def eventNetloginFailure(self):
self.netlogin = self.FAIL
self.overal = 40
self.update()
def eventKuleuvenSuccess(self):
self.kuleuven = self.DONE
self.overal = 60
self.update()
def eventKuleuvenFailure(self):
self.kuleuven = self.FAIL
self.overal = 60
self.update()
def eventInvoerenSuccess(self):
self.invoeren = self.DONE
self.overal = 80
self.update()
def eventInvoerenFailure(self):
self.invoeren = self.FAIL
self.overal = 80
self.update()
def eventOpsturenSuccess(self):
self.opsturen = self.DONE
self.overal = 100
self.update()
def eventOpsturenFailure(self):
self.opsturen = self.FAIL
self.overal = 100
self.update()
def eventTegoedenBekend(self, downloadpercentage, uploadpercentage):
self.download = -downloadpercentage
self.upload = -uploadpercentage
self.overal = 100
self.update()
def beeindig_sessie(self, error_code=0):
print "" # print newline to clean prompt under dialog
示例14: Dialog
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
}
}
"""
## Wizard
import locale, dialog
from dialog import Dialog
import sys
config = {}
locale.setlocale(locale.LC_ALL, '')
d = Dialog(dialog="dialog")
d.set_background_title("pizza-auth configuration wizard")
d.msgbox("Welcome to the configuration interface for pizza-auth.")
config["auth"] = {}
code, tag = d.menu("Are you running this for a corp or alliance?",
choices = [("1.", "Corporation"),
("2.", "Alliance")])
if code != d.OK:
sys.exit()
if tag == "1.":
mode = "corp"
config["auth"]["corp"] = d.inputbox("What is your corporation's name?")
config["auth"]["allianceshort"] = d.inputbox("What is your corporation's ticker?")
示例15: disclaimer
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import set_background_title [as 别名]
def disclaimer():
d = Dialog(dialog="dialog",autowidgetsize=True)
d.set_background_title("Monitman LLC -> Baba Yaga PWN")
d.msgbox("Legal Disclaimer: This application is intended for use by security professionals, it's aim is to assist them in easily finding security problems and testing the security of both people and systems. Please use this application in accordance with your local/state/federal laws.")