def generatePicture(self): self.picture = QtGui.QPicture() painter = QtGui.QPainter(self.picture) painter.setFont(QtGui.QFont('times', 50)) painter.scale(1, -1) paint_discovered(painter, distances=self.distances, walls=self.walls) painter.end()
def render(self): scale = self.settingsDialog.scaleSpinBox.value() sbX = self.settingsDialog.sbXSpinBox.value() * self.dimx sbY = self.settingsDialog.sbYSpinBox.value() * self.dimy sbLabelYOffset = self.settingsDialog.sbLabelYOffsetSpinBox.value( ) * self.dimy sbWidth = int( np.round(self.settingsDialog.sbLengthSpinBox.value() / scale)) sbHeight = self.settingsDialog.sbHeightSpinBox.value() * self.dimy # Bar self.bar.setRect(sbX - sbWidth / 2, sbY - sbHeight / 2, sbWidth, sbHeight) self.bar.setPen(pg.mkPen(None)) self.bar.setBrush(self.sbColor) # Label self.label.setText( '{:.3g}'.format(self.settingsDialog.sbLengthSpinBox.value()) + " \u03bcm") self.label.setFont(QtGui.QFont("Helvetica", 0.04 * self.dimy)) # (self.dimx + self.dimy)/2 self.label.setBrush(self.sbColor) bRect = self.label.boundingRect() self.label.setPos(sbX - bRect.width() / 2, sbY - bRect.height() / 2 - sbLabelYOffset)
def __init__(self, parent=None, language='Python'): super(Editor, self).__init__(parent) self.setIndentationsUseTabs(False) self.setIndentationWidth(4) # Set the default font font = QtGui.QFont() font.setFamily('DejaVu Sans Mono') font.setFixedPitch(True) font.setPointSize(10) self.setFont(font) self.setMarginsFont(font) self.zoomIn() # Margin 0 is used for line numbers fontmetrics = QtGui.QFontMetrics(font) self.setMarginsFont(font) self.setMarginWidth(0, fontmetrics.width("000") + 6) self.setMarginLineNumbers(0, True) self.setMarginsBackgroundColor(QtGui.QColor("#cccccc")) self._marker = None # Clickable margin 1 for showing markers #self.setMarginSensitivity(1, True) #self.connect(self, # SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'), # self.on_margin_clicked) self.markerDefine(QsciScintilla.RightArrow, self.ARROW_MARKER_NUM) self.setMarkerBackgroundColor(QtGui.QColor("#ee1111"), self.ARROW_MARKER_NUM) # Brace matching: enable for a brace immediately before or after # the current position # self.setBraceMatching(QsciScintilla.SloppyBraceMatch) # Current line visible with special background color self.setCaretLineVisible(True) self.setCaretLineBackgroundColor(QtGui.QColor("#ffe4e4")) # Set Python lexer # Set style for Python comments (style number 1) to a fixed-width # courier. # lexer = getattr(Qsci, 'QsciLexer' + language)() lexer.setDefaultFont(font) self.setLexer(lexer) self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, b'Courier') # Don't want to see the horizontal scrollbar at all # Use raw message to Scintilla here (all messages are documented # here: http://www.scintilla.org/ScintillaDoc.html) self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0) self.setWrapMode(QsciScintilla.WrapWord) self.setEolMode(QsciScintilla.EolUnix)
def start(): global app app = QApplication.instance() if app is None: app = QApplication(sys.argv) font = QtGui.QFont('Courier') app.setFont(font) new = interface() new.show() app.exit(app.exec_()) return new
def __init__(self, size=None, antialias=True, glOptions='translucent', line_width=2, show_labels=True, label_font=None): pgl.GLAxisItem.__init__(self, size, antialias, glOptions) self.line_width = 2 self.show_labels = show_labels if label_font is None: label_font = QtGui.QFont() self.label_font = label_font
rms2 = -np.sqrt(2 * np.mean(np.square(fluxdata2 / m - 1))) pw2.setLabel('bottom', 'tempo', units=xlabel) pw2.plot(x=timedata, y=fluxdata2 / m - 1, pen='b', connect=sub) line = pg.InfiniteLine(pos=rms1, angle=0, pen='r') pw2.addItem(line) line = pg.InfiniteLine(pos=rms2, angle=0, pen='r') pw2.addItem(line) print('activity =', rms1 - rms2) return pw1, pw2 if __name__ == '__main__': import argparse app = QtGui.QApplication([]) font = QtGui.QFont('Century Gothic', 18) app.setFont(font) win = pg.GraphicsWindow() parser = argparse.ArgumentParser( description= 'remove erros sistematicos utilizando CBVs e salva um novo FITS') parser.add_argument('arq', help='nome do arquivo FITS de origem (LC)', type=str) parser.add_argument('novo_arq', help='nome do arquivo FITS de saida', type=str) parser.add_argument('--vectors', dest='cbv_list', help='lista de CBVs para utilizar', type=str)
print(self.maskx, self.masky, i, j) for k in range(len(self.maskx)): if i == self.masky[k] and j == self.maskx[k]: curve.setPen('b') provx = [] provy = [] for k2 in range(len(self.maskx)): if i != self.masky[k2] or j != self.maskx[k2]: provx.append(self.maskx[k2]) provy.append(self.masky[k2]) self.maskx = provx self.masky = provy break else: self.maskx.append(j) self.masky.append(i) curve.setPen('g') self.timedata, self.fluxdata, self.qdata, self.info = lc.realtime_newcurve( self.arq, self.maskx, self.masky) self.updatePlot() return updateMask if __name__ == '__main__': app = QtGui.QApplication([]) font = QtGui.QFont('noto sans', 18) app.setFont(font) ex = start() app.exec_()
size = screen.size() geo = screen.availableGeometry() phydpi = screen.physicalDotsPerInch() logdpi = screen.logicalDotsPerInch() print( # f'screen number: {screen_num}\n', f'screen name: {name}\n' f'screen size: {size}\n' f'screen geometry: {geo}\n\n' f'devicePixelRationF(): {pxr}\n' f'physical dpi: {phydpi}\n' f'logical dpi: {logdpi}\n') # app-wide font font = QtGui.QFont("Hack") # use pixel size to be cross-resolution compatible? font.setPixelSize(6) fm = QtGui.QFontMetrics(font) fontdpi = fm.fontDpi() font_h = fm.height() string = '10000' str_br = fm.boundingRect(string) str_w = str_br.width() print( # f'screen number: {screen_num}\n', f'font dpi: {fontdpi}\n' f'font height: {font_h}\n'