当前位置: 首页>>代码示例>>Python>>正文


Python Dialog.msgbox方法代码示例

本文整理汇总了Python中dialog.Dialog.msgbox方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.msgbox方法的具体用法?Python Dialog.msgbox怎么用?Python Dialog.msgbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dialog.Dialog的用法示例。


在下文中一共展示了Dialog.msgbox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_image

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
    def check_image(self):

        # Check if the image exists or not
        if not os.path.isdir('/home/partimag/' + self.image_uuid):
            d = Dialog(dialog="dialog")
            d.msgbox("Could not find image on server", backtitle="Mandriva Pulse Imaging Client")
            raise Exception('Could not find image on server')
        # Check if image is compatible (davos)
        if not os.path.isfile('/home/partimag/%s/davosInfo.json' % self.image_uuid):
            d = Dialog(dialog="dialog")
            d.msgbox("Selected image is not compatible with this backend, please convert this image to the correct format.", backtitle="Mandriva Pulse Imaging Client")
            raise Exception('Could not find image on server')
开发者ID:gnumaniac,项目名称:pulse2-davos-client,代码行数:14,代码来源:image_restorer.py

示例2: __init__

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
class Game:

	global game_backend
	global game_dialog
	empty = ''

	def __init__(self):
		locale.setlocale(locale.LC_ALL, '')
		print('lala')
		self.game_backend = backend.Backend()
		self.game_dialog = Dialog(dialog='dialog')

		user_input = []
		for i in range(0, self.game_backend.code_length):
			user_input.append([self.get_input(i, user_input, True),
							   self.get_input(i, user_input, False)])

		print(user_input)

	def get_input(self, i, user_input, shapes):
		if shapes:
			choicesl = self.game_backend.get_shapes()
			question_text = 'Please pick the ' + str(i + 1) + '. shape. ' \
															'Entered ' \
													 'until now: ' + \
							str(user_input)
			help_text = 'This is helptext for shapes.'
		else:
			choicesl = self.game_backend.get_colours()
			question_text = 'Please pick the ' + str(i + 1) + '. colour. ' \
														   'Entered ' \
													 'until now: ' + \
							str(user_input)
			help_text = 'This is helptext for colours.'

		choices = []
		for i in choicesl:
			choices.append((i, self.empty, False))

		broken = False
		while not broken:
			code, choice = self.game_dialog\
				.radiolist(question_text,\
					choices = choices,\
					help_button = True)

			if code == 'help':
				self.game_dialog.msgbox(help_text)

			else:
				broken = True

		return choicesl.index(choice)
开发者ID:ZDuh,项目名称:mastermind,代码行数:55,代码来源:game.py

示例3: main

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [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()
开发者ID:Monitman,项目名称:Monitman-PWN,代码行数:19,代码来源:pwn.py

示例4: here

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
# 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),
        ],
        title="Do you prefer ham or spam?",
        backtitle="And now, for something " "completely different...",
    )
开发者ID:greising,项目名称:PythonLearn,代码行数:32,代码来源:dialogapp.py

示例5: install_package

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
                        "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)
    if code == d.CANCEL:
        exit_msg()
        sys.exit()
开发者ID:nadams810,项目名称:srchub-install,代码行数:33,代码来源:srchub-install.py

示例6:

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
    elif action == "Get VM/CT list":
        pass
    elif action == "Configure Tool":
        data = pickle.load(open("data.p", "rb"))
        code, action = d.menu("Configure Tool",
            choices=[("Set IP of Proxmox server", ""),
                ("Set username of Proxmox user to login as", ""),
                ("Set password of Proxmox user to log in as", "")])
        if action == "Set IP of Proxmox server":
            code, ip = d.inputbox("Enter IP of Proxmox server:", init=data[1])
        elif action == "Set username of Proxmox user to login as":
            code, username = d.inputbox("Enter username of SSH user:")
        elif action == "Set password of Proxmox user to login as":
            code, password = d.inputbox("Enter password of SSH user:")
        else:
            d.msgbox("Oops. Something went wrong...")

    elif action == "Exit Tool":
        sys.exit()


    elif action == "":
        if d.yesno("Are you REALLY sure you want to exit?") == d.OK:
            sys.exit()

    else:
        d.msgbox("Oops. Something went wrong...")

