Changeset 842


Ignore:
Timestamp:
Apr 28, 2012 7:19:36 AM (10 years ago)
Author:
jemian
Message:

finish off pv.py GUI demo, add TODO items

Location:
moxy/trunk/src/moxy/qtlib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • moxy/trunk/src/moxy/qtlib/CaQLabel.py

    r841 r842  
    2626    Provide the value of an EPICS PV on a PySide.QtGui.QLabel
    2727    '''
     28    # TODO: need to superclass a lot of this
    2829
    2930    def __init__(self, text=''):
  • moxy/trunk/src/moxy/qtlib/pv.py

    r841 r842  
    4545import PySide.QtGui
    4646from CaQLabel import CaQLabel
     47import tools
    4748
    4849
     
    6162        self.pvname.setText(pvname)
    6263        value_label = PySide.QtGui.QLabel("PV Value:")
    63         self.value  = CaQLabel(" "*4)     
     64        self.value  = CaQLabel(" "*4) 
     65       
     66        status_label  = PySide.QtGui.QLabel("status:")
     67        self.status  = PySide.QtGui.QLabel("just starting")
     68        self.status_text = ''
     69       
     70        content_label  = PySide.QtGui.QLabel("content:")
     71        self.content  = PySide.QtGui.QLabel("just starting")
     72        self.content_text = ''
     73
     74        self.sig_status = tools.CaQSignalDef()
     75        self.sig_status.newText.connect(self.SetStatus)
     76        self.sig_content = tools.CaQSignalDef()
     77        self.sig_content.newText.connect(self.SetContent)
    6478
    6579        self.pvname.returnPressed.connect(self.onPVNameReturn)
    6680
    6781        grid = PySide.QtGui.QGridLayout()
    68         grid.addWidget(name_label,   0, 0)
    69         grid.addWidget(self.pvname,  0, 1)
    70         grid.addWidget(value_label,  1, 0)
    71         grid.addWidget(self.value,   1, 1)
     82        grid.addWidget(name_label,    0, 0)
     83        grid.addWidget(self.pvname,   0, 1)
     84        grid.addWidget(value_label,   1, 0)
     85        grid.addWidget(self.value,    1, 1)
     86        grid.addWidget(status_label,  2, 0)
     87        grid.addWidget(self.status,   2, 1)
     88        grid.addWidget(content_label, 3, 0)
     89        grid.addWidget(self.content,  3, 1)
    7290
    7391        self.setLayout(grid)
     
    82100   
    83101    def connect_update(self, **kw):
    84         print kw['conn']
     102        self.status_text = {True: 'connected', False: 'disconnected'}[ kw['conn'] ]
     103        self.sig_status.newText.emit()
    85104   
    86105    def pv_update(self, **kw):
    87         print kw['char_value'], kw['timestamp']
     106        self.content_text = "updated:" + str(kw['timestamp'])
     107        self.sig_content.newText.emit()
     108   
     109    def SetStatus(self):
     110        self.status.setText(self.status_text)
     111   
     112    def SetContent(self):
     113        self.content.setText(self.content_text)
    88114
    89115
  • moxy/trunk/src/moxy/qtlib/tools.py

    r841 r842  
    4646    newBgColor = PySide.QtCore.Signal()
    4747    newText    = PySide.QtCore.Signal()
     48    # TODO: Can we have the caller give the list of signals to create?
     49    # Signal v SignalInstance: we want the latter
    4850
    4951
Note: See TracChangeset for help on using the changeset viewer.