예제 #1
0
    def __init__(self, parent, caption = '', minValue = 0, maxValue = 32768, step = 1, unit = ''):
        """Constructor
        
        parent -- the parent QObject
        caption -- a caption string (default: no caption)
        minValue -- minimal accepted value (default: 0)
        maxValue -- maximal accepted value (default: 32768)
        step -- step (default: 1)
        unit -- unit string is appended to the end of the displayed value (default: no string)"""
        ProcedureEntryField.__init__(self, parent, caption)

        box = QWidget(self)
        self.spinbox = QSpinBox(minValue, maxValue, step, box)
        self.spinbox.setSuffix(' ' + str(unit))
        okCancelBox = QHBox(box)
        okCancelBox.setSpacing(0)
        okCancelBox.setMargin(0)
        self.cmdOK = QPushButton(okCancelBox)
        self.cmdCancel = QPushButton(okCancelBox)
        self.cmdOK.setPixmap(Qt4_Icons.load('button_ok_small')) #QPixmap(Icons.okXPM))
        self.cmdOK.setFixedSize(20, 20)
        self.cmdCancel.setPixmap(Qt4_Icons.load('button_cancel_small')) #QPixmap(Icons.cancelXPM))
        self.cmdCancel.setFixedSize(20, 20)
            
        QObject.connect(self.cmdOK, SIGNAL('clicked()'), self.valueChanged)
        QObject.connect(self.cmdCancel, SIGNAL('clicked()'), self.cancelClicked)
        QObject.connect(self.spinbox, SIGNAL('valueChanged(int)'), self.valueChanging)
        
        QHBoxLayout(box, 0, 5)
        box.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
        box.layout().addWidget(self.spinbox, 0, Qt.AlignLeft)
        box.layout().addWidget(okCancelBox, 0, Qt.AlignLeft)
        box.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))

        self.setIsOk(False)
    def __init__(self, *args):

        Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.__init__(self, *args)

        self.light_actuator_hwo = None
        self.light_saved_pos = None

        self.addProperty("light_actuator", "string", "")
        self.addProperty("icons", "string", "")
        self.addProperty("out_delta", "string", "")

        self.light_off_button = QtGui.QPushButton("", self.extra_button_box)
        self.light_off_button.setIcon(Qt4_Icons.load_icon("BulbDelete"))

        self.light_on_button = QtGui.QPushButton("", self.extra_button_box)
        self.light_on_button.setIcon(Qt4_Icons.load_icon("BulbCheck"))

        self.light_on_button.clicked.connect(self.lightButtonOffClicked)
        self.light_off_button.clicked.connect(self.lightButtonOnClicked)

        self.extra_button_box_layout.addWidget(self.light_off_button)
        self.extra_button_box_layout.addWidget(self.light_on_button)

        # self.position_spinbox.close()
        # self.step_button.close()
        # self.stop_button.close()

        self.light_off_button.setToolTip("Switches off the light and sets the intensity to zero")
        self.light_on_button.setToolTip("Switches on the light and sets the intensity back to the previous setting")

        self.light_off_button.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
        self.light_on_button.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
    def __init__(self, parent, caption = ''):
        """Constructor
        
        parent -- the parent QObject
        caption -- a caption string (default: no caption)"""
        ProcedureEntryField.__init__(self, parent, caption)
        
        box = QWidget(self)

        self.savedValue = None
        self.textbox = QLineEdit('', box)
        okCancelBox = QHBox(box)
        okCancelBox.setSpacing(0)
        okCancelBox.setMargin(0)
        self.cmdOK = QPushButton(okCancelBox)
        self.cmdOK.setFixedSize(20, 20)
        self.cmdCancel = QPushButton(okCancelBox)
        self.cmdCancel.setFixedSize(20, 20)
        self.cmdOK.setPixmap(Qt4_Icons.load('button_ok_small')) #QPixmap(Icons.okXPM))
        self.cmdCancel.setPixmap(Qt4_Icons.load('button_cancel_small')) #QPixmap(Icons.cancelXPM))
        
        QObject.connect(self.textbox, SIGNAL('textChanged( const QString & )'), self.valueChanging)
        QObject.connect(self.textbox, SIGNAL('returnPressed()'), self.valueChanged)
        QObject.connect(self.cmdOK, SIGNAL('clicked()'), self.valueChanged)
        QObject.connect(self.cmdCancel, SIGNAL('clicked()'), self.cancelClicked)

        self.cmdCancel.setEnabled(False)
        self.cmdOK.setEnabled(True)

        QHBoxLayout(box, 0, 5)
        box.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
        box.layout().addWidget(self.textbox, 0, Qt.AlignLeft)
        box.layout().addWidget(okCancelBox, 0, Qt.AlignLeft)
        box.layout().addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
    def propertyChanged(self, property, oldValue, newValue):

        if property == "light_actuator":
            if self.light_actuator_hwo is not None:
                self.disconnect(self.light_actuator_hwo, "wagoStateChanged", self.lightStateChanged)

            self.light_actuator_hwo = self.getHardwareObject(newValue)
            if self.light_actuator_hwo is not None:
                self.connect(self.light_actuator_hwo, "wagoStateChanged", self.lightStateChanged)
                self.lightStateChanged(self.light_actuator_hwo.getState())

        elif property == "icons":
            icons_list = newValue.split()
            try:
                self.light_off_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))
                self.light_on_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
            except IndexError:
                pass
        elif property == "mnemonic":
            Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.propertyChanged(self, property, oldValue, newValue)
            if self.motor_hwobj is not None:
                if self.motor_hwobj.isReady():
                    limits = self.motor_hwobj.getLimits()
                    motor_range = float(limits[1] - limits[0])
                    self["delta"] = str(motor_range / 10.0)
                else:
                    self["delta"] = 1.0
        else:
            Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.propertyChanged(self, property, oldValue, newValue)
예제 #5
0
 def propertyChanged(self, property_name, old_value, new_value):
     if property_name == 'label':
         if new_value == "" and self.motor_hwobj is not None:
             self.label.setText("<i>" + self.motor_hwobj.username + ":</i>")
         else:
             self.label.setText(new_value)
     elif property_name == 'mnemonic':
         if self.motor_hwobj is not None:
             self.disconnect(self.motor_hwobj, 'stateChanged',
                             self.motor_state_changed)
             self.disconnect(self.motor_hwobj, 'newPredefinedPositions',
                             self.fill_positions)
             self.disconnect(self.motor_hwobj, 'predefinedPositionChanged',
                             self.predefined_position_changed)
         self.motor_hwobj = self.getHardwareObject(new_value)
         if self.motor_hwobj is not None:
             self.connect(self.motor_hwobj, 'newPredefinedPositions',
                          self.fill_positions)
             self.connect(self.motor_hwobj, 'stateChanged',
                          self.motor_state_changed)
             self.connect(self.motor_hwobj, 'predefinedPositionChanged',
                          self.predefined_position_changed)
             self.fill_positions()
             if self.motor_hwobj.is_ready():
                 if hasattr(self.motor_hwobj, "getCurrentPositionName"):
                     self.predefined_position_changed(
                         self.motor_hwobj.getCurrentPositionName(), 0)
                 else:
                     self.predefined_position_changed(
                         self.motor_hwobj.get_current_position_name(), 0)
             if self['label'] == "":
                 lbl = self.motor_hwobj.username
                 self.label.setText("<i>" + lbl + ":</i>")
             Qt4_widget_colors.set_widget_color(
                 self.positions_combo,
                 Qt4_MotorPredefPosBrick.STATE_COLORS[0], QPalette.Button)
             #TODO remove this check
             if hasattr(self.motor_hwobj, "getState"):
                 self.motor_state_changed(self.motor_hwobj.getState())
             else:
                 self.motor_state_changed(self.motor_hwobj.get_state())
     elif property_name == 'showMoveButtons':
         if new_value:
             self.previous_position_button.show()
             self.next_position_button.show()
         else:
             self.previous_position_button.hide()
             self.next_position_button.hide()
     elif property_name == 'icons':
         icons_list = new_value.split()
         try:
             self.previous_position_button.setIcon(\
                 Qt4_Icons.load_icon(icons_list[0]))
             self.next_position_button.setIcon(\
                 Qt4_Icons.load_icon(icons_list[1]))
         except:
             pass
     else:
         BlissWidget.propertyChanged(self, property_name, old_value,
                                     new_value)
    def __init__(self, parent=None):
        """
        Descript. : parent (QTreeWidget) : Item's QTreeWidget parent.
        """

        QtGui.QWidget.__init__(self, parent)
       
        self.OK = QtGui.QToolButton(parent)
        self.OK.setAutoRaise(True)
        self.OK.setIcon(QtGui.QIcon(Qt4_Icons.load('button_ok_small'))) #QPixmap(Icons.tinyOK)))
        self.Cancel = QtGui.QToolButton(parent)
        self.Cancel.setAutoRaise(True)
        self.Cancel.setIcon(QtGui.QIcon(Qt4_Icons.load('button_cancel_small'))) #QPixmap(Icons.tinyCancel)))
        self.Reset = QtGui.QToolButton(parent)
        self.Reset.setIcon(QtGui.QIcon(Qt4_Icons.load('button_default_small'))) #QPixmap(Icons.defaultXPM)))
        self.Reset.setAutoRaise(True)
        self.setEnabled(False)

        main_layout = QtGui.QHBoxLayout()
        main_layout.addWidget(self.OK)
        main_layout.addWidget(self.Cancel)
        main_layout.addWidget(self.Reset)
        main_layout.setSpacing(0)
        main_layout.setContentsMargins(0,0,0,0)
        self.setLayout(main_layout)
