Пример #1
0
    def __init__(self, screen):
        super(DemoFrame, self).__init__(screen,
                                        screen.height,
                                        screen.width,
                                        has_border=False,
                                        name="My Form")
        # Internal state required for doing periodic updates
        self._last_frame = 0
        self._sort = 5
        self._reverse = True

        # Create the basic form layout...
        layout = Layout([1], fill_frame=True)
        self._header = TextBox(1, as_string=True)
        self._header.disabled = True
        self._header.custom_colour = "label"
        self._list = MultiColumnListBox(
            Widget.FILL_FRAME,
            [">6", 10, ">4", ">7", ">7", ">5", ">5", "100%"],
            [],
            titles=["PID", "USER", "NI", "VIRT", "RSS", "CPU%", "MEM%", "CMD"],
            name="mc_list")
        self.add_layout(layout)
        layout.add_widget(self._header)
        layout.add_widget(self._list)
        layout.add_widget(
            Label("Press `<`/`>` to change sort, `r` to toggle order, or `q` to quit."))
        self.fix()

        # Add my own colour palette
        self.palette = defaultdict(
            lambda: (Screen.COLOUR_WHITE, Screen.A_NORMAL, Screen.COLOUR_BLACK))
        for key in ["selected_focus_field", "label"]:
            self.palette[key] = (Screen.COLOUR_WHITE, Screen.A_BOLD, Screen.COLOUR_BLACK)
        self.palette["title"] = (Screen.COLOUR_BLACK, Screen.A_NORMAL, Screen.COLOUR_WHITE)
Пример #2
0
    def __init__(self, screen, interface):
        super(NetworkOptions, self).__init__(screen,
                                             8,
                                             26,
                                             y=2,
                                             has_shadow=True,
                                             is_modal=True,
                                             name="networkopts",
                                             title="Network Options",
                                             can_scroll=False)
        self.set_theme('shadowlands')
        self._interface = interface

        #debug(); pdb.set_trace()

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        #layout.add_widget(Divider(draw_line=False))

        self._node = self._interface.node

        options = [
            ('Local node', 'connect_w3_local'),
            #('Public infura', 'connect_w3_public_infura'),
            ('Custom http', 'connect_w3_custom_http'),
            ('Custom websocket', 'connect_w3_custom_websocket'),
            ('Custom ipc', 'connect_w3_custom_ipc'),
            #('Custom Infura API Key', 'connect_w3_custom_infura'),
        ]
        listbox = ListBox(4, options, on_select=self._ok, name='netpicker')

        # Set listbox to match stored options
        for i, option in enumerate(options):
            if option[1] == self._interface._config.default_method:
                listbox._value = option[1]
                listbox._selection = i

        layout.add_widget(listbox)

        layout2 = Layout([1, 1])
        self.add_layout(layout2)

        layout2.add_widget(Button("Cancel", self._cancel))
        #layout2.add_widget(Button("Connect", self._ok), 0)
        self.fix()
Пример #3
0
 def _compose_help_layout(self):
     help_layout = Layout([1])
     self.add_layout(help_layout)
     help_layout.add_widget(Label(
         "[Return] to edit, [Space] to pick several, [Esc] to go to main menu",
         align="^",
     ))
     help_layout.add_widget(Label(
         "S - signature status (+ if valid, - if invalid, <blank> if not present)",
         align="^",
     ))
Пример #4
0
 def _compose_file_picker_layout(self):
     layout = Layout([1])
     self.add_layout(layout)
     layout.add_widget(
         FileBrowser(
             height=11,
             root=os.getcwd(),
             on_change=self._on_browser_change,
             on_select=self._on_file_selected_in_browser,
             name="file_browser",
         ))
     layout.add_widget(Divider())
 def __init__(self, screen, model):
     super(RoboView, self).__init__(screen,
                                    screen.height * 1 // 3,
                                    screen.width,
                                    x=0,
                                    y=screen.height * 1 // 3,
                                    on_load=self.upd,
                                    hover_focus=False,
                                    title="Robos")
     self.model = model
     self.position_field = Text("", "position")
     self.dir_field = Text("", "direction")
     self.load_field = Text("", "load")
     layout = Layout([1, 1, 1], fill_frame=True)
     self.add_layout(layout)
     layout.add_widget(self.position_field, 0)
     layout.add_widget(self.dir_field, 1)
     layout.add_widget(self.load_field, 2)
     self.set_theme('monochrome')
     self.fix()
