Пример #1
0
def runPyDM(ui=None, disp_args=[], pfmon=None, mcro=None):

    app = PyDMApplication(ui_file=ui,
                          command_line_args=disp_args,
                          perfmon=pfmon,
                          macros=mcro)
    app.exec_()
Пример #2
0
def qapp(pytestconfig):
    global application
    if application:
        pass
    else:
        application = PyDMApplication()
        if pytestconfig.getoption('--dark'):
            import qdarkstyle
            application.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    return application
Пример #3
0
def main():
    _parse_arguments()

    app = PyDMApplication(command_line_args=sys.argv, hide_nav_bar=True, hide_menu_bar=True, hide_status_bar=True,
                          use_main_window=False)

    pydm_chartsdipslay = PyDMChartingDisplay()
    pydm_chartsdipslay.setMinimumSize(1600, 800)
    pydm_chartsdipslay.show()

    sys.exit(app.exec_())
Пример #4
0
def qapp(pytestconfig):
    global application
    if application:
        pass
    else:
        application = PyDMApplication(use_main_window=False)
        if pytestconfig.getoption('--dark'):
            import qdarkstyle
            application.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
        else:
            typhon.use_stylesheet()
    return application
    def do_search(self):
        # For each widget inside the results frame, lets destroy them
        for widget in self.frmLT_result.findChildren(QWidget):
            widget.setParent(None)
            widget.deleteLater()
        for widget in self.frmBO_result.findChildren(QWidget):
            widget.setParent(None)
            widget.deleteLater()
        for widget in self.frmSR_result.findChildren(QWidget):
            widget.setParent(None)
            widget.deleteLater()
        for widget in self.frmDCL_result.findChildren(QWidget):
            widget.setParent(None)
            widget.deleteLater()

        # Grab the filter text
        filter_text = self.txt_filter.text()

        # For every entry in the dataset...
        for entry in self.BBB_PS_list:
            # Check if they match our filter
            if filter_text.upper() not in entry.upper():
                continue

            # Create macros list
            dict_macro_BBB = {
                "PS_CON": entry,
                "PYTHON":
                "python" if platform.system() == "Windows" else "python3"
            }
            for i in range(1, len(self.BBB_PS_list[entry]) + 1):
                dict_macro_BBB["PS{}".format(i)] = self.BBB_PS_list[entry][i -
                                                                           1]
            # Create a PyDMEmbeddedDisplay for this entry
            disp = PyDMEmbeddedDisplay(parent=self)
            PyDMApplication.instance().close_widget_connections(disp)
            disp.macros = json.dumps(dict_macro_BBB)
            disp.filename = 'PS_Controller.ui'
            disp.setMinimumWidth(700)
            disp.setMinimumHeight(40)
            disp.setMaximumHeight(100)

            # Add the Embedded Display to the Results Layout
            if "DCL" in entry:
                self.resultsDCL_layout.addWidget(disp)
            elif "SI" in entry:
                self.resultsSR_layout.addWidget(disp)
            elif "BO" in entry:
                self.resultsBO_layout.addWidget(disp)
            elif ("TB" in entry) or ("TS" in entry):
                self.resultsLT_layout.addWidget(disp)

            PyDMApplication.instance().establish_widget_connections(disp)
Пример #6
0
def main():
    parser = argparse.ArgumentParser(description="Python Display Manager")
    parser.add_argument(
        'displayfile',
        help=
        'A PyDM file to display.    Can be either a Qt .ui file, or a Python file.',
        nargs='?',
        default=None)
    parser.add_argument(
        '--perfmon',
        action='store_true',
        help=
        'Enable performance monitoring, and print CPU usage to the terminal.')
    parser.add_argument('--hide-nav-bar',
                        action='store_true',
                        help='Start PyDM with the navigation bar hidden.')
    parser.add_argument('--hide-menu-bar',
                        action='store_true',
                        help='Start PyDM with the menu bar hidden.')
    parser.add_argument('--hide-status-bar',
                        action='store_true',
                        help='Start PyDM with the status bar hidden.')
    parser.add_argument('--read-only',
                        action='store_true',
                        help='Start PyDM in a Read-Only mode.')
    parser.add_argument(
        '-m',
        '--macro',
        help=
        'Specify macro replacements to use, in JSON object format.    Reminder: JSON requires double quotes for strings, so you should wrap this whole argument in single quotes.  Example: -m \'{"sector": "LI25", "facility": "LCLS"}'
    )
    parser.add_argument(
        'display_args',
        help=
        'Arguments to be passed to the PyDM client application (which is a QApplication subclass).',
        nargs=argparse.REMAINDER)
    pydm_args = parser.parse_args()
    macros = None
    if pydm_args.macro is not None:
        try:
            macros = json.loads(pydm_args.macro)
        except ValueError:
            raise ValueError("Could not parse macro argument as JSON.")
    app = PyDMApplication(ui_file=pydm_args.displayfile,
                          command_line_args=pydm_args.display_args,
                          perfmon=pydm_args.perfmon,
                          hide_nav_bar=pydm_args.hide_nav_bar,
                          hide_menu_bar=pydm_args.hide_menu_bar,
                          hide_status_bar=pydm_args.hide_status_bar,
                          read_only=pydm_args.read_only,
                          macros=macros)
    sys.exit(app.exec_())