예제 #7
0
 def centring_in_progress_changed(self, centring_in_progress):
     if centring_in_progress:
         self.manager_widget.create_point_start_button.setIcon(\
          Qt4_Icons.load_icon("Delete"))
     else:
         self.manager_widget.create_point_start_button.setIcon(\
          Qt4_Icons.load_icon("VCRPlay2"))
    def propertyChanged(self, property, oldValue, newValue):

        if property == 'light_actuator':
            if self.light_actuator_hwo is not None:
                self.disconnect(self.light_actuator_hwo, 'wagoStateChanged',
                                self.lightStateChanged)

            self.light_actuator_hwo = self.getHardwareObject(newValue)
            if self.light_actuator_hwo is not None:
                self.connect(self.light_actuator_hwo, 'wagoStateChanged',
                             self.lightStateChanged)
                self.lightStateChanged(self.light_actuator_hwo.getState())

        elif property == 'icons':
            icons_list = newValue.split()
            try:
                self.light_off_button.setIcon(
                    Qt4_Icons.load_icon(icons_list[0]))
                self.light_on_button.setIcon(Qt4_Icons.load_icon(
                    icons_list[1]))
            except IndexError:
                pass
        elif property == 'mnemonic':
            Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.propertyChanged(
                self, property, oldValue, newValue)
            if self.motor_hwobj is not None:
                if self.motor_hwobj.isReady():
                    limits = self.motor_hwobj.getLimits()
                    motor_range = float(limits[1] - limits[0])
                    self['delta'] = str(motor_range / 10.0)
                else:
                    self['delta'] = 1.0
        else:
            Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.propertyChanged(
                self, property, oldValue, newValue)
예제 #9
0
    def propertyChanged(self, property, oldValue, newValue):
        if property == 'mnemonic':
	    if self.slitbox_hwobj is not None:
		self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('gapSizeChanged'), self.gap_value_changed)
		self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('statusChanged'), self.gap_status_changed)
	        self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('focModeChanged'), self.focModeChanged)
	        self.disconnect(self.slitbox_hwobj, QtCore.SIGNAL('gapLimitsChanged'), self.gapLimitsChanged)
	    self.slitbox_hwobj = self.getHardwareObject(newValue)
	    if self.slitbox_hwobj is not None:
		self.connect(self.slitbox_hwobj, QtCore.SIGNAL('gapSizeChanged'), self.gap_value_changed)
		self.connect(self.slitbox_hwobj, QtCore.SIGNAL('statusChanged'), self.gap_status_changed)
                self.connect(self.slitbox_hwobj, QtCore.SIGNAL('focModeChanged'), self.focModeChanged)
	        self.connect(self.slitbox_hwobj, QtCore.SIGNAL('gapLimitsChanged'), self.gapLimitsChanged)

                self.slitbox_hwobj.update_values()
            	self.slitBoxReady()
	    else:
                self.slitBoxNotReady()
	elif property == 'icons':
            icons_list=newValue.split()
            try:
		self.set_hor_gap_button.setIcon(Qt4_Icons.load_icon(icons_list[0])) 
		self.set_ver_gap_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))                  
		self.stop_hor_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
        	self.stop_ver_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
            except IndexError:
                self.set_hor_gap_button.setText("Set")
                self.set_ver_gap_button.setText("Set")
                self.stop_hor_button.setText("Stop")
                self.stop_ver_button.setText("Stop")
        else:
            BlissWidget.propertyChanged(self,property,oldValue,newValue)
예제 #10
0
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.motor_hwobj = None

        # Internal values -----------------------------------------------------

        self.positions = None
        # Properties ----------------------------------------------------------
        self.addProperty('label', 'string', '')
        self.addProperty('mnemonic', 'string', '')
        self.addProperty('icons', 'string', '')
        self.addProperty('showMoveButtons', 'boolean', True)

        # Signals -------------------------------------------------------------

        # Slots ---------------------------------------------------------------
        self.defineSlot('setEnabled', ())

        # Graphic elements ----------------------------------------------------
        _group_box = QGroupBox(self)
        self.label = QLabel("motor:", _group_box)
        self.positions_combo = QComboBox(_group_box)
        self.previous_position_button = QPushButton(_group_box)
        self.next_position_button = QPushButton(_group_box)

        # Layout --------------------------------------------------------------
        _group_box_hlayout = QHBoxLayout(_group_box)
        _group_box_hlayout.addWidget(self.label)
        _group_box_hlayout.addWidget(self.positions_combo)
        _group_box_hlayout.addWidget(self.previous_position_button)
        _group_box_hlayout.addWidget(self.next_position_button)
        _group_box_hlayout.setSpacing(2)
        _group_box_hlayout.setContentsMargins(2, 2, 2, 2)

        main_layout = QHBoxLayout(self)
        main_layout.addWidget(_group_box)
        main_layout.setSpacing(0)
        main_layout.setContentsMargins(0, 0, 0, 0)

        # Size Policy ---------------------------------------------------------
        #box1.setSizePolicy(QtGui.QSizePolicy.Fixed,
        #                   QtGui.QSizePolicy.Fixed)
        self.label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        #self.setSizePolicy(QtGui.QSizePolicy.Minimum,
        #                   QtGui.QSizePolicy.Fixed)
        # Qt signal/slot connections ------------------------------------------
        self.positions_combo.activated.connect(self.position_selected)
        self.previous_position_button.clicked.connect(
            self.select_previous_position)
        self.next_position_button.clicked.connect(self.select_next_position)

        # Other ---------------------------------------------------------------
        self.positions_combo.setToolTip(
            "Moves the motor to a predefined position")
        self.previous_position_button.setIcon(Qt4_Icons.load_icon('Minus2'))
        self.previous_position_button.setFixedWidth(27)
        self.next_position_button.setIcon(Qt4_Icons.load_icon('Plus2'))
        self.next_position_button.setFixedWidth(27)
예제 #11
0
 def propertyChanged(self, property_name, old_value, new_value):
     """
     Descript. :
     """
     if property_name == 'ldapServer':
         self.ldap_connection_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'codes':
         self.setCodes(new_value)
     elif property_name == 'localLogin':
         self.local_login_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'dbConnection':
         self.lims_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'instanceServer':
         if self.instanceServer is not None:
             self.disconnect(self.instanceServer, QtCore.SIGNAL('passControl'), self.passControl)
             self.disconnect(self.instanceServer, QtCore.SIGNAL('haveControl'), self.haveControl)
         self.instanceServer = self.getHardwareObject(new_value)
         if self.instanceServer is not None:
             self.connect(self.instanceServer, QtCore.SIGNAL('passControl'), self.passControl)
             self.connect(self.instanceServer, QtCore.SIGNAL('haveControl'), self.haveControl)
     elif property_name == 'icons':
         icons_list = new_value.split()
         try:
             self.login_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[0])))
         except IndexError:
             pass
         try:
             self.logout_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[1])))
         except IndexError:
             pass
     elif property_name == 'session':
         self.session_hwobj = self.getHardwareObject(new_value)
     else:
         BlissWidget.propertyChanged(self, property_name, old_value, new_value)
예제 #12
0
    def __init__(self, parent=None):
        """
        Descript. : parent (QTreeWidget) : Item's QTreeWidget parent.
        """

        QtGui.QWidget.__init__(self, parent)

        self.OK = QtGui.QToolButton(parent)
        self.OK.setAutoRaise(True)
        self.OK.setIcon(QtGui.QIcon(
            Qt4_Icons.load('button_ok_small')))  #QPixmap(Icons.tinyOK)))
        self.Cancel = QtGui.QToolButton(parent)
        self.Cancel.setAutoRaise(True)
        self.Cancel.setIcon(QtGui.QIcon(Qt4_Icons.load(
            'button_cancel_small')))  #QPixmap(Icons.tinyCancel)))
        self.Reset = QtGui.QToolButton(parent)
        self.Reset.setIcon(QtGui.QIcon(Qt4_Icons.load(
            'button_default_small')))  #QPixmap(Icons.defaultXPM)))
        self.Reset.setAutoRaise(True)
        self.setEnabled(False)

        main_layout = QtGui.QHBoxLayout()
        main_layout.addWidget(self.OK)
        main_layout.addWidget(self.Cancel)
        main_layout.addWidget(self.Reset)
        main_layout.setSpacing(0)
        main_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(main_layout)
