예제 #1
0
 def CloseDlg(self, _OK = 0):
   self.OK = _OK
   if not(self.OK):
     self.form.close()
     return None
   self.lbData = self.lb.retData()
   if not(len(self.lbData)):
     self.mbox = lbw.LBWidget(None, None, None, 'dlgmess', 'No file selected.')
     self.mbox.show()
     return None
   self.cbData = self.cb.retData()
   for cbdata in self.cbData:
     if (cbdata[0] == self.nc and cbdata[1] != self.nc) or (cbdata[0] != self.nc and cbdata[1] == self.nc):
       self.mbox = lbw.LBWidget(None, None, None, 'dlgmess', 'Full passive and active channel pairs must be selected.')
       self.mbox.show()
       return None
   validet, discard = (self.et.valiData(1,1))
   if not(validet):
     self.mbox = lbw.LBWidget(None, None, None, 'dlgmess', 'Invalid channel information provided.')
     self.mbox.show()
     return None
   else:
     self.etData = self.et.retData()
     self.form.close()
   filn = []
   for i in range(len(self.lbData)): filn.append(self.cefn[self.lbData[i]])
   chno = []
   signof = []
   chans = []
   for i in range(len(self.cbData)):
     j = i * 2
     k = j + 1
     if self.cbData[i][0] < self.nc and self.cbData[i][1] < self.nc:
       chp = self.cbData[i][0]
       cha = self.cbData[i][1]
       chno.append(chp)
       chno.append(cha)
       signof.append([float(self.etData[chp][0]), float(self.etData[chp][1]), float(self.etData[chp][2])])
       signof.append([float(self.etData[cha][0]), float(self.etData[cha][1]), float(self.etData[cha][2])])
       chans.append(chWave())
       chans[j].index = self.chan[chp].index
       chans[j].name = self.chan[chp].name
       chans[j].units = self.chan[chp].units
       chans[j].samplint = signof[j][0]
       chans[j].gain = signof[j][1]
       chans[j].offset = signof[j][2]
       chans.append(chWave())
       chans[k].index = self.chan[cha].index
       chans[k].name = self.chan[cha].name
       chans[k].units = self.chan[cha].units
       chans[k].samplint = signof[k][0]
       chans[k].gain = signof[k][1]
       chans[k].offset = signof[k][2]
   return self.dirn, filn, chno, signof, chans
예제 #2
0
  def __init__(self, Form = None):
    if Form == None: return
    Lbls = [ ["Label 1", "Label 2"], ["Label 3", "Label 4"], ["Label 5", "Label 6" ] ]
    Wids = [ ["edit", "edit"], ["edit", "edit"], ["edit", "listbox"] ]
    Data = [ ["", ""], ["", ""], ["", 0]]
    Opts = [ [None, None], [None, None], [None, ["Opt1", "Opt2"] ]]

    MB = lbw.LBWidget(Form, None, 1)
    BB = lbw.BWidgets(Form, [0, 0], None, ["button", "button"], ["button0", "button1"])
    BB.Widgets[0].connect("btndown", self.buttonpress1)
    
    self.BG = lbw.BGWidgets(Form, 'Button group label', 0, ["Label1", "Label2"], 'radiobutton', 1)    
    
    self.GB = lbw.LBWidgets(Form, 'Label', 1, Lbls, Wids, Data, Opts)
    self.GB.Boxes[2].Widgets[1].setMode(3)
    
    #FW = lbw.LBWidget(Form, None, None, 'figure')
    #fig = FW.retFrame()
    #ax = fig.add_subplot(211)
    #x = pl.linspace(-pl.pi, pl.pi, 400)
    #y = pl.sin(x)
    #ax.plot(x,y)
    
    MB.add(self.GB)
    MB.add(self.BG)
    MB.add(BB)
    
    #MB.add(FW)
    #print self.BG.Widget.checkedButton()
    Form.setChild(MB)
예제 #3
0
 def save(self, _path = None, _options = None, _nofilter = 0, _senderwidget = None): # last 2 inputs argument necessary for inheriting class
   if _path == '': return # returns function call from constructor
   elif _path == None:
       senderwidget = _senderwidget
       if senderwidget == None:
         senderwidget = lbw.LBWidget(None, None, None, 'base')
       self.path = senderwidget.dlgFileSave("Save File")
       if self.path == "": self.path = None
   else:
       self.path = _path
   if self.path == None: return None
   return self.path
