Пример #1
0
    def demoWidget(self):
        cb = QCheckBox("MyCheckBox", self)
        cb.move(0, 0)
        cb.resize(cb.sizeHint()) #가장 최적의 사이즈를 찾아줌
        cb.stateChanged.connect(self.changed)
        #stateChanged는 시그널임. self.changed

        s = QSlider(QtCore.Qt.Horizontal , self)
        s.move(30,30)
        s.setRange(0,100) #범위 지정
        s.resize(300,10)
        s.setSingleStep(2) #최소 단위 설정
        s.valueChanged.connect(self.slider)

        self.label = QLabel(self)
        self.label.move(0, 100)
        self.label.setText("Hello <b style='color: red'>QLabel</b>")

        self.qle1 = QLineEdit(self)
        self.qle2 = QLineEdit(self)
        label2 = QLabel(self)

        self.qle1.move(0,150)
        label2.move(110,150)
        label2.setText("+")
        label2.resize(20,30)
        self.qle2.move(130,150)

        self.button = QPushButton("result", self)
        self.button.move(0,200)
        self.button.clicked.connect(self.calculation_add)

        self.result = QLabel(self)
        self.result.move(0,250)
        self.result.setFont(QtGui.QFont('SansSerif', 20))
Пример #2
0
class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.label = QLabel(self)
        self.label.setMinimumSize(200, 10)
        self.initializeUI()

    def initializeUI(self):
        self.setGeometry(100, 100, 250, 250)
        self.setWindowTitle('QCheckBox Test')
        self.label.move(30, 200)
        header_label = QLabel(self)
        header_label.setText("Во сколько вы просыпаетесь?")
        header_label.setWordWrap(True)
        header_label.move(10, 10)
        header_label.resize(230, 60)
        morning6 = QCheckBox("6 утра", self)  # text, parent
        morning6.move(20, 80)
        morning6.stateChanged.connect(self.printChoose)
        morning7 = QCheckBox("7 утра", self)  # text, parent
        morning7.move(20, 100)
        morning7.stateChanged.connect(self.printChoose)
        never_sleep = QCheckBox("Я вообще не сплю", self)  # text, parent
        never_sleep.move(20, 120)
        never_sleep.stateChanged.connect(self.printChoose)
        self.show()

    def printChoose(self, state):
        sender = self.sender()
        if state == Qt.Checked:
            choose = f"Выбрано: {sender.text()}."
        else:
            choose = f"Отменен выбор: {sender.text()}."
        self.label.setText(choose)
Пример #3
0
class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        self.setGeometry(300, 300, 250, 200)
        self.setWindowTitle('Font dialog')
        self.show()

    def initUI(self):
        vbox = QVBoxLayout()

        btn = QPushButton('フォント選択', self)
        btn.setSizePolicy(QSizePolicy.Fixed,
                          QSizePolicy.Fixed)

        btn.move(20, 20)

        vbox.addWidget(btn)

        btn.clicked.connect(self.showDialog)

        self.lbl = QLabel('フォントサンプル : abcdef ABCDEF', self)
        self.lbl.move(100, 20)

        vbox.addWidget(self.lbl)
        self.setLayout(vbox)

    def showDialog(self):
        ok, font = QFontDialog.getFont()
        if ok:
            self.lbl.setFont(font)
Пример #4
0
class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        vbox = QVBoxLayout()

        btn = QPushButton('Dialog', self)
        btn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        btn.move(20, 20)

        vbox.addWidget(btn)

        btn.clicked.connect(self.showDialog)

        self.label = QLabel('Knowledge only matters', self)
        self.label.move(130, 20)

        vbox.addWidget(self.label)
        self.setLayout(vbox)

        self.setGeometry(300, 300, 450, 350)
        self.setWindowTitle('Font dialog')
        self.show()

    def showDialog(self):

        font, OK = QFontDialog.getFont()
        if OK:
            self.label.setFont(font)
Пример #5
0
class ComboBox(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.lbl = QLabel('中国', self)
        self.lbl.move(50, 150)

        combo = QComboBox(self)
        combo.addItem('中国')
        combo.addItem('美国')
        combo.addItem('法国')
        combo.addItem('德国')
        combo.addItem('俄罗斯')
        combo.addItem('澳大利亚')
        combo.move(50, 50)
        combo.activated[str].connect(self.onActivated)

        combo1 = QComboBox(self)
        combo1.addItem('Item1')
        combo1.addItem('Item2')
        combo1.addItem('Item3')
        combo1.move(200, 50)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QComboBox控件')
        self.show()

    def onActivated(self, text):
        self.lbl.setText(text)
        self.lbl.adjustSize()
Пример #6
0
    def initRadioButtons(self):

        width = self.width()
        height = self.height()

        self.deterministicRadio = QRadioButton('Deterministic Queue', self)
        self.deterministicRadio.setFont(QFont('Sanserif', 18))
        self.deterministicRadio.setStyleSheet('QRadioButton{color:maroon}')
        self.deterministicRadio.adjustSize()
        self.deterministicRadio.move(100, 100)
        self.deterministicRadio.clicked.connect(self.deterministicRadioClicked)

        self.stochasticRadio = QRadioButton('Stochastic Queue', self)
        self.stochasticRadio.setFont(QFont('Sanserif', 18))
        self.stochasticRadio.setStyleSheet('QRadioButton{color:darkslategray}')
        self.stochasticRadio.adjustSize()
        self.stochasticRadio.move((width / 2) + 50, 100)
        self.stochasticRadio.clicked.connect(self.stochasticRadioClicked)

        self.deterministicRadio = QRadioButton('WhatEver Queue', self)
        self.deterministicRadio.setFont(QFont('Sanserif', 18))
        self.deterministicRadio.setStyleSheet('QRadioButton{color:steelblue}')
        self.deterministicRadio.adjustSize()
        self.deterministicRadio.move(300, 200)

        icon1 = QIcon('line.png')
        label1 = QLabel('Sample', self)
        pixmap1 = icon1.pixmap(100, 100, QIcon.Active, QIcon.On)
        label1.setPixmap(pixmap1)
        label1.move((width / 2) - 50, 300)
        label1.adjustSize()
Пример #7
0
    def displayWidgets(self):
        """
        Configura os widgets da app
        """
        # Criando um label e um edit para o nome
        quest_lbl = QLabel(self)
        quest_lbl.setText(
            "Em quais turnos você pode trabalhar? (Verifque antes de confirmar)"
        )
        quest_lbl.setWordWrap(True)
        quest_lbl.move(10, 10)  # localiza o label na tela
        quest_lbl.resize(230, 60)

        # definindo os checkboxes
        manha_cbx = QCheckBox("Matutino [8:00 - 14:00]", self)
        manha_cbx.move(20, 80)
        manha_cbx.toggle()
        manha_cbx.stateChanged.connect(self.printToTerminal)

        tarde_cbx = QCheckBox("Vespertino [14:00 - 20:00]", self)
        tarde_cbx.move(20, 100)
        #tarde_cbx.toggle()
        tarde_cbx.stateChanged.connect(self.printToTerminal)

        noite_cbx = QCheckBox("Noturno [20:00 - 2:00]", self)
        noite_cbx.move(20, 120)
        #noite_cbx.toggle()
        noite_cbx.stateChanged.connect(self.printToTerminal)
Пример #8
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.move(3, 20)
        self.setFixedSize

        rates = requests.get(
            "https://wasabiwallet.io/api/v3/btc/Offchain/exchange-rates")
        coinjoin_states = requests.get(
            "https://wasabiwallet.io/api/v3/btc/ChaumianCoinJoin/states")

        rates = [
            "1 BTC = {0[rate]} {0[ticker]}".format(el) for el in rates.json()
        ]
        coinjoin_info = "\n\nCoinJoin\nPeers: {0[registeredPeerCount]}/{0[requiredPeerCount]}\nRound: {0[roundId]}".format(
            coinjoin_states.json()[0])

        self.label = QLabel("\n".join(rates) + coinjoin_info)
        self.label.setParent(self)
        self.label.move(0, 5)

        prvt_key_shift = 80

        label = QLabel('Завантажте приватний ключ', self)
        label.move(0, prvt_key_shift)
        prvt_key_selector = PrivateKeySelector(self)
        prvt_key_selector.move(0, prvt_key_shift + 15)

        self.show_key = QTextEdit(self)
        self.show_key.setFixedSize(200, 210)
        self.show_key.setDisabled(True)
        self.show_key.move(320, prvt_key_shift + 4)
Пример #9
0
class WinDialog(QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setAttribute(Qt.WA_TranslucentBackground, True)
        self.setWindowFlag(Qt.FramelessWindowHint, True)
        self.widget = QWidget(self)
        self.widget.setGeometry(0, 0, 400, 300)
        self.widget.setStyleSheet(
            'border-radius:10px;background-color:#FFFFFF;')
        self.label = QLabel("恭喜你,数独已经被你成功解答", self)
        self.label.move(25, 0)
        self.label.resize(350, 200)
        self.label.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        self.label.setWordWrap(True)
        self.newGame = QPushButton("新游戏", self)
        self.newGame.resize(100, 50)
        self.newGame.move(25, 200)
        self.newGame.clicked.connect(lambda: self.new_game())
        self.wait = QPushButton("再看看", self)
        self.wait.resize(100, 50)
        self.wait.move(150, 200)
        self.wait.clicked.connect(lambda: self.close())
        self.continueButton = QPushButton("退出", self)
        self.continueButton.resize(100, 50)
        self.continueButton.move(275, 200)
        self.continueButton.clicked.connect(
            lambda: self.parent().parent().close())
        self.label.setStyleSheet(
            'border-radius:10px;background-color:#FFFFFF;')

    def new_game(self):
        self.close()
        self.parent().parent().play(self.parent().parent().start)
Пример #10
0
class EXample(QWidget):
    def __init__(self):
        super().__init__()

        self.initUI()

    def initUI(self):

        self.lbl = QLabel("Ubuntu", self)  # 设置Label默认值

        combo = QComboBox(self)
        combo.addItem("Ubuntu")
        combo.addItem("Mandriva")
        combo.addItem("Fedora")
        combo.addItem("Arch")
        combo.addItem("Gentoo")

        combo.move(50, 50)
        self.lbl.move(50, 150)

        combo.activated[str].connect(self.onActivated)

        self.setGeometry(300, 300, 600, 400)
        self.setWindowTitle("QComboBox")
        self.show()

    def onActivated(self, text):

        self.lbl.setText(text)
        self.lbl.adjustSize()
Пример #11
0
    def displayLabels(self):
        """
        Apresentando texto e imagens com QLabels.

        Verifica se o arquivo de imagem está disponível,
        caso contrario gera uma exception.
        """

        txt_lbl = QLabel(self)
        txt_lbl.setText("Saudações")
        txt_lbl.move(95, 15)

        #img = "Imagens/pessoa.png"
        qr = qrcode.QRCode(
            version=1,
            error_correction=qrcode.constants.ERROR_CORRECT_L,
            box_size=10,
            border=4,
        )

        qr.add_data("Esbel Tomas Valero Orellana, ")
        qr.add_data("Professor Pleno, ")
        qr.add_data("*****@*****.**")
        qr.make(fit=True)

        img = qr.make_image(fill_color="black", back_color="white")
        imgQt = ImageQt(img.convert("RGB"))  # keep a reference!
        pixmap = QPixmap.fromImage(imgQt)
        #self.setPixmap(pixm.scaled(self.size(),QtCore.Qt.KeepAspectRatio))

        pic_lbl = QLabel(self)
        #pixmap = QPixmap(img)
        pixmap = pixmap.scaled(160, 160)
        pic_lbl.setPixmap(pixmap)
        pic_lbl.move(45, 45)
Пример #12
0
class Example(QWidget):

    def initUI(self):
        self.lbl = QLabel("Ubuntu", self)
        self.lbl.move(50, 150)

        combo = QComboBox(self)
        combo.addItem("Ubuntu")
        combo.addItem("Mac OS")
        combo.addItem("Windows")
        combo.addItem("Red Hat")
        combo.addItem("Fedora")

        combo.move(50, 50)
        combo.setGeometry(50, 50, 100, 100)
        combo.activated[str].connect(self.onActivated)

        self.setGeometry(300, 300, 200, 200)
        self.setWindowTitle('QComboBox')
        self.show()

    def onActivated(self, text):
        self.lbl.setText(text)
        self.lbl.adjustSize()   # This is needed to update the label as the textedit got updated

    def __init__(self):
        super(Example, self).__init__()
        self.initUI()
Пример #13
0
    def displayImag(self):
        """
        Modifica a imagem de fundo e mostra imagem 
        do funcionario no crachá

        Verifica se os arquivos de imagens estão disponível,
        caso contrario gera uma exception.
        """

        text = QLabel(self)
        text.setText("Saudações")
        text.move(105, 15)

        bckImg = "Imagens/modelo.png"
        usrImg = "Imagens/pessoa.png"

        try:
            with open(bckImg):
                bck = QLabel(self)
                pixmap = QPixmap(bckImg)
                pixmap = pixmap.scaled(250, 400)
                bck.setPixmap(pixmap)
        except FileNotFoundError:
            print("Não tem imagem de fundo!")

        try:
            with open(usrImg):
                foto = QLabel(self)
                pixmap = QPixmap(usrImg)
                pixmap = pixmap.scaled(130, 130)
                foto.setPixmap(pixmap)
                foto.move(120 - 65, 122 - 65)
        except FileNotFoundError:
            print("Não tem foto para o cracha!")
Пример #14
0
class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle('Premiere Pro Version Changer')

        self.label1 = QLabel('Drop your file here', self)
        self.label1.move(120, 90)

        QToolTip.setFont('Helvetica')
        self.setToolTip(
            'Drag and Drop a <b>Premiere Project File</b> to be converted into this window. As soon as the file is dropped, you will find a folder named as the Project File with the extension "_changed" in the same location where the Project File that you dopped is located. Inside, you will find a <b>Converted Premiere Project File</b>.'
        )

        self.setAcceptDrops(True)

    def greetings(self):
        print("Hello %s" % self.edit.text())

    def dragEnterEvent(self, e):
        if e.mimeData().hasUrls():
            e.acceptProposedAction()

    def dropEvent(self, e):
        for url in e.mimeData().urls():
            userInput = url.toLocalFile()
            # print("Change Version on Project: " + userInput)
            func(userInput)
        return userInput
Пример #15
0
 def __init__(self, main, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.main = main
     label = QLabel('Вставте ключ', self)
     label.move(6, 0)
     self.editor = QTextEdit(self)
     self.editor.move(5, 15)
     self.editor.setFixedSize(285, 120)
Пример #16
0
 def createBackArrow(self):
     icon1 = QIcon('arrow_back.png')
     label1 = QLabel('Sample', self)
     pixmap1 = icon1.pixmap(20, 20, QIcon.Active, QIcon.On)
     label1.setPixmap(pixmap1)
     label1.move(25, 25)
     label1.adjustSize()
     label1.mousePressEvent = self.arrowbackClicked
Пример #17
0
    def initUI(self):
        label = QLabel("Press ESC to Quit", self)
        label.move(15, 10)

        self.setToolTip("Press ESC to quit")

        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Event handler')
        self.show()
Пример #18
0
class MyWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.resize(640, 480)
        self.demoWidget()

    def changed(self, state): #state부분은 다른 이름으로 바꿔도 됨
        # print(state)
        print("Checked" if state == QtCore.Qt.Checked else "Unchecked")
        #그냥 2로 적는것보단 QtCore의 Qt라는 페키지에 있는 것을 사용하는 것이 더 좋음

    def slider(self, state):
        print(state)
        self.label.setText(str(state))

    def calculation_add(self):
        num1 = int(self.qle1.text())
        num2 = int(self.qle2.text())
        self.result.setText(str(num1+num2))

    def demoWidget(self):
        cb = QCheckBox("MyCheckBox", self)
        cb.move(0, 0)
        cb.resize(cb.sizeHint()) #가장 최적의 사이즈를 찾아줌
        cb.stateChanged.connect(self.changed)
        #stateChanged는 시그널임. self.changed

        s = QSlider(QtCore.Qt.Horizontal , self)
        s.move(30,30)
        s.setRange(0,100) #범위 지정
        s.resize(300,10)
        s.setSingleStep(2) #최소 단위 설정
        s.valueChanged.connect(self.slider)

        self.label = QLabel(self)
        self.label.move(0, 100)
        self.label.setText("Hello <b style='color: red'>QLabel</b>")

        self.qle1 = QLineEdit(self)
        self.qle2 = QLineEdit(self)
        label2 = QLabel(self)

        self.qle1.move(0,150)
        label2.move(110,150)
        label2.setText("+")
        label2.resize(20,30)
        self.qle2.move(130,150)

        self.button = QPushButton("result", self)
        self.button.move(0,200)
        self.button.clicked.connect(self.calculation_add)

        self.result = QLabel(self)
        self.result.move(0,250)
        self.result.setFont(QtGui.QFont('SansSerif', 20))
Пример #19
0
class MainWindow(QWidget):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__()
        self.preview_screen = QApplication.primaryScreen().grabWindow(0)
        self.settings()
        self.create_widgets()
        self.set_layout()
        print(type(self.preview_screen))

    def settings(self):
        self.resize(370, 270)
        self.setWindowTitle('Screenshoter')

    def create_widgets(self):
        self.img_preview = QLabel()
        self.img_preview.setPixmap(
            self.preview_screen.scaled(350, 350, Qt.KeepAspectRatio,
                                       Qt.SmoothTransformation))

        self.btn_save_screenshot = QPushButton('Save screenshot')
        self.btn_new_screenshot = QPushButton('New screenshot')

        # Signals connections
        self.btn_save_screenshot.clicked.connect(self.save_screenshot)
        self.btn_new_screenshot.clicked.connect(self.new_screenshot)

    def set_layout(self):
        self.img_preview.setParent(self)
        self.img_preview.move(10, 10)

        self.btn_save_screenshot.setParent(self)
        self.btn_new_screenshot.setParent(self)
        self.btn_save_screenshot.move(10, 240)
        self.btn_new_screenshot.move(100, 240)

    def save_screenshot(self):
        img, _ = QFileDialog.getSaveFileName(self,
                                             'Salvar Arquivo',
                                             filter='PNG(*.png);; JPEG(*.jpg)')
        if img[-3:] == 'png':
            self.preview_screen.save(img, 'png')
        elif img[-3:] == 'jpg':
            self.preview_screen.save(img, 'jpg')

    def new_screenshot(self):
        self.hide()
        QTimer.singleShot(500, self.take_screenshot)

    def take_screenshot(self):
        self.preview_screen = QApplication.primaryScreen().grabWindow(0)
        self.img_preview.setPixmap(
            self.preview_screen.scaled(350, 350, Qt.KeepAspectRatio,
                                       Qt.SmoothTransformation))
        self.show()
Пример #20
0
    def displayButton(self):
        """
        Configura o button 
        """

        nome_label = QLabel(self)
        nome_label.setText("Não aperte o botão!!!")
        nome_label.move(30, 30)  # localiza o label na tela

        botao = QPushButton('Aperte aqui!', self)
        botao.clicked.connect(self.buttonClicked)
        botao.move(50, 70)  # localizando o botão na tela
Пример #21
0
 def loading_message(self) -> QDialog:
     """Returns the message box to be displayed while the user waits for the input data to load."""
     message = QDialog(self)
     message.setWindowTitle('Loading')
     message.resize(300, 50)
     label = QLabel('loading DataFrame into memory...', message)
     label.setStyleSheet(self.style['label'])
     label.adjustSize()
     label.setAlignment(Qt.AlignCenter)
     label.move(int((message.width() - label.width()) / 2),
                int((message.height() - label.height()) / 2))
     return message
Пример #22
0
def func(userInput):
    # check if userInput has the extension .prproj
    check = userInput
    # print(userInput)
    if check.endswith('.prproj'):
        label0 = QLabel("Converting file to a previous version of premiere")
        label0.move(120, 80)
        convert(check)
    else:
        label10 = QLabel(" The file refered is not a Premiere Project.")
        label10.move(120, 80)
    return check
Пример #23
0
 def quit_message(self) -> QDialog:
     """Displays a window while SCOUTS is exiting"""
     message = QDialog(self)
     message.setWindowTitle('Exiting SCOUTS')
     message.resize(300, 50)
     label = QLabel('SCOUTS is exiting, please wait...', message)
     label.setStyleSheet(self.style['label'])
     label.adjustSize()
     label.setAlignment(Qt.AlignCenter)
     label.move(int((message.width() - label.width()) / 2),
                int((message.height() - label.height()) / 2))
     return message
Пример #24
0
    def initUI(self):
        '''
        Must Todo UI:
        1. add goto decensored file button
        2. Two progress bars
            2-1. total images to decenesor (images in ./decensor_input)
            2-2. current decensoring image's censored area (example marmaid image in DCPv2, 2 / 17)
        3. go back to main button

        Could Do UI:
        1. showing live image decensoring (decensored one by one)
        '''

        # progress bar showing images left to be decensored
        def setProgressBar():
            bar_X = 50
            bar_Y = 300
            bar_width = 600
            bar_height = 30

            # images waiting to be decensored
            self.total_images_ProgressBar = QProgressBar(self)
            # setGeometry(left top x cordinate, left top y cordinate, width, height)
            self.total_images_ProgressBar.setGeometry(bar_X, bar_Y, bar_width,
                                                      bar_height)
            self.total_images_ProgressBar.setMaximum(100)
            self.total_images_ProgressBar.setValue(0)

            # showing progress of decensored area
            self.signal_image_decensor_ProgressBar = QProgressBar(self)
            self.signal_image_decensor_ProgressBar.setGeometry(
                bar_X, bar_Y + 80, bar_width, bar_height)
            self.signal_image_decensor_ProgressBar.setMaximum(100)
            self.signal_image_decensor_ProgressBar.setValue(0)

        progress_Label_1 = QLabel(self)
        progress_Label_1.move(50, 270)
        progress_Label_1.setText("Decensor progress of all images")
        progress_Label_1.resize(progress_Label_1.sizeHint())

        progress_Label_2 = QLabel(self)
        progress_Label_2.move(50, 300 + 50)
        progress_Label_2.setText("Decensor progress of current image")
        progress_Label_2.resize(progress_Label_2.sizeHint())

        self.progress_status_LABEL = QLabel(self)
        self.progress_status_LABEL.move(100, 100)
        self.progress_status_LABEL.setText("Decensoring...")
        self.progress_status_LABEL.resize(
            self.progress_status_LABEL.sizeHint())

        setProgressBar()
Пример #25
0
 def setIconModes(self):
     icon1 = QIcon("icon.png")
     label1 = QLabel("sample", self)
     pixmap1 = icon1.pixmap(100, 100, QIcon.Active, QIcon.On)
     label1.setPixmap(pixmap1)
     label2 = QLabel("sample", self)
     pixmap2 = icon1.pixmap(100, 100, QIcon.Disabled, QIcon.Off)
     label2.setPixmap(pixmap2)
     label2.move(100, 0)
     label3 = QLabel("sample", self)
     pixmap3 = icon1.pixmap(100, 100, QIcon.Selected, QIcon.On)
     label3.setPixmap(pixmap3)
     label3.move(200, 0)
Пример #26
0
 def initializeUI(self):
     self.setGeometry(100, 100, 400, 200)
     self.setWindowTitle('QLineEdit Test')
     QLabel("Введите login", self).move(100, 10)
     name_label = QLabel("Login:", self)
     name_label.move(70, 50)
     self.line_edit.setAlignment(
         Qt.AlignLeft)  # выравнивание по левому краю
     self.line_edit.move(130, 50)
     self.line_edit.resize(200, 20)
     self.button.clicked.connect(self.clearEntries)
     self.button.move(160, 110)
     self.show()
Пример #27
0
    def displayInfo(self):
        """
        Cria labels para apresentar as informações do funcionario
        """

        nomeFun = QLabel(self)
        nomeFun.setText("Francisco Silva Oliveira")
        nomeFun.move(40, 240)
        nomeFun.setFont(QFont('Arial', 14))

        cargFun = QLabel(self)
        cargFun.setText("Programador")
        cargFun.move(40, 280)
        nomeFun.setFont(QFont('Arial', 12))
    def __init__(self, screen_width, screen_height):
        self.screen_width = screen_width
        self.screen_height = screen_height
        self.screen_ratio = screen_width / 3840
        self.half_screen_ratio = 0.45 + self.screen_ratio / 2
        self.production_speed_ratio = 1
        self.window = QMainWindow()
        self.window.resize(self.screen_width, self.screen_height)
        self.window.setWindowTitle('戴森球计划产量计算器 ver.0.1')
        self.grid_width = 75 * self.screen_ratio
        self.grid_height = 50 * self.screen_ratio
        self.init_bias = 50 * self.screen_ratio
        self.interval = 0 * self.screen_ratio
        self.box_width = self.grid_width * 4 + self.interval + 5 * self.screen_ratio
        self.box_height = self.grid_height * 2 + self.init_bias + 5 * self.screen_ratio

        # Subtitle: app name - author
        self.subtitle_font_size = 50 * self.screen_ratio
        if self.screen_ratio > 0.7:
            self.subtitle_font_size = 50 * self.screen_ratio / 1.5
        subtitle = QLabel(self.window)
        subtitle.setText('戴森球计划 材料生产计算器 -- by 魂月')
        subtitle.setStyleSheet('QLabel {font: 75 ' + str(int(self.subtitle_font_size)) + 'pt "宋体";}')
        subtitle.move(1000 * self.screen_ratio, int(25 * self.screen_ratio))
        subtitle.resize(1840 * self.screen_ratio, self.box_height * self.screen_ratio)

        # Bottom: 取整机器数量
        self.button = QPushButton('取整机器数量', self.window)
        self.button.move(2840 * self.screen_ratio, int(25 * self.screen_ratio) + int(self.box_height / 3))
        self.button.resize(400 * self.screen_ratio, int(self.box_height / 3))
        self.button.setStyleSheet('QPushButton {font: ' + str(int(self.subtitle_font_size / 2)) + 'pt "宋体";}')
        self.button.clicked.connect(self.ceil_machine_number)

        self.ox = (self.screen_width - 12 * self.box_width) / 2
        self.oy = self.box_height + 50 * self.screen_ratio
        self.font_size = 14 * self.half_screen_ratio
        self.line_edit_font_size = self.font_size * 0.9 * 0.75
        self.element = source.element
        self.production = source.production
        self.supporter = source.support
        self.bi_material = source.bi_material
        self.sorted_element = source.sorted_element
        self.element_box = [[[None, None, None, None] for _ in range(len(self.element[0]))] for _ in range(len(self.element))]
        self.element_amount = [[[0, 0, 0, 0] for _ in range(len(self.element[0]))] for _ in range(len(self.element))]
        self.table_gen()
        for resource in self.sorted_element:
            i, j = self.get_idx(resource)
            for k in range(4):
                self.element_box[i][j][k].editingFinished.connect(self.update_element_amount)
Пример #29
0
    def backGroundcolorChanger(self):
        icon1=QIcon('colors.png')
        label1=QLabel('ColorPalette',self)
        pixmap1=icon1.pixmap(30,30,QIcon.Active,QIcon.On)
        label1.setPixmap(pixmap1)
        label1.setToolTip('go to Previous Screen')
        label1.mousePressEvent=self.getBackgroundColor

        self.namesLabel=QLabel('Designed by:\n\tAbd-ElRahman Abd-ElFattah Habib.\n\tMohammed Ahmed Mekkawy.\n\tElSayed Abd-ElMohaymen ElSayed.\n',self)
        self.namesLabel.width=300
        width=self.width()
        height=self.height()

        label1.move(width-40,height-40)
        self.namesLabel.move(10,height-60)
        self.namesLabel.adjustSize()
Пример #30
0
    def displayWidgets(self):
        """
        Configura os widgets da app
        """
        # Criando um label e um edit para o nome
        nome_label = QLabel("Nome:",self)
        nome_label.move(70, 50) # localiza o label na tela

        self.nome_edit = QLineEdit(self)
        self.nome_edit.setAlignment(Qt.AlignLeft)                           # Este é o padrão
        self.nome_edit.move(130, 50)
        self.nome_edit.resize(200, 20)                                      # mudando o tamanho da caixa de texto

        self.limpar_btn = QPushButton('Limpar', self)
        self.limpar_btn.clicked.connect(self.limparCxTxt)
        self.limpar_btn.move(160, 110)                                      # localizando o botão na tela