install

installer
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/install

commit 6a35598a6c50a01c38ea859d90bd4558b81399a3
parent 713d4d8b694bb7ad3c6bb0bf73a26836401a83dd
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue, 25 Oct 2016 17:22:26 +0200

Add(Network): Add network inputs / Support

Diffstat:
Ascreens/network/__init__.py | 0
Ascreens/network/network.py | 105+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mscreens/partitions/partitions.py | 2+-
3 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/screens/network/__init__.py b/screens/network/__init__.py diff --git a/screens/network/network.py b/screens/network/network.py @@ -0,0 +1,105 @@ +################################### LICENSE #################################### +# Copyright 2016 Louis Solofrizzo # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +## +# network.py +# Created: 25/10/2016 +# By: Louis Solofrizzo <louis@morphux.org> +## + +import curses +import os.path +import stat + +class Network: + + key = 0 + quit = 3 + main = 0 + + def init(self, main): + self.main = main + self.config = { + "id": 3, + "title": "Network", + "type": "input", + "input": [ + { + "name": "ip", + "title": "ENTER YOUR LOCAL IP", + "default": "192.168.0.1", + "type": "text", + "function": self.ip + }, + { + "name": "netmask", + "title": "NETMASK", + "default": "255.255.255.255", + "type": "text", + "function": self.netmask + }, + { + "name": "gateway", + "title": "ENTER YOUR GATEWAY", + "default": "", + "type": "text", + "function": self.gateway + }, + { + "name": "dns", + "title": "ENTER YOUR DNS", + "default": "8.8.8.8,4.4.4.4", + "type": "text", + "function": self.dns + }, + ] + } + return self.config + + def ip(self, string): + if len(string): + self.main.config("network.ip", string) + return 1 + self.main.error("IP cannot be blank") + return 0 + + def netmask(self, string): + if len(string): + self.main.config("network.netmask", string) + return 1 + self.main.error("Netmask cannot be blank") + return 0 + + def gateway(self, string): + if len(string): + self.main.config("network.gateway", string) + return 1 + self.main.error("Gateway cannot be blank") + return 0 + + + def dns(self, string): + if len(string): + self.main.config("network.dns", string) + return 1 + self.main.error("DNS cannot be blank") + return 0 + + def reset(self): + self.quit = 3 + + def refresh(self, win): + return self.quit diff --git a/screens/partitions/partitions.py b/screens/partitions/partitions.py @@ -131,9 +131,9 @@ class Partitions: def home(self, string): if self.exist(string): + self.quit = 3 self.main.config("partitions.home", string) return 1 - self.quit = 0 self.main.error("Partition " + string + " cannot be found") return 0