示例#1
0
 def click(self, event):
     mainRow, _ = self.HitTest(event.Position)
     if mainRow != -1:
         col = self.getColumn(event.Position)
         if col == self.getColIndex(State):
             try:
                 mainDrone = self.drones[mainRow]
             except IndexError:
                 return
             if mainDrone in self.original:
                 mainPosition = self.original.index(mainDrone)
                 positions = []
                 for row in self.getSelectedRows():
                     try:
                         drone = self.drones[row]
                     except IndexError:
                         continue
                     if drone in self.original:
                         positions.append(self.original.index(drone))
                 if mainPosition not in positions:
                     positions = [mainPosition]
                 self.mainFrame.command.Submit(
                     cmd.GuiToggleLocalDroneStatesCommand(
                         fitID=self.mainFrame.getActiveFit(),
                         mainPosition=mainPosition,
                         positions=positions))
                 return
     event.Skip()
示例#2
0
    def fitSelected(self, event):
        pyfalog.debug('====== Fit Selected: ' + repr(self) + str(bool(self)))

        if self.parent.IsActive(self):
            fitID = event.fitID
            startup = getattr(event, "startup", False)
            self.activeFitID = fitID
            sFit = Fit.getInstance()

            # VEETOR TINKERING START
            self.mainFrame.command.Submit(cmd.GuiToggleLocalDroneStatesCommand(
                fitID=fitID,
                mainPosition=0,
                positions=[0]))
            # VEETOR TINKERING END

            self.updateTab()
            if not startup or startup == 2:  # see OpenFitsThread in gui.mainFrame
                self.Show(fitID is not None)
                self.slotsChanged()
                sFit.switchFit(fitID)
                # @todo pheonix: had to disable this as it was causing a crash at the wxWidgets level. Dunno why, investigate
                wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))

            # VEETOR TINKERING START
            if self.mainFrame.options.fit is not None:
                fit_parsed = self.mainFrame.getActiveFit()
                from eos.db import getFit
                fit_db = getFit(fit_parsed)
                from service.port import Port
                exp = Port().exportFitStatsJson(fit_db)
                print(exp)
                sFit.deleteFit(fitID)
                wx.PostEvent(self.mainFrame, GE.FitRemoved(fitID=fitID))
                import sys
                sys.exit(0)
            # VEETOR TINKERING END

        event.Skip()