def setup(self, parent, logger, trend):
        self.trend = trend or logger.trend
        self.logger = logger
        self.setWindowTitle("Reload Archiving")
        lwidget, lcheck = Qt.QVBoxLayout(), Qt.QHBoxLayout()
        self.setLayout(lwidget)

        self._reloadbutton = Qt.QPushButton('Reload Archiving')
        self.layout().addWidget(self._reloadbutton)
        self._reloadbutton.connect(self._reloadbutton, Qt.SIGNAL('clicked()'),
                                   self.logger.resetBuffers)
        self._decimatecombo = Qt.QComboBox()
        self._decimatecombo.addItems([t[0] for t in DECIMATION_MODES])
        self._decimatecombo.setCurrentIndex(0)
        self._nonescheck = Qt.QCheckBox('Remove Nones')
        self._nonescheck.setChecked(True)
        self._nonescheck.connect(self._nonescheck, Qt.SIGNAL('toggled(bool)'),
                                 self.toggle_nones)
        self._windowedit = Qt.QLineEdit()
        self._windowedit.setText('0')

        dl = Qt.QGridLayout()
        dl.addWidget(Qt.QLabel('Decimation method:'), 0, 0, 1, 2)
        dl.addWidget(self._decimatecombo, 0, 3, 1, 2)
        dl.addWidget(Qt.QLabel('Fixed Period (0=AUTO)'), 1, 0, 1, 1)
        dl.addWidget(self._windowedit, 1, 1, 1, 1)
        dl.addWidget(self._nonescheck, 1, 2, 1, 2)
        self.layout().addLayout(dl)
 def __init__(self, parent=None):
     TaurusWidget.__init__(self, parent)
     self.setLayout(Qt.QHBoxLayout())
     form = LoadForm(self)
     form.setModel([
         "simumotor/zreszela/1/position", "simumotor/zreszela/2/position",
         "simumotor/zreszela/3/position", "simumotor/zreszela/4/position"
     ])
     self.layout().addWidget(form)
示例#3
0
 def __init__(self, parent=None):
     Qt.QWidget.__init__(self, parent)
     self.setLayout(Qt.QVBoxLayout())
     self.bar = Qt.QWidget()
     self.bar.setLayout(Qt.QHBoxLayout())
     self.bar.setMaximumHeight(50)
     self.modelline = Qt.QLineEdit()
     self.modelbt = Qt.QPushButton('Apply')
     map(self.bar.layout().addWidget, (self.modelline, self.modelbt))
     self.main = QAlarmPanel(self)
     map(self.layout().addWidget, (self.bar, self.main))
