示例#1
0
文件: main.py 项目: armsvb/OpenPLC-1
 def runPopup(self, tool, cellNum):
     popUpOKed = False  #becomes true if dialog is OK'ed
     tempCellInfo = cellStruct(None, None, None, None, None, None, None,
                               None, False, False, False, False, False,
                               False)
     if tool == "Coil" or tool == "CoilNot":  #do dialog for this tool:
         self.dialog = popupDialogs.CoilDialog(self.grid, cellNum,
                                               self.currentHW)
         popUpOKed = self.dialog.exec_()  # For Modal dialogs
     elif tool == "contNO" or tool == "contNC":  #do dialog for this tool:
         self.dialog = popupDialogs.ContDialog(self.grid, cellNum,
                                               self.currentHW)
         popUpOKed = self.dialog.exec_()  # For Modal dialogs
     elif tool == "Rising" or tool == "Fall":  #do dialog for this tool:
         self.dialog = popupDialogs.EdgeDialog(self.grid, cellNum,
                                               self.currentHW)
         popUpOKed = self.dialog.exec_()  # For Modal dialogs
     elif tool == "Timer":  #do dialog for this tool:
         self.dialog = popupDialogs.TimerDialog(self.grid, cellNum,
                                                self.currentHW)
         popUpOKed = self.dialog.exec_()  # For Modal dialogs
     elif tool == "Counter":  #do dialog for this tool:
         self.dialog = popupDialogs.CounterDialog(self.grid, cellNum,
                                                  self.currentHW)
         popUpOKed = self.dialog.exec_()  # For Modal dialogs
     if popUpOKed == True:
         # get all info from popup:
         try:
             tempCellInfo.ioAssign = self.dialog.ui.comboBox.currentText(
             )  #I/O assign
         except:
             pass
         try:
             tempCellInfo.variableName = self.dialog.ui.comboBox_2.currentText(
             )  #variable Name
         except:
             pass
         try:
             tempCellInfo.comment = self.dialog.ui.lineEdit.text()  #comment
         except:
             pass
         try:
             tempCellInfo.setPoint = self.dialog.ui.doubleSpinBox.value(
             )  #setpoint decimal
         except:
             pass
         try:
             tempCellInfo.setPoint = self.dialog.ui.spinBox.value(
             )  #setpoint integer
         except:
             pass
         try:
             tempCellInfo.ioAssign = self.dialog.ui.comboBox.currentText()
         except:
             pass
         tempCellInfo.MTorElement = tool
         return tempCellInfo
     else:
         return False
示例#2
0
文件: main.py 项目: armsvb/OpenPLC-1
	def setupDataGrid(self):
		#x,y, element there, rung there, & there, element name, variable name, i/o connection.
		self.grid = [[]] # grid: list of rows  ex: grid [2][6] gives cell 6 in row(rung) 2
		self.reDoGrid = [[[]]]# list of grids for redo
		self.unDoGrid = [[[]]]# list of grids for undo
		self.currentTool = 0 #to track the tool being used
		width=10
		for i in range(width):#fill the first row
			self.grid[0].append(cellStruct(i*60, 60, "MT","Rung", None, None, None, None, False, False, False, False, False, False,None,None,None,None,None))
		for i in range(1,6):# add 5 more rungs to start
			ManageGrid(self.grid, self.scene,self.Tools,self.items).insertRung(i)        
示例#3
0
文件: main.py 项目: armsvb/OpenPLC-1
 def setupDataGrid(self):
     #x,y, element there, rung there, & there, element name, variable name, i/o connection.
     self.grid = [
         []
     ]  # grid: list of rows  ex: grid [2][6] gives cell 6 in row(rung) 2
     self.reDoGrid = [[[]]]  # list of grids for redo
     self.unDoGrid = [[[]]]  # list of grids for undo
     self.currentTool = 0  #to track the tool being used
     width = 10
     for i in range(width):  #fill the first row
         self.grid[0].append(
             cellStruct(i * 60, 60, "MT", "Rung", None, None, None, None,
                        False, False, False, False, False, False))
     for i in range(1, 6):  # add 5 more rungs to start
         ManageGrid(self.grid, self.scene, self.Tools,
                    self.items).insertRung(i)
