def update_client_data(self, *args): self.client_data.update(*args) self.ui.toolButtonIcon.setIcon( get_app_icon(self.client_data.icon, self)) self.ui.toolButtonFavorite.set_template(self._name, self.client_data.icon, self._factory)
def update_client_data(self): # set main label and main disposition self.update_disposition() # set tool tip tool_tip = "<html><head/><body>" tool_tip += "<p><span style=\" font-weight:600;\">%s<br></span>" \ % self.client.name tool_tip += "<span style=\" font-style:italic;\">%s</span></p>" \ % self.client.description tool_tip += "<p></p>" tool_tip += "<p>%s : %s<br>" \ % (_translate('client_slot', 'Protocol'), ray.protocol_to_str(self.client.protocol)) tool_tip += "%s : %s<br>" \ % (_translate('client_slot', 'Executable'), self.client.executable_path) tool_tip += "%s : %s</p>" \ % (_translate('client_slot', 'client id'), self.client.client_id) tool_tip += "</body></html>" self.ui.ClientName.setToolTip(tool_tip) # set icon self._icon_on = get_app_icon(self.client.icon, self) self._icon_off = QIcon(self._icon_on.pixmap(32, 32, QIcon.Disabled)) self._gray_icon(False)
def contextMenuEvent(self, event): if not self.itemAt(event.pos()): self.setCurrentRow(-1) if (self.session is not None and not self.session.server_status in (ray.ServerStatus.OFF, ray.ServerStatus.CLOSE, ray.ServerStatus.OUT_SAVE, ray.ServerStatus.WAIT_USER, ray.ServerStatus.OUT_SNAPSHOT)): menu = QMenu() fav_menu = QMenu(_translate('menu', 'Favorites'), menu) fav_menu.setIcon(QIcon(':scalable/breeze/star-yellow')) for favorite in self.session.favorite_list: act_app = fav_menu.addAction( get_app_icon(favorite.icon, self), favorite.name) act_app.setData([favorite.name, favorite.factory]) act_app.triggered.connect(self._launch_favorite) menu.addMenu(fav_menu) menu.addAction(self.session.main_win.ui.actionAddApplication) menu.addAction(self.session.main_win.ui.actionAddExecutable) act_selected = menu.exec(self.mapToGlobal(event.pos())) event.accept() return
def update_client_data(self): # set main label and main disposition self.update_disposition() # set tool tip tool_tip = "<html><head/><body>" tool_tip += "<p><span style=\" font-weight:600;\">%s<br></span>" \ % self.client.name tool_tip += "<span style=\" font-style:italic;\">%s</span></p>" \ % self.client.description tool_tip += "<p></p>" tool_tip += "<p>%s : %s<br>" \ % (_translate('client_slot', 'Protocol'), ray.protocol_to_str(self.client.protocol)) tool_tip += "%s : %s<br>" \ % (_translate('client_slot', 'Executable'), self.client.executable_path) tool_tip += "%s : %s</p>" \ % (_translate('client_slot', 'client id'), self.client.client_id) tool_tip += "</body></html>" self.ui.ClientName.setToolTip(tool_tip) # set icon self._icon_on = get_app_icon(self.client.icon, self) self._icon_off = QIcon(self._icon_on.pixmap(32, 32, QIcon.Disabled)) self._gray_icon( bool(self.client.status in (ray.ClientStatus.STOPPED, ray.ClientStatus.PRECOPY))) self.ui.toolButtonGUI.setVisible( bool(':optional-gui:' in self.client.capabilities)) if self.client.executable_path in ('ray-proxy', 'nsm-proxy'): if is_dark_theme(self): self._icon_visible = QIcon() self._icon_visible.addPixmap( QPixmap(':scalable/breeze-dark/emblem-symbolic-link'), QIcon.Normal, QIcon.Off) self._icon_invisible = QIcon() self._icon_invisible.addPixmap( QPixmap(':scalable/breeze-dark/link'), QIcon.Normal, QIcon.Off) self._icon_invisible.addPixmap( QPixmap(':scalable/breeze-dark/disabled/link'), QIcon.Disabled, QIcon.Off) else: self._icon_visible = QIcon() self._icon_visible.addPixmap( QPixmap(':scalable/breeze/emblem-symbolic-link'), QIcon.Normal, QIcon.Off) self._icon_invisible = QIcon() self._icon_invisible.addPixmap( QPixmap(':scalable/breeze/link'), QIcon.Normal, QIcon.Off) self._icon_invisible.addPixmap( QPixmap(':scalable/breeze/disabled/link'), QIcon.Disabled, QIcon.Off)
def __init__(self, parent, client): ChildDialog.__init__(self, parent) self.ui = ui.client_rename.Ui_Dialog() self.ui.setupUi(self) self.client = client self.ui.toolButtonIcon.setIcon(get_app_icon(client.icon, self)) self.ui.labelClientLabel.setText(client.prettier_name()) self.ui.lineEdit.setText(client.prettier_name()) self.ui.lineEdit.selectAll() self.ui.lineEdit.setFocus()
def _update_template_infos(self, item): self.ui.widgetTemplateInfos.setVisible(bool(item)) self.ui.widgetNoTemplate.setVisible(not bool(item)) if not item: return cdata = item.client_data self.ui.toolButtonIcon.setIcon(get_app_icon(cdata.icon, self)) template_name = item.data(TEMPLATE_NAME_DATA) self.ui.labelTemplateName.setText(item.get_display_name()) #self.ui.labelTemplateName.setText(template_name) self.ui.labelDescription.setText(cdata.description) self.ui.labelProtocol.setText(ray.protocol_to_str(cdata.protocol)) self.ui.labelExecutable.setText(cdata.executable_path) self.ui.labelLabel.setText(cdata.label) self.ui.labelName.setText(cdata.name) for widget in (self.ui.labelProtocolTitle, self.ui.labelProtocolColon, self.ui.labelProtocol): widget.setVisible(bool(cdata.protocol != ray.Protocol.NSM)) for widget in (self.ui.labelLabelTitle, self.ui.labelLabelColon, self.ui.labelLabel): widget.setVisible(bool(cdata.label)) for widget in (self.ui.labelNameTitle, self.ui.labelNameColon, self.ui.labelName): widget.setVisible(bool(cdata.protocol == ray.Protocol.NSM)) self.ui.toolButtonUser.setVisible(not item.is_factory) self.ui.toolButtonFavorite.set_template(item.data(TEMPLATE_NAME_DATA), cdata.icon, item.is_factory) self.ui.toolButtonFavorite.set_as_favorite( self.session.is_favorite(item.data(TEMPLATE_NAME_DATA), item.is_factory)) self.ui.widgetNonSaveable.setVisible( bool(cdata.ray_hack is not None and cdata.protocol == ray.Protocol.RAY_HACK and cdata.ray_hack.no_save_level > 0)) # little security # client_properties_dialog could crash if ray_hack has not been updated yet # (never seen this appears, but it could with slow systems) self.ui.toolButtonAdvanced.setEnabled( bool(cdata.protocol != ray.Protocol.RAY_HACK or cdata.ray_hack is not None))
def __init__(self, parent, client): AbstractSaveTemplateDialog.__init__(self, parent) self.ui.labelSessionTitle.setVisible(False) self.ui.toolButtonClientIcon.setIcon(get_app_icon(client.icon, self)) self.ui.labelLabel.setText(client.prettier_name()) self.ui.pushButtonAccept.setEnabled(False) self.ui.labelNewTemplateName.setText( _translate('new client template', "New application template name :")) self.signaler.user_client_template_found.connect( self._add_templates_to_list) self.to_daemon('/ray/server/list_user_client_templates') self.ui.lineEdit.setText(client.template_origin) self.ui.lineEdit.selectAll() self.ui.lineEdit.setFocus() self._server_status_changed(self.session.server_status)
def __init__(self, list_widget, session, name, factory, client_data): QFrame.__init__(self) self.ui = ui.template_slot.Ui_Frame() self.ui.setupUi(self) self._factory = factory self._list_widget = list_widget self._name = name self._user_menu = QMenu() self.session = session self.client_data = client_data self.ui.toolButtonIcon.setIcon( get_app_icon(self.client_data.icon, self)) self.ui.label.setText(name) self.ui.toolButtonUser.setVisible(not factory) act_remove_template = QAction(QIcon.fromTheme('edit-delete-remove'), _translate('menu', 'remove'), self._user_menu) act_remove_template.triggered.connect(self.remove_template) self._user_menu.addAction(act_remove_template) self.ui.toolButtonUser.setMenu(self._user_menu) self.ui.toolButtonFavorite.set_session(self.session) self.ui.toolButtonFavorite.set_template(self._name, self.client_data.icon, self._factory) if is_dark_theme(self): self.ui.toolButtonUser.setIcon( QIcon(':scalable/breeze-dark/im-user.svg')) self.ui.toolButtonFavorite.set_dark_theme()
def _change_icon_with_text(self, text: str): icon = get_app_icon(text, self) self.ui.toolButtonIcon.setIcon(icon)