Example #1
0
 def openSetbyHand(self):
     self.buttonBox.button(QDialogButtonBox.Ok).setAutoDefault(False)
     self.buttonBox.button(QDialogButtonBox.Ok).setDefault(False)
     self.buttonBox.button(QDialogButtonBox.Cancel).setAutoDefault(False)
     self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(False)
     self.buttonBox.button(QDialogButtonBox.Help).setAutoDefault(False)
     self.buttonBox.button(QDialogButtonBox.Help).setDefault(False)
    
    
     setname=unicode(self.setpathLabel.text())+"/"+unicode(self.setnameLine.text())
     filename=setname+".image"
         
     
     if not os.path.exists(filename):
         self.clearAxesLayout()
         self.axesLayout.addWidget(QLabel("The set does not exist %s"%setname), 0, 0)
     else:
         
         self.setPath=setname
         set=gipsySet()
         set.loadSetRO(self.setPath)
         self.axesInfo=set.getInfoAxes()
         self.axesList=set.getAxes()
         #del set
         set.closeSet()
         self.clearAxesLayout()
         self.showDefaultAxes()
Example #2
0
 def accept(self):
    
    #If the user select all axis as repeated axis, this method lates a long time and hangs the application
     
     subset=unicode(self.subsetLine.text())
     box=unicode(self.boxLine.text())
     subsetSplit=subset.split()
     if self.special ==None: #Not the case of the COPY tasks
         if len(subsetSplit)>1: #At least one axes, if not, there is no problem with the repeated axis
             path=subsetSplit[0]
             axesUser=subsetSplit[1:]
             set=gipsySet()
             try:
                 set.loadSetRO(path)
             except gipsyException as g:
                 QMessageBox.warning(self, "Processing input failed", QString(g.msj))
             else:
                 axes=set.getAxes()
                 set.closeSet()
                 if len(axes) == len(axesUser):
                     QMessageBox.warning(self,"Processing input failed","All the axis of the set are repeated axis")
                 else:
                     s=gipsySet()
                     try:
                         s.tryOpenSet(subset, box)
                     except gipsyException as g:
                         QMessageBox.warning(self, "Processing input failed", QString(g.msj))
                     else:
                         self.done(1)
         
         else:
             s=gipsySet()
             try:
                 s.tryOpenSet(subset, box)
             except gipsyException as g:
                 QMessageBox.warning(self, "Processing input failed", QString(g.msj))
             else:
                 self.done(1)
     else: #Case of the COPY task
         self.done(1)
Example #3
0
 def showHeaders(self):
     setname=unicode(self.setpathLabel.text())+"/"+unicode(self.setnameLine.text())
     filename=setname+".image"
         
     
     if not os.path.exists(filename):
         QMessageBox.warning(self,"Error","The set does not exist %s"%setname)
     else:
         set=gipsySet()
         set.loadSetRO(setname)
         text=set.getPropertiesModeG()
         set.closeSet()
         self.fhd=fitsHeaderDlg(text)
         self.fhd.exec_()
Example #4
0
 def browser(self):
     if self.setPath != None:
         dir=os.path.dirname(self.setPath)
     else:
         dir = self.defaultPath
     fName = unicode(QFileDialog.getOpenFileName(self, "File open ", dir,FORMATS["SET"]))
     if (fName==""):
         return
     self.setPath=unicode(os.path.splitext(fName)[0])
     set=gipsySet()
     set.loadSetRO(self.setPath)
     self.axesInfo=set.getInfoAxes()
     self.axesList=map(lambda x: x.split("-")[0].upper(), set.getAxes())
     #del set
     set.closeSet()
     self.setpathLabel.setText(os.path.dirname(self.setPath))
     self.setnameLine.setText(os.path.basename(self.setPath))
     self.clearAxesLayout()
     self.showDefaultAxes()
Example #5
0
 def sendTask(self, task,  setname=None):
     if setname!=None:
         inset=gipsySet()
         inset.loadSetRO(setname)
         self.insetAxesInfo=inset.getInfoAxes()
         self.insetAxesList=inset.getAxes()
         inset.closeSet()
     
         (subsetText, boxText)=insetDefaultText(setname, self.insetAxesInfo,*TASKS_CLASS[task.upper()])
         command=task+" INSET=%s BOX=%s"%(subsetText, boxText)
     else:
         command=task
     key="SVKEY="
     output="xeq(%s,%s)"%(command, key)
     try:
         xeq(command, key)
     except XeqError as e:
         raise gipsyException(unicode(e))
         return
     return output
Example #6
0
    def __init__(self, parent, filename, subset,  box, gdsClass=1,  classDim=0,  special=None, defaultPath="./"): #The special is due to allow COPY insert axes
        super(setbrowser, self).__init__(parent)
        self.setPath=None
        self.axesInfo=None
        self.axesList=None
        self.gdsClass=gdsClass
        self.classDim=classDim
        self.special=special
        self.setupUi(self)
        #self.subButtons={}
        #self.boxButtons={}
        self.groupCheckBox={}
        self.limitLabel={}
        self.RangeListEdit={}
        self.parent=parent
        self.defaultPath=defaultPath
       
        self.connect(self.browseButton, SIGNAL("clicked()"), self.browser)
        self.connect(self.headerButton, SIGNAL("clicked()"), self.showHeaders)
       
        if self.gdsClass==-1: #TRANSPOSE
            self.axisFrame.setEnabled(False)
            self.editEnableButton.setEnabled(False)
            self.composerEnableButton.setEnabled(False)
            self.manualEditFrame.setEnabled(False)

            if filename!=None:
               self.setpathLabel.setText(os.path.dirname(filename))
            else:
                self.setpathLabel.setText(os.getcwd())
                
            self.connect(self.setnameLine, SIGNAL("returnPressed()"), self.openSetbyHand )
        else:
        
            if  filename!=None: 
                self.setPath=filename
                self.setpathLabel.setText(os.path.dirname(filename))
                self.setnameLine.setText(os.path.basename(filename))
                set=gipsySet()
                try:
                    set.loadSetRO(self.setPath)
                except gipsyException as g:
                    QMessageBox.warning(self, "Reading SET Failed", QString(g.msj+self.setPath))
                self.axesInfo=set.getInfoAxes()
                self.axesList=map(lambda x: x.split("-")[0].upper(), set.getAxes())
                #del set
                set.closeSet()
                
                self.subsetLine.setText(subset)
                self.boxLine.setText(box)
                self.clearAxesLayout()
                self.showUpdatedAxes(filename, unicode(subset),  unicode(box))
            else:
                
                self.setpathLabel.setText(os.getcwd())
                self.showDefaultAxes()
        
            self.connect(self.composerEnableButton, SIGNAL("clicked()"),  self.enableComposer)
            self.connect(self.editEnableButton, SIGNAL("clicked()"),  self.disableComposer)
            self.connect(self.setnameLine, SIGNAL("returnPressed()"), self.openSetbyHand )
        curried=functools.partial(self.done, 1)
        self.connect(self.parent, SIGNAL("finished(int)"), curried)