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

gerrishj@myxo.css.msu.edu gerrishj at myxo.css.msu.edu
Thu Jul 6 11:34:37 PDT 2006


Author: gerrishj
Date: 2006-07-06 14:34:37 -0400 (Thu, 06 Jul 2006)
New Revision: 805

Modified:
   branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsView.ui
   branches/developers/avida-edward/source/python/AvidaGui2/pyTaskDataCtrl.py
   branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py
Log:
Fixed margin issues in population stat box for Windows
Added task count to pyTaskDataCtrl
Fixed timeline geometry issues.


Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py	2006-07-06 17:55:09 UTC (rev 804)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOneOrg_ScopeCtrl.py	2006-07-06 18:34:37 UTC (rev 805)
@@ -17,6 +17,8 @@
     self.m_execution_step_slider.setMaxValue(0)
     self.m_timeline.setMinValue(0)
     self.m_timeline.setMaxValue(0)
+    # Use background color so timeline meter doesn't show up
+    self.m_timeline.setFillColor(self.m_timeline.colorGroup().background())
     self.m_timer = qt.QTimer()
     self.m_next = qt.QTimer()
     self.m_timer_interval = 100

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsView.ui
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsView.ui	2006-07-06 17:55:09 UTC (rev 804)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyOnePop_StatsView.ui	2006-07-06 18:34:37 UTC (rev 805)
@@ -328,7 +328,7 @@
                                 </font>
                             </property>
                             <property name="text">
-                                <string>Gestation (instructions):</string>
+                                <string>Gestation:</string>
                             </property>
                         </widget>
                         <spacer>
@@ -493,6 +493,9 @@
                                 <property name="name">
                                     <cstring>unnamed</cstring>
                                 </property>
+                                <property name="spacing">
+                                    <number>3</number>
+                                </property>
                                 <widget class="QLayoutWidget">
                                     <property name="name">
                                         <cstring>layout20_2</cstring>
@@ -1204,7 +1207,7 @@
                                 </font>
                             </property>
                             <property name="text">
-                                <string>Avg. Gestation (instructions):</string>
+                                <string>Avg. Gestation:</string>
                             </property>
                         </widget>
                         <spacer>
@@ -1405,6 +1408,9 @@
                         <property name="name">
                             <cstring>unnamed</cstring>
                         </property>
+                        <property name="spacing">
+                            <number>3</number>
+                        </property>
                         <widget class="QLayoutWidget">
                             <property name="name">
                                 <cstring>layout20</cstring>

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyTaskDataCtrl.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyTaskDataCtrl.py	2006-07-06 17:55:09 UTC (rev 804)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyTaskDataCtrl.py	2006-07-06 18:34:37 UTC (rev 805)
@@ -2,11 +2,11 @@
 
 class ColoredListViewItem(QListViewItem):
     "QListViewItem with colored text"
-    def __init__(self, parent, label1, label2):
-        QListViewItem.__init__(self, parent, label1, label2)
+    def __init__(self, parent, label1, label2, label3):
+        QListViewItem.__init__(self, parent, label1, label2, label3)
         self.color = Qt.black
-    def __init__(self, parent, label1, label2, color):
-        QListViewItem.__init__(self, parent, label1, label2)
+    def __init__(self, parent, label1, label2, label3, color):
+        QListViewItem.__init__(self, parent, label1, label2, label3)
         self.color = color
     def setColor(self, color):
         self.color = color
@@ -36,21 +36,31 @@
 
         self.addColumn("")
         self.addColumn("Task")
+        self.addColumn("Count")
         self.add_tasks()
         self.show()
 
     def add_tasks(self):
         self.list_items = []
         # TODO: set from TaskLib
-        self.list_items.append(ColoredListViewItem(self, "0", "not", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "1", "nand", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "2", "and", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "3", "orn", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "4", "or", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "5", "andn", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "6", "nor", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "7", "xor", Qt.gray))
-        self.list_items.append(ColoredListViewItem(self, "8", "equ", Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "0", "not", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "1", "nand", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "2", "and", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "3", "orn", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "4", "or", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "5", "andn", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "6", "nor", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "7", "xor", "0",
+						   Qt.gray))
+        self.list_items.append(ColoredListViewItem(self, "8", "equ", "0",
+						   Qt.gray))
         self.uncompleted_tasks = [0, 1, 2, 3, 4, 5, 6, 7, 8]
 
     def setReadFn(self, sender, read_fn):
@@ -62,12 +72,13 @@
         "Called when a frame is shown"
         if frames is not None and frame_no < frames.m_gestation_time:
             for task in self.uncompleted_tasks:
-                if frames.m_tasks_info[frame_no][task] > 0:
+		count = frames.m_tasks_info[frame_no][task]
+		self.list_items[task].setText(2, str(count))
+                if count > 0:
                     self.list_items[task].dim(False)
                 else:
                     self.list_items[task].dim(True)
                 self.list_items[task].repaint()
-#                self.repaint()
 
     def reset():
         "Reset the uncompleted tasks"

Modified: branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py
===================================================================
--- branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py	2006-07-06 17:55:09 UTC (rev 804)
+++ branches/developers/avida-edward/source/python/AvidaGui2/pyTimeline.py	2006-07-06 18:34:37 UTC (rev 805)
@@ -65,17 +65,14 @@
         if self.maxValue() == 0.0:
             # Uninitialized range
             return
-        # adj adjusts for the pixmap size
-#        adj = flag.pos - (flag.widget.pixmap_size.width() / 2)
-
-        adj = flag.pos - flag.widget.width() / 2
-        # adjust for borders
-        borders = self.borderWidth() * 2 + 13
-        # FIXME: horrible hack 418 depends on current geometry of window
-        # TODO: figure out proper geometry code
-        a = self.width() - 418
+        # center widget
+	adj = flag.widget.width() / 2
+	frame = self.frameSize().width() - self.width()
+	# default margin size is 10 (QwtThermo docs)
+	borders = self.borderWidth() + 10
+	a = self.width() - frame - (borders * 2)
         mult = a / (self.maxValue() - self.minValue())
-        flag.widget.move((flag.pos * mult) + adj + borders, 2)
+        flag.widget.move((flag.pos * mult) + (frame / 2) + borders - adj, 2)
 
     def removeFlag(self, pos):
         "Remove flag from timeline position pos"




More information about the Avida-cvs mailing list