Unverified Commit 30e051f0 authored by AJ Fite's avatar AJ Fite 🚀
Browse files

Finishes required addition and closes #5

parent 4c6a3085
Loading
Loading
Loading
Loading
+137 −3
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@
   <rect>
    <x>0</x>
    <y>0</y>
    <width>698</width>
    <height>564</height>
    <width>981</width>
    <height>672</height>
   </rect>
  </property>
  <property name="windowTitle">
@@ -213,6 +213,12 @@
   </item>
   <item row="0" column="0">
    <widget class="QLabel" name="label">
     <property name="sizePolicy">
      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
       <horstretch>0</horstretch>
       <verstretch>0</verstretch>
      </sizepolicy>
     </property>
     <property name="font">
      <font>
       <pointsize>15</pointsize>
@@ -238,7 +244,7 @@
     </property>
    </widget>
   </item>
   <item row="14" column="0">
   <item row="18" column="0">
    <widget class="QDialogButtonBox" name="buttonBox">
     <property name="orientation">
      <enum>Qt::Horizontal</enum>
@@ -269,6 +275,130 @@
     </item>
    </layout>
   </item>
   <item row="16" column="0">
    <layout class="QHBoxLayout" name="horizontalLayout_13">
     <item>
      <widget class="QLabel" name="label_16">
       <property name="text">
        <string>dbg_ser_noavg (Disable averaging of serial data)</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="avgDisable">
       <property name="text">
        <string>Averaging Enabled</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgsernoavggroup</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="avgEnable">
       <property name="text">
        <string>Averaging Disabled</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgsernoavggroup</string>
       </attribute>
      </widget>
     </item>
    </layout>
   </item>
   <item row="15" column="0">
    <layout class="QHBoxLayout" name="horizontalLayout_12">
     <item>
      <widget class="QLabel" name="label_15">
       <property name="text">
        <string>dbg_print (Enable debug prints)</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="printEnable">
       <property name="text">
        <string>Enable</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgprintgroup</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="printDisable">
       <property name="text">
        <string>Disable</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgprintgroup</string>
       </attribute>
      </widget>
     </item>
    </layout>
   </item>
   <item row="14" column="0">
    <layout class="QHBoxLayout" name="horizontalLayout_8">
     <item>
      <widget class="QLabel" name="label_14">
       <property name="text">
        <string>dbg_testmode1 (Disable FFC on 1st lepton)</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="testmodeDisable">
       <property name="text">
        <string>Enable FFC</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgtestmodegroup</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="testmodeEnable">
       <property name="text">
        <string>Disable FFC</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgtestmodegroup</string>
       </attribute>
      </widget>
     </item>
    </layout>
   </item>
   <item row="17" column="0">
    <layout class="QHBoxLayout" name="horizontalLayout_14">
     <item>
      <widget class="QLabel" name="label_17">
       <property name="text">
        <string>dbg_no_serial (Disable serial support)</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="serialDisable">
       <property name="text">
        <string>Serial Enabled</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgnoserialgroup</string>
       </attribute>
      </widget>
     </item>
     <item>
      <widget class="QRadioButton" name="serialEnable">
       <property name="text">
        <string>Serial Disabled</string>
       </property>
       <attribute name="buttonGroup">
        <string notr="true">dbgnoserialgroup</string>
       </attribute>
      </widget>
     </item>
    </layout>
   </item>
  </layout>
 </widget>
 <resources/>
@@ -309,5 +439,9 @@
 <buttongroups>
  <buttongroup name="dbgcsvgroup"/>
  <buttongroup name="dbgpnggroup"/>
  <buttongroup name="dbgtestmodegroup"/>
  <buttongroup name="dbgprintgroup"/>
  <buttongroup name="dbgsernoavggroup"/>
  <buttongroup name="dbgnoserialgroup"/>
 </buttongroups>
</ui>
+17 −0
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ class Config:
        Config.dbg_capture_count = 720
        Config.dbg_serial_csv = True
        Config.dbg_lepton_set = 7

        # Note that this block of config values is named for whether the
        # flag they correspond to is on or not, so it logically could seem
        # backwards
        Config.dbg_testmode1 = False
        Config.dbg_print = False
        Config.dbg_ser_noavg = False
@@ -163,6 +167,15 @@ class ConfigEditor(QDialog):
        self.csvEnable.setChecked(Config.dbg_serial_csv)
        self.csvDisable.setChecked(not Config.dbg_serial_csv)

        self.testmodeEnable.setChecked(Config.dbg_testmode1)
        self.testmodeDisable.setChecked(not Config.dbg_testmode1)
        self.printEnable.setChecked(Config.dbg_print)
        self.printDisable.setChecked(not Config.dbg_print)
        self.avgEnable.setChecked(Config.dbg_ser_noavg)
        self.avgDisable.setChecked(not Config.dbg_ser_noavg)
        self.serialEnable.setChecked(Config.dbg_no_serial)
        self.serialDisable.setChecked(not Config.dbg_no_serial)

    def apply_settings(self):
        parser = SafeConfigParser(allow_no_value=True)

@@ -179,6 +192,10 @@ class ConfigEditor(QDialog):

        Config.dbg_png = self.pngEnable.isChecked()
        Config.dbg_serial_csv = self.csvEnable.isChecked()
        Config.dbg_testmode1 = self.testmodeEnable.isChecked()
        Config.dbg_print = self.printEnable.isChecked()
        Config.dbg_ser_noavg = self.avgEnable.isChecked()
        Config.dbg_no_serial = self.serialEnable.isChecked()

        Config.write_config(parser)

+14 −1
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ class MainWindow(QMainWindow):
        self.imgW.setEnabled(status)
        self.imgNW.setEnabled(status)
        self.imgCenter.setEnabled(status)
        self.actionSettings.setDisabled(status)  # TODO: Test me

    # Triggered when the QProcess that runs the lepton-grabber runs
    def process_started(self):
@@ -167,7 +168,19 @@ class MainWindow(QMainWindow):
                                    " --dbg_serial_csv "
                                    + str(int(Config.dbg_serial_csv)) +
                                    " --dbg_lepton_set "
                                    + str(Config.dbg_lepton_set) + "\n")
                                    + str(Config.dbg_lepton_set)
                                    + (" --dbg_testmode1"
                                       if Config.dbg_testmode1
                                       else "")
                                    + (" --dbg_print" if Config.dbg_print
                                       else "")
                                    + (" --dbg_ser_noavg"
                                       if Config.dbg_ser_noavg
                                       else "")
                                    + (" --dbg_no_serial"
                                       if Config.dbg_no_serial
                                       else "")
                                    + "\n")
                                   .encode('utf-8'))

        self.simfProcess.writeData("exit\n".encode('utf-8'))