예제 #4
0
 def OpenDlg(self, okfunc, ccfunc):
   if self.seli == None or len(self.cefn) == 0: return None
   self.interpret() # to initialise channel list
   self.box = lbw.LBWidget(self.form, None, 1)
   self.lb = lbw.LBWidget(self.form, "File Selection", 1,"listbox", self.seli, self.cefn)
   self.lb.setMode(4)
   self.box.add(self.lb)
   self.cbwids = []
   self.cblbls = []
   self.cbdata = []
   self.cbopts = []
   chitoff = self.chit
   chitoff.append("Off")
   for i in range(self.ncp):
     self.cbwids.append(["combobox", "combobox"])
     self.cblbls.append(["Passive Signal #" + str(i), "Active Signal #" + str(i)])
     if i == 0: # included this branch code to turn `off' all other channels
       self.cbdata.append(self.chpa[i])
     else:
       self.cbdata.append([self.nc, self.nc])
     self.cbopts.append([chitoff, chitoff])
   self.cb = lbw.LBWidgets(self.form, "Channel Selection", 1, self.cblbls, self.cbwids, self.cbdata, self.cbopts)
   self.box.add(self.cb)
   self.lewids = []
   self.lelbls = []
   self.ledata = []
   for i in range(self.nc):
     self.lewids.append(["edit", "edit", "edit"])
     self.lelbls.append([self.chis[i] + " samp. int. (s)", self.chis[i] + " gain", self.chis[i] + " offset"])
     self.ledata.append([str(self.chan[i].samplint), str(self.chan[i].gain), str(self.chan[i].offset)])
   self.et = lbw.LBWidgets(self.form, "Channel Information", 1, self.lelbls, self.lewids, self.ledata)
   self.box.add(self.et)
   self.bbx = lbw.BWidgets(self.form, 0, None, ["Button", "Button"], ["OK", "Cancel"])
   self.box.add(self.bbx)
   self.bbx.Widgets[0].connect("btndown", okfunc)
   self.bbx.Widgets[1].connect("btndown", ccfunc)
   self.form.setChild(self.box)
   self.form.show()
예제 #5
0
 def open(self, _path = None, _options = None, _nofilter = 0, _senderwidget = None): # last 2 inputs argument necessary for inheriting class
   if _path == '': return # returns function call from constructor
   elif _path == None:
       senderwidget = _senderwidget
       if senderwidget == None:
         senderwidget = lbw.LBWidget(None, None, None, 'base')
       self.path = senderwidget.dlgFileOpen("Open Data File")
       i = -1
       if self.path == "":
         self.path = None
       else:
         i = self.path.find("'")
       if i == 2: # remove string elements comprising apostrophes, `u' characters, etc...
         self.path = self.path[i+1:]
         i = self.path.find("'")
         self.path = self.path[:i]
   else:
       self.path = _path
   if self.path == None: return None
   self.parse(None, _nofilter)
   return self.path
예제 #6
0
    self.BG = lbw.BGWidgets(Form, 'Button group label', 0, ["Label1", "Label2"], 'radiobutton', 1)    
    
    self.GB = lbw.LBWidgets(Form, 'Label', 1, Lbls, Wids, Data, Opts)
    self.GB.Boxes[2].Widgets[1].setMode(3)
    
    #FW = lbw.LBWidget(Form, None, None, 'figure')
    #fig = FW.retFrame()
    #ax = fig.add_subplot(211)
    #x = pl.linspace(-pl.pi, pl.pi, 400)
    #y = pl.sin(x)
    #ax.plot(x,y)
    
    MB.add(self.GB)
    MB.add(self.BG)
    MB.add(BB)
    
    #MB.add(FW)
    #print self.BG.Widget.checkedButton()
    Form.setChild(MB)
  def buttonpress1(self, event = None):
    print(self.GB.retData())
    print(self.BG.retData())
    

App = lbw.LBWidget(None, None, None, 'app')
Form = lbw.LBWidget(None, None, None, 'dlgform', "title")
testGUI = test(Form)
Form.show()
#fo = Form.dlgFileOpen()
App.loop()
예제 #7
0
 def Open(self, okfunc, ccfunc, _path = None):
   self.form = lbw.LBWidget(None, None, None, 'dlgform', "File and channel selection")
   self.open(_path, None, 0, self.form)
   return self.OpenDlg(okfunc, ccfunc)
예제 #8
0
# PARAMETERS

import pyclamp.gui.lbwgui as lbwgui
import pyclamp.qnp.qmods as qmods
lbwgui.use('qt')

App = lbwgui.LBWidget(None, None, None, 'app')

e = 5.
sres = 128
vres = 64
ares = 1
nres = 32
nmax = 128
ipd = "/home/admin/analyses/"
opd = "/home/admin/results/"

qmods.qmods(e, sres, vres, ares, nres, nmax, ipd, opd)