コード例 #1
0
    def click(self):
        def do():
            self.client.get_unit_in_focus().perform_activity(self.action_ident)

        if self.action_ident in confirm_actions:
            ui.ask('Really %s?' % self.action_name, do)
        else:
            do()
コード例 #2
0
    def click(self):
        def do():
            self.client.get_unit_in_focus().perform_activity(self.action_ident)

        if self.action_ident in confirm_actions:
            ui.ask('Really %s?' % self.action_name, do)
        else:
            do()
コード例 #3
0
ファイル: citydlg.py プロジェクト: 4nakin/freeciv-android
 def sell_dialog(self, name, handle):
     if not self.city.can_sell(handle):
         ui.message('Cannot sell %s' % name)
     else:
         def do_sell():
             self.city.sell(handle)
             ui.back()
         cost = self.city.get_sell_price(handle)
         ui.ask('Sell %s for %d?' % (name, cost), do_sell)
コード例 #4
0
ファイル: actions.py プロジェクト: Silox/eva
def new_project():
    name = ui.ask("What project are you planning on taking on?")
    project = db.Project(name=name)

    # Ask for tasks in this project
    while True:
        task = ui.ask("What does this project consist of?")
        if not task:
            break
        db.Task(content=task, project=project)
コード例 #5
0
    def sell_dialog(self, name, handle):
        if not self.city.can_sell(handle):
            ui.message('Cannot sell %s' % name)
        else:

            def do_sell():
                self.city.sell(handle)
                ui.back()

            cost = self.city.get_sell_price(handle)
            ui.ask('Sell %s for %d?' % (name, cost), do_sell)
コード例 #6
0
ファイル: gamescreen.py プロジェクト: bazerk/freeciv-android
    def popup_incite_dialog(self, diplomat_action, cost, possible):
        if not possible:
            ui.message('Revolt not possible')
            return
        if cost > self.get_gold():
            ui.message('You don\'t have enough money (needed %d)' % cost)
            return

        def yes():
            diplomat_action.perform_simple_action(freeciv.const.DIPLOMAT_INCITE)

        ui.ask('Incite revolt? (costs %d)' % cost, yes)
コード例 #7
0
ファイル: citydlg.py プロジェクト: 4nakin/freeciv-android
    def buy_prod(self):
        def buy():
            self.city.buy()
            self.make_ui()

        price = self.city.get_buy_price()
        if not price:
            ui.message('Cannot buy')
        elif price > self.client.get_gold():
            ui.message('Too expensive - %d' % price)
        else:
            ui.ask('Buy %s for %d?' % (self.city.get_production_name(), price), buy)
コード例 #8
0
    def popup_incite_dialog(self, diplomat_action, cost, possible):
        if not possible:
            ui.message('Revolt not possible')
            return
        if cost > self.get_gold():
            ui.message('You don\'t have enough money (needed %d)' % cost)
            return

        def yes():
            diplomat_action.perform_simple_action(freeciv.const.DIPLOMAT_INCITE)

        ui.ask('Incite revolt? (costs %d)' % cost, yes)
コード例 #9
0
ファイル: gamemenu.py プロジェクト: zielmicha/freeciv-android
    def click(self):
        self.client.draw_patrol_lines = False
        def do():
            self.client.draw_patrol_lines = False
            unit = self.client.get_unit_in_focus()
            if unit is not None:
                unit.perform_activity(self.action_ident)

        if self.action_ident in confirm_actions:
            ui.ask('Really %s?' % self.action_name, do)
        else:
            do()
コード例 #10
0
    def click(self):
        self.client.draw_patrol_lines = False

        def do():
            self.client.draw_patrol_lines = False
            unit = self.client.get_unit_in_focus()
            if unit is not None:
                unit.perform_activity(self.action_ident)

        if self.action_ident in confirm_actions:
            ui.ask('Really %s?' % self.action_name, do)
        else:
            do()
コード例 #11
0
    def buy_prod(self):
        def buy():
            self.city.buy()
            self.make_ui()

        price = self.city.get_buy_price()
        if not price:
            ui.message('Cannot buy')
        elif price > self.client.get_gold():
            ui.message('Too expensive - %d' % price)
        else:
            ui.ask('Buy %s for %d?' % (self.city.get_production_name(), price),
                   buy)
コード例 #12
0
ファイル: application.py プロジェクト: VMoM/dotstar
    def ask_pm(
            self,
            usable_pms: dict[str, PackageManager]) -> Optional[PackageManager]:
        """
        Ask to the user witch PM use for the installation
        :return: the PM to use, or None if cancel
        """
        possibles_pm = list(set(self.pms.keys()) & set(usable_pms.values()))
        choice = 0

        while not 1 <= choice <= len(possibles_pm):
            ui.print_information("Possible package managers:")
            for index in range(len(possibles_pm)):
                ui.print_description(
                    str(index + 1) + ": " + possibles_pm[index].system_name)
            choice = ui.ask(
                "Enter the number of the package manager you want to use (-1 to cancel the installation): "
            )
            if choice == "-1":
                ui.print_error("Installation canceled")
                return None
            elif not (choice.isnumeric()
                      and 1 <= int(choice) <= len(possibles_pm)):
                ui.print_error(
                    "Error: please enter a number between %d and %d" %
                    (1, len(possibles_pm)))
                choice = 0
            else:
                choice = int(choice)

        return possibles_pm[choice - 1]
