[Avida-cvs] [avida-svn] r431 - branches/developers/avida-edward/source/python/AvidaGui2

baerb@myxo.css.msu.edu baerb at myxo.css.msu.edu
Wed Jan 4 14:34:28 PST 2006


Author: baerb
Date: 2006-01-04 17:34:28 -0500 (Wed, 04 Jan 2006)
New Revision: 431

Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeOrganismCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyQuitDialogCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui
Log:
Improved user interface on file operations (still not linked to any actual code
yet)

Fixed problem with quitting.  Previously if you clicked on freeze than canceled
that freeze the quit function for the entire program would stop working (unless you clicked on freeze option a second time).  Now the quit option works after
freezing even if you cancel.



Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py	2006-01-03 22:50:36 UTC (rev 430)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeDialogCtrl.py	2006-01-04 22:34:28 UTC (rev 431)
@@ -19,8 +19,10 @@
     else:
       self.FullRadioButton.setEnabled(True)
     while (found_valid_name == False and dialog_result > 0):
-      while (self.exec_loop() and self.result() == 0):
-        pass
+      self.show()
+      self.exec_loop()
+      # while (self.exec_loop() and self.result() == 0):
+      #   pass
       dialog_result = self.result()
       tmp_name = str(self.FileNameLineEdit.text())
       if dialog_result == 0:

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeOrganismCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeOrganismCtrl.py	2006-01-03 22:50:36 UTC (rev 430)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezeOrganismCtrl.py	2006-01-04 22:34:28 UTC (rev 431)
@@ -15,8 +15,10 @@
     found_valid_name = False
     dialog_result = 1
     while (found_valid_name == False and dialog_result > 0):
-      while (self.exec_loop() and self.result() == 0):
-        pass
+      self.show()
+      self.exec_loop()
+      # while (self.exec_loop() and self.result() == 0):
+      #   pass
       dialog_result = self.result()
       tmp_name = str(self.FileNameLineEdit.text())
 

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2006-01-03 22:50:36 UTC (rev 430)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyFreezerCtrl.py	2006-01-04 22:34:28 UTC (rev 431)
@@ -260,11 +260,29 @@
   # if item is right clicked pull up services menu
 
   def right_clicked_itemSlot(self, item):
-    print item.text(0)
-    m_right_click_menu = pyRightClickDialogCtrl()
-    cancel_confirm = m_right_click_menu.showDialog()
-    print cancel_confirm
 
+    # check that the item is not at the top level
+
+    if item != None and item.depth() > 0:
+      top_level = item
+      while top_level.parent():
+        top_level = top_level.parent()
+
+      # Rebuild the file name
+
+      if str(top_level.text(0)).startswith(" Empty Petri"):
+        file_name = str(item.text(0)) + ".empty"
+      elif str(top_level.text(0)).startswith(" Full Petri"):
+        file_name = str(item.text(0)) + ".full"
+        file_name = os.path.join(file_name, "petri_dish")
+      elif str(top_level.text(0)).startswith(" Organism"):
+        file_name = str(item.text(0)) + ".organism"
+      file_name = os.path.join(self.m_session_mdl.m_current_freezer, file_name)
+
+      print "BDB " + str(file_name)
+      m_right_click_menu = pyRightClickDialogCtrl(item.text(0), file_name)
+      cancel_confirm = m_right_click_menu.showDialog()
+
   class itemDrag(QTextDrag):
     def __init__(self, item_name, parent=None, name=None):
       QStoredDrag.__init__(self, 'item name (QString)', parent, name)

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyQuitDialogCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyQuitDialogCtrl.py	2006-01-03 22:50:36 UTC (rev 430)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyQuitDialogCtrl.py	2006-01-04 22:34:28 UTC (rev 431)
@@ -26,8 +26,11 @@
   def showDialog(self):
     dialog_result = 1
     while (dialog_result > 0):
-      while (self.exec_loop() and self.result() == 0):
-        pass
+      self.show()
+      self.exec_loop()
+
+      # while (self.exec_loop() and self.result() == 0):
+      #   pass
       dialog_result = self.result()
       if dialog_result == 0:
         return self.CancelFlag

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py	2006-01-03 22:50:36 UTC (rev 430)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogCtrl.py	2006-01-04 22:34:28 UTC (rev 431)
@@ -9,28 +9,29 @@
 # return the name of a file to save information to be frozen
 
 class pyRightClickDialogCtrl (pyRightClickDialogView):
-  def __init__(self):
+  def __init__(self, item_name, file_name):
     pyRightClickDialogView.__init__(self)
-    self.connect(self.CancelPushButton, SIGNAL("clicked()"), self.DownCancelSlot)
-    self.connect(self.ConfirmPushButton, SIGNAL("clicked()"), self.DownConfirmSlot)
-    self.ConfirmFlag = 1
-    self.CancelFlag = 2
+    self.connect(self.ConfirmPushButton, SIGNAL("clicked()"), self.DoneDialogSlot)
+
+    print "BDB item_name = " + str(item_name) + " file_name = " + str(file_name)
+    self.DeleteFlag = 1
+    self.RenameFlag = 2
+    self.SaveAsFlag = 3
+    self.OpenFlag = 4
     
-  def DownCancelSlot(self):
-    self.QuitCancelButton.setDown(True)
-    
-  def DownConfirmSlot(self):
-    self.ConfirmPushButton.setDown(True)
-    
+  def DoneDialogSlot(self):
+    if self.DeleteRadioButton.isChecked():
+      self.done(self.DeleteFlag)
+    elif self.RenameRadioButton.isChecked():
+      self.done(self.RenameFlag)
+    elif self.SaveAsRadioButton.isChecked():
+      self.done(self.SaveAsFlag)
+    elif self.OpenRadioButton.isChecked():
+      self.done(self.OpenFlag)
+
   def showDialog(self):
-    dialog_result = 1
-    while (dialog_result > 0):
-      while (self.exec_loop() and self.result() == 0):
-        pass
-      dialog_result = self.result()
-      if dialog_result == 0:
-        return self.CancelFlag
-      elif self.ConfirmPushButton.isDown():
-        return self.ConfirmFlag
-      else:
-        return self.CancelFlag
+    self.show()
+    junk = self.exec_loop()
+    print "BDB junk = " + str(junk)
+    dialog_result = self.result()
+    print "BDB dialog_results = " + str(dialog_result)

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui	2006-01-03 22:50:36 UTC (rev 430)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyRightClickDialogView.ui	2006-01-04 22:34:28 UTC (rev 431)
@@ -147,5 +147,13 @@
         </vbox>
     </widget>
 </widget>
+<connections>
+    <connection>
+        <sender>CancelPushButton</sender>
+        <signal>clicked()</signal>
+        <receiver>pyRightClickDialogView</receiver>
+        <slot>close()</slot>
+    </connection>
+</connections>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>




More information about the Avida-cvs mailing list