install

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

commit 7506984bcdc0e4fad08a5d7351c99a5d4dc71197
parent d3bf3c5cdcf5e6a6fbbd4879b959c677840d799b
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Wed, 16 Nov 2016 18:33:12 +0100

Add(Load Configuration): Add the module, not working fully as expected

Diffstat:
Ascreens/load_conf/__init__.py | 0
Ascreens/load_conf/load_conf.py | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mscreens/main_menu/main_menu.py | 2+-
3 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/screens/load_conf/__init__.py b/screens/load_conf/__init__.py diff --git a/screens/load_conf/load_conf.py b/screens/load_conf/load_conf.py @@ -0,0 +1,73 @@ +################################### LICENSE #################################### +# Copyright 2016 Morphux # +# # +# 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. # +################################################################################ + +## +# load_conf.py +# Created: 16/11/2016 +# By: Louis Solofrizzo <louis@morphux.org> +## + +class Load_Conf: + +## +# Variables +## + + dlg = 0 # Dialog object + conf_lst = {} # List object for configuration + +## +# Functions +## + + # Init function, called by Main instance + def init(self, dialog, config_list): + self.dlg = dialog + self.conf_lst = config_list + self.config = { + "id": 2, + "name": "Load Configuration File" + } + return self.config + + # main function, called by Main instance + # The second parameter, d_path is the default starting path + def main(self, d_path = "/"): + + # Call to the file selection dialog box + code, path = self.dlg.fselect(d_path, height=20, width=60, title="Select the configuration file") + + # If user hit cancel + if (code == "cancel"): + return 0 + + # Try to open the file + try: + fd = open(path, 'r') + + # We got an error, show a message, then recall this function + except IOError: + self.dlg.msgbox("The file "+ path +" cannot be found.") + return self.main(path) + + with fd: + # All good, we can read the file + data = fd.read() + print(data) + sys.exit(1) + # We do nothing with this file, yet. + return 0 + diff --git a/screens/main_menu/main_menu.py b/screens/main_menu/main_menu.py @@ -55,7 +55,7 @@ For more information about the menu entries, See <Help> button"; "help": "Launch the full, assisted, Morphux system installation" }, "Custom Install": { - "t_id": 0, + "t_id": 2, "help": "Launch an automated install from a previous generated configuration file" }, "Boot": {