[Avida-cvs] [Avida2-svn] r241 - trunk/source/python/AvidaGui2

jclune@myxo.css.msu.edu jclune at myxo.css.msu.edu
Thu Jul 14 21:01:02 PDT 2005


Author: jclune
Date: 2005-07-15 00:01:02 -0400 (Fri, 15 Jul 2005)
New Revision: 241

Modified:
   trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
   trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
Log:
If you click on an empty cell after having clicked on a full cell, the green outline around the previous cell is removed. 


Modified: trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2005-07-14 17:49:38 UTC (rev 240)
+++ trunk/source/python/AvidaGui2/pyOnePop_PetriDishCtrl.py	2005-07-15 04:01:02 UTC (rev 241)
@@ -72,6 +72,7 @@
     # self.m_petri_dish_ctrl.emit(PYSIGNAL("zoomSig"), 
     #   (self.m_petri_dish_ctrl.m_initial_target_zoom,))
 
+
   def setAvidaSlot(self, avida):
     print "pyOnePop_PetriDishCtrl.setAvidaSlot() ..."
     old_avida = self.m_avida

Modified: trunk/source/python/AvidaGui2/pyPetriDishCtrl.py
===================================================================
--- trunk/source/python/AvidaGui2/pyPetriDishCtrl.py	2005-07-14 17:49:38 UTC (rev 240)
+++ trunk/source/python/AvidaGui2/pyPetriDishCtrl.py	2005-07-15 04:01:02 UTC (rev 241)
@@ -1,4 +1,5 @@
 
+
 print """
 XXX fixme: in pyPetriDishCtrl.py,
 pyPetriDishCtrl.setAvidaSlot(),
@@ -56,10 +57,11 @@
     self.m_canvas_view.setHScrollBarMode(QScrollView.AlwaysOff)
 
     #adding manual ones
-    self.m_scroll_bar_width = 15  # also the height if vertical
+    self.m_scroll_bar_width = 15
     # the following settings get overridden once the scroll bars are necessary, so they are junk
     self.m_petri_dish_ctrl_h_scrollBar = QScrollBar(0,371,0,20,185,Qt.Horizontal,self.m_canvas_view)
     self.m_petri_dish_ctrl_v_scrollBar = QScrollBar(0,371,0,20,185,Qt.Vertical,self.m_canvas_view)
+    # end junk settings
     self.m_petri_dish_ctrl_h_scrollBar.setGeometry(0,371, 371,self.m_scroll_bar_width)
     self.m_petri_dish_ctrl_v_scrollBar.setGeometry(371,0,self.m_scroll_bar_width,371)
 
@@ -178,8 +180,12 @@
     self.m_org_clicked_on_item = org_clicked_on_item
     if self.m_org_clicked_on_item:
       self.updateCellItems(self.m_org_clicked_on_item.m_population_cell.GetID())
+      self.m_last_m_org_clicked_on_item = self.m_org_clicked_on_item
+    else:
+        if hasattr(self,"m_last_cell_outlined"):
+          self.m_last_cell_outlined.setPen(QPen(Qt.NoPen))
+          self.updateCellItems(self.m_last_m_org_clicked_on_item.m_population_cell.GetID())
 
-
   def updateCellItem(self, cell_id):
     if self.m_cell_info[cell_id] is None:
       self.m_cell_info[cell_id] = self.createNewCellItem(cell_id)
@@ -189,7 +195,8 @@
 
     if self.m_org_clicked_on_item:
       if cell_info_item.m_population_cell.GetID == self.m_org_clicked_on_item.m_population_cell.GetID:
-        cell_info_item.setPen(QPen(QColor(0,255,0)))      
+        cell_info_item.setPen(QPen(QColor(0,255,0)))
+        self.m_last_cell_outlined = cell_info_item      
 
   def updateCellItems(self, should_update_all = False):
     if self.m_cell_info:
@@ -206,7 +213,6 @@
           self.updateCellItem(cell_id)
 
       if self.m_canvas: self.m_canvas.update()
-#jmc this is where you put the AllCellsPaintedSignal      
 
   def extractPopulationSlot(self, send_reset_signal = False, send_quit_signal = False):
 
@@ -234,9 +240,9 @@
     self.m_world_matrix = QWMatrix()
     if self.m_canvas_view:
       self.m_world_matrix.scale(self.m_zoom_factor/self.m_target_dish_scaling, self.m_zoom_factor/self.m_target_dish_scaling)
-      trans_h_preadjust = ((self.m_canvas_view.size().height()-self.m_scroll_bar_width) - (self.m_map_cell_width * self.m_world_h)*
+      trans_h_preadjust = ((self.m_canvas_view.size().height()) - (self.m_map_cell_width * self.m_world_h)*
         (self.m_zoom_factor/self.m_target_dish_scaling))/2
-      trans_w_preadjust = ((self.m_canvas_view.size().width()-self.m_scroll_bar_width) - (self.m_map_cell_width * self.m_world_w)*
+      trans_w_preadjust = ((self.m_canvas_view.size().width()) - (self.m_map_cell_width * self.m_world_w)*
         (self.m_zoom_factor/self.m_target_dish_scaling))/2
 
       trans_h = trans_h_preadjust + self.m_v_scrollbar_offset*(self.m_zoom_factor/self.m_target_dish_scaling)




More information about the Avida-cvs mailing list