Browse Source

fixed plot bug with compare plot

also added tooltips for plot list
BlaXXuN 8 years ago
parent
commit
f5419beb08
4 changed files with 24 additions and 14 deletions
  1. 1 1
      KCG/VERSION
  2. 10 7
      KCG/base/leftbar.py
  3. 12 5
      KCG/base/plotWidget.py
  4. 1 1
      setup.py

+ 1 - 1
KCG/VERSION

@@ -1 +1 @@
-0.3.2.161.0331-beta
+0.3.2.162.0331-beta

+ 10 - 7
KCG/base/leftbar.py

@@ -434,6 +434,7 @@ class LeftBar(kcgw.KCGWidgets):
         if datatype == FILE:
             self.openData[unique_id].file_name = file_name
         self.openData[unique_id].setText(0, "Live" if datatype == LIVE else file_name.split('/')[-1])
+        self.openData[unique_id].setToolTip(0, "Live" if datatype == LIVE else file_name.split('/')[-1])
         self.openData[unique_id].setText(1, "Reading")
         if datatype == LIVE:  # Insert LIVE on top
             self.treeWidget.insertTopLevelItem(0, self.openData[unique_id])
@@ -537,12 +538,14 @@ class LeftBar(kcgw.KCGWidgets):
             brd = " B: "+available_boards.get_board_name_from_id(board_id)
         else:
             brd = ""
-        self.openPlots[unique_sub_id].setText(0, str(nr) + "." + self.possiblePlots[d_type] + " - ADC 1"+brd)
         if d_type == 4:  # Compare Plot
-            self.openPlots[unique_sub_id].setText(0, str(nr) + "." + self.possiblePlots[d_type] + " - ADC 1+2"+brd)
+            adc = "1+2"
+        else:
+            adc = "1"
         self.openPlots[unique_sub_id].is_child = True
         self.openPlots[unique_sub_id].usid = unique_sub_id
         self.openPlots[unique_sub_id].nr = nr
+        self.update_plot(unique_sub_id, d_type, adc+brd)
         self.openData[unique_id].addChild(self.openPlots[unique_sub_id])
         self.treeWidget.resizeColumnToContents(0)
 
@@ -612,17 +615,17 @@ class LeftBar(kcgw.KCGWidgets):
         del self.Data[unique_id]
 
     @QtCore.pyqtSlot(int, int, str)
-    def update_plot(self, uid, b_type, adc):
+    def update_plot(self, uid, b_type, add):
         """
         Updates the plot list when the type of a plot window changes
         :param uid: (int) unique id of the plot window to update
         :param b_type: (int) type of that plot window
-        :param int adc: the adc to update
+        :param str add: the add, board and additional text to update
         :return: -
         """
-        self.openPlots[uid].setText(
-                0, str(self.openPlots[uid].nr) + "." + self.possiblePlots[b_type] + " - ADC " + str(adc)
-        )
+        text = str(self.openPlots[uid].nr) + "." + self.possiblePlots[b_type] + " - ADC " + str(add)
+        self.openPlots[uid].setText(0, text)
+        self.openPlots[uid].setToolTip(0, text)
         self.treeWidget.resizeColumnToContents(0)
 
     def handle_dialog(self, value, diag=None,):

+ 12 - 5
KCG/base/plotWidget.py

@@ -683,12 +683,15 @@ class PlotWidget(kcgw.KCGWidgets):
         else:
             checked = [i.isChecked() for i in self.groupCompare.buttons()]
             self._single_adc_checked = False
-            self.adc = np.where(np.array(checked) == True)[0][0] + 1 # +1 because adcs are 1 based and indices 0
-            self.secadc = np.where(np.array(checked) == True)[0][1] + 1 # +1 because adcs are 1 based and indices 0
+            self.adc = np.where(np.array(checked) == True)[0][0] + 1  # +1 because adcs are 1 based and indices 0
+            self.secadc = np.where(np.array(checked) == True)[0][1] + 1  # +1 because adcs are 1 based and indices 0
             self.compare_heading_left.setText("ADC "+str(self.adc))
             self.compare_heading_right.setText("ADC "+str(self.secadc))
             self.change_identifier_text()
-            self.plot(self.theType)
+            if self.theType in [ERROR, NO_DATA]:
+                self.plot(self._old_type)
+            else:
+                self.plot(self.theType)
 
     def disable_buttons(self, b_bool):
         """
@@ -816,11 +819,15 @@ class PlotWidget(kcgw.KCGWidgets):
             the_text = str(self.adc)+"+"+str(self.secadc)
         else:
             the_text = str(self.adc)
+        if self.theType in [ERROR, NO_DATA]:
+            type = self._old_type
+        else:
+            type = self.theType
         if self.theDataType is LIVE:
-            self.change_type_signal.emit(self.theId, self.theType,
+            self.change_type_signal.emit(self.theId, type,
                                          the_text+" B: "+available_boards.get_board_name_from_id(self.board_id))
         else:
-            self.change_type_signal.emit(self.theId, self.theType, the_text)
+            self.change_type_signal.emit(self.theId, type, the_text)
 
     def closeEvent(self, event):
         """

+ 1 - 1
setup.py

@@ -5,7 +5,7 @@ DESCRIPTION = "KCG KAPTURE Control Gui"
 
 setup(
     name='KCG',
-    version='0.3.2.161.0331-beta',
+    version='0.3.2.162.0331-beta',
     author='Patrick Schreiber',
     author_email='uldfk@student.kit.edu',
 #    license='GPL',