Beispiel #1
0
def newSig(self):

    boolsTrue()

    #Deselect qlistwidget
    for entry in range(self.left.scrollAreaWidgetContents.count()):
        item=self.left.scrollAreaWidgetContents.item(entry)
        self.left.scrollAreaWidgetContents.setItemSelected(item,False)

    clearRightInfoHub()
    makeRightInfoHub(self,getDictionary(fileName()))

    i=0
    for entry in getDictionary(fileName()):
        labler(entry,'',self,i) 
        i+=1

    self.saveButton.clicked.connect(lambda:saveChanges(self,headers,-1))
def clearRightInfoHub():
   global rightInfoHub
   dictionary=getInfo.getDictionary(fileName())
   i=0
   while i<len(dictionary):
      try: 
         rightInfoHub['headers'][dictionary[i]].close()
         rightInfoHub['textBoxes'][dictionary[i]].close()
      except:
         pass
      i+=1
def saveChanges(self,headers,num):
   global bools
   global rightInfoHub
   if bools==True:
      from addSignal import addsignal
      bools=False
      reply=QtGui.QMessageBox.question(self, 'Save Changes?', 'Save these changes to '+rightInfoHub['textBoxes']['name'].text()+'?', QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
      if reply==QtGui.QMessageBox.Yes:
        i=1

        headers=getInfo.getDictionary(fileName())
        #Get new information from text boxes
        signalist=[[]]
        signalist[0]=['name',signalSet(self,'name')]
        while i<len(headers):

           #signalist is of the form [ [attribute name, attribute text] * N]
           signalist.append([headers[i],signalSet(self,headers[i])])
           i+=1
                
             #Uses new information to replace previous information.
             #If entry with desired name exists, new entry is created
        addsignal(signalist,self,num,{'action':'edit'})
def lookingAt(self):
   global previousnum
   global bools
   global reftex
   global headers

   entries=getInfo.getinfo(fileName())
   dictionary=getInfo.getDictionary(fileName())

   #Stiffle error message when no signal is selected
   try:text= str(self.left.scrollAreaWidgetContents.selectedItems()[0].text())
   except:return

   #get current selection's position in vdb
   i=0
   while i<len(entries):
      if entries[i][1]==text:
         num=i
      i+=1

   #Checks for changes to text boxes with bool
   #num =-1 is a flag that a variable is being deleted, and not to save changes made
   if bools==True and num!=-1:
      bools=False
      saveChanges(self,headers,num)
      return

   #If num is set as flag -1, reset it to 0
   #This indicates not to save changes, so bool is set to False
   if num==-1:
      bools=False
      num=0

   #Get attributes
   #headers=entries[num][0]
   headers=getInfo.getDictionary(fileName())

   #CLEAR RIGHT SIDE INFORMATION HUB
   clearRightInfoHub()

   #Create framework for upright side information hub
   makeRightInfoHub(self,headers)

   #Get signal's attribute info
   i=1
   signals=[]
   while i<len(entries[num][0])+1:
     
     signals.append(entries[num][i])
     i+=1
   i=0

   #write attribute info to screen
   while i<len(entries[num][0]):
      if entries[num][0][i] in headers:
        labler(entries[num][0][i],signals[i],self,i)
        headers.remove(entries[num][0][i])
      else:
        labler(dictionary[0],'',self,i)
      i+=1

   #Disconnect buttons
   try: 
      self.deleteButton.clicked.disconnect()
   except Exception: pass
   try: 
      self.saveButton.clicked.disconnect()
   except Exception: pass


   #Connect buttons
   self.deleteButton.clicked.connect(lambda: delete(str(rightInfoHub['textBoxes']['name'].text()),self,num)) 
   self.saveButton.clicked.connect(lambda: saveChanges(self,headers,num))

   clearRightInfoHub()
   previousnum=num
   bools=False