Exemplo n.º 1
0
    def _build_model_inputs(self):
        sl = []
        for code, native in self.model.get_languages():
            sl.append(
                forward_btn(label=native, on_press=self.confirm,
                            user_arg=code))

        return SimpleList(sl)
Exemplo n.º 2
0
    def _build_model_inputs(self):
        sl = []
        for lang in self.model.get_menu():
            sl.append(
                Color.menu_button(menu_btn(label=lang, on_press=self.confirm),
                                  focus_map="menu_button focus"))

        return BoxAdapter(SimpleList(sl), height=len(sl))
Exemplo n.º 3
0
    def _build_model_inputs(self):
        sl = []
        for ipath, sig in self.model.get_menu():
            log.debug("Building inputs: {}".format(ipath))
            sl.append(
                menu_btn(label=ipath, on_press=self.confirm, user_arg=sig))

        return BoxAdapter(SimpleList(sl), height=len(sl))
Exemplo n.º 4
0
 def __init__(self, model, signal, selected_device, hdinfo):
     log.debug('DiskInfoView: {}'.format(selected_device))
     self.model = model
     self.signal = signal
     self.selected_device = selected_device
     hdinfo = hdinfo.split("\n")
     body = []
     for h in hdinfo:
         body.append(Text(h))
     body.append(Padding.fixed_10(self._build_buttons()))
     super().__init__(Padding.center_79(SimpleList(body)))
Exemplo n.º 5
0
 def __init__(self, model, controller, disk, hdinfo):
     log.debug('DiskInfoView: {}'.format(disk))
     self.model = model
     self.controller = controller
     self.disk = disk
     hdinfo = hdinfo.split("\n")
     body = []
     for h in hdinfo:
         body.append(Text(h))
     body.append(self._build_buttons())
     super().__init__(Padding.center_79(SimpleList(body)))
Exemplo n.º 6
0
    def _build_model_inputs(self):
        sl = []
        current_index = None
        for i, (code, native) in enumerate(self.model.get_languages()):
            if code == self.model.selected_language:
                current_index = i
            sl.append(
                forward_btn(label=native, on_press=self.confirm,
                            user_arg=code))

        lb = SimpleList(sl)
        if current_index is not None:
            lb._w.focus_position = current_index
        return lb
Exemplo n.º 7
0
    def _build_model_inputs(self):
        log.debug('FileSystemView: building model inputs')
        col_1 = []
        col_2 = []

        avail_disks = self.model.get_available_disk_names()
        if len(avail_disks) == 0:
            return Pile([Color.info_minor(Text("No available disks."))])

        for dname in avail_disks:
            disk = self.model.get_disk_info(dname)
            device = self.model.get_disk(dname)
            btn = menu_btn(label=disk.name,
                           on_press=self.show_disk_partition_view)

            col_1.append(Color.menu_button(btn, focus_map='menu_button focus'))
            disk_sz = _humanize_size(disk.size)
            log.debug('device partitions: {}'.format(len(device.partitions)))
            # if we've consumed some of the device, show
            # the remaining space and percentage of the whole
            if len(device.partitions) > 0:
                free, percent = self._get_percent_free(device)
                disk_sz = "{} ({}%) free".format(free, percent)
            col_2.append(Text(disk_sz))
            for partname in device.available_partitions:
                part = device.get_partition(partname)
                btn = menu_btn(label=partname,
                               on_press=self.show_disk_partition_view)
                col_1.append(
                    Color.menu_button(btn, focus_map='menu_button focus'))
                col_2.append(Text(_humanize_size(part.size)))

        col_1 = BoxAdapter(SimpleList(col_1), height=len(col_1))
        col_2 = BoxAdapter(SimpleList(col_2, is_selectable=False),
                           height=len(col_2))
        return Columns([(16, col_1), col_2], 2)
Exemplo n.º 8
0
    def _build_model_inputs(self):
        partitioned_disks = []

        for mnt, size, fstype, path in self.disk_obj.get_fs_table():
            mnt = Text(mnt)
            size = Text("{}".format(_humanize_size(size)))
            fstype = Text(fstype) if fstype else '-'
            path = Text(path) if path else '-'
            partition_column = Columns([(15, path), size, fstype, mnt], 4)
            partitioned_disks.append(partition_column)
        free_space = _humanize_size(self.disk_obj.freespace)
        partitioned_disks.append(
            Columns([(15, Text("FREE SPACE")),
                     Text(free_space),
                     Text(""),
                     Text("")], 4))

        return BoxAdapter(SimpleList(partitioned_disks, is_selectable=False),
                          height=len(partitioned_disks))
Exemplo n.º 9
0
 def __init__(self):
     super().__init__(SimpleList([Text("")]))
Exemplo n.º 10
0
 def __init__(self):
     text = [
         Padding.line_break(""),
     ]
     w = (SimpleList(text))
     super().__init__(w)