コード例 #13
0
ファイル: application.py プロジェクト: VMoM/dotstar
 def ask_for_installation(self) -> bool:
     """
     Ask to the user if they want to install the applications
     :return: if the user wants to install the applications
     """
     install_application_choice = ui.ask("Do you want to install " +
                                         self.name + "? (y/N): ")
     return install_application_choice in ("y", "Y")
コード例 #14
0
def main():
    ui.splash(version)
    if len(sys.argv) < 2:
        filename = ui.chooseFile("No file specified!")
    else:
        filename = sys.argv[1]

    #	r = test.Record(filename)

    data = load.Excel(filename)
    print("Successfully parsed record!")
    r = Record(data)

    if ui.ask("Print response table?"):
        ui.clear()
        print(r.table())
    if ui.ask("Calculate structural summary?"):
        s = structuralSummary.calc(r)
コード例 #15
0
ファイル: main.py プロジェクト: VMoM/dotstar
def main() -> None:

    # Application part
    install_applications_choice = ui.ask("Do you want to install applications? (y/N): ")
    if install_applications_choice in ("y", "Y"):
        application_store = app_utils.read_application_store(res.get_absolute_res_path("applications.json"))

        usable_pms = app_utils.get_usable_pms()
        installation_dict = app_utils.create_installation_dict(usable_pms)

        for category_name in application_store:
            see_category_choice = ui.ask(
                "Do you want to see available applications from the <" + category_name + "> category? (y/N): "
            )
            if see_category_choice in ("y", "Y"):
                for application in application_store[category_name]:
                    ui.print_delimiter()
                    application.print_informations()
                    install_it = application.ask_for_installation()
                    if install_it:
                        pm = application.ask_pm(usable_pms)
                        if pm is not None:
                            installation_dict[pm].append(application.pms[pm])

        ui.print_delimiter()
        ui.print_information("Installation on the selected apps...")
        app_utils.install_apps(installation_dict)
        ui.print_information("End of the installation part.")

    # Apparence part
    ui.print_delimiter()
    user_de = os.environ["DESKTOP_SESSION"]
    if user_de in constants.SUPPORTED_DE:
        if ui.ask(
                "Your desktop environment is compatible with the customization. Do you want to customize it? (y/N): "
        ) in ("Y", "y"):
            ui.print_information(
                "My custom theme \"Sweet-Layan-mashup\", a mashup of my two favorites KDE themes "
                + "(Sweet by EliverLara and Layan by Vince Liuice, plus Papirus icon theme) will be install."
                + "You can return to your previous theme by going to apparence/ in the KDE setting app."
            )
            kde.install_kde_theme("Sweet-Layan-mashup", res.get_absolute_res_path("theme/KDE/Sweet-Layan-mashup"))
コード例 #16
0
ファイル: actions.py プロジェクト: Silox/eva
def new_task():
    content = ui.ask("What do you want to have done?")

    if ui.ask_polar_question("Does it take less than two minutes?"):
        print("Do it now! I'll wait.")
        input("> ")
        return

    task = db.Task(content=content)

    project_choices = list(_generate_project_choices())
    task.project = ui.let_choose("Is it part of a project?", project_choices, none_option="No")

    if ui.ask_polar_question("Can it be devided in smaller chunks?"):
        while True:
            subtask_content = ui.ask("Like what?")
            if not subtask_content:
                break
            subtask = db.Task(content=subtask_content, project=task.project)
            task.subtasks.add(subtask)
コード例 #17
0
ファイル: actions.py プロジェクト: Procrat/eva
def new_project():
    while True:
        name = ui.ask('What project are you planning on taking on?')
        if not name:
            return

        if orm.exists(project for project in db.Project
                      if project.name == name):
            ui.show('A project with this name already exists. '
                    'Please choose another name or leave empty to exit.')
        else:
            break

    project = db.Project(name=name)
    ui.show("If you're finished just say 'ready' :)")
    # Ask for tasks in this project
    while True:
        task = ui.ask('What does this project consist of?')
        if re.match("^|[rR]eady", task) is not None:
            break
        db.Task(content=task, project=project)
コード例 #18
0
ファイル: actions.py プロジェクト: Procrat/eva
def new_reminder():
    content = ui.ask('What do you want me to remind you of?')
    if not content:
        return
    when = ui.pick_date('When do you want to be reminded?',
                        'You will be reminded at {}.')
    if not when:
        question = "Are you sure you don't want to be reminded?"
        if ui.ask_polar_question(question):
            return
    reminder = db.Reminder(content=content, when=when)
    notifier.delayed_notify(reminder)
