Diff of /trunk/cforge/cforge/Package/CFORGE/Scripts/ui.py [r42] .. [r43]  Maximize  Restore

Switch to side-by-side view

--- a/trunk/cforge/cforge/Package/CFORGE/Scripts/ui.py
+++ b/trunk/cforge/cforge/Package/CFORGE/Scripts/ui.py
@@ -13,7 +13,7 @@
 import json
 import ntpath
 
-DialogResult = False
+GlobalResult = False
 
 class IFormSettings(Form):
 
@@ -41,7 +41,7 @@
 			
 			self.FolderBox = TextBox()
 			self.FolderBox.Text = Config["folder"]
-			self.FolderBox.Enabled = False
+			self.FolderBox.Enabled = True
 			self.FolderBox.Location = Point(60, y)
 			self.FolderBox.Parent = self
 			self.FolderBox.Width = 300
@@ -115,26 +115,30 @@
 		dialog.ShowHelp = True
 		dialog.ValidateNames = False;
 		dialog.CheckFileExists = False;
-		dialog.CheckPathExists = True;
+		dialog.CheckPathExists = False;
 		dialog.FileName = "Folder Selection"
 
 		if dialog.ShowDialog(self) == DialogResult.OK:
 			folder, file = ntpath.split(dialog.FileName)
+			print (self.FolderBox)
 			self.FolderBox.Text = folder
 
 	def OnClickOK(self, sender, event):
-		global DialogResult
+		global GlobalResult
 		# Return content of form in config structure
-		self.Config["folder"] = self.FolderBox.Text
-		self.Config["user"] = self.UserBox.Text
-		self.Config["pass"] = self.PassBox.Text
-		DialogResult = True
+		if hasattr(self, 'FolderBox'):
+			self.Config["folder"] = self.FolderBox.Text
+		if hasattr(self, 'UserBox'):
+			self.Config["user"] = self.UserBox.Text
+		if hasattr(self, 'PassBox'):
+			self.Config["pass"] = self.PassBox.Text
+		GlobalResult = True
 		self.Dispose()
 
 	def OnClickCancel(self, sender, event):
-		global DialogResult
+		global GlobalResult
 		# Discard form data, don't return it
-		DialogResult = False
+		GlobalResult = False
 		self.Dispose()
 		
 	   
@@ -158,15 +162,15 @@
 	with open(filename, "w") as f:
 		config = json.dump(config, f)
 	
-def Dialog(Title, Folder=True, Credentials=True, DefaultFolder=""):            
+def Dialog(Title, Folder=False, Credentials=False, DefaultFolder=""):            
 	config = GetSettings()
 		
 	if DefaultFolder != "":
 		folder, file = ntpath.split(config['folder'])
 		config['folder'] = os.path.join(folder, DefaultFolder)
 
-	Application.Run(IFormSettings("Checkout", Folder=Folder, Credentials=Credentials, Config=config))
-	if DialogResult:
+	Application.Run(IFormSettings(Title, Folder=Folder, Credentials=Credentials, Config=config))
+	if GlobalResult:
 		SaveSettings(config)
 		return config
 	else: