Ejemplo n.º 1
0
 def moveScreenCenter(self):
     w = self.frameGeometry().width()
     h = self.frameGeometry().height()
     desktop = QDesktopWidget()
     screenW = desktop.screen().width()
     screenH = desktop.screen().height()
     self.setGeometry((screenW-w)/2, (screenH-h)/2, w, h)
Ejemplo n.º 2
0
 def moveScreenCenter(self):
     w = self.frameGeometry().width()
     h = self.frameGeometry().height()
     desktop = QDesktopWidget()
     screenW = desktop.screen().width()
     screenH = desktop.screen().height()
     self.setGeometry((screenW - w) / 2, (screenH - h) / 2, w, h)
	def setCenter(self):
		desktop = QDesktopWidget()

		screenwidth = desktop.screen().width()
		screenheight = desktop.screen().height()

		self.setGeometry((screenwidth - self.width()) // 2,
						 (screenheight - self.height()) // 2,
						 self.width(), self.height())
Ejemplo n.º 4
0
    def center(self):
        width = self.frameGeometry().width()
        height = self.frameGeometry().height()

        desktopInfo = QDesktopWidget()

        screenWidth = desktopInfo.screen().width()
        screenHeight = desktopInfo.screen().height()

        self.setGeometry((screenWidth / 2) - (width / 2),
                         (screenHeight / 2) - (height / 2), width, height)
Ejemplo n.º 5
0
def getScreenGeomtry():
    pos = QCursor().pos()
    qdt = QDesktopWidget()
    for i in range(qdt.screenCount()):
        sgm = qdt.screen(i).geometry()
        bwX = pos.x() >= sgm.left() and pos.x() <= sgm.right()
        bwY = pos.y() >= sgm.top() and pos.y() <= sgm.bottom()
        if bwX and bwY:
            return sgm
    return QRect(0, 0, 0, 0)
Ejemplo n.º 6
0
    def setCenter(self):
        desktop = QDesktopWidget()
        screenwidth = desktop.screen().width()
        screenheight = desktop.screen().height()

        self.setGeometry((screenwidth - self.width()) // 2,
                         (screenheight - self.height()) // 2, self.width(),
                         self.height())

        #membuat nama label
        self.labelNama = QLabel()
        self.labelNama.setText(
            '<b><center> Program Hitung Bilangan Ruang Kerucut</center></b>')
        self.label1 = QLabel()
        self.label1.setText('<b>Jari-jari : </b>')
        self.label2 = QLabel()
        self.label2.setText('<b>Tinggi : </b>')
        self.hasil = QPushButton('Hasil')

        #membuat tombol
        self.luasAlas = QLabel('Luas Alas : ')
        self.luasSelimut = QLabel('Luas Selimut : ')
        self.luasPermukaan = QLabel('Luas Permukaan : ')
        self.volume = QLabel('Volume : ')

        #buat box edit
        self.editJari = QLineEdit()
        self.editTinggi = QLineEdit()

        #atur Horisontal layout button
        tombol = QGridLayout()
        tombol.addWidget(self.luasAlas, 0, 0)
        tombol.addWidget(self.luasSelimut, 0, 1)
        tombol.addWidget(self.luasPermukaan, 1, 0)
        tombol.addWidget(self.volume, 1, 1)

        #atur grid label isi data
        grid = QGridLayout()
        grid.addWidget(self.labelNama, 0, 0, 1, 2)
        #membuat objek garis horisontal
        horisontal = QFrame()
        #membuat garis
        horisontal.setFrameShape(QFrame.HLine)
        horisontal.setFrameShadow(QFrame.Sunken)
        grid.addWidget(horisontal, 1, 0, 1, 2)
        grid.addWidget(self.label1, 2, 0)
        grid.addWidget(self.label2, 3, 0)
        grid.addWidget(self.editJari, 2, 1)
        grid.addWidget(self.editTinggi, 3, 1)

        #satukan layout
        layout = QVBoxLayout()
        layout.addLayout(grid)
        layout.addLayout(tombol)
        #membuat objek garis horisontal
        horisontal = QFrame()
        #membuat garis
        horisontal.setFrameShape(QFrame.HLine)
        horisontal.setFrameShadow(QFrame.Sunken)
        layout.addWidget(horisontal)

        #hasil
        layout.addWidget(self.hasil)
        layout.addStretch()

        self.setLayout(layout)

        self.hasil.clicked.connect(self.hasilclick)
Ejemplo n.º 7
0
class Welcome(QWidget):
    def __init__(self):
        super().__init__()

        self.layout = QVBoxLayout()

        self.setWindowFlags(Qt.Widget | Qt.WindowCloseButtonHint
                            | Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)

        self.setStyleSheet("""
        
        QWidget {
        
            background-color: #434343;
        }
        
        QLabel {
        
            background-color: transparent;
            color: white;
        }
        
        """)

        self.progress_bar = QProgressBar()
        self.label = QLabel("""
        <h3> ASI E-poe laoülevaate tarkvara </h3>
        """)

        self.layout.addWidget(self.label)

        self.update_label = QLabel()
        self.layout.addWidget(self.update_label)
        self.layout.addWidget(self.progress_bar)

        self.setLayout(self.layout)

        self.desktop = QDesktopWidget()

        self.label_width = 150
        self.label_height = 150

        self.screenWidth = self.desktop.screen().width()

        self.screenHeight = self.desktop.screen().height()

        self.x = (self.screenWidth - self.label_width) // 2
        self.y = (self.screenHeight - self.label_height) // 2

        self.resize(self.label_width, self.label_height)
        self.move(self.x - 150, self.y - 100)

        self.show()

        self.show_loading()

    def show_loading(self):

        if os.path.isfile(
                "inventuur.db"):  # File exists, setting up is unnecessary
            return "no"

        self.update_label.setText("Setting up the database...")
        from database import Create
        a = Create()
        for i in range(101):
            self.progress_bar.setValue(i)
            x = random.randint(1, 100)
            QtTest.QTest.qWait(x)

            if i == 25:
                a.init_db()
                self.update_label.setText("Database initialized...")

            if i == 60:
                self.update_label.setText("Collecting data...")
                QtTest.QTest.qWait(1000)
                a.add_data()
                self.update_label.setText("Database filled...")

        self.hide()
        self.start()

    def start(self):

        self.process = QProcess()

        self.process.startDetached("python3 asi.py")

    def closeEvent(self, a0):

        os._exit(1)