Example #1
0
    def __init__(self,parent = None,globals = {}):
        Debugger.__init__(self)
        QWidget.__init__(self,parent)
        ObserverWidget.__init__(self)
        layout = QGridLayout()
        
        self._globals = globals
        self._cube = None
        self.name = QLineEdit()
        self.filename = QLineEdit()
        self.filename.setReadOnly(True)
        self.tags = QLineEdit()
        self.description = QTextEdit()

        self.parameters,self.attributes = QTableWidget(20,2),QTableWidget(20,2)
        for widg in [self.parameters,self.attributes]:
            widg.setColumnWidth (0, 160)
            widg.setColumnWidth (1, 160)
            widg.setHorizontalHeaderLabels(["Key","Value"])
        self.parameters.setEditTriggers(QAbstractItemView.AllEditTriggers)
        self.attributes.setEditTriggers(QAbstractItemView.NoEditTriggers)

        self.bindName = QLineEdit()
        self.updateBindButton = QPushButton("Update / Set")
        self.updateBindButton.setSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum)
        self.connect(self.updateBindButton,SIGNAL("clicked()"),self.updateBind)
        
        #font = self.description.currentFont()
        #font.setPixelSize(12)
        #self.description.setFont(font  )
        
        subLayout1=QBoxLayout(QBoxLayout.LeftToRight)
        subLayout1.setSpacing(4)
        subLayout1.addWidget(QLabel("Name"))
        subLayout1.addWidget(self.name)
        subLayout1.addWidget(QLabel(" Bind to local variable:"))
        subLayout1.addWidget(self.bindName)
        subLayout1.addWidget(self.updateBindButton)
        layout.addItem(subLayout1)

        layout.addWidget(QLabel("Filename"))
        layout.addWidget(self.filename)
        layout.addWidget(QLabel("Tags"))
        layout.addWidget(self.tags)
        layout.addWidget(QLabel("Description"))
        layout.addWidget(self.description)

        subLayout2= QGridLayout()
        subLayout2.setSpacing(4) 

        subLayout2.addWidget(QLabel("Parameters"),0,0)
        subLayout2.addWidget(QLabel("Child attributes"),0,1)
        subLayout2.addWidget(self.parameters,1,0)
        subLayout2.addWidget(self.attributes,1,1)
        layout.addItem(subLayout2)

        self.connect(self.name,SIGNAL("textEdited(QString)"),self.nameChanged)
        self.connect(self.tags,SIGNAL("textEdited(QString)"),self.tagsChanged)
        self.connect(self.description,SIGNAL("textChanged()"),self.descriptionChanged)
        self.setLayout(layout)
Example #2
0
 def __init__(self,parent = None,globals = {}):
   QWidget.__init__(self,parent)
   ObserverWidget.__init__(self)
   layout = QGridLayout()
   
   self._globals = globals
   self._thread = None
   self._coderunner=self._globals["__coderunner__"]
   self.name = QLineEdit()
   self.filename = QLineEdit()
   self.filename.setReadOnly(True)
   self.failed = QLineEdit()
   self.isRunning = QLineEdit()
   self.failed.setReadOnly(True)
   self.isRunning.setReadOnly(True)
       
   layout.addWidget(QLabel("Name"))
   layout.addWidget(self.name)
   layout.addWidget(QLabel("Filename"))
   layout.addWidget(self.filename)
   layout.addWidget(QLabel("failed"))
   layout.addWidget(self.failed)
   layout.addWidget(QLabel("isRunning"))
   layout.addWidget(self.isRunning)
   
   self.setLayout(layout)