예제 #13
0
 def centring_in_progress_changed(self, centring_in_progress):
     if centring_in_progress:
         self.manager_widget.create_point_start_button.setIcon(\
          Qt4_Icons.load_icon("Delete"))
     else:
         self.manager_widget.create_point_start_button.setIcon(\
          Qt4_Icons.load_icon("VCRPlay2"))
예제 #14
0
    def __init__(self, *args):

        Qt4_MotorSpinBoxBrick.Qt4_MotorSpinBoxBrick.__init__(self, *args)

        self.light_actuator_hwo = None
        self.light_saved_pos=None

        self.addProperty('light_actuator', 'string', '')
        self.addProperty('icons', 'string', '')
        self.addProperty('out_delta', 'string', '')

        self.light_off_button=QPushButton(self.main_gbox)
        self.light_off_button.setIcon(Qt4_Icons.load_icon('BulbDelete'))
        self.light_off_button.setFixedSize(27, 27)
        
        self.light_on_button=QPushButton(self.main_gbox)
        self.light_on_button.setIcon(Qt4_Icons.load_icon('BulbCheck'))
        self.light_on_button.setFixedSize(27, 27)
        
        self.light_off_button.clicked.connect(self.lightButtonOffClicked)
        self.light_on_button.clicked.connect(self.lightButtonOnClicked)

        self._gbox_hbox_layout.addWidget(self.light_off_button)
        self._gbox_hbox_layout.addWidget(self.light_on_button)

        self.light_off_button.setToolTip("Switches off the light and sets the intensity to zero")
        self.light_on_button.setToolTip("Switches on the light and sets the intensity back to the previous setting")        

        self.light_off_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.light_on_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        def addConnection(senderWindow, sender, connection):
            newItem = QtGui.QTreeWidgetItem(self.connections_treewidget)

            windowName = senderWindow["name"]
            
            newItem.setText(1, windowName)

            if sender != senderWindow:
                # object-*
                newItem.setText(2, sender["name"])
            
            newItem.setText(4, connection["receiverWindow"])
                
            try:
                receiverWindow = self.configuration.windows[connection["receiverWindow"]]
            except KeyError:
                receiverWindow = {}
                ok = False
            else:
                ok = True

            if len(connection["receiver"]):
                # *-object
                newItem.setText(5, connection["receiver"])

                ok = ok and receiverInWindow(connection["receiver"], receiverWindow)

            if ok:
                newItem.setIcon(0, QtGui.QIcon(Qt4_Icons.load('button_ok_small')))
            else:
                newItem.setIcon(0, QtGui.QIcon(Qt4_Icons.load('button_cancel_small')))

            newItem.setText(3, connection['signal'])
            newItem.setText(6, connection['slot'])
    def __init__(self, *args):
        BlissWidget.__init__(self, *args)

        # Hardware objects ----------------------------------------------------
        self.motor_hwobj = None

        # Internal values -----------------------------------------------------

        self.positions = None
        # Properties ----------------------------------------------------------
        self.addProperty('label','string','')
        self.addProperty('mnemonic', 'string', '')
        self.addProperty('icons', 'string', '')
        self.addProperty('showMoveButtons', 'boolean', True)

        # Signals -------------------------------------------------------------

        # Slots ---------------------------------------------------------------
        self.defineSlot('setEnabled',())

        # Graphic elements ----------------------------------------------------
        _group_box = QtGui.QGroupBox(self)
        self.label = QtGui.QLabel("motor:", _group_box)
        self.positions_combo = QtGui.QComboBox(_group_box)
        self.previous_position_button = QtGui.QPushButton(_group_box)
        self.next_position_button = QtGui.QPushButton(_group_box)

        # Layout -------------------------------------------------------------- 
        _group_box_hlayout = QtGui.QHBoxLayout(_group_box)
        _group_box_hlayout.addWidget(self.label)
        _group_box_hlayout.addWidget(self.positions_combo) 
        _group_box_hlayout.addWidget(self.previous_position_button)
        _group_box_hlayout.addWidget(self.next_position_button)
        _group_box_hlayout.setSpacing(2)
        _group_box_hlayout.setContentsMargins(2, 2, 2, 2)

        main_layout = QtGui.QHBoxLayout(self)
        main_layout.addWidget(_group_box)
        main_layout.setSpacing(0)
        main_layout.setContentsMargins(0, 0, 0, 0)

        # Size Policy ---------------------------------------------------------
        #box1.setSizePolicy(QtGui.QSizePolicy.Fixed, 
        #                   QtGui.QSizePolicy.Fixed)
        self.label.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                 QtGui.QSizePolicy.Fixed)
        #self.setSizePolicy(QtGui.QSizePolicy.Minimum,
        #                   QtGui.QSizePolicy.Fixed)
        # Qt signal/slot connections ------------------------------------------
        self.positions_combo.activated.connect(self.position_selected)
        self.previous_position_button.clicked.connect(self.select_previous_position)
        self.next_position_button.clicked.connect(self.select_next_position)

        # Other ---------------------------------------------------------------
        self.positions_combo.setToolTip("Moves the motor to a predefined position")
        self.previous_position_button.setIcon(Qt4_Icons.load_icon('Minus2'))
        self.previous_position_button.setFixedWidth(27) 
        self.next_position_button.setIcon(Qt4_Icons.load_icon('Plus2'))
        self.next_position_button.setFixedWidth(27)
예제 #17
0
 def setIcons(self, load_icon, unload_icon):
     self.load_icon = Qt4_Icons.load_icon(load_icon)
     self.unload_icon = Qt4_Icons.load_icon(unload_icon)
     txt = str(self.load_button.text()).split()[0]
     if txt == "Mount":
         self.load_button.setIcon(self.load_icon)
     elif txt == "Unmount":
         self.load_button.setIcon(self.unload_icon)
예제 #18
0
 def setIcons(self,load_icon,unload_icon):
     self.load_icon = Qt4_Icons.load_icon(load_icon)
     self.unload_icon = Qt4_Icons.load_icon(unload_icon)
     txt=str(self.buttonLoad.text()).split()[0]
     if txt == "Mount":
         self.buttonLoad.setIcon(self.load_icon)
     elif txt == "Unmount":
         self.buttonLoad.setIcon(self.unload_icon)
 def set_icons(self, icons):
     icons = icons.split(",")
     if len(icons) == 2:
         self.icons = {
             'on': Qt4_Icons.load_icon(icons[0]),
             'off': Qt4_Icons.load_icon(icons[1])
         }
         self.widget.button.setIcon(self.icons["on"])
예제 #20
0
    def propertyChanged(self, property_name, old_value, new_value):
        if property_name == 'mnemonic':
            hwobj_names_list = new_value.split()
            for hwobj_name in hwobj_names_list:
                temp_motor_hwobj = self.getHardwareObject(hwobj_name)
                temp_motor_widget = Qt4_MotorSpinBoxBrick(self)
                temp_motor_widget.set_motor(temp_motor_hwobj, hwobj_name)
                temp_motor_widget.move_left_button.setVisible(
                    self['showMoveButtons'])
                temp_motor_widget.move_right_button.setVisible(
                    self['showMoveButtons'])
                temp_motor_widget.step_button.setVisible(self['showStep'])
                temp_motor_widget.stop_button.setVisible(self['showStop'])
                temp_motor_widget.set_line_step(self['defaultStep'])
                temp_motor_widget['defaultStep'] = self['defaultStep']
                temp_motor_widget['delta'] = self['delta']
                temp_motor_widget.step_changed(None)
                self.main_groupbox_hlayout.addWidget(temp_motor_widget)

                self.motor_hwobj_list.append(temp_motor_hwobj)
                self.motor_widget_list.append(temp_motor_widget)

            self.enable_motors_buttons.setVisible(self['showEnableButtons'])
            self.disable_motors_buttons.setVisible(self['showEnableButtons'])
            if self['showEnableButtons']:
                self.main_groupbox_hlayout.addWidget(
                    self.enable_motors_buttons)
                self.main_groupbox_hlayout.addWidget(
                    self.disable_motors_buttons)
            if len(self.motor_widget_labels):
                for index, label in enumerate(self.motor_widget_labels):
                    self.motor_widget_list[index].setLabel(label)
        elif property_name == 'moveButtonIcons':
            icon_list = new_value.split()
            for index in range(len(icon_list) - 1):
                if index % 2 == 0:
                    self.motor_widget_list[index / 2].move_left_button.setIcon(\
                         Qt4_Icons.load_icon(icon_list[index]))
                    self.motor_widget_list[index / 2].move_right_button.setIcon(\
                         Qt4_Icons.load_icon(icon_list[index + 1]))
        elif property_name == 'labels':
            self.motor_widget_labels = new_value.split()
            if len(self.motor_widget_list):
                for index, label in enumerate(self.motor_widget_labels):
                    self.motor_widget_list[index].setLabel(label)
        elif property_name == 'predefinedPositions':
            self.predefined_positions_list = new_value.split()
            for predefined_position in self.predefined_positions_list:
                temp_position_button = QPushButton(predefined_position,
                                                   self.main_group_box)
                self.main_groupbox_hlayout.addWidget(temp_position_button)
                temp_position_button.clicked.connect(lambda: \
                     self.predefined_position_clicked(predefined_position))
        else:
            BlissWidget.propertyChanged(self, property_name, old_value,
                                        new_value)
 def propertyChanged(self, property_name, old_value, new_value):
     if property_name == 'label':
         if new_value == "" and self.motor_hwobj is not None:
             self.label.setText("<i>" + self.motor_hwobj.username + ":</i>")
         else:
             self.label.setText(new_value)
     elif property_name == 'mnemonic':
         if self.motor_hwobj is not None:
             self.disconnect(self.motor_hwobj,
                             'stateChanged',
                             self.motor_state_changed)
             self.disconnect(self.motor_hwobj,
                             'newPredefinedPositions',
                             self.fill_positions)
             self.disconnect(self.motor_hwobj,
                             'predefinedPositionChanged',
                             self.predefined_position_changed)
         self.motor_hwobj = self.getHardwareObject(new_value)
         if self.motor_hwobj is not None:
             self.connect(self.motor_hwobj,
                          'newPredefinedPositions',
                          self.fill_positions)
             self.connect(self.motor_hwobj,
                          'stateChanged',
                          self.motor_state_changed)
             self.connect(self.motor_hwobj,
                          'predefinedPositionChanged',
                          self.predefined_position_changed)
             self.fill_positions()
             if self.motor_hwobj.isReady():
                 self.predefined_position_changed(self.motor_hwobj.getCurrentPositionName(), 0)
             if self['label'] == "":
                 lbl=self.motor_hwobj.username
                 self.label.setText("<i>" + lbl + ":</i>")
             Qt4_widget_colors.set_widget_color(self.positions_combo,
                                                Qt4_MotorPredefPosBrick.STATE_COLORS[0],
                                                QPalette.Button)
             self.motor_state_changed(self.motor_hwobj.getState())
     elif property_name == 'showMoveButtons':
         if new_value:
             self.previous_position_button.show()
             self.next_position_button.show()
         else:
             self.previous_position_button.hide()
             self.next_position_button.hide()
     elif property_name == 'icons':
         icons_list = new_value.split()
         try:
             self.previous_position_button.setIcon(\
                 Qt4_Icons.load_icon(icons_list[0]))
             self.next_position_button.setIcon(\
                 Qt4_Icons.load_icon(icons_list[1]))
         except:
             pass
     else:
         BlissWidget.propertyChanged(self,property_name, old_value, new_value)
