Ejemplo n.º 1
0
 def inject_has_privilege(self, layout):
     layout.add_widget(Label('Has Privilege'), 0)
     layout.add_widget(Text(label='Address:', name='has_privilege_address', on_change=self.on_changed), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Label(' '), 3)
     layout.add_widget(Button('Call', self.has_privilege), 4)
Ejemplo n.º 2
0
    def __init__(self, screen, data):
        """
        Args:
            screen (Screen): Screen
            data (DataModel): Data model
        """
        super(ModulesView, self).__init__(screen, min(screen.height, 43), min(screen.width, 132),
                                          hover_focus=True,
                                          title=_("Choose modules"),
                                          reduce_cpu=True)

        self._model = data
        self.set_theme("bright")
        master_layout = Layout([6, 4])
        self.add_layout(master_layout)

        self.master_channel = RadioButtons(
            self._model.get_master_id_tuples(),
            label=_("Master channel"),
            name="master_channel"
        )
        if "master_channel" in self._model.config and \
                self._model.config['master_channel'] in self._model.modules and \
                self._model.modules[self._model.config['master_channel']].type == "master":
            self.master_channel.value = self._model.config['master_channel']
        master_layout.add_widget(self.master_channel, 0)
        self.master_instance = Text(_("Instance ID"), "master_channel_instance")
        master_layout.add_widget(self.master_instance, 1)
        master_layout.add_widget(Label(_("Leave this blank to use the default instance."), 3), 1)

        layout = Layout([1])
        self.add_layout(layout)
        layout.add_widget(Label("", 3))

        slave_layout = Layout([8, 2])
        self.add_layout(slave_layout)
        slave_layout.add_widget(Label(_("Slave channels")), 0)
        self.slave_channels = ListBox(
            Widget.FILL_COLUMN,
            self._model.get_selected_slave_id_tuples(),
            name="slave_channels",
            add_scroll_bar=True
        )
        slave_layout.add_widget(self.slave_channels, 0)
        slave_layout.add_widget(Button(_("Add"), self.edit_popup("slave", "add")), 1)
        slave_layout.add_widget(Button(_("Edit"), self.edit_popup("slave", "edit")), 1)
        slave_layout.add_widget(Button(_("Up"), self.shift("slave", is_up=True)), 1)
        slave_layout.add_widget(Button(_("Down"), self.shift("slave", is_up=False)), 1)
        slave_layout.add_widget(Button(_("Remove"), self.delete("slave")), 1)

        layout = Layout([1])
        self.add_layout(layout)
        layout.add_widget(Label("", 3))

        middleware_layout = Layout([8, 2])
        self.add_layout(middleware_layout)
        middleware_layout.add_widget(Label(_("Middlewares")), 0)
        self.middlewares = ListBox(
            Widget.FILL_COLUMN,
            self._model.get_selected_middleware_id_tuples(),
            name="middlewares",
            add_scroll_bar=True
        )
        middleware_layout.add_widget(self.middlewares, 0)
        middleware_layout.add_widget(Button(_("Add"), self.edit_popup("middleware", "add")), 1)
        middleware_layout.add_widget(Button(_("Edit"), self.edit_popup("middleware", "edit")), 1)
        middleware_layout.add_widget(Button(_("Up"), self.shift("middleware", is_up=True)), 1)
        middleware_layout.add_widget(Button(_("Down"), self.shift("middleware", is_up=False)), 1)
        middleware_layout.add_widget(Button(_("Remove"), self.delete("middleware")), 1)

        confirm_layout = Layout([1])
        self.add_layout(confirm_layout)
        confirm_layout.add_widget(Divider(height=4))
        confirm_layout.add_widget(Button(_("Next"), self._ok))
        self.fix()