Example #3
0
 def __init__(self,codeEditorWindow,codeRunner,parent = None):
   self._codeEditorWindow = codeEditorWindow
   self._codeRunner = codeRunner
   QTreeWidget.__init__(self,parent)
   ObserverWidget.__init__(self)
   self.connect(self,SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"),self.itemDoubleClicked)
   self.setColumnCount(2)
   self.setColumnWidth(0,400)
   self.setHeaderLabels(["filename","line"])
Example #4
0
 def __init__(self,parent = None):
   QTreeWidget.__init__(self,parent)
   ObserverWidget.__init__(self)
   self._items = dict()
   self._manager = dm.DataManager()
   self._manager.attach(self)
   self.setHeaderLabels(["Name"])
   for datacube in self._manager.datacubes():
     self.addDatacube(datacube,None)
Example #5
0
 def __init__(self,parent = None):
     QTreeWidget.__init__(self,parent)
     ObserverWidget.__init__(self)
     self._parent=parent
     self._items = dict()
     self._manager = dm.DataManager()           # attach  dataManager to this dataTreeview, i.e. dataTreeView receives message from datamanager  
     debugDM2GUI('attaching ',self._manager,' to ',self)
     self._manager.attach(self)
     self.setHeaderLabels(["Name"])
     for cube in self._manager.datacubes():
       self.addDatacube(cube,None)
     self.itemDoubleClicked.connect(self.renameCube)
Example #6
0
  def __init__(self,parent = None,globals={}):
    QTreeWidget.__init__(self,parent)
    ObserverWidget.__init__(self)

    self._parent=parent
    self.setSelectionMode(QAbstractItemView.SingleSelection)
    self.setSortingEnabled(True)

    self._globals=globals

    self._coderunner=self._globals["__coderunner__"]
    self.updateThreadList()
Example #7
0
  def __init__(self,parent = None,globals = {}):
    QScrollArea.__init__(self,parent)
    ObserverWidget.__init__(self)
    self._globals = globals
    self._coderunner=self._globals["__coderunner__"]
    self._thread = None

    
    layout = QFormLayout()
    self.setAttribute(Qt.WA_DeleteOnClose,True)
    self.variables = QLineEdit()
    self.variables.setReadOnly(True)


    self.setLayout(layout)
Example #8
0
  def __init__(self,parent = None):
    QMainWindow.__init__(self,parent)
    ObserverWidget.__init__(self)
    
    self.setWindowTitle("Instruments")
    
    self._windows = dict()
    
    self.setAutoFillBackground(False)
    
    self._instrumentsArea = QMdiArea(self)

    self._instrumentsArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
    self._instrumentsArea.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)

    self.setCentralWidget(self._instrumentsArea)
Example #9
0
 def __init__(self,instrument,parent=None):
   Debugger.__init__(self)
   QMainWindow.__init__(self,parent)
   self.qw=QWidget(parent)
   self.setCentralWidget(self.qw)
   menubar=self.menuBar()
   myMenu=menubar.addMenu("&File")
   reloadCommand=myMenu.addAction("Reload instrument")
   reloadCommand=myMenu.addAction("Save state")
   restoreStateCommand=myMenu.addAction("Restore state")
   self.connect(reloadCommand,SIGNAL("triggered()"),self.reloadInstrument)
   self.connect(reloadCommand,SIGNAL("triggered()"),self.saveState)
   self.connect(restoreStateCommand,SIGNAL("triggered()"),self.restoreState)
   ObserverWidget.__init__(self)
   self.setInstrument(instrument)
   self._manager=pyview.helpers.instrumentsmanager.Manager()