예제 #22
0
 def set_icons(self, icon_run, icon_stop):
     """
     Descript. : 
     Args.     : 
     Return    : 
     """
     self.run_icon = Qt4_Icons.load_icon(icon_run)
     self.stop_icon = Qt4_Icons.load_icon(icon_stop)
     if self.executing:
         self.setIcon(self.stop_icon)
     else:
         self.setIcon(self.run_icon)
예제 #23
0
 def set_icons(self, icon_run, icon_stop):
     """
     Descript. : 
     Args.     : 
     Return    : 
     """
     self.run_icon = Qt4_Icons.load_icon(icon_run)
     self.stop_icon = Qt4_Icons.load_icon(icon_stop)
     if self.executing:
         self.setIcon(self.stop_icon)
     else:
         self.setIcon(self.run_icon)
예제 #24
0
    def __init__(self, parent):
        """
        Descript. :
        """
        QDialog.__init__(self, parent)
        # Graphic elements-----------------------------------------------------
        #self.main_gbox = QtGui.QGroupBox('Motor step', self)
        #box2 = QtGui.QWidget(self)
        self.grid = QWidget(self)
        label1 = QLabel("Current:", self)
        self.current_step = QLineEdit(self)
        self.current_step.setEnabled(False)
        label2 = QLabel("Set to:", self)
        self.new_step = QLineEdit(self)
        self.new_step.setAlignment(Qt.AlignRight)
        self.new_step.setValidator(QDoubleValidator(self))

        self.button_box = QWidget(self)
        self.apply_button = QPushButton("Apply", self.button_box)
        self.close_button = QPushButton("Dismiss", self.button_box)

        # Layout --------------------------------------------------------------
        self.button_box_layout = QHBoxLayout(self.button_box)
        self.button_box_layout.addWidget(self.apply_button)
        self.button_box_layout.addWidget(self.close_button)

        self.grid_layout = QGridLayout(self.grid)
        self.grid_layout.addWidget(label1, 0, 0)
        self.grid_layout.addWidget(self.current_step, 0, 1)
        self.grid_layout.addWidget(label2, 1, 0)
        self.grid_layout.addWidget(self.new_step, 1, 1)

        self.main_layout = QVBoxLayout(self)
        self.main_layout.addWidget(self.grid)
        self.main_layout.addWidget(self.button_box)
        self.main_layout.setSpacing(0)
        self.main_layout.setContentsMargins(0, 0, 0, 0)

        # Qt signal/slot connections -----------------------------------------
        self.new_step.returnPressed.connect(self.apply_clicked)
        self.apply_button.clicked.connect(self.apply_clicked)
        self.close_button.clicked.connect(self.accept)

        # SizePolicies --------------------------------------------------------
        self.close_button.setSizePolicy(QSizePolicy.Fixed,
                                        QSizePolicy.Fixed)
        self.setSizePolicy(QSizePolicy.Minimum,
                           QSizePolicy.Minimum)
 
        # Other ---------------------------------------------------------------
        self.setWindowTitle("Motor step editor")
        self.apply_button.setIcon(Qt4_Icons.load_icon("Check"))
        self.close_button.setIcon(Qt4_Icons.load_icon("Delete"))
예제 #25
0
    def propertyChanged(self, property, oldValue, newValue):
        if property == 'mnemonic':
            if self.slitbox_hwobj is not None:
                self.disconnect(self.slitbox_hwobj,
                                QtCore.SIGNAL('gapSizeChanged'),
                                self.gap_value_changed)
                self.disconnect(self.slitbox_hwobj,
                                QtCore.SIGNAL('statusChanged'),
                                self.gap_status_changed)
                self.disconnect(self.slitbox_hwobj,
                                QtCore.SIGNAL('focModeChanged'),
                                self.focModeChanged)
                self.disconnect(self.slitbox_hwobj,
                                QtCore.SIGNAL('gapLimitsChanged'),
                                self.gapLimitsChanged)
            self.slitbox_hwobj = self.getHardwareObject(newValue)
            if self.slitbox_hwobj is not None:
                self.connect(self.slitbox_hwobj,
                             QtCore.SIGNAL('gapSizeChanged'),
                             self.gap_value_changed)
                self.connect(self.slitbox_hwobj,
                             QtCore.SIGNAL('statusChanged'),
                             self.gap_status_changed)
                self.connect(self.slitbox_hwobj,
                             QtCore.SIGNAL('focModeChanged'),
                             self.focModeChanged)
                self.connect(self.slitbox_hwobj,
                             QtCore.SIGNAL('gapLimitsChanged'),
                             self.gapLimitsChanged)

                self.slitbox_hwobj.update_values()
                self.slitBoxReady()
            else:
                self.slitBoxNotReady()
        elif property == 'icons':
            icons_list = newValue.split()
            try:
                self.set_hor_gap_button.setIcon(
                    Qt4_Icons.load_icon(icons_list[0]))
                self.set_ver_gap_button.setIcon(
                    Qt4_Icons.load_icon(icons_list[0]))
                self.stop_hor_button.setIcon(Qt4_Icons.load_icon(
                    icons_list[1]))
                self.stop_ver_button.setIcon(Qt4_Icons.load_icon(
                    icons_list[1]))
            except IndexError:
                self.set_hor_gap_button.setText("Set")
                self.set_ver_gap_button.setText("Set")
                self.stop_hor_button.setText("Stop")
                self.stop_ver_button.setText("Stop")
        else:
            BlissWidget.propertyChanged(self, property, oldValue, newValue)
