def setHoverIcon(self, icon): """ Sets the icon that will be used when this hotspot is hovered. :param icon | <QIcon> || None """ icon = QIcon(icon) if not icon.isNull(): self._hoverIcon = QIcon(icon) else: self._hoverIcon = None
def setIcon(self, icon): """ Sets the icon for this hotspot. If this method is called with a valid icon, then the style will automatically switch to Icon, otherwise, the style will be set to Invisible. :param icon | <QIcon> || <str> || None """ icon = QIcon(icon) if icon.isNull(): self._icon = None self._style = XNodeHotspot.Style.Invisible else: self._icon = icon self._style = XNodeHotspot.Style.Icon
def icon(self): default = projex.resources.find('img/logo_16.png') return QIcon(getattr(Base, '__designer_icon__', default))
def setupActions(self): viewWidget = self.viewWidget() self.addSection('Views') self._pluginMenu = XViewPluginMenu(self.viewWidget()) self._pluginMenu.setTitle('Switch View') self.addMenu(self._pluginMenu) self._pluginMenu.triggered.disconnect(self._pluginMenu.addView) self._pluginMenu.setIcon(QIcon(resources.find('img/view/switch.png'))) self._pluginMenu.triggered.connect(self.swapTabType) # create view grouping options self._groupingMenu = self.addMenu('Set Group') icon = QIcon(resources.find('img/view/group.png')) self._groupingMenu.setIcon(icon) act = self._groupingMenu.addAction('No Grouping') act.setData(wrapVariant(0)) act.setCheckable(True) self._groupingMenu.addSeparator() self._groupingGroup.addAction(act) for i in range(1, 6): act = self._groupingMenu.addAction('Group %i' % i) act.setData(wrapVariant(i)) act.setCheckable(True) self._groupingGroup.addAction(act) self._groupingMenu.triggered.connect(self.assignGroup) self.setTitle('Tabs') self.addSection('Tabs') act = self.addAction('Rename Tab') act.setIcon(QIcon(resources.find('img/edit.png'))) act.triggered.connect(self.renamePanel) act = self.addAction('Detach Tab') act.setIcon(QIcon(resources.find('img/view/detach.png'))) act.triggered.connect(self.detachPanel) act = self.addAction('Detach Tab (as a Copy)') act.setIcon(QIcon(resources.find('img/view/detach_copy.png'))) act.triggered.connect(self.detachPanelCopy) act = self.addAction('Close Tab') act.setIcon(QIcon(resources.find('img/view/tab_remove.png'))) act.triggered.connect(self.closeView) self.addSeparator() act = self.addAction('Hide Tabs when Locked') act.triggered[bool].connect(self.setHideTabsWhenLocked) act.setCheckable(True) self._hideAction = act self.addSection('Panels') act = self.addAction('Split Panel Left/Right') act.setIcon(QIcon(resources.find('img/view/split_horizontal.png'))) act.triggered.connect(self.splitHorizontal) split_adv = QAction(self) split_adv.setIcon(QIcon(resources.find('img/advanced.png'))) split_adv.setToolTip('Specify number of columns for split') split_adv.triggered.connect(self.splitHorizontalAdvanced) self.setAdvancedAction(act, split_adv) act = self.addAction('Split Panel Top/Bottom') act.setIcon(QIcon(resources.find('img/view/split_vertical.png'))) act.triggered.connect(self.splitVertical) split_adv = QAction(self) split_adv.setIcon(QIcon(resources.find('img/advanced.png'))) split_adv.setToolTip('Specify number of rows for split') split_adv.triggered.connect(self.splitVerticalAdvanced) self.setAdvancedAction(act, split_adv)
def setupActions(self): # initialize the menu viewWidget = self.viewWidget() self.setTitle('Panel Options') self.addSection('Panels') act = self.addAction('Split Panel Left/Right') act.setIcon(QIcon(resources.find('img/view/split_horizontal.png'))) act.triggered.connect(self.splitHorizontal) split_adv = QAction(self) split_adv.setIcon(QIcon(resources.find('img/advanced.png'))) split_adv.setToolTip('Specify number of columns for split') split_adv.triggered.connect(self.splitHorizontalAdvanced) self.setAdvancedAction(act, split_adv) act = self.addAction('Split Panel Top/Bottom') act.setIcon(QIcon(resources.find('img/view/split_vertical.png'))) act.triggered.connect(self.splitVertical) split_adv = QAction(self) split_adv.setIcon(QIcon(resources.find('img/advanced.png'))) split_adv.setToolTip('Specify number of rows for split') split_adv.triggered.connect(self.splitVerticalAdvanced) self.setAdvancedAction(act, split_adv) self.addSeparator() menu = self.addMenu('Add...') menu.setIcon(QIcon(resources.find('img/view/add.png'))) act = menu.addAction('Row Above') act.setIcon(QIcon(resources.find('img/view/up.png'))) act = menu.addAction('Row Below') act.setIcon(QIcon(resources.find('img/view/down.png'))) menu.addSeparator() act = menu.addAction('Column Left') act.setIcon(QIcon(resources.find('img/view/left.png'))) act = menu.addAction('Column Right') act.setIcon(QIcon(resources.find('img/view/right.png'))) menu.triggered.connect(self.addPanel) # create pane options menu menu = self.addMenu('Move...') menu.setIcon(QIcon(resources.find('img/view/switch.png'))) act = menu.addAction('Row Up') act.setIcon(QIcon(resources.find('img/view/up.png'))) act = menu.addAction('Row Down') act.setIcon(QIcon(resources.find('img/view/down.png'))) menu.addSeparator() act = menu.addAction('Column Left') act.setIcon(QIcon(resources.find('img/view/left.png'))) act = menu.addAction('Column Right') act.setIcon(QIcon(resources.find('img/view/right.png'))) menu.triggered.connect(self.switchPanels) self.addSeparator() act = self.addAction('Close Section (All Tabs)') act.setIcon(QIcon(resources.find('img/view/close.png'))) act.triggered.connect(self.closePanel)
def __init__(self, parent=None): super(XChart, self).__init__(parent) # load the interface projexui.loadUi(__file__, self) # define custom properties self._renderer = None self._chartTitle = '' self._axes = [] self._datasets = [] self._horizontalAxis = None self._verticalAxis = None self._showDatasetToolbar = True self._showTypeButton = True self._dataChanged = False self._showGrid = True self._showRows = True self._showColumns = True self._showXAxis = True self._showYAxis = True # set default properties self.uiChartVIEW.setScene(XChartScene(self)) self.uiXAxisVIEW.setScene(XChartScene(self)) self.uiYAxisVIEW.setScene(XChartScene(self)) self.uiChartVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft) self.uiXAxisVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft) self.uiYAxisVIEW.setAlignment(Qt.AlignTop | Qt.AlignLeft) self.uiDatasetTBAR.setFixedHeight(32) self.uiXAxisVIEW.hide() self.uiYAxisVIEW.hide() self.setAutoFillBackground(True) self.setBackgroundRole(QPalette.Base) self.setStyleSheet(STYLE) self.uiChartVIEW.setMouseTracking(True) self.uiDatasetTBAR.setStyleSheet(TOOLBAR_STYLE) # load renderers for renderer in XChartRenderer.plugins(): act = QAction('%s Chart' % renderer, self) ico = 'img/chart/%s.png' % renderer.lower() act.setIcon(QIcon(resources.find(ico))) self.uiTypeBTN.addAction(act) # assign the default renderer if not self.uiTypeBTN.defaultAction(): self._renderer = XChartRenderer.plugin(renderer) self.uiTypeBTN.setDefaultAction(act) # create connections chart_hbar = self.uiChartVIEW.horizontalScrollBar() chart_vbar = self.uiChartVIEW.verticalScrollBar() x_bar = self.uiXAxisVIEW.horizontalScrollBar() y_bar = self.uiYAxisVIEW.verticalScrollBar() chart_hbar.valueChanged.connect(self.syncScrollbars) chart_hbar.rangeChanged.connect(self.syncScrollbars) y_bar.valueChanged.connect(self.syncScrollbars) y_bar.rangeChanged.connect(self.syncScrollbars) self.uiTypeBTN.triggered.connect(self.assignRenderer)
def showProfileMenu(self, point): """ Prompts the user for profile menu options. Editing needs to be enabled for this to work. """ if not self.isEditingEnabled(): return trigger = self.actionAt(point) if (isinstance(trigger, XViewProfileAction)): prof = trigger.profile() else: prof = None # define the menu menu = QMenu(self) acts = {} text = self.profileText() # user right clicked on a profile if prof: acts['edit'] = menu.addAction('Edit {0}...'.format(text)) acts['save'] = menu.addAction('Save Layout') menu.addSeparator() acts['copy'] = menu.addAction('Copy {0}'.format(text)) acts['export'] = menu.addAction('Export {0}...'.format(text)) menu.addSeparator() acts['remove'] = menu.addAction('Delete {0}'.format(text)) # show toolbar options else: acts['new'] = menu.addAction('New Layout'.format(text)) menu.addSeparator() acts['save_as'] = menu.addAction('Save Layout as...') if QApplication.clipboard().text(): acts['paste'] = menu.addAction('Paste {0}'.format(text)) acts['import'] = menu.addAction('Import {0}...'.format(text)) for key, act in acts.items(): act.setIcon(QIcon(resources.find('img/{0}.png'.format(key)))) # run the menu act = menu.exec_(QCursor.pos()) # create a new profile if act is None: return elif act == acts.get('new'): self.clearActive() # create a new clear profile elif act == acts.get('save_as'): self.saveProfileAs() # edit an existing profile elif act == acts.get('edit'): self.editProfile(prof) # save or create a new profile elif act == acts.get('save'): self.saveProfileLayout(prof) # copy profile elif act == acts.get('copy'): QApplication.clipboard().setText(prof.toString()) # export elif act == acts.get('export'): self.exportProfile(prof) # export elif act == acts.get('import'): self.importProfile() # paste profile elif act == acts.get('paste'): text = QApplication.clipboard().text() try: prof = XViewProfile.fromString(text) except: prof = None QMessageBox.information(self.window(), 'Invalid {0}'.format(text), 'The clipboard text does not contain '\ 'a properly formated {0}'.format(text)) if prof and not prof.isEmpty(): self.createProfile(profile=prof) # paste as profile elif act == acts.get('paste_as'): text = QApplication.clipboard().text() prof = XViewProfile.fromString(text) if not prof.isEmpty(): if XViewProfileDialog.edit(self, prof): self.createProfile(profile=prof) # remove the profile elif act == acts.get('remove'): self.removeProfile(prof)