コード例 #19
0
ファイル: measure.py プロジェクト: moh495/ug_bluerobot
    def _pre_move(self, n):
        if self.display:
            self.robot.display_planned_path(self.trajs[n])

        if self.confirm:
            r = ui.ask("Would you like to continue?", {'Y': 'Yes', 'n': 'No'})
            if r is 'n':
                self.stop = True
                return

        # Call user deffined pre_move function
        if not self.simulation:
            fun = getattr(self, "pre_move", None)
            if callable(fun):
                fun()
            elif n == 0:
                rospy.loginfo("Pre-move function not implemented!")
コード例 #20
0
ファイル: walker.py プロジェクト: ewen-lbh/pychemin
 def execute_input(self):
     self.collecting_input = False
     fallback = self._make_walk_func(self.current_input.fallback)
     answer = ui.ask(
         choices=self._get_input_choices(),
         # ask_again=self.current_input.
         restrict_to_choices=not fallback,
         hint=self.current_input.hint,
         error_callback=fallback)
     self.context['answer'] = answer
     for case, directives in self.current_input.actions_map.items():
         debug.log(f'For case {case!r}: {directives!r}')
         if answer in json.loads(
                 case) or answer in self.current_input.required_cases:
             if not directives:
                 debug.log(f'[WARN] No directives for case {case!r}')
             else:
                 self._make_walk_func(directives)()
コード例 #21
0
def add():

    global ret

    global focus

    y, x = 18, 2

    record = ui.ask(y, x,\
                    dbmgr.typechs, dbmgr.lengths, dbmgr.fields)

    if not record == ui.keyboard['ESC']:

        y, x = 19, 3

        if ui.confirm(y, x, 'ADD?') == 0:

            focus = dbmgr.add(record)

            if focus == -1: focus = dbmgr.search(record[0])

    else:

        focus = ret[1]
コード例 #22
0
ファイル: main.py プロジェクト: alexfromapex/hue-controller
import lights




if __name__=='__main__':
    try:
        globals.init()
        globals.light_thread = lights.LightThread(globals.lightFunc)
        logging.basicConfig()
        app=wx.App(False)
        try:
            import config
            bridge_ip = config.bridge['ip']
        except ImportError:
            bridge_ip = ui.ask(message='What is your bridge IP address?')
            file = open('config.py','w')
            file.write('bridge={\'ip\':\''+bridge_ip+'\'}')
            file.close()
        if bridge_ip:
            print u"Bridge IP is: "+bridge_ip
            try:
                globals.b = Bridge(bridge_ip)
                globals.lights = globals.b.get_light_objects('id')
                frame=Frame(globals.light_thread)
                frame.Maximize()
                app.MainLoop()
            except BridgeButtonException:
                print "Button on bridge needs to be pressed within 30 seconds. Please try again."
                globals.light_thread.stop()
                sys.exit(0)
コード例 #23
0
from ui import ask

camp = ask([
    ["resistance", "revolte", "rebellion", "résistant"],
    ["reine", "lydia", "von hardenberg", "royaume"],
], 'Veuillez choisir un camp !')

if camp == "reine":
    import story.queen_side
else:
    import story.resistance_side
コード例 #24
0
ファイル: actions.py プロジェクト: Silox/eva
def new_idea():
    content = ui.ask("Tell me all about it.")
    db.Idea(content=content)
コード例 #25
0
 def break_treaty(player, type, ask):
     ui.ask(ask % dict(name=player.get_name()),
            lambda: do_break_treaty(player, type))
コード例 #26
0
 def break_treaty(player, type, ask):
     ui.ask(ask % dict(name=player.get_name()), lambda: do_break_treaty(player, type))
コード例 #27
0
from characters import *
from ui import narrator, ask, act, chapter, ask_bool
from player import player

Artur.say(
    "Merci d'avoir rejoint nos rangs. Bienvenue dans la résistance, dont je suis le chef, {}."
    .format(Artur.name_russian))

act(1, '')
chapter(1, 'Le QG')

narrator(
    "Dans le quartier général de la résistance, tout semble calme. Très calme. Trop calme. Toi, du haut de ton rang de simple résistant arrivé depuis peu, tu cherche quelque chose a faire. L'endroit est rempli de truc en tout genre. Allant de la simple table où quelques résistants jouent au tarot à la salle d'entrainement, tu as du mal à choisir quoi faire. Tu sais cependant qu'en temps que résistant, les efforts autant mentaux que physiques font partie de ton quotidien. Il est temps de faire un choix sur ce que tu veux faire. Ce n'est pas en restant planté là que tu arriveras à quelque chose."
)

action = ask((['tarot', 'repos'], ['entraînement', 'entraîner']),
             "Choisis entre jouer au tarot ou t'entraîner", False)

if action == 'tarot':
    player.change('smart', 0.01)
elif action == 'entraînement':
    player.change('strength', 0.05)

narrator(
    "Un résistant s'approche de toi pour te dire que le chef veut te voir")

chapter(2, 'La mission')

narrator(
    "C'est la première fois que Artur Zarzeit, le chef de la résistance, demande à te voir. Non, qu'il demande à voir un non gradé en fait. En réalité, cela te fais un peu peur. Il doit bien avoir une bonne raison pour que la personne la plus recherchée par la Garde Royale se montre à un résistant lambda."
)