示例#4
0
文件: main.py 项目: armsvb/OpenPLC-1
 def runPopup(self, tool, cellNum):
     popUpOKed = False #becomes true if dialog is OK'ed
     tempCellInfo = cellStruct(None,None,None,None,None,None,None,None, False, False, False, False, False, False) 
     if tool == "Coil" or tool =="CoilNot":#do dialog for this tool:
         self.dialog = popupDialogs.CoilDialog(self.grid, cellNum,self.currentHW)
         popUpOKed = self.dialog.exec_()# For Modal dialogs
     elif tool == "contNO" or tool =="contNC":#do dialog for this tool:
         self.dialog = popupDialogs.ContDialog(self.grid, cellNum,self.currentHW)
         popUpOKed = self.dialog.exec_()# For Modal dialogs
     elif tool == "Rising" or tool =="Fall":#do dialog for this tool:
         self.dialog = popupDialogs.EdgeDialog(self.grid, cellNum,self.currentHW)
         popUpOKed = self.dialog.exec_()# For Modal dialogs
     elif tool == "Timer" :#do dialog for this tool:
         self.dialog = popupDialogs.TimerDialog(self.grid, cellNum,self.currentHW)
         popUpOKed = self.dialog.exec_()# For Modal dialogs
     elif tool == "Counter" :#do dialog for this tool:
         self.dialog = popupDialogs.CounterDialog(self.grid, cellNum,self.currentHW)
         popUpOKed = self.dialog.exec_()# For Modal dialogs
     if popUpOKed == True:        
         # get all info from popup:
         try: tempCellInfo.ioAssign = self.dialog.ui.comboBox.currentText()#I/O assign
         except: pass
         try: tempCellInfo.variableName = self.dialog.ui.comboBox_2.currentText()#variable Name
         except: pass
         try: tempCellInfo.comment = self.dialog.ui.lineEdit.text()#comment
         except: pass
         try: tempCellInfo.setPoint = self.dialog.ui.doubleSpinBox.value() #setpoint decimal
         except: pass
         try: tempCellInfo.setPoint = self.dialog.ui.spinBox.value() #setpoint integer
         except: pass
         try: tempCellInfo.ioAssign = self.dialog.ui.comboBox.currentText()
         except: pass
         tempCellInfo.MTorElement = tool
         return tempCellInfo
     else: 
         return False
示例#5
0
文件: main.py 项目: armsvb/OpenPLC-1
	def runPopup(self, tool, cellNum):
		popUpOKed = False #becomes true if dialog is OK'ed
		tempCellInfo = cellStruct(None,None,None,None,None,None,None,None, False, False, False, False, False, False,None,None,None,None,None) 
		##004##
		if tool == "Coil" or tool =="CoilNot":#do dialog for this tool:
			self.dialog = popupDialogs.CoilDialog(self.grid, cellNum,self.currentHW)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "contNO" or tool =="contNC":#do dialog for this tool:
			self.dialog = popupDialogs.ContDialog(self.grid, cellNum,self.currentHW)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "Rising" or tool =="Fall":#do dialog for this tool:
			self.dialog = popupDialogs.EdgeDialog(self.grid, cellNum,self.currentHW)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "Timer" :#do dialog for this tool:
			self.dialog = popupDialogs.TimerDialog(self.grid, cellNum,self.currentHW)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "Counter" :#do dialog for this tool:
			self.dialog = popupDialogs.CounterDialog(self.grid, cellNum,self.currentHW)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "Plus"or tool =="Minus"or tool =="Divide"or tool =="Mult" or tool == "Move" :#do dialog for this tool:
			self.dialog = popupDialogs.MathDialog(self.grid, cellNum,self.currentHW,tool)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "Equals" or tool =="Greater"or tool =="Lessthan"or tool =="GreaterOrEq"or tool =="LessOrEq":#do dialog for this tool:
			self.dialog = popupDialogs.CompairDialog(self.grid, cellNum,self.currentHW,tool)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		#elif tool == "Move" :#do dialog for this tool:
		#    self.dialog = popupDialogs.MoveDialog(self.grid, cellNum,self.currentHW)
		#    popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "PWM" :#do dialog for this tool:
			self.dialog = popupDialogs.PWMDialog(self.grid, cellNum,self.currentHW)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
		elif tool == "ADC" :#do dialog for this tool:
			self.dialog = popupDialogs.ADCDialog(self.grid, cellNum,self.currentHW)
			popUpOKed = self.dialog.exec_()# For Modal dialogs
			
			#Equals Greater Lessthan GreaterOrEq LessOrEq Plus Minus Divide Mult Move   PWM ADC 
		if popUpOKed == True:        
			##008##
			# get all info from popup:
			try: tempCellInfo.ioAssign = self.dialog.ui.comboBox.currentText()#I/O assign
			except: pass
			try: tempCellInfo.variableName = self.dialog.ui.comboBox_2.currentText()#variable Name
			except: pass
			else:
				#check that name is OK
				if not re.match(r'^[a-zA-Z0-9_]+$', tempCellInfo.variableName):
					print "bad name"
					tempCellInfo.variableName = "please_rename"
			try: tempCellInfo.comment = self.dialog.ui.lineEdit.text()#comment
			except: pass
			try: tempCellInfo.setPoint = self.dialog.ui.doubleSpinBox.value() #setpoint decimal
			except: pass
			try: tempCellInfo.setPoint = self.dialog.ui.spinBox.value() #setpoint integer
			except: pass
			#try: tempCellInfo.ioAssign = self.dialog.ui.comboBox.currentText()
			#except: pass
				#for comparison operators:
			try: tempCellInfo.source_A = self.dialog.ui.comboBox_A.currentText()
			except: pass
			try: tempCellInfo.source_B = self.dialog.ui.comboBox_B.currentText()
			except: pass
			try: tempCellInfo.const_A = self.dialog.ui.spinBox_A.value()
			except: pass
			try: tempCellInfo.const_B = self.dialog.ui.spinBox_B.value()
			except: pass
			
			
			tempCellInfo.MTorElement = tool
			return tempCellInfo
		else: 
			return False