def buttonevent_preview(self, event):
		print('debug: Preview...')
		self.options_generation()
		#system_preview = copy.deepcopy(self.system)
		tree = ET.parse(self.options.config_file)
		root = tree.getroot()
		system_preview = chris.System(root.attrib['name'], [])
		allnode, alllb, allimage = get_nodes.get_nodes(self.options.key_file, get_keys.get_keys(True, self.options.key_file))
		system_preview.reconfig(root, False, allnode, self.options, alllb)
		#system_preview.name = 'temp'
		if not reconfig_single.reconfig_single(self.options, system_preview, self.allnode, self.alllb, modifyxml = False):
			print('Error; reconfig_single()')
			return
		tree = ET.parse('configuration.preview.xml')
		root = tree.getroot()
		#print('debug: finish parsing')
		system_preview = chris.System(root.attrib['name'], [])
		if not system_preview.reconfig(root, False, allnode, self.options, alllb, preview = True):
			print('Error: Preview Failed')
			return
		#	#print('Warning: This faile might already cause some changes to the system')
		#	exit()
		print('hi')
		self.tree_generation(self.m_treeCtrl2, system_preview = system_preview)
		self.m_treeCtrl2.ExpandAll()
		self.m_staticText11.SetLabel("After Reconfig (Estimated)")
		self.m_treeCtrl2.Update()
	def buttonevent(self, event):
		print('debug: Send...')
		#print('debug: ori type: ' + self.system.clusters[1].mynodes[0].extra['instance_type'])
		self.options_generation()
		if not reconfig_single.reconfig_single(self.options, self.system, self.allnode, self.alllb):
			print('Error: reconfig_single()')
			return
		self.Close()
    system.generate_xml(options.config_file)
    print("debug: The file " + options.config_file + " has been updated")
    options.mode = "rs"

    # ..... input config file was been updated .....

    # activate GUI
    if options.gui == "y":
        guithread = gui_reconfigsingle.GUI_Thread_ReconfigSingle(options, system, allnode, alllb)
        guithread.setDaemon(True)
        print("debug: starting GUI")
        guithread.start()
        guithread.join()
        # command line
    else:
        if not reconfig_single.reconfig_single(options, system, allnode, alllb):
            print("Error: reconfig single cluster")
            exit()

# ..... temp config file was been generated .....
# --- The moves before this would not cause any actual change to the system on the cloud, jusy malnipulate the temp file ---

# ----- Reconfiguration -----
tree = ET.parse("configuration.tmp.xml")
root = tree.getroot()
# print('debug: finish parsing')
if str(root.tag) != "SYSTEM":
    print("Error: syntax error in reconfiguration.xml: <SYSTEM>: not " + root.tag)
    print("All changes discarded")
    exit()