示例#4
0
 def __init__(self, parent=None):
     Qt.QWidget.__init__(self, parent)
     self.setLayout(Qt.QHBoxLayout())
     self.model = ''
     self.device = ''
     self.label = Qt.QLabel()
     self.label.setFixedWidth(250)
     self.value = Qt.QLabel()
     self.value.setFixedWidth(200)
     self.units = Qt.QLabel()
     self.units.setFixedWidth(50)
     self.setWindowTitle('TaurusSingleValue')
     map(self.layout().addWidget, (self.label, self.value, self.units))
    def setupUi(self, USE_SCROLL=False, SHOW_OPTIONS=False, USE_TREND=False):
        self.setWindowTitle('Tango Finder : Search Attributes and Archiving')
        self.setLayout(Qt.QVBoxLayout())
        self.setMinimumWidth(950)  #550)
        #self.setMinimumHeight(700)

        self.layout().setAlignment(Qt.Qt.AlignTop)
        self.browser = Qt.QFrame()
        self.browser.setLayout(Qt.QVBoxLayout())

        self.chooser = Qt.QTabWidget()
        self.chooser.setTabPosition(
            self.chooser.West if SHOW_OPTIONS else self.chooser.North)
        #self.combo = Qt.QComboBox() # Combo used for domains, currently disabled

        self.searchbar = Qt.QFrame()
        self.searchbar.setLayout(Qt.QGridLayout())

        #self.label = Qt.QLabel('Type a part of device name and a part of attribute name, use "*" or " " as wildcards:')
        #self.layout().addWidget(self.label)

        self.ServerFilter = Qt.QLineEdit()
        self.ServerFilter.setMaximumWidth(250)
        self.DeviceFilter = fandango.qt.Dropable(Qt.QLineEdit)()
        self.DeviceFilter.setSupportedMimeTypes(
            fandango.qt.TAURUS_DEV_MIME_TYPE)
        self.AttributeFilter = fandango.qt.Dropable(Qt.QLineEdit)()
        self.AttributeFilter.setSupportedMimeTypes(
            [fandango.qt.TAURUS_ATTR_MIME_TYPE, fandango.qt.TEXT_MIME_TYPE])
        self.update = Qt.QPushButton('Update')
        self.archivecheck = Qt.QCheckBox("Show archived attributes only")
        self.archivecheck.setChecked(True)

        self.searchbar.layout().addWidget(
            Qt.QLabel(
                'Enter Device and Attribute filters using wildcards '
                '(e.g. li/ct/plc[0-9]+ / ^stat*$ & !status ) and push Update'),
            0, 0, 3, 13)

        [
            self.searchbar.layout().addWidget(o, x, y, h, w)
            for o, x, y, h, w in (
                (Qt.QLabel("Device or Alias:"), 4, 0, 1, 1),
                (self.DeviceFilter, 4, 1, 1, 4),
                (Qt.QLabel("Attribute:"), 4, 5, 1, 1),
                (self.AttributeFilter, 4, 6, 1, 4),
                (self.update, 4, 10, 1, 1),
                (self.archivecheck, 4, 11, 1, 2),
            )
        ]

        if SHOW_OPTIONS:
            self.options = Qt.QWidget()  #self.searchbar
            self.options.setLayout(Qt.QGridLayout())
            separator = lambda x: Qt.QLabel(' ' * x)
            row = 1
            [
                self.options.layout().addWidget(o, x, y, h, w)
                for o, x, y, h, w in (
                    #separator(120),Qt.QLabel("Options: "),separator(5),
                    (Qt.QLabel("Server: "), row, 0, 1, 1),
                    (self.ServerFilter, row, 1, 1, 4),
                    (Qt.QLabel(''), row, 2, 1, 11))
            ]
            #self.panel = generate_table(load_all_thermocouples('SR14')[-1])
            self.optiontab = Qt.QTabWidget()
            self.optiontab.addTab(self.searchbar, 'Filters')
            self.optiontab.addTab(self.options, 'Options')
            self.optiontab.setMaximumHeight(100)
            self.optiontab.setTabPosition(self.optiontab.North)
            self.browser.layout().addWidget(self.optiontab)

        else:
            self.browser.layout().addWidget(self.searchbar)

        self.toppan = Qt.QWidget(self)
        self.toppan.setLayout(Qt.QVBoxLayout())

        if USE_SCROLL:
            print '*' * 30 + ' USE_SCROLL=True ' + '*' * 30
            ## TO USE SCROLL, HEADER HAS BEEN SET AS A SEPARATE WIDGET
            #self.header = QGridTable(self.toppan)
            #self.header.setHorizontalHeaderLabels(self.LABELS)
            #self.header.setColumnWidth(0,350)
            self.headers = []
            self.header = Qt.QWidget(self.toppan)
            self.header.setLayout(Qt.QHBoxLayout())
            for l, s in zip(self.LABELS, self.SIZES):
                ql = Qt.QLabel(l)
                self.headers.append(ql)
                #if s is not None:
                #ql.setFixedWidth(s)
                #else:
                #ql.setSizePolicy(Qt.QSizePolicy.MinimumExpanding,Qt.QSizePolicy.Fixed)
                self.header.layout().addWidget(ql)

            self.toppan.layout().addWidget(self.header)

            self._scroll = MyScrollArea(self.toppan)  #Qt.QScrollArea(self)
            self._background = AttributesPanel(
                self._scroll
            )  #At least a panel should be kept (never deleted) in background to not crash the worker!
            self.panel = None
            self._scroll.setChildrenPanel(self.panel)
            self._scroll.setWidget(self.panel)
            self._scroll.setMaximumHeight(700)
            self.toppan.layout().addWidget(self._scroll)
            self.attrpanel = self._background
        else:
            self.panel = AttributesPanel(self.toppan)
            self.toppan.layout().addWidget(self.panel)
            self.attrpanel = self.panel

        self.toppan.layout().addWidget(
            Qt.QLabel(
                'Drag any attribute from the first column into the trend or any taurus widget you want:'
            ))

        self.browser.layout().addWidget(self.toppan)
        self.chooser.addTab(self.browser, 'Search ...')

        if USE_TREND:
            self.split = Qt.QSplitter(Qt.Qt.Vertical)
            self.split.setHandleWidth(25)
            self.split.addWidget(self.chooser)

            from taurus.qt.qtgui.plot import TaurusTrend
            from PyTangoArchiving.widget.trend import ArchivingTrend, ArchivingTrendWidget
            self.trend = ArchivingTrendWidget()  #TaurusArchivingTrend()
            self.trend.setUseArchiving(True)
            self.trend.showLegend(True)
            self.attrpanel.trend = self.trend

            if TaurusModelChooser is not None:
                self.treemodel = TaurusModelChooser(parent=self.chooser)
                self.chooser.addTab(self.treemodel, 'Tree')
                self.treemodel.updateModels.connect(self.trend.addModels)
                #self.treemodel.connect(self.treemodel,Qt.SIGNAL('updateModels'),self.trend.addModels)
            else:
                tracer('TaurusModelChooser not available!')

            self.split.addWidget(self.trend)
            self.layout().addWidget(self.split)
        else:
            self.layout().addWidget(self.chooser)
        type(self)._persistent_ = self
 def setupUi(self,USE_SCROLL=False,SHOW_OPTIONS=True,USE_TREND=False):
     self.setWindowTitle('Tango Finder : Search Attributes and Archiving')
     self.setLayout(Qt.QVBoxLayout())
     self.setMinimumWidth(950)#550)
     #self.setMinimumHeight(700)
     self.layout().setAlignment(Qt.Qt.AlignTop)
     self.chooser = Qt.QFrame()
     self.chooser.setLayout(Qt.QHBoxLayout())
     self.combo = Qt.QComboBox() #(self)
     #self.chooser.layout().addWidget(Qt.QLabel('Choose a domain to see temperatures status:'))
     #self.chooser.layout().addWidget(self.combo)
     #self.layout().addWidget(self.chooser)
     if True:
         self.searchbar = Qt.QFrame()
         self.searchbar.setLayout(Qt.QGridLayout()) 
         self.label = Qt.QLabel('Type a part of device name and a part of attribute name, use "*" or " " as wildcards:')
         #self.search = Qt.QLineEdit()
         self.ServerFilter = Qt.QLineEdit()
         self.ServerFilter.setMaximumWidth(250)
         self.DeviceFilter = fandango.qt.Dropable(Qt.QLineEdit)()
         self.DeviceFilter.setSupportedMimeTypes(fandango.qt.TAURUS_DEV_MIME_TYPE)
         self.AttributeFilter = fandango.qt.Dropable(Qt.QLineEdit)()
         self.AttributeFilter.setSupportedMimeTypes([fandango.qt.TAURUS_ATTR_MIME_TYPE,fandango.qt.TEXT_MIME_TYPE])
         self.update = Qt.QPushButton('Update')
         self.archivecheck = Qt.QCheckBox("Show archived attributes only")
         self.archivecheck.setChecked(False)
         self.layout().addWidget(self.label)
         [self.searchbar.layout().addWidget(o,x,y,h,w) for o,x,y,h,w in (
             (Qt.QLabel("Device or Alias:"),0,0,1,1),(self.DeviceFilter,0,1,1,4),
             (Qt.QLabel("Attribute:"),0,5,1,1),(self.AttributeFilter,0,6,1,4),
             (self.update,0,10,1,1),(self.archivecheck,0,11,1,2),
             )]
         self.searchbar.layout().addWidget(Qt.QLabel('Enter Device and Attribute filters using wildcards (e.g. li/ct/plc[0-9]+ / ^stat*$ & !status ) and push Update'),1,0,4,13)
         if SHOW_OPTIONS:
             self.options = Qt.QWidget() #self.searchbar
             self.options.setLayout(Qt.QGridLayout())
             separator = lambda x:Qt.QLabel(' '*x)
             row = 1
             [self.options.layout().addWidget(o,x,y,h,w) for o,x,y,h,w in (
                 #separator(120),Qt.QLabel("Options: "),separator(5),
                 (Qt.QLabel("Server: "),row,0,1,1),(self.ServerFilter,row,1,1,4),(Qt.QLabel(''),row,2,1,11)
                 )]
             #self.panel = generate_table(load_all_thermocouples('SR14')[-1])
             self.optiontab = Qt.QTabWidget()
             self.optiontab.addTab(self.searchbar,'Filters')
             self.optiontab.addTab(self.options,'Options')
             self.optiontab.setMaximumHeight(100)
             self.optiontab.setTabPosition(self.optiontab.North)
             self.layout().addWidget(self.optiontab)
         else: self.layout().addWidget(self.searchbar)
         
     self.toppan = Qt.QWidget(self)
     self.toppan.setLayout(Qt.QVBoxLayout())
     if True:
         self.header = QGridTable(self.toppan)
         self.header.setHorizontalHeaderLabels('Label/Value Device Attribute Alias Archiving'.split())
         self.header.setColumnWidth(0,350)
         self.toppan.layout().addWidget(self.header)
     
     if USE_SCROLL:
         print '*'*30 + ' USE_SCROLL=True '+'*'*30
         self._scroll = MyScrollArea(self.toppan)#Qt.QScrollArea(self)
         self._background = AttributesPanel(self._scroll) #At least a panel should be kept (never deleted) in background to not crash the worker!
         self.panel = None
         self._scroll.setChildrenPanel(self.panel)
         self._scroll.setWidget(self.panel)
         self._scroll.setMaximumHeight(700)
         self.toppan.layout().addWidget(self._scroll)
     else:
         self.panel = AttributesPanel(self.toppan)
         self.toppan.layout().addWidget(self.panel)
         
     self.toppan.layout().addWidget(Qt.QLabel('Drag any attribute from the first column into the trend or any taurus widget you want:'))
     
     if USE_TREND:
         self.split = Qt.QSplitter(Qt.Qt.Vertical)
         self.split.setHandleWidth(10)
         self.split.addWidget(self.toppan)
         
         from taurus.qt.qtgui.plot import TaurusTrend
         from PyTangoArchiving.widget.trend import ArchivingTrend,ArchivingTrendWidget
         self.trend = ArchivingTrendWidget() #TaurusArchivingTrend()
         self.trend.setUseArchiving(True)
         self.trend.showLegend(True)
         self.split.addWidget(self.trend)
         self.layout().addWidget(self.split)
     else:
         self.layout().addWidget(self.toppan)
     type(self)._persistent_ = self