Пример #7
0
    def __init__(self, parent=None, args=[], macros=None):
        super(TableDisplay, self).__init__(parent=parent,
                                           args=args,
                                           macros=macros)

        table_batch = len(devices) * 8  # if len(devices) * 8 < 30 else 30

        horizontal_header_labels = [
            'Channel Name', 'Device Name', 'Device Alpha', 'Temperature',
            'Temperature Raw'
        ]

        self.tdc = MBTempTableDataController(
            self.table,
            devices=devices,
            table_batch=table_batch,
            horizontal_header_labels=horizontal_header_labels)

        self.tfFilter.editingFinished.connect(
            lambda: self.filter(self.tfFilter.text()))

        self.btnNavLeft.clicked.connect(lambda: self.update_navbar(False))
        self.btnNavLeft.setIcon(IconFont().icon('arrow-left'))
        self.btnNavRight.clicked.connect(lambda: self.update_navbar(True))
        self.btnNavRight.setIcon(IconFont().icon('arrow-right'))
        PyDMApplication.instance().hide_nav_bar = True
Пример #8
0
def qapp(pytestconfig):
    global application
    application = QtWidgets.QApplication.instance()
    if application is None:
        application = PyDMApplication(use_main_window=False)
    typhos.use_stylesheet(pytestconfig.getoption('--dark'))
    return application
Пример #9
0
def qapp(pytestconfig):
    global application
    if application:
        pass
    else:
        application = PyDMApplication(use_main_window=False)
        typhon.use_stylesheet(pytestconfig.getoption('--dark'))
    return application
Пример #10
0
    def __init__(self, parent=None, args=None, macros=None):
        super(TableDisplay, self).__init__(parent=parent,
                                           args=args,
                                           macros=macros)

        table_batch = 0
        for device in DEVICES:
            if not device.enable:
                continue
            for channel in device.channels:
                if not channel.enable:
                    continue
                table_batch += 1

        horizontal_header_labels = [
            "Channel Name",
            "Device Name",
            "Device Alpha",
            "Temperature",
        ]
        # "Temperature Raw",]

        self.tdc = MBTempTableDataController(
            self.table,
            devices=DEVICES,
            table_batch=table_batch,
            horizontal_header_labels=horizontal_header_labels,
        )

        self.tfFilter.editingFinished.connect(
            lambda: self.filter(self.tfFilter.text()))

        self.TempMax.valueChanged.connect(
            lambda: self.tdc.update_TempMaxMin(Maximum=self.TempMax.value()))

        self.TempMin.valueChanged.connect(
            lambda: self.tdc.update_TempMaxMin(Minimum=self.TempMin.value()))

        self.btnNavLeft.clicked.connect(lambda: self.update_navbar(False))
        self.btnNavLeft.setIcon(IconFont().icon("arrow-left"))
        self.btnNavRight.clicked.connect(lambda: self.update_navbar(True))
        self.btnNavRight.setIcon(IconFont().icon("arrow-right"))
        PyDMApplication.instance().hide_nav_bar = True
Пример #11
0
            return True

        except:
            return False

    def errorMessage(self, message):
        self.showDialog("---Attention---", message)

    '''
    ____________________________________________________________________________________________________________________________________
    Functions not used 
    '''


if __name__ == "__main__":
    import sys
    app = PyDMApplication(use_main_window=False)
    Ui_MainWindow_Ocean = QtWidgets.QMainWindow()
    ui = PressureSystem()
    ui.setupUi(Ui_MainWindow_Ocean)
    ui.setFlowControl(oceanPV="SOL3", motorPV="SOL:galil:test:A", LS="XDS:LS")
    Ui_MainWindow_Ocean.show()
    app.establish_widget_connections(widget=Ui_MainWindow_Ocean)
    sys.exit(app.exec_())
    '''
    self.ui.lblAcquiring.linkActivated.connect(self.pri1)
        self.ui.lblAcquiring.linkHovered.connect(self.pri1)
        #self.ui.lblAcquiring.channel.
        self.ui.lblProgress.value_changed(0)
        self.ui.cmbAcquisition.send_value_signal.connect(self.pri1)
    '''
