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)
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)
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, 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 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, 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)
def set_Icons(self, icon_run, icon_stop): """ Descript. : Args. : Return : """ self.run_icon = QtGui.QIcon(Qt4_Icons.load(icon_run)) self.stop_icon = QtGui.QIcon(Qt4_Icons.load(icon_stop)) if self.executing: self.setIcon(self.stop_icon) else: self.setIcon(self.run_icon)
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) 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) 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(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) elif property_name == 'secondaryProposals': self.secondary_proposals = new_value.split() else: BlissWidget.propertyChanged(self, property_name, old_value, new_value)
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) 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) 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( 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) elif property_name == 'secondaryProposals': self.secondary_proposals = new_value.split() else: BlissWidget.propertyChanged(self, property_name, old_value, new_value)
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))
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)
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)
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 add_pending_connection(self, connection_dict): """ Descript. : """ new_item = QtGui.QTreeWidgetItem( self.connections_treewidget, QtCore.QStringList([ '', connection_dict['senderWindow'], connection_dict['senderObject'], connection_dict['signal'], connection_dict['receiverWindow'], connection_dict['receiverObject'], connection_dict['slot'] ])) new_item.setIcon(0, QtGui.QIcon(Qt4_Icons.load('button_ok_small'))) self.connections_treewidget.addTopLevelItem(new_item)
def add_pending_connection(self, connection_dict): """ Descript. : """ new_item = QtGui.QTreeWidgetItem(self.connections_treewidget, QtCore.QStringList([ '', connection_dict['senderWindow'], connection_dict['senderObject'], connection_dict['signal'], connection_dict['receiverWindow'], connection_dict['receiverObject'], connection_dict['slot']])) new_item.setIcon(0, QtGui.QIcon(Qt4_Icons.load('button_ok_small'))) self.connections_treewidget.addTopLevelItem(new_item)
def tab_slot(self, hide=True, page = {"widget" : scroll_area, \ "label": self.tabText(self.indexOf(scroll_area)), "index" : self.indexOf(scroll_area), "icon": icon, "hidden" : False}): if hide: if not page["hidden"]: self.removeTab(self.indexOf(page["widget"])) self.repaint() page["hidden"] = True else: if page["hidden"]: if icon: pixmap = Qt4_Icons.load(icon) self.insertTab(page["widget"], QtGui.QIcon(pixmap,pixmap), label, page["index"]) else: self.insertTab(page["index"], page["widget"], page["label"]) self.showPage(page["widget"]) page["hidden"] = False else: self.showPage(page["widget"])
def propertyChanged(self, property_name, old_value, new_value): """ Descript. : Args. : Return : """ if property_name == 'mnemonic': if self.instance_server_hwobj is not None: self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('chatMessageReceived'), self.message_arrived) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('newClient'), self.new_client) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('serverInitialized'),self.server_initialized) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('clientInitialized'),self.client_initialized) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('serverClosed'), self.client_closed) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('wantsControl'), self.wants_control) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('haveControl'), self.have_control) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('passControl'), self.pass_control) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('clientClosed'), self.client_closed) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('clientChanged'), self.client_changed) self.instance_server_hwobj = self.getHardwareObject(new_value) if self.instance_server_hwobj is not None: self.connect(self.instance_server_hwobj, QtCore.SIGNAL('chatMessageReceived'), self.message_arrived) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('newClient'), self.new_client) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('serverInitialized'),self.server_initialized) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('clientInitialized'),self.client_initialized) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('serverClosed'), self.client_closed) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('wantsControl'), self.wants_control) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('haveControl'), self.have_control) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('passControl'), self.pass_control) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('clientClosed'), self.client_closed) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('clientChanged'), self.client_changed) elif property_name == 'icons': icons_list = new_value.split() try: self.send_button.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[0]))) except IndexError: pass else: BlissWidget.propertyChanged(self,property_name, old_value, new_value)
def set_icons(self, icons): """ Descript. : Args. : Return : """ icons_list = icons.split() try: self.button_centre.set_Icons(icons_list[0], icons_list[1]) self.button_accept.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[2]))) self.button_snapshot.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[3]))) self.button_reject.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[4]))) self.button_toogle_phase.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[5]))) self.button_refresh_camera.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[6]))) self.button_visual_align.setIcon(QtGui.QIcon(Qt4_Icons.load(icons_list[7]))) except IndexError: logging.getLogger().error("HutchMenuBrick: Unable to set icons")
def tab_slot(self, hide=True, page = {"widget" : scroll_area, \ "label": self.tabText(self.indexOf(scroll_area)), "index" : self.indexOf(scroll_area), "icon": icon, "hidden" : False}): if hide: if not page["hidden"]: self.removeTab(self.indexOf(page["widget"])) self.repaint() page["hidden"] = True else: if page["hidden"]: if icon: pixmap = Qt4_Icons.load(icon) self.insertTab(page["widget"], QtGui.QIcon(pixmap, pixmap), label, page["index"]) else: self.insertTab(page["index"], page["widget"], page["label"]) self.showPage(page["widget"]) page["hidden"] = False else: self.showPage(page["widget"])
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with MXCuBE. If not, see <http://www.gnu.org/licenses/>. from PyQt4 import QtCore from PyQt4 import QtGui from BlissFramework import Qt4_Icons from BlissFramework.Utils import Qt4_widget_colors import queue_model_objects_v1 as queue_model_objects PIN_PIXMAP = Qt4_Icons.load("sample_axis.png") class QueueItem(QtGui.QTreeWidgetItem): """ Use this class to create a new type of item for the collect tree/queue. """ normal_brush = QtGui.QBrush(QtCore.Qt.black) highlighted_brush = QtGui.QBrush(QtGui.QColor(128, 128, 128)) normal_pen = QtGui.QPen(QtCore.Qt.black) highlighted_pen = QtGui.QPen(QtGui.QColor(128, 128, 128)) bg_brush = QtGui.QBrush(QtGui.QColor(0, 128, 0)) bg_normal_brush = QtGui.QBrush(QtCore.Qt.white) def __init__(self, *args, **kwargs): """
def __init__(self, parent=None, name="parameter_widget"): QtGui.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Hardware objects ---------------------------------------------------- self._beamline_setup_hwobj = None # Internal variables -------------------------------------------------- self._data_collection = None self.add_dc_cb = None self._tree_view_item = None # Graphic elements ---------------------------------------------------- _dc_parameters_widget = QtGui.QWidget(self) self.caution_pixmap = Qt4_Icons.load("Caution2.png") self.path_widget = DataPathWidget(_dc_parameters_widget) self.acq_widget = AcquisitionWidget(_dc_parameters_widget, layout='horizontal') #self.acq_widget.setFixedHeight(170) self.processing_widget = ProcessingWidget(_dc_parameters_widget) self.position_widget = uic.loadUi( os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) #self.position_widget.setMinimumSize(310, 210) # Layout -------------------------------------------------------------- _dc_parameters_widget_layout = QtGui.QVBoxLayout(self) _dc_parameters_widget_layout.addWidget(self.path_widget) _dc_parameters_widget_layout.addWidget(self.acq_widget) _dc_parameters_widget_layout.addWidget(self.processing_widget) _dc_parameters_widget_layout.setSpacing(2) _dc_parameters_widget_layout.addStretch(0) _dc_parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _dc_parameters_widget.setLayout(_dc_parameters_widget_layout) _main_hlayout = QtGui.QHBoxLayout(self) _main_hlayout.addWidget(_dc_parameters_widget) _main_hlayout.addWidget(self.position_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) self.setLayout(_main_hlayout) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.path_widget.data_path_layout.prefix_ledit.textChanged.connect( self._prefix_ledit_change) self.path_widget.data_path_layout.run_number_ledit.textChanged.connect( self._run_number_ledit_change) self.connect(self.acq_widget, QtCore.SIGNAL('mad_energy_selected'), self.mad_energy_selected) self.connect(self.acq_widget, QtCore.SIGNAL("path_template_changed"), self.handle_path_conflict) #QtCore.QObject.connect(QtGui.QApplication, QtCore.SIGNAL('tab_changed'), # self.tab_changed) # Other --------------------------------------------------------------- Qt4_widget_colors.set_widget_color(self.path_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.acq_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.processing_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.position_widget, Qt4_widget_colors.GROUP_BOX_GRAY)
def setIcons(self, scan_all_icon, scan_select): self.scan_all_icon = Qt4_Icons.load(scan_all_icon) self.scan_all_baskets_button.setIcon(self.scan_all_icon) self.buttonSelect.setIcon(Qt4_Icons.load(scan_select))
def __init__(self, *args): """ Descript. : """ BlissWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.beamline_config_hwobj = None self.lims_hwobj = None self.sample_changer_hwobj = None self.queue_hwobj = None # Internal variables -------------------------------------------------- self.current_cpos = None self.__collection_stopped = False self.current_view = None # Properties ---------------------------------------------------------- self.addProperty("holderLengthMotor", "string", "") self.addProperty("queue", "string", "/Qt4_queue") self.addProperty("queue_model", "string", "/Qt4_queue-model") self.addProperty("beamline_setup", "string", "/Qt4_beamline-setup-break") self.addProperty("xml_rpc_server", "string", "/Qt4_xml_rpc_server") # Signals ------------------------------------------------------------ self.defineSignal("enable_hutch_menu", ()) self.defineSignal("enable_command_menu", ()) self.defineSignal("enable_task_toolbox", ()) # Hiding and showing the tabs self.defineSignal("hide_sample_tab", ()) self.defineSignal("hide_dc_parameters_tab", ()) self.defineSignal("hide_sample_centring_tab", ()) self.defineSignal("hide_dcg_tab", ()) self.defineSignal("hide_sample_changer_tab", ()) self.defineSignal("hide_char_parameters_tab", ()) self.defineSignal("hide_energy_scan_tab",()) self.defineSignal("hide_xrf_scan_tab",()) self.defineSignal("hide_workflow_tab", ()) self.defineSignal("hide_advanced_scan_tab", ()) # Populating the tabs with data self.defineSignal("populate_dc_parameter_widget", ()) self.defineSignal("populate_char_parameter_widget",()) self.defineSignal("populate_sample_details",()) self.defineSignal("populate_energy_scan_widget", ()) self.defineSignal("populate_xrf_scan_widget", ()) self.defineSignal("populate_workflow_tab", ()) self.defineSignal("populate_advanced_scan_tab", ()) # Handle selection self.defineSignal("selection_changed",()) self.defineSignal("set_directory", ()) self.defineSignal("set_prefix", ()) self.defineSignal("set_sample", ()) # Slots --------------------------------------------------------------- self.defineSlot("logged_in", ()) self.defineSlot("status_msg_changed", ()) self.defineSlot("sample_load_state_changed", ()) self.defineSlot("set_session", ()) self.defineSlot("get_tree_brick",()) self.defineSlot("get_selected_samples", ()) #self.defineSlot("get_mounted_sample", ()) #self.defineSlot("new_centred_position", ()) #self.defineSlot("add_dcg", ()) #self.defineSlot("add_data_collection", ()) #self.defineSlot("set_session", ()) # Graphic elements ---------------------------------------------------- self.sample_changer_widget = uic.loadUi(os.path.join(os.path.dirname(__file__), "widgets/ui_files/Qt4_sample_changer_widget_layout.ui")) self.refresh_pixmap = Qt4_Icons.load("Refresh2.png") self.sample_changer_widget.synch_button.setIcon(QtGui.QIcon(self.refresh_pixmap)) self.sample_changer_widget.synch_button.setText("Synch ISPyB") self.dc_tree_widget = DataCollectTree(self) self.dc_tree_widget.selection_changed_cb = self.selection_changed self.dc_tree_widget.run_cb = self.run #self.dc_tree_widget.clear_centred_positions_cb = \ # self.clear_centred_positions # Layout -------------------------------------------------------------- main_layout = QtGui.QVBoxLayout(self) main_layout.addWidget(self.sample_changer_widget) main_layout.addWidget(self.dc_tree_widget) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(main_layout) # SizePolicies -------------------------------------------------------- self.sample_changer_widget.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) # Qt signal/slot connections ------------------------------------------ self.sample_changer_widget.details_button.clicked.\ connect(self.toggle_sample_changer_tab) self.sample_changer_widget.filter_cbox.activated.\ connect(self.dc_tree_widget.filter_sample_list) self.sample_changer_widget.centring_cbox.activated.\ connect(self.dc_tree_widget.set_centring_method) self.sample_changer_widget.synch_button.clicked.\ connect(self.refresh_sample_list) # Other --------------------------------------------------------------- self.enable_collect(False) #self.setFixedWidth(315) #self.sample_changer_widget.child('centring_cbox').setCurrentItem(1) self.dc_tree_widget.set_centring_method(1)
def setIcons(self,scan_one_icon): self.scan_basket_button.setIcon(Qt4_Icons.load(scan_one_icon))
def __init__(self, parent=None, name="task_toolbox"): QtGui.QWidget.__init__(self, parent) self.setObjectName = name # Hardware objects ---------------------------------------------------- self.graphics_manager_hwobj = None # Internal variables -------------------------------------------------- self.tree_brick = None self.previous_page_index = 0 # Graphic elements ---------------------------------------------------- self.method_group_box = QtGui.QGroupBox(" Collection method", self) font = self.method_group_box.font() font.setPointSize(10) self.method_group_box.setFont(font) self.tool_box = QtGui.QToolBox(self.method_group_box) self.tool_box.setObjectName("tool_box") self.tool_box.setFixedWidth(475) self.tool_box.setFont(font) self.discrete_page = CreateDiscreteWidget( self.tool_box, "Discrete", ) self.char_page = CreateCharWidget(self.tool_box, "Characterise") self.helical_page = CreateHelicalWidget(self.tool_box, "helical_page") self.energy_scan_page = CreateEnergyScanWidget(self.tool_box, "energy_scan") self.xrf_scan_page = CreateXRFScanWidget(self.tool_box, "xrf_scan") self.advanced_scan_page = CreateAdvancedScanWidget( self.tool_box, "advanced_scan") self.tool_box.addItem(self.discrete_page, "Standard Collection") self.tool_box.addItem(self.char_page, "Characterisation") self.tool_box.addItem(self.helical_page, "Helical Collection") self.tool_box.addItem(self.energy_scan_page, "Energy Scan") self.tool_box.addItem(self.xrf_scan_page, "XRF Scan") self.tool_box.addItem(self.advanced_scan_page, "Advanced") self.button_box = QtGui.QWidget(self) self.create_task_button = QtGui.QPushButton(" Add to queue", self.button_box) self.create_task_button.setIcon( QtGui.QIcon(Qt4_Icons.load("add_row.png"))) msg = "Add the collection method to the selected sample" self.create_task_button.setToolTip(msg) # Layout -------------------------------------------------------------- self.method_group_box_layout = QtGui.QVBoxLayout(self) self.method_group_box_layout.addWidget(self.tool_box) self.method_group_box_layout.setSpacing(0) self.method_group_box_layout.setContentsMargins(0, 0, 0, 0) self.method_group_box.setLayout(self.method_group_box_layout) self.button_box_layout = QtGui.QHBoxLayout(self) self.button_box_layout.addStretch(0) self.button_box_layout.addWidget(self.create_task_button) self.button_box_layout.setSpacing(0) self.button_box_layout.setContentsMargins(0, 0, 0, 0) self.button_box.setLayout(self.button_box_layout) self.main_layout = QtGui.QVBoxLayout(self) self.main_layout.addWidget(self.method_group_box) #self.main_layout.addStretch(0) self.main_layout.addWidget(self.button_box) self.main_layout.setSpacing(0) self.main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.main_layout) # SizePolicies -------------------------------------------------------- self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # Qt signal/slot connections ------------------------------------------ self.create_task_button.clicked.connect(self.create_task_button_click) self.connect(self.tool_box, QtCore.SIGNAL("currentChanged( int )"), self.current_page_changed)
def propertyChanged(self, property_name, old_value, new_value): """ Descript. : Args. : Return : """ if property_name == 'mnemonic': if self.instance_server_hwobj is not None: self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('chatMessageReceived'), self.message_arrived) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('newClient'), self.new_client) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('serverInitialized'), self.server_initialized) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('clientInitialized'), self.client_initialized) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('serverClosed'), self.client_closed) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('wantsControl'), self.wants_control) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('haveControl'), self.have_control) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('passControl'), self.pass_control) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('clientClosed'), self.client_closed) self.disconnect(self.instance_server_hwobj, QtCore.SIGNAL('clientChanged'), self.client_changed) self.instance_server_hwobj = self.getHardwareObject(new_value) if self.instance_server_hwobj is not None: self.connect(self.instance_server_hwobj, QtCore.SIGNAL('chatMessageReceived'), self.message_arrived) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('newClient'), self.new_client) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('serverInitialized'), self.server_initialized) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('clientInitialized'), self.client_initialized) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('serverClosed'), self.client_closed) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('wantsControl'), self.wants_control) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('haveControl'), self.have_control) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('passControl'), self.pass_control) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('clientClosed'), self.client_closed) self.connect(self.instance_server_hwobj, QtCore.SIGNAL('clientChanged'), self.client_changed) elif property_name == 'icons': icons_list = new_value.split() try: self.send_button.setIcon( QtGui.QIcon(Qt4_Icons.load(icons_list[0]))) except IndexError: pass else: BlissWidget.propertyChanged(self, property_name, old_value, new_value)
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with MXCuBE. If not, see <http://www.gnu.org/licenses/>. from PyQt4 import QtCore from PyQt4 import QtGui from BlissFramework import Qt4_Icons from BlissFramework.Utils import Qt4_widget_colors import queue_model_objects_v1 as queue_model_objects PIN_PIXMAP = Qt4_Icons.load("sample_axis.png") class QueueItem(QtGui.QTreeWidgetItem): """ Use this class to create a new type of item for the collect tree/queue. """ normal_brush = QtGui.QBrush(QtCore.Qt.black) highlighted_brush = QtGui.QBrush(QtGui.QColor(128, 128, 128)) normal_pen = QtGui.QPen(QtCore.Qt.black) highlighted_pen = QtGui.QPen(QtGui.QColor(128, 128, 128)) bg_brush = QtGui.QBrush(QtGui.QColor(0, 128, 0)) bg_normal_brush = QtGui.QBrush(QtCore.Qt.white) def __init__(self, *args, **kwargs): """
def __init__(self, *args): """ Descript. : """ BlissWidget.__init__(self, *args) # Hardware objects ---------------------------------------------------- self.beamline_config_hwobj = None self.lims_hwobj = None self.sample_changer_hwobj = None self.queue_hwobj = None # Internal variables -------------------------------------------------- self.current_cpos = None self.__collection_stopped = False self.current_view = None # Properties ---------------------------------------------------------- self.addProperty("holderLengthMotor", "string", "") self.addProperty("queue", "string", "/Qt4_queue") self.addProperty("queue_model", "string", "/Qt4_queue-model") self.addProperty("beamline_setup", "string", "/Qt4_beamline-setup-break") self.addProperty("xml_rpc_server", "string", "/Qt4_xml_rpc_server") # Signals ------------------------------------------------------------ self.defineSignal("enable_hutch_menu", ()) self.defineSignal("enable_command_menu", ()) self.defineSignal("enable_task_toolbox", ()) # Hiding and showing the tabs self.defineSignal("hide_sample_tab", ()) self.defineSignal("hide_dc_parameters_tab", ()) self.defineSignal("hide_sample_centring_tab", ()) self.defineSignal("hide_dcg_tab", ()) self.defineSignal("hide_sample_changer_tab", ()) self.defineSignal("hide_char_parameters_tab", ()) self.defineSignal("hide_energy_scan_tab", ()) self.defineSignal("hide_xrf_scan_tab", ()) self.defineSignal("hide_workflow_tab", ()) self.defineSignal("hide_advanced_scan_tab", ()) # Populating the tabs with data self.defineSignal("populate_dc_parameter_widget", ()) self.defineSignal("populate_char_parameter_widget", ()) self.defineSignal("populate_sample_details", ()) self.defineSignal("populate_energy_scan_widget", ()) self.defineSignal("populate_xrf_scan_widget", ()) self.defineSignal("populate_workflow_tab", ()) self.defineSignal("populate_advanced_scan_tab", ()) # Handle selection self.defineSignal("selection_changed", ()) self.defineSignal("set_directory", ()) self.defineSignal("set_prefix", ()) self.defineSignal("set_sample", ()) # Slots --------------------------------------------------------------- self.defineSlot("logged_in", ()) self.defineSlot("status_msg_changed", ()) self.defineSlot("sample_load_state_changed", ()) self.defineSlot("set_session", ()) self.defineSlot("get_tree_brick", ()) self.defineSlot("get_selected_samples", ()) #self.defineSlot("get_mounted_sample", ()) #self.defineSlot("new_centred_position", ()) #self.defineSlot("add_dcg", ()) #self.defineSlot("add_data_collection", ()) #self.defineSlot("set_session", ()) # Graphic elements ---------------------------------------------------- self.sample_changer_widget = uic.loadUi( os.path.join( os.path.dirname(__file__), "widgets/ui_files/Qt4_sample_changer_widget_layout.ui")) self.refresh_pixmap = Qt4_Icons.load("Refresh2.png") self.sample_changer_widget.synch_button.setIcon( QtGui.QIcon(self.refresh_pixmap)) self.sample_changer_widget.synch_button.setText("Synch ISPyB") self.dc_tree_widget = DataCollectTree(self) self.dc_tree_widget.selection_changed_cb = self.selection_changed self.dc_tree_widget.run_cb = self.run #self.dc_tree_widget.clear_centred_positions_cb = \ # self.clear_centred_positions # Layout -------------------------------------------------------------- main_layout = QtGui.QVBoxLayout(self) main_layout.addWidget(self.sample_changer_widget) main_layout.addWidget(self.dc_tree_widget) main_layout.setSpacing(0) main_layout.setContentsMargins(0, 0, 0, 0) self.setLayout(main_layout) # SizePolicies -------------------------------------------------------- self.sample_changer_widget.setSizePolicy( QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed) # Qt signal/slot connections ------------------------------------------ self.sample_changer_widget.details_button.clicked.\ connect(self.toggle_sample_changer_tab) self.sample_changer_widget.filter_cbox.activated.\ connect(self.dc_tree_widget.filter_sample_list) self.sample_changer_widget.centring_cbox.activated.\ connect(self.dc_tree_widget.set_centring_method) self.sample_changer_widget.synch_button.clicked.\ connect(self.refresh_sample_list) # Other --------------------------------------------------------------- self.enable_collect(False) #self.setFixedWidth(315) #self.sample_changer_widget.child('centring_cbox').setCurrentItem(1) self.dc_tree_widget.set_centring_method(1)
def add_item(self, item_cfg, parent): """ Descript. : """ item_type = item_cfg["type"] item_name = item_cfg["name"] newItem = None try: klass = WindowDisplayWidget.items[item_type] except KeyError: newItem = item_cfg["brick"] else: newItem = klass(parent, item_cfg["name"], executionMode=self.execution_mode) if item_type in ("vbox", "hbox", "vgroupbox", "hgroupbox"): if item_cfg["properties"]["color"] is not None: try: qtcolor = QtGui.QColor(item_cfg["properties"]["color"]) newItem_palette = newItem.palette() newItem_palette.setColor(QtGui.QPalette.Background, QtGui.QColor(qtcolor.red(), qtcolor.green(), qtcolor.blue())) newItem.setPalette(newItem_palette) except: logging.getLogger().exception("Could not set color on item %s", item_cfg["name"]) if item_type.endswith("groupbox"): newItem.setTitle(item_cfg["properties"]["label"]) newItem.layout().setSpacing(item_cfg["properties"]["spacing"]) newItem.layout().setMargin(item_cfg["properties"]["margin"]) frame_style = QtGui.QFrame.NoFrame if item_cfg["properties"]["frameshape"]!="default": frame_style = getattr(QtGui.QFrame, item_cfg["properties"]["frameshape"]) if item_cfg["properties"]["shadowstyle"]!="default": frame_style = frame_style | getattr(QtGui.QFrame, item_cfg["properties"]["shadowstyle"].capitalize()) if frame_style != QtGui.QFrame.NoFrame: try: newItem.setFrameStyle(frame_style) except: logging.getLogger().exception("Could not set frame style on item %s", item_cfg["name"]) if item_cfg["properties"]["fixedwidth"] > -1: newItem.setFixedWidth(item_cfg["properties"]["fixedwidth"]) if item_cfg["properties"]["fixedheight"] > -1: newItem.setFixedHeight(item_cfg["properties"]["fixedheight"]) elif item_type == "icon": img = QtGui.QPixmap() if img.load(item_cfg["properties"]["filename"]): newItem.setPixmap(img) elif item_type == "label": newItem.setText(item_cfg["properties"]["text"]) elif item_type == "tab": item_cfg.widget = newItem newItem.close_tab_button = QtGui.QToolButton(newItem) newItem.close_tab_button.setIcon(QtGui.QIcon(Qt4_Icons.load('delete_small'))) newItem.setCornerWidget(newItem.close_tab_button) newItem.close_tab_button.hide() def close_current_page(): tab=newItem slot_name = "hidePage_%s" % str(tab.tabText(tab.currentIndex())) slot_name = slot_name.replace(" ", "_") getattr(tab, slot_name)() #QtGui.QApplication.emit(QtCore.SIGNAL('tab_closed'), tab, slotName) def current_page_changed(index): item_cfg.notebookPageChanged(newItem.tabText(index)) newItem._close_current_page_cb = close_current_page newItem.currentChanged.connect(current_page_changed) newItem.close_tab_button.clicked.connect(close_current_page) elif item_type == "vsplitter" or type == "hsplitter": pass newItem.show() return newItem
def propertyChanged(self, propertyName, oldValue, newValue): if propertyName == 'level': self.filterLevel = logging.NOTSET if newValue == 'INFO': self.filterLevel = logging.INFO elif newValue == 'WARNING': self.filterLevel = logging.WARNING elif newValue == 'ERROR': self.filterLevel = logging.ERROR elif propertyName == 'showDebug': if self['appearance'] == "tabs": if newValue: if self.tabs.indexOf(self.DebugLog) == -1: self.tabs.insertTab(self.DebugLog, self.DebugLog.tabLabel, 9) self.tabs.setTabToolTip( self.DebugLog, Qt4_LogViewBrick.TOOLTIPS["Debug"]) else: if self.tabs.indexOf(self.DebugLog) != -1: self.tabs.removePage(self.DebugLog) elif propertyName == 'emailAddresses': self.FeedbackLog.emailAddresses = newValue elif propertyName == 'enableFeedback': if self['appearance'] == "tabs": if newValue: if self.tabs.indexOf(self.FeedbackLog) == -1: self.tabs.insertTab(self.FeedbackLog, self.FeedbackLog.tabLabel, 2) self.tabs.setTabToolTip( self.FeedbackLog, Qt4_LogViewBrick.TOOLTIPS["Feedback"]) else: if self.tabs.indexOf(self.FeedbackLog) != -1: self.tabs.removePage(self.FeedbackLog) elif propertyName == 'appearance': if oldValue == "list": self.layout().removeWidget(self.InfoLog) elif oldValue == "tabs": for l in Qt4_LogViewBrick.LOGS: exec("self.tabs.removePage(self.%sLog)" % l) exec("self.%sLog.reparent(self,0,QPoint(0,0),True)" % l) self.layout().removeWidget(self.tabs) for l in Qt4_LogViewBrick.LOGS[1:]: exec("self.%sLog.hide()" % l) self.tabs.hide() elif oldValue is None: self.layout().removeWidget(self.InfoLog) if newValue == "list": self.tabLevels = { logging.NOTSET: self.InfoLog, logging.DEBUG: self.InfoLog, logging.INFO: self.InfoLog, logging.WARNING: self.InfoLog, logging.ERROR: self.InfoLog, logging.CRITICAL: self.InfoLog } self.layout().addWidget(self.InfoLog) elif newValue == "tabs": self.tabLevels = { logging.NOTSET: self.DetailsLog, logging.DEBUG: self.DebugLog, logging.INFO: self.InfoLog, logging.WARNING: self.DetailsLog, logging.ERROR: self.DetailsLog, logging.CRITICAL: self.DetailsLog } for l in Qt4_LogViewBrick.LOGS: if l == "Debug" and not self['showDebug']: pass elif l == "Feedback" and not self['enableFeedback']: pass else: exec("self.tabs.addTab(self.%sLog,'%s')" % (l, Qt4_LogViewBrick.TITLES[l])) exec("self.tabs.setTabToolTip(self.%sLog,'%s')" % (l, Qt4_LogViewBrick.TOOLTIPS[l])) self.layout().addWidget(self.tabs) self.tabs.show() elif propertyName == 'icons': icons_list = newValue.split() for i in range(self.tabs.count()): try: icon_name = icons_list[i] pxmap = Qt4_Icons.load(icon_name) icon_set = QIconSet(pxmap) tab = self.tabs.page(i) self.tabs.setTabIconSet(tab, icon_set) except IndexError: pass try: self.FeedbackLog.submitButton.setIcon( QtGui.QIcon(Qt4_Icons.load(icons_list[-1]))) except IndexError: pass elif propertyName == 'maxLogLines': print("maxLogLines - implement") #for l in Qt4_LogViewBrick.LOGS: # exec("self.%sLog.setMaxLogLines(%d)" % (l,newValue)) else: Qt4_BaseComponents.BlissWidget.propertyChanged( self, propertyName, oldValue, newValue)
def __init__(self, parent = None, name = "task_toolbox"): QtGui.QWidget.__init__(self, parent) self.setObjectName = name # Hardware objects ---------------------------------------------------- self.graphics_manager_hwobj = None # Internal variables -------------------------------------------------- self.tree_brick = None self.previous_page_index = 0 # Graphic elements ---------------------------------------------------- self.method_group_box = QtGui.QGroupBox(" Collection method", self) font = self.method_group_box.font() font.setPointSize(10) self.method_group_box.setFont(font) self.tool_box = QtGui.QToolBox(self.method_group_box) self.tool_box.setObjectName("tool_box") self.tool_box.setFixedWidth(475) self.tool_box.setFont(font) self.discrete_page = CreateDiscreteWidget(self.tool_box, "Discrete",) self.char_page = CreateCharWidget(self.tool_box, "Characterise") self.helical_page = CreateHelicalWidget(self.tool_box, "helical_page") self.energy_scan_page = CreateEnergyScanWidget(self.tool_box, "energy_scan") self.xrf_spectrum_page = CreateXRFSpectrumWidget(self.tool_box, "xrf_spectrum") self.advanced_page = CreateAdvancedWidget(self.tool_box, "advanced_scan") self.tool_box.addItem(self.discrete_page, "Standard Collection") self.tool_box.addItem(self.char_page, "Characterisation") self.tool_box.addItem(self.helical_page, "Helical Collection") self.tool_box.addItem(self.energy_scan_page, "Energy Scan") self.tool_box.addItem(self.xrf_spectrum_page, "XRF Spectrum") self.tool_box.addItem(self.advanced_page, "Advanced") self.button_box = QtGui.QWidget(self) self.create_task_button = QtGui.QPushButton(" Add to queue", self.button_box) self.create_task_button.setIcon(QtGui.QIcon(Qt4_Icons.load("add_row.png"))) msg = "Add the collection method to the selected sample" self.create_task_button.setToolTip(msg) # Layout -------------------------------------------------------------- _method_group_box_vlayout = QtGui.QVBoxLayout(self.method_group_box) _method_group_box_vlayout.addWidget(self.tool_box) _method_group_box_vlayout.setSpacing(0) _method_group_box_vlayout.setContentsMargins(0, 0, 0, 0) _button_box_hlayout = QtGui.QHBoxLayout(self.button_box) _button_box_hlayout.addStretch(0) _button_box_hlayout.addWidget(self.create_task_button) _button_box_hlayout.setSpacing(0) _button_box_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtGui.QVBoxLayout(self) _main_vlayout.addWidget(self.method_group_box) #_main_vlayout.addStretch(0) _main_vlayout.addWidget(self.button_box) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # Qt signal/slot connections ------------------------------------------ self.create_task_button.clicked.connect(self.create_task_button_click) self.tool_box.currentChanged.connect(self.current_page_changed)
def __init__(self, parent = None, name = "data_collect", selection_changed = None): """ Descript. : """ QtGui.QWidget.__init__(self, parent) self.setObjectName(name) # Hardware objects ---------------------------------------------------- self.queue_hwobj = None self.queue_model_hwobj = None self.beamline_setup_hwobj = None self.sample_changer_hwobj = None self.hl_motor_hwobj = None # Internal values ----------------------------------------------------- self.collecting = False self.centring_method = 0 self.sample_centring_result = gevent.event.AsyncResult() self.tree_brick = self.parent() self.sample_item_list = [] self.collect_tree_task = None self.user_stopped = False self.selection_changed_cb = None self.collect_stop_cb = None #self.clear_centred_positions_cb = None self.run_cb = None # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.confirm_dialog = ConfirmDialog(self, 'Confirm Dialog') self.confirm_dialog.setModal(True) self.pin_pixmap = Qt4_Icons.load("sample_axis.png") self.task_pixmap = Qt4_Icons.load("task.png") self.play_pixmap = Qt4_Icons.load("VCRPlay.png") self.stop_pixmap = Qt4_Icons.load("Stop.png") self.up_pixmap = Qt4_Icons.load("Up2.png") self.down_pixmap = Qt4_Icons.load("Down2.png") self.delete_pixmap = Qt4_Icons.load("bin_small.png") self.ispyb_pixmap = Qt4_Icons.load("SampleChanger2.png") self.caution_pixmap = Qt4_Icons.load("Caution2.png") self.button_widget = QtGui.QWidget(self) self.up_button = QtGui.QPushButton(self.button_widget) self.up_button.setIcon(QtGui.QIcon(self.up_pixmap)) self.up_button.setFixedHeight(25) self.down_button = QtGui.QPushButton(self.button_widget) self.down_button.setIcon(QtGui.QIcon(self.down_pixmap)) self.down_button.setFixedHeight(25) self.delete_button = QtGui.QPushButton(self.button_widget) self.delete_button.setIcon(QtGui.QIcon(self.delete_pixmap)) self.delete_button.setDisabled(True) self.delete_button.setToolTip("Delete highlighted queue entries") self.collect_button = QtGui.QPushButton(self.button_widget) self.collect_button.setText("Collect Queue") self.collect_button.setFixedWidth(125) self.collect_button.setIcon(QtGui.QIcon(self.play_pixmap)) Qt4_widget_colors.set_widget_color(self.collect_button, Qt4_widget_colors.LIGHT_GREEN) self.continue_button = QtGui.QPushButton(self.button_widget) self.continue_button.setText('Pause') self.continue_button.setEnabled(True) self.continue_button.setFixedWidth(75) self.continue_button.setToolTip("Pause after current data collection") self.sample_tree_widget = QtGui.QTreeWidget(self) # Layout -------------------------------------------------------------- button_widget_grid_layout = QtGui.QGridLayout(self) button_widget_grid_layout.addWidget(self.up_button, 0, 0) button_widget_grid_layout.addWidget(self.down_button, 0, 1) button_widget_grid_layout.addWidget(self.collect_button, 1, 0, 1, 2) button_widget_grid_layout.addWidget(self.delete_button, 0, 3) button_widget_grid_layout.addWidget(self.continue_button, 1, 3) button_widget_grid_layout.setColumnStretch(2, 1) button_widget_grid_layout.setContentsMargins(0, 0, 0, 0) button_widget_grid_layout.setSpacing(1) self.button_widget.setLayout(button_widget_grid_layout) main_layout = QtGui.QVBoxLayout(self) main_layout.addWidget(self.sample_tree_widget) main_layout.addWidget(self.button_widget) main_layout.setContentsMargins(2, 2, 2, 2) main_layout.setSpacing(1) self.setLayout(main_layout) # SizePolicies -------------------------------------------------------- #self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, # QtGui.QSizePolicy.Expanding)) #self.sample_tree_widget.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, # QtGui.QSizePolicy.Expanding)) # Qt signal/slot connections ------------------------------------------ self.up_button.clicked.connect(self.up_click) self.down_button.clicked.connect(self.down_click) self.delete_button.clicked.connect(self.delete_click) self.collect_button.clicked.connect(self.collect_stop_toggle) self.sample_tree_widget.itemSelectionChanged.\ connect(self.sample_tree_widget_selection) self.connect(self.sample_tree_widget, QtCore.SIGNAL("customContextMenuRequested (const QPoint & pos)"), self.show_context_menu) #tCore.QObject.connect(self.sample_tree_widget, # QtCore.SIGNAL("itemRenamed(QListViewItem *, int , const QString& )"), # self.item_renamed) self.sample_tree_widget.itemDoubleClicked.connect(self.item_double_click) self.sample_tree_widget.itemClicked.connect(self.item_click) self.connect(self.confirm_dialog, QtCore.SIGNAL("continue_clicked"), self.collect_items) self.continue_button.clicked.connect(self.continue_button_click) # Other --------------------------------------------------------------- self.sample_tree_widget.setColumnCount(2) self.sample_tree_widget.setColumnWidth(0, 200) self.sample_tree_widget.header().hide() self.sample_tree_widget.setRootIsDecorated(1) self.sample_tree_widget.setCurrentItem(self.sample_tree_widget.topLevelItem(0)) self.setAttribute(QtCore.Qt.WA_WState_Polished) self.sample_tree_widget.viewport().installEventFilter(self) #self.setFixedWidth(315) self.collect_button.setDisabled(True) self.setWindowTitle("Data collect")
def __init__(self, parent=None, name="data_collect", selection_changed=None): """ Descript. : """ QtGui.QWidget.__init__(self, parent) self.setObjectName(name) # Hardware objects ---------------------------------------------------- self.queue_hwobj = None self.queue_model_hwobj = None self.beamline_setup_hwobj = None self.sample_changer_hwobj = None self.hl_motor_hwobj = None # Internal values ----------------------------------------------------- self.collecting = False self.centring_method = 0 self.sample_centring_result = gevent.event.AsyncResult() self.tree_brick = self.parent() self.sample_item_list = [] self.collect_tree_task = None self.user_stopped = False self.selection_changed_cb = None self.collect_stop_cb = None #self.clear_centred_positions_cb = None self.run_cb = None # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Graphic elements ---------------------------------------------------- self.confirm_dialog = ConfirmDialog(self, 'Confirm Dialog') self.confirm_dialog.setModal(True) self.pin_pixmap = Qt4_Icons.load("sample_axis.png") self.task_pixmap = Qt4_Icons.load("task.png") self.play_pixmap = Qt4_Icons.load("VCRPlay.png") self.stop_pixmap = Qt4_Icons.load("Stop.png") self.up_pixmap = Qt4_Icons.load("Up2.png") self.down_pixmap = Qt4_Icons.load("Down2.png") self.delete_pixmap = Qt4_Icons.load("bin_small.png") self.ispyb_pixmap = Qt4_Icons.load("SampleChanger2.png") self.caution_pixmap = Qt4_Icons.load("Caution2.png") self.button_widget = QtGui.QWidget(self) self.up_button = QtGui.QPushButton(self.button_widget) self.up_button.setIcon(QtGui.QIcon(self.up_pixmap)) self.up_button.setFixedHeight(25) self.down_button = QtGui.QPushButton(self.button_widget) self.down_button.setIcon(QtGui.QIcon(self.down_pixmap)) self.down_button.setFixedHeight(25) self.delete_button = QtGui.QPushButton(self.button_widget) self.delete_button.setIcon(QtGui.QIcon(self.delete_pixmap)) self.delete_button.setDisabled(True) self.delete_button.setToolTip("Delete highlighted queue entries") self.collect_button = QtGui.QPushButton(self.button_widget) self.collect_button.setText("Collect Queue") self.collect_button.setFixedWidth(125) self.collect_button.setIcon(QtGui.QIcon(self.play_pixmap)) Qt4_widget_colors.set_widget_color(self.collect_button, Qt4_widget_colors.LIGHT_GREEN) self.continue_button = QtGui.QPushButton(self.button_widget) self.continue_button.setText('Pause') self.continue_button.setEnabled(True) self.continue_button.setFixedWidth(75) self.continue_button.setToolTip("Pause after current data collection") self.sample_tree_widget = QtGui.QTreeWidget(self) # Layout -------------------------------------------------------------- button_widget_grid_layout = QtGui.QGridLayout(self) button_widget_grid_layout.addWidget(self.up_button, 0, 0) button_widget_grid_layout.addWidget(self.down_button, 0, 1) button_widget_grid_layout.addWidget(self.collect_button, 1, 0, 1, 2) button_widget_grid_layout.addWidget(self.delete_button, 0, 3) button_widget_grid_layout.addWidget(self.continue_button, 1, 3) button_widget_grid_layout.setColumnStretch(2, 1) button_widget_grid_layout.setContentsMargins(0, 0, 0, 0) button_widget_grid_layout.setSpacing(1) self.button_widget.setLayout(button_widget_grid_layout) main_layout = QtGui.QVBoxLayout(self) main_layout.addWidget(self.sample_tree_widget) main_layout.addWidget(self.button_widget) main_layout.setContentsMargins(2, 2, 2, 2) main_layout.setSpacing(1) self.setLayout(main_layout) # SizePolicies -------------------------------------------------------- #self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, # QtGui.QSizePolicy.Expanding)) self.sample_tree_widget.setSizePolicy( QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)) # Qt signal/slot connections ------------------------------------------ self.up_button.clicked.connect(self.up_click) self.down_button.clicked.connect(self.down_click) self.delete_button.clicked.connect(self.delete_click) self.collect_button.clicked.connect(self.collect_stop_toggle) self.sample_tree_widget.itemSelectionChanged.\ connect(self.sample_tree_widget_selection) self.connect( self.sample_tree_widget, QtCore.SIGNAL("customContextMenuRequested (const QPoint & pos)"), self.show_context_menu) #tCore.QObject.connect(self.sample_tree_widget, # QtCore.SIGNAL("itemRenamed(QListViewItem *, int , const QString& )"), # self.item_renamed) self.sample_tree_widget.itemDoubleClicked.connect( self.item_double_click) self.sample_tree_widget.itemClicked.connect(self.item_click) self.connect(self.confirm_dialog, QtCore.SIGNAL("continue_clicked"), self.collect_items) self.continue_button.clicked.connect(self.continue_button_click) # Other --------------------------------------------------------------- self.sample_tree_widget.setColumnCount(2) self.sample_tree_widget.setColumnWidth(0, 200) self.sample_tree_widget.setColumnWidth(1, 200) self.sample_tree_widget.header().hide() self.sample_tree_widget.setRootIsDecorated(1) self.sample_tree_widget.setCurrentItem( self.sample_tree_widget.topLevelItem(0)) self.setAttribute(QtCore.Qt.WA_WState_Polished) self.sample_tree_widget.viewport().installEventFilter(self) #self.setFixedWidth(315) self.collect_button.setDisabled(True) self.setWindowTitle("Data collect")
def __init__(self, parent = None, name = "parameter_widget"): QtGui.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Properties ---------------------------------------------------------- # Signals ------------------------------------------------------------ # Slots --------------------------------------------------------------- # Hardware objects ---------------------------------------------------- self._beamline_setup_hwobj = None # Internal variables -------------------------------------------------- self._data_collection = None self.add_dc_cb = None self._tree_view_item = None # Graphic elements ---------------------------------------------------- _dc_parameters_widget = QtGui.QWidget(self) self.caution_pixmap = Qt4_Icons.load("Caution2.png") self.path_widget = DataPathWidget(_dc_parameters_widget) self.acq_widget = AcquisitionWidget(_dc_parameters_widget, layout = 'horizontal') #self.acq_widget.setFixedHeight(170) self.processing_widget = ProcessingWidget(_dc_parameters_widget) self.position_widget = uic.loadUi(os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) #self.position_widget.setMinimumSize(310, 210) # Layout -------------------------------------------------------------- _dc_parameters_widget_layout = QtGui.QVBoxLayout(self) _dc_parameters_widget_layout.addWidget(self.path_widget) _dc_parameters_widget_layout.addWidget(self.acq_widget) _dc_parameters_widget_layout.addWidget(self.processing_widget) _dc_parameters_widget_layout.setSpacing(2) _dc_parameters_widget_layout.addStretch(0) _dc_parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _dc_parameters_widget.setLayout(_dc_parameters_widget_layout) _main_hlayout = QtGui.QHBoxLayout(self) _main_hlayout.addWidget(_dc_parameters_widget) _main_hlayout.addWidget(self.position_widget) _main_hlayout.setSpacing(2) _main_hlayout.setContentsMargins(0, 0, 0, 0) _main_hlayout.addStretch(0) self.setLayout(_main_hlayout) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ self.path_widget.data_path_layout.prefix_ledit.textChanged.connect( self._prefix_ledit_change) self.path_widget.data_path_layout.run_number_ledit.textChanged.connect( self._run_number_ledit_change) self.connect(self.acq_widget, QtCore.SIGNAL('mad_energy_selected'), self.mad_energy_selected) self.connect(self.acq_widget, QtCore.SIGNAL("path_template_changed"), self.handle_path_conflict) #QtCore.QObject.connect(QtGui.QApplication, QtCore.SIGNAL('tab_changed'), # self.tab_changed) # Other --------------------------------------------------------------- Qt4_widget_colors.set_widget_color(self.path_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.acq_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.processing_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.position_widget, Qt4_widget_colors.GROUP_BOX_GRAY)
def __init__(self, parent = None, name = "task_toolbox"): QtGui.QWidget.__init__(self, parent) self.setObjectName = name # LNLS self.parent = parent # Hardware objects ---------------------------------------------------- self.graphics_manager_hwobj = None # Internal variables -------------------------------------------------- self.tree_brick = None self.previous_page_index = 0 # Graphic elements ---------------------------------------------------- self.method_group_box = QtGui.QGroupBox(" Collection method", self) font = self.method_group_box.font() font.setPointSize(10) self.method_group_box.setFont(font) # ------------------------------------------------------- # LNLS style_string = """QToolBox { background-color: rgb(0,128,255); }""" self.setStyleSheet(style_string) # ------------------------------------------------------- self.tool_box = QtGui.QToolBox(self.method_group_box) self.tool_box.setObjectName("tool_box") self.tool_box.setFixedWidth(475) # LNLS self.tool_box.setFixedHeight(705) self.tool_box.setFont(font) self.discrete_page = CreateDiscreteWidget(self.tool_box, "Discrete", parent_class=self) # LNLS #self.char_page = CreateCharWidget(self.tool_box, "Characterise") #self.helical_page = CreateHelicalWidget(self.tool_box, "helical_page") self.energy_scan_page = CreateEnergyScanWidget(self.tool_box, "energy_scan", parent_class=self) #self.xrf_spectrum_page = CreateXRFSpectrumWidget(self.tool_box, "xrf_spectrum") #self.advanced_page = CreateAdvancedWidget(self.tool_box, "advanced_scan") self.tool_box.addItem(self.discrete_page, QtGui.QIcon(Qt4_Icons.load("down_small.png")), "Standard Collection") #self.tool_box.addItem(self.char_page, "Characterisation") #self.tool_box.addItem(self.helical_page, "Helical Collection") self.tool_box.addItem(self.energy_scan_page, QtGui.QIcon(Qt4_Icons.load("down_small.png")), "Energy Scan") #self.tool_box.addItem(self.xrf_spectrum_page, "XRF Spectrum") #self.tool_box.addItem(self.advanced_page, "Advanced") self.button_box = QtGui.QWidget(self) self.create_task_button = QtGui.QPushButton(" Add to queue", self.button_box) self.create_task_button.setIcon(QtGui.QIcon(Qt4_Icons.load("add_row.png"))) msg = "Add the collection method to the selected sample" self.create_task_button.setToolTip(msg) # Layout -------------------------------------------------------------- _method_group_box_vlayout = QtGui.QVBoxLayout(self.method_group_box) _method_group_box_vlayout.addWidget(self.tool_box) _method_group_box_vlayout.setSpacing(0) _method_group_box_vlayout.setContentsMargins(0, 0, 0, 0) _button_box_hlayout = QtGui.QHBoxLayout(self.button_box) _button_box_hlayout.addStretch(0) _button_box_hlayout.addWidget(self.create_task_button) _button_box_hlayout.setSpacing(0) _button_box_hlayout.setContentsMargins(0, 0, 0, 0) _main_vlayout = QtGui.QVBoxLayout(self) _main_vlayout.addWidget(self.method_group_box) #_main_vlayout.addStretch(0) _main_vlayout.addWidget(self.button_box) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0) # SizePolicies -------------------------------------------------------- self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) # Qt signal/slot connections ------------------------------------------ self.create_task_button.clicked.connect(self.create_task_button_click) self.tool_box.currentChanged.connect(self.current_page_changed)
def add_item(self, item_cfg, parent): """ Descript. : """ item_type = item_cfg["type"] item_name = item_cfg["name"] newItem = None try: klass = WindowDisplayWidget.items[item_type] except KeyError: newItem = item_cfg["brick"] else: newItem = klass(parent, item_cfg["name"], executionMode=self.execution_mode) if item_type in ("vbox", "hbox", "vgroupbox", "hgroupbox"): if item_cfg["properties"]["color"] is not None: try: qtcolor = QtGui.QColor(item_cfg["properties"]["color"]) newItem_palette = newItem.palette() newItem_palette.setColor( QtGui.QPalette.Background, QtGui.QColor(qtcolor.red(), qtcolor.green(), qtcolor.blue())) newItem.setPalette(newItem_palette) except: logging.getLogger().exception( "Could not set color on item %s", item_cfg["name"]) if item_type.endswith("groupbox"): newItem.setTitle(item_cfg["properties"]["label"]) newItem.layout().setSpacing(item_cfg["properties"]["spacing"]) newItem.layout().setMargin(item_cfg["properties"]["margin"]) frame_style = QtGui.QFrame.NoFrame if item_cfg["properties"]["frameshape"] != "default": frame_style = getattr(QtGui.QFrame, item_cfg["properties"]["frameshape"]) if item_cfg["properties"]["shadowstyle"] != "default": frame_style = frame_style | getattr( QtGui.QFrame, item_cfg["properties"]["shadowstyle"].capitalize()) if frame_style != QtGui.QFrame.NoFrame: try: newItem.setFrameStyle(frame_style) except: logging.getLogger().exception( "Could not set frame style on item %s", item_cfg["name"]) if item_cfg["properties"]["fixedwidth"] > -1: newItem.setFixedWidth(item_cfg["properties"]["fixedwidth"]) if item_cfg["properties"]["fixedheight"] > -1: newItem.setFixedHeight( item_cfg["properties"]["fixedheight"]) elif item_type == "icon": img = QtGui.QPixmap() if img.load(item_cfg["properties"]["filename"]): newItem.setPixmap(img) elif item_type == "label": newItem.setText(item_cfg["properties"]["text"]) elif item_type == "tab": item_cfg.widget = newItem newItem.close_tab_button = QtGui.QToolButton(newItem) newItem.close_tab_button.setIcon( QtGui.QIcon(Qt4_Icons.load('delete_small'))) newItem.setCornerWidget(newItem.close_tab_button) newItem.close_tab_button.hide() def close_current_page(): tab = newItem slot_name = "hidePage_%s" % str( tab.tabText(tab.currentIndex())) slot_name = slot_name.replace(" ", "_") getattr(tab, slot_name)() #QtGui.QApplication.emit(QtCore.SIGNAL('tab_closed'), tab, slotName) def current_page_changed(index): item_cfg.notebookPageChanged(newItem.tabText(index)) newItem._close_current_page_cb = close_current_page newItem.currentChanged.connect(current_page_changed) newItem.close_tab_button.clicked.connect(close_current_page) elif item_type == "vsplitter" or type == "hsplitter": pass newItem.show() return newItem