本文整理汇总了Python中dialog.Dialog.mixedform方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.mixedform方法的具体用法?Python Dialog.mixedform怎么用?Python Dialog.mixedform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialog.Dialog
的用法示例。
在下文中一共展示了Dialog.mixedform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SBoTemplates
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import mixedform [as 别名]
#.........这里部分代码省略.........
"Maintainer": self.maintainerData,
"Directory": self.__updateDirectory,
"Help": self.getHelp,
"Exit": self.exit,
}
case[tag]()
def exit(self):
os.system("clear")
sys.exit(0)
def getHelp(self):
"""get help from slackbuilds.org
"""
self.msg = ("For additional assistance, visit: http://www.slackbuilds."
"org/guidelines/")
self.width = len(self.msg) + 4
self.height = 7
self.messageBox()
self.menu()
def __updateDirectory(self):
"""update working direcroty
"""
self.height = 10
self.comments = "Current directory: {0}".format(self.pwd)
field_length = 90
input_length = 90
attributes = '0x0'
self.elements = [
("Directory=", 1, 1, "", 1, 11, field_length, input_length,
attributes),
]
self.mixedform()
if self.fields:
self.pwd = self.fields[0].strip()
if self.pwd and not self.pwd.endswith("/"):
self.pwd = self.pwd + "/"
self.width = 60
self.height = 6
self.msg = "Current directory: {0}".format(self.pwd)
self.messageBox()
self.menu()
def maintainerData(self):
"""Maintainer data handler
"""
cache_dir = self.pwd
self.pwd = ""
self.height = 15
self.filename = "{0}.sbo-maintainer".format(self.HOME)
self.comments = ("Enter the details of the maintainer and change "
"editor, \ndefault is 'nano'.")
self.width = 90
field_length = 90
input_length = 90
attributes = '0x0'
text = ["MAINTAINER=", "EMAIL=", "LIVE=", "EDITOR="]
self.elements = [
(text[0], 1, 1, self.maintainer, 1, 12, field_length, input_length,
attributes),
(text[1], 2, 1, self.email, 2, 7, field_length, input_length,
attributes),
(text[2], 3, 1, self.live, 3, 6, field_length, input_length,
attributes),
(text[3], 4, 1, self.editor, 4, 8, field_length, input_length,
示例2: get_info_via_dialog
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import mixedform [as 别名]
def get_info_via_dialog():
global server
global username
global password
global user # chmod user
global cred_file
global mount_folder
global create_mount_fld_as_sharename
global fstab_loc
from dialog import Dialog
d = Dialog(dialog="dialog")
button_names = {d.OK: "OK",
d.CANCEL: "Cancel",
d.HELP: "Help",
d.EXTRA: "Extra"}
code, tag = d.mixedform("What sandwich toppings do you like?",
[("Server", 1, 1, "",1, 10, 20, 20, 0),
("Username", 2, 1, "",2, 10, 20, 20, 0),
("Password", 3, 1, "", 3, 10, 20, 20, 1)
]
)
import pprint
pprint.pprint(code)
pprint.pprint(tag[1])
if tag[0] != '' and tag[1] != '' and tag[2] != '':
server = tag[0]
username = tag[1]
password = tag[2]
else:
sys.exit("Please specify all the input box's")
code, tag = d.inputbox("Please enter the username who will have R/W access to the mounts")
pprint.pprint(code)
pprint.pprint(tag)
#need to add checks for user
user = tag
code, tag = d.inputbox("Please enter the filename only, it will be edited to add the username and password\n and will be user in fstab or mount cmd")
if tag != '':
cred_file = tag
code, tag = d.fselect('/etc/fstab')
if tag != '':
fstab_loc = tag
import pathlib
code, tag = d.dselect('/media')
if tag != '' and pathlib.Path(tag).is_dir():
mount_folder = tag
else:
sys.exit("Please select a folder to mount!")
pprint.pprint(code)
pprint.pprint(tag)