Пример #12
0
#!/usr/bin/env python
import sys
import argparse
from pydm import PyDMApplication

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Python Display Manager")
    parser.add_argument(
        'displayfile',
        help=
        'A PyDM file to display.  Can be either a Qt .ui file, or a Python file.',
        nargs='?',
        default=None)
    parser.add_argument(
        'display_args',
        help=
        'Arguments to be passed to the PyDM client application (which is a QApplication subclass).',
        nargs=argparse.REMAINDER)
    pydm_args = parser.parse_args()
    app = PyDMApplication(ui_file=pydm_args.displayfile,
                          command_line_args=pydm_args.display_args)
    sys.exit(app.exec_())
Пример #13
0
        nargs='?',
        default=None)
    parser.add_argument(
        '--perfmon',
        action='store_true',
        help=
        'Enable performance monitoring, and print CPU usage to the terminal.')
    parser.add_argument(
        '-m',
        '--macro',
        help=
        'Specify macro replacements to use, in JSON object format.    Reminder: JSON requires double quotes for strings, so you should wrap this whole argument in single quotes.  Example: -m \'{"sector": "LI25", "facility": "LCLS"}'
    )
    parser.add_argument(
        'display_args',
        help=
        'Arguments to be passed to the PyDM client application (which is a QApplication subclass).',
        nargs=argparse.REMAINDER)
    pydm_args = parser.parse_args()
    macros = None
    if pydm_args.macro is not None:
        try:
            macros = json.loads(pydm_args.macro)
        except ValueError:
            raise ValueError("Could not parse macro argument as JSON.")
    app = PyDMApplication(ui_file=pydm_args.displayfile,
                          command_line_args=pydm_args.display_args,
                          perfmon=pydm_args.perfmon,
                          macros=macros)
    sys.exit(app.exec_())
Пример #14
0
#!/usr/bin/python3
import sys
from PyQt5 import uic
from PyQt5.QtWidgets import QMainWindow
from pydm import PyDMApplication

app = PyDMApplication()
window = uic.loadUi('pvsim.ui')
window.show()
sys.exit(app.exec_())
Пример #15
0
    def __init__(self,
                 parent=None,
                 macros=None,
                 args=None,
                 average="Gamma Detectors"):
        super().__init__(parent=parent,
                         args=args,
                         macros=macros,
                         ui_filename=OVERVIEW_UI)
        self.setWindowTitle("Overview of Time Bases")
        self.alpha = [0, 0, 0, 0, 0]  # Initially doesn't show none graph
        self.average = average
        self.groups = ["{:0>2d}".format(sec) for sec in range(1, 21)]
        self.x = numpy.arange(len(self.groups))
        self.width = 0.185

        self.dict_pvs_tb = {}
        self.dict_macro_gamma = {}

        self.gamma_1 = [0] * 20
        self.gamma_2 = [0] * 20
        self.gamma_3 = [0] * 20
        self.gamma_4 = [0] * 20
        self.gamma_5 = [0] * 20

        self.fig, self.ax = plt.subplots(figsize=(12, 8))  #
        self.fig.canvas.set_window_title("Overview")  #
        self.fig.subplots_adjust(left=0.05, bottom=0.08, right=0.95,
                                 top=0.95)  # Adjustments of graphics
        plt.subplots_adjust(left=0.1)  #

        self.fig.text(0.03, 0.25, "Control of\n Graphic", ha="center")
        self.ani = FuncAnimation(fig=self.fig,
                                 func=self.animate,
                                 interval=10000)
        self.animate()
        self.checkButtons_setting()
        plt.show()

        if self.average == "Gamma Detectors":  # If user chose 'Counting - Overview'
            for PV in range(1, 21):
                for s_sec in range(2):
                    self.dict_pvs_tb["valueTB{}{}".format(
                        PV, counters[s_sec]
                    )] = "ca://SI-{:0>2d}{}:CO-Counter:TimeBase-SP".format(
                        PV, counters[s_sec])
                if PV != 20:
                    self.dict_pvs_tb["valueTB{}M1".format(
                        PV
                    )] = "ca://SI-{:0>2d}M1:CO-Counter:TimeBase-SP".format(PV +
                                                                           1)
                else:
                    self.dict_pvs_tb["valueTB{}M1".format(
                        PV)] = "ca://SI-01M1:CO-Counter:TimeBase-SP"

            for location in range(1, 21):
                for s_sec in range(len(Det_Location)):
                    self.dict_macro_gamma["DET{}".format(
                        s_sec)] = "SI-{:0>2d}{}:CO-Gamma".format(
                            location, Det_Location[s_sec])
                    if s_sec < 3:
                        self.dict_macro_gamma["TimeBase{}".format(
                            s_sec)] = "{}".format(
                                self.dict_pvs_tb["valueTB{}{}".format(
                                    location, counters[s_sec])])

                    a = PyDMChannel(
                        address="ca://SI-{:0>2d}{}:CO-Gamma:Count-Mon".format(
                            location, Det_Location[s_sec]),
                        value_slot=partial(self.plot,
                                           location=location,
                                           det=s_sec),
                    )  # Connect to Counting PVs
                    a.connect()

                self.disp = PyDMEmbeddedDisplay(
                    parent=self)  # Creates the window of Time Bases
                PyDMApplication.instance().close_widget_connections(self.disp)
                self.disp.macros = json.dumps(self.dict_macro_gamma)
                self.disp.filename = LAYOUT_OVERVIEW_UI
                self.disp.setMinimumWidth(300)
                self.disp.setMinimumHeight(140)
                self.verticalLayout.addWidget(self.disp)

                PyDMApplication.instance().establish_widget_connections(
                    self.disp)
        else:  # If user chose some Average
            for location in range(1, 21):
                for s_sec in range(len(Det_Location)):
                    a = PyDMChannel(
                        address="ca://SI-{:0>2d}{}:CO-Gamma:{}-Mon".format(
                            location, Det_Location[s_sec], self.average),
                        value_slot=partial(self.plot,
                                           location=location,
                                           det=s_sec),
                    )  # Connect to Averages PVs
                    a.connect()
