forked from vmware/photon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathostreeserverselector.py
executable file
·42 lines (34 loc) · 1.38 KB
/
ostreeserverselector.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python2
#
# Copyright (C) 2015 vmware inc.
#
# Author: Mahmoud Bassiouny <[email protected]>
import json
import os
import curses
from sets import Set
from jsonwrapper import JsonWrapper
from menu import Menu
from window import Window
from actionresult import ActionResult
class OSTreeServerSelector(object):
def __init__(self, maxy, maxx, install_config):
self.install_config = install_config
win_width = 50
win_height = 13
win_starty = (maxy - win_height) / 2
win_startx = (maxx - win_width) / 2
menu_starty = win_starty + 3
ostree_host_menu_items = [
("Default RPM-OSTree Server", self.set_default_repo_installation, True),
("Custom RPM-OSTree Server", self.set_default_repo_installation, False)
]
host_menu = Menu(menu_starty, maxx, ostree_host_menu_items)
self.window = Window(win_height, win_width, maxy, maxx, 'Select OSTree Server', True, host_menu)
def set_default_repo_installation(self, is_default_repo ):
self.install_config['default_repo'] = is_default_repo
return ActionResult(True, None)
def display(self, params):
if self.install_config['type'] == 'ostree_host':
return self.window.do_action()
return ActionResult(True, None)