当前位置: 首页>>代码示例>>Python>>正文


Python ParameterTree.setWindowTitle方法代码示例

本文整理汇总了Python中pyqtgraph.parametertree.ParameterTree.setWindowTitle方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterTree.setWindowTitle方法的具体用法?Python ParameterTree.setWindowTitle怎么用?Python ParameterTree.setWindowTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyqtgraph.parametertree.ParameterTree的用法示例。


在下文中一共展示了ParameterTree.setWindowTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Ui_ChildWindow

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class Ui_ChildWindow(object):
    def setupUi(self, MainWindow, params):
        #app = QtGui.QApplication([])
        #self.win = QtGui.QMainWindow()
        self.area = DockArea()
        MainWindow.setCentralWidget(self.area)
        MainWindow.resize(500, 700)
        MainWindow.setWindowTitle('Action construct')


        self.seq_cntr = Dock("Sequence", size=(150,200))
        self.area.addDock(self.seq_cntr, 'left')

        ## first dock gets save/restore buttons
        self.t = ParameterTree()


        if params != None:
            self.p_child = Parameter.create(name='params', type='group', children=params)
            self.t.setParameters(self.p_child, showTop=False)

        self.t.setWindowTitle('pyqtgraph example: Parameter Tree')
        self.seq_cntr.addWidget(self.t)


        self.seq = pg.LayoutWidget()
        self.label = QtGui.QLabel("""Controls""")
        self.saveBtn = QtGui.QPushButton('Add Action')
        self.restoreBtn = QtGui.QPushButton('Modify table')
        self.restoreBtn.setEnabled(False)
        self.seq.addWidget(self.label, row=0, col=0)
        self.seq.addWidget(self.saveBtn, row=1, col=0)
        self.seq.addWidget(self.restoreBtn, row=2, col=0)
        self.seq_cntr.addWidget(self.seq)
开发者ID:iagapov,项目名称:ocelot,代码行数:36,代码来源:ui_optim_sase.py

示例2: restore

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
    global state
    state = p.saveState()
    
def restore():
    global state
    add = p['Save/Restore functionality', 'Restore State', 'Add missing items']
    rem = p['Save/Restore functionality', 'Restore State', 'Remove extra items']
    p.restoreState(state, addChildren=add, removeChildren=rem)
p.param('Save/Restore functionality', 'Save State').sigActivated.connect(save)
p.param('Save/Restore functionality', 'Restore State').sigActivated.connect(restore)


## Create two ParameterTree widgets, both accessing the same data
t = ParameterTree()
t.setParameters(p, showTop=False)
t.setWindowTitle('pyqtgraph example: Parameter Tree')
t2 = ParameterTree()
t2.setParameters(p, showTop=False)

win = QtGui.QWidget()
layout = QtGui.QGridLayout()
win.setLayout(layout)
layout.addWidget(QtGui.QLabel("These are two views of the same data. They should always display the same values."), 0,  0, 1, 2)
layout.addWidget(t, 1, 0, 1, 1)
layout.addWidget(t2, 1, 1, 1, 1)
win.show()
win.resize(800,800)

## test save/restore
s = p.saveState()
p.restoreState(s)
开发者ID:3rdcycle,项目名称:pyqtgraph,代码行数:33,代码来源:parametertree.py

示例3: __init__

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
    def __init__(self):
    #==========================================
        super(GUIMainWindow, self).__init__()
        
        # CHANGE HERE -------------------------------------------------
        # -------------------------------------------------------------

        area = DockArea()
        self.setCentralWidget(area)
        self.resize(1280, 800)
        self.setWindowTitle('Demo: How to use HARP with Python')
        
        ## Create docks, place them into the window one at a time.
        ## Note that size arguments are only a suggestion; docks will still have to
        ## fill the entire dock area and obey the limits of their internal widgets.
        d1 = Dock("Control", size=(300,200))     ## give this dock the minimum possible size
        d2 = Dock("Description", size=(300,800))
        d31 = Dock("INTRA frame - Prediction Units", size=(500,300))
        d32 = Dock("INTER frame - Prediction Units", size=(500,300))
        #d33 = Dock("Dock3 - Transform Units", size=(500,300))
        d41 = Dock("Frame Difference ", size=(100,100))
        d42 = Dock("Current Frame ", size=(100,100))
        d51 = Dock("CU Depths", size=(200,100))
        d52 = Dock("MVs X Component", size=(200,100))
        d53 = Dock("MVs Y Component", size=(200,100))

        area.addDock(d2, 'left')      ## place d1 at left edge of dock area (it will fill the whole space since there are no other docks yet)
        area.addDock(d1, 'bottom', d2)     ## place d2 at right edge of dock area
        area.addDock(d31, 'right')     
        area.addDock(d32, 'bottom', d31)
        #area.addDock(d33, 'bottom', d32)
        area.addDock(d41, 'right')
        area.addDock(d51, 'bottom', d41) 
        area.addDock(d42, 'right', d41)
        
        area.addDock(d52, 'right', d51)
        area.addDock(d53, 'right', d52)
           
        #==========================================
        def dock_ImageItem(self, Dock):
        #==========================================
            pgGLWidget = pg.GraphicsLayoutWidget()
            ViewBox = pgGLWidget.addViewBox(invertY = True)
            #ViewBox.setBackgroundColor((255,255,255))
            ViewBox.setAspectLocked(True)
            pgImageItem = pg.ImageItem(border='w')
            ViewBox.addItem(pgImageItem)
            Dock.addWidget(pgGLWidget)
            return pgImageItem
        
        #==========================================
        def dock_CurveItem(self, Dock, Title, LabelX, LabelY):
        #==========================================
            pgGWindow= pg.GraphicsLayoutWidget()
            pgPlot = pgGWindow.addPlot(title=Title)
            x =[0,0,0]
            y = [0,0]
            pgCurveItem = pg.PlotCurveItem(x, y, stepMode=True, fillLevel=0, brush=(0, 255, 0, 80))
            pgPlot.addItem(pgCurveItem)
            pgPlot.setLabel('bottom', LabelX)
            pgPlot.setLabel('left', LabelY)
            Dock.addWidget(pgGWindow)
            return pgCurveItem

        
        self.ImageItem_d2  = dock_ImageItem(self, d2)
        self.ImageItem_d31 = dock_ImageItem(self, d31)
        self.ImageItem_d32 = dock_ImageItem(self, d32)
        self.ImageItem_d41 = dock_ImageItem(self, d41)
        self.ImageItem_d42 = dock_ImageItem(self, d42)
          
        
        self.CurveItem_d51 = dock_CurveItem(self, d51, "CU Depths",       "CU Depth", "Number of Occurences")
        self.CurveItem_d52 = dock_CurveItem(self, d52, "MVs X Component", "Magnitude", "Number of Occurences")
        self.CurveItem_d53 = dock_CurveItem(self, d53, "MVs Y Component", "Magnitude", "Number of Occurences")
          
        params = [
            {'name': 'Basic settings', 'type': 'group', 'children': 
             [
                {'name': 'QP', 'type': 'int', 'value': 30},
                {'name': 'x265', 'type': 'bool', 'value': True},
                {'name': 'Show CUs', 'type': 'bool', 'value': True},
                {'name': 'Show PUs', 'type': 'bool', 'value': True},
                {'name': 'Show Modes', 'type': 'bool', 'value': True},
            ]},

            ]
        
        ## Create tree of Parameter objects
        p = Parameter.create(name='params', type='group', children=params, readonly=False, enabled=True)
        t = ParameterTree()
        t.setParameters(p, showTop=False)
        t.setWindowTitle('pyqtgraph example: Parameter Tree')
        self.p = p
        d1.addWidget(t)
        
        MyWorkThread = WorkThread(self)
        MyWorkThread.start()
        
        Description = readImg(ProjectDir + "/Various/Resources/Special/LMS_Demo.png")