Пример #16
0
    def invertedScale(self):
        """
        Whether or not the motor scale is inverted.

        Returns
        -------
        bool
        """
        return self._inverted_scale

    @invertedScale.setter
    def invertedScale(self, inverted):
        """
        Whether or not the motor scale is inverted.

        Parameters
        ----------
        flipped : bool
        """
        if self._inverted_scale != inverted:
            self._inverted_scale = inverted
            self.build_layout(self._orientation, self._flipped, inverted)


if __name__ == '__main__':
    app = PyDMApplication()
    #widget = QMotor(init_channel='SOL8:m1')
    widget = QMotor(init_channel='A')
    app.establish_widget_connections(widget=widget)
    sys.exit(app.exec_())
Пример #17
0
    def acceptedChanges_pvname(self):
        ''' PV names edition '''
        try:
            self.getting_pvname()
            self.showDialog(title = 'Please Wait', text = 'Please Wait While E-MA Configures E-MA Application')
            self.ui_ocean.setFlowControl(oceanPV = self.pvname_ocean, motorPV = self.pvname_motorGearBox, LS = self.pvname_lakeshore)
        except OSError as err:
            self.showDialog(title = 'Error on PV names edition', text = err)
        
        self.Ui_MainWindow_editPVnames.close()
        
    def rejectedChanges_pvname(self):
        self.Ui_MainWindow_editPVnames.close()
            
    def showDialog(self,title = None, text = None):
        """Show a simple message dialog"""
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)
        msg.setText(text)
        msg.setWindowTitle(title)
        msg.exec_()  
        
if __name__ == '__main__':
    pass
    app = PyDMApplication(use_main_window=False)
    app.load_external_tools()
    ui_Dioptas = MainController() 
    emapp = EmaApp()
    sys.excepthook = excepthook
    sys.exit(app.exec_())
    QtWidgets.QApplication.closeAllWindows()
Пример #18
0
#!/usr/local/lcls/package/python/current/bin/python

import sys, os
from pydm.PyQt import QtCore, QtGui
from display_ui import Ui_MainWindow
from pydm import PyDMApplication


class DisplayWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)


if __name__ == "__main__":
    app = PyDMApplication(sys.argv)
    window = DisplayWindow()
    window.show()
    app.start_connections()
    sys.exit(app.exec_())
Пример #19
0
 def openPyDM(self):
     app_pydm = PyDMApplication(sys.argv)
     app_pydm.new_window("lineEditTestPyDM.ui")
Пример #20
0
    def stop(self):
        """Stop."""
        self.update_timer.stop()

    def set_update_interval(self, interval):
        """Set timer update interval."""
        self.update_timer.stop()
        self.model.update_interval = interval
        self.update_timer.start(self.model.update_interval)

    def channels(self):
        """Used by PyDmApplication to set the model channel."""
        if isinstance(self.model, PyDMBarGraphModel):
            return self.model.channels()
        return [PyDMChannel()]


if __name__ == "__main__":
    import sys
    from pydm import PyDMApplication

    app = PyDMApplication(None, sys.argv)
    w = BarGraphWidget()
    w.set_scale(100)
    w.set_brush("b")
    pv = "fac-lnls455-linux-SI-13C4:DI-DCCT:BbBCurrent-Mon"
    w.model.channel = pv
    w.show()
    sys.exit(app.exec_())