def __init__(self, parent, message, severity, actions=None): QFrame.__init__(self, parent) self.ui = Ui_NotificationFrame() self.ui.setupUi(self) self.ui.closeButton.setIcon(QApplication.style().standardIcon(QStyle.SP_DialogCloseButton)) if severity == self.INFO: bgcolor = "#4398c8" fgcolor = self.palette().base().color().name() icon = self._standardIconAsPixmap(QStyle.SP_MessageBoxInformation) elif severity == self.WARNING: bgcolor = "#d0b05f" fgcolor = self.palette().text().color().name() icon = self._standardIconAsPixmap(QStyle.SP_MessageBoxWarning) elif severity == self.ERROR: bgcolor = "#cda8a8" fgcolor = self.palette().text().color().name() icon = self._standardIconAsPixmap(QStyle.SP_MessageBoxCritical) self.ui.iconLabel.setPixmap(icon) self.ui.messageLabel.setText(message) self._setColor(bgcolor, fgcolor) if actions: for action in reversed(actions): action.triggered.connect(self.deleteLater) b = QToolButton() b.setDefaultAction(action) self.layout().insertWidget(2, b)
def __init__(self, parent=None, horizontal=True): QFrame.__init__(self, parent) self.horizontal = horizontal if horizontal: self.setFrameShape(QFrame.HLine) self.setMinimumHeight(21) self.tilt = 90 else: self.setFrameShape(QFrame.VLine) self.setMinimumWidth(21) self.tilt = 180 self.setFrameShadow(QFrame.Sunken) self.setMidLineWidth(3) self.setMouseTracking(True) self.size = 12 self.min_value = 0.0 self.max_value = 1.0 self.setDefaultColors() self.button = Qt.NoButton self.selected_marker = 'none'
def __init__(self, parent=None, animationEnabled=True): QFrame.__init__(self, parent) self.__animationEnabled = animationEnabled layout = StackLayout() self.__fadeWidget = CrossFadePixmapWidget(self) self.transitionAnimation = \ QPropertyAnimation(self.__fadeWidget, "blendingFactor_", self) self.transitionAnimation.setStartValue(0.0) self.transitionAnimation.setEndValue(1.0) self.transitionAnimation.setDuration(100 if animationEnabled else 0) self.transitionAnimation.finished.connect( self.__onTransitionFinished ) layout.addWidget(self.__fadeWidget) layout.currentChanged.connect(self.__onLayoutCurrentChanged) self.setLayout(layout) self.__widgets = [] self.__currentIndex = -1 self.__nextCurrentIndex = -1
def paintEvent(self, e): painter = QPainter(self) painter.setPen(QColor(self._backgroundColor)) painter.setBrush(QColor(self._backgroundColor)) painter.drawRect(0, 0, self.width(), self.height()) painter.end() QFrame.paintEvent(self, e)
def finalise(self): # cette fonction est a appeler une fois tout le contenu ajoute. line = QFrame(self)#, -1, size=(20,-1), style=wx.LI_HORIZONTAL) line.setFrameStyle(QFrame.HLine) self.sizer.addWidget(line) self.box = QHBoxLayout() ##if wx.Platform != "__WXMSW__": ##btn = wx.ContextHelpButton(self) ##self.box.Add(btn) btn = QPushButton(u" Créer " if self.objet else u"Enregistrer", clicked=self.accept) btn.setWhatsThis(u"Créer l'objet." if self.objet else u"Enregistrer les modifications.") ##btn.SetDefault() #XXX: Action à ajouter !! self.box.addWidget(btn) btn = QPushButton(u"Annuler", clicked=self.close) btn.setWhatsThis(u"Quitter sans rien changer.") self.box.addWidget(btn) self.sizer.addLayout(self.box) self.setLayout(self.sizer) if self.objet: self.champs['nom'].setFocus()
def __init__(self, symbol, color, parent = None): QFrame.__init__(self, parent) self._symbol = symbol self.backColor = color # define and set stylesheets self.setup_stylesheets() self.setStyleSheet(self._theStyleSheet) # layout layout = QHBoxLayout() layout.setContentsMargins( 0, 0, 0, 0 ) self.setToolTip(symbol["description"]) # add the symbol's svg svgWidget = QSvgWidget(symbol["svgPath"]) svgWidth = int(symbol["width"]) self.setMinimumWidth(svgWidth * 25) self.setMaximumWidth(svgWidth * 25) self.setMinimumHeight(25) self.setMaximumHeight(25) layout.addWidget(svgWidget) self.setLayout(layout)
def __init__(self, parent, layer): ''' Constructor ''' QDialog.__init__(self, parent) self.ui = Ui_VectorLayerProPertyDialog() self.ui.setupUi(self) self.ui.txtLayerName.setText(layer.name()) self.ui.txtLayerSource.setText(layer.source()) self.ui.txtCrs.setText(layer.crs().authid() + " - " + layer.crs().description()) self.ui.btnCrsSelect.clicked.connect(self.selectCrs) self.mCrs = layer.crs() self.vLayer = layer self.ui.mOptionsListWidget.currentRowChanged.connect( self.changeStackWidget) ''' init RenderV2 Widget''' self.mRendererDialog = QgsRendererV2PropertiesDialog( self.vLayer, QgsStyleV2.defaultStyle(), True) self.ui.stackedWidget.insertWidget(1, self.mRendererDialog) self.ui.buttonBox.accepted.connect(self.OK) frame_Label = QFrame() verticalLayout_Label = QVBoxLayout(frame_Label) self.mLabelWidget = QgsFieldExpressionWidget() self.mLabelWidget.setLayer(layer) verticalLayout_Label.addWidget(self.mLabelWidget) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) verticalLayout_Label.addItem(spacerItem) frame_Label.setLayout(verticalLayout_Label) self.ui.stackedWidget.insertWidget(2, frame_Label)
def setup_layout(self): outer_layout = QVBoxLayout() outer_layout.addWidget(self.menu_bar) outer_layout.setStretch(0, 1) h_splitter = QSplitter(self) h_splitter.setOrientation(Qt.Horizontal) # FIRST COLUMN of h_splitter is chromatogram + peakmap: ############################ v_splitter1 = QSplitter(self) v_splitter1.setOrientation(Qt.Vertical) v_splitter1.addWidget(self.eic_plotter) v_splitter1.addWidget(self.peakmap_plotter) self.peakmap_plotter.setMinimumSize(250, 200) v_splitter1.setStretchFactor(0, 1) v_splitter1.setStretchFactor(1, 3) h_splitter.addWidget(v_splitter1) h_splitter.setStretchFactor(0, 2) # SECOND COLUMN of h_splittier holds controlx boxes + mz plot ####################### v_splitter2 = QSplitter(self) v_splitter2.setOrientation(Qt.Vertical) v_splitter2.addWidget(self.image_scaling_widget) v_splitter2.addWidget(self.spectra_selector_widget) v_splitter2.addWidget(self.view_range_widget) v_splitter2.addWidget(self.history_list) v_splitter2.addWidget(self.mz_plotter) v_splitter2.setStretchFactor(0, 0) v_splitter2.setStretchFactor(1, 0) v_splitter2.setStretchFactor(2, 0) v_splitter2.setStretchFactor(3, 0) v_splitter2.setStretchFactor(4, 1) h_splitter.addWidget(v_splitter2) h_splitter.setStretchFactor(1, 1) # THIRD COLUMN of h_splittier holds control table + buttons ########################## if self.table: frame = QFrame(self) layout = QVBoxLayout(frame) frame.setLayout(layout) layout.addWidget(self.table_widget) button_row_layout = QHBoxLayout(frame) button_row_layout.addWidget(self.select_all_peaks) button_row_layout.addWidget(self.unselect_all_peaks) button_row_layout.addWidget(self.done_button) layout.addLayout(button_row_layout) h_splitter.addWidget(frame) h_splitter.setStretchFactor(2, 2) outer_layout.addWidget(h_splitter) self.setLayout(outer_layout) outer_layout.setStretch(1, 99)
def __init__(self,widget,card_id): QFrame.__init__(self,widget) self.setupUi(self) self.card_id = card_id self.table_name.setText( "Debug Card (%s)" % card_id ) self.client_core = widget.client_core self.initialize_table()
def __init__(self, p): QFrame.__init__( self, p ) self.phs = 0 self.d_knbVolume = Knob( "Volume", 0.0, 10.0, self ) self.d_knbBalance = Knob( "Balance", -10.0, 10.0, self ) self.d_knbTreble = Knob( "Treble", -10.0, 10.0, self ) self.d_knbBass = Knob( "Bass", -10.0, 10.0, self ) self.d_thmLeft = Thermo( "Left [dB]", self ) self.d_thmRight = Thermo( "Right [dB]", self ) self.layout = QHBoxLayout( self ) self.layout.setSpacing( 0 ) #self.layout.setMargin( 10 ) self.layout.addWidget( self.d_knbVolume ) self.layout.addWidget( self.d_knbBalance) self.layout.addWidget( self.d_knbTreble) self.layout.addWidget( self.d_knbBass ) self.layout.addSpacing( 20 ) self.layout.addStretch( 10 ) self.layout.addWidget( self.d_thmLeft ) self.layout.addSpacing( 10 ) self.layout.addWidget( self.d_thmRight ) self.d_knbVolume.setValue( 7.0 ) self.startTimer( 50 ) self.d_master = 0
def __init__(self, weboob, backend, person, parent=None): QFrame.__init__(self, parent) self.parent = parent self.ui = Ui_MiniPerson() self.ui.setupUi(self) self.weboob = weboob self.backend = backend self.person = person self.ui.nameLabel.setText('%s' % person.name) if not empty(person.short_description): if unicode(self.parent.ui.currentActionLabel.text()).startswith( 'Casting'): self.ui.shortDescTitleLabel.setText(u'Role') self.ui.shortDescLabel.setText('%s' % person.short_description) else: self.ui.shortDescTitleLabel.hide() self.ui.shortDescLabel.hide() self.ui.backendLabel.setText(backend.name) self.connect(self.ui.newTabButton, SIGNAL("clicked()"), self.newTabPressed) self.connect(self.ui.viewButton, SIGNAL("clicked()"), self.viewPressed) self.connect(self.ui.viewThumbnailButton, SIGNAL("clicked()"), self.gotThumbnail) if self.parent.parent.ui.showTCheck.isChecked(): self.gotThumbnail()
def __init__(self, plot_path, plot_config_path): QFrame.__init__(self) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.plot_figure = PlotFigure() self.canvas = FigureCanvas(self.plot_figure.getFigure()) self.canvas.setParent(self) self.canvas.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) size = QSize(297*2, 210*2) # A4 aspectratio self.canvas.setMaximumSize(size) self.canvas.setMinimumSize(size) self.setMaximumSize(size) self.setMinimumSize(size) self.popup = Popup(self) self.plot_config_loader = PlotSettingsLoader() self.plot_settings = PlotSettings() self.plot_settings.setPlotPath(plot_path) self.plot_settings.setPlotConfigPath(plot_config_path) self.connect(self.popup, SIGNAL('updateProgress(int)'), self.updateProgress) self.plot_context_data_fetcher = PlotContextDataFetcher() self.plot_context_data_fetcher.initialize(self.plot_context_data_fetcher.getModel()) self.plot_data_fetcher = PlotDataFetcher() self.plot_data_fetcher.initialize(self.plot_data_fetcher.getModel())
def __init__(self, symbol, color, parent=None): QFrame.__init__(self, parent) self._symbol = symbol self.backColor = color # define and set stylesheets self.setup_stylesheets() self.setStyleSheet(self._theStyleSheet) # layout layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setToolTip(symbol["description"]) # add the symbol's svg svgWidget = QSvgWidget(symbol["svgPath"]) svgWidth = int(symbol["width"]) self.setMinimumWidth(svgWidth * 25) self.setMaximumWidth(svgWidth * 25) self.setMinimumHeight(25) self.setMaximumHeight(25) layout.addWidget(svgWidget) self.setLayout(layout)
def __init__(self, parent=None): QFrame.__init__(self, parent) self.memBox = QGroupBox("Memory Usage", self) self.memBox.setFont(QFont("Helvetica", 10)) self.memLayout = QVBoxLayout(self.memBox) #self.memLayout.setMargin( 15 ) self.memLayout.setSpacing(5) o = Qt.Horizontal self.memLayout.addWidget(ValueBar(o, "Used", self.memBox, 57)) self.memLayout.addWidget(ValueBar(o, "Shared", self.memBox, 17)) self.memLayout.addWidget(ValueBar(o, "Cache", self.memBox, 30)) self.memLayout.addWidget(ValueBar(o, "Buffers", self.memBox, 22)) self.memLayout.addWidget(ValueBar(o, "Swap Used", self.memBox, 57)) self.memLayout.addWidget(QWidget(self.memBox), 10) # spacer self.cpuBox = QGroupBox("Cpu Usage", self) self.cpuBox.setFont(QFont("Helvetica", 10)) self.cpuLayout = QHBoxLayout(self.cpuBox) #self.cpuLayout.setMargin( 15 ) self.cpuLayout.setSpacing(5) o = Qt.Vertical self.cpuLayout.addWidget(ValueBar(o, "User", self.cpuBox, 57)) self.cpuLayout.addWidget(ValueBar(o, "Total", self.cpuBox, 73)) self.cpuLayout.addWidget(ValueBar(o, "System", self.cpuBox, 16)) self.cpuLayout.addWidget(ValueBar(o, "Idle", self.cpuBox, 27)) self.layout = QHBoxLayout(self) #self.layout.setMargin( 10 ) self.layout.addWidget(self.memBox, 10) self.layout.addWidget(self.cpuBox, 0)
def __init__(self, img, layout='vertical', order=['R', 'G', 'B', 'V']): QFrame.__init__(self) r, g, b, v = histograms(img, 100) self.r_hist = ColorHistogram(r, (255, 0, 0)) self.g_hist = ColorHistogram(g, (0, 255, 0)) self.b_hist = ColorHistogram(b, (0, 0, 255)) self.v_hist = ColorHistogram(v, (0, 0, 0)) self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken) self.layout = QGridLayout(self) self.layout.setMargin(0) order_map = { 'R': self.r_hist, 'G': self.g_hist, 'B': self.b_hist, 'V': self.v_hist } if layout == 'vertical': for i in range(len(order)): self.layout.addWidget(order_map[order[i]], i, 0) elif layout == 'horizontal': for i in range(len(order)): self.layout.addWidget(order_map[order[i]], 0, i)
def __init__(self, parent=None): super(UserPanelDlg, self).__init__(parent) self.setWindowTitle('Address Book - User Panel') self.resize(330, 164) self.parent = parent self.db = self.parent.db chooseLabel = QLabel('Choose User:'******'New user') self.editButton = QPushButton('Edit username') self.deleteButton = QPushButton('Delete user') self.connectButton = QPushButton('Connect') line = QFrame() line.setFrameShape(QFrame.VLine) line.setFrameShadow(QFrame.Sunken) add_l = pyqttools.add_to_layout hlayout1 = add_l(QHBoxLayout(), (chooseLabel, None)) hlayout2 = add_l(QHBoxLayout(), (None, self.connectButton)) vlayout1 = add_l(QVBoxLayout(),(None, hlayout1,self.userComboBox, None)) vlayout2 = add_l(QVBoxLayout(), (newButton, self.editButton, self.deleteButton)) hlayout3 = add_l(QHBoxLayout(), (vlayout1, line, vlayout2)) f_layout = add_l(QVBoxLayout(), (hlayout3, hlayout2)) self.setLayout(f_layout) newButton.clicked.connect(self.add_user) self.editButton.clicked.connect(self.edit_user) self.deleteButton.clicked.connect(self.delete_user) self.connectButton.clicked.connect(self.accept) self.fill_combobox()
def paintEvent(self, paint_event): QFrame.paintEvent(self, paint_event) painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing) w = self.width() h = self.height() if self.horizontal: self.min_marker = QRectF(w * self.min_value, 4, self.size, self.size) self.max_marker = QRectF(w * self.max_value - self.size - 1, 4, self.size, self.size) else: self.min_marker = QRectF(4, h - h * self.min_value - self.size - 1, self.size, self.size) self.max_marker = QRectF(4, h - h * self.max_value, self.size, self.size) pen = painter.pen() pen.setWidth(0) pen.setColor(QApplication.palette().background().color().dark()) painter.setPen(pen) painter.setBrush(self.min_marker_brush) painter.drawPie(self.min_marker, self.tilt * 16, 180 * 16) painter.setBrush(self.max_marker_brush) painter.drawPie(self.max_marker, self.tilt * 16, -180 * 16)
def paintEvent(self, paint_event): QFrame.paintEvent(self, paint_event) painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing, True) painter.setRenderHint(QPainter.SmoothPixmapTransform, True) rect = self.contentsRect() """@type: QRect""" painter.fillRect(rect, self.background_color) x = rect.x() y = rect.y() height = rect.height() width = floor(rect.width() * self.__progress) painter.fillRect(x, y, width, height, self.color) if self.__shiny: #Shiny overlay! gradient = QLinearGradient(rect.width() / 2, 0, rect.width() / 2, rect.height()) gradient.setColorAt(0, QColor(255, 255, 255, 0)) gradient.setColorAt(0.2, QColor(255, 255, 255, 200)) gradient.setColorAt(0.4, QColor(255, 255, 255, 0)) gradient.setColorAt(0.85, QColor(255, 255, 255, 0)) gradient.setColorAt(0.85, QColor(0, 0, 0, 0)) gradient.setColorAt(1, QColor(0, 0, 0, 127)) painter.fillRect(rect, gradient)
def _build_widgets(self): """Builds own widgets.""" self.lastActiveLayer = None self._disconnect_connect_from_to_iface() self.iface.currentLayerChanged.connect( self._disconnect_connect_from_to_iface) QgsMapLayerRegistry.instance().legendLayersAdded.connect( self._check_added_perimeter_layer) self.toolBar = ToolBar( self, self.dWName, self.iface, self.pluginDir) self.gridLayout.addWidget(self.toolBar, 0, 0, 1, 1) self.statusBar = StatusBar( self, self.dWName, self.iface, self.pluginDir) self.gridLayout.addWidget(self.statusBar, 2, 0, 1, 1) self.frame = QFrame(self) self.frame.setObjectName(u'frame') self.frame.setFrameShape(QFrame.StyledPanel) self.frame.setFrameShadow(QFrame.Raised) self.gridLayout.addWidget(self.frame, 1, 0, 1, 1) self.stackedWidget = StackedWidget( self, self.dWName, self.iface, self.pluginDir) self.gridLayout.addWidget(self.stackedWidget, 1, 0, 1, 1)
def hideEvent(self, e): if self.eventLoop: self.eventLoop.exit() self.setFocus() self.emit(SIGNAL('hid()')) QFrame.hideEvent(self, e)
def __init__(self, subtitle, backend, parent=None): QFrame.__init__(self, parent) self.parent = parent self.backend = backend self.ui = Ui_Subtitle() self.ui.setupUi(self) self.connect(self.ui.downloadButton, SIGNAL("clicked()"), self.download) self.subtitle = subtitle self.ui.idEdit.setText(u'%s@%s' % (subtitle.id, backend.name)) self.ui.nameLabel.setText(u'%s' % subtitle.name) if not empty(subtitle.nb_cd): self.ui.nbcdLabel.setText(u'%s' % subtitle.nb_cd) else: self.ui.nbcdLabel.parent().hide() if not empty(subtitle.language): self.ui.langLabel.setText(u'%s' % subtitle.language) else: self.ui.langLabel.parent().hide() if not empty(subtitle.description): self.ui.descriptionPlain.setPlainText(u'%s' % subtitle.description) else: self.ui.descriptionPlain.parent().hide() if not empty(subtitle.url): self.ui.urlEdit.setText(u'%s' % subtitle.url) else: self.ui.downloadButton.setDisabled(True) self.ui.downloadButton.setText( 'Impossible to download this subtitle') self.ui.verticalLayout.setAlignment(Qt.AlignTop)
def __init__(self, parent): QFrame.__init__(self, parent) # Make the frame nice looking panelColor = QColor(170, 17, 17) palette = self.palette() palette.setColor(self.backgroundRole(), panelColor) self.setPalette(palette) self.setFrameShape(QFrame.StyledPanel) self.setLineWidth(2) self.setAutoFillBackground(True) # Keep pylint happy self.__messageLabel = None self.__leaveAsIsButton = None self.__reloadButton = None self.__reloadAllNonChangedButton = None self.__markers = [] self.__createLayout() for item in self.__markers: item.hide() return
def mousePressEvent(self, event): QFrame.mousePressEvent(self, event) if event.button() == 4: self.newTabPressed() else: self.viewPressed()
def __init__(self, parent=None): QFrame.__init__(self, parent) self.setAutoFillBackground(True) self.palette().setColor(self.backgroundRole(), spec.POV_COLOR) self.benderButtons = bender.Buttons(self) self.bender = bender.Bender(self) self.bender.setValue(150) self.wheelPad = pk.widgets.WheelPad(self) self.history = History(self.bender, parent=self) self.history.setMinimumHeight(50) QObject.connect(self.benderButtons, SIGNAL('bendUp()'), self.bender.bendUp) QObject.connect(self.benderButtons, SIGNAL('bendDown()'), self.bender.bendDown) QObject.connect(self.benderButtons, SIGNAL('bendBack()'), self.bender.bendBack) QObject.connect(self.bender, SIGNAL('valueChanged(float)'), self.emitTempo) QObject.connect(self.wheelPad, SIGNAL('moved_y(int)'), self.slotWheel) Layout = QVBoxLayout(self) Layout.setMargin(0) Layout.addWidget(self.history) Layout.addWidget(self.benderButtons) Layout.setStretchFactor(self.benderButtons, 0) Layout.addWidget(self.wheelPad) Layout.setStretchFactor(self.wheelPad, 1)
def __init__(self, parent=None, columns=4, buttonSize=None, iconSize=None, toolButtonStyle=Qt.ToolButtonTextUnderIcon): QFrame.__init__(self, parent) if buttonSize is not None: buttonSize = QSize(buttonSize) if iconSize is not None: iconSize = QSize(iconSize) self.__columns = columns self.__buttonSize = buttonSize or QSize(50, 50) self.__iconSize = iconSize or QSize(26, 26) self.__toolButtonStyle = toolButtonStyle self.__gridSlots = [] self.__buttonListener = ToolButtonEventListener(self) self.__buttonListener.buttonRightClicked.connect( self.__onButtonRightClick) self.__buttonListener.buttonEnter.connect(self.__onButtonEnter) self.__mapper = QSignalMapper() self.__mapper.mapped[QObject].connect(self.__onClicked) self.__setupUi()
def __init__(self, person, backend, parent=None): QFrame.__init__(self, parent) self.parent = parent self.ui = Ui_Person() self.ui.setupUi(self) self.connect(self.ui.filmographyButton, SIGNAL("clicked()"), self.filmography) self.connect(self.ui.biographyButton, SIGNAL("clicked()"), self.biography) self.person = person self.backend = backend self.gotThumbnail() self.ui.nameLabel.setText(person.name) self.ui.idEdit.setText(u'%s@%s' % (person.id, backend.name)) if not empty(person.real_name): self.ui.realNameLabel.setText('%s' % person.real_name) else: self.ui.realNameLabel.parent().hide() if not empty(person.birth_place): self.ui.birthPlaceLabel.setText('%s' % person.birth_place) else: self.ui.birthPlaceLabel.parent().hide() if not empty(person.birth_date): self.ui.birthDateLabel.setText(person.birth_date.strftime('%Y-%m-%d')) else: self.ui.birthDateLabel.parent().hide() if not empty(person.death_date): self.ui.deathDateLabel.setText(person.death_date.strftime('%Y-%m-%d')) else: self.ui.deathDateLabel.parent().hide() self.ui.shortBioPlain.setPlainText('%s' % person.short_biography) for role in person.roles.keys(): self.ui.filmographyCombo.addItem(role) self.ui.verticalLayout_2.setAlignment(Qt.AlignTop)
def __init__(self, parent = None): QFrame.__init__(self, parent) ltrb = self.getContentsMargins() if str(self.style().objectName()).lower() == "windowsxp": self.setContentsMargins(ltrb[0]+1, ltrb[1], ltrb[2]+2, ltrb[3]+1) else: self.setContentsMargins(ltrb[0]+1, ltrb[1], ltrb[2]+1, ltrb[3])
def __init__(self, parent): QFrame.__init__(self, parent) self.setContentsMargins(0, 0, 0, 0) layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(1) self._setNameLineEdit = QLineEdit(self) layout.addWidget(self._setNameLineEdit) self._setListView = QListView(self) self._listModel = QStandardItemModel(self) self._proxyModel = QSortFilterProxyModel(self) self._proxyModel.setSourceModel(self._listModel) self._setListView.setModel(self._proxyModel) self._setListView.setItemDelegate(ListItemDelegate(self)) self._setNameLineEdit.textChanged.connect( self._proxyModel.setFilterFixedString) self._completer = QCompleter(self._listModel, self) self._setNameLineEdit.setCompleter(self._completer) self._listModel.itemChanged.connect(self._onSetNameChange) layout.addWidget(self._setListView) buttonLayout = QHBoxLayout() self._addAction = QAction( "+", self, toolTip="Add a new sort key") self._updateAction = QAction( "Update", self, toolTip="Update/save current selection") self._removeAction = QAction( "\u2212", self, toolTip="Remove selected sort key.") self._addToolButton = QToolButton(self) self._updateToolButton = QToolButton(self) self._removeToolButton = QToolButton(self) self._updateToolButton.setSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.Minimum) self._addToolButton.setDefaultAction(self._addAction) self._updateToolButton.setDefaultAction(self._updateAction) self._removeToolButton.setDefaultAction(self._removeAction) buttonLayout.addWidget(self._addToolButton) buttonLayout.addWidget(self._updateToolButton) buttonLayout.addWidget(self._removeToolButton) layout.addLayout(buttonLayout) self.setLayout(layout) self._addAction.triggered.connect(self.addCurrentSelection) self._updateAction.triggered.connect(self.updateSelectedSelection) self._removeAction.triggered.connect(self.removeSelectedSelection) self._setListView.selectionModel().selectionChanged.connect( self._onListViewSelectionChanged) self.selectionModel = None self._selections = []
def __init__(self, parent): super(HtmlViewerWidget, self).__init__(parent) self.setLayout(QGridLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.view = QWebView() self.view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks) self.frame = QFrame() self.frame.setLayout(QGridLayout()) self.frame.layout().setContentsMargins(0, 0, 0, 0) self.toolbar = QToolBar() self.spacer = QWidget() self.spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.copyAction = self.toolbar.addAction(QIcon(":/icons/clipboard"), "Copy Text") self.label = QLabel() self.closeAction = self.toolbar.addAction(QIcon(":/icons/cancel"), "Close") self.spaceraction = self.toolbar.insertWidget(self.closeAction, self.spacer) self.labelaction = self.toolbar.insertWidget(self.spaceraction, self.label) self.closeAction.triggered.connect(self.close) self.copyAction.triggered.connect(self.copy_text) self.layout().addWidget(self.frame) self.frame.layout().addWidget(self.toolbar) self.frame.layout().addWidget(self.view) self.effect = QGraphicsOpacityEffect() self.label.setGraphicsEffect(self.effect) self.anim = QPropertyAnimation(self.effect, "opacity") self.anim.setDuration(2000) self.anim.setStartValue(1.0) self.anim.setEndValue(0.0) self.anim.setEasingCurve(QEasingCurve.OutQuad)
def createPlotRangePanel(self): frame = QFrame() #frame.setMaximumHeight(150) #frame.setFrameShape(QFrame.StyledPanel) #frame.setFrameShadow(QFrame.Plain) layout = QFormLayout() self.x_min = DisableableSpinner(self.plotView.setMinXLimit) self.x_max = DisableableSpinner(self.plotView.setMaxXLimit) layout.addRow("X min:", self.x_min) layout.addRow("X max:", self.x_max) self.y_min = DisableableSpinner(self.plotView.setMinYLimit) self.y_max = DisableableSpinner(self.plotView.setMaxYLimit) layout.addRow("Y min:", self.y_min) layout.addRow("Y max:", self.y_max) layout.addWidget(ert_gui.widgets.util.createSeparator()) self.plot_compare_to_case = QtGui.QComboBox() self.plot_compare_to_case.setToolTip("Select case to compare members against.") self.connect(self.plot_compare_to_case, SIGNAL("currentIndexChanged(QString)"), self.select_case) layout.addRow("Case:", self.plot_compare_to_case) frame.setLayout(layout) return frame
def __init__(self, parent): QFrame.__init__(self, parent, Qt.Popup | Qt.Window | Qt.Tool) self.setupUi(self) self.parent = parent self.master = self.parent.master self.update_status()
def createMemberSelectionPanel(self): frame = QFrame() #frame.setMinimumHeight(100) #frame.setMaximumHeight(100) #frame.setFrameShape(QFrame.StyledPanel) #frame.setFrameShadow(QFrame.Plain) layout = QVBoxLayout() self.selected_member_label = QtGui.QLabel() self.selected_member_label.setWordWrap(True) layout.addWidget(QtGui.QLabel("Selected members:")) layout.addWidget(self.selected_member_label) layout.addStretch(1) self.clear_button = QtGui.QPushButton() self.clear_button.setText("Clear selection") layout.addWidget(self.clear_button) self.connect(self.clear_button, QtCore.SIGNAL('clicked()'), self.plotView.clearSelection) layout.addStretch(1) frame.setLayout(layout) return frame
def mousePressEvent(self, event): QFrame.mousePressEvent(self, event) video = self.backend.get_video(self.video.id) if video: video_widget = Video(video, self) video_widget.show()
def __init__(self, func): QFrame.__init__(self) self.func = func layout = QHBoxLayout() layout.setMargin(0) self.check = QCheckBox() self.spinner = QtGui.QDoubleSpinBox() self.spinner.setSingleStep(1) self.spinner.setDisabled(True) self.spinner.setMinimum(-10000000000) self.spinner.setMaximum(10000000000) self.spinner.setMaximumWidth(100) self.connect(self.spinner, QtCore.SIGNAL('valueChanged(double)'), self.update) self.date_spinner = QtGui.QDateEdit() self.date_spinner.setDisabled(True) self.date_spinner.setDisplayFormat("dd/MM-yyyy") self.date_spinner.setMaximumWidth(100) self.date_spinner.setCalendarPopup(True) self.connect(self.date_spinner, QtCore.SIGNAL('dateChanged(QDate)'), self.update) self.connect(self.check, SIGNAL('stateChanged(int)'), self.disabler) layout.addWidget(self.check) layout.addWidget(self.spinner) layout.addWidget(self.date_spinner) self.setLayout(layout) self.showDate(False)
def __init__(self, *args): PluginBase.__init__(self, BrickletCurrent12, *args) self.cur = self.device self.cbe_current = CallbackEmulator(self.cur.get_current, self.cb_current, self.increase_error_count) self.qtcb_over.connect(self.cb_over) self.cur.register_callback(self.cur.CALLBACK_OVER_CURRENT, self.qtcb_over.emit) self.over_label = QLabel('Over Current: No') self.calibrate_button = QPushButton('Calibrate Zero') self.calibrate_button.clicked.connect(self.calibrate_clicked) self.current_current = None # float, A plots = [('Current', Qt.red, lambda: self.current_current, format_current)] self.plot_widget = PlotWidget('Current [A]', plots, extra_key_widgets=[self.over_label]) line = QFrame() line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) layout = QVBoxLayout(self) layout.addWidget(self.plot_widget) layout.addWidget(line) layout.addWidget(self.calibrate_button)
def __init__(self, parent=None): # ------------------------------------------------------------------- QFrame.__init__(self, parent); # ------------------------------------------------------------------- self.PARENT = parent; self.DEBUG = False; self.LOG_TAG = str(self.__class__.__name__).upper(); self.setGeometry( 4, 34, 1012, 606 ); self.setStyleSheet( "QFrame{ font: 12px 'monospace'; color: #fff; background-color: rbga(0,0,0, 220); border-style: solid; border-width: 5px; border-color: #FFF; }" ); # ------------------------------------------------------------------- self.WIDGET_NAME_LABEL = QLabel( "Settings: ", self ); self.WIDGET_NAME_LABEL.setStyleSheet( "QLabel{ background-color: none; border-style: none; width: 96px; padding: 10px; } " ); # ------------------------------------------------------------------- self.hide(); self.IS_OPEN = False; self.KEEP_OPEN = False; # ------------------------------------------------------------------- self.UPDATE_TIMER = QTimer(); self.UPDATE_TIMER.singleShot( 1000, self.UPDATE_FRAME ); # ------------------------------------------------------------------- self.PARENT.SPLASH.STATUS( self.LOG_TAG+": [INIT]" );
def __init__(self, parent = None): QFrame.__init__(self, parent) self.setFrameStyle(QFrame.Box | QFrame.Raised); self.setupWidget() self.folded = False self.connect(self.folding_button, SIGNAL("clicked()"), self.toggleVisible) self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
def __createLayout(self): " Creates the widget layout " verticalLayout = QVBoxLayout(self) verticalLayout.setContentsMargins(0, 0, 0, 0) verticalLayout.setSpacing(0) self.headerFrame = QFrame() self.headerFrame.setFrameStyle(QFrame.StyledPanel) self.headerFrame.setAutoFillBackground(True) headerPalette = self.headerFrame.palette() headerBackground = headerPalette.color(QPalette.Background) headerBackground.setRgb(min(headerBackground.red() + 30, 255), min(headerBackground.green() + 30, 255), min(headerBackground.blue() + 30, 255)) headerPalette.setColor(QPalette.Background, headerBackground) self.headerFrame.setPalette(headerPalette) self.headerFrame.setFixedHeight(24) self.__threadsLabel = QLabel("Threads") expandingSpacer = QSpacerItem(10, 10, QSizePolicy.Expanding) fixedSpacer = QSpacerItem(3, 3) self.__showHideButton = QToolButton() self.__showHideButton.setAutoRaise(True) self.__showHideButton.setIcon(PixmapCache().getIcon('less.png')) self.__showHideButton.setFixedSize(20, 20) self.__showHideButton.setToolTip("Hide threads list") self.__showHideButton.setFocusPolicy(Qt.NoFocus) self.__showHideButton.clicked.connect(self.__onShowHide) headerLayout = QHBoxLayout() headerLayout.setContentsMargins(0, 0, 0, 0) headerLayout.addSpacerItem(fixedSpacer) headerLayout.addWidget(self.__threadsLabel) headerLayout.addSpacerItem(expandingSpacer) headerLayout.addWidget(self.__showHideButton) self.headerFrame.setLayout(headerLayout) self.__threadsList = QTreeWidget() self.__threadsList.setSortingEnabled(False) # I might not need that because of two reasons: # - the window has no focus # - the window has custom current indicator # self.__threadsList.setAlternatingRowColors( True ) self.__threadsList.setRootIsDecorated(False) self.__threadsList.setItemsExpandable(False) self.__threadsList.setUniformRowHeights(True) self.__threadsList.setSelectionMode(QAbstractItemView.NoSelection) self.__threadsList.setSelectionBehavior(QAbstractItemView.SelectRows) self.__threadsList.setItemDelegate(NoOutlineHeightDelegate(4)) self.__threadsList.setFocusPolicy(Qt.NoFocus) self.__threadsList.itemClicked.connect(self.__onThreadClicked) self.__threadsList.setHeaderLabels(["", "Name", "State", "TID"]) verticalLayout.addWidget(self.headerFrame) verticalLayout.addWidget(self.__threadsList) return
def __init__(self, parent=None): """ Initializer. @param parent ancestor object """ QFrame.__init__(self, parent) self.setupUi(self)
def __init__(self, parent = None): """ Constructor """ QFrame.__init__(self, parent) self.setupUi(self) self.points =[] self.point_prev = 0 self.point_next = 0 self.point_drv = 0 self.points_msg.connect(self._pointsmsg) self.interval = 0 self.timer = QPauseTimer(self) self.timer.timeout.connect(self._timeout) self.displayrefresh = QTimer(self) self.displayrefresh.start(100) #100ms refresh rate of display self.displayrefresh.timeout.connect(self._refresh) self.spinBox_goto.setValue(1) self.spinBox_goto.setMinimum(1) self.spinBox_loop_from.setMinimum(1) self.spinBox_loop_times.setMinimum(1) self.spinBox_loop_to.setMinimum(1) self.spinBox_point_first.setMinimum(1) self.spinBox_point_last.setMinimum(1)
def __init__(self, weboob, backend, parent=None): QFrame.__init__(self, parent) self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) self.weboob = weboob self.backend = backend self.setLayout(QVBoxLayout()) self.timer = None head = QHBoxLayout() headw = QWidget() headw.setLayout(head) self.title = QLabel(u'<h1>%s — %s</h1>' % (backend.name, backend.DESCRIPTION)) self.body = QLabel() if backend.ICON: self.icon = QLabel() img = QImage(backend.ICON) self.icon.setPixmap(QPixmap.fromImage(img)) head.addWidget(self.icon) head.addWidget(self.title) head.addStretch() self.layout().addWidget(headw) if backend.has_caps(ICapAccount): self.body.setText(u'<i>Waiting...</i>') self.layout().addWidget(self.body) self.timer = self.weboob.repeat(60, self.updateStats)
def mousePressEvent(self, event): QFrame.mousePressEvent(self, event) video = self.backend.fillobj(self.video) if video: video_widget = Video(video, self) video_widget.show()
def __init__(self, parent, old_ids): QDialog.__init__(self, parent) self.old_ids = old_ids main_lay = QVBoxLayout(self) self.fra_id = QFrame(self) fra_id_lay = QFormLayout(self.fra_id) self.lbl_id = QLabel('New ID:') self.txt_id = QLineEdit('') fra_id_lay.addRow(self.lbl_id, self.txt_id) self.lbl_desc = QLabel('Description:') self.txt_desc = QLineEdit('') fra_id_lay.addRow(self.lbl_desc, self.txt_desc) self.fra_buttons = QFrame() fra_buttons_lay = QHBoxLayout(self.fra_buttons) self.btn_ok = QPushButton('OK') self.btn_ok.clicked.connect(self.btn_ok_clicked) self.btn_cancel = QPushButton('Cancel') self.btn_cancel.clicked.connect(self.btn_cancel_clicked) fra_buttons_lay.addWidget(self.btn_ok) fra_buttons_lay.addWidget(self.btn_cancel) main_lay.addWidget(self.fra_id) main_lay.addWidget(self.fra_buttons) self.new_id = None self.description = None
def __init__(self, plugin): QFrame.__init__(self, core.workspace()) self._mode = None self.plugin = plugin from PyQt4 import uic # lazy import for better startup performance uic.loadUi(os.path.join(os.path.dirname(__file__), "SearchWidget.ui"), self) self.cbSearch.setCompleter(None) self.cbReplace.setCompleter(None) self.cbMask.setCompleter(None) self.fsModel = QDirModel(self.cbPath.lineEdit()) self.fsModel.setFilter(QDir.AllDirs | QDir.NoDotAndDotDot) self.cbPath.lineEdit().setCompleter(QCompleter(self.fsModel, self.cbPath.lineEdit())) # TODO QDirModel is deprecated but QCompleter does not yet handle # QFileSystemodel - please update when possible.""" self.cbSearch.setCompleter(None) self.pbSearchStop.setVisible(False) self.pbReplaceCheckedStop.setVisible(False) self._progress = QProgressBar(self) self._progress.setAlignment(Qt.AlignCenter) self._progress.setToolTip(self.tr("Search in progress...")) self._progress.setMaximumSize(QSize(80, 16)) core.mainWindow().statusBar().insertPermanentWidget(1, self._progress) self._progress.setVisible(False) # cd up action self.tbCdUp = QToolButton(self.cbPath.lineEdit()) self.tbCdUp.setIcon(QIcon(":/enkiicons/go-up.png")) self.tbCdUp.setCursor(Qt.ArrowCursor) self.tbCdUp.installEventFilter(self) # for drawing button self.cbSearch.installEventFilter(self) # for catching Tab and Shift+Tab self.cbReplace.installEventFilter(self) # for catching Tab and Shift+Tab self.cbPath.installEventFilter(self) # for catching Tab and Shift+Tab self.cbMask.installEventFilter(self) # for catching Tab and Shift+Tab self._closeShortcut = QShortcut(QKeySequence("Esc"), self) self._closeShortcut.setContext(Qt.WidgetWithChildrenShortcut) self._closeShortcut.activated.connect(self.hide) # connections self.cbSearch.lineEdit().textChanged.connect(self._onSearchRegExpChanged) self.cbSearch.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbReplace.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbPath.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbMask.lineEdit().returnPressed.connect(self._onReturnPressed) self.cbRegularExpression.stateChanged.connect(self._onSearchRegExpChanged) self.cbCaseSensitive.stateChanged.connect(self._onSearchRegExpChanged) self.tbCdUp.clicked.connect(self._onCdUpPressed) core.mainWindow().hideAllWindows.connect(self.hide) core.workspace().currentDocumentChanged.connect( lambda old, new: self.setVisible(self.isVisible() and new is not None) )
def __init__(self, client, mainwindow, parent=None): QFrame.__init__(self, parent) self.init_done = False self.modified = False self.client = client self.mainwindow = mainwindow self._parent = parent form_layout = QVBoxLayout(self) title = QLabel("<H1>%s</H1>" % tr('NTP Configuration')) form_layout.addWidget(title) self.ntpServers = ListEdit() self.ntpServers.headers = self.getColumnLabels() self.ntpServers.displayUpDown = True self.ntpServers.readOnly = mainwindow.readonly self.ntpServers.editInPopup = True self.ntpServers.setColDelegate(self.createDelegateForColumn) self.mainwindow.writeAccessNeeded(self.ntpServers) self.connect(self.ntpServers, SIGNAL('itemDeleted'), self.serverDeleted) self.connect(self.ntpServers, SIGNAL('itemAdded'), self.serverAdded) self.connect(self.ntpServers, SIGNAL('itemModified'), self.serverModified) self.connect(self.ntpServers, SIGNAL('itemSorted'), self.serverSorted) self.addToInfoArea = mainwindow.addToInfoArea if self.resetConf(): self.addToInfoArea(tr("NTP interface enabled")) else: self.addToInfoArea(tr("NTP interface disabled: NTP backend not loaded"), category=COLOR_CRITICAL) raise NuConfModuleDisabled("NTP") self.build() self.init_done = True
def __init__(self, bender, parent=None): QFrame.__init__(self, parent) self.setFrameShape(QFrame.StyledPanel) self.bender = bender self.nominal = [] self.bent = [] self.startTimer(self.interval)
def __init__(self, subtitle, backend, parent=None): QFrame.__init__(self, parent) self.parent = parent self.backend = backend self.ui = Ui_Subtitle() self.ui.setupUi(self) self.connect(self.ui.downloadButton, SIGNAL("clicked()"), self.download) self.subtitle = subtitle self.ui.idEdit.setText(u'%s@%s' % (subtitle.id, backend.name)) self.ui.nameLabel.setText(u'%s' % subtitle.name) if not empty(subtitle.nb_cd): self.ui.nbcdLabel.setText(u'%s' % subtitle.nb_cd) else: self.ui.nbcdLabel.parent().hide() if not empty(subtitle.language): self.ui.langLabel.setText(u'%s' % subtitle.language) else: self.ui.langLabel.parent().hide() if not empty(subtitle.description): self.ui.descriptionPlain.setPlainText(u'%s' % subtitle.description) else: self.ui.descriptionPlain.parent().hide() if not empty(subtitle.url): self.ui.urlEdit.setText(u'%s' % subtitle.url) else: self.ui.downloadButton.setDisabled(True) self.ui.downloadButton.setText('Impossible to download this subtitle') self.ui.verticalLayout.setAlignment(Qt.AlignTop)
def __init__(self): QFrame.__init__(self) # Avoid the border around the window self.setWindowFlags(Qt.SplashScreen) # Make the frame nice looking self.setFrameShape(QFrame.StyledPanel) self.setLineWidth(2) self.info = None self.location = None self.__createLayout() # The item the tooltip is for self.item = None # The timer which shows the tooltip. The timer is controlled from # outside of the class. self.tooltipTimer = QTimer(self) self.tooltipTimer.setSingleShot(True) self.tooltipTimer.timeout.connect(self.__onTimer) self.startPosition = None return