Example #10
0
  def __init__(self,parent = None,globals = {}):
    QMainWindow.__init__(self,parent)
    ObserverWidget.__init__(self)

    self._globals = globals


    self._workingDirectory = None
    
    self.setStyleSheet("""
    QTreeWidget:Item {padding:6;} 
    QTreeView:Item {padding:6;}""")

    self.setWindowTitle("Variables Manager")
    self.setAttribute(Qt.WA_DeleteOnClose,True)

    splitter = QSplitter(Qt.Horizontal)


    self._thread = None

    self._threadList = ThreadList(parent =self,globals = globals)

    self._updateButton=QPushButton("Update")

    self.connect(self._updateButton,SIGNAL("clicked()"),self.updatePressed)

    self._variablesList = VariablesList(parent =self,globals = globals)
    self._props = ThreadProperties(parent =self,globals = globals)
    self.connect(self._threadList,SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"),self.selectThread)

    self.tabs = QTabWidget() 
   
    splitter.addWidget(self._threadList)
    splitter.addWidget(self._updateButton)
    splitter.addWidget(self.tabs)
    
    self.setCentralWidget(splitter)
    self.tabs.addTab(self._props,"Properties")
    self.tabs.addTab(self._variablesList,"Variables")
Example #11
0
 def __init__(self,parent = None,globals = {}):
   QWidget.__init__(self,parent)
   ObserverWidget.__init__(self)
   layout = QGridLayout()
   
   self._globals = globals
   self._cube = None
   self.name = QLineEdit()
   self.filename = QLineEdit()
   self.filename.setReadOnly(True)
   self.tags = QLineEdit()
   self.description = QTextEdit()
   self.bindName = QLineEdit()
   self.updateBindButton = QPushButton("Update / Set")
   self.updateBindButton.setSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum)
   self.connect(self.updateBindButton,SIGNAL("clicked()"),self.updateBind)
   
   font = self.description.currentFont()
   font.setPixelSize(18)
   self.description.setFont(font  )
   
   layout.addWidget(QLabel("Name"))
   layout.addWidget(self.name)
   layout.addWidget(QLabel("Filename"))
   layout.addWidget(self.filename)
   layout.addWidget(QLabel("Bind to local variable:"))
   bindLayout = QBoxLayout(QBoxLayout.LeftToRight)
   bindLayout.addWidget(self.bindName)
   bindLayout.addWidget(self.updateBindButton)
   layout.addItem(bindLayout)
   layout.addWidget(QLabel("Tags"))
   layout.addWidget(self.tags)
   layout.addWidget(QLabel("Description"))
   layout.addWidget(self.description)
   
   self.connect(self.name,SIGNAL("textEdited(QString)"),self.nameChanged)
   self.connect(self.tags,SIGNAL("textEdited(QString)"),self.tagsChanged)
   self.connect(self.description,SIGNAL("textChanged()"),self.descriptionChanged)
   self.setLayout(layout)
Example #12
0
  def __init__(self,parent = None):
    QWidget.__init__(self,parent)
    ObserverWidget.__init__(self)
    self._instrumentsArea = InstrumentsArea()
    self.manager = pyview.helpers.instrumentsmanager.Manager()
    self.setMinimumHeight(200)
    settings = QSettings()
    if settings.contains("directories.setup"):
      setupPath = str(settings.value("directories.setup").toString())
    else:
      setupPath = os.getcwd()
    self._picklePath = setupPath+r"/config/setups.pickle"
    self.loadStates()
    self.dashboards = dict()
    self.setWindowTitle("Instruments")
    layout = QGridLayout()
        
    self.instrumentlist = InstrumentList()
    
    self.connect(self.instrumentlist,SIGNAL("showFrontPanel()"),self.showFrontPanel)
    
    self.instrumentlist.setSelectionMode(QAbstractItemView.ExtendedSelection)
    self.instrumentlist.setHeaderLabels(["Name","Base Class","Args","Kwargs"])
    
    
    self.setupList = QComboBox()
    self.setupList.setEditable(True)
    restoreSetup = QPushButton("Restore setup")
    saveSetup = QPushButton("Save setup")
    removeSetup = QPushButton("Remove setup")
    
    setupLayout = QBoxLayout(QBoxLayout.LeftToRight)
    
    reloadButton = QPushButton("Reload instrument")
    frontPanelButton = QPushButton("Show frontpanel")
    self.connect(reloadButton,SIGNAL("clicked()"),self.reloadInstrument)
    self.connect(frontPanelButton,SIGNAL("clicked()"),self.showFrontPanel)
    
    self.connect(restoreSetup,SIGNAL("clicked()"),self.restoreSetup)
    self.connect(saveSetup,SIGNAL("clicked()"),self.saveSetup)
    self.connect(removeSetup,SIGNAL("clicked()"),self.removeSetup)

    buttonsLayout = QBoxLayout(QBoxLayout.LeftToRight)
    buttonsLayout.addWidget(reloadButton)
    buttonsLayout.addWidget(frontPanelButton)
    buttonsLayout.addStretch()
    setupLayout.addWidget(restoreSetup)
    setupLayout.addWidget(saveSetup)
    setupLayout.addStretch()
    setupLayout.addWidget(removeSetup)

    layout.addWidget(self.instrumentlist)
    layout.addItem(buttonsLayout)
    layout.addWidget(QLabel("Store/restore setup:"))
    layout.addWidget(self.setupList)
    layout.addItem(setupLayout)
    self.manager.attach(self)   
    self.updateInstrumentsList()

    self.setLayout(layout)
    self.updateStateList()