#code, vmid = d.inputbox("Enter VM ID:")

#os.system('sshpass -p \'' + sshpass + '\' ssh ' + sshuser + '@' + ip)
开发者ID:jelimoore,项目名称:pve-virtual-console,代码行数:33,代码来源:program.py

示例7: WindowsInstallApp

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
class WindowsInstallApp(object):
    def __init__(self, config=None):
        self.logger = logging.getLogger(__name__)
        self.config = config

        self.uefi = False

        self.boot_part = ''
        self.system_part = ''
        self.image_path = ''
        self.image_index = ''

        self.boot_dir = '/mnt/boot'
        self.system_dir = '/mnt/system'

        self.mbr_disk_signature = '4D34B30F'
        self.gpt_disk_signature = '572BD0E9-D39E-422C-82E6-F37157C3535D'
        self.boot_partuuid = '8d03c7bb-6b0c-4223-aaa1-f20bf521cd6e'
        self.system_partuuid = '57092450-f142-4749-b540-f2ec0a183b7b'

        self.cluster_size = 4096
        self.fs_compression = False
        self.quick_format = True

        self.d = Dialog(dialog='dialog')
        self.d.set_background_title('KiWI: Killer Windows Installer')

        self.source_dir = '/mnt/source/'

        advanced_items = [
            ('Filesystem options', MenuItem(self.fs_options)),
        ]

        advanced_submenu = Menu(self.d, advanced_items, title='Advanced Options')

        main_menu_items = [
            ('Configure Networking', MenuItem(self.configure_network)),
            ('Prepare Storage Device', MenuItem(self.auto_prepare)),
            ('Select Installation Source', MenuItem(self.prepare_source)),
            ('Install OS', MenuItem(self.install_os)),
            #('Install Bootloader', self.install_bootloader),
            ('Reboot', MenuItem(self.reboot)),
            ('---', MenuItem(separator=True)),
            ('Advanced Options', advanced_submenu),
        ]

        self.running = True
        self.main_menu = StatefulMenu(self.d, main_menu_items, title='Main Menu')
        while self.running: self.main_menu.run(ret=self.exit())

    def sync(self):
        self.d.infobox('Syncing buffered data\n\nDo NOT reboot!', width=30)
        subprocess.check_call(['sync'])

    def reboot(self):
        self.sync()
        subprocess.check_call(['reboot'])

    def fs_options(self):
        choices = [
            ('Quick Format',        '',             'quick_format'),
            ('NTFS Compression',    '',             'fs_compression'),
            ('Force GPT/EFI',       '',             'uefi'),
        ]

        code, selected = self.d.checklist('Filesystem Options', choices=[
            (choice[0], choice[1], getattr(self, choice[2])) for choice in choices],
            cancel_label='Back')

        if code != self.d.OK: return

        for item in choices:
            tag = item[0]
            var_name = item[2]

            if tag in selected: setattr(self, var_name, True)
            else: setattr(self, var_name, False)

    def test_network(self):
        return True if subprocess.call(
            ['ping', '-c 2', '-i 0.2', '8.8.8.8'],
            stdout=subprocess.PIPE) == 0 else False

    def configure_network(self):
        if not self.test_network():
            rc = subprocess.call('nmtui', shell=True)
        else:
            self.d.msgbox('Network Configuration Successful', width=40, title='Network Status')
            self.main_menu.advance()

    def detect_blockdevs(self):
        devices = []
        p = subprocess.run(['lsblk', '-Ppd'], stdout=subprocess.PIPE)
        for line in p.stdout.decode('UTF-8').split('\n'):
            dev = {}
            for p in line.split():
                pair = p.split('=')
                dev[pair[0]] = pair[1][1:-1]

            # We don't need read-only devices
#.........这里部分代码省略.........
开发者ID:jakogut,项目名称:KiWI,代码行数:103,代码来源:install.py