#.........这里部分代码省略.........
开发者ID:pixlra,项目名称:HARP-fork,代码行数:103,代码来源:a_HARP_LiveDemo_ICIP2014.py

示例4: Labels

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class Labels(object):
    def __init__(self, parent = None):
        
        #print "init!!!!!"
        self.parent = parent

        ## Dock: Labels
        self.dLabels = Dock("Labels", size=(1, 1))
        self.wLabels = ParameterTree()
        self.wLabels.setWindowTitle('Labels')
        self.dLabels.addWidget(self.wLabels)

        self.labels_grp = 'Labels'
        self.labels_A_str = 'Single'
        self.labels_B_str = 'Multi'
        self.labels_C_str = 'Dunno'

        self.labelA = False
        self.labelB = False
        self.labelC = False
        #######################
        # Mandatory parameter #
        #######################
        self.params = [
            {'name': self.labels_grp, 'type': 'group', 'children': [
                {'name': self.labels_A_str, 'type': 'bool', 'value': self.labelA, 'tip': "Single"},
                {'name': self.labels_B_str, 'type': 'bool', 'value': self.labelB, 'tip': "Multi"},
                {'name': self.labels_C_str, 'type': 'bool', 'value': self.labelC, 'tip': "Dunno"},
            ]},
        ]

        self.pLabels = Parameter.create(name='paramsLabel', type='group', \
                                   children=self.params, expanded=True)
        self.pLabels.sigTreeStateChanged.connect(self.change)
        self.wLabels.setParameters(self.pLabels, showTop=False)

    # If anything changes in the parameter tree, print a message
    def change(self, panel, changes):
        for param, change, data in changes:
            path = panel.childPath(param)
            if self.parent.args.v >= 1:
                print('  path: %s' % path)
                print('  change:    %s' % change)
                print('  data:      %s' % str(data))
                print('  ----------')
            self.paramUpdate(path, data)

    ##############################
    # Mandatory parameter update #
    ##############################
    def paramUpdate(self, path, data):
        global dset
        if path[1] == self.labels_A_str:
            self.labelA = data
            if data:
                dset[self.parent.eventNumber] = 1
            else:
                dset[self.parent.eventNumber] = 0
        elif path[1] == self.labels_B_str:
            self.labelB = data
            if data:
                dset[self.parent.eventNumber] = 2
            else:
                dset[self.parent.eventNumber] = 0
        elif path[1] == self.labels_C_str:
            self.labelC = data
            if data:
                dset[self.parent.eventNumber] = 3
            else:
                dset[self.parent.eventNumber] = 0

    def refresh(self):
        fname = self.parent.psocakeRunDir + '/' + self.parent.experimentName + '_' + str(self.parent.runNumber).zfill(4) + '_labels.h5'
        global dset
        print "##### fname: ", fname
        if self.parent.runNumber > 0:
            if os.path.exists(fname):
               labels = h5py.File(fname, 'r+', dtype = 'i8')
            else:
               labels = h5py.File(fname, 'w', dtype = 'i8')
            try:
                dset = labels["labels"]
            except: # corrupt dataset, so create a new one
                print labels
                dset = labels.create_dataset("labels", (self.parent.exp.eventTotal, 1))
            #print dset.shape
            self.labelA = False
            self.labelB = False
            self.labelC = False
            if dset[self.parent.eventNumber] == 1:
                self.labelA = True
            elif dset[self.parent.eventNumber] == 2:
                self.labelB = True
            elif dset[self.parent.eventNumber] == 3:
                self.labelC = True
            self.pLabels.param(self.labels_grp, self.labels_A_str).setValue(self.labelA)
            self.pLabels.param(self.labels_grp, self.labels_B_str).setValue(self.labelB)
            self.pLabels.param(self.labels_grp, self.labels_C_str).setValue(self.labelC)
开发者ID:laurentroque,项目名称:psocake,代码行数:100,代码来源:LabelPanel.py

示例5: GuiManager

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]

#.........这里部分代码省略.........
                textDots = "....."
                nDots = 1    
            item.setForeground(QtGui.QColor("red"))
            item.setText(textNotConnected+textDots)
            self.timerDotChangeCamera = Timer(0.25, dotChange, [self.itemCameraStatus, nDots])
            self.timerDotChangeCamera.start()                      
        if (isConnected == False): #System not connected     
            print 'cam oups'
            nDots = 1
            if hasattr(self,'timerDotChangeCamera'):
                self.timerDotChangeCamera.cancel()            
            self.timerDotChangeCamera = Timer(0.25, dotChange, [self.itemCameraStatus, nDots])
            self.timerDotChangeCamera.start()              
        else:    
            print "Camera connected"
            if hasattr(self,'timerDotChangeCamera'):
                self.timerDotChangeCamera.cancel()
                time.sleep(0.1)
            self.itemCameraStatus.setForeground(QtGui.QColor("green"))                
            self.itemCameraStatus.setText("Camera connected.")
            print "Camera connected2"
            
    #Set the status text (system connected or not)
    def setInfo(self, text):
        self.tbInfo.append(text)
            
    #Set the status text (system connected or not)
    def setWire(self, mem1, mem2, mem3, mem4, maxValPos):
        self.itemMemory.setText("Acquisition board memory usage:\nDDR2: " + str(mem1) + " bytes.\nFIFO in: " + str(mem2) + " bytes.\nFIFO out: " + str(mem3) + " bytes.\nFIFO out (minimum): " + str(mem4) + " bytes.")
        self.itemMaxValPos.setText("Maximum RF value position: " + str(maxValPos))
                
    def createLayout(self):
        print 'Creating layout...'
        self.setWindowTitle('Interferometry Acquisition GUI')  
        #self.widget = QtGui.QWidget()
        #self.setCentralWidget(self.widget)
        self.layout = pg.LayoutWidget()
        #self.widget.setLayout(self.layout)
        self.setCentralWidget(self.layout)
        
        #Create GUI
        sizePolicyBt = QtGui.QSizePolicy(1, 1)
        sizePolicyBt.setHorizontalStretch(0)
        sizePolicyBt.setVerticalStretch(0)
        
        self.btOpen = QtGui.QPushButton("Open\nprevious results")
        sizePolicyBt.setHeightForWidth(self.btOpen.sizePolicy().hasHeightForWidth())
        self.btOpen.setSizePolicy(sizePolicyBt);
        self.btOpen.setStyleSheet("background-color: yellow; font-size: 16px; font: bold")
        
        self.btStart = QtGui.QPushButton("Start\nacquisition")
        sizePolicyBt.setHeightForWidth(self.btStart.sizePolicy().hasHeightForWidth())
        self.btStart.setSizePolicy(sizePolicyBt);
        self.btStart.setStyleSheet("background-color: green; font-size: 16px; font: bold")
        self.btStart.clicked.connect(self.startAcquisition)
        
        self.btStop = QtGui.QPushButton("Stop\nacquisition")
        sizePolicyBt.setHeightForWidth(self.btStop.sizePolicy().hasHeightForWidth())
        self.btStop.setSizePolicy(sizePolicyBt);
        self.btStop.setStyleSheet("background-color: red; font-size: 16px; font: bold")
        self.btStop.clicked.connect(self.stopAcquisition)
        self.btStop.setEnabled(False)
        
        self.paramTree = ParameterTree()
        self.paramTree.setParameters(Parameters.paramObject, showTop=False)
        self.paramTree.setWindowTitle('pyqtgraph example: Parameter Tree')