Example #13
0
    def __init__(self,parent = None,globals = {}):  # creator of the frontpanel
        debugDM2GUI("in dataManagerGUI frontpanel creator")
        QMainWindow.__init__(self,parent)
        ObserverWidget.__init__(self)

        self.manager = dm.DataManager()
        debugDM2GUI('attaching',self.manager,'to',self)
        self.manager.attach(self)
        self._globals = globals
        
        self._workingDirectory = None
        
        self.setStyleSheet("""QTreeWidget:Item {padding:6;} QTreeView:Item {padding:6;}""")

        self.setWindowTitle("Data Manager plugin version "+plugin["version"])
        self.setAttribute(Qt.WA_DeleteOnClose,True)

        splitter = QSplitter(Qt.Horizontal)

        self.cubeList = DataTreeView(parent=self)
        self.cubeViewer = DatacubeTableView()
        self.connect(self.cubeList,SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"),self.selectCube)
        self.plotters2D=[]
        self.plotters3D=[]    
        self.tabs = QTabWidget()

        self._cube = None   # current cube of the datamanager GUI
        
        leftLayout = QGridLayout()
        
        leftLayout.addWidget(self.cubeList)
        
        leftWidget = QWidget()
        leftWidget.setLayout(leftLayout)
        
        splitter.addWidget(leftWidget)
        splitter.addWidget(self.tabs)
        menubar = self.menuBar()
        filemenu = menubar.addMenu("File")
        
        newCube = filemenu.addAction("New")
        loadCube = filemenu.addAction("Open...")
        renameCube = filemenu.addAction("Rename...")
        filemenu.addSeparator()
        removeCube = filemenu.addAction("Remove")
        filemenu.addSeparator()
        saveCube = filemenu.addAction("Save")
        saveCubeAs = filemenu.addAction("Save as...")
        filemenu.addSeparator()
        markAsGood = filemenu.addAction("Mark as Good")
        markAsBad = filemenu.addAction("Mark as Bad")
        filemenu.addSeparator()
        sendToIgor=filemenu.addAction("Send to IgorPro")

        menubar.addMenu(filemenu)    

        self.connect(loadCube,SIGNAL("triggered()"),self.loadCube)
        self.connect(newCube,SIGNAL("triggered()"),self.newCube)
        self.connect(renameCube,SIGNAL("triggered()"),self.renameCube)
        self.connect(saveCube,SIGNAL("triggered()"),self.saveCube)
        self.connect(saveCubeAs,SIGNAL("triggered()"),self.saveCubeAs)
        self.connect(removeCube,SIGNAL("triggered()"),self.removeCube)
        self.connect(markAsGood,SIGNAL("triggered()"),self.markAsGood)
        self.connect(markAsBad,SIGNAL("triggered()"),self.markAsBad)
        self.connect(sendToIgor,SIGNAL("triggered()"),self.sendToIgor)

        plotmenu = menubar.addMenu("Plots")
        new2DPlot = plotmenu.addAction("New 2D plot")
        new3DPlot = plotmenu.addAction("New 3D plot")
        removePlot = plotmenu.addAction("Remove current plot")
        self.connect(new2DPlot,SIGNAL("triggered()"),self.add2DPlotter)
        self.connect(new3DPlot,SIGNAL("triggered()"),self.add3DPlotter)
        self.connect(removePlot,SIGNAL("triggered()"),self.removePlotter)

        def preparePlotMenu():
            removePlot.setEnabled(isinstance(self.tabs.currentWidget(),Plot2DWidget) or isinstance(self.tabs.currentWidget(),Plot3DWidget))
        self.connect(plotmenu,SIGNAL("aboutToShow()"),preparePlotMenu)

        menubar.addMenu(plotmenu)

        self.setCentralWidget(splitter)
        self.controlWidget = DatacubeProperties(globals = globals)
        self.tabs.addTab(self.controlWidget,"Properties")
        self.tabs.addTab(self.cubeViewer,"Table View")
        self.add2DPlotter()
        self.add3DPlotter()
        self.selectCube(self._cube,None)
Example #14
0
 def __init__(self, cube):
     QAbstractItemModel.__init__(self)
     ObserverWidget.__init__(self)
     self.setDatacube(cube)
Example #15
0
 def __init__(self,instrument,parent=None):
   QWidget.__init__(self,parent)
   ObserverWidget.__init__(self)
   self.setInstrument(instrument)
Example #16
0
  def __init__(self,parent = None,globals = {}):
    QMainWindow.__init__(self,parent)
    ObserverWidget.__init__(self)

    self.manager = dm.DataManager()
    self.manager.attach(self)
    self._globals = globals
    
    self._workingDirectory = None
    
    self.setStyleSheet("""
    QTreeWidget:Item {padding:6;} 
    QTreeView:Item {padding:6;}""")

    self.setWindowTitle("Data Manager")
    self.setAttribute(Qt.WA_DeleteOnClose,True)

    splitter = QSplitter(Qt.Horizontal)


    self.datacubeList = DataTreeView(parent =self)
    self.datacubeViewer = DatacubeTableView()
    self.connect(self.datacubeList,SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"),self.selectCube)
    self.dataPlotter2D = Plot2DWidget()
    self.dataPlotter3D = Plot3DWidget()
    self.tabs = QTabWidget() 
    self._cube = None
    
    leftLayout = QGridLayout()
    
    leftLayout.addWidget(self.datacubeList)
    
    leftWidget = QWidget()
    leftWidget.setLayout(leftLayout)
    
    splitter.addWidget(leftWidget)
    splitter.addWidget(self.tabs)
    menubar = self.menuBar()
    filemenu = menubar.addMenu("File")
    
    newDatacube = filemenu.addAction("New")
    loadDatacube = filemenu.addAction("Load")
    saveDatacube = filemenu.addAction("Save")
    saveDatacubeAs = filemenu.addAction("Save as...")
    removeDatacube = filemenu.addAction("Remove")
    filemenu.addSeparator()
    markAsGood = filemenu.addAction("Mark as Good")
    markAsBad = filemenu.addAction("Mark as Bad")
    filemenu.addSeparator()
    sendToIgor=filemenu.addAction("Send to IgorPro")    

    self.connect(loadDatacube,SIGNAL("triggered()"),self.loadDatacube)
    self.connect(newDatacube,SIGNAL("triggered()"),self.addCube)
    self.connect(saveDatacube,SIGNAL("triggered()"),self.saveCube)
    self.connect(saveDatacubeAs,SIGNAL("triggered()"),self.saveCubeAs)
    self.connect(removeDatacube,SIGNAL("triggered()"),self.removeCube)
    self.connect(markAsGood,SIGNAL("triggered()"),self.markAsGood)
    self.connect(markAsBad,SIGNAL("triggered()"),self.markAsBad)
    self.connect(sendToIgor,SIGNAL("triggered()"),self.sendToIgor)
    
    menubar.addMenu(filemenu)

    self.setCentralWidget(splitter)
    self.props = DatacubeProperties(globals = globals)
    self.tabs.addTab(self.props,"Properties")
    self.tabs.addTab(self.dataPlotter2D,"2D Data Plotting")
    self.tabs.addTab(self.dataPlotter3D,"3D Data Plotting")
    self.tabs.addTab(self.datacubeViewer,"Table View")
    self.selectCube(None,None)
Example #17
0
  def __init__(self,parent = None):
    QWidget.__init__(self,parent)
    ObserverWidget.__init__(self)
    self._cube = None
    self._showLegend = True
    self._plots = []
    self._cnt = 0
    self._lineColors = [(0,0,0),(0.8,0,0),(0.0,0,0.8),(0.0,0.5,0),(0.5,0.5,0.5),(0.8,0.5,0.0),(0.9,0,0.9)]
    self._lineStyles = ['-','--','-.',':']
    self._updated = False
    self.xnames = []
    self._currentIndex = None
    self.ynames = []
    self._plottedVariables =[]
    self.legends = []
    self.cubes = []
    splitter = QSplitter(Qt.Vertical)
    layout = QGridLayout()
    self.timer = QTimer(self)
    self.timer.setInterval(1000)
    self.connect(self.timer,SIGNAL("timeout()"),self.onTimer)
    self.timer.start()
    self.props = QWidget()
    self.canvas = MyMplCanvas(dpi = 72,width = 8,height = 4)

    splitter.addWidget(self.canvas)
    splitter.addWidget(self.props)
    propLayout = QGridLayout()
    self.xNames = QComboBox()
    self.xNames.setSizeAdjustPolicy(QComboBox.AdjustToContents)
    self.addButton = QPushButton("Add plot")
    self.autoplot=QCheckBox("Auto plot")
    self.autoclear=QCheckBox("Auto clear")
    self.clearButton = QPushButton("Clear all")
    self.yNames = QComboBox()
    self.showLegend = QCheckBox("Show legend")
    self.showLegend.setCheckState(Qt.Checked)
    self.yNames.setSizeAdjustPolicy(QComboBox.AdjustToContents)

    playout = QBoxLayout(QBoxLayout.LeftToRight)
    playout.addWidget(QLabel("X:"))
    playout.addWidget(self.xNames)
    playout.addWidget(QLabel("Y:"))
    playout.addWidget(self.yNames)
    playout.addWidget(self.addButton)
    playout.addWidget(self.showLegend)
    playout.addStretch()
    playout.addWidget(self.autoplot)
    playout.addWidget(self.autoclear)
    playout.addWidget(self.clearButton)
    
    self.connect(self.showLegend,SIGNAL("stateChanged(int)"),self.showLegendStateChanged)
    self.connect(self.autoplot,SIGNAL("stateChanged(int)"),self.autoplotChanged)
    self.connect(self.addButton,SIGNAL("clicked()"),self.addPlot)
    self.connect(self.clearButton,SIGNAL("clicked()"),self.clearPlots)
    layout.addWidget(splitter)
    
    self.plotList = QTreeWidget()
    self.lineStyles = QComboBox()
    self.lineStyles.addItem("line","line")
    self.lineStyles.addItem("scatter","scatter")
    self.lineStyles.setSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum)

    self.plotList.setColumnCount(5)
    self.plotList.setHeaderLabels(("Datacube","X variable","Y variable","style"))

    removeButton = QPushButton("Remove line")
    removeButton.setSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum)

    styleLabel = QLabel("Line style")
    styleLabel.setSizePolicy(QSizePolicy.Maximum,QSizePolicy.Maximum)

    linePropertiesLayout = QBoxLayout(QBoxLayout.LeftToRight)
    linePropertiesLayout.addWidget(styleLabel)
    linePropertiesLayout.addWidget(self.lineStyles)
    linePropertiesLayout.addWidget(removeButton)
    linePropertiesLayout.insertStretch(2)

    self.connect(removeButton,SIGNAL("clicked()"),self.removeLine)
    self.connect(self.plotList,SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"),self.lineSelectionChanged)
    self.connect(self.lineStyles,SIGNAL("currentIndexChanged(int)"),self.updateLineStyle)

    propLayout.addLayout(playout,0,0)
    propLayout.addWidget(self.plotList,1,0)

    propLayout.addItem(linePropertiesLayout,2,0)

    self.props.setLayout(propLayout)
    self.setLayout(layout)