def testGenerator(self):
     self.assertTrue(QRandomGenerator.system())
     self.assertTrue(QRandomGenerator.global_())
     generator = QRandomGenerator()
     r = generator.bounded(10, 20)
     self.assertTrue(r >= 10)
     self.assertTrue(r <= 20)
Exemple #2
0
 def rndPosVectGenerator(cls, genSize=5000.0, is2D=True, genType="round"):
     if (genType == "round"):
         initVect = QVector3D(
             QRandomGenerator.global_().generateDouble() * genSize, 0, 0)
         return cls.rndQuaternionGenerator(
             is2D=is2D).rotatedVector(initVect)
     elif (genType == "square"):
         xPos = randomSignGenerator() * QRandomGenerator.global_(
         ).generateDouble() * genSize
         yPos = randomSignGenerator() * QRandomGenerator.global_(
         ).generateDouble() * genSize
         zPos = 0.0 if is2D else randomSignGenerator(
         ) * QRandomGenerator.global_().generateDouble() * genSize
         return QVector3D(xPos, yPos, zPos)
     else:
         return QVector3D(0, 0, 0)
Exemple #3
0
    def __init__(self):
        global pixmapDict, specialDescriptionDict
        super(MainWindow, self).__init__()
        self.ui = Ui_pipboy()
        self.ui.setupUi(self)

        self.ui.chartContainer.setContentsMargins(0, 0, 0, 0)

        self.anim = QTimeLine(20000, self)
        self.anim.setFrameRange(0, 500)
        self.anim.setLoopCount(0)
        self.anim.setUpdateInterval(16)
        self.anim.frameChanged[int].connect(
            self.ui.perks_description.verticalScrollBar().setValue)
        self.anim.frameChanged[int].connect(
            self.ui.aid_effect_label.verticalScrollBar().setValue)
        self.anim.frameChanged[int].connect(
            self.ui.data_description.verticalScrollBar().setValue)

        #self.anim2 = QPropertyAnimation(self.ui.main_tab, b"pos")
        #self.anim2.setEasingCurve(QEasingCurve.OutBounce)
        #self.anim2.setDuration(2000)
        #self.anim2.setStartValue(QPoint(10, -400))
        #self.anim2.setEndValue(QPoint(10, 0))
        #self.anim2.start()

        self.random = QRandomGenerator.global_()

        self.ui.stat_tab.setFocus()
        self.ui.stat_tab.currentChanged.connect(self.shift)
        self.ui.stat_tab.installEventFilter(self)
        self.ui.inv_tab.installEventFilter(self)

        self.ui.special_list.installEventFilter(self)
        self.ui.perks_list.installEventFilter(self)
        self.ui.test_list.installEventFilter(self)
        self.ui.apparel_list.installEventFilter(self)
        self.ui.aid_list.installEventFilter(self)
        self.ui.ammo_list.installEventFilter(self)
        self.ui.data_list.installEventFilter(self)
        self.ui.radio_list.installEventFilter(self)

        self.ui.main_img.setPixmap(description.main_img_pixmap)

        self.ui.special_image.setPixmap(description.pixmapDict.get(0))
        self.ui.perks_image.setPixmap(description.pixmatPerksDict.get(0))
        self.ui.weapon_image.setPixmap(description.pixmapWeaponDict.get(0))
        self.ui.apparel_image.setPixmap(description.pixmapWeaponDict.get(0))
        self.ui.aid_image.setPixmap(description.pixmapAidDict.get(0))
        self.ui.ammo_image.setPixmap(description.pixmapAmmoDict.get(0))

        lay = QVBoxLayout(self.ui.chartContainer)
        lay.setContentsMargins(0, 0, 0, 0)

        self.chartview = QtCharts.QChartView()
        self.chartview.setContentsMargins(0, 0, 0, 0)
        lay.addWidget(self.chartview)

        self.chart = QtCharts.QChart()
        self.chart.legend().hide()
        self.chart.setAnimationOptions(QtCharts.QChart.SeriesAnimations)

        self.series = QtCharts.QLineSeries()
        self.pen = QPen(QColor(119, 251, 81, 255))
        self.pen.setWidth(3)
        self.pen.setJoinStyle(Qt.RoundJoin)
        self.series.setPen(self.pen)

        backgroundGradient = QLinearGradient(QPointF(100, 100),
                                             QPointF(200, 200))

        backgroundGradient.setColorAt(0, QColor(0, 0, 0, 255))
        backgroundGradient.setColorAt(1, QColor(0, 0, 0, 255))
        self.chart.setBackgroundBrush(backgroundGradient)
        self.chart.setPlotAreaBackgroundBrush(backgroundGradient)

        self.chart.addSeries(self.series)

        self.chart.createDefaultAxes()

        self.chart.axisX(self.series).setVisible(False)
        self.chart.axisY(self.series).setVisible(False)
        self.chart.axisY(self.series).setRange(0, 100)
        self.chartview.setChart(self.chart)

        self.play = False
        self.player = QMediaPlayer()

        self.playlistFalloutNewVegas = QMediaPlaylist(self.player)
        self.playlistFalloutNewVegas.addMedia(
            QMediaContent(description.falooutNewVegas))
        self.playlistFalloutNewVegas.setCurrentIndex(1)

        self.playListMohaveMusic = QMediaPlaylist(self.player)

        for url in description.mohaveMusic:
            self.playListMohaveMusic.addMedia(QMediaContent(url))

        self.playListMohaveMusic.setCurrentIndex(1)

        self.playlisNewVegas = QMediaPlaylist(self.player)

        for url in description.newVegas:
            self.playlisNewVegas.addMedia(QMediaContent(url))

        self.playlisNewVegas.setCurrentIndex(1)

        self.playlistDict = {
            0: self.playlistFalloutNewVegas,
            1: self.playListMohaveMusic,
            2: self.playlisNewVegas
        }
Exemple #4
0
 def rndQuaternionGenerator(cls, is2D=False):
     phi = QRandomGenerator.global_().generateDouble() * 360
     theta = 90 if is2D else QRandomGenerator.global_().generateDouble(
     ) * 180
     return anglesSphToQuaternion(phi, theta)
Exemple #5
0
def randomSignGenerator():
    rndNum = QRandomGenerator.global_().bounded(0, 2)
    if (rndNum == 0):
        return -1.0
    else:
        return 1.0
Exemple #6
0
def rndColorGenerator():
    return QColor(QRandomGenerator.global_().bounded(0, 256),
                  QRandomGenerator.global_().bounded(0, 256),
                  QRandomGenerator.global_().bounded(0, 256))