← Back to team overview

mlhim-specs-dev team mailing list archive

[Branch ~cdd-dev/cdd/trunk] Rev 203: Added dialog to ask about workspace when the program starts.

 

------------------------------------------------------------
revno: 203
committer: Eduardo C. P. Ribeiro <eduardo.cesar@xxxxxxx>
branch nick: cdd
timestamp: Sun 2012-07-29 21:54:47 -0300
message:
  Added dialog to ask about workspace when the program starts.
modified:
  src/cdd.py
  src/cdg_main.py


--
lp:cdd
https://code.launchpad.net/~cdd-dev/cdd/trunk

Your team MLHIM Specifications Developers is subscribed to branch lp:cdd.
To unsubscribe from this branch go to https://code.launchpad.net/~cdd-dev/cdd/trunk/+edit-subscription
=== modified file 'src/cdd.py'
--- src/cdd.py	2012-07-30 00:51:05 +0000
+++ src/cdd.py	2012-07-30 00:54:47 +0000
@@ -169,10 +169,12 @@
 ######## Misc initializations ######################################
 
         self.config_dialog = cdg_main.ConfigDialog(self)
+        self.config_dialog.test_workspace_dir(self)
         self.metadata = mlhim2.Metadata(self)
         self.metadata.read_config()
         info.get_meta_info(self.metadata)
         
+        
 
     def OnSelChanged(self, event):
         item =  event.GetItem()

=== modified file 'src/cdg_main.py'
--- src/cdg_main.py	2012-07-30 00:51:05 +0000
+++ src/cdg_main.py	2012-07-30 00:54:47 +0000
@@ -2,6 +2,7 @@
 # generated by wxGlade 0.6.4 on Tue Jul 17 15:12:08 2012
 
 import os
+import os.path
 import sys
 import uuid
 import locale
@@ -326,9 +327,31 @@
         self.text_ctrl_autosave.SetValue(self.config.get('DEFAULT', 'autosave'))
         self.text_ctrl_workspace.SetValue(self.config.get('DEFAULT', 'workspace'))
 
+
+    def test_workspace_dir(self, panel):
+        workspace = self.config.get('DEFAULT', 'workspace')
+        if not os.path.exists(workspace):
+            dlg = wx.TextEntryDialog(panel, 'Please choose the workpspace directory.',
+                                  'Workspace', defaultValue=workspace)
+            result = dlg.ShowModal()
+            if result == wx.ID_OK:
+                workspace = dlg.GetValue()
+                self.config.set('DEFAULT', 'workspace', workspace)
+                self.set_panel_configs()
+                self.save_config()
+                if not os.path.isdir(workspace):
+                    try:
+                        os.mkdir(workspace)
+                    except OSError:
+                        popup_message(None, 'Workspace directory NOT created.', 'Error creating workspace dir', wx.ICON_EXCLAMATION)                        
+
+
+            dlg.Destroy()
+
 # end of class ConfigDialog
 
 
+# This class holds the XSD file that will be created.
 class Info(object):
     def __init__(self):
         self.title = ''