示例8: SBoTemplates

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]

#.........这里部分代码省略.........
            if tag == "autotools-template":
                self.data = SlackBuilds(
                    self.app, version, self.year, self.maintainer,
                    self.live).autotools().splitlines()
                self.write()
                self.messageBox()
            elif tag == "cmake-template":
                self.data = SlackBuilds(
                    self.app, version, self.year, self.maintainer,
                    self.live).cmake().splitlines()
                self.write()
                self.messageBox()
            elif tag == "perl-template":
                self.data = SlackBuilds(
                    self.app, version, self.year, self.maintainer,
                    self.live).perl().splitlines()
                self.write()
                self.messageBox()
            elif tag == "python-template":
                self.data = SlackBuilds(
                    self.app, version, self.year, self.maintainer,
                    self.live).python().splitlines()
                self.write()
                self.messageBox()
            elif tag == "rubygem-template":
                self.data = SlackBuilds(
                    self.app, version, self.year, self.maintainer,
                    self.live).rubygem().splitlines()
                self.write()
                self.messageBox()
        self.edit()
        self.menu()

    def mixedform(self):
        """Dialog.mixedform(text, elements, height=0, width=0, form_height=0,
        **kwargs)
        Display a form consisting of labels and fields.
        """
        self.code, self.fields = self.d.mixedform(self.comments, self.elements,
                                                  self.height, self.width)

    def edit(self):
        """editor handler
        """
        subprocess.call([self.editor, self.pwd + self.filename])

    def messageBox(self):
        """view messages
        """
        self.d.msgbox(self.msg, self.height, self.width)

    def choose(self):
        """Choosing if write to file or exit
        """
        if self.code == self.d.OK:
            self.__ifFileExist()
            self.write()
            self.messageBox()
            self.menu()
        elif self.code == self.d.CANCEL:
            self.menu()
        elif self.code == self.d.ESC:
            self.menu()

    def __ifFileExist(self):
        """check if file exist
        """
        self.width = 60
        self.height = 6
        if os.path.isfile(self.pwd + self.filename):
            self.msg = "File {0} modified.".format(self.filename)
        else:
            self.msg = "File {0} is created.".format(self.filename)

    def checksum(self):
        """checksum sources
        """
        self.height = 7
        self.width = 90
        self.chk_md5 = "".join(self.chk_md5.replace('"', ''))
        if os.path.isfile(self.pwd + self.source):
            with open(self.pwd + self.source) as f:
                data = f.read()
                if self.chk_md5 != hashlib.md5(data).hexdigest():
                    self.msg = "MD5SUM check for {0} FAILED".format(self.source)
                    self.messageBox()
            self.infoFile()

    def touch(self):
        """create empty file
        """
        with open(self.pwd + self.filename, "w") as f:
            f.close()

    def write(self):
        """write handler
        """
        with open(self.pwd + self.filename, "w") as f:
            for line in self.data:
                f.write(line + "\n")
开发者ID:fatman2021,项目名称:sbo-templates,代码行数:104,代码来源:main.py

