本文整理汇总了Python中ubiquity.filteredcommand.FilteredCommand.run方法的典型用法代码示例。如果您正苦于以下问题:Python FilteredCommand.run方法的具体用法?Python FilteredCommand.run怎么用?Python FilteredCommand.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ubiquity.filteredcommand.FilteredCommand
的用法示例。
在下文中一共展示了FilteredCommand.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question == 'grub-installer/bootdev':
# Force to the default in the case of an unsupported OS.
if self.db.get(question) == '':
self.preseed(question, misc.grub_default())
return FilteredCommand.run(self, priority, question)
示例2: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self,priority,question):
if question.startswith('lirc/remote'):
device=self.frontend.get_lirc("remote")
if question.startswith('lirc/remote_modules'):
self.preseed('lirc/remote_modules',device["modules"])
elif question.startswith('lirc/remote_lircd_conf'):
self.preseed('lirc/remote_lircd_conf',device["lircd_conf"])
elif question.startswith('lirc/remote_driver'):
self.preseed('lirc/remote_driver',device["driver"])
elif question.startswith('lirc/remote_device'):
self.preseed('lirc/remote_device',device["device"])
elif question.startswith('lirc/remote'):
self.preseed('lirc/remote',device["remote"])
elif question.startswith('lirc/transmitter'):
device=self.frontend.get_lirc("transmitter")
if question.startswith('lirc/transmitter_modules'):
self.preseed('lirc/transmitter_modules',device["modules"])
elif question.startswith('lirc/transmitter_lircd_conf'):
self.preseed('lirc/transmitter_lircd_conf',device["lircd_conf"])
elif question.startswith('lirc/transmitter_driver'):
self.preseed('lirc/transmitter_driver',device["driver"])
elif question.startswith('lirc/transmitter_device'):
self.preseed('lirc/transmitter_device',device["device"])
elif question.startswith('lirc/transmitter'):
self.preseed('lirc/transmitter',device["transmitter"])
return FilteredCommand.run(self, priority, question)
示例3: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question.endswith('/apt-install-failed'):
return self.error(priority, question)
elif question == 'migration-assistant/failed-unmount':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
('ubiquity/text/go_back', 'ubiquity/text/continue'))
if response is None or response == 'ubiquity/text/continue':
self.preseed(question, 'true')
else:
self.preseed(question, 'false')
return True
elif question == 'ubiquity/install/copying_error/md5':
response = self.frontend.question_dialog(
self.description(question),
# TODO evand 2008-02-14: i18n.
self.extended_description(question),
('Abort', 'Retry', 'Skip'),
use_templates=False)
if response is None or response == 'Abort':
self.preseed(question, 'abort')
elif response == 'Retry':
self.preseed(question, 'retry')
elif response == 'Skip':
self.preseed(question, 'skip')
return True
return FilteredCommand.run(self, priority, question)
示例4: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if self.done:
return self.succeeded
if question == 'console-setup/layout':
# Reset this in case we just backed up from the variant
# question.
self.succeeded = True
# TODO cjwatson 2006-09-07: no console-setup support for layout
# choice translation yet
self.frontend.set_keyboard_choices(
self.choices_untranslated(question))
self.frontend.set_keyboard(self.db.get(question))
return True
elif question == 'console-setup/variant':
# TODO cjwatson 2006-10-02: no console-setup support for variant
# choice translation yet
self.frontend.set_keyboard_variant_choices(
self.choices_untranslated(question))
self.frontend.set_keyboard_variant(self.db.get(question))
# console-setup preseeding is special, and needs to be checked
# by hand. The seen flag on console-setup/layout is used
# internally by console-setup, so we can't just force it to
# true.
if ('UBIQUITY_AUTOMATIC' in os.environ and
self.db.fget('console-setup/layoutcode', 'seen') == 'true'):
return True
else:
return FilteredCommand.run(self, priority, question)
else:
return True
示例5: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question == 'grub-installer/bootdev':
# Force to (hd0) in the case of an unsupported OS.
if self.db.get(question) == '':
self.preseed(question, '(hd0)')
return FilteredCommand.run(self, priority, question)
示例6: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question.endswith('/summary'):
text = ''
wrapper = textwrap.TextWrapper(width=76)
for line in self.extended_description(question).split("\n"):
text += wrapper.fill(line) + "\n"
self.frontend.set_summary_text(text)
if os.access('/usr/share/grub-installer/grub-installer', os.X_OK):
# TODO cjwatson 2006-09-04: a bit inelegant, and possibly
# Ubuntu-specific?
self.frontend.set_summary_device('(hd0)')
else:
self.frontend.set_summary_device(None)
self.frontend.set_grub_combo(grub_options())
if will_be_installed('popularity-contest'):
try:
participate = self.db.get('popularity-contest/participate')
self.frontend.set_popcon(participate == 'true')
except debconf.DebconfError:
self.frontend.set_popcon(None)
else:
self.frontend.set_popcon(None)
# This component exists only to gather some information and then
# get out of the way.
#return True
return FilteredCommand.run(self, priority, question)
示例7: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
syslog.syslog("-------> run guadaPrePartition")
if question.startswith('guada-ubiquity/prepartition'):
#advanced = self.frontend.get_advanced()
#self.preseed_bool('mythbuntu/advanced_install', advanced)
print "question"
return FilteredCommand.run(self, priority, question)
示例8: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if self.done:
return self.succeeded
if question.startswith('partman/confirm'):
if question == 'partman/confirm':
self.db.set('ubiquity/partman-made-changes', 'true')
else:
self.db.set('ubiquity/partman-made-changes', 'false')
self.preseed(question, 'true')
return True
elif question == 'partman/exception_handler':
if priority == 'critical' or priority == 'high':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
self.choices(question), use_templates=False)
self.preseed(question, response, seen=False)
else:
self.preseed(question, 'unhandled', seen=False)
return True
elif question == 'partman/exception_handler_note':
if priority == 'critical' or priority == 'high':
self.frontend.error_dialog(self.description(question),
self.extended_description(question))
return FilteredCommand.error(self, priority, question)
else:
return True
elif self.question_type(question) == 'boolean':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
('ubiquity/text/go_back', 'ubiquity/text/continue'))
answer_reversed = False
if (question == 'partman-jfs/jfs_boot' or
question == 'partman-jfs/jfs_root'):
answer_reversed = True
if response is None or response == 'ubiquity/text/continue':
answer = answer_reversed
else:
answer = not answer_reversed
self.succeeded = False
self.done = True
self.frontend.return_to_partitioning()
if answer:
self.preseed(question, 'true')
else:
self.preseed(question, 'false')
return True
else:
return FilteredCommand.run(self, priority, question)
示例9: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question.endswith('/apt-install-failed'):
return self.error(priority, question)
elif question == 'ubiquity/install/new-bootdev':
current_device = self.db.get(question)
response = self.frontend.bootloader_dialog(current_device)
self.preseed(question, response)
return True
return FilteredCommand.run(self, priority, question)
示例10: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question.endswith("/summary"):
text = ""
wrapper = textwrap.TextWrapper(width=76)
for line in self.extended_description(question).split("\n"):
text += wrapper.fill(line) + "\n"
self.frontend.set_summary_text(text)
useRaid = self.db.get("ubiquity/use_raid")
if useRaid != "true":
self.frontend.set_summary_text(text)
try:
install_bootloader = self.db.get("ubiquity/install_bootloader")
self.frontend.set_grub(install_bootloader == "true")
except debconf.DebconfError:
self.frontend.set_grub(None)
if os.access("/usr/share/grub-installer/grub-installer", os.X_OK):
# TODO cjwatson 2006-09-04: a bit inelegant, and possibly
# Ubuntu-specific?
if installing_from_disk():
self.frontend.set_summary_device(find_grub_target())
else:
self.frontend.set_summary_device("(hd0)")
else:
self.frontend.set_summary_device(None)
self.frontend.set_grub_combo(grub_options())
if will_be_installed("popularity-contest"):
try:
participate = self.db.get("popularity-contest/participate")
self.frontend.set_popcon(participate == "true")
except debconf.DebconfError:
self.frontend.set_popcon(None)
else:
self.frontend.set_popcon(None)
else:
raidDiskStrs = re.split("\\\\[\t ]+", self.db.get("ubiquity/raid_disks"))
text = text + "\n"
text = text + "These disks will be formatted into a RAID array:\n" + "\n".join(raidDiskStrs) + "\n\n"
self.frontend.set_summary_text(text)
# This component exists only to gather some information and then
# get out of the way.
# return True
return FilteredCommand.run(self, priority, question)
示例11: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question == 'ubiquity/install/copying_error/md5':
response = self.frontend.question_dialog(
self.description(question),
# TODO evand 2008-02-14: i18n.
self.extended_description(question),
('Abort', 'Retry', 'Skip'),
use_templates=False)
if response is None or response == 'Abort':
self.preseed(question, 'abort')
elif response == 'Retry':
self.preseed(question, 'retry')
elif response == 'Skip':
self.preseed(question, 'skip')
return True
return FilteredCommand.run(self, priority, question)
示例12: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question == 'time/zone':
zone = self.db.get(question)
# Some countries don't have a default zone, so just pick the
# first choice in the list.
if not zone:
choices_c = self.choices_untranslated(question)
if choices_c:
zone = choices_c[0]
# special cases where default is not in zone.tab
if zone == 'Canada/Eastern':
zone = 'America/Toronto'
elif zone == 'US/Eastern':
zone = 'America/New_York'
self.frontend.set_timezone(zone)
return FilteredCommand.run(self, priority, question)
示例13: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if (question != 'ubiquity/run-ma-again') and \
(question != 'migration-assistant/partitions'):
self.got_a_question = True
if question == 'migration-assistant/failed-unmount':
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
('ubiquity/text/go_back', 'ubiquity/text/continue'))
if response is None or response == 'ubiquity/text/continue':
self.preseed(question, 'true')
else:
self.preseed(question, 'false')
return True
# We cannot currently import from partitions that are scheduled for
# deletion, so we filter them out of the list.
if question == 'migration-assistant/partitions':
self.filter_parts()
elif question == 'ubiquity/run-ma-again':
self.db.set('ubiquity/run-ma-again', 'false')
self.set_choices()
# If we didn't ask any questions, they're all preseeded and we don't
# need to show the page, so we'll continue along. If we got at
# least one question, show the page.
if not self.got_a_question:
return self.succeeded
else:
return FilteredCommand.run(self, priority, question)
elif question.endswith('user'):
username = self.db.get('passwd/username')
self.preseed(question, username)
elif question.endswith('password'):
# Just in case for now. It should never get here as there's a check
# in ma-ask that skips asking the user details if the username is
# already preseeded in passwd.
password = self.db.get('passwd/user-password')
self.preseed(question, password)
self.preseed(question + '-again', password)
else:
self.preseed(question, ", ".join(self.choices(question)))
return True
示例14: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if question.startswith('user-setup/password-weak'):
# A dialog is a bit clunky, but workable for now. Perhaps it
# would be better to display some text in the style of
# password_error, and then let the user carry on anyway by
# clicking next again?
response = self.frontend.question_dialog(
self.description(question),
self.extended_description(question),
('ubiquity/text/choose_another_password',
'ubiquity/text/continue'))
if response is None or response == 'ubiquity/text/continue':
self.preseed(question, 'true')
else:
self.preseed(question, 'false')
self.succeeded = False
self.done = False
self.frontend.select_password()
return True
return FilteredCommand.run(self, priority, question)
示例15: run
# 需要导入模块: from ubiquity.filteredcommand import FilteredCommand [as 别名]
# 或者: from ubiquity.filteredcommand.FilteredCommand import run [as 别名]
def run(self, priority, question):
if self.done:
return self.succeeded
if question == "console-setup/layout":
# Reset this in case we just backed up from the variant
# question.
self.succeeded = True
# TODO cjwatson 2006-09-07: no console-setup support for layout
# choice translation yet
self.frontend.set_keyboard_choices(self.choices_untranslated(question))
self.frontend.set_keyboard(self.db.get(question))
return True
elif question == "console-setup/variant":
# TODO cjwatson 2006-10-02: no console-setup support for variant
# choice translation yet
self.frontend.set_keyboard_variant_choices(self.choices_untranslated(question))
self.frontend.set_keyboard_variant(self.db.get(question))
return FilteredCommand.run(self, priority, question)
else:
return True