def BLoadClicked(self): #command.cmd('{"command": "select", "print": false}','X-Api-Key: 054E508852624649B8B250B341CFF639', 'http://127.0.0.1:5000/api/files/local/Vts.gcode') gcodeselect=self.LWGcode.currentItem().text() #print gcodeselect self.myprinter.select(gcodeselect) time.sleep(0.5) data = alist.liste('http://127.0.0.1:5000/api/job','054E508852624649B8B250B341CFF639') self.update_temp2(data)
def RafrFile(self): content2 = alist.liste('http://127.0.0.1:5000/api/files','054E508852624649B8B250B341CFF639') self.LWGcode.clear() i = 0 while i < len(content2['files']): fichier = content2['files'][i]['name'] #print fichier self.LWGcode.addItem(fichier) #self.oports.addItem(fichier) i = i + 1
def get_values3(self): data = alist.liste('http://127.0.0.1:5000/api/connection','054E508852624649B8B250B341CFF639') #data = {'bed': str(random.randint(50, 60)), # 'tool0': str(random.randint(180, 220))} self.message.emit(data)
def BConectRafrClicked(self): content3 = alist.liste('http://127.0.0.1:5000/api/connection','054E508852624649B8B250B341CFF639') self.RafrPorts(content3)
def __init__(self,parent=None): super(MainDialog,self).__init__(parent) QtGui.QTabWidget.__init__(self) # Charge de la définition de l'UI depuis le fichier produit par le designer #self.ui = loadUi("example.ui") #self.ui.show() #self.lazy = lazyworker() #self.lazy.message.connect(self.updateUI) # Création d'une instance de GetTemp self.get_status = GetTemp() # On connecte le message émis par GetTemp à la méthode update_temp self.get_status.message.connect(self.update_temp) # Créatiion d'un QTimer self.timer = QTimer() # Choix de l'intervalle self.timer.setInterval(2000) # On appelle la méthode get_values de l'instance de GetStatus quand le timer arrive à expiration self.timer.timeout.connect(self.get_status.get_values) # Démarrage du timer self.timer.start() self.get_status2 = GetTemp() # On connecte le message émis par GetTemp à la méthode update_temp self.get_status2.message.connect(self.update_temp2) # Créatiion d'un QTimer self.timer2 = QTimer() # Choix de l'intervalle self.timer2.setInterval(5000) # On appelle la méthode get_values de l'instance de GetStatus quand le timer arrive à expiration self.timer2.timeout.connect(self.get_status2.get_values2) # Démarrage du timer self.timer2.start() self.get_status3 = GetTemp() # On connecte le message émis par GetTemp à la méthode update_temp self.get_status3.message.connect(self.update_temp3) self.timer3 = QTimer() # Choix de l'intervalle self.timer3.setInterval(5000) # On appelle la méthode get_values de l'instance de GetStatus quand le timer arrive à expiration self.timer3.timeout.connect(self.get_status3.get_values3) # Démarrage du timer self.timer3.start() ##########TEST PYQTSIGNAL #self.akex = server2.Pot() #self.wsc= server2.wsc() #self.connect(self.akex, (SIGNAL("clicked()")), self.retourterminal) #self.akex.eventterminal.connect(self.retourterminal) #self.lazy = lazyworker() #self.lazy.message.connect(self.updateUI) #self.connect(lazyworker.doWork, SIGNAL("alex()"),self.updateUI) #tl = lazyworker() #self.connect(tl, SIGNAL("update(int)"), self.updateUI) #tl.doWork() import command import trav #pg.setConfigOption('background', 'w') #before loading widget #plt=self.plot #curve = plt.plot() #win = pyqtgraph.GraphicsWindow(title="Basic plotting examples") #p1 = self.graphicsView.addPlot() #curve1 = p1.plot() #p1 = win.addPlot(title="Basic array plotting", y=np.random.normal(size=100)) #super(MainDialog,self).__init__(parent) self.setupUi(self) #self.pb.clicked.connect(self.pbClicked) #self.pb2.clicked.connect(self.pb2Clicked) ####Onglet connexion self.BConnect.clicked.connect(self.BConnectClicked) self.BDisconect.clicked.connect(self.BDisconectClicked) #BConectRafr self.BConectRafr.clicked.connect(self.BConectRafrClicked) #BConectRafr self.PBReboot.clicked.connect(self.PBRebootClicked) self.PBArret.clicked.connect(self.PBArretClicked) ####Onglet Print self.BLoadPrint.clicked.connect(self.BLoadClicked) self.BPrint.clicked.connect(self.BPrintClicked) self.BRafrGcode.clicked.connect(self.BRafrGcodeClicked) #icon2 = QtGui.QIcon() #icon2.addPixmap(QtGui.QPixmap("glyphicons_082.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) #self.BRafrGcode.setIcon(icon2); self.BPlay.clicked.connect(self.BPlayClicked) self.BPause.clicked.connect(self.BPauseClicked) self.BStop.clicked.connect(self.BStopClicked) ###Onglet Temperature self.BSetExtru.clicked.connect(self.BSetExtruClicked) self.BSetBed.clicked.connect(self.BSetBedClicked) #PBExtruOff self.PBExtruOff.clicked.connect(self.PBExtruOffClicked) #PBExtruOff self.PBBedOff.clicked.connect(self.PBBedOffClicked) #Gaph plt=self.plot plt.setYRange(15, 250) plt.setXRange(5, 0.6) plt.setLabel('bottom', "Time", "min") plt.setLabel('left', "Temp", "°") plt.addLegend() p1 = plt.plot(name='Extru1') p1.setPen(color=(0,0,255), width=5.0) #p1.set_title("EX0") p2 = plt.plot(name='Bed') p2.setPen(color=(255,0,0), width=5.0) #style = pg.PlotDataItem(pen='y') #plt.addItem(l, "maximum value") #plt.setXLimits(50) #plt.plot(int(10),int(20)) #X = 100 #Y =50 #x = np.arange(1000) #y = np.random.normal(size=1000) #plt.plot(x, y) ###Onglet Controle #increment mouvement self.BZZU.clicked.connect(self.BzzuClicked) self.BZU.clicked.connect(self.BZUClicked) self.BU.clicked.connect(self.BUClicked) self.BD.clicked.connect(self.BDClicked) self.BC.clicked.connect(self.BCClicked) #Axes + - self.BX.clicked.connect(self.BXClicked) self.BY.clicked.connect(self.BYClicked) self.BZ.clicked.connect(self.BZClicked) self.BX_2.clicked.connect(self.BXMClicked) self.BY_2.clicked.connect(self.BYMClicked) self.BZ_2.clicked.connect(self.BZMClicked) #Home Axes self.BHX.clicked.connect(self.BHXClicked) self.BHY.clicked.connect(self.BHYClicked) self.BHZ.clicked.connect(self.BHZClicked) self.BMotor.clicked.connect(self.BMotorOffClicked) self.BFOFF.clicked.connect(self.BFOffClicked) #Slider fan vitesse flux self.BFan.clicked.connect(self.BFanClicked) self.BVitesse.clicked.connect(self.BVitesseClicked) self.BFlux.clicked.connect(self.BFluxClicked) #Extruder mouvement self.BExtru.clicked.connect(self.BExtruClicked) self.BRetra.clicked.connect(self.BRetraClicked) self.BEC.clicked.connect(self.BECClicked) self.BED.clicked.connect(self.BEDClicked) self.BECent.clicked.connect(self.BECentClicked) #ALIM self.PBAlimOn.clicked.connect(self.PBAlimOnClicked) self.PBAlimOff.clicked.connect(self.PBAlimOffClicked) #Slider self.SFan.valueChanged.connect(self.SFanChange) self.SVitesse.valueChanged.connect(self.SvitesseChange) self.SliderFlux.valueChanged.connect(self.SFluxChange) ###Onglet Cam self.BRafCam.clicked.connect(self.BRafCamClicked) self.CBTime.addItem("off") self.CBTime.addItem("zchange") self.CBTime.addItem("timed") self.BSaveTime.clicked.connect(self.BSaveTimeClicked) self.CBTime.currentIndexChanged.connect(self.CBTimeChanged) ##################################################################BOUTON SAUVER ###Onglet Terminale self.BTerminal.clicked.connect(self.BTerminalClicked) ###Connection event clavier QlineEdit self.LETerminal.clicked.connect(lambda: self.printText("LETerminal")) self.LETembed.clicked.connect(lambda: self.printText("LETembed")) self.LETemExt.clicked.connect(lambda: self.printText("LETemExt")) self.LEFps.clicked.connect(lambda: self.printText("LEFps")) self.LEDerImg.clicked.connect(lambda: self.printText("LEDerImg")) self.LEExtru.clicked.connect(lambda: self.printText("LEExtru")) #LEExtru self.LEZhop.clicked.connect(lambda: self.printText("LEZhop")) #LEExtru ###Clavier self.PBCG.clicked.connect(self.PBCGCliked) self.PBCM.clicked.connect(self.PBCMCliked) self.PBCX.clicked.connect(self.PBCXCliked) self.PBCY.clicked.connect(self.PBCYCliked) self.PBCZ.clicked.connect(self.PBCZCliked) self.PBCE.clicked.connect(self.PBCECliked) self.PBCS.clicked.connect(self.PBCSCliked) self.PBCF.clicked.connect(self.PBCFCliked) self.PBCP.clicked.connect(self.PBCPCliked) self.PBCI.clicked.connect(self.PBCICliked) self.PBCD.clicked.connect(self.PBCDCliked) self.PBCC.clicked.connect(self.PBCCCliked) self.PBCH.clicked.connect(self.PBCHCliked) self.PBCT.clicked.connect(self.PBCTCliked) self.PBCEspace.clicked.connect(self.PBCEspaceCliked) self.PBC7.clicked.connect(self.PBC7Cliked) self.PBC8.clicked.connect(self.PBC8Cliked) self.PBC9.clicked.connect(self.PBC9Cliked) self.PBC4.clicked.connect(self.PBC4Cliked) self.PBC5.clicked.connect(self.PBC5Cliked) self.PBC6.clicked.connect(self.PBC6Cliked) self.PBC1.clicked.connect(self.PBC1Cliked) self.PBC2.clicked.connect(self.PBC2Cliked) self.PBC3.clicked.connect(self.PBC3Cliked) self.PBC0.clicked.connect(self.PBC0Cliked) self.PBCSuppr.clicked.connect(self.PBCSupprCliked) self.PBCDel.clicked.connect(self.PBCDelCliked) self.PBCEntrer.clicked.connect(self.PBCEntrerCliked) ###Cache clavier self.clavier.hide() ###Instanciation de myprinter au module command et a la class Printer self.myprinter = command.Printer("http://127.0.0.1:5000", "054E508852624649B8B250B341CFF639") ###Instanciation de travx au module trav et a la class travel self.travx=trav.travel() self.travx1=trav.travel() ###Marque le depart pour le graph fin = time.time() self.travx.set_temps(fin) ###Remplissage de l onglet connexion etat/port list/et profile content3 = alist.liste('http://127.0.0.1:5000/api/connection','054E508852624649B8B250B341CFF639') self.update_temp3(content3) self.RafrPorts(content3) ###Remplissage de l onglet print fichier temps filament etc data = alist.liste('http://127.0.0.1:5000/api/job','054E508852624649B8B250B341CFF639') self.update_temp2(data) self.RafrFile() #import testlib #tl = lazyworker() #self.connect(tl, SIGNAL("update(int)"), self.updateUI) #tl.doWork() #tl.RegisterSignal(self.updateUI) #self.test = tl.doWork() self.worker = testlib.myWorker() # register signal to a slot self.worker.mySignal.connect(self.updateUI) self.wsc= server2.wsc()