Beispiel #1
0
    def run(self):
        self.emit(qt.PYSIGNAL("hide_dc_parameters_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_dcg_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_centring_tab"), (False,))
        self.emit(qt.PYSIGNAL("hide_edna_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_changer_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_energy_scan_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_xrf_scan_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_workflow_tab"), (True,))

        camera_brick = None

        for w in qt.QApplication.allWidgets():
            if isinstance(w, BaseComponents.BlissWidget):
                if "CameraBrick" in str(w.__class__):
                    camera_brick = w
                    camera_brick.installEventFilter(self)
                    break

        # workaround for the remote access problem 
        # (have to disable video display when DC is running)
        if BaseComponents.BlissWidget.isInstanceRoleClient():
            # find the video brick, make sure it is hidden when collecting data
            # and that it is shown again when DC is finished 
            def disable_video(w=camera_brick):
              w.disable_update()
            self.__disable_video=disable_video
            def enable_video(w=camera_brick):
              w.enable_update()
            self.__enable_video=enable_video
            dispatcher.connect(self.__disable_video, "collect_started")
            dispatcher.connect(self.__enable_video, "collect_finished")
Beispiel #2
0
    def run(self):
        self.emit(qt.PYSIGNAL("hide_dc_parameters_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_dcg_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_centring_tab"), (False,))
        self.emit(qt.PYSIGNAL("hide_edna_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_changer_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_sample_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_energy_scan_tab"), (True,))
        self.emit(qt.PYSIGNAL("hide_workflow_tab"), (True,))

        camera_brick = None

        for w in qt.QApplication.allWidgets():
            if isinstance(w, BaseComponents.BlissWidget):
                if "CameraBrick" in str(w.__class__):
                    camera_brick = w
                    camera_brick.installEventFilter(self)
                    break

        # workaround for the remote access problem 
        # (have to disable video display when DC is running)
        if BaseComponents.BlissWidget.isInstanceRoleClient():
            # find the video brick, make sure it is hidden when collecting data
            # and that it is shown again when DC is finished 
            def disable_video(w=camera_brick):
              w.disable_update()
            self.__disable_video=disable_video
            def enable_video(w=camera_brick):
              w.enable_update()
            self.__enable_video=enable_video
            dispatcher.connect(self.__disable_video, "collect_started")
            dispatcher.connect(self.__enable_video, "collect_finished")
Beispiel #3
0
    def __init__(self, parent = None, name = "Grid Dialog", modal = False, flags = 0,
                 canvas = None, matrix = None, event_mgr = None, drawing_object_layer = None):
        super(GridDialog, self).__init__(parent, name, modal, flags)
        self.current_motor_positions = {}
        self.__cell_width = 0
        self.__cell_height = 0
        self.__list_items = {}
        self.__item_counter = 0
        self.__grid_list = []
        self.__main_layout = qt.QVBoxLayout(self, 10, 11, 'main_layout')

        self.__canvas = canvas
        self.__matrix = matrix
        self.__event_mgr = event_mgr
        self.__drawing_object_layer = drawing_object_layer
        self.__drawing_mgr = None
        self.__x_pixel_size = 1
        self.__y_pixel_size = 1
        self.__beam_pos = (0, 0, 0, 0)

        ui_file = 'ui_files/grid_row_widget.ui'
        current_dir = os.path.dirname(__file__)
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
        widget.reparent(self, qt.QPoint(0,0))
        self.__main_layout.add(widget)
        self.__list_view = widget.child("list_view")
        self.__visibility_button = widget.child("visibility_button")
        self.__vspace_ledit = widget.child("vspace_ledit")
        self.__hspace_ledit = widget.child("hspace_ledit")

        qt.QObject.connect(widget.child("add_button"), qt.SIGNAL("clicked()"),
                           self.__add_drawing)

        qt.QObject.connect(widget.child("remove_button"), qt.SIGNAL("clicked()"),
                           self.__delete_drawing)

        qt.QObject.connect(self.__visibility_button, qt.SIGNAL("clicked()"),
                           self.__toggle_visibility_grid)

        qt.QObject.connect(self.__visibility_button, qt.SIGNAL("clicked()"),
                           self.__toggle_visibility_grid)

        qt.QObject.connect(self.__vspace_ledit, qt.SIGNAL("textChanged ( const QString & )"),
                           self.__set_vspace)

        qt.QObject.connect(self.__hspace_ledit, qt.SIGNAL("textChanged ( const QString & )"),
                           self.__set_hspace)
        
        dispatcher.connect(self._get_grid_info, "grid")
        dispatcher.connect(self._set_grid_data, "set_grid_data") 

        qt.QObject.connect(widget.child("list_view"),
                           qt.SIGNAL("selectionChanged(QListViewItem * )"),
                           self.__selection_changed)

        self.setCaption("Grid Tool") 
    def clientInitialized(self,connected,server_id=None,my_nickname=None,quiet=False):
        if connected is None:
            BlissWidget.setInstanceRole(BlissWidget.INSTANCE_ROLE_CLIENTCONNECTING)
            BlissWidget.setInstanceMode(BlissWidget.INSTANCE_MODE_SLAVE)
        elif not connected:
            if not quiet:
                msg_event=MsgDialogEvent(QMessageBox.Warning,\
                    "Couldn't connect to the server application!",\
                    self.font().pointSize())
                qApp.postEvent(self,msg_event)
                
            QTimer.singleShot(InstanceListBrick.RECONNECT_TIME,self.reconnectToServer)
        else:
            BlissWidget.setInstanceRole(BlissWidget.INSTANCE_ROLE_CLIENT)
            BlissWidget.setInstanceMode(BlissWidget.INSTANCE_MODE_SLAVE)

            server_print=self.instanceServer.idPrettyPrint(server_id)

            if self.clientIcon is None:
                item=QListBoxText(self.listBox,server_print)
            else:
                item=QListBoxPixmap(self.listBox,self.serverIcon,server_print)
            self.nickname.setText(my_nickname)
            self.connections[server_id[0]]=(item,server_id[1])
            item.setSelectable(False)
            self.haveControl(False,gui_only=True)
            self.initName(my_nickname)
            #self.giveControl.setChecked(False)

            # workaround for the remote access problem
            # (have to disable video display when DC is running)
            camera_brick = None

            for w in qt.QApplication.allWidgets():
                if isinstance(w, BaseComponents.BlissWidget):
                    if "CameraBrick" in str(w.__class__):
                        camera_brick = w
                        camera_brick.installEventFilter(self)
                        break

            # find the video brick, make sure it is hidden when collecting data
            # and that it is shown again when DC is finished
            def disable_video(w=camera_brick):
                w.disable_update()
            self.__disable_video=disable_video
            def enable_video(w=camera_brick):
                w.enable_update()
            self.__enable_video=enable_video
            dispatcher.connect(self.__disable_video, "collect_started")
            dispatcher.connect(self.__enable_video, "collect_finished")

            msg_event=MsgDialogEvent(QMessageBox.Information,\
                "Successfully connected to the server application.",\
                self.font().pointSize())
            qApp.postEvent(self,msg_event)
Beispiel #5
0
    def run(self):
        BaseGraphicScan.run(self)
        startButton = self._widgetTree.child('__startScan')
        startButton.hide()

        stopButton = self._widgetTree.child('__stopScan')
        stopButton.hide()
        
        if self._horizontalMotors and self._verticalMotors:
       
          startButton.setEnabled(True)
          mot1 = self._horizontalMotors[0]
          mot2 = self._verticalMotors[0]
          self.old_mot1_pos = mot1.getPosition()
          self.old_mot2_pos = mot2.getPosition()
          mot1.connect('positionChanged', self.mot1_position_changed)
          mot2.connect('positionChanged', self.mot2_position_changed)
 
        table = self._widgetTree.child('__gridTable')
        table.setText(0, 0, "2")
        table.setText(1, 0, "2")

        dispatcher.connect(self._askedForGrid, "grid")
Beispiel #6
0
    def run(self):
        BaseGraphicScan.run(self)
        startButton = self._widgetTree.child('__startScan')
        startButton.hide()

        stopButton = self._widgetTree.child('__stopScan')
        stopButton.hide()

        if self._horizontalMotors and self._verticalMotors:

            startButton.setEnabled(True)
            mot1 = self._horizontalMotors[0]
            mot2 = self._verticalMotors[0]
            self.old_mot1_pos = mot1.getPosition()
            self.old_mot2_pos = mot2.getPosition()
            mot1.connect('positionChanged', self.mot1_position_changed)
            mot2.connect('positionChanged', self.mot2_position_changed)

        table = self._widgetTree.child('__gridTable')
        table.setText(0, 0, "2")
        table.setText(1, 0, "2")

        dispatcher.connect(self._askedForGrid, "grid")
Beispiel #7
0
    def clientInitialized(self,
                          connected,
                          server_id=None,
                          my_nickname=None,
                          quiet=False):
        if connected is None:
            BlissWidget.setInstanceRole(
                BlissWidget.INSTANCE_ROLE_CLIENTCONNECTING)
            BlissWidget.setInstanceMode(BlissWidget.INSTANCE_MODE_SLAVE)
        elif not connected:
            if not quiet:
                msg_event=MsgDialogEvent(QMessageBox.Warning,\
                    "Couldn't connect to the server application!",\
                    self.font().pointSize())
                qApp.postEvent(self, msg_event)

            QTimer.singleShot(InstanceListBrick.RECONNECT_TIME,
                              self.reconnectToServer)
        else:
            BlissWidget.setInstanceRole(BlissWidget.INSTANCE_ROLE_CLIENT)
            BlissWidget.setInstanceMode(BlissWidget.INSTANCE_MODE_SLAVE)

            server_print = self.instanceServer.idPrettyPrint(server_id)

            if self.clientIcon is None:
                item = QListBoxText(self.listBox, server_print)
            else:
                item = QListBoxPixmap(self.listBox, self.serverIcon,
                                      server_print)
            self.nickname.setText(my_nickname)
            self.connections[server_id[0]] = (item, server_id[1])
            item.setSelectable(False)
            self.haveControl(False, gui_only=True)
            self.initName(my_nickname)
            #self.giveControl.setChecked(False)

            # workaround for the remote access problem
            # (have to disable video display when DC is running)
            camera_brick = None

            for w in qt.QApplication.allWidgets():
                if isinstance(w, BaseComponents.BlissWidget):
                    if "CameraBrick" in str(w.__class__):
                        camera_brick = w
                        camera_brick.installEventFilter(self)
                        break

            # find the video brick, make sure it is hidden when collecting data
            # and that it is shown again when DC is finished
            def disable_video(w=camera_brick):
                w.disable_update()

            self.__disable_video = disable_video

            def enable_video(w=camera_brick):
                w.enable_update()

            self.__enable_video = enable_video
            dispatcher.connect(self.__disable_video, "collect_started")
            dispatcher.connect(self.__enable_video, "collect_finished")

            msg_event=MsgDialogEvent(QMessageBox.Information,\
                "Successfully connected to the server application.",\
                self.font().pointSize())
            qApp.postEvent(self, msg_event)
Beispiel #8
0
    def __init__(self,
                 parent=None,
                 name="Grid Dialog",
                 modal=False,
                 flags=0,
                 canvas=None,
                 matrix=None,
                 event_mgr=None,
                 drawing_object_layer=None):
        super(GridDialog, self).__init__(parent, name, modal, flags)
        self.current_motor_positions = {}
        self.__cell_width = 0
        self.__cell_height = 0
        self.__list_items = {}
        self.__item_counter = 0
        self.__grid_list = []
        self.__main_layout = qt.QVBoxLayout(self, 10, 11, 'main_layout')

        self.__canvas = canvas
        self.__matrix = matrix
        self.__event_mgr = event_mgr
        self.__drawing_object_layer = drawing_object_layer
        self.__drawing_mgr = None
        self.__x_pixel_size = 1
        self.__y_pixel_size = 1
        self.__beam_pos = (0, 0, 0, 0)

        ui_file = 'ui_files/grid_row_widget.ui'
        current_dir = os.path.dirname(__file__)
        widget = qtui.QWidgetFactory.create(os.path.join(current_dir, ui_file))
        widget.reparent(self, qt.QPoint(0, 0))
        self.__main_layout.add(widget)
        self.__list_view = widget.child("list_view")
        self.__visibility_button = widget.child("visibility_button")
        self.__vspace_ledit = widget.child("vspace_ledit")
        self.__hspace_ledit = widget.child("hspace_ledit")

        qt.QObject.connect(widget.child("add_button"), qt.SIGNAL("clicked()"),
                           self.__add_drawing)

        qt.QObject.connect(widget.child("remove_button"),
                           qt.SIGNAL("clicked()"), self.__delete_drawing)

        qt.QObject.connect(self.__visibility_button, qt.SIGNAL("clicked()"),
                           self.__toggle_visibility_grid)

        qt.QObject.connect(self.__vspace_ledit,
                           qt.SIGNAL("textChanged ( const QString & )"),
                           self.__set_vspace)

        qt.QObject.connect(self.__hspace_ledit,
                           qt.SIGNAL("textChanged ( const QString & )"),
                           self.__set_hspace)

        dispatcher.connect(self._get_grid_info, "grid")
        dispatcher.connect(self._set_grid_data, "set_grid_data")

        qt.QObject.connect(widget.child("list_view"),
                           qt.SIGNAL("selectionChanged(QListViewItem * )"),
                           self.__selection_changed)

        self.setCaption("Grid Tool")