开发者ID:XavierDR,项目名称:OCT,代码行数:70,代码来源:GuiManager.py

示例6: ParameterWidget

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class ParameterWidget(QtGui.QWidget):
    """Settings Widget takes a list of dictionaries and provides a widget to edit the values (and key names)

		Each dict object must include these keys:
			key: The string used to get/set the value, shown to left of value if 'name' not given
			value: The value to show next to name, matches 'type' if given else use type of this value
				accepts QColor, lambda, list, generic types

		Optional keys are:
			name: the name which is shown to the left of the value for user readability
			type: Specify the type if it is not obvious by the value provided, as a string
			suffix: (for float/int values only) added for user readability
			children: a list of dicts under a 'group' parameter
			removable: bool specifying if this can be removed (set to False)
			renamable: bool specifying if this can be renamed (set to False)
			appendable: bool specifying if user can add to this group

		To pass in a parent parameter with children, pass 'group' to the 'value' key and the list of dicts to a new 'children' parameter

	"""

    done = QtCore.Signal(dict)
    valueChanged = QtCore.Signal(str, object)

    def __init__(self, title, paramlist, about="", doneButton=False, appendable=False):
        super(ParameterWidget, self).__init__()
        self.ParamGroup = ScalableGroup if appendable else pTypes.GroupParameter

        self.hasDone = doneButton

        self.parameters = self.ParamGroup(name="Parameters", children=ParameterWidget.build_parameter_list(paramlist))
        self.parameters.sigTreeStateChanged.connect(self.paramsChanged)
        self.info = about
        self.tree = ParameterTree()
        self.tree.setParameters(self.parameters, showTop=False)
        self.tree.setWindowTitle(title)
        self.makeLayout()
        self.resize(800, 600)

    @staticmethod
    def type_as_str(var):
        if type(var) == tuple and len(var) != 3:
            var = list(var)
        elif isinstance(var, np.string_):
            return "str"
        elif isinstance(var, np.generic):
            var = float(var)
        elif isinstance(var, QtGui.QColor) or (type(var) == tuple and len(var) == 3):
            return "color"
        elif isinstance(var, dict) or (isinstance(var, list) and all([type(i) == dict for i in var])):
            return "group"
        elif isinstance(var, (int, float, bool, list, str)):
            return type(var).__name__
        elif isinstance(var, FunctionType):
            return "action"
        return "text"

    def paramsChanged(self, params, change):
        obj, change, val = change[0]
        if change == "value":
            self.valueChanged.emit(obj.opts["key"], val)
        else:
            pass

    def makeLayout(self):
        layout = QtGui.QGridLayout()
        self.setLayout(layout)

        if len(self.info) > 0:
            self.scrollArea = QtGui.QScrollArea(self)
            self.scrollArea.setWidgetResizable(True)
            self.scrollArea.setWidget(QtGui.QLabel(self.info))
            layout.addWidget(self.scrollArea, 0, 0, 1, 2)

        layout.addWidget(self.tree, 1, 0, 1, 2)

        if self.hasDone:
            cancelButton = QtGui.QPushButton("Cancel")
            cancelButton.clicked.connect(self.close)
            okButton = QtGui.QPushButton("Ok")
            okButton.clicked.connect(lambda: self.close(emit=True))
            layout.addWidget(cancelButton, 2, 0)
            layout.addWidget(okButton, 2, 1)

        layout.setRowStretch(1, 4)

    @staticmethod
    def get_group_dict(groupParam):
        d = {}
        for c in groupParam.childs:
            if isinstance(c, pTypes.GroupParameter):
                d[c.opts["name"]] = ParameterWidget.get_group_dict(c)
            else:
                d[c.opts["key"]] = c.opts["value"]
        return d

    @staticmethod
    def build_parameter_list(params):
        return_params = []
        for param_dict in params:
#.........这里部分代码省略.........
开发者ID:BrettJSettle,项目名称:BioDocks,代码行数:103,代码来源:SettingsWidgets.py