Пример #6
0
 def __init__(self, screen, model):
     super(ExceptionView, self).__init__(model,
                                         screen,
                                         screen.height * 9 // 10,
                                         screen.width * 9 // 10,
                                         hover_focus=True,
                                         can_scroll=False,
                                         title="Error",
                                         reduce_cpu=True)
     self._model = model
     layout = Layout([100], fill_frame=True)
     self.add_layout(layout)
     self._header = TextBox(20, as_string=True)
     self._header.disabled = True
     self._header.custom_colour = "label"
     layout.add_widget(self._header)
     layout2 = Layout([1, 1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("OK", self._ok), 0)
     self.fix()
Пример #7
0
    def __init__(self, screen, model):
        super(CommitOptionsView, self).__init__(model,
                                                screen,
                                                screen.height * 6 // 10,
                                                screen.width * 6 // 10,
                                                hover_focus=True,
                                                can_scroll=False,
                                                title="Commit Options",
                                                reduce_cpu=True)
        self._model = model

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(
            Button("View changes in commit..", self._view_changes), 0)
        layout.add_widget(Button("Checkout commit..", self._checkout_commit),
                          0)
        layout.add_widget(Button("Cancel", self._open_commits_view), 0)

        self.fix()
Пример #8
0
    def __init__(self, screen, status_model):
        super().__init__(screen,
                         screen.height,
                         screen.width,
                         title="Status",
                         can_scroll=False,
                         reduce_cpu=True)
        self._status_model = status_model

        # Layout the status widgets
        layout1 = Layout([1, 4, 1], fill_frame=False)
        self.add_layout(layout1)
        layout1.add_widget(Label(label="Status page is under construction"), 1)
        layout1.add_widget(Text(label="GPS:",
                                name="gps",
                                readonly=True,
                                disabled=True), 1)

        layout1.add_widget(Button("Return", self._on_click_return), 1)
        self.fix()
Пример #9
0
    def __init__(self, screen, model):
        super(WorkingCopyView, self).__init__(model,
                                              screen,
                                              screen.height * 9 // 10,
                                              screen.width * 9 // 10,
                                              on_load=self._reload_list,
                                              hover_focus=True,
                                              can_scroll=False,
                                              title="Working copy")
        self._model = model
        screen.catch_interrupt = True

        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.changed_files_for_table(),
                                  name="working_copy",
                                  add_scroll_bar=True,
                                  on_select=self._add_to_index)

        self.add_navigation_header()
        self.add_divider()

        self.table_layout = Layout([100], fill_frame=True)
        self.add_layout(self.table_layout)
        self.table_layout.add_widget(self._list_view)
        self.table_layout.add_widget(Divider())

        self._commit_button = Button("Commit", self._commit)
        self._push_button = Button("Push", self._push)

        layout2 = Layout([8, 1, 1])
        self.add_layout(layout2)

        self.commit_message = Text("Commit message:", "commit_message")
        layout2.add_widget(self.commit_message, 0)
        layout2.add_widget(self._commit_button, 1)
        layout2.add_widget(self._push_button, 2)

        self.add_divider()

        self.add_shortcut_panel()
        self.fix()
Пример #10
0
 def __init__(self,
              screen,
              text,
              on_ok,
              on_cancel=None,
              height=6,
              weight=50):
     super(InputFrame, self).__init__(screen,
                                      height,
                                      weight,
                                      has_shadow=True,
                                      has_border=True)
     self.on_ok = on_ok
     layout = Layout([1])
     self.add_layout(layout)
     layout.add_widget(Text(text, 'data'))
     layout.add_widget(Button("确定", self._btn_ok))
     layout.add_widget(
         Button('取消',
                on_cancel if on_cancel is not None else self._btn_cancel))
     self.fix()