예제 #26
0
    def __init__(self, parent):
        """
        Descript. :
        """
        QDialog.__init__(self, parent)
        # Graphic elements-----------------------------------------------------
        #self.main_gbox = QtGui.QGroupBox('Motor step', self)
        #box2 = QtGui.QWidget(self)
        self.grid = QWidget(self)
        label1 = QLabel("Current:", self)
        self.current_step = QLineEdit(self)
        self.current_step.setEnabled(False)
        label2 = QLabel("Set to:", self)
        self.new_step = QLineEdit(self)
        self.new_step.setAlignment(Qt.AlignRight)
        self.new_step.setValidator(QDoubleValidator(self))

        self.button_box = QWidget(self)
        self.apply_button = QPushButton("Apply", self.button_box)
        self.close_button = QPushButton("Dismiss", self.button_box)

        # Layout --------------------------------------------------------------
        self.button_box_layout = QHBoxLayout(self.button_box)
        self.button_box_layout.addWidget(self.apply_button)
        self.button_box_layout.addWidget(self.close_button)

        self.grid_layout = QGridLayout(self.grid)
        self.grid_layout.addWidget(label1, 0, 0)
        self.grid_layout.addWidget(self.current_step, 0, 1)
        self.grid_layout.addWidget(label2, 1, 0)
        self.grid_layout.addWidget(self.new_step, 1, 1)

        self.main_layout = QVBoxLayout(self)
        self.main_layout.addWidget(self.grid)
        self.main_layout.addWidget(self.button_box)
        self.main_layout.setSpacing(0)
        self.main_layout.setContentsMargins(0, 0, 0, 0)

        # Qt signal/slot connections -----------------------------------------
        self.new_step.returnPressed.connect(self.apply_clicked)
        self.apply_button.clicked.connect(self.apply_clicked)
        self.close_button.clicked.connect(self.accept)

        # SizePolicies --------------------------------------------------------
        self.close_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

        # Other ---------------------------------------------------------------
        self.setWindowTitle("Motor step editor")
        self.apply_button.setIcon(Qt4_Icons.load_icon("Check"))
        self.close_button.setIcon(Qt4_Icons.load_icon("Delete"))
    def propertyChanged(self, property_name, old_value, new_value):
        if property_name == 'mnemonic':
            hwobj_names_list = new_value.split()
            for hwobj_name in hwobj_names_list:
                temp_motor_hwobj = self.getHardwareObject(hwobj_name)
                temp_motor_widget = Qt4_MotorSpinBoxBrick(self)
                temp_motor_widget.set_motor(temp_motor_hwobj, hwobj_name)
                temp_motor_widget.move_left_button.setVisible(self['showMoveButtons'])
                temp_motor_widget.move_right_button.setVisible(self['showMoveButtons'])
                temp_motor_widget.step_button.setVisible(self['showStep'])
                temp_motor_widget.stop_button.setVisible(self['showStop'])
                temp_motor_widget.set_line_step(self['defaultStep'])
                temp_motor_widget['defaultStep'] = self['defaultStep']
                temp_motor_widget['delta'] = self['delta']
                temp_motor_widget.step_changed(None)
                self.main_groupbox_hlayout.addWidget(temp_motor_widget)

                self.motor_hwobj_list.append(temp_motor_hwobj)
                self.motor_widget_list.append(temp_motor_widget)

            self.enable_motors_buttons.setVisible(self['showEnableButtons'])
            self.disable_motors_buttons.setVisible(self['showEnableButtons']) 
            if self['showEnableButtons']:
                self.main_groupbox_hlayout.addWidget(self.enable_motors_buttons)
                self.main_groupbox_hlayout.addWidget(self.disable_motors_buttons)
            if len(self.motor_widget_labels):      
                for index, label in enumerate(self.motor_widget_labels):
                    self.motor_widget_list[index].setLabel(label)
        elif property_name == 'moveButtonIcons':
            icon_list = new_value.split()
            for index in range(len(icon_list) - 1):
                if index % 2 == 0:
                    self.motor_widget_list[index / 2].move_left_button.setIcon(\
                         Qt4_Icons.load_icon(icon_list[index]))
                    self.motor_widget_list[index / 2].move_right_button.setIcon(\
                         Qt4_Icons.load_icon(icon_list[index + 1])) 
        elif property_name == 'labels':
            self.motor_widget_labels = new_value.split()
            if len(self.motor_widget_list):
                for index, label in enumerate(self.motor_widget_labels):
                    self.motor_widget_list[index].setLabel(label)            
        elif property_name == 'predefinedPositions':
            self.predefined_positions_list = new_value.split()
            for predefined_position in self.predefined_positions_list:
                temp_position_button = QtGui.QPushButton(predefined_position, self.main_group_box)
                self.main_groupbox_hlayout.addWidget(temp_position_button)
                temp_position_button.clicked.connect(lambda: \
                     self.predefined_position_clicked(predefined_position))
        else:
            BlissWidget.propertyChanged(self,property_name, old_value, new_value)
예제 #28
0
 def propertyChanged(self, property_name, old_value, new_value):
     """
     Descript. :
     """
     if property_name == 'codes':
         self.setCodes(new_value)
     elif property_name == 'localLogin':
         self.local_login_hwobj = self.getHardwareObject(new_value, optional=True)
     elif property_name == 'dbConnection':
         self.lims_hwobj = self.getHardwareObject(new_value)
         self.login_as_user = self.lims_hwobj.get_login_type() == "user"
         if self.login_as_user:
            self.login_as_user_widget.show()
            self.login_as_proposal_widget.hide()
         else:
            self.login_as_user_widget.hide()
            self.login_as_proposal_widget.show()
     elif property_name == 'instanceServer':
         if self.instanceServer is not None:
             self.disconnect(self.instanceServer,
                             'passControl',
                             self.passControl)
             self.disconnect(self.instanceServer,
                             'haveControl',
                             self.haveControl)
         self.instanceServer = self.getHardwareObject(new_value, optional=True)
         if self.instanceServer is not None:
             self.connect(self.instanceServer,
                          'passControl',
                          self.passControl)
             self.connect(self.instanceServer,
                          'haveControl',
                          self.haveControl)
     elif property_name == 'icons':
         icons_list = new_value.split()
         try:
             self.login_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))
         except IndexError:
             pass
         try:
             self.logout_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
         except IndexError:
             pass
     elif property_name == 'session':
         self.session_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'secondaryProposals':
         self.secondary_proposals = new_value.split() 
     else:
         BlissWidget.propertyChanged(self, property_name, old_value, new_value)
예제 #29
0
 def propertyChanged(self, property_name, old_value, new_value):
     """
     Descript. :
     """
     if property_name == 'codes':
         self.setCodes(new_value)
     elif property_name == 'localLogin':
         self.local_login_hwobj = self.getHardwareObject(new_value, optional=True)
     elif property_name == 'dbConnection':
         self.lims_hwobj = self.getHardwareObject(new_value)
         self.login_as_user = self.lims_hwobj.get_login_type() == "user"
         if self.login_as_user:
            self.login_as_user_widget.show()
            self.login_as_proposal_widget.hide()
         else:
            self.login_as_user_widget.hide()
            self.login_as_proposal_widget.show()
     elif property_name == 'instanceServer':
         if self.instanceServer is not None:
             self.disconnect(self.instanceServer,
                             'passControl',
                             self.passControl)
             self.disconnect(self.instanceServer,
                             'haveControl',
                             self.haveControl)
         self.instanceServer = self.getHardwareObject(new_value, optional=True)
         if self.instanceServer is not None:
             self.connect(self.instanceServer,
                          'passControl',
                          self.passControl)
             self.connect(self.instanceServer,
                          'haveControl',
                          self.haveControl)
     elif property_name == 'icons':
         icons_list = new_value.split()
         try:
             self.login_button.setIcon(Qt4_Icons.load_icon(icons_list[0]))
         except IndexError:
             pass
         try:
             self.logout_button.setIcon(Qt4_Icons.load_icon(icons_list[1]))
         except IndexError:
             pass
     elif property_name == 'session':
         self.session_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'secondaryProposals':
         self.secondary_proposals = new_value.split() 
     else:
         BlissWidget.propertyChanged(self, property_name, old_value, new_value)
예제 #30
0
    def __init__(self, *args):
        """
        Descript. :
        """
        QtGui.QWidget.__init__(self, *args)

        self.value_plot = None

        self.title_label = QtGui.QLabel(self)
        self.value_widget = QtGui.QWidget(self)
        self.value_label = QtGui.QLabel(self.value_widget)
        self.value_label.setAlignment(QtCore.Qt.AlignCenter)
        self.history_button = QtGui.QPushButton(\
             Qt4_Icons.load_icon("LineGraph"), "", self.value_widget)
        self.history_button.hide()
        self.history_button.setFixedWidth(22)
        self.history_button.setFixedHeight(22)

        _value_widget_hlayout = QtGui.QHBoxLayout(self.value_widget)
        _value_widget_hlayout.addWidget(self.value_label)
        _value_widget_hlayout.addWidget(self.history_button)
        _value_widget_hlayout.setSpacing(2)
        _value_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        self.main_vlayout = QtGui.QVBoxLayout(self)
        self.main_vlayout.addWidget(self.title_label)
        self.main_vlayout.addWidget(self.value_widget)
        self.main_vlayout.setSpacing(1)
        self.main_vlayout.setContentsMargins(0, 0, 0, 0)

        self.history_button.clicked.connect(self.open_history_view)