示例7: Ui_MainWindow

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class Ui_MainWindow(object):
    def setupUi(self, MainWindow, params):
        #app = QtGui.QApplication([])
        #self.win = QtGui.QMainWindow()
        self.area = DockArea()
        MainWindow.setCentralWidget(self.area)
        MainWindow.resize(1200,600)
        MainWindow.setWindowTitle('SASE optimization')

        ## Create docks, place them into the window one at a time.
        ## Note that size arguments are only a suggestion; docks will still have to
        ## fill the entire dock area and obey the limits of their internal widgets.
        #self.orb_fig = Dock("Orbit", size=(400, 300))     ## give this dock the minimum possible size
        #self.orb_fig.float()
        #self.sase_fig = Dock("SASE", size=(400,300), closable=True)
        self.sase_fig = Dock("SASE", size=(400,300))
        self.blm_fig = Dock("BLM", size=(400,200))
        self.seq_cntr = Dock("Sequence", size=(150,200))
        self.sase_cntr = Dock("Controls", size=(150,200))
        #self.orb_cntr = Dock("orb contr.", size=(400,100))
        self.cur_fig = Dock("Settings", size=(400,300))
        self.logger = Dock("Logger", size=(100,300))

        self.area.addDock(self.cur_fig, 'left')

        #self.area.addDock(self.orb_fig, 'above', self.cur_fig)      ## place d1 at left edge of dock area (it will fill the whole space since there are no other docks yet)
        self.area.addDock(self.sase_fig, 'bottom', self.cur_fig)     ## place d2 at right edge of dock area

        self.area.addDock(self.blm_fig, 'top', self.sase_fig)## place d3 at bottom edge of d1
        self.area.addDock(self.sase_cntr, 'right')  ## place d5 at left edge of d1
        self.area.addDock(self.seq_cntr, 'left', self.sase_cntr)     ## place d4 at right edge of dock area
        #self.area.addDock(self.orb_cntr, 'bottom', self.orb_fig)

        ## Test ability to move docks programatically after they have been placed
        #self.area.moveDock(self.sase_fig, 'bottom', self.orb_fig)     ## move d4 to top edge of d2
        #self.area.moveDock(self.blm_fig, 'bottom', self.sase_fig)   ## move d6 to stack on top of d4
        self.area.addDock(self.logger, 'bottom', self.sase_fig)
        self.area.moveDock(self.blm_fig, 'above', self.logger)

        ## Add widgets into each dock

        #add Logger
        self.log_lab = QtGui.QTextBrowser()
        #self.log_lab.verticalScrollBar().setValue(self.log_lab.verticalScrollBar().maximum())
        self.logger.addWidget(self.log_lab)

        ## first dock gets save/restore buttons
        self.t = ParameterTree()
        if params != None:
            self.p = Parameter.create(name='params', type='group', children=params)
            self.t.setParameters(self.p, showTop=False)

        self.t.setWindowTitle('SASE optimization')
        self.seq_cntr.addWidget(self.t)


        self.seq = pg.LayoutWidget()
        self.label = QtGui.QLabel("""sequence control""")
        self.add_seq_btn = QtGui.QPushButton('Add Action')
        self.save_seq_btn = QtGui.QPushButton('Save seqs')
        self.load_seq_btn = QtGui.QPushButton('Load seqs')
        #self.restoreBtn.setEnabled(False)
        self.seq.addWidget(self.label, row=0, col=0)
        self.seq.addWidget(self.add_seq_btn, row=1, col=0)
        self.seq.addWidget(self.save_seq_btn, row=2, col=0)
        self.seq.addWidget(self.load_seq_btn, row=3, col=0)
        self.seq_cntr.addWidget(self.seq)


        #Currents graphics
        self.t_cur_cntr = ParameterTree()
        #param = [{'name': 'Devices', 'type': 'list', 'values': {}, 'value': 0}]
        param = []
        self.p_cur_cntr = Parameter.create(name='control', type='group', children=param)
        self.t_cur_cntr.setParameters(self.p_cur_cntr, showTop=False)

        self.current = pg.PlotWidget(title="Settings")

        self.cur_fig.addWidget(self.current, row=0, col=0)
        self.cur_fig.addWidget(self.t_cur_cntr, row=0, col=1)



        #BLM graphics
        ## Hide title bar on dock 3
        #d3.hideTitleBar()
        self.blm = pg.PlotWidget(title="BLM")
        self.blm_fig.addWidget(self.blm)


        #SASE graphics

        self.sase = pg.PlotWidget(title="SASE")
        self.sase_fig.addWidget(self.sase)

        #controls
        self.w5 = pg.LayoutWidget()
        self.start_opt_btm = QtGui.QPushButton('start')

        params = [
#.........这里部分代码省略.........
开发者ID:iagapov,项目名称:ocelot,代码行数:103,代码来源:ui_optim_sase.py

示例8: selected

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
def selected(text):
    global sz, t
    sz=SzenenTreeInputs(False,text)
    t.setParameters(sz.p, showTop=False)


win = QtGui.QWidget()
comboBox = QtGui.QComboBox(win)
for cmdLst in cmdLsts:
    comboBox.addItem(cmdLst)
comboBox.activated[str].connect(selected)
t = ParameterTree()
sz=SzenenTreeInputs(False,cmdLsts[0])
#print sz
t.setParameters(sz.p, showTop=False)
t.setWindowTitle('Szenen Setup:')
#t2 = ParameterTree()
#t2.setParameters(p, showTop=False)


    
layout = QtGui.QGridLayout()
win.setLayout(layout)
layout.addWidget(QtGui.QLabel(""), 1,  1, 1, 2)

layout.addWidget(comboBox, 0, 0, 1, 1)
layout.addWidget(t, 20, 0, 1, 1)
#layout.addWidget(t2, 1, 1, 1, 1)
win.show()
win.resize(800,800)
开发者ID:chrihuc,项目名称:steuerzentrale,代码行数:32,代码来源:gui_inp.py

示例9: CrystalIndexing

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class CrystalIndexing(object):
    def __init__(self, parent = None):
        self.parent = parent

        ## Dock 14: Indexing
        self.d14 = Dock("Indexing", size=(1, 1))
        self.w21 = ParameterTree()
        self.w21.setWindowTitle('Indexing')
        self.d14.addWidget(self.w21)
        self.w22 = pg.LayoutWidget()
        self.launchIndexBtn = QtGui.QPushButton('Launch indexing')
        self.w22.addWidget(self.launchIndexBtn, row=0, col=0)
        self.synchBtn = QtGui.QPushButton('Deploy CrystFEL geometry')
        self.w22.addWidget(self.synchBtn, row=1, col=0)
        self.d14.addWidget(self.w22)


        self.index_grp = 'Crystal indexing'
        self.index_on_str = 'Indexing on'
        self.index_geom_str = 'CrystFEL geometry'
        self.index_peakMethod_str = 'Peak method'
        self.index_intRadius_str = 'Integration radii'
        self.index_pdb_str = 'PDB'
        self.index_method_str = 'Indexing method'
        #self.index_minPeaks_str = 'Minimum number of peaks'
        #self.index_maxPeaks_str = 'Maximum number of peaks'
        #self.index_minRes_str = 'Minimum resolution (pixels)'
        self.index_tolerance_str = 'Tolerance'
        self.index_extra_str = 'Extra CrystFEL parameters'

        self.launch_grp = 'Batch'
        self.outDir_str = 'Output directory'
        self.runs_str = 'Runs(s)'
        self.sample_str = 'Sample name'
        self.tag_str = 'Tag'
        self.queue_str = 'Queue'
        self.chunkSize_str = 'Chunk size'
        self.keepData_str = 'Keep CXI images'
        self.noe_str = 'Number of events to process'
        (self.psanaq_str,self.psnehq_str,self.psfehq_str,self.psnehprioq_str,self.psfehprioq_str,self.psnehhiprioq_str,self.psfehhiprioq_str,self.psdebugq_str) = \
            ('psanaq','psnehq','psfehq','psnehprioq','psfehprioq','psnehhiprioq','psfehhiprioq','psdebugq')

        self.outDir = self.parent.psocakeDir
        self.outDir_overridden = False
        self.runs = ''
        self.sample = 'crystal'
        self.tag = ''
        self.queue = self.psanaq_str
        self.chunkSize = 500
        self.noe = -1

        # Indexing
        self.showIndexedPeaks = False
        self.indexedPeaks = None
        self.hiddenCXI = '.temp.cxi'
        self.hiddenCrystfelStream = '.temp.stream'
        self.hiddenCrystfelList = '.temp.lst'

        self.indexingOn = False
        self.numIndexedPeaksFound = 0
        self.geom = '.temp.geom'
        self.peakMethod = 'cxi'
        self.intRadius = '2,3,4'
        self.pdb = ''
        self.indexingMethod = 'mosflm-noretry,dirax'
        #self.minPeaks = 15
        #self.maxPeaks = 2048
        #self.minRes = 0
        self.tolerance = '5,5,5,1.5'
        self.extra = ''
        self.keepData = True

        #######################
        # Mandatory parameter #
        #######################
        self.params = [
            {'name': self.index_grp, 'type': 'group', 'children': [
                {'name': self.index_on_str, 'type': 'bool', 'value': self.indexingOn, 'tip': "Turn on indexing"},
                {'name': self.index_geom_str, 'type': 'str', 'value': self.geom, 'tip': "CrystFEL geometry file"},
                #{'name': self.index_peakMethod_str, 'type': 'str', 'value': self.peakMethod, 'tip': "Turn on indexing"},
                {'name': self.index_intRadius_str, 'type': 'str', 'value': self.intRadius, 'tip': "Integration radii"},
                {'name': self.index_pdb_str, 'type': 'str', 'value': self.pdb, 'tip': "(Optional) CrystFEL unitcell file"},
                {'name': self.index_method_str, 'type': 'str', 'value': self.indexingMethod, 'tip': "comma separated indexing methods"},
                {'name': self.index_tolerance_str, 'type': 'str', 'value': self.tolerance,
                 'tip': "Indexing tolerance, default: 5,5,5,1.5"},
                {'name': self.index_extra_str, 'type': 'str', 'value': self.extra,
                 'tip': "Other indexing parameters"},
                #{'name': self.index_minPeaks_str, 'type': 'int', 'value': self.minPeaks,
                # 'tip': "Index only if there are more Bragg peaks found"},
                #{'name': self.index_maxPeaks_str, 'type': 'int', 'value': self.maxPeaks,
                # 'tip': "Index only if there are less Bragg peaks found"},
                #{'name': self.index_minRes_str, 'type': 'int', 'value': self.minRes,
                # 'tip': "Index only if Bragg peak resolution is at least this"},
            ]},
            {'name': self.launch_grp, 'type': 'group', 'children': [
                {'name': self.outDir_str, 'type': 'str', 'value': self.outDir},
                {'name': self.runs_str, 'type': 'str', 'value': self.runs, 'tip': "comma separated or use colon for a range, e.g. 1,3,5:7 = runs 1,3,5,6,7"},
                {'name': self.sample_str, 'type': 'str', 'value': self.sample, 'tip': "name of the sample saved in the cxidb file, e.g. lysozyme"},
                {'name': self.tag_str, 'type': 'str', 'value': self.tag, 'tip': "attach tag to stream, e.g. cxitut13_0010_tag.stream"},
                {'name': self.queue_str, 'type': 'list', 'values': {self.psfehhiprioq_str: self.psfehhiprioq_str,
#.........这里部分代码省略.........
开发者ID:laurentroque,项目名称:psocake,代码行数:103,代码来源:crystalIndexingPanel.py

示例10: setupGUI

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]

#.........这里部分代码省略.........
    self.splitter.setSizes([int(self.height()*0.5), int(self.height()*0.5)]);
    self.layout.addWidget(self.splitter)

    self.splitter2 = QtGui.QSplitter()
    self.splitter2.setOrientation(QtCore.Qt.Horizontal)
    #self.splitter2.setSizes([int(self.width()*0.5), int(self.width()*0.5)]);
    self.splitter.addWidget(self.splitter2);
    
    self.splitter3 = QtGui.QSplitter()
    self.splitter3.setOrientation(QtCore.Qt.Horizontal)
    #self.splitter2.setSizes([int(self.width()*0.5), int(self.width()*0.5)]);
    self.splitter.addWidget(self.splitter3);
    
    
    # various matrix like plots: state, goal, weights, p
    self.nStates = 20; #number of states in the past to remember
    self.matrixdata = [np.zeros((self.network.nInputs, self.nStates)),
                       np.zeros((self.network.nOutputs, self.nStates)), 
                       np.zeros((self.network.nOutputs, self.nStates)),
                       np.zeros((self.network.nNodes,   self.nStates)),
                       np.zeros(self.network.weights.shape)];
                       #np.zeros(self.network.a.shape)
                       #np.zeros(self.network.b.shape)];
                       
    self.images = [];
    for j in range(len(self.matrixdata)):
      l = pg.GraphicsLayoutWidget()
      self.splitter2.addWidget(l);
      v = pg.ViewBox();
      l.addItem(v, 0, 1);
      i = pg.ImageItem(self.matrixdata[j]);
      v.addItem(i);
      self.images.append(i);
    
    for i in [0,1,2,3]:
      self.images[i].setLevels([0,1]);
    
    #output and error
    self.plotlayout = pg.GraphicsLayoutWidget();
    self.splitter3.addWidget(self.plotlayout);
    
    self.plot = [];
    for i in range(2):
      self.plot.append(self.plotlayout.addPlot());
      self.plot[i].setYRange(0, 1, padding=0);
      
      
    self.plotlength = 10000;
    self.output = np.zeros((self.network.nOutputs, self.plotlength));
    #self.goal   = np.zeros((self.network.nOutputs, self.plotlength));
    self.errorlength = 10000;
    self.error  = np.zeros(self.errorlength);     
      
    self.curves = []
    for i in range(self.network.nOutputs):
      c = self.plot[0].plot(self.output[i,:], pen = (i, self.network.nOutputs));
      #c.setPos(0,0*i*6);
      self.curves.append(c);      
    
    c = self.plot[1].plot(self.error, pen = (2,3));
    self.curves.append(c);
    
    
    # parameter controls
    self.steps = 0;
    
    params = [
        {'name': 'Controls', 'type': 'group', 'children': [
            {'name': 'Simulate', 'type': 'bool', 'value': True, 'tip': "Run the network simulation"},
            {'name': 'Plot', 'type': 'bool', 'value': True, 'tip': "Check to plot network evolution"},
            {'name': 'Plot Interval', 'type': 'int', 'value': 10, 'tip': "Step between plot updates"},
            {'name': 'Timer', 'type': 'int', 'value': 10, 'tip': "Pause between plot is updated"},
        ]}
        ,
        {'name': 'Network Parameter', 'type': 'group', 'children': [
            {'name': 'Eta', 'type': 'float', 'value': self.network.eta, 'tip': "Learning rate"},
            {'name': 'Gamma', 'type': 'float', 'value': self.network.gamma, 'tip': "Learning rate"}#,
        ]}
        ,
        {'name': 'Status', 'type': 'group', 'children': [
            {'name': 'Steps', 'type': 'int', 'value': self.steps, 'tip': "Actual iteration step", 'readonly': True}
        ]}
      ];

    self.parameter = Parameter.create(name = 'Parameter', type = 'group', children = params);
    
    print self.parameter
    print self.parameter.children()
    
    self.parameter.sigTreeStateChanged.connect(self.updateParameter);   
    
    ## Create two ParameterTree widgets, both accessing the same data
    t = ParameterTree();
    t.setParameters(self.parameter, showTop=False)
    t.setWindowTitle('Parameter');
    self.splitter3.addWidget(t);
    
    # draw network
    self.nsteps = 100;    
    self.updateView();
开发者ID:theideasmith,项目名称:rockefeller,代码行数:104,代码来源:NetworkViewer2.py

示例11: ProjectSettingsDialog

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class ProjectSettingsDialog(QtGui.QDialog):
    path2key=dict()
    def __init__(self, parent = None, savedstate=None):
        super(ProjectSettingsDialog, self).__init__(parent)
        self.setWindowTitle("Application Settings")
        layout = QtGui.QVBoxLayout(self)

        self.initKeyParamMapping()
        self._settings = Parameter.create(name='params', type='group', children=settings_params)

        if savedstate:
            self._settings.restoreState(savedstate)

        # Holds settings keys that have changed by the user when the
        # dialog is closed. Used to update any needed gui values..
        self._updated_settings={}

        self._settings.sigTreeStateChanged.connect(self.handleSettingChange)

        self.initSettingsValues()

        self.ptree = ParameterTree()
        self.ptree.setParameters(self._settings, showTop=False)
        self.ptree.setWindowTitle('MarkWrite Application Settings')
        layout.addWidget(self.ptree)
        self.ptree.adjustSize()
        # OK and Cancel buttons
        self.buttons = QtGui.QDialogButtonBox(
            QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)
        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.resize(500,700)

    def initKeyParamMapping(self):
        if len(self.path2key)==0:
            def replaceGroupKeys(paramlist, parent_path=[]):
                for i,p in enumerate(paramlist):
                    if isinstance(p,basestring):
                        pdict=flattenned_settings_dict[p]
                        paramlist[i]=pdict
                        self.path2key['.'.join(parent_path+[pdict['name'],])]=p
                    elif isinstance(p,dict):
                        replaceGroupKeys(p.get('children'),parent_path+[p.get('name'),])
            replaceGroupKeys(settings_params)

    def initSettingsValues(self, pgroup=None):
        global SETTINGS
        if pgroup is None:
            pgroup = self._settings
        for child in pgroup.children():
            if child.hasChildren():
                self.initSettingsValues(child)
            else:
                path = self._settings.childPath(child)
                if path is not None:
                    childName = '.'.join(path)
                else:
                    childName = child.name()
                if self.path2key.has_key(childName):
                    SETTINGS[self.path2key[childName]]=child.value()

    ## If anything changes in the tree, print a message
    def handleSettingChange(self, param, changes):
        global SETTINGS
        for param, change, data in changes:
            path = self._settings.childPath(param)
            if path is not None:
                childName = '.'.join(path)
            else:
                childName = param.name()
            if change == 'value':
                setting_key = self.path2key[childName]
                SETTINGS[setting_key]=data
                self._updated_settings[setting_key] = data
                #print 'settings_state:',self.settings_state

    # static method to create the dialog and return (date, time, accepted)
    @staticmethod
    def getProjectSettings(parent = None, usersettings = None):
        dialog = ProjectSettingsDialog(parent, usersettings)
        result = dialog.exec_()
        usersettings=dialog._settings.saveState()
        return dialog._updated_settings,SETTINGS, usersettings, result == QtGui.QDialog.Accepted
开发者ID:Mark-Torrance,项目名称:OpenHandWrite,代码行数:89,代码来源:projectsettings.py

示例12: _init_extra

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
    def _init_extra(self,**kw):
        
        self.neuron=kw.get('base_neuron')
        self.neuron_params=kw.get('neuron_params')
        for d in self.neuron_params[0]['children']:
            if 'children' in d.keys():
                for dd in d['children']:
                    self.__dict__[dd['name']] = dd['value']
            else:
                pp(d)
                if 'value' in d.keys():
                    self.__dict__[d['name']] = d['value']
        
        
        self.dyn_xticks=[[100*i,i*0.1] for i in range(0,22,4)]
        
        self.script_name=kw.get('script_name', __file__.split('/')[-1][0:-3])
          
        self.p.param('store_state', 'save').sigActivated.connect(self.save)
        self.p.param('stimulate', 'start').sigActivated.connect(self.stimulate)
   
        
        # Comet for recovery current vs time plot
        w=pg.PlotWidget()
        w.plotItem.getAxis('bottom').setScale(0.001)
        w.plotItem.getAxis('left').setLabel('Current', units='A')
        w.plotItem.getAxis('left').setScale(0.000000000001)
        
        w.setWindowTitle('Recovery current')
        w.setRange(QtCore.QRectF(0, -200, self.n_history, 400)) 
        w.setLabel('bottom', 'Time', units='s')
        w.plotItem.layout.setContentsMargins(20, 20, 20, 20)
        
        color=self.kw.get('curve_uv_color',(0,0,0))
        pen=pg.mkPen(color, width=self.kw.get('curve_uv_width',5))
        self.curve_ut = w.plot(pen=pen)
        self.widgets.append(w) 
        
        
        # Comet for voltage recovery current plot
        w=pg.PlotWidget()
        w.plotItem.getAxis('bottom').setScale(0.001)
        w.plotItem.getAxis('left').setLabel('Recovery current u', units='A')
        w.plotItem.getAxis('left').setScale(0.000000000001)
        w.setWindowTitle('Recovery current/voltage')
        w.setRange(QtCore.QRectF(-100, -50, 100, 200)) 
        w.setLabel('bottom', 'Voltage', units='V')
        w.plotItem.layout.setContentsMargins(10, 10, 10, 10)
        self.widgets.append(w) 

        color=self.kw.get('curve_uv_color',(0,0,0))
        pen=pg.mkPen(color, width=self.kw.get('curve_uv_width',5) )
        self.curve_uv = w.plot(pen=pen)
#         x,y=self.get_nullcline_extreme_points()
#         self.curve_uv_extreme_point = w.plot(x,y, pen=pen)
        color=self.kw.get('curve_uv_color',(0,0,0))
        self.curve_uv_nullcline0 = w.plot(pen=pen)
        self.curve_uv_nullcline1 = w.plot(pen=pen)
        
        color=self.kw.get('curve_uv_color',(255,0,0))
        brush=pg.mkBrush(color=color)
        self.curve_uv_comet= w.plot(symbolBrush= brush, symbol='o', symbolSize=15.)
       
          
        # Parameters base_neuron
        self.p2 = Parameter.create(name='params', type='group', children=self.neuron_params)
        self.p2.sigTreeStateChanged.connect(self.change)
        self.p2.param('IV, IF, nullcline, etc', 'run base_neuron').sigActivated.connect(self.run_neuron_thread)
        self.p2.param('IV, IF, nullcline, etc', 'run GP-ST network').sigActivated.connect(self.run_GP_STN_network_thread)
        pt = ParameterTree()
        pt.setParameters(self.p2, showTop=False)
        pt.setWindowTitle('Parameters')
        
        self.widgets.append(pt)

        # Threshold type
        w=pg.PlotWidget()
#         w.plotItem.getAxis('bottom').setScale(0.001)
        w.plotItem.getAxis('left').setLabel('a/g_L')
#         w.plotItem.getAxis('left').setScale(0.000000000001)
        w.setWindowTitle('Recovery current/voltage')
        w.setRange(QtCore.QRectF(0, 0, 4, 1)) 
        w.setLabel('bottom', 'tau_m/tau_w')
        w.plotItem.layout.setContentsMargins(10, 10, 10, 10)
        self.widgets.append(w)         
                
        color=self.kw.get('curve_uv_color',(0,0,0))
        pen=pg.mkPen(color, width=self.kw.get('curve_uv_width',5) )
        c1,c2=self.get_threshold_oscillation_curves()
        x, y=self.get_threshold_oscilltion_point()
        color=self.kw.get('curve_uv_color',(255,0,0))
        brush=pg.mkBrush(color=color)
        self.curve_oscillation1 = w.plot(c1[0],c1[1],pen=pen)
        self.curve_oscillation2 = w.plot(c2[0],c2[1],pen=pen)
        self.curve_oscillation_points1 = w.plot([x[0]], [y[0]], 
                                               symbolBrush= brush, 
                                               symbol='o', 
                                               symbolSize=25.)
        color=self.kw.get('curve_uv_color',(0,0,255))
        brush=pg.mkBrush(color=color)
#.........这里部分代码省略.........
开发者ID:mickelindahl,项目名称:bgmodel,代码行数:103,代码来源:interact.py

示例13: __init__

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
    def __init__(self, **kw):
        self.app=kw.pop('app')
        self.data_label=''
        self.date_time=dt.datetime.now().strftime('%Y_%m_%d-%H_%M')
        self.h=kw.pop('h', .1) #integration step size
        self.n_state_variables=kw.pop('n_state_variables', 2)
        self.n_history=kw.pop('n_history', 2000)
        self.kw=kw
        self.params=kw.get('params') #qt paramters, se tree parameter class
        self.update_time=kw.pop('update_time', 0)
        self.widgets=[]
        self.script_name=kw.pop('script_name',__file__.split('/')[-1][0:-3])
        self.start_stim=-10000.0
        self.scale_plot=10
        
        for key, value in kw.items():
            self.__dict__[key] = value
            
        for d in self.params[0]['children']:
            self.__dict__[d['name']] = d['value']

        for d in self.params[1]['children']:
            if 'value' in d.keys():
                self.__dict__[d['name']] = d['value']
        
        self.x=self.n_history
        self.y=numpy.zeros(self.n_state_variables)
        self.y[0]=-70
        self.dy=numpy.zeros(self.n_state_variables)
        
        self.x_history=numpy.arange(0,self.n_history, self.scale_plot*self.h)
        self.y_history=numpy.random.rand( self.n_state_variables, self.n_history/(self.scale_plot*self.h))
        self.y_history[0,:]=-70   
        
        # Parameters
        self.p = Parameter.create(name='params', type='group', children=self.params)
        self.p.sigTreeStateChanged.connect(self.change)
        pt = ParameterTree()
        pt.setParameters(self.p, showTop=False)
        pt.setWindowTitle('Parameters')
        
        self.widgets.append(pt)
        
        # Voltage time plot
        w=pg.PlotWidget()
        w.setWindowTitle('Voltage/time')
        
        w.setRange(QtCore.QRectF(0, -90, self.n_history, 100)) 
        w.setLabel('bottom', 'Time', units='s')
        w.plotItem.layout.setContentsMargins(20, 20, 20, 20)
        
        ax=w.plotItem.getAxis('left')
        l=[[ (0.0,'0'), (-30, -30), (-60, -60), (-90, -90) ], ]
        ax.setTicks(l)
        
        w.plotItem.getAxis('bottom').setScale(0.001)
        ax.setLabel('Voltage', units='V')
        ax.setScale(0.001)
#         ax.setWidth(w=2)
        
#         ax.setRange(500,1500)
        color=self.kw.get('curve_uv_color',(0,0,0))
        pen=pg.mkPen(color, width=self.kw.get('curve_uv_width',5))
        self.curve_vt = w.plot(pen=pen)
        self.curve_vt.setData(self.x_history, self.y_history[0,:])
        self.widgets.append(w)
    
    
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update)
        self.timer.start(self.update_time)    
#         self.timer.start(1000.)  
    
        self._init_extra(**kw)        
开发者ID:mickelindahl,项目名称:bgmodel,代码行数:76,代码来源:interact.py

示例14: DiffractionGeometry

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class DiffractionGeometry(object):
    def __init__(self, parent = None):
        self.parent = parent


        #############################
        ## Dock 3: Diffraction geometry
        #############################
        self.d3 = Dock("Diffraction Geometry", size=(1, 1))
        self.w3 = ParameterTree()
        self.w3.setWindowTitle('Diffraction geometry')
        self.d3.addWidget(self.w3)
        self.w3a = pg.LayoutWidget()
        self.deployGeomBtn = QtGui.QPushButton('Deploy manually centred geometry')
        self.w3a.addWidget(self.deployGeomBtn, row=0, col=0)
        self.deployAutoGeomBtn = QtGui.QPushButton('Deploy automatically centred geometry')
        self.w3a.addWidget(self.deployAutoGeomBtn, row=1, col=0)
        self.d3.addWidget(self.w3a)

        self.resolutionRingList = np.array([100.,300.,500.,700.,900.,1100.])
        self.resolutionText = []
        self.hasUserDefinedResolution = False

        self.geom_grp = 'Diffraction geometry'
        self.geom_detectorDistance_str = 'Detector distance'
        self.geom_clen_str = 'Home to Detector (clen)'
        self.geom_coffset_str = 'Sample to Home (coffset)'
        self.geom_photonEnergy_str = 'Photon energy'
        self.geom_wavelength_str = "Wavelength"
        self.geom_pixelSize_str = 'Pixel size'
        self.geom_resolutionRings_str = 'Resolution rings'
        self.geom_resolution_str = 'Resolution (pixels)'
        self.geom_resolutionUnits_str = 'Units'
        self.geom_unitA_crystal_str = 'Crystallography (Angstrom)'
        self.geom_unitNm_crystal_str = 'Crystallography (Nanometre)'
        self.geom_unitQ_crystal_str = 'Crystallography Reciprocal Space (q)'
        self.geom_unitA_physics_str = 'Physics (Angstrom)'
        self.geom_unitNm_physics_str = 'Physics (Nanometre)'
        self.geom_unitQ_physics_str = 'Physics Reciprocal Space (q)'
        self.geom_unitTwoTheta_str = 'Scattering Angle 2Theta'
        (self.unitA_c,self.unitNm_c,self.unitQ_c,self.unitA_p,self.unitNm_p,self.unitQ_p,self.unitTwoTheta) = (0,1,2,3,4,5,6)

        #######################
        # Mandatory parameter #
        #######################
        self.params = [
            {'name': self.geom_grp, 'type': 'group', 'children': [
                {'name': self.geom_detectorDistance_str, 'type': 'float', 'value': 0.0, 'precision': 6, 'minVal': 0.0001, 'siFormat': (6,6), 'siPrefix': True, 'suffix': 'mm'},
                {'name': self.geom_clen_str, 'type': 'float', 'value': 0.0, 'step': 1e-6, 'siPrefix': True,
                 'suffix': 'm', 'readonly': True},
                {'name': self.geom_coffset_str, 'type': 'float', 'value': 0.0, 'step': 1e-6, 'siPrefix': True,
                 'suffix': 'm', 'readonly': True},
                {'name': self.geom_photonEnergy_str, 'type': 'float', 'value': 0.0, 'step': 1e-6, 'siPrefix': True, 'suffix': 'eV'},
                {'name': self.geom_wavelength_str, 'type': 'float', 'value': 0.0, 'step': 1e-6, 'siPrefix': True, 'suffix': 'm', 'readonly': True},
                {'name': self.geom_pixelSize_str, 'type': 'float', 'value': 0.0, 'precision': 12, 'minVal': 1e-6, 'siPrefix': True, 'suffix': 'm'},
                {'name': self.geom_resolutionRings_str, 'type': 'bool', 'value': False, 'tip': "Display resolution rings", 'children': [
                    {'name': self.geom_resolution_str, 'type': 'str', 'value': None},
                    {'name': self.geom_resolutionUnits_str, 'type': 'list', 'values': {self.geom_unitA_crystal_str: self.unitA_c,
                                                                                  self.geom_unitNm_crystal_str: self.unitNm_c,
                                                                                  self.geom_unitQ_crystal_str: self.unitQ_c,
                                                                                  self.geom_unitA_physics_str: self.unitA_p,
                                                                                  self.geom_unitNm_physics_str: self.unitNm_p,
                                                                                  self.geom_unitQ_physics_str: self.unitQ_p,
                                                                                  self.geom_unitTwoTheta_str: self.unitTwoTheta},
                     'value': self.unitA_c},
                ]},
            ]},
        ]

        self.p1 = Parameter.create(name='paramsDiffractionGeometry', type='group', \
                                   children=self.params, expanded=True)
        self.p1.sigTreeStateChanged.connect(self.change)
        self.w3.setParameters(self.p1, showTop=False)
       
        self.deployGeomBtn.clicked.connect(self.deploy)
        self.deployAutoGeomBtn.clicked.connect(self.autoDeploy)

    # If anything changes in the parameter tree, print a message
    def change(self, panel, changes):
        for param, change, data in changes:
            path = panel.childPath(param)
            if self.parent.args.v >= 1:
                print('  path: %s' % path)
                print('  change:    %s' % change)
                print('  data:      %s' % str(data))
                print('  ----------')
            self.paramUpdate(path, change, data)

    ##############################
    # Mandatory parameter update #
    ##############################
    def paramUpdate(self, path, change, data):
        if path[1] == self.geom_detectorDistance_str:
            self.updateDetectorDistance(data)
        elif path[1] == self.geom_clen_str:
            pass
        elif path[1] == self.geom_coffset_str:
            pass
        elif path[1] == self.geom_photonEnergy_str:
            self.updatePhotonEnergy(data)
#.........这里部分代码省略.........
开发者ID:laurentroque,项目名称:psocake,代码行数:103,代码来源:diffractionGeometryPanel.py

示例15: ProjectSettingsDialog

# 需要导入模块: from pyqtgraph.parametertree import ParameterTree [as 别名]
# 或者: from pyqtgraph.parametertree.ParameterTree import setWindowTitle [as 别名]
class ProjectSettingsDialog(QtGui.QDialog):
    path2key=dict()
    def __init__(self, parent = None, savedstate=None):
        global  SETTINGS
        super(ProjectSettingsDialog, self).__init__(parent)
        self.setWindowTitle("Application Settings")
        layout = QtGui.QVBoxLayout(self)
        self.setLayout(layout)

        if savedstate:
            for key,val in savedstate.items():
                if flattenned_settings_dict.get(key):
                    flattenned_settings_dict[key]['value'] = val

            #self._settings.restoreState(savedstate)

        self.initKeyParamMapping()
        self._settings = Parameter.create(name='params', type='group', children=settings_params)

        # Holds settings keys that have changed by the user when the
        # dialog is closed. Used to update any needed gui values..
        self._updated_settings={}

        self._invalid_settings={}

        self._settings.sigTreeStateChanged.connect(self.handleSettingChange)

        self.initSettingsValues()

        self._settings.param('Default Settings', 'Save As').sigActivated.connect(self.saveToFile)
        self._settings.param('Default Settings', 'Load').sigActivated.connect(self.loadFromFile)

        self.ptree = ParameterTree()
        self.ptree.setParameters(self._settings, showTop=False)
        self.ptree.setWindowTitle('MarkWrite Application Settings')

        layout.addWidget(self.ptree)

        # OK and Cancel buttons
        self.buttons = QtGui.QDialogButtonBox(
            QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal, self)
        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        wscreen = QtGui.QDesktopWidget().screenGeometry()
        if savedstate and savedstate.get(SETTINGS_DIALOG_SIZE_SETTING):
            w, h = savedstate.get(SETTINGS_DIALOG_SIZE_SETTING)
            self.resize(w, h)
            SETTINGS[SETTINGS_DIALOG_SIZE_SETTING]=(w, h)
            if savedstate.get(APP_WIN_SIZE_SETTING):
                SETTINGS[APP_WIN_SIZE_SETTING]=savedstate.get(APP_WIN_SIZE_SETTING)
        else:          
            if parent:
                wscreen = QtGui.QDesktopWidget().screenGeometry(parent)
                self.resize(min(500,int(wscreen.width()*.66)),min(700,int(wscreen.height()*.66)))
        # center dialog on same screen as is being used by markwrite app.
        qr = self.frameGeometry()
        cp = wscreen.center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

    def saveToFile(self):
        from markwrite.gui.dialogs import fileSaveDlg, ErrorDialog
        from markwrite import writePickle, current_settings_path
        save_to_path=fileSaveDlg(
                        initFilePath=current_settings_path,
                        initFileName=u"markwrite_settings.pkl",
                        prompt=u"Save MarkWrite Settings",
                        allowed="Python Pickle file (*.pkl)",
                        parent=self)
        if save_to_path:
            import os
            from markwrite import default_settings_file_name, current_settings_file_name
            ff, fn = os.path.split(save_to_path)
            if fn in [default_settings_file_name, current_settings_file_name]:
                ErrorDialog.info_text = u"%s a is reserved file name." \
                                        u" Save again using a different name."%(fn)
                ErrorDialog().display()                
            else:
                writePickle(ff, fn, SETTINGS)
        
        
    def loadFromFile(self):
        global settings
        from markwrite.gui.dialogs import fileOpenDlg
        from markwrite import appdirs as mwappdirs
        from markwrite import readPickle, writePickle
        from markwrite import current_settings_file_name, current_settings_path
        if self.parent:
            mws_file = fileOpenDlg(current_settings_path,
                                   None, "Select MarkWrite Settings File",
                                   "Python Pickle file (*.pkl)", False)
            if mws_file:
                import os
                ff, fn = os.path.split(mws_file[0])
                mw_setting = readPickle(ff, fn)
                _ = ProjectSettingsDialog(savedstate=mw_setting)
#.........这里部分代码省略.........
开发者ID:isolver,项目名称:OpenHandWrite,代码行数:103,代码来源:projectsettings.py


注:本文中的pyqtgraph.parametertree.ParameterTree.setWindowTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。