Пример #11
0
    def __init__(self, screen):
        super(Confirm, self).__init__(screen,
                                          screen.height * 1 // 8,
                                          screen.width * 1 // 3,
                                          hover_focus=True,
                                          on_load=self._setValue,
                                          title="Confirm action",
                                          reduce_cpu=True)

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self.label = CLabel("{} module {} {}?")
        layout.add_widget(Label(" "))
        layout.add_widget(self.label)
        layout2 = Layout([1,1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Ok", self._ok), 0)
        layout2.add_widget(Button("Cancel", self._cancel), 1)

        self.fix()
Пример #12
0
 def __init__(self, screen):
     super(SubsView, self).__init__(screen,
                                    screen.height,
                                    screen.width,
                                    hover_focus=True,
                                    title="Subscriptions",
                                    reduce_cpu=True)
     layout = Layout([100], fill_frame=True)
     self.add_layout(layout)
     self.data = dict(names='\n'.join([
         name[0] for name in data.cursor.execute(
             'select name from tweeples').fetchall()
     ]))
     self.loaded = self.data['names'].split('\n')
     layout.add_widget(
         TextBox(Widget.FILL_FRAME, "Current:", "names", as_string=True))
     layout2 = Layout([1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("Back", self._back), 0)
     layout2.add_widget(Button("Save", self._save), 1)
     self.fix()
Пример #13
0
    def __init__(self, screen):
        super(UI_frame, self).__init__(screen,
                                      int(screen.height * 2 // 3),
                                      int(screen.width *2 // 3),
                                      has_shadow = True,
                                      name = "MusicBox",
                                      title = "MusicBox")
        layout = Layout([3])
        self.add_layout(layout)
        layout.add_widget(Button(u"排行榜", self._rank), 0)
        layout.add_widget(Button(u"miu", self._rank), 0)
        layout.add_widget(Button(u"shsh", self._rank), 0)

        self.fix()
Пример #14
0
 def __init__(self, screen):
     super(MidFrame, self).__init__(screen,
                                    int(screen.height // 3) - 1,
                                    screen.width // 2,
                                    y=int(screen.height // 3),
                                    has_border=False,
                                    can_scroll=True,
                                    name="Mid Form")
     layout = Layout([1, 18, 1])
     self.add_layout(layout)
     layout.add_widget(Label("Scrolling, no border"), 1)
     for i in range(screen.height // 2):
         layout.add_widget(Text(label=f"Text {i}:"), 1)
     self.fix()
Пример #15
0
 def __init__(self, screen, x, y):
     super(Warning_Frame, self).__init__(screen,
                                         width=screen.width,
                                         height=screen.height // 2,
                                         name='logtextbox',
                                         x=x,
                                         y=y)
     self.set_theme("bright")
     layout = Layout([1, 18])
     self.add_layout(layout)
     layout.add_widget(TextBox(height=1, ), 1)
     layout.add_widget(
         Text(label="Warning:", name="TC", validator="^[0-9]*$"), 1)
     self.fix()
Пример #16
0
    def __init__(self, screen):
        super(Detail, self).__init__(screen,
                                     screen.height,
                                     screen.width,
                                     hover_focus=True,
                                     can_scroll=False,
                                     title='::Listing::',
                                     reduce_cpu=True)

        self.check_theme()
        # keep a pointer to the viewmodel so my super methods work correctly
        self.vm = VM()

        self.inject_header()

        # create a 4 col layout minus any dividers for main
        main = Layout([15, 40, 40, 5], fill_frame=True)
        self.add_layout(main)

        self.inject_get_address_and_owner(main, 4)

        self.inject_is_listed(main)
        self.inject_dividers(main, 4)
        self.inject_get_listing(main)
        self.inject_dividers(main, 4)
        self.inject_list(main)
        self.inject_dividers(main, 4)
        self.inject_withdraw_from_listing(main)
        self.inject_dividers(main, 4)
        self.inject_resolve_application(main)
        self.inject_dividers(main, 4)
        self.inject_claim_access_reward(main)
        self.inject_dividers(main, 4)
        self.inject_challenge(main)
        self.inject_dividers(main, 4)
        self.inject_resolve_challenge(main)
        self.inject_dividers(main, 4)
        self.inject_exit(main)

        self.inject_footer()

        self.fix()
Пример #17
0
    def __init__(self, screen: Screen):
        super(Mandel, self).__init__(screen,
                                     screen.height,
                                     screen.width,
                                     has_border=True,
                                     name="Mandelbrot_viewer")

        # Create the (very simple) form layout...
        layout = Layout([screen.width], fill_frame=True)
        self.add_layout(layout)
        # self.root.add_widget(Button('OK', self._ok))
        self.status = BetterLabel('')

        self.mandelbrot = MandelDisplay('I AM FRACTAL',
                                        screen.width,
                                        screen=screen)

        layout.add_widget(self.status)
        layout.add_widget(Divider())
        layout.add_widget(self.mandelbrot)

        self.fix()
Пример #18
0
    def __init__(self, screen):
        super(DemoFrame, self).__init__(screen,
                                        screen.height,
                                        screen.width,
                                        has_border=False,
                                        name="My Form")
        # Internal state required for doing periodic updates
        self._last_frame = 0
        self._sort = 5
        self._reverse = True

        # Create the basic form layout...
        layout = Layout([1], fill_frame=True)
        self._header = TextBox(1, as_string=True)
        self._header.disabled = True
        self._header.custom_colour = "label"
        self._list = MultiColumnListBox(
            Widget.FILL_FRAME,
            [">6", 10, ">4", ">7", ">7", ">5", ">5", "100%"], [],
            titles=["PID", "USER", "NI", "VIRT", "RSS", "CPU%", "MEM%", "CMD"],
            name="mc_list",
            parser=AsciimaticsParser())
        self.add_layout(layout)
        layout.add_widget(self._header)
        layout.add_widget(self._list)
        layout.add_widget(
            Label(
                "Press `<`/`>` to change sort, `r` to toggle order, or `q` to quit."
            ))
        self.fix()

        # Add my own colour palette
        self.palette = defaultdict(lambda: (Screen.COLOUR_WHITE, Screen.
                                            A_NORMAL, Screen.COLOUR_BLACK))
        for key in ["selected_focus_field", "label"]:
            self.palette[key] = (Screen.COLOUR_WHITE, Screen.A_BOLD,
                                 Screen.COLOUR_BLACK)
        self.palette["title"] = (Screen.COLOUR_BLACK, Screen.A_NORMAL,
                                 Screen.COLOUR_WHITE)
Пример #19
0
    def __init__(self, screen, model):
        super(MenuListView, self).__init__(screen,
                                          screen.height * 2 // 3,
                                          screen.width * 2 // 3,
                                          hover_focus=True,
                                          title="Main Menu",
                                          reduce_cpu=True)

        self._list_view = ListBox(
            Widget.FILL_FRAME,
            self._get_items(),
            name="menu")
        self._ok_button = Button("Ok", self._ok)
        self._cancel_button = Button("Cancel", self._cancel)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("OK", self._ok), 0)

        self.fix()
Пример #20
0
 def __init__(self, screen):
     super(TopFrame, self).__init__(screen,
                                    int(screen.height // 3) - 1,
                                    screen.width // 2,
                                    y=0,
                                    has_border=True,
                                    can_scroll=True,
                                    name="Top Form")
     self.border_box.style = DOUBLE_LINE
     layout = Layout([1, 18, 1])
     self.add_layout(layout)
     layout.add_widget(Label("Scrolling, with border"), 1)
     for i in range(screen.height // 2):
         layout.add_widget(Text(label=f"Text {i}:"), 1)
     self.fix()
Пример #21
0
    def __init__(self, screen):
        super(LogView, self).__init__(screen,
                                      screen.height * 1,
                                      screen.width * 2 // 3,
                                      hover_focus=True,
                                      title="TPO Log")

        self._screen = screen
        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Label("It`s LOG"))
        layout.add_widget(Button("Cancel", self._cancel))
        self._screen.height = 300  #base buf size windows cmd
        self._dy = 0
        self._start_line = 0
Пример #22
0
class CommitFilesView(View):
    def __init__(self, screen, model):
        super(CommitFilesView, self).__init__(model,
                                              screen,
                                              screen.height * 9 // 10,
                                              screen.width * 9 // 10,
                                              on_load=self._reload_list,
                                              hover_focus=True,
                                              can_scroll=False,
                                              title="Diff Files")
        self._model = model

        # Create the form for displaying the list of branches.
        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.list_files_in_current_commit(),
                                  name="diff_files",
                                  add_scroll_bar=True,
                                  on_select=self.__view_diff)

        self.add_navigation_header()
        self.add_divider()

        self.table_layout = Layout([100], fill_frame=True)
        self.add_layout(self.table_layout)
        self.table_layout.add_widget(self._list_view)

        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Back", self._open_commits_view), 0)

        self.table_layout.add_widget(Divider())

        self.add_shortcut_panel()
        self.fix()

    def __view_diff(self):
        self.save()
        self._model.current_commit_file = self.data["diff_files"]
        self.__open_commit_file_diff_scene()

    @staticmethod
    def __open_commit_file_diff_scene():
        raise NextScene("View Commit Diff")

    def _reload_list(self):
        self._list_view.options = self._model.list_files_in_current_commit()
        self.nav_header.blur()
        self.table_layout.focus()
Пример #23
0
    def __init__(self, screen):
        super(EntryFrame, self).__init__(screen,
                                         screen.height,
                                         screen.width,
                                         has_border=False,
                                         hover_focus=True,
                                         name="Pythonic Jeopardy!")

        layout = Layout([1])
        self.add_layout(layout)

        self.add_effect(
            self._figlet(self._canvas, {
                "text": "PYTHONIC",
                "font": 'starwars'
            }, [screen.width // 2, 5], 40))
        self.add_effect(
            self._figlet(self._canvas, {
                "text": "JEOPARDY",
                "font": 'starwars'
            }, [screen.width // 2, 15], 42))
Пример #24
0
    def __init__(self, screen):
        super(JeopardyFrame, self).__init__(screen,
                                            screen.height,
                                            screen.width,
                                            has_border=False,
                                            hover_focus=True,
                                            name="Pythonic Jeopardy!")

        # We use list comprehension here to create a dynamicly sized list based on how many columns we specify above
        jeopardy_columns = 6
        jeopardy_rows = 6
        self.layouts = [
            Layout(
                [100 / jeopardy_columns for index in range(jeopardy_columns)])
            for index in range(jeopardy_rows)
        ]
        [self.add_layout(layout) for layout in self.layouts]
        self.define_grid(screen)

        # Prepare the Frame for use.
        self.fix()
Пример #25
0
    def __init__(self, screen):
        super(Show_paste, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          hover_focus=True,
                                          on_load=self._setValue,
                                          title="Show current paste",
                                          reduce_cpu=True)

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

        self.label_list = []
        self.num_label = 42 # Number of line available for displaying the paste
        for i in range(self.num_label):
            self.label_list += [Label("THE PASTE CONTENT " + str(i))]
            layout.add_widget(self.label_list[i])

        layout2 = Layout([100])
        self.add_layout(layout2)
        layout2.add_widget(Button("Ok", self._ok), 0)
        self.fix()
Пример #26
0
def demo(screen):
    scenes = []
    frame = Frame(screen, 20, 80, can_scroll=False, title="Sender")
    layout = Layout([40, 10, 40, 10], fill_frame=True)
    frame.add_layout(layout)

    optionen = [("Erster", 1), ("Zweiter", 2)]

    sender = ["Erster hihihihihihi", "Zweiter", "Dritter"]

    for s in sender:
        layout.add_widget(Label(s, align=u'^'))

    layout.add_widget(Label("<<<<", align='<'), 1)

    layout.add_widget(Button("hihi!", None))

    frame.fix()

    effects = [frame]

    scenes.append(Scene(effects, -1))
    screen.play(scenes)
Пример #27
0
 def _compose_actions_layout(self):
     actions_layout = Layout([1, 1])
     self.add_layout(actions_layout)
     actions_layout.add_widget(
         Button(
             "Create",
             self._model.create_query
         ),
         0
     )
     self._remove_button = Button(
         "Remove",
         self._remove_queries,
         disabled=True
     )
     actions_layout.add_widget(self._remove_button, 1)
Пример #28
0
    def __init__(self, screen):
        super(ListView, self).__init__(screen,
                                       screen.height * 2 // 3,
                                       screen.width * 2 // 3,
                                       hover_focus=True,
                                       can_scroll=False,
                                       title="Scoreboard")
        # Save off the model that accesses the contacts database.

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(Widget.FILL_FRAME, [])
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        self.fix()
Пример #29
0
    def __init__(self, screen):
        super(Detail, self).__init__(screen, screen.height, screen.width,
            hover_focus=True, can_scroll = False, title='::Voting::', reduce_cpu=True)

        self.check_theme()
        # keep a pointer to the viewmodel so my super methods work correctly
        self.vm = VM()
        self.inject_header()
        # create a 5 col layout minus any dividers for main
        main = Layout([11,28,28,28,5], fill_frame=True)
        self.add_layout(main)
        # address and owner are common to all detail views
        self.inject_get_address_and_owner(main, 5)

        self.inject_is_candidate(main)
        self.inject_dividers(main, 5)
        self.inject_candidate_is(main)
        self.inject_dividers(main, 5)
        self.inject_get_candidate(main)
        self.inject_dividers(main, 5)
        self.inject_did_pass(main)
        self.inject_dividers(main, 5)
        self.inject_poll_closed(main)
        self.inject_dividers(main, 5)
        self.inject_vote(main)
        self.inject_dividers(main, 5)
        self.inject_get_stake(main)
        self.inject_dividers(main, 5)
        self.inject_unstake(main)
        self.inject_dividers(main, 5)

        self.inject_set_privileged(main)
        self.inject_dividers(main, 5)
        self.inject_get_privileged(main)
        self.inject_dividers(main, 5)
        self.inject_has_privilege(main)

        self.inject_footer()

        self.fix()
Пример #30
0
    def __init__(self, screen, path):
        super(VenvView, self).__init__(screen,
                                       screen.height,
                                       screen.width,
                                       hover_focus=False,
                                       can_scroll=True,
                                       reduce_cpu=True,
                                       has_border=True)
        self.selected_size = 0
        self.size_found = 0
        self.path = path
        self.venvs = self.__find_venvs(self.path)

        self.set_visual_theme()
        # Top bar, logo & summary
        self.layout_top = Layout([1, 1])
        self.add_layout(self.layout_top)
        logo = TextBox(height=self.ASCII_TITLE_HEIGHT,
                       as_string=True,
                       disabled=True)
        logo.value = self.ASCII_TITLE
        self.layout_top.add_widget(logo, 1)

        self.layout_top.add_widget(Label(''), 0)
        self.layout_top.add_widget(Label('SUMMARY'), 0)
        self.label_size_found = Text('Total: ', disabled=True)
        self.label_size_selected = Text('To Free: ', disabled=True)
        self.layout_top.add_widget(self.label_size_found, 0)
        self.layout_top.add_widget(self.label_size_selected, 0)
        self.__update_sizes()

        # Main list of environments
        self.layout_main = Layout([80, 20], fill_frame=True)
        self.add_layout(self.layout_main)
        self.__draw_list()

        # Bottom buttons
        self.layout_bottom = Layout([1, 1])
        self.add_layout(self.layout_bottom)

        self.layout_bottom.add_widget(Divider(), 0)
        self.layout_bottom.add_widget(Divider(), 1)
        self.layout_bottom.add_widget(Button('Delete', self._delete), 0)
        self.layout_bottom.add_widget(Button('Quit', self._quit), 1)

        self.fix()
Пример #31
0
    def __init__(self, screen: Screen, model: ScenesModel):
        """
        :param screen: The screen will play this scene.
        :param model: All data to display scenes. 
        """
        super().__init__(SceneName.NODE_INFO, model, screen)

        self.frame._on_load = self.load_node_info

        layout = Layout(columns=[1], fill_frame=True)
        self.frame.add_layout(layout)
        self._name_label = Label('No node selected', align='<')
        layout.add_widget(self._name_label)
        self._info_widget = NodeInfo(screen.height - 2)
        layout.add_widget(self._info_widget)

        self.frame.fix()
Пример #32
0
    def __init__(self, screen, frame_type, frame_data):
        super(WizardFrame, self).__init__(screen,
                                          int(screen.height * 2 // 3),
                                          int(screen.width * 2 // 3),
                                          has_shadow=True,
                                          name="WizardFrame",
                                          title=frame_data.caption)
        self._layout = Layout([1, 18, 1], fill_frame=True)
        self.add_layout(self._layout)

        divider_layout = Layout([1])
        self.add_layout(divider_layout)
        divider_layout.add_widget(Divider(height=3), 0)

        self._buttons_layout = Layout([1, 1, 1, 1, 1])
        self.add_layout(self._buttons_layout)

        self._back_enabled = True
        if frame_type is FrameType.FIRST:
            self._back_enabled = False
            self._buttons_layout.add_widget(
                Button("Cancel", self._cancel_button_click), 3)
            self._buttons_layout.add_widget(
                Button("Next", self._next_button_click), 4)
        elif frame_type is FrameType.REGULAR:
            self._buttons_layout.add_widget(
                Button("Cancel", self._cancel_button_click), 2)
            self._buttons_layout.add_widget(
                Button("Back", self._back_button_click), 3)
            self._buttons_layout.add_widget(
                Button("Next", self._next_button_click), 4)
        elif frame_type is FrameType.LAST:
            self._buttons_layout.add_widget(
                Button("Cancel", self._cancel_button_click), 2)
            self._buttons_layout.add_widget(
                Button("Back", self._back_button_click), 3)
            self._buttons_layout.add_widget(
                Button("Finish", self._next_button_click), 4)

        self._frame_data = frame_data
Пример #33
0
    def __init__(self, screen):
        super(Show_paste, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          hover_focus=True,
                                          on_load=self._setValue,
                                          title="Show current paste",
                                          reduce_cpu=True)

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

        self.label_list = []
        self.num_label = 42 # Number of line available for displaying the paste
        for i in range(self.num_label):
            self.label_list += [Label("THE PASTE CONTENT " + str(i))]
            layout.add_widget(self.label_list[i])

        layout2 = Layout([100])
        self.add_layout(layout2)
        layout2.add_widget(Button("Ok", self._ok), 0)
        self.fix()
Пример #34
0
 def __init__(self, screen, init_values):
     super(TestFrame2, self).__init__(screen,
                                      screen.height,
                                      screen.width,
                                      title="Test Frame 2")
     # Create the form for displaying the list of contacts.
     self._list_view = ListBox(
         Widget.FILL_FRAME,
         init_values,
         name="contacts",
         on_change=self._on_pick)
     self._edit_button = Button("Edit", self._edit)
     self._delete_button = Button("Delete", self._delete)
     layout = Layout([100], fill_frame=True)
     self.add_layout(layout)
     layout.add_widget(self._list_view)
     layout.add_widget(Divider())
     layout2 = Layout([1, 1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("Add", self._add), 0)
     layout2.add_widget(self._edit_button, 1)
     layout2.add_widget(self._delete_button, 2)
     layout2.add_widget(Button("Quit", self._quit), 3)
     self.fix()
     self._on_pick()
	def __init__(self, screen, agent_data):
		super(ServerInfoView, self).__init__(screen,
											screen.height * 2 // 3,
											screen.width * 2 // 3,
											hover_focus=True,
											title='Define Server info',
											reduce_cpu=True
											)
		self._agent_data = agent_data

		layout = Layout([100], fill_frame=True)
		self.add_layout(layout)
		layout.add_widget(Text('InMan server URL:', 'inman_server'))
		layout.add_widget(Text('Websocket server URL:', 'websocket_server'))
		layout.add_widget(Text('Websocket server port:', 'websocket_port'))
		layout.add_widget(Text('Websocket local log:', 'websocket_log_path'))
		debug_choice = ListBox(4, [('Debug', 'logging.DEBUG'), ('Info', 'logging.INFO'), ('Warning', 'logging.WARNING'), ('Error', 'logging.ERROR'), ('Critical', 'logging.CRITICAL')], label='Websocket debug level:', name='websocket_debug_level')
		layout.add_widget(debug_choice)

		layout2 = Layout([1, 1, 1, 1])
		self.add_layout(layout2)
		layout2.add_widget(Button('Finish', self._finish), 1)
		layout2.add_widget(Button('Previous', self._previous), 2)
		layout2.add_widget(Button('Quit', self._quit), 3)
		self.fix()
	def __init__(self, screen, agent_data):
		super(AgentConfView, self).__init__(screen,
											screen.height * 2 // 3,
											screen.width * 2 // 3,
											hover_focus=True,
											title='Define Agent configuration',
											reduce_cpu=True
											)
		self._agent_data = agent_data
		
		layout = Layout([100], fill_frame=True)
		self.add_layout(layout)
		layout.add_widget(Text('Hostname:', 'agent_hostname'))
		layout.add_widget(Text('IP:', 'agent_ip'))
		layout.add_widget(Text('Agent name:', 'agent_name'))
		debug_choice = ListBox(4, [('Debug', 'logging.DEBUG'), ('Info', 'logging.INFO'), ('Warning', 'logging.WARNING'), ('Error', 'logging.ERROR'), ('Critical', 'logging.CRITICAL')], label='Agent debug level:', name='agent_debug_level')
		layout.add_widget(debug_choice)
		layout.add_widget(Text('Agent log path:', 'agent_log_path'))
		layout.add_widget(Text('RADIUS env path:', 'radius_env_path'))
		layout.add_widget(Text('RADIUS log path:', 'radius_log_path'))

		layout2 = Layout([1, 1, 1, 1])
		self.add_layout(layout2)
		layout2.add_widget(Button('Next', self._next), 2)
		layout2.add_widget(Button('Quit', self._quit), 3)
		self.fix()
Пример #37
0
    def __init__(self, screen):
        super(Action_choice, self).__init__(screen,
                                          screen.height * 1 // 8,
                                          screen.width * 1 // 2,
                                          hover_focus=True,
                                          on_load=self._setValue,
                                          title="Confirm action",
                                          reduce_cpu=True)

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self.label = CLabel("Choose action on module {} {}")
        layout.add_widget(self.label)
        layout2 = Layout([1,1,1,1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Cancel", self._cancel), 0)
        self._ShowPasteBtn = Button("Show current paste", self._showpaste)
        layout2.add_widget(self._ShowPasteBtn, 1)
        self._killBtn = Button("KILL", self._kill)
        layout2.add_widget(self._killBtn, 2)
        layout2.add_widget(Button("START", self._start), 3)
        layout3 = Layout([1,1,1,1])
        self.add_layout(layout3)
        self.textEdit = Text("Amount", "amount")
        layout3.add_widget(self.textEdit, 3)

        self.fix()
	def __init__(self, screen, plugin_data):
		super(PluginConfView, self).__init__(screen,
											screen.height * 2 // 3,
											screen.width * 2 // 3,
											hover_focus=True,
											title='Define Plugin configuration',
											reduce_cpu=True
											)
		self._plugin_data = plugin_data
		
		layout = Layout([100], fill_frame=True)
		self.add_layout(layout)
		layout.add_widget(Text('Hostname:', 'plugin_hostname'))
		layout.add_widget(Text('IP:', 'plugin_ip'))
		layout.add_widget(Text('Plugin log path:', 'plugin_log_path'))
		layout.add_widget(Text('InMan Server:', 'inman_server'))
		layout.add_widget(Text('Cluster Master Name:', 'cluster_master_name'))
		layout.add_widget(Text('Cluster Master IP:', 'cluster_master_ip'))
		layout.add_widget(Text('Cluster RADIUS name:', 'cluster_radius_name'))
		debug_choice = ListBox(4, [('Debug', 'logging.DEBUG'), ('Info', 'logging.INFO'), ('Warning', 'logging.WARNING'), ('Error', 'logging.ERROR'), ('Critical', 'logging.CRITICAL')], label='Agent debug level:', name='cluster_debug_level')
		layout.add_widget(debug_choice)

		layout2 = Layout([1, 1, 1, 1])
		self.add_layout(layout2)
		layout2.add_widget(Button('Next', self._next), 2)
		layout2.add_widget(Button('Quit', self._quit), 3)
		self.fix()
Пример #39
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",
                               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()
	def __init__(self, screen, plugin_data):
		super(CreateConfFileView, self).__init__(screen,
											screen.height * 2 // 3,
											screen.width * 2 // 3,
											hover_focus=True,
											title='Create configuration file',
											reduce_cpu=True
											)
		self._plugin_data = plugin_data

		layout = Layout([100], fill_frame=True)
		self.add_layout(layout)
		layout.add_widget(Label(''))
		layout.add_widget(Label(''))
		layout.add_widget(Label('Confirm proceed to create configuration file for InMan Freeradius Cluster Plugin.'))

		layout2 = Layout([1, 1, 1, 1])
		self.add_layout(layout2)
		layout2.add_widget(Button('Proceed', self._proceed), 1)
		layout2.add_widget(Button('Previous', self._previous), 2)
		layout2.add_widget(Button('Quit', self._quit), 3)
		self.fix()
Пример #41
0
    def __init__(self, screen):
        super(DemoFrame, self).__init__(
            screen, screen.height, screen.width, has_border=False, name="My Form")

        # Create the (very simple) form layout...
        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)

        # Now populate it with the widgets we want to use.
        self._details = Text()
        self._details.disabled = True
        self._details.custom_colour = "field"
        self._list = FileBrowser(Widget.FILL_FRAME,
                                 os.path.abspath("."),
                                 name="mc_list",
                                 on_select=self.popup,
                                 on_change=self.details)
        layout.add_widget(Label("Local disk browser sample"))
        layout.add_widget(Divider())
        layout.add_widget(self._list)
        layout.add_widget(Divider())
        layout.add_widget(self._details)
        layout.add_widget(Label("Press Enter to select or `q` to quit."))

        # Prepare the Frame for use.
        self.fix()
Пример #42
0
 def __init__(self, screen):
     super(DemoFrame, self).__init__(screen,
                                     int(screen.height * 2 // 3),
                                     int(screen.width * 2 // 3),
                                     data=form_data,
                                     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",
                               on_change=self._on_change), 1)
     layout.add_widget(
         Text(label="Text1:", name="TB", on_change=self._on_change), 1)
     layout.add_widget(
         Text(label="Text2:", name="TC", on_change=self._on_change), 1)
     layout.add_widget(
         Text(label="Text3:", name="TD", on_change=self._on_change), 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(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()
Пример #43
0
    def __init__(self, screen, model):
        super(ContactView, self).__init__(screen,
                                          screen.height * 2 // 3,
                                          screen.width * 2 // 3,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Contact Details",
                                          reduce_cpu=True)
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Text("Name:", "name"))
        layout.add_widget(Text("Address:", "address"))
        layout.add_widget(Text("Phone number:", "phone"))
        layout.add_widget(Text("Email address:", "email"))
        layout.add_widget(TextBox(
            Widget.FILL_FRAME, "Notes:", "notes", as_string=True, line_wrap=True))
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("OK", self._ok), 0)
        layout2.add_widget(Button("Cancel", self._cancel), 3)
        self.fix()
Пример #44
0
    def __init__(self, screen):
        super(Dashboard, self).__init__(screen,
                                       screen.height,
                                       screen.width,
                                       hover_focus=True,
                                       reduce_cpu=True)

        self._list_view_run_queue = CListBox(
            "running",
            screen.height // 2,
            [], name="LIST")
        self._list_view_idle_queue = CListBox(
            "idle",
            screen.height // 2,
            [], name="LIST")
        self._list_view_noRunning = CListBox(
            "notRunning",
            screen.height // 5,
            [], name="LIST")
        self._list_view_Log = CListBox(
            "logs",
            screen.height // 4,
            [], name="LIST")
        #self._list_view_Log.disabled = True


        #Running Queues
        layout = Layout([100])
        self.add_layout(layout)
        text_rq = CLabel("Running Queues")
        layout.add_widget(text_rq)
        layout.add_widget(CLabel(TABLES_TITLES["running"], listTitle=True))
        layout.add_widget(self._list_view_run_queue)
        layout.add_widget(Divider())

        #Idling Queues
        layout2 = Layout([1,1])
        self.add_layout(layout2)
        text_iq = CLabel("Idling Queues")
        layout2.add_widget(text_iq, 0)
        layout2.add_widget(CLabel(TABLES_TITLES["idle"], listTitle=True), 0)
        layout2.add_widget(self._list_view_idle_queue, 0)
        #Non Running Queues
        text_nq = CLabel("Queues not running")
        layout2.add_widget(text_nq, 1)
        layout2.add_widget(CLabel(TABLES_TITLES["notRunning"], listTitle=True), 1)
        layout2.add_widget(self._list_view_noRunning, 1)
        layout2.add_widget(Divider(), 1)
        #Log
        text_l = CLabel("Logs")
        layout2.add_widget(text_l, 1)
        layout2.add_widget(CLabel(TABLES_TITLES["logs"], listTitle=True), 1)
        layout2.add_widget(self._list_view_Log, 1)

        self.fix()
Пример #45
0
    def __init__(self, screen, model):
        super(ListView, self).__init__(screen,
                                       screen.height * 2 // 3,
                                       screen.width * 2 // 3,
                                       on_load=self._reload_list,
                                       hover_focus=True,
                                       can_scroll=False,
                                       title="Contact List")
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(
            Widget.FILL_FRAME,
            model.get_summary(),
            name="contacts",
            add_scroll_bar=True,
            on_change=self._on_pick,
            on_select=self._edit)
        self._edit_button = Button("Edit", self._edit)
        self._delete_button = Button("Delete", self._delete)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Add", self._add), 0)
        layout2.add_widget(self._edit_button, 1)
        layout2.add_widget(self._delete_button, 2)
        layout2.add_widget(Button("Quit", self._quit), 3)
        self.fix()
        self._on_pick()