예제 #31
0
    def __init__(self,
                 design_mode=False,
                 show_maximized=False,
                 no_border=False):
        """init"""

        QWidget.__init__(self)

        self.framework = None
        self.gui_config_file = None
        self.user_file_dir = None
        self.configuration = None
        self.user_settings = None

        self.launch_in_design_mode = design_mode
        self.hardware_repository = HardwareRepository.HardwareRepository()
        self.show_maximized = show_maximized
        self.no_border = no_border
        self.windows = []
        self.splash_screen = BlissSplashScreen(Qt4_Icons.load_pixmap('splash'))

        set_splash_screen(self.splash_screen)
        self.splash_screen.show()

        self.timestamp = 0
    def refresh_plate_location(self):
        """
        Descript. :
        """
        loaded_sample = self.plate_manipulator_hwobj.getLoadedSample()
        new_location = self.plate_manipulator_hwobj.get_plate_location()
        self.plate_navigator_cell.setEnabled(True)

        if new_location and self.__current_location != new_location:
            row = new_location[0]
            col = new_location[1]
            pos_x = new_location[2]
            pos_y = new_location[3]
            #pos_x *= self.plate_navigator_cell.width()
            #pos_y *= self.plate_navigator_cell.height()
            self.navigation_item.set_navigation_pos(pos_x, pos_y)
            self.plate_navigator_cell.update()
            if self.__current_location:
                empty_item = QTableWidgetItem(QIcon(), "")
                self.plate_navigator_table.setItem(self.__current_location[0],
                                                   self.__current_location[1],
                                                   empty_item)
            new_item = QTableWidgetItem(Qt4_Icons.load_icon("sample_axis"), "")
            self.plate_navigator_table.setItem(row, col, new_item)
            self.__current_location = new_location
예제 #33
0
    def refresh_plate_location(self):
        """
        Descript. :
        """
        loaded_sample = self.plate_manipulator_hwobj.getLoadedSample()
        new_location = self.plate_manipulator_hwobj.get_plate_location()
        self.plate_navigator_cell.setEnabled(True)

        if new_location and self.__current_location != new_location:
            row = new_location[0]
            col = new_location[1]
            pos_x = new_location[2]
            pos_y = new_location[3]
            #pos_x *= self.plate_navigator_cell.width()
            #pos_y *= self.plate_navigator_cell.height()
            self.navigation_item.set_navigation_pos(pos_x, pos_y)
            self.plate_navigator_cell.update()
            if self.__current_location:
                empty_item = QTableWidgetItem(QIcon(), "")
                self.plate_navigator_table.setItem(self.__current_location[0],
                                                   self.__current_location[1],
                                                   empty_item)
            new_item = QTableWidgetItem(Qt4_Icons.load_icon("sample_axis"), "")
            self.plate_navigator_table.setItem(row, col, new_item)
            self.__current_location = new_location
예제 #34
0
    def __init__(self, *args):
        QWidget.__init__(self, *args)

        self.value_plot = None

        self.title_label = QLabel(self)
        self.value_widget = QWidget(self)
        self.value_label = QLabel(self.value_widget)
        self.value_label.setAlignment(Qt.AlignCenter)
        self.history_button = QPushButton(\
             Qt4_Icons.load_icon("LineGraph"), "", self.value_widget)
        self.history_button.hide()
        self.history_button.setFixedWidth(22)
        self.history_button.setFixedHeight(22)

        _value_widget_hlayout = QHBoxLayout(self.value_widget)
        _value_widget_hlayout.addWidget(self.value_label)
        _value_widget_hlayout.addWidget(self.history_button) 
        _value_widget_hlayout.setSpacing(2)
        _value_widget_hlayout.setContentsMargins(0, 0, 0, 0)

        self.main_vlayout = QVBoxLayout(self)
        self.main_vlayout.addWidget(self.title_label)
        self.main_vlayout.addWidget(self.value_widget)
        self.main_vlayout.setSpacing(1)
        self.main_vlayout.setContentsMargins(0, 0, 0, 0)

        self.history_button.clicked.connect(self.open_history_view)
예제 #35
0
    def refresh_plate_location(self):
        """
        Descript. :
        """
        loaded_sample = self.plate_manipulator_hwobj.getLoadedSample()
        new_location = self.plate_manipulator_hwobj.get_current_location() 
        if self.current_location != new_location:
            #self.plate_widget.navigation_label_painter.setBrush(.QBrush(qt.QWidget.white, qt.Qt.SolidPattern))

            #for drop_index in range(self.num_drops):
            #    pos_y = float(drop_index + 1) / (self.num_drops + 1) * \
            #         self.plate_widget.navigation_graphicsview.height()
            #    self.navigation_graphicsscene.drawLine(58, pos_y - 2, 62, pos_y + 2)
            #    self.navigation_graphicsscene.drawLine(62, pos_y - 2, 58, pos_y + 2)

            if new_location:
                row = new_location[0]
                col = new_location[1]
                pos_x = new_location[2]
                pos_y = new_location[3]
                self.plate_widget.current_location_ledit.setText(\
                     "Col: %d Row: %d X: %.2f Y: %.2f" % (col, row, pos_x, pos_y))
                pos_x *= self.plate_widget.navigation_graphicsview.width()
                pos_y *= self.plate_widget.navigation_graphicsview.height()
                self.navigation_item.set_navigation_pos(pos_x, pos_y)
                self.navigation_graphicsscene.update()    
                if self.current_location:
                    empty_item = QtGui.QTableWidgetItem("")
                    #     QtGui.QTableWidget.Item.Never)
                    self.plate_widget.sample_table.setItem(self.current_location[0],
                                              self.current_location[1],
                                              empty_item)
                new_item = QtGui.QTableWidgetItem(Qt4_Icons.load_icon("sample_axis.png"), "")
                self.plate_widget.sample_table.setItem(row, col, new_item)
            self.current_location = new_location  
예제 #36
0
    def __init__(self, parent):
        """
        Descript. :
        """
        QWidget.__init__(self, parent)

        self.home_url = None

        self.navigation_bar = QWidget(self)
        self.url_ledit = QLineEdit(self.navigation_bar)
        self.url_ledit.setReadOnly(True)
        self.home_button = QPushButton(self.navigation_bar)
        self.back_button = QPushButton(self.navigation_bar)
        self.forward_button = QPushButton(self.navigation_bar)

        self.home_button.setIcon(Qt4_Icons.load_icon("Home2"))
        self.back_button.setIcon(Qt4_Icons.load_icon("Left2"))
        self.forward_button.setIcon(Qt4_Icons.load_icon("Right2"))
         
        if QWEBVIEW_AVAILABLE:
            self.web_page_viewer = QWebView(self)
            self.web_page_viewer.settings().setObjectCacheCapacities(0,0,0)
        else:
            self.web_page_viewer = QTextBrowser(self)

        _navigation_bar_hlayout = QHBoxLayout(self.navigation_bar)
        _navigation_bar_hlayout.addWidget(self.home_button)
        _navigation_bar_hlayout.addWidget(self.back_button) 
        _navigation_bar_hlayout.addWidget(self.forward_button)
        _navigation_bar_hlayout.addWidget(self.url_ledit)  
        _navigation_bar_hlayout.setSpacing(2)
        _navigation_bar_hlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QVBoxLayout(self)
        _main_vlayout.addWidget(self.navigation_bar) 
        _main_vlayout.addWidget(self.web_page_viewer)  
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)
        
        self.web_page_viewer.setSizePolicy(QSizePolicy.Expanding,
                                           QSizePolicy.Expanding)

        self.home_button.clicked.connect(self.go_to_home_page)
        self.back_button.clicked.connect(self.go_back)
        self.forward_button.clicked.connect(self.go_forward)
예제 #37
0
    def __init__(self, parent):
        """
        Descript. :
        """
        QWidget.__init__(self, parent)

        self.home_url = None

        self.navigation_bar = QWidget(self)
        self.url_ledit = QLineEdit(self.navigation_bar)
        self.url_ledit.setReadOnly(True)
        self.home_button = QPushButton(self.navigation_bar)
        self.back_button = QPushButton(self.navigation_bar)
        self.forward_button = QPushButton(self.navigation_bar)

        self.home_button.setIcon(Qt4_Icons.load_icon("Home2"))
        self.back_button.setIcon(Qt4_Icons.load_icon("Left2"))
        self.forward_button.setIcon(Qt4_Icons.load_icon("Right2"))

        if QWEBVIEW_AVAILABLE:
            self.web_page_viewer = QWebView(self)
            self.web_page_viewer.settings().setObjectCacheCapacities(0, 0, 0)
        else:
            self.web_page_viewer = QTextBrowser(self)

        _navigation_bar_hlayout = QHBoxLayout(self.navigation_bar)
        _navigation_bar_hlayout.addWidget(self.home_button)
        _navigation_bar_hlayout.addWidget(self.back_button)
        _navigation_bar_hlayout.addWidget(self.forward_button)
        _navigation_bar_hlayout.addWidget(self.url_ledit)
        _navigation_bar_hlayout.setSpacing(2)
        _navigation_bar_hlayout.setContentsMargins(2, 2, 2, 2)

        _main_vlayout = QVBoxLayout(self)
        _main_vlayout.addWidget(self.navigation_bar)
        _main_vlayout.addWidget(self.web_page_viewer)
        _main_vlayout.setSpacing(2)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        self.web_page_viewer.setSizePolicy(QSizePolicy.Expanding,
                                           QSizePolicy.Expanding)

        self.home_button.clicked.connect(self.go_to_home_page)
        self.back_button.clicked.connect(self.go_back)
        self.forward_button.clicked.connect(self.go_forward)