Ejemplo n.º 3
0
    def __init__(self, name, screen, inputs, data):
        super(InputFrame, self).__init__(
            screen,
            int(len(inputs) * 2 + 8),
            int(screen.width * 4 // 5),
            has_shadow=True,
            data=data,
            name=name,
        )
        layout = Layout([1, len(inputs), 1])
        self.add_layout(layout)
        layout.add_widget(
            Label("Inputs for the input task '{}'".format(name), height=2), 1
        )
        for singleinput in inputs:
            if (
                singleinput.get("input_type", SINGLE_INPUT.TYPE.TEXT)
                == SINGLE_INPUT.TYPE.TEXT
            ):
                layout.add_widget(
                    Text(
                        label=singleinput.get("name") + ":",
                        name=singleinput.get("name"),
                        on_change=self._on_change,
                    ),
                    1,
                )
            elif (
                singleinput.get("input_type", SINGLE_INPUT.TYPE.TEXT)
                == SINGLE_INPUT.TYPE.DATE
            ):
                layout.add_widget(
                    DatePicker(
                        label=singleinput.get("name") + ":",
                        name=singleinput.get("name"),
                        year_range=range(1899, 2300),
                        on_change=self._on_change,
                    ),
                    1,
                )
            elif (
                singleinput.get("input_type", SINGLE_INPUT.TYPE.TEXT)
                == SINGLE_INPUT.TYPE.TIME
            ):
                layout.add_widget(
                    TimePicker(
                        label=singleinput.get("name") + ":",
                        name=singleinput.get("name"),
                        seconds=True,
                        on_change=self._on_change,
                    ),
                    1,
                )
            elif singleinput.get("input_type", SINGLE_INPUT.TYPE.TEXT) in [
                SINGLE_INPUT.TYPE.SELECT,
                SINGLE_INPUT.TYPE.SELECTMULTIPLE,
            ]:
                layout.add_widget(
                    DropdownList(
                        [(option, option) for option in singleinput.get("options")],
                        label=singleinput.get("name") + ":",
                        name=singleinput.get("name"),
                        on_change=self._on_change,
                    ),
                    1,
                )
            elif (
                singleinput.get("input_type", SINGLE_INPUT.TYPE.TEXT)
                == SINGLE_INPUT.TYPE.PASSWORD
            ):
                layout.add_widget(
                    Text(
                        label=singleinput.get("name") + ":",
                        name=singleinput.get("name"),
                        hide_char="*",
                        on_change=self._on_change,
                    ),
                    1,
                )

        layout.add_widget(Divider(height=3), 1)
        layout2 = Layout([1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Submit", self._submit), 1)
        self.fix()
Ejemplo n.º 4
0
 def _compose_signature_layout(self):
     signature_layout = Layout([5, 9, 4])
     self.add_layout(signature_layout)
     signature_layout.add_widget(Label("Signature"), 0)
     signature_layout.add_widget(DynamicLabel("signature_status"), 1)
     signature_layout.add_widget(Button("Sign", on_click=self._model.sign), 2)
Ejemplo n.º 5
0
    def __init__(self, screen: Any, cache: TopCache, show_details: bool):

        super(TopView, self).__init__(
            screen, screen.height, screen.width, has_border=True, can_scroll=False
        )
        self.cache = cache
        self.show_details = show_details
        self.set_theme("monochrome")
        self.palette["title"] = (
            Screen.COLOUR_BLACK,
            Screen.A_NORMAL,
            Screen.COLOUR_WHITE,
        )

        self.job_count = len(self.cache.jobs)
        self.pool_count = len(self.cache.pools)

        max_widget_height = (
            int((screen.height - BASE_LINES) / 3) - EXTRA_LINES_PER_WIDGET
        )

        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)

        self.onefuzz_reversed = {
            "pools": False,
            "jobs": True,
            "tasks": True,
            "messages": True,
        }

        dimensions = {
            "pools": {
                "height": min(self.pool_count + 1, max_widget_height),
                "setup": self.cache.POOL_FIELDS,
            },
            "jobs": {
                "height": min(self.job_count + 1, max_widget_height),
                "setup": self.cache.JOB_FIELDS,
            },
            "tasks": {"height": Widget.FILL_FRAME, "setup": self.cache.TASK_FIELDS},
            "messages": {
                "height": min(10, max_widget_height),
                "setup": ["Updated", "Type", "Message"],
            },
            "status": {"height": 1},
        }

        for name in ["status", "pools", "jobs", "tasks", "messages"]:
            if name == "messages" and not self.show_details:
                continue

            titles = dimensions[name].get("setup")

            if titles:
                title = TextBox(1, as_string=True, name=name + "_title")
                title.disabled = True
                title.custom_colour = "label"
                layout.add_widget(title)

            widget = MultiColumnListBox(
                dimensions[name]["height"],
                column_config(titles),
                [],
                titles=titles,
                name=name,
                add_scroll_bar=bool(titles),
            )
            if not titles:
                widget.disabled = True

            layout.add_widget(widget)
            layout.add_widget(Divider())

        layout.add_widget(Label("Press `q` to quit or `r` to reorder."))
        self.fix()
Ejemplo n.º 6
0
 def inject_get_price_floor(self, layout):
     layout.add_widget(Label('Get Price Floor'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_price_floor), 3)
Ejemplo n.º 7
0
 def inject_get_support_price(self, layout):
     layout.add_widget(Label('Support Price'), 0)
     layout.add_widget(
         Label(' '),
         1)  # placeholders so that our borders don't shift around
     layout.add_widget(Button('Call', self.get_support_price), 2)
Ejemplo n.º 8
0
    def __init__(self,
                 screen,
                 table,
                 edit_scene,
                 header_text='TableFrame',
                 spacing=2,
                 has_border=True,
                 footer=dict(),
                 reverse_sort=False,
                 sort_index=0,
                 scene_keybinds=None):
        self.table = table
        self.__screen = screen
        self.__edit_scene = edit_scene
        self.__spacing = spacing
        self.__reverse_sort = reverse_sort
        self.__sort_index = sort_index
        self.__scene_keybinds = scene_keybinds
        super().__init__(screen,
                         screen.height,
                         screen.width,
                         has_border=has_border,
                         name=header_text,
                         on_load=self._reload_list)

        layout = Layout([17, 3])

        # Search

        def searching():
            self.__searching = True
            self.data["row_index"] = None

        def not_searching():
            self.__searching = False

        self.__search_box = Text(label='Search:',
                                 name='search',
                                 on_focus=searching,
                                 on_blur=not_searching)
        self.__search_box._on_change = self._reload_list
        # Header
        self.__header = TextBox(1, as_string=True)
        self.__header.disabled = True
        self.__header.custom_colour = "label"
        self.__header.value = header_text
        # List of rows
        self.__list = MultiColumnListBox(Widget.FILL_FRAME,
                                         self.table.get_column_widths(
                                             self.__spacing), [],
                                         titles=self.table.get_column_names(),
                                         name='row_index')
        footers = ['[{}] {}'.format(key, text) for key, text in footer.items()]
        default_footer_text = '[a] Add Row [e] Edit/View Row [r] Reverse Sort [<;>] Change Sort Column [tab] Search [d] Delete [q] Quit'
        self.__footer = Label(' '.join(footers) + ' ' + default_footer_text)

        self.add_layout(layout)
        layout.add_widget(self.__header)
        layout.add_widget(self.__search_box, column=1)
        layout.add_widget(self.__list)
        layout.add_widget(self.__footer)
        self.fix()

        # Change colours
        self.set_theme('monochrome')
Ejemplo n.º 9
0
 def inject_get_owner(self, layout, n):
     last = n - 1
     layout.add_widget(Label('Get Owner'), 0)
     for c in range(1, last):
         layout.add_widget(Label(' '), c)
     layout.add_widget(Button('Call', self.get_owner), last)
Ejemplo n.º 10
0
 def inject_poll_closed(self, layout):
     layout.add_widget(Label('Poll Closed'), 0)
     layout.add_widget(Text(label='Hash:', name='poll_closed_hash', on_change=self.on_changed), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Label(' '), 3)
     layout.add_widget(Button('Call', self.poll_closed), 4)
Ejemplo n.º 11
0
 def add_path_selector(self, button_fn, text):
     layout = Layout([80, 20])
     self.add_layout(layout)
     layout.add_widget(Label(lambda: self.dapp.config.sl_dapp_path), 0)
     layout.add_widget(Button(text, button_fn), 1)
     layout.add_widget(Divider(draw_line=False))
Ejemplo n.º 12
0
 def inject_did_pass(self, layout):
     layout.add_widget(Label('Did Pass'), 0)
     layout.add_widget(Text(label='Hash:', name='did_pass_hash', on_change=self.on_changed), 1)
     layout.add_widget(Text(label='Plurality:', name='did_pass_plurality', on_change=self.on_changed), 2)
     layout.add_widget(Label(' '), 3)
     layout.add_widget(Button('Call', self.did_pass), 4)
Ejemplo n.º 13
0
 def inject_get_candidate(self, layout):
     layout.add_widget(Label('Get Candidate'), 0)
     layout.add_widget(Text(label='Hash:', name='get_candidate_hash', on_change=self.on_changed), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Label(' '), 3)
     layout.add_widget(Button('Call', self.get_candidate), 4)
Ejemplo n.º 14
0
 def inject_candidate_is(self, layout):
     layout.add_widget(Label('Candidate Is'), 0)
     layout.add_widget(Text(label='Hash:', name='candidate_is_hash', on_change=self.on_changed), 1)
     layout.add_widget(Text(label='Kind:', name='candidate_is_kind', on_change=self.on_changed), 2)
     layout.add_widget(Label(' '), 3)
     layout.add_widget(Button('Call', self.candidate_is), 4)
Ejemplo n.º 15
0
 def inject_get_cost_per_byte(self, layout):
     layout.add_widget(Label('Get Cost Per Byte'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_cost_per_byte), 3)
Ejemplo n.º 16
0
    def _create_window(self):
        self.screen = Screen.open()
        self.frame = Frame(self.screen, self.screen.height, self.screen.width, has_border=False, title="Test")
        self.frame.set_theme("mpf_theme")

        title_layout = Layout([1, 5, 1])
        self.frame.add_layout(title_layout)

        title_left = Label("")
        title_left.custom_colour = "title"
        title_layout.add_widget(title_left, 0)

        title = 'Mission Pinball Framework v{}'.format(mpf._version.__version__)    # noqa
        title_text = Label(title, align="^")
        title_text.custom_colour = "title"
        title_layout.add_widget(title_text, 1)

        exit_label = Label("< CTRL + C > TO EXIT", align=">")
        exit_label.custom_colour = "title_exit"

        title_layout.add_widget(exit_label, 2)

        self.layout = MpfLayout([1, 1, 1, 1], fill_frame=True)
        self.frame.add_layout(self.layout)

        footer_layout = Layout([1, 1, 1])
        self.frame.add_layout(footer_layout)
        self.footer_memory = Label("", align=">")
        self.footer_memory.custom_colour = "footer_memory"
        self.footer_uptime = Label("", align=">")
        self.footer_uptime.custom_colour = "footer_memory"
        self.footer_mc_cpu = Label("")
        self.footer_mc_cpu.custom_colour = "footer_mc_cpu"
        self.footer_cpu = Label("")
        self.footer_cpu.custom_colour = "footer_cpu"
        footer_path = Label(self.machine.machine_path)
        footer_path.custom_colour = "footer_path"
        footer_empty = Label("")
        footer_empty.custom_colour = "footer_memory"

        footer_layout.add_widget(footer_path, 0)
        footer_layout.add_widget(self.footer_cpu, 0)
        footer_layout.add_widget(footer_empty, 1)
        footer_layout.add_widget(self.footer_mc_cpu, 1)
        footer_layout.add_widget(self.footer_uptime, 2)
        footer_layout.add_widget(self.footer_memory, 2)

        self.scene = Scene([self.frame], -1)
        self.screen.set_scenes([self.scene], start_scene=self.scene)

        # prevent main from scrolling out the footer
        self.layout.set_max_height(self.screen.height - 2)
Ejemplo n.º 17
0
 def inject_get_stake(self, layout):
     layout.add_widget(Label('Get Stake'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_stake), 3)
Ejemplo n.º 18
0
 def inject_get_list_reward(self, layout):
     layout.add_widget(Label('Get List Reward'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_list_reward), 3)
Ejemplo n.º 19
0
 def inject_get_spread(self, layout):
     layout.add_widget(Label('Get Spread'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_spread), 3)
Ejemplo n.º 20
0
 def inject_get_plurality(self, layout):
     layout.add_widget(Label('Get Plurality'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_plurality), 3)
Ejemplo n.º 21
0
 def inject_withdraw(self, layout):
     layout.add_widget(Label('Withdraw'), 0)
     layout.add_widget(
         Label(' '),
         1)  # placeholders so that our borders don't shift around
     layout.add_widget(Button('Send', self.withdraw), 2)
Ejemplo n.º 22
0
 def inject_get_vote_by(self, layout):
     layout.add_widget(Label('Get Vote By'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_vote_by), 3)
Ejemplo n.º 23
0
 def __init__(self, screen):
     super(DemoFrame, self).__init__(screen,
                                     int(screen.height * 2 // 3),
                                     int(screen.width * 2 // 3),
                                     data=form_data,
                                     has_shadow=True,
                                     name="My Form")
     layout = Layout([1, 18, 1])
     self.add_layout(layout)
     self._reset_button = Button("Reset", self._reset)
     layout.add_widget(Label("Group 1:"), 1)
     layout.add_widget(
         TextBox(5,
                 label="My First Box:",
                 name="TA",
                 parser=AsciimaticsParser(),
                 line_wrap=True,
                 on_change=self._on_change), 1)
     layout.add_widget(
         Text(label="Alpha:",
              name="TB",
              on_change=self._on_change,
              validator="^[a-zA-Z]*$"), 1)
     layout.add_widget(
         Text(label="Number:",
              name="TC",
              on_change=self._on_change,
              validator="^[0-9]*$",
              max_length=4), 1)
     layout.add_widget(
         Text(label="Email:",
              name="TD",
              on_change=self._on_change,
              validator=self._check_email), 1)
     layout.add_widget(Divider(height=2), 1)
     layout.add_widget(Label("Group 2:"), 1)
     layout.add_widget(
         RadioButtons([("Option 1", 1), ("Option 2", 2), ("Option 3", 3)],
                      label="A Longer Selection:",
                      name="Things",
                      on_change=self._on_change), 1)
     layout.add_widget(
         CheckBox("Field 1",
                  label="A very silly long name for fields:",
                  name="CA",
                  on_change=self._on_change), 1)
     layout.add_widget(
         CheckBox("Field 2", name="CB", on_change=self._on_change), 1)
     layout.add_widget(
         CheckBox("Field 3", name="CC", on_change=self._on_change), 1)
     layout.add_widget(
         DatePicker("Date",
                    name="DATE",
                    year_range=range(1999, 2100),
                    on_change=self._on_change), 1)
     layout.add_widget(
         TimePicker("Time",
                    name="TIME",
                    on_change=self._on_change,
                    seconds=True), 1)
     layout.add_widget(
         Text("Password",
              name="PWD",
              on_change=self._on_change,
              hide_char="*"), 1)
     layout.add_widget(
         DropdownList([
             ("Item 1", 1),
             ("Item 2", 2),
             ("Item 3", 3),
             ("Item 3", 4),
             ("Item 3", 5),
             ("Item 3", 6),
             ("Item 3", 7),
             ("Item 3", 8),
             ("Item 3", 9),
             ("Item 3", 10),
             ("Item 3", 11),
             ("Item 3", 12),
             ("Item 3", 13),
             ("Item 3", 14),
             ("Item 3", 15),
             ("Item 3", 16),
             ("Item 4", 17),
             ("Item 5", 18),
         ],
                      label="Dropdown",
                      name="DD",
                      on_change=self._on_change), 1)
     layout.add_widget(Divider(height=3), 1)
     layout2 = Layout([1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(self._reset_button, 0)
     layout2.add_widget(Button("View Data", self._view), 1)
     layout2.add_widget(Button("Quit", self._quit), 2)
     self.fix()
Ejemplo n.º 24
0
 def inject_get_maker_payment(self, layout):
     layout.add_widget(Label('Get Maker Payment'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_maker_payment), 3)
Ejemplo n.º 25
0
    def __init__(self, screen, data, mtype, index, mode, on_close=None):
        # self.palette['background'] = (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLUE)

        if mtype == "slave" and mode == "add":
            title = _("Add a new slave channel")
        elif mtype == "slave" and mode == "edit":
            title = _("Edit a slave channel entry")
        elif mtype == "middleware" and mode == "add":
            title = _("Add a new middleware")
        elif mtype == "middleware" and mode == "edit":
            title = _("Edit a middleware entry")
        else:
            raise ValueError("Unknown mtype and mode pair: %s, %s", mtype, mode)

        super(ModuleEntryView, self) \
            .__init__(screen,
                      min(screen.height, 15), min(screen.width, 75),
                      hover_focus=True,
                      is_modal=True,
                      title=title,
                      reduce_cpu=True
                      )

        self.set_theme("bright")
        self._model = data  # type: DataModel
        self._mtype = mtype  # type: str
        self._index = index
        self._mode = mode
        self._on_close = on_close
        layout = Layout([1])
        self.add_layout(layout)

        module_kv = []
        label = ""
        if mtype == "slave":
            module_kv = self._model.get_slave_id_tuples()
            label = _("Slave channel")
        elif mtype == 'middleware':
            module_kv = self._model.get_middleware_id_tuples()
            label = _("Middleware")

        self.modules = RadioButtons(
            module_kv,
            label=label,
            name="modules"
        )
        layout.add_widget(self.modules)

        self.instance = Text(
            _("Instance ID"),
            "instance_id",
        )
        layout.add_widget(self.instance)

        layout.add_widget(Label(_("Leave this blank to use the default instance."), 3))

        layout.add_widget(Divider(height=2))
        layout.add_widget(Button(_("Save"), self._save))

        if mode == "edit":
            if mtype == "slave":
                c = self._model.config['slave_channels'][index].split("#")
            else:  # mtype == "middleware"
                c = self._model.config['middlewares'][index].split("#")
            self.modules.value = c[0]
            if len(c) > 1:
                self.instance.value = c[1]
        self.fix()
Ejemplo n.º 26
0
 def inject_get_backend_payment(self, layout):
     layout.add_widget(Label('Get Backend Payment'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_backend_payment), 3)
Ejemplo n.º 27
0
    def __init__(self, screen, data):
        super(ModulesSetupView, self).__init__(screen, min(screen.height, 43), min(screen.width, 132),
                                               hover_focus=True,
                                               title=_("EH Forwarder Bot Setup Wizard"),
                                               reduce_cpu=True)

        self._model = data  # type: DataModel
        self.set_theme("bright")
        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)
        label_text = _("You have chosen to enable the following modules for profile \"{0}\".\n"
                       "\n"
                       "Master channel: {1}").format(
            self._model.profile,
            self._model.get_instance_display_name(self._model.config['master_channel'])
        )

        label_text += "\n\n" + \
                      ngettext("Slave channel:", "Slave channels:", len(self._model.config['slave_channels'])) + "\n"
        for i in self._model.config['slave_channels']:
            label_text += '- ' + self._model.get_instance_display_name(i) + "\n"

        num_middlewares = len(self._model.config.get('middlewares', []))
        if num_middlewares > 0:
            label_text += '\n\n' + \
                ngettext("Middleware:", "Middlewares:")
            for i in self._model.config['middlewares']:
                label_text += '- ' + self._model.get_instance_display_name(i) + "\n"

        modules_count = 1
        missing_wizards = []
        if not self._model.has_wizard(self._model.config['master_channel']):
            missing_wizards.append(self._model.config['master_channel'])
        for i in self._model.config['slave_channels']:
            modules_count += 1
            if not self._model.has_wizard(i):
                missing_wizards.append(i)
        for i in self._model.config['middlewares']:
            modules_count += 1
            if not self._model.has_wizard(i):
                missing_wizards.append(i)

        if missing_wizards:
            label_text += "\n" + \
                ngettext("Note:\n"
                         "The following module does not have a setup wizard. It is probably because "
                         "that it does not need to be set up, or it requires you to set up manually.\n"
                         "Please consult its documentation for further details.\n",
                         "Note:\n"
                         "The following modules do not have a setup wizard. It is probably because "
                         "that they do not need to be set up, or they require you to set up manually.\n"
                         "Please consult their documentations respectively for further details.\n",
                         len(missing_wizards))
            for i in missing_wizards:
                label_text += "- " + self._model.get_instance_display_name(i) + "\n"

        label_text += "\n"
        if len(missing_wizards) == modules_count:
            label_text += _("If you are happy with this settings, you may finish this wizard now, and "
                            "continue to configure other modules if necessary. Otherwise, you can also "
                            "go back to change your module settings again.")
            button_text = _("Finish")
        else:
            label_text += _("If you are happy with this settings, this wizard will guide you to setup "
                            "modules you have enabled. Otherwise, you can also go back to change your "
                            "module settings again.")
            button_text = _("Continue")

        h = get_height(label_text, screen.width) + 3
        layout.add_widget(Label(label_text, height=h))

        layout.add_widget(Button(_("Back"), self._back))
        layout.add_widget(Button(button_text, self._ok))
        self.fix()
Ejemplo n.º 28
0
 def inject_get_reserve_payment(self, layout):
     layout.add_widget(Label('Get Reserve Payment'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Button('Call', self.get_reserve_payment), 3)
Ejemplo n.º 29
0
 def _add_bazel_path_menu(self, layout):
     layout.add_widget(Label("Bazel Path:"), 1)
     layout.add_widget(Text(name="tool", on_change=self._on_data_field_change), 2)
     layout.add_widget(Label("Additional Bazel Flags:"), 1)
     layout.add_widget(Text(name="bazelopts", on_change=self._on_data_field_change), 2)
Ejemplo n.º 30
0
 def inject_get_privileged(self, layout):
     layout.add_widget(Label('Get Privileged'), 0)
     layout.add_widget(Label(' '), 1)
     layout.add_widget(Label(' '), 2)
     layout.add_widget(Label(' '), 3)
     layout.add_widget(Button('Call', self.get_privileged), 4)