示例9: Dialog

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [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?")

elif tag == "2.":
开发者ID:xxpizzaxx,项目名称:pizza-auth,代码行数:33,代码来源:wizard.py

示例10: list

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
class historyPlugin:
    """
    Simple history showing plugin for copysync

    :author: Damian Kęska <[email protected]>
    """

    history = list()

    def __init__(self, app):
        """
        Initialize - append callbacks to copysync functions
        :param app:
        :author: Damian Kęska <[email protected]>
        :return:
        """

        self.kernel = app
        self.dialog = Dialog(dialog="dialog")

        # hook up to queue
        self.kernel.hooking.addOption('app.syncJob.Queue.iterate.item', self.queueFileAction, priority=10)

        # hook up to args init
        self.kernel.hooking.addOption('app.argsparsing.init', self.initializeInteractive, priority=99)


    def initializeInteractive(self, args = ''):
        """
        hook up to interactive console

        :param args:
        :author: Damian Kęska <[email protected]>
        :return:
        """

        # hook up to interactive console
        if self.kernel.interactive:
            self.kernel.interactive.recognizedChars['h'] = self.showHistoryWindow

    def queueFileAction(self, args = ''):
        """
        Capture queue actions to put into history log

        :param dict args: Input queue state parameters
        :author: Damian Kęska <[email protected]>
        :return: input args
        """

        if not 'operationType' in args or not args['operationType']:
            return args

        # mapping:
        # 0 => date
        # 1 => operation type (eg. add, remove)
        # 2 => virtual path

        self.history.append((time.strftime("%d.%m.%Y %H:%M:%S"), args['operationType'], args['virtualPath']))

        return args

    def showHistoryWindow(self):
        """
        Show history window using Dialog
        :return:
        """


        f = open(os.devnull, 'w')
        __stdout = sys.stdout
        sys.stdout = f

        historyString = ''

        for entry in self.history:
            historyString += "["+entry[0]+"] "+entry[1]+": "+entry[2]+" \n"

        self.dialog.msgbox(historyString, width=160, height=30)

        # restore stdout
        sys.stdout = __stdout
开发者ID:Panthera-Framework,项目名称:copysync,代码行数:83,代码来源:history.py

示例11: MainDialog

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
class MainDialog():
    def __init__(self, auto_run=True):
        self.d = Dialog(dialog="dialog", autowidgetsize=True, DIALOGRC='rc')
        self.d.set_background_title("ATILLA - Transition shell")
        if auto_run:
            self.run()

    def check_address(self, address):
        ip_regex = re.compile("^192.168.(10|253).\d{1,3}$")
        address_regex = re.compile("^([a-zA-Z0-9-]*\.){0,4}atilla\.org$")
        return ip_regex.match(address) or address_regex.match(address)

    def check_user(self, user):
        user_regex = re.compile("^[a-zA-Z0-9-]{0,255}$")
        return user_regex.match(user)

    def input_ssh_hostname(self):
        while True:
            code, address = self.d.inputbox("Enter the server FQDN / IP : ",
                                            width=35)

            if code == self.d.OK:
                if self.check_address(address):
                    return address
                else:
                    self.d.msgbox("Invalid address, plase make sure that you"
                                  " are trying to reach an ATILLA server",
                                  width=50, height=10)
            else:
                return None

    def input_ssh_user(self):
        while True:
            code, user = self.d.inputbox("Enter the username : ",
                                         init="root")
            if code == self.d.OK:
                if self.check_user(user):
                    return user
                else:
                    self.d.msgbox("Invalid user name")
            else:
                return None

    def ssh(self):
        hostname = self.input_ssh_hostname()
        if hostname is not None:
            user = self.input_ssh_user()
            if user is not None:
                os.system('clear')
                os.system('ssh ' + user + '@' + hostname)

    def learn_more(self):
        text = ("This application is meant to provide a user-friendly "
                "interface for SSH bouncing into ATILLA network.\n\n"
                "Source code available at :\n"
                "https://gitlab.atilla.org/adminsys/transition-shell")
        self.d.msgbox(text)

    def main_menu(self):
        main_menu_choices = [("#1", "Connect to another SSH server"),
                             ("#2", "Learn more about this application"),
                             ("#3", "Quit the program")]
        while True:
            code, tag = self.d.menu(("Welcome to ATILLA transition server, "
                                     "please choose one of the following "
                                     "options :"),
                                    choices=main_menu_choices)
            if code == self.d.OK:
                if tag == "#1":
                    self.ssh()
                elif tag == "#2":
                    self.learn_more()
                elif tag == "#3":
                    return
            else:
                return

    def run(self):
        self.main_menu()
        self.d.infobox("Goodbye !")
        time.sleep(0.25)
        os.system('clear')
开发者ID:Atilla-Admin,项目名称:transititon-shell,代码行数:84,代码来源:transition-shell.py

示例12: extend_column

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
    def extend_column(self, new_field, add=None):
        """ We know what is new column, now determine how we should extend it
                add - bool if the column should be added to the table; None ask
        """
        print("\nWhat column we base {} on?".format(new_field))
        g = self.csv.guesses.get_graph()
        valid_types = list(g.dijkstra(new_field))
        possible_cols = {}
        for (i, key), types in self.csv.guesses.field_type.items():
            for val in types:
                if val in valid_types:
                    possible_cols[i] = types[val]
                    break
        source_col_i = Dialogue.pickOption(self.csv.get_fields_autodetection(),
                                           title="Searching source for " + new_field,
                                           guesses=sorted(possible_cols, key=possible_cols.get, reverse=True))

        dialog = Dialog(autowidgetsize=True)
        method = self.csv.guesses.get_best_method(source_col_i, new_field)
        if method is None:
            # ask how should be treated the column as, even it seems not valid
            # list all known methods to compute the desired new_field (e.g. for incident-contact it is: ip, hostname, ...)
            choices = [(k, self.csv.guesses.get_description(k)) for k, _ in
                       sorted(self.csv.guesses.get_graph().dijkstra(new_field, ignore_private=True).items(),
                              key=lambda v: v[1], reverse=False)]  # whois is an internal keyword

            if len(choices) == 1 and choices[0][0] == "plaintext":
                # if the only method is derivable from a plaintext, no worries that a method
                # converting the column type to "plaintext" is not defined; everything's plaintext
                method = "plaintext"
            elif choices:
                title = "Choose the right method\n\nNo known method for making {} from column {} because the column type wasn't identified. How should I treat the column?".format(
                    new_field, self.csv.fields[source_col_i])
                code, method = dialog.menu(title, choices=choices)
                if code == "cancel":
                    return
            else:
                dialog.msgbox("No known method for making {}. Raise your usecase as an issue at {}.".format(new_field,
                                                                                                            Config.PROJECT_SITE))

        custom = None
        if new_field == "custom":  # choose a file with a needed method
            while True:
                title = "What .py file should be used as custom source?"
                code, path = dialog.fselect(os.getcwd(), title=title)
                if code != "ok" or not path:
                    return
                module = self.csv.guesses.get_module_from_path(path)
                if module:
                    # inspect the .py file, extract methods and let the user choose one
                    code, method = dialog.menu("What method should be used in the file {}?".format(path),
                                               choices=[(x, "") for x in dir(module) if not x.startswith("_")])
                    if code == "cancel":
                        return

                    custom = path, method
                    break
                else:
                    dialog.msgbox("The file {} does not exist or is not a valid .py file.".format(path))

        self.csv.settings["add"].append((new_field, source_col_i, method, custom))
        self.csv.fields.append(new_field)

        if add is None:
            if dialog.yesno("New field added: {}\n\nDo you want to include this field as a new column?".format(
                    new_field)) == "ok":
                add = True

        if add is True:  # or (add is None and input("Do you want to include this field as a new column? [y]/n ") not in ["n","no"]):
            self.csv.settings["chosen_cols"].append(len(self.csv.fields) - 1)
        # if add is False or (add is None and input("Do you want to include this field as a new column? [y]/n ") in ["n","no"]):
        # self.csv.settings["chosen_cols"].append(False)
        return len(self.csv.fields) - 1  # + len(self.csv.settings["add"]) - 1
开发者ID:CZ-NIC,项目名称:convey,代码行数:75,代码来源:controller.py

示例13: call

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
while True:

	mmenu, rmenu = d.menu("Que souhaitez vous faire ?", choices = [("(1)", "Lancer Tuxbot"), ("(2)", "Eteindre Tuxbot"), ("(3)", "Mettre à jour Tuxbot"), ("(4)", "Quitter")])
	
	if rmenu == "(1)":
		d.gauge_start("Lancement")
		d.gauge_update(10)
#		try:
#			call(["screen", "-S", "tuxbot", "-X","quit"])
#		except:
#			d.gauge_update(35)
		d.gauge_update(40)
		call(["screen","-S","tuxbot", "-d", "-m", "python3", "bot.py"])
		d.gauge_update(100)
		d.gauge_stop()
		d.msgbox("Tuxbot est correctement lancé ! Merci de faire .ping sur discord pour vérifier.")

	if rmenu == "(2)": 
		d.gauge_start("Arrêt")
		d.gauge_update(10)
		call(["screen", "-S", "tuxbot", "-X","quit"])
		d.gauge_update(100)
		d.gauge_stop()
		d.msgbox("Tuxbot s'est correctement arrêté. Faites vite ;-) !")

	if rmenu == "(4)":
		d.pause("A bientôt !\n(C) 2018 Gnous.EU Dev Team.", seconds=2)
		call(["clear"])
		exit()
		
	if rmenu == "(3)":
开发者ID:outout14,项目名称:radis-bot,代码行数:33,代码来源:launch.py

示例14: main

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
def main():
    locale.setlocale(locale.LC_ALL, '')
    d = Dialog(dialog="dialog", autowidgetsize=True)
    d.set_background_title("Programme de support express")
    d.msgbox("Bienvenue sur le programme de support technique. Celui-ci vous guidera pour résoudre votre probleme ou la soumettre de maniere correcte !")
    code, programme = d.menu("Quel est le programme concerné par le probleme ?:",
                       choices=[("serveur", "Mon serveur en entier, le soucis est global, ou n'est pas lié à un programme particulier."),
                                ("web", "Mon site web (apache2, nginx, ioncube...)"),
                                ("minecraft", "Un serveur de jeu Minecraft"),
                                ("source", "Un serveur de jeu CS:GO, TF2, ou autre jeu source"),
                                ("vpn", "Un VPN OpenVpn"),
                                ("ssh", "Le SSHd (connexion au serveur avec PuTTy ou équivalent)"),
                                ("bdd", "Une base de données (MySql, phpmyadmin...)"),
                                ("autre", "Autre chose, qui n'est pas expliqué ici")
                                ])

    if code == d.OK:
        if d.yesno("Le principal, avez vous lu les logs de l'application ou du service ?", yes_label="Bien sur que oui !", no_label="Euh... On peut le faire maintenent ?") == d.OK:
            if d.yesno("Et vous n'avez rien trouvé dedans?", yes_label="Sisi, j'ai vu des erreurs", no_label="Vraiment rien trouvé!") == d.OK:
                if programme == "minecraft":
                    if d.yesno("Hum... S'agit t'il d'un trés long message avec des at à quasiment chaque ligne ?", yes_label="Oui, c'est ca !", no_label="Non !") == d.OK:
                        d.msgbox("C'est une stacktrace. Il doit y avoir le nom d'un ou plusieurs plugins dedans, ainsi que leur version. Essaye de les mettre à jour.")
                        if d.yesno("La mise à jour et le redémarrage ont-ils résolu le probleme ?", yes_label="Oui, merci !", no_label="Non :'(") == d.OK:
                            d.msgbox("Dans, ce cas, merci à toi ! :)")
                            sys.exit(0)
                        else:
                            propositionsMessages(d, programme)
                    else:
                        d.msgbox("Pas grave, nous allons trouver, alors dit moi :")

                code, tag = d.menu("Quel genre de messages ?:",
                                   choices=[("1", "Des messages d'erreurs"),
                                            ("2", "Des \"Warnings\""),
                                            ("3", "Des messsages que j'ai pas trop compris")
                                            ])
                tag = int(tag)
                if code == d.OK:
                    if tag == 1:
                        d.msgbox("Super ! La plupart du boulot est fait ! Essayez d'entrer dans google le message d'erreur en retirant la date, l'heure, les chemins de fichiers et tout autre signe distinctif, puis appliquez les solutions proposées")
                        if d.yesno("Cela à résolu votre probleme ?", yes_label="Oui, merci beaucoup !", no_label="Malheureusement non !") == d.OK:
                            d.msgbox("Dans, ce cas, merci à toi ! :)")
                            sys.exit(0)
                        else:
                            propositionsMessages(d, programme)
                    elif tag == 2:
                        if d.yesno("Le mieux serait d'entrer ces messages sans trop de signes distinctifs dans google et d'essayer les solutions proposées. Est-ce que cela résout le problème ?", yes_label="Oui, merci beaucoup !", no_label="Malheureusement non !") == d.OK:
                            d.msgbox("Dans, ce cas, merci à toi ! :)")
                            sys.exit(0)
                        else:
                            propositionsMessages(d, programme)
                    elif tag == 3:
                        d.msgbox("Essayez d'entrer dans google le message en retirant la date, l'heure, les chemins de fichiers et tout autre signe distinctif, puis appliquez les solutions proposées")
                        if d.yesno("Cela à résolu votre probleme ?", yes_label="Oui, merci beaucoup !", no_label="Malheureusement non !") == d.OK:
                            d.msgbox("Dans, ce cas, merci à toi ! :)")
                            sys.exit(0)
                        else:
                            propositionsMessages(d, programme)
            else:
                d.msgbox("Si tu ne trouves pas de message particulier, cherche si l'application n'a pas d'autres fichiers de logs. Si ce n'est pas le cas, passe nous voir au support sur IRC")
        else:
            d.msgbox("Pas de soucis, regardons. Tu dois chercher des lignes contenant des erreurs")
            if d.yesno("Connais-tu le chemin vers ces logs ? Je ne connais que ceux par défault, et si tes serveurs sont installés a d'autres endroits, je ne les trouverai pas.", yes_label="Oui, je connais!", no_label="Malheureusement non !") != d.OK:
                d.msgbox("Voici les logs, si je les trouves...")
                try:
                    if programme == "serveur":
                        d.textbox("/var/log/syslog")
                    elif programme == "web":
                        d.textbox("/var/log/apache2/error.log")
                    elif programme == "minecraft":
                        code, serv = d.inputbox("Quel est le nom du serveur aprés /home/minecraft ? (tapez juste / si il n'y en a pas)", init="/")
                        d.textbox("/home/minecraft/" + serv + "/logs/latest.log")
                    elif programme == "source":
                        d.msgbox("Les logs pour les serveurs source sont dans la console seulement")
                    elif programme == "vpn":
                        d.textbox("/var/log/syslog") # oui, ca log dans syslog openvpn :o
                    elif programme == "sshd":
                        d.textbox("/var/log/auth.log")
                        d.textbox("/var/log/messages")
                    elif programme == "bdd":
                        d.textbox("/var/log/mysql.log")
                    else:
                        d.msgbox("Le mieux serait de chercher ce chemin sur google...")
                        code, logs = d.inputbox("Quel est ce chemin ?", init="/var/log/[...]")
                        if code == d.OK:
                            d.textbox(logs)
                        else:
                            d.msgbox("Au revoir è_é!")
                            sys.exit(2)
                except DialogError:
                    d.msgbox("Je n'ai pas trouvé le fichier :'(. Le mieux serait de chercher ce chemin sur google...")
                    code, logs = d.inputbox("Quel est ce chemin ?", init="/var/log/[...]")
                    if code == d.OK:
                        d.textbox(logs)
                    else:
                        d.msgbox("Au revoir è_é!")
                        sys.exit(2)
            else:
                code, logs = d.inputbox("Quel est ce chemin ?", init="/var/log/[...]")
                if code == d.OK:
                    d.textbox(logs)
#.........这里部分代码省略.........
开发者ID:paris-ci,项目名称:support,代码行数:103,代码来源:support.py

示例15: randrange

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import msgbox [as 别名]
                       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":
        if d.yesno("Really quit?") == d.OK:
            i = randrange(0, len(exit_messages))
            d.msgbox(exit_messages[i])
            exit(0)
        else:
            pass
        pass  # at least I'm not using goto

    else:
        if tag == "Help":
            d.msgbox("Try adding particles and testing the field strength.")
            # maybe add some actually useful help here, I dunno.

        elif tag == "Configure":
            while code == d.OK:  # probably lets people keep configuring after a single change
                code, tag = d.menu("Choose a configuration option.",
                                   choices=[("Angle", "change the angle units"),
                                            ("Charge", "change the charge units"),
开发者ID:idajourney,项目名称:PhysTools,代码行数:33,代码来源:main.py


注:本文中的dialog.Dialog.msgbox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。