stop trying to be clever handling escape in filesystem views
This commit is contained in:
parent
395b30451e
commit
387f2c7b76
|
@ -16,7 +16,7 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
from subiquitycore.controller import BaseController, view
|
||||
from subiquitycore.controller import BaseController
|
||||
from subiquitycore.ui.dummy import DummyView
|
||||
from subiquitycore.ui.error import ErrorView
|
||||
|
||||
|
@ -46,7 +46,6 @@ class FilesystemController(BaseController):
|
|||
self.raid_model = RaidModel()
|
||||
self.model.probe() # probe before we complete
|
||||
|
||||
@view
|
||||
def default(self, reset=False):
|
||||
# FIXME: Is this the best way to zero out this list for a reset?
|
||||
if reset:
|
||||
|
@ -107,7 +106,6 @@ class FilesystemController(BaseController):
|
|||
self.signal.emit_signal('next-screen')
|
||||
|
||||
# Filesystem/Disk partition -----------------------------------------------
|
||||
@view
|
||||
def partition_disk(self, disk):
|
||||
log.debug("In disk partition view, using {} as the disk.".format(disk.path))
|
||||
title = ("Partition, format, and mount {}".format(disk.path))
|
||||
|
@ -119,7 +117,6 @@ class FilesystemController(BaseController):
|
|||
|
||||
self.ui.set_body(dp_view)
|
||||
|
||||
@view
|
||||
def add_disk_partition(self, disk):
|
||||
log.debug("Adding partition to {}".format(disk))
|
||||
footer = ("Select whole disk, or partition, to format and mount.")
|
||||
|
@ -160,9 +157,9 @@ class FilesystemController(BaseController):
|
|||
self.model.add_mount(fs, spec['mountpoint'])
|
||||
|
||||
log.info("Successfully added partition")
|
||||
self.prev_view()
|
||||
self.partition_disk(disk)
|
||||
|
||||
def add_format_handler(self, volume, spec):
|
||||
def add_format_handler(self, volume, spec, back):
|
||||
log.debug('add_format_handler')
|
||||
if spec['fstype'] is not None:
|
||||
fs = self.model.add_filesystem(volume, spec['fstype'])
|
||||
|
@ -172,7 +169,7 @@ class FilesystemController(BaseController):
|
|||
if fs is None:
|
||||
raise Exception("{} is not formatted".format(volume.path))
|
||||
self.model.add_mount(fs, spec['mountpoint'])
|
||||
self.prev_view()
|
||||
back()
|
||||
|
||||
def connect_iscsi_disk(self, *args, **kwargs):
|
||||
# title = ("Disk and filesystem setup")
|
||||
|
@ -193,7 +190,6 @@ class FilesystemController(BaseController):
|
|||
# self.signal))
|
||||
self.ui.set_body(DummyView(self.signal))
|
||||
|
||||
@view
|
||||
def create_volume_group(self, *args, **kwargs):
|
||||
title = ("Create Logical Volume Group (\"LVM2\") disk")
|
||||
footer = ("ENTER on a disk will show detailed "
|
||||
|
@ -204,7 +200,6 @@ class FilesystemController(BaseController):
|
|||
self.ui.set_footer(footer)
|
||||
self.ui.set_body(LVMVolumeGroupView(self.model, self.signal))
|
||||
|
||||
@view
|
||||
def create_raid(self, *args, **kwargs):
|
||||
title = ("Create software RAID (\"MD\") disk")
|
||||
footer = ("ENTER on a disk will show detailed "
|
||||
|
@ -218,7 +213,6 @@ class FilesystemController(BaseController):
|
|||
self.ui.set_body(RaidView(self.model,
|
||||
self.signal))
|
||||
|
||||
@view
|
||||
def create_bcache(self, *args, **kwargs):
|
||||
title = ("Create hierarchical storage (\"bcache\") disk")
|
||||
footer = ("ENTER on a disk will show detailed "
|
||||
|
@ -236,17 +230,15 @@ class FilesystemController(BaseController):
|
|||
self.model.add_raid_device(result)
|
||||
self.signal.prev_signal()
|
||||
|
||||
@view
|
||||
def format_entire(self, disk):
|
||||
log.debug("format_entire {}".format(disk))
|
||||
header = ("Format and/or mount {}".format(disk.path))
|
||||
footer = ("Format or mount whole disk.")
|
||||
self.ui.set_header(header)
|
||||
self.ui.set_footer(footer)
|
||||
afv_view = AddFormatView(self.model, self, disk)
|
||||
afv_view = AddFormatView(self.model, self, disk, lambda : self.partition_disk(disk))
|
||||
self.ui.set_body(afv_view)
|
||||
|
||||
@view
|
||||
def format_mount_partition(self, partition):
|
||||
log.debug("format_entire {}".format(partition))
|
||||
if partition.fs() is not None:
|
||||
|
@ -257,7 +249,7 @@ class FilesystemController(BaseController):
|
|||
footer = ("Format and mount partition.")
|
||||
self.ui.set_header(header)
|
||||
self.ui.set_footer(footer)
|
||||
afv_view = AddFormatView(self.model, self, partition)
|
||||
afv_view = AddFormatView(self.model, self, partition, self.default)
|
||||
self.ui.set_body(afv_view)
|
||||
|
||||
def show_disk_information_next(self, disk):
|
||||
|
|
|
@ -46,10 +46,11 @@ class AddFormatForm(Form):
|
|||
|
||||
|
||||
class AddFormatView(BaseView):
|
||||
def __init__(self, model, controller, volume):
|
||||
def __init__(self, model, controller, volume, back):
|
||||
self.model = model
|
||||
self.controller = controller
|
||||
self.volume = volume
|
||||
self.back = back
|
||||
|
||||
self.form = AddFormatForm(model)
|
||||
if self.volume.fs() is not None:
|
||||
|
@ -71,8 +72,8 @@ class AddFormatView(BaseView):
|
|||
format_box = Padding.center_50(ListBox(body))
|
||||
super().__init__(format_box)
|
||||
|
||||
def cancel(self, button):
|
||||
self.controller.prev_view()
|
||||
def cancel(self, button=None):
|
||||
self.back()
|
||||
|
||||
def done(self, result):
|
||||
""" format spec
|
||||
|
@ -97,4 +98,4 @@ class AddFormatView(BaseView):
|
|||
result['fstype'] = None
|
||||
|
||||
log.debug("Add Format Result: {}".format(result))
|
||||
self.controller.add_format_handler(self.volume, result)
|
||||
self.controller.add_format_handler(self.volume, result, self.back)
|
||||
|
|
|
@ -20,11 +20,9 @@ configuration.
|
|||
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from urwid import connect_signal, Text
|
||||
|
||||
from subiquitycore.ui.container import Columns, ListBox
|
||||
from subiquitycore.ui.container import ListBox
|
||||
from subiquitycore.ui.form import (
|
||||
Form,
|
||||
FormField,
|
||||
|
@ -114,8 +112,8 @@ class AddPartitionView(BaseView):
|
|||
partition_box = Padding.center_50(ListBox(body))
|
||||
super().__init__(partition_box)
|
||||
|
||||
def cancel(self, button):
|
||||
self.controller.prev_view()
|
||||
def cancel(self, button=None):
|
||||
self.controller.partition_disk(self.disk)
|
||||
|
||||
def done(self, result):
|
||||
|
||||
|
|
|
@ -63,5 +63,5 @@ class DiskInfoView(BaseView):
|
|||
''' Return to FilesystemView '''
|
||||
self.controller.partition_disk(self.disk)
|
||||
|
||||
def cancel(self, button):
|
||||
def cancel(self, button=None):
|
||||
self.controller.partition_disk(self.disk)
|
||||
|
|
|
@ -150,7 +150,7 @@ class DiskPartitionView(BaseView):
|
|||
|
||||
def done(self, result):
|
||||
''' Return to FilesystemView '''
|
||||
self.controller.prev_view()
|
||||
self.controller.default()
|
||||
|
||||
def cancel(self, button):
|
||||
self.controller.prev_view()
|
||||
def cancel(self, button=None):
|
||||
self.controller.default()
|
||||
|
|
|
@ -203,7 +203,7 @@ class FilesystemView(BaseView):
|
|||
user_data=sig)))
|
||||
return Pile(opts)
|
||||
|
||||
def cancel(self, button):
|
||||
def cancel(self, button=None):
|
||||
self.controller.cancel()
|
||||
|
||||
def reset(self, button):
|
||||
|
|
|
@ -63,5 +63,5 @@ class InstallpathView(BaseView):
|
|||
def confirm(self, result, sig):
|
||||
self.signal.emit_signal(sig)
|
||||
|
||||
def cancel(self, button):
|
||||
def cancel(self, button=None):
|
||||
self.signal.emit_signal('prev-screen')
|
||||
|
|
Loading…
Reference in New Issue