예제 #38
0
    def __init__(self, parent, email_addresses, tab_label):
        QWidget.__init__(self, parent)

        # Hardware objects ----------------------------------------------------

        # Internal values -----------------------------------------------------
        self.tab_label = tab_label
        self.unread_messages = 0
        self.email_addresses = email_addresses
        self.from_email_address = None

        msg = [
            "Feel free to report any comment about this software;",
            " an email will be sent to the people concerned.",
            "Do not forget to put your name or email address if you require an answer."
        ]
        # Properties ----------------------------------------------------------

        # Signals ------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Graphic elements ----------------------------------------------------
        __label = QLabel("<b>%s</b>" % "\n".join(msg), self)
        __msg_label = QLabel('Message:', self)

        self.submit_button = QToolButton(self)
        self.message_textedit = QTextEdit(self)

        # Layout --------------------------------------------------------------
        _main_vlayout = QVBoxLayout(self)
        _main_vlayout.addWidget(__label)
        _main_vlayout.addWidget(__msg_label)
        _main_vlayout.addWidget(self.message_textedit)
        _main_vlayout.addWidget(self.submit_button)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self.submit_button.clicked.connect(self.submit_message)

        # Other ---------------------------------------------------------------
        self.message_textedit.setToolTip(
            "Write here your comments or feedback")
        self.submit_button.setText('Submit')

        #if hasattr(self.submit_button, "setUsesTextLabel"):
        #    self.submit_button.setUsesTextLabel(True)
        #elif hasattr(self.submit_button, "setToolButtonStyle"):
        #    self.submit_button.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        self.submit_button.setToolButtonStyle(True)
        self.submit_button.setIcon(Qt4_Icons.load_icon('Envelope'))
        self.submit_button.setToolTip("Click here to send your feedback " + \
                                      "to the authors of this software")
예제 #39
0
    def collect_now_button_click(self):
        if self.is_running:
            self._beamline_setup_hwobj.collect_hwobj.stop_collect()
            self.is_running = False
            self.collect_now_button.setText("Collect Now")
            self.collect_now_button.setIcon(Qt4_Icons.load_icon("VCRPlay2.png"))
        elif self.tool_box.currentWidget().approve_creation():
            sample_item = self.tree_brick.dc_tree_widget.\
                 get_mounted_sample_item()
            self.collect_now_button.setText("Stop")   
            self.collect_now_button.setIcon(Qt4_Icons.load_icon("Stop.png"))

            self.is_running = True 
            self.tool_box.currentWidget().execute_task(\
                 sample_item.get_model())
            self.is_running = False
            self.collect_now_button.setText("Collect Now")
            self.collect_now_button.setIcon(Qt4_Icons.load_icon("VCRPlay2.png"))
예제 #40
0
    def collect_now_button_click(self):
        if self.is_running:
            self._beamline_setup_hwobj.collect_hwobj.stop_collect()
            self.is_running = False
            self.collect_now_button.setText("Collect Now")
            self.collect_now_button.setIcon(Qt4_Icons.load_icon("VCRPlay2.png"))
        elif self.tool_box.currentWidget().approve_creation():
            sample_item = self.tree_brick.dc_tree_widget.\
                 get_mounted_sample_item()
            self.collect_now_button.setText("Stop")   
            self.collect_now_button.setIcon(Qt4_Icons.load_icon("Stop.png"))

            self.is_running = True 
            self.tool_box.currentWidget().execute_task(\
                 sample_item.get_model())
            self.is_running = False
            self.collect_now_button.setText("Collect Now")
            self.collect_now_button.setIcon(Qt4_Icons.load_icon("VCRPlay2.png"))
    def __init__(self, parent, caption='', unit=''):
        """Constructor
        
        parent -- the parent QObject
        caption -- a caption string (default: no caption)
        unit -- unit string is appended to the end of the displayed value (default: no string)"""
        ProcedureEntryField.__init__(self, parent, caption)

        box = QWidget(self)

        self.savedValue = None
        self.textbox = QLineEdit('', box)
        self.unitLabel = QLabel(str(unit), box)
        okCancelBox = QHBox(box)
        okCancelBox.setSpacing(0)
        okCancelBox.setMargin(0)
        self.cmdOK = QPushButton(okCancelBox)
        self.cmdCancel = QPushButton(okCancelBox)
        self.cmdOK.setFixedSize(20, 20)
        self.cmdCancel.setFixedSize(20, 20)
        self.cmdOK.setPixmap(
            Qt4_Icons.load('button_ok_small'))  #QPixmap(Icons.okXPM))
        self.cmdCancel.setPixmap(
            Qt4_Icons.load('button_cancel_small'))  #QPixmap(Icons.cancelXPM))

        QObject.connect(self.textbox, SIGNAL('returnPressed()'),
                        self.valueChanged)
        QObject.connect(self.textbox, SIGNAL('textChanged( const QString & )'),
                        self.valueChanging)
        QObject.connect(self.cmdOK, SIGNAL('clicked()'), self.valueChanged)
        QObject.connect(self.cmdCancel, SIGNAL('clicked()'),
                        self.cancelClicked)

        self.cmdCancel.setEnabled(False)
        self.cmdOK.setEnabled(True)

        QHBoxLayout(box, 0, 5)
        box.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
        box.layout().addWidget(self.textbox, 0, Qt.AlignLeft)
        box.layout().addWidget(self.unitLabel, 0, Qt.AlignLeft)
        box.layout().addWidget(okCancelBox, 0, Qt.AlignLeft)
        box.layout().addItem(
            QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
예제 #42
0
 def __init__(self, parent, caption=None, icon=None, fixed_size=(70, 45)):
     QtGui.QToolButton.__init__(self, parent)
     self.setUsesTextLabel(True)
     if fixed_size: 
         self.setFixedSize(fixed_size[0], fixed_size[1])
     self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
     if caption:
         self.setText(caption)
     if icon:
         self.setIcon(Qt4_Icons.load_icon(icon))
예제 #43
0
 def __init__(self, parent, caption=None, icon=None):
     QToolButton.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.Expanding,
                        QSizePolicy.Fixed)
     self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
     if caption:
         self.setText(caption)
         self.setWindowIconText(caption)
     if icon:
         self.setIcon(Qt4_Icons.load_icon(icon))
예제 #44
0
 def __init__(self, parent, caption=None, icon=None):
     QToolButton.__init__(self, parent)
     self.setSizePolicy(QSizePolicy.Expanding,
                        QSizePolicy.Fixed)
     self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
     if caption:
         self.setText(caption)
         self.setWindowIconText(caption)
     if icon:
         self.setIcon(Qt4_Icons.load_icon(icon))
예제 #45
0
 def __init__(self, parent, caption=None, icon=None, fixed_size=(70, 45)):
     QtGui.QToolButton.__init__(self, parent)
     self.setUsesTextLabel(True)
     if fixed_size:
         self.setFixedSize(fixed_size[0], fixed_size[1])
     self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
     if caption:
         self.setText(caption)
     if icon:
         self.setIcon(Qt4_Icons.load_icon(icon))
예제 #46
0
 def propertyChanged(self, property_name, old_value, new_value):
     """
     Descript. :
     """
     if property_name == 'loginAsUser':
         self.login_as_user = new_value
         if self.login_as_user:
            self.login_as_user_widget.show()
            self.login_as_proposal_widget.hide()
         else:
            self.login_as_user_widget.hide()
            self.login_as_proposal_widget.show() 
     elif property_name == 'ldapServer':
         self.ldap_connection_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'codes':
         self.setCodes(new_value)
     elif property_name == 'localLogin':
         self.local_login_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'dbConnection':
         self.lims_hwobj = self.getHardwareObject(new_value)
     elif property_name == 'instanceServer':
         if self.instanceServer is not None:
             self.disconnect(self.instanceServer, QtCore.SIGNAL('passControl'), self.passControl)
             self.disconnect(self.instanceServer, QtCore.SIGNAL('haveControl'), self.haveControl)
         self.instanceServer = self.getHardwareObject(new_value)
         if self.instanceServer is not None:
             self.connect(self.instanceServer, QtCore.SIGNAL('passControl'), self.passControl)
             self.connect(self.instanceServer, QtCore.SIGNAL('haveControl'), self.haveControl)
     elif property_name == 'icons':
         icons_list = new_value.split()
         try:
             self.login_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[0])))
         except IndexError:
             pass
         try:
             self.logout_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[1])))
         except IndexError:
             pass
     elif property_name == 'session':
         self.session_hwobj = self.getHardwareObject(new_value)
     else:
         BlissWidget.propertyChanged(self, property_name, old_value, new_value)
예제 #47
0
 def propertyChanged(self, property_name, old_value, new_value):
     """
     Descript. :
     """
     if property_name == "loginAsUser":
         self.login_as_user = new_value
         if self.login_as_user:
             self.login_as_user_widget.show()
             self.login_as_proposal_widget.hide()
         else:
             self.login_as_user_widget.hide()
             self.login_as_proposal_widget.show()
     elif property_name == "ldapServer":
         self.ldap_connection_hwobj = self.getHardwareObject(new_value)
     elif property_name == "codes":
         self.setCodes(new_value)
     elif property_name == "localLogin":
         self.local_login_hwobj = self.getHardwareObject(new_value)
     elif property_name == "dbConnection":
         self.lims_hwobj = self.getHardwareObject(new_value)
     elif property_name == "instanceServer":
         if self.instanceServer is not None:
             self.disconnect(self.instanceServer, QtCore.SIGNAL("passControl"), self.passControl)
             self.disconnect(self.instanceServer, QtCore.SIGNAL("haveControl"), self.haveControl)
         self.instanceServer = self.getHardwareObject(new_value)
         if self.instanceServer is not None:
             self.connect(self.instanceServer, QtCore.SIGNAL("passControl"), self.passControl)
             self.connect(self.instanceServer, QtCore.SIGNAL("haveControl"), self.haveControl)
     elif property_name == "icons":
         icons_list = new_value.split()
         try:
             self.login_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[0])))
         except IndexError:
             pass
         try:
             self.logout_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[1])))
         except IndexError:
             pass
     elif property_name == "session":
         self.session_hwobj = self.getHardwareObject(new_value)
     else:
         BlissWidget.propertyChanged(self, property_name, old_value, new_value)
예제 #48
0
 def set_step_button_icon(self, icon_name):
     """
     Descript. :
     Args.     :
     Return.   : 
     """
     self.step_button_icon = Qt4_Icons.load_icon(icon_name)
     self.step_button.setIcon(self.step_button_icon)
     for i in range(self.step_combo.count()):
         #xt = self.step_combo.itemText(i)
         self.step_combo.setItemIcon(i, self.step_button_icon)
예제 #49
0
 def __init__(self, parent, caption, icon=None):
     QtGui.QToolButton.__init__(self, parent)
     self.setUsesTextLabel(True)
     self.setFixedSize(75, 50)
     self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
     if caption:
         self.setText(caption)
     else:
         self.setText(self.objectName)
     if icon:
         self.setIcon(Qt4_Icons.load_icon(icon))
 def set_step_button_icon(self, icon_name):
     """
     Descript. :
     Args.     :
     Return.   : 
     """
     self.step_button_icon = Qt4_Icons.load_icon(icon_name)
     self.step_button.setIcon(self.step_button_icon)
     for i in range(self.step_cbox.count()):
         #xt = self.step_cbox.itemText(i)
         self.step_cbox.setItemIcon(i, self.step_button_icon)
예제 #51
0
 def __init__(self, parent, caption, icon=None):
     QtGui.QToolButton.__init__(self, parent)
     self.setUsesTextLabel(True)
     self.setFixedSize(75, 50)
     self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
     if caption:
         self.setText(caption)
     else:
         self.setText(self.objectName)
     if icon:
         self.setIcon(Qt4_Icons.load_icon(icon))
예제 #52
0
    def __init__(self, parent, email_addresses, tab_label):
        QWidget.__init__(self, parent)

        # Hardware objects ----------------------------------------------------

        # Internal values -----------------------------------------------------
        self.tab_label = tab_label
        self.unread_messages = 0
        self.email_addresses = email_addresses
        self.from_email_address = None

        msg = ["Feel free to report any comment about this software;",
               " an email will be sent to the people concerned.",
               "Do not forget to put your name or email address if you require an answer."]
        # Properties ----------------------------------------------------------

        # Signals ------------------------------------------------------------

        # Slots ---------------------------------------------------------------

        # Graphic elements ----------------------------------------------------
        __label = QLabel("<b>%s</b>" % "\n".join(msg), self)
        __msg_label = QLabel('Message:', self)

        self.submit_button = QToolButton(self)
        self.message_textedit = QTextEdit(self)

        # Layout --------------------------------------------------------------
        _main_vlayout = QVBoxLayout(self)
        _main_vlayout.addWidget(__label)
        _main_vlayout.addWidget(__msg_label)
        _main_vlayout.addWidget(self.message_textedit)
        _main_vlayout.addWidget(self.submit_button)
        _main_vlayout.setSpacing(0)
        _main_vlayout.setContentsMargins(2, 2, 2, 2)

        # SizePolicies --------------------------------------------------------

        # Qt signal/slot connections ------------------------------------------
        self.submit_button.clicked.connect(self.submit_message)

        # Other ---------------------------------------------------------------
        self.message_textedit.setToolTip("Write here your comments or feedback")
        self.submit_button.setText('Submit')

        #if hasattr(self.submit_button, "setUsesTextLabel"):  
        #    self.submit_button.setUsesTextLabel(True)
        #elif hasattr(self.submit_button, "setToolButtonStyle"):
        #    self.submit_button.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)

        self.submit_button.setToolButtonStyle(True)
        self.submit_button.setIcon(Qt4_Icons.load_icon('Envelope'))
        self.submit_button.setToolTip("Click here to send your feedback " + \
                                      "to the authors of this software")
예제 #53
0
    def run(self):
        self.tools_menu = QtGui.QMenu("Graphics tools", self)
        _measure_menu = self.tools_menu.addMenu("Measure")

        self.measure_distance_action = _measure_menu.addAction(
             Qt4_Icons.load_icon("measure_distance"),
             "Distance", 
             self.measure_distance_clicked)
        self.measure_angle_action = _measure_menu.addAction(
             Qt4_Icons.load_icon("measure_angle"),
             "Angle", 
             self.measure_angle_clicked)
        self.measure_area_action = _measure_menu.addAction(
             Qt4_Icons.load_icon("measure_area"),
             "Area", 
             self.measure_area_clicked) 

        _create_menu = self.tools_menu.addMenu("Create")
        aa_action = _create_menu.addAction(Qt4_Icons.load_icon("VCRPlay2"),
             "Centring point with 3 clicks", self.create_point_click_clicked)
        aa_action.setShortcut("Ctrl+1")
        temp_action = _create_menu.addAction(Qt4_Icons.load_icon("ThumbUp"),
             "Centring point on current position", self.create_point_current_clicked)
        temp_action.setShortcut("Ctrl+2")
        temp_action = _create_menu.addAction(Qt4_Icons.load_icon("Line.png"),
             "Helical line",self.create_line_clicked)
        temp_action.setShortcut("Ctrl+3")
        temp_action = _create_menu.addAction(Qt4_Icons.load_icon("Grid"),
             "Grid", self.create_grid_clicked)
        temp_action.setShortcut("Ctrl+4")
        temp_action = self.tools_menu.addAction("Select all centring points",
             self.select_all_points_clicked)
        temp_action.setShortcut("Ctrl+A")
        temp_action = self.tools_menu.addAction("Deselect all items",
             self.deselect_all_items_clicked)
        temp_action.setShortcut("Ctrl+D")
        temp_action = self.tools_menu.addAction("Clear all items",
             self.clear_all_items_clicked)
        temp_action.setShortcut("Ctrl+X")

        self.move_beam_mark_action = self.tools_menu.addAction(
             "Move beam mark",
             self.move_beam_mark_clicked)
        self.move_beam_mark_action.setEnabled(False)

        if self.target_menu == "menuBar":
            BlissWidget._menuBar.insert_menu(self.tools_menu, 2)
        elif self.target_menu == "toolBar":
            for action in self.tools_menu.actions():
                BlissWidget._toolBar.addAction(action)
        else:
         
            BlissWidget._menuBar.insert_menu(self.tools_menu, 2)
            toolbar_actions = []
            for action in self.tools_menu.actions():
                BlissWidget._toolBar.addAction(action)
예제 #54
0
 def init_tools(self):
     """
     Gets available methods and populates menubar with methods
     If icon name exists then adds icon
     """
     self.tools_list = self.tools_hwobj.get_tools_list()
     for tool in self.tools_list:
         if hasattr(tool["hwobj"], tool["method"]):
             temp_action = self.tools_menu.addAction(\
                tool["display"], getattr(tool["hwobj"], tool["method"]))
             if len(tool["icon"]) > 0:
                 temp_action.setIcon(Qt4_Icons.load_icon(tool["icon"]))
예제 #55
0
    def __init__(self, parent, caption=None, icon=None, fixed_size=(70, 40)):
        QToolButton.__init__(self, parent)

        self.setFixedSize(fixed_size[0], fixed_size[1])
        #self.setSizePolicy(QSizePolicy.Fixed,
        #                   QSizePolicy.Fixed)
        self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        if caption:
            self.setText(caption)
            self.setWindowIconText(caption)
        if icon:
            self.setIcon(Qt4_Icons.load_icon(icon))
예제 #56
0
 def init_tools(self):
     """
     Gets available methods and populates menubar with methods
     If icon name exists then adds icon
     """
     self.tools_list = self.tools_hwobj.get_tools_list()
     for tool in self.tools_list:
         if hasattr(tool["hwobj"], tool["method"]): 
             temp_action = self.tools_menu.addAction(\
                tool["display"], getattr(tool["hwobj"], tool["method"]))
             if len(tool["icon"]) > 0:
                 temp_action.setIcon(Qt4_Icons.load_icon(tool["icon"]))