Пример #1
0
 def __init__(self,app):
      super(calibeditor,self).__init__( )
      self.app=app
      self.setLayout(QtGui.QVBoxLayout())
      self.treeview=QtGui.QTreeView()
      self.layout().addWidget(self.treeview)
      self.model=jsonschematreemodel.jsonschematreemodel(app )
      self.treeview.setModel(self.model)
      self.treeview.setMinimumWidth(800)
      self.treeview.setMinimumHeight(400)
   
      self.treeview.setAlternatingRowColors(True)
      self.treeview.setItemDelegateForColumn(1,calibeditdelegate.calibEditDelegate( app ))
      self.reset()
     
          
      QtGui.QShortcut(QtGui.QKeySequence("Ctrl+S"),self,self.model.save)
Пример #2
0
    def __init__(self, app):
        super(calibeditor, self).__init__()
        self.app = app
        self.setLayout(QtGui.QVBoxLayout())
        self.treeview = QtGui.QTreeView()
        self.layout().addWidget(self.treeview)
        self.model = jsonschematreemodel.jsonschematreemodel(app)
        self.treeview.setModel(self.model)
        self.treeview.setMinimumWidth(800)
        self.treeview.setMinimumHeight(400)

        self.treeview.setAlternatingRowColors(True)
        self.treeview.setItemDelegateForColumn(
            1, calibeditdelegate.calibEditDelegate(app))
        self.reset()

        QtGui.QShortcut(QtGui.QKeySequence("Ctrl+S"), self, self.model.save)
Пример #3
0
 def __init__(self,app):
     super(consolidatepanel,self).__init__( )
     self.app=app
     self.hlayout=QtGui.QHBoxLayout()
     self.setLayout(self.hlayout)
     self.treeview=QtGui.QTreeView()
     self.hlayout.addWidget(self.treeview)
     
     self.model=jsonschematreemodel.jsonschematreemodel( app,
                     schema=json.load(open(os.path.dirname(__file__)
                     +os.sep+'DataConsolidationConf.json'),
                     object_pairs_hook=collections.OrderedDict) 
                                                        )
     self.treeview.setModel(self.model)
     self.treeview.setMinimumWidth(400)
     self.treeview.setMinimumHeight(400)
     self.treeview.setAlternatingRowColors(True)
     self.treeview.setItemDelegateForColumn(1,calibeditdelegate.calibEditDelegate( app ))
     self.reset()
     default= schematools.schematodefault( self.model.schema)
     
     
     self.filename=os.path.expanduser("~"
                                            +os.sep
                                            +self.app.netconf["Name"]
                                            +"consolconf.json"
                                            )
     if not os.path.isfile(self.filename):
         import shutil
         shutil.copy(os.path.dirname(__file__)   +os.sep+'consolconftemplate.json',self.filename)
     self.model.loadfile(self.filename)
     self.reset()
     self.connect(self.model, QtCore.SIGNAL('dataChanged(QModelIndex,QModelIndex)'),self.model.save)
     self.submitbutton=QtGui.QPushButton("Collect All Data")
     self.submitlayout=QtGui.QVBoxLayout()
     self.hlayout.addLayout(self.submitlayout)
     self.submitlayout.addWidget(   self.submitbutton)
     self.submitlayout.addStretch()
     self.connect(self.submitbutton, QtCore.SIGNAL("clicked()"),self.startmerge)
     self.connect(self.app.plotthread,QtCore.SIGNAL("mergeresultdata(QString)"),self.showmergeresults)
Пример #4
0
    def __init__(self, app):
        super(consolidatepanel, self).__init__()
        self.app = app

        self.localmergetstatusthread = mergestatusthread(self)
        self.timeformat = "%Y.%m.%d - %H:%M:%S"
        self.connect(self.localmergetstatusthread,
                     QtCore.SIGNAL("sig_writeToStatus(QString)"),
                     self.writeToStatus)

        self.hlayout = QtGui.QHBoxLayout()
        self.setLayout(self.hlayout)

        self.vlayout = QtGui.QVBoxLayout()
        self.hlayout.addLayout(self.vlayout)

        self.treeview = QtGui.QTreeView()
        self.vlayout.addWidget(self.treeview)

        self.statuslabel = QtGui.QLabel()
        self.vlayout.addWidget(self.statuslabel)
        self.statuslabel.setText("Datamerger status:")

        self.statusfield = QtGui.QTextEdit()
        self.vlayout.addWidget(self.statusfield)
        self.statusfield.setMaximumHeight(150)
        self.statusfield.setMinimumHeight(150)
        self.statusfield.setVerticalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOff)
        self.statusfield.setVerticalScrollBarPolicy(
            QtCore.Qt.ScrollBarAlwaysOn)

        self.model = jsonschematreemodel.jsonschematreemodel(
            app,
            schema=json.load(open(
                os.path.dirname(__file__) + os.sep +
                'DataConsolidationConf.json'),
                             object_pairs_hook=collections.OrderedDict))
        self.treeview.setModel(self.model)
        self.treeview.setMinimumWidth(400)
        self.treeview.setMinimumHeight(400)
        self.treeview.setAlternatingRowColors(True)
        self.treeview.setItemDelegateForColumn(
            1, calibeditdelegate.calibEditDelegate(app))
        self.reset()
        default = schematools.schematodefault(self.model.schema)

        self.filename = os.path.expanduser("~" + os.sep +
                                           self.app.netconf["Name"] +
                                           "consolconf.json")
        if not os.path.isfile(self.filename):
            import shutil
            shutil.copy(
                os.path.dirname(__file__) + os.sep + 'consolconftemplate.json',
                self.filename)

        try:
            self.calib = json.load(open(self.filename),
                                   object_pairs_hook=collections.OrderedDict)
            validate(self.calib, self.model.schema)
        except Exception as e:
            print e
            import shutil
            shutil.copy(
                os.path.dirname(__file__) + os.sep + 'consolconftemplate.json',
                self.filename)

        self.model.loadfile(self.filename)
        self.reset()
        self.connect(self.model,
                     QtCore.SIGNAL('dataChanged(QModelIndex,QModelIndex)'),
                     self.model.save)
        self.submitbutton = QtGui.QPushButton("Collect All Data")
        self.submitbutton.setEnabled(False)
        self.submitbutton.setMinimumWidth(150)
        self.submitbutton.setMaximumWidth(150)

        self.submitlabel = QtGui.QLabel("Waiting for calibration...")

        self.submitlayout = QtGui.QVBoxLayout()

        self.hlayout.addLayout(self.submitlayout)
        self.submitlayout.addWidget(self.submitlabel)
        self.submitlayout.addWidget(self.submitbutton)
        self.submitlayout.addStretch()

        self.connect(self.submitbutton, QtCore.SIGNAL("clicked()"),
                     self.startmerge)
        self.connect(self.app.plotthread,
                     QtCore.SIGNAL("mergeresultdata(QString)"),
                     self.showmergeresults)

        self.writeToStatus(
            "\nDatamerger waiting for input... Make sure you load a calibration first!"
        )
Пример #5
0
 def __init__(self,app):
     super(consolidatepanel,self).__init__( )
     self.app=app
     
     self.localmergetstatusthread = mergestatusthread(self)
     self.timeformat = "%Y.%m.%d - %H:%M:%S"
     self.connect(self.localmergetstatusthread, QtCore.SIGNAL("sig_writeToStatus(QString)"),self.writeToStatus)
     
     self.hlayout=QtGui.QHBoxLayout()
     self.setLayout(self.hlayout)
     
     self.vlayout=QtGui.QVBoxLayout()
     self.hlayout.addLayout(self.vlayout)
     
     self.treeview=QtGui.QTreeView()
     self.vlayout.addWidget(self.treeview)
     
     self.statuslabel =QtGui.QLabel()
     self.vlayout.addWidget(self.statuslabel)
     self.statuslabel.setText("Datamerger status:")
     
     self.statusfield = QtGui.QTextEdit()
     self.vlayout.addWidget(self.statusfield)
     self.statusfield.setMaximumHeight(150)
     self.statusfield.setMinimumHeight(150)
     self.statusfield.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
     self.statusfield.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
     
     self.model=jsonschematreemodel.jsonschematreemodel( app,
                     schema=json.load(open(os.path.dirname(__file__)
                     +os.sep+'DataConsolidationConf.json'),
                     object_pairs_hook=collections.OrderedDict) 
                                                        )
     self.treeview.setModel(self.model)
     self.treeview.setMinimumWidth(400)
     self.treeview.setMinimumHeight(400)
     self.treeview.setAlternatingRowColors(True)
     self.treeview.setItemDelegateForColumn(1,calibeditdelegate.calibEditDelegate( app ))
     self.reset()
     default= schematools.schematodefault(self.model.schema)
     
     
     self.filename=os.path.expanduser("~"
                                            +os.sep
                                            +self.app.netconf["Name"]
                                            +"consolconf.json"
                                            )
     if not os.path.isfile(self.filename):
         import shutil
         shutil.copy(os.path.dirname(__file__)   +os.sep+'consolconftemplate.json',self.filename)
     
     try:
         self.calib=json.load(open(self.filename),object_pairs_hook=collections.OrderedDict)
         validate(self.calib,self.model.schema)
     except Exception as e:
         print e
         import shutil
         shutil.copy(os.path.dirname(__file__)   +os.sep+'consolconftemplate.json',self.filename)
      
     self.model.loadfile(self.filename)
     self.reset()
     self.connect(self.model, QtCore.SIGNAL('dataChanged(QModelIndex,QModelIndex)'),self.model.save)
     self.submitbutton=QtGui.QPushButton("Collect All Data")
     self.submitbutton.setEnabled(False)
     self.submitbutton.setMinimumWidth(150)
     self.submitbutton.setMaximumWidth(150)
     
     self.submitlabel=QtGui.QLabel("Waiting for calibration...")
     
     self.submitlayout=QtGui.QVBoxLayout()
     
     self.hlayout.addLayout(self.submitlayout)
     self.submitlayout.addWidget(self.submitlabel)
     self.submitlayout.addWidget(self.submitbutton)
     self.submitlayout.addStretch()
     
     self.connect(self.submitbutton, QtCore.SIGNAL("clicked()"),self.startmerge)
     self.connect(self.app.plotthread,QtCore.SIGNAL("mergeresultdata(QString)"),self.showmergeresults)
     
     self.writeToStatus("\nDatamerger waiting for input... Make sure you load a calibration first!")