Esempio n. 1
0
    def updateObsFunc(self):

        root = self.treeObs.invisibleRootItem()
        child_count = root.childCount()
        remObsList = []
        for i in range(child_count):
            item = root.child(i)
            url = item.text(0)  # text at first (0) column
            j = item.childCount()
            for chil in range(j):
                child = item.child(chil)
                state = child.checkState(0)
                if state == Qt.Unchecked:

                    if child.text(2) == '':
                        remObsList.append([
                            "distance",
                            str(item.text(0)),
                            str(child.text(1))
                        ])
                    elif child.text(3) == '':
                        remObsList.append([
                            "direction",
                            str(item.text(0)),
                            str(child.text(1))
                        ])

        if self.backup == False:
            self.Nbackup = self.N.copy()
            self.stationsOrderbackup = []
            self.obsOrderbackup = []
            for i in self.stationsOrder:
                self.stationsOrderbackup.append(i)

            for i in self.obsOrder:
                self.obsOrderbackup.append(i)
            self.backup = True

        self.N = self.Nbackup.copy()
        if len(remObsList) > 0:
            self.N, self.stationsOrder, self.obsOrder = self.changeN(
                remObsList)
#         for u,v,d in self.N.edges_iter(data=True):
#             print u
#             print v
#             print d

        N = self.N
        self.obs1, self.ObsList = getObs(N)
        self.obs = obsSplit(self.obs1)
Esempio n. 2
0
    def updateObsFunc(self):
        
        root = self.treeObs.invisibleRootItem()
        child_count = root.childCount()
        remObsList=[]
        for i in range(child_count):
            item = root.child(i)
            url = item.text(0) # text at first (0) column
            j=item.childCount()
            for chil in range (j):
                child=item.child(chil)
                state= child.checkState(0)
                if state ==Qt.Unchecked:

                    if child.text(2)=='':
                        remObsList.append(["distance",str(item.text(0)),str(child.text(1))])
                    elif child.text(3)=='':
                        remObsList.append(["direction",str(item.text(0)),str(child.text(1))])
                
        if self.backup==False:
            self.Nbackup=self.N.copy()
            self.stationsOrderbackup=[]
            self.obsOrderbackup=[]
            for i in self.stationsOrder:
                self.stationsOrderbackup.append(i)
  
            for i in self.obsOrder:
                self.obsOrderbackup.append(i)
            self.backup=True
                
        self.N=self.Nbackup.copy()       
        if len(remObsList)>0:        
            self.N,self.stationsOrder,self.obsOrder = self.changeN(remObsList)
#         for u,v,d in self.N.edges_iter(data=True):
#             print u
#             print v
#             print d  
            
        N=self.N
        self.obs1,self.ObsList=getObs(N)
        self.obs=obsSplit(self.obs1)
Esempio n. 3
0
    def readObsFile(self, filename):
        self.N, self.stationsOrder, self.obsOrder = Observations(filename)
        N = self.N
        self.obs1, self.ObsList = getObs(N)
        self.obs = obsSplit(self.obs1)
        for name in self.stationsOrder:
            item = QTreeWidgetItem(self.treeObs)
            item.setText(0, name)

            for t, j in self.obs[name].iteritems():
                subitem = QTreeWidgetItem(item)
                subitem.setText(1, t[0:-2])
                if j.type == 'direction':
                    subitem.setText(2, str(rad2dms(j.direction)))
                    subitem.setCheckState(0, Qt.Checked)
                if j.type == 'distance':
                    subitem.setCheckState(0, Qt.Checked)
                    subitem.setText(3, str(j.distance))
                if j.type == 'both':
                    subitem.setText(2, str(rad2dms(j.direction)))
                    subitem.setCheckState(0, Qt.Checked)
                    subitem.setText(3, str(j.distance))
                item.setCheckState(0, Qt.Checked)
Esempio n. 4
0
 def readObsFile(self, filename):
     self.N,self.stationsOrder,self.obsOrder = Observations(filename)
     N=self.N
     self.obs1,self.ObsList=getObs(N)
     self.obs=obsSplit(self.obs1)
     for name in self.stationsOrder:
         item = QTreeWidgetItem(self.treeObs)
         item.setText(0, name)
         
         for t,j in self.obs[name].iteritems():
             subitem=QTreeWidgetItem(item)
             subitem.setText(1, t[0:-2])
             if j.type=='direction':
                 subitem.setText(2,str( rad2dms(j.direction))) 
                 subitem.setCheckState(0, Qt.Checked)          
             if j.type=='distance':
                 subitem.setCheckState(0, Qt.Checked)
                 subitem.setText(3, str(j.distance))
             if j.type=='both':
                 subitem.setText(2,str( rad2dms(j.direction))) 
                 subitem.setCheckState(0, Qt.Checked)
                 subitem.setText(3, str(j.distance))
             item.setCheckState(0, Qt.Checked)