コード例 #1
0
 def RunAcWindows(self):
     self.ActivationWindows.setDisabled(True)
     self.AcWindowsThread = Threads(2)
     self.AcWindowsThread.AotStepOneSignal.connect(self.OneWindowsBar)
     self.AcWindowsThread.AotStepTwoSignal.connect(self.TwoWindowsBar)
     self.AcWindowsThread.AotStepThreeSignal.connect(self.ThreeWindowsBar)
     self.AcWindowsThread.AotFinishSignal.connect(self.AcWindowsTips)
     self.AcWindowsThread.start()
コード例 #2
0
 def RunAcOffice(self):
     self.ActivationOffice.setDisabled(True)
     self.AcOfficeThread = Threads(3)
     self.AcOfficeThread.AotOfficePathError.connect(self.PathError)
     self.AcOfficeThread.AotStepOneSignal.connect(self.OneOfficeBar)
     self.AcOfficeThread.AotStepTwoSignal.connect(self.TwoOfficeBar)
     self.AcOfficeThread.AotStepThreeSignal.connect(self.ThreeOfficeBar)
     self.AcOfficeThread.AotFinishSignal.connect(self.AcOfficeTips)
     self.AcOfficeThread.GetUserDirSignal.connect(self.GetUserDir)
     self.AcOfficeThread.start()
コード例 #3
0
    def readline_stdin(self):
        if Threads.is_gui_thread():
            raise RuntimeError, "Cannot call readline_stdin from GUI thread"

        if len(self.input_result) == 0:
            Threads.run_on_gui_thread(self.request_input)
            self.input_event.wait()
            self.input_event.clear()

        result = self.input_result
        self.input_result = ""
        return result
コード例 #4
0
    def write(self, data):
        console = None
        if "value" in dir(_python_console):
            console = _python_console.value

        if console is None:
            self.stdout.write(data)
        else:
            if self.error:
                Threads.run_on_gui_thread(lambda: console.write_stderr(data))
            else:
                Threads.run_on_gui_thread(lambda: console.write_stdout(data))
コード例 #5
0
    def readline_stdin(self):
        if Threads.is_gui_thread():
            raise RuntimeError("Cannot call readline_stdin from GUI thread")

        if len(self.input_result) == 0:
            Threads.run_on_gui_thread(self.request_input)
            self.input_event.wait()
            self.input_event.clear()

        result = self.input_result
        self.input_result = ""
        return result
コード例 #6
0
    def write(self, data):
        console = None
        if "value" in dir(_python_console):
            console = _python_console.value

        if console is None:
            self.stdout.write(data)
        else:
            if self.error:
                Threads.run_on_gui_thread(lambda: console.write_stderr(data))
            else:
                Threads.run_on_gui_thread(lambda: console.write_stdout(data))
コード例 #7
0
 def getGPSReport(self):
     if DataManager._gpsSession is False:
         #This starts a thread which self connects
         DataManager._gpsSession = Thrd.GpsPoller()
         DataManager._gpsSession.start()
     
     return DataManager._gpsSession.curReport
コード例 #8
0
def FourNumCalc(numRange, expRange, minReq, board, operators):

    formulaCombos = cf.getFormulas(operators, True)
    group1, group2, group3 = cf.getNumCombs(numRange, expRange, True)
    outerDict, innerDict = th.StartThreads(formulaCombos, group1, group2,
                                           group3, board, minReq, True)
    return outerDict, innerDict
コード例 #9
0
 def startLaserShark(self, event):
     print "Connecting to OpenSL Printer..."
     self.connected = True
     self.disconnectFromLaserSharkButton.Enable()
     self.connectToLaserSharkButton.Disable()
     self.launch_openlase()
     self.loadPrintThread = Threads.PrintLoader()
コード例 #10
0
 def beginLog(self):  
     #Make sure previous one is stopped
     DataManager.stopLog()
     
     DataManager.rwThread = Thrd.RWThread()
     DataManager.isRecording = True
     DataManager.rwThread.start()
コード例 #11
0
def start_snapshot(self):
    self.Snap_Thread = Threads.Snap()
    self.Snap_Thread.transmit.connect(lambda: UI_Update.transmit_update(self))
    self.Snap_Thread.started.connect(lambda: UI_Update.snap_start(self))
    self.Snap_Thread.finished.connect(lambda: UI_Update.snap_complete(self))

    self.Snap_Thread.start()
コード例 #12
0
    def onLongitudinalClicked(self):
        Ui_MainWindow.DisableAnalysisButtons(self)
        Ui_MainWindow.predictionArea = [0, 0, 0, 0]
        # Bools to keep track:
        Ui_MainWindow.goodPredicted = False
        Ui_MainWindow.badPredicted = False
        Ui_MainWindow.goodpredictionList = []
        Ui_MainWindow.badpredictionList = []

        #Make a messagebox to ask how you wanna do this:
        msgBox = QtWidgets.QMessageBox(self)
        msgBox.setWindowTitle("Assurance - Longitudinal analysis")
        msgBox.setText(
            "For this supervised approach you will need to set aside files that have not been included in the main dataset which will be randomly divided into test and training sets. You need to divide those files into examples of good and bad quality. How would you like to do so?"
        )
        msgBox.addButton(QtWidgets.QPushButton('Select from graph of IDs'),
                         QtWidgets.QMessageBox.YesRole)
        msgBox.addButton(
            QtWidgets.QPushButton('Select from table of quality metrics'),
            QtWidgets.QMessageBox.YesRole)
        msgBox.addButton(QtWidgets.QPushButton('Cancel'),
                         QtWidgets.QMessageBox.RejectRole)
        ret = msgBox.exec_()

        if ret == 0:  # They want the graph

            tpep = Threads.SideThread(self.GetTrainingSetTable)
            tpep.signals.result.connect(self.OnParserThreadFinish)
            self.threadpool.start(tpep)

        elif ret == 1:  # They want the table
            FileInput.BrowseWindow.GetTrainingQualityFiles(self)
            if FileInput.BrowseWindow.NullError:
                QtWidgets.QMessageBox.warning(
                    self, "Error",
                    "Is it possible there may be unnecessary spaces in your tsv? Two spaces next to each other will create a NaN column.Fix the file and upload it again."
                )
                FileInput.BrowseWindow.__init__(Ui_MainWindow)
                FileInput.BrowseWindow.GetTrainingQualityFiles(Ui_MainWindow)
            if hasattr(Ui_MainWindow, "Numerictrainingmetrics"):
                if len(Ui_MainWindow.Numerictrainingmetrics) > 0:
                    Ui_MainWindow.TrainingOrTestSet = QtWidgets.QTabWidget()
                    Ui_MainWindow.TrainingOrTestSet.setStyleSheet(
                        "margin: 2px;")
                    Ui_MainWindow.sIndex = self.addTab(
                        Ui_MainWindow.TrainingOrTestSet,
                        "Setting up the training set:")
                    RandomForest.RandomForest.createTable(self)
                    self.setCurrentIndex(Ui_MainWindow.sIndex)
                    Ui_MainWindow.RandomForestPerformed = True
                    Ui_MainWindow.pdf.setEnabled(True)
                else:
                    QtWidgets.QMessageBox.warning(self, "Error",
                                                  "Something went wrong.")
            else:
                Ui_MainWindow.EnableAnalysisButtons(self)

        elif ret == 2:  #Cancelled
            Ui_MainWindow.EnableAnalysisButtons(self)
コード例 #13
0
    def read_stdin(self, size):
        if Threads.is_gui_thread():
            raise RuntimeError, "Cannot call read_stdin from GUI thread"

        if len(self.input_result) == 0:
            Threads.run_on_gui_thread(self.request_input)
            self.input_event.wait()
            self.input_event.clear()

        if len(self.input_result) > size:
            result = self.input_result[0:size]
            self.input_result = self.input_result[size:]
            return result

        result = self.input_result
        self.input_result = ""
        return
コード例 #14
0
def sensor_init(self):
    try:
        self.Sensor_Thread = Threads.Sensor()
        self.Sensor_Thread.update.connect(
            lambda: UI_Update.sensor_update(self))
        self.Sensor_Thread.start()
    except Exception as e:
        print(e)
コード例 #15
0
ファイル: Main.py プロジェクト: CoSE-Jerry/3D-Clinostat
    def sensor_init(self):

            os.system("i2cdetect -y 1 > ../_temp/output.txt")

            if '1f' in open('../_temp/output.txt').read():
                self.Sensor_Thread = Threads.Sensor()
                self.Sensor_Thread.update.connect(lambda: UI_Update.sensor_update(self))
                self.Sensor_Thread.start()
コード例 #16
0
    def read_stdin(self, size):
        if Threads.is_gui_thread():
            raise RuntimeError("Cannot call read_stdin from GUI thread")

        if len(self.input_result) == 0:
            Threads.run_on_gui_thread(self.request_input)
            self.input_event.wait()
            self.input_event.clear()

        if len(self.input_result) > size:
            result = self.input_result[0:size]
            self.input_result = self.input_result[size:]
            return result

        result = self.input_result
        self.input_result = ""
        return 
コード例 #17
0
ファイル: FS.py プロジェクト: ObserverSputnik/FS3399
def snailInit(processMode):
	global Pflag
	Pflag = processMode
	VS.Init(processMode)
	MC.Init()
	Threads.ThreadInit(processMode)
	MC.SetMotor(cmd,250)
	time.sleep(1)
コード例 #18
0
def start_sequence(self):

    if(Settings.image_format):
        Settings.file = Settings.full_dir + "/" + Settings.sequence_name + "_%04d.jpg"
    else:
        Settings.file = Settings.full_dir + "/" + Settings.sequence_name + "_%04d.png"
    self.Progress_Bar.setMaximum(Settings.total)

    try:
        if not Settings.timelapse_running:
            Functions.Camera_update(self)

            self.Imaging_Thread = Threads.Image()
            self.Imaging_Thread.started.connect(
                lambda: UI_Update.timelapse_update(self))
            self.Imaging_Thread.finished.connect(
                lambda: UI_Update.timelapse_update(self))
            self.Imaging_Thread.capturing.connect(
                lambda: UI_Update.imaging_disable(self))
            self.Imaging_Thread.complete.connect(
                lambda: UI_Update.update_frame(self, Settings.current_image))
            self.Imaging_Thread.start()
        else:
            Settings.timelapse_running = False
            UI_Update.timelapse_update(self)

    except Exception as e:
        print(e)

    if(Settings.storage_mode):
        try:
            if Settings.cloudTypeComboSelection == 0:
                print("Starting Dropbox Sync Thread")
                self.Dropbox_Thread = Threads.Dropbox()
                self.Dropbox_Thread.start()

                self.Email_Thread = Threads.Email()
                self.Email_Thread.start()
            elif Settings.cloudTypeComboSelection == 1:
                print("Starting Cyverse Sync Thread")
                self.Cyverse_Thread = Threads.Cyverse()
                self.Cyverse_Thread.start()

        except Exception as e:
            print(e)
コード例 #19
0
    def onBrowseClicked(self, database):

        FileInput.BrowseWindow.__init__(Ui_MainWindow)
        inputFiles = FileInput.BrowseWindow.GetInputFile(Ui_MainWindow)
        #Threading
        tbrowse = Threads.SideThread(
            lambda: self.ParseFiles(inputFiles, database))
        tbrowse.signals.result.connect(self.ThreadingFix)
        self.threadpool.start(tbrowse)
コード例 #20
0
 def launch_openlase(self):
     print "Connecting to Serial " + self.serialport.GetValue(
     ) + "@ " + self.baud.GetValue()
     self.printerSerial.connect(self.serialport.GetValue(),
                                self.baud.GetValue())
     self.loadLaserSharkThread = Threads.Loader()
     self.launch_qjackctl()
     self.launch_openlase_output()
     self.launch_openlase_simulator()
     self.launch_lasershark_host_app()
コード例 #21
0
def start_preview(self):

    self.Preview_Thread = Threads.Preview()
    self.Preview_Thread.transmit.connect(
        lambda: UI_Update.transmit_update(self))
    self.Preview_Thread.started.connect(lambda: UI_Update.snap_start(self))
    self.Preview_Thread.finished.connect(
        lambda: UI_Update.preview_complete(self))

    self.Preview_Thread.start()
コード例 #22
0
ファイル: Main.py プロジェクト: Zavhorodnii/Remembrall_v.2
 def __init__(self, database, remembral_settings):
     self.__buttons = Buttons.Buttons()
     self.__database = database
     self.__remembral_settings = remembral_settings
     self.__threads = Threads.Threads(self.__database, self.__buttons)
     self.__commandStart = CommandStart.CommandStart(self.__database, self.__buttons)
     self.__buttonPressShow = ButtonPressShow.ButtonPressShow(self.__database, self.__buttons)
     self.__buttonPressDelete = ButtonPressDelete.ButtonPressDelete(self.__database,  self.__threads)
     self.__buttonPressTransfer = ButtonPressTransfer.ButtonPressTransfer(self.__database, self.__threads, self.__buttons)
     self.__buttonPressCreate = ButtonPressCreate.ButtonPressCreate(self.__threads, self.__database, self.__buttons, self.__buttonPressTransfer)
     self.__remembrall = None
コード例 #23
0
 def getSpeed(self):
     if DataManager._hallSpeedSess is False:
         DataManager._hallSpeedSess = Thrd.HallSensors(DataManager.isEmulate)
         DataManager._hallSpeedSess.start()
     
     TotS = 0;
     for i in range(1,3):
         obj = DataManager._hallSpeedSess;
         TotS = TotS + (obj.stamps[i][0] - obj.stamps[i][1])
         
     return 1/((TotS/6)*21) #rev/s
コード例 #24
0
def start_livefeed(self):
    try:
        Settings.livetime = self.liveFeed_spinBox.value()
        self.livefeed_Thread = Threads.Live()
        self.livefeed_Thread.started.connect(
            lambda: UI_Update.imaging_disable(self))
        self.livefeed_Thread.finished.connect(
            lambda: UI_Update.imaging_enable(self))
        self.livefeed_Thread.start()

    except Exception as e:
        print(e)
コード例 #25
0
def start_snapshot(self):
    try:
        Functions.Camera_update(self)
        self.Snap_Thread = Threads.Snap()
        self.Snap_Thread.started.connect(
            lambda: UI_Update.imaging_disable(self))
        self.Snap_Thread.finished.connect(
            lambda: UI_Update.update_frame_snap(self, "../_temp/snapshot.jpg"))
        self.Snap_Thread.start()

    except Exception as e:
        print(e)
コード例 #26
0
ファイル: Main.py プロジェクト: CoSE-Jerry/3D-Clinostat
 def start_snapshot(self):
     try:
         self.Snap_Thread = Threads.Snap()
         self.Snap_Thread.transmit.connect(lambda: UI_Update.transmit_update(self))
         self.Snap_Thread.started.connect(lambda: UI_Update.imaging_start(self))
         self.Snap_Thread.finished.connect(lambda: UI_Update.snap_complete(self))
         self.Snap_Thread.ir.connect(lambda: self.ir_imaging())
         
         self.Snap_Thread.start()
         
     except Exception as e:
         print(e)
コード例 #27
0
ファイル: Main.py プロジェクト: CoSE-Jerry/3D-Clinostat
    def start_preview(self):
        try:
            self.Preview_Thread = Threads.Preview()
            self.Preview_Thread.transmit.connect(lambda: UI_Update.transmit_update(self))
            self.Preview_Thread.started.connect(lambda: UI_Update.imaging_start(self))
            self.Preview_Thread.finished.connect(lambda: UI_Update.preview_complete(self))
            self.Preview_Thread.ir.connect(lambda: self.ir_imaging())

            self.Preview_Thread.start()
            
        except Exception as e:
            print(e)
コード例 #28
0
def CV_authenticate(self):
    Settings.cyverseUsername = self.cyverseUsername_lineEdit.text()
    Settings.cyversePassword = self.cyversePassword_lineEdit.text()
    try:
        self.Auth_Thread = Threads.Auth()
        self.Auth_Thread.started.connect(
            lambda: UI_Update.CV_authenticating(self))
        self.Auth_Thread.finished.connect(
            lambda: UI_Update.CV_authenticated(self))
        self.Auth_Thread.start()

    except Exception as e:
        print(e)
コード例 #29
0
ファイル: Main.py プロジェクト: CoSE-Jerry/3D-Clinostat
    def start_cycle(self):
        if not Settings.cycle_running:
            try:
                self.Cycle_Thread = Threads.Cycle()
                self.Cycle_Thread.started.connect(lambda: UI_Update.cycle_start(self))
                self.Cycle_Thread.finished.connect(lambda: UI_Update.cycle_end(self))

                self.Cycle_Thread.start()
                
            except Exception as e:
                print(e)
        else:
            Settings.cycle_running = False
コード例 #30
0
def start_cycle(self):
    if not Settings.cycle_running:
        try:
            Settings.cycle_time = self.powerCycle_spinBox.value()

            self.Cycle_Thread = Threads.Cycle()
            self.Cycle_Thread.started.connect(
                lambda: UI_Update.cycle_update(self))
            self.Cycle_Thread.start()

        except Exception as e:
            print(e)
    else:
        Settings.cycle_running = False
        UI_Update.cycle_update(self)
コード例 #31
0
def start_cycle(self):
    if not Settings.cycle_running:
        try:
            self.Cycle_Thread = Threads.Cycle()
            self.Cycle_Thread.started.connect(
                lambda: UI_Update.cycle_start(self))
            self.Cycle_Thread.finished.connect(
                lambda: UI_Update.cycle_end(self))

            self.Cycle_Thread.start()

        except Exception as e:
            print(e, "cycle failure, please contact Jerry for support")
    else:
        Settings.cycle_running = False
コード例 #32
0
def start_preview(self):
    try:
        Functions.Camera_update(self)
        self.Preview_Thread = Threads.Preview()
        self.Preview_Thread.started.connect(
            lambda: UI_Update.imaging_disable(self))
        if(Settings.image_format):
            self.Preview_Thread.finished.connect(
                lambda: UI_Update.update_frame_alt(self, "../_temp/preview.jpg"))
        else:
            self.Preview_Thread.finished.connect(
                lambda: UI_Update.update_frame_alt(self, "../_temp/preview.png"))
        self.Preview_Thread.start()

    except Exception as e:
        print(e)
コード例 #33
0
def schedule_test(self):
    if not Settings.test_running:
        try:
            Settings.angle_1 = self.rotate1_spinbox.value()
            Settings.angle_2 = self.rotate2_spinbox.value()
            self.Test_Thread = Threads.Test()
            self.Test_Thread.started.connect(
                lambda: UI_Update.test_update(self))
            self.Test_Thread.finished.connect(
                lambda: UI_Update.test_update(self))
            self.Test_Thread.start()
        except Exception as e:
            print(e)
    else:
        Settings.test_running = False
        UI_Update.test_update(self)
コード例 #34
0
    def __init__(self, console):
        threading.Thread.__init__(self)
        self.console = console
        self.globals = {"__name__":"__console__", "__doc__":None}
        self.code = None
        self.event = threading.Event()
        self.done = threading.Event()
        self.exit = False
        self.interpreter = code.InteractiveInterpreter(self.globals)

        # There is no way to interrupt a thread that isn't the main thread, so
        # to avoid not being able to close the app, create the thread as
        # as daemon thread.
        self.daemon = True

        # Set up environment with useful variables and functions
        self.globals["data"] = Threads.GuiObjectProxy(self.console.view.data)
        self.globals["exe"] = Threads.GuiObjectProxy(self.console.view.exe)
        self.globals["view"] = Threads.GuiObjectProxy(self.console.view)

        self.globals["current_view"] = Threads.GuiObjectProxy(lambda: self.console.view.view)
        self.globals["change_view"] = Threads.GuiObjectProxy(lambda type: self.console.view.setViewType(type))
        self.globals["navigate"] = Threads.GuiObjectProxy(lambda type, pos: self.console.view.navigate(type, pos))
        self.globals["create_file"] = Threads.GuiObjectProxy(lambda data: Threads.create_file(data))

        self.globals["cursor"] = Threads.GuiObjectProxy(lambda: self.console.view.view.get_cursor_pos())
        self.globals["set_cursor"] = Threads.GuiObjectProxy(lambda pos: self.console.view.view.set_cursor_pos(pos))
        self.globals["selection_range"] = Threads.GuiObjectProxy(lambda: self.console.view.view.get_selection_range())
        self.globals["set_selection_range"] = Threads.GuiObjectProxy(lambda start, end: self.console.view.view.set_selection_range(start, end))
        self.globals["selection"] = Threads.GuiObjectProxy(lambda: self.get_selection())
        self.globals["replace_selection"] = Threads.GuiObjectProxy(lambda value: self.replace_selection(value))
        self.globals["write_at_cursor"] = Threads.GuiObjectProxy(lambda value: self.write_at_cursor(value))

        self.globals["undo"] = Threads.GuiObjectProxy(lambda: self.console.view.undo())
        self.globals["redo"] = Threads.GuiObjectProxy(lambda: self.console.view.redo())
        self.globals["commit"] = Threads.GuiObjectProxy(lambda: self.console.view.commit_undo())

        self.globals["copy"] = Threads.GuiObjectProxy(lambda value: self.copy(value))
        self.globals["paste"] = Threads.GuiObjectProxy(lambda: self.console.view.view.paste())
        self.globals["clipboard"] = Threads.GuiObjectProxy(lambda: self.get_clipboard())