def load(self, path): if path == self._path: return self._path = path with open(os.path.join(self._path, "theme.json")) as f: Logger.log("d", "Loading theme file: %s", os.path.join(self._path, "theme.json")) data = json.load(f) self._initializeDefaults() if "colors" in data: for name, color in data["colors"].items(): c = QColor(color[0], color[1], color[2], color[3]) self._colors[name] = c fontsdir = os.path.join(self._path, "fonts") if os.path.isdir(fontsdir): for file in os.listdir(fontsdir): if "ttf" in file: QFontDatabase.addApplicationFont(os.path.join(fontsdir, file)) if "fonts" in data: for name, font in data["fonts"].items(): f = QFont() f.setFamily(font.get("family", QCoreApplication.instance().font().family())) f.setBold(font.get("bold", False)) f.setLetterSpacing(QFont.AbsoluteSpacing, font.get("letterSpacing", 0)) f.setItalic(font.get("italic", False)) f.setPixelSize(font.get("size", 1) * self._em_height) f.setCapitalization(QFont.AllUppercase if font.get("capitalize", False) else QFont.MixedCase) self._fonts[name] = f if "sizes" in data: for name, size in data["sizes"].items(): s = QSizeF() s.setWidth(round(size[0] * self._em_width)) s.setHeight(round(size[1] * self._em_height)) self._sizes[name] = s iconsdir = os.path.join(self._path, "icons") if os.path.isdir(iconsdir): for icon in os.listdir(iconsdir): name = os.path.splitext(icon)[0] self._icons[name] = QUrl.fromLocalFile(os.path.join(iconsdir, icon)) imagesdir = os.path.join(self._path, "images") if os.path.isdir(imagesdir): for image in os.listdir(imagesdir): name = os.path.splitext(image)[0] self._images[name] = QUrl.fromLocalFile(os.path.join(imagesdir, image)) styles = os.path.join(self._path, "styles.qml") if os.path.isfile(styles): c = QQmlComponent(self._engine, styles) context = QQmlContext(self._engine, self._engine) context.setContextProperty("Theme", self) self._styles = c.create(context) if c.isError(): for error in c.errors(): Logger.log("e", error.toString()) Logger.log("d", "Loaded theme %s", self._path) self.themeLoaded.emit()
def __init__(self, string): super().__init__(string) self.setFlags(Qt.ItemIsEnabled) self.setTextAlignment(Qt.AlignCenter) self.setBackground(QBrush(QColor(97, 154, 244))) font = QFont() font.setBold(True) font.setCapitalization(QFont.SmallCaps) self.setFont(font)
def init_ui(self): self.setStyle(QStyleFactory.create("Windows")) self.setView(QListView()) font = QFont() font.setLetterSpacing(QFont.AbsoluteSpacing, 0.8) font.setPixelSize(11) font.setCapitalization(QFont.AllUppercase) self.setFont(font)
def __init__(self, text, type=str, value=None): super().__init__() self.type = type self.setLayout(QVBoxLayout()) label = QLabel(text) font = QFont("Helvetica [Cronyx]", 10) font.setCapitalization(QFont.SmallCaps) label.setFont(font) self.edit = QLineEdit() if type is int: self.edit.setFixedWidth(30) else: pass # self.edit.setFixedWidth(60) if type is int: self.edit.setValidator(QIntValidator(-999, 999)) if value is not None: self.edit.setText(str(value)) self.layout().addWidget(label, Qt.AlignCenter) self.layout().addWidget(self.edit, Qt.AlignCenter)
def init_ui(self): self.layout = QVBoxLayout() self.setObjectName("tablePanel") self.training_label = QLabel("Training set") self.layout.addWidget(self.training_label) font = QFont() font.setLetterSpacing(QFont.AbsoluteSpacing, 2) font.setPixelSize(11.5) font.setCapitalization(QFont.AllUppercase) self.training_label.setFont(font) self.trainingTable = Datatable() self.empty_label = QLabel("Currently empty") self.trainingTable.setVisible(False) self.trainingTable.added.connect(self.added_to_table) self.trainingViewAll = CustomPushButton("View all") self.trainingViewAll.clicked.connect(self.clicked_training_view_all) self.trainingViewAll.setVisible(False) self.layout.addWidget(self.trainingTable) self.layout.addWidget(self.empty_label) self.layout.addWidget(self.trainingViewAll) self.testing_label = QLabel("Test set") self.layout.addWidget(self.testing_label) self.testing_label.setFont(font) self.testing_quantity = QLabel("0 items") self.testingViewAll = CustomPushButton("View all") self.testingViewAll.clicked.connect(self.clicked_testing_view_all) self.layout.addWidget(self.testing_quantity) self.layout.addWidget(self.testingViewAll) self.testingViewAll.setVisible(False) self.setContentsMargins(5, 0, 5, 0) self.setLayout(self.layout) self.setAutoFillBackground(True)
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.setWindowTitle("Bedrijfs Informatie Systeem") self.setWindowIcon(QIcon('./images/logos/logo.jpg')) self.setFont(QFont('Arial', 10)) self.Aanhef = QLabel() q2Edit = QComboBox() q2Edit.setFixedWidth(80) q2Edit.setFont(QFont("Arial", 10)) q2Edit.setStyleSheet("color: black; background-color: gainsboro") q2Edit.addItem(' ') q2Edit.addItem('Dhr. ') q2Edit.addItem('Mevr. ') q2Edit.setCurrentIndex(q2Edit.findText(rpaccount[1])) q2Edit.activated[str].connect(self.q2Changed) self.Voornaam = QLabel() q3Edit = QLineEdit(mvoornaam) q3Edit.setFixedWidth(200) q3Edit.setFont(QFont("Arial", 10)) q3Edit.textChanged.connect(self.q3Changed) reg_ex = QRegExp("^[^0-9]{1,30}$") input_validator = QRegExpValidator(reg_ex, q3Edit) q3Edit.setValidator(input_validator) self.Tussenvoegsel = QLabel() q4Edit = QLineEdit('') q4Edit.setFixedWidth(80) q4Edit.setFont(QFont("Arial", 10)) q4Edit.textChanged.connect(self.q4Changed) q4Edit.setText(mtussenv) reg_ex = QRegExp("^[^0-9]{1,10}$") input_validator = QRegExpValidator(reg_ex, q3Edit) q4Edit.setValidator(input_validator) self.Achternaam = QLabel() q5Edit = QLineEdit(machternaam) q5Edit.setFixedWidth(400) q5Edit.setFont(QFont("Arial", 10)) q5Edit.textChanged.connect(self.q5Changed) reg_ex = QRegExp("^[^0-9]{1,50}$") input_validator = QRegExpValidator(reg_ex, q5Edit) q5Edit.setValidator(input_validator) self.Straat = QLabel() q6Edit = QLineEdit(mstraat) q6Edit.setFixedWidth(500) q6Edit.setDisabled(True) q6Edit.setStyleSheet( "QLineEdit { background-color: ; color: black }") q6Edit.setFont(QFont("Arial", 10)) q6Edit.textChanged.connect(self.q6Changed) self.Huisnummer = QLabel() q7Edit = QLineEdit(str(mhuisnr)) q7Edit.setFixedWidth(60) q7Edit.setFont(QFont("Arial", 10)) q7Edit.textChanged.connect(self.q7Changed) reg_ex = QRegExp("^[0-9]{1,5}$") input_validator = QRegExpValidator(reg_ex, q7Edit) q7Edit.setValidator(input_validator) self.Toevoeging = QLabel() q8Edit = QLineEdit('') q8Edit.setFixedWidth(80) q8Edit.setFont(QFont("Arial", 10)) q8Edit.textChanged.connect(self.q8Changed) q8Edit.setText(mtoev) reg_ex = QRegExp("^[A-Za-z0-9-#]{0,10}") input_validator = QRegExpValidator(reg_ex, q8Edit) q8Edit.setValidator(input_validator) self.Postcode = QLabel() q9Edit = QLineEdit(mpostcode) q9Edit.setFixedWidth(70) font = QFont("Arial", 10) font.setCapitalization(QFont.AllUppercase) q9Edit.setFont(font) q9Edit.textChanged.connect(self.q9Changed) reg_ex = QRegExp("^[0-9]{4}[A-Za-z]{2}$") input_validator = QRegExpValidator(reg_ex, q9Edit) q9Edit.setValidator(input_validator) self.Woonplaats = QLabel() q10Edit = QLineEdit(mplaats) q10Edit.setFixedWidth(500) q10Edit.setDisabled(True) q10Edit.setFont(QFont("Arial", 10)) q10Edit.setStyleSheet( "QLineEdit { background-color: ; color: black }") q10Edit.textChanged.connect(self.q10Changed) self.email = QLabel() q11Edit = QLineEdit(m_email) q11Edit.setFixedWidth(300) q11Edit.setFont(QFont("Arial", 10)) q11Edit.textChanged.connect(self.q11Changed) reg_ex = QRegExp( "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$") input_validator = QRegExpValidator(reg_ex, q11Edit) q11Edit.setValidator(input_validator) self.BestaandWachtwoord = QLabel() q12Edit = QLineEdit() q12Edit.setFixedWidth(300) q12Edit.setFont(QFont("Arial", 10)) q12Edit.setEchoMode(QLineEdit.Password) q12Edit.textChanged.connect(self.q12Changed) self.NieuwWachtwoord = QLabel() q13Edit = QLineEdit() q13Edit.setFixedWidth(300) q13Edit.setFont(QFont("Arial", 10)) q13Edit.setEchoMode(QLineEdit.Password) q13Edit.textChanged.connect(self.q13Changed) self.NieuwWachtwoordControle = QLabel() q14Edit = QLineEdit() q14Edit.setFixedWidth(300) q14Edit.setFont(QFont("Arial", 10)) q14Edit.setEchoMode(QLineEdit.Password) q14Edit.textChanged.connect(self.q14Changed) self.Telefoonnr = QLabel() q15Edit = QLineEdit('') q15Edit.setFixedWidth(100) q15Edit.setFont(QFont("Arial", 10)) q15Edit.textChanged.connect(self.q15Changed) q15Edit.setText(mtelnr) reg_ex = QRegExp("^[#0]{1}[0-9]{9}$") input_validator = QRegExpValidator(reg_ex, q15Edit) q15Edit.setValidator(input_validator) self.Accountnummer = QLabel() q16Edit = QLineEdit(str(maccountnr)) q16Edit.setFixedWidth(100) q16Edit.setDisabled(True) q16Edit.setStyleSheet( "QLineEdit { background-color: ; color: black }") q16Edit.setFont(QFont("Arial", 10)) q16Edit.textChanged.connect(self.q16Changed) self.Geboortedatum = QLabel() q17Edit = QLineEdit(mgebdat) q17Edit.setFixedWidth(100) q17Edit.setFont(QFont("Arial", 10)) q17Edit.textChanged.connect(self.q17Changed) reg_ex = QRegExp( '^[1-2]{1}[09]{1}[0-9]{2}-[0-1]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$') input_validator = QRegExpValidator(reg_ex, q17Edit) q17Edit.setValidator(input_validator) grid = QGridLayout() grid.setSpacing(20) lbl = QLabel() pixmap = QPixmap('./images/logos/verbinding.jpg') lbl.setPixmap(pixmap) grid.addWidget(lbl, 1, 0) logo = QLabel() pixmap = QPixmap('./images/logos/logo.jpg') logo.setPixmap(pixmap) grid.addWidget(logo, 1, 2, 1, 1, Qt.AlignRight) self.setFont(QFont('Arial', 10)) grid.addWidget(QLabel('Opvragen of aanpassen persoongegevens'), 1, 1) grid.addWidget( QLabel(' *'), 2, 0) grid.addWidget(QLabel('Verplichte velden'), 2, 1) grid.addWidget(QLabel('Aanhef'), 3, 0) grid.addWidget(q2Edit, 3, 1) grid.addWidget(QLabel('Voornaam *'), 4, 0) grid.addWidget(q3Edit, 4, 1) grid.addWidget(QLabel('Tussenvoegsel'), 5, 0) grid.addWidget(q4Edit, 5, 1) grid.addWidget(QLabel('Achternaam *'), 6, 0) grid.addWidget(q5Edit, 6, 1, 1, 2) grid.addWidget(QLabel('Geboortedatum *'), 7, 0) grid.addWidget( QLabel(' formaat: jjjj-mm-dd'), 7, 1, 1, 2) grid.addWidget(q17Edit, 7, 1) grid.addWidget(QLabel('Straat'), 8, 0) grid.addWidget(q6Edit, 8, 1, 1, 2) grid.addWidget(QLabel('Huisnummer *'), 9, 0) grid.addWidget(q7Edit, 9, 1) grid.addWidget(QLabel('Toevoeging'), 9, 1, 1, 1, Qt.AlignRight) grid.addWidget(q8Edit, 9, 2) grid.addWidget(QLabel('Postcode *'), 10, 0) grid.addWidget(q9Edit, 10, 1) grid.addWidget(QLabel('Woonplaats'), 11, 0) grid.addWidget(q10Edit, 11, 1, 1, 2) grid.addWidget(QLabel('e-mail *'), 12, 0) grid.addWidget(q11Edit, 12, 1, 1, 2) grid.addWidget(QLabel('Bestaand wachtwoord *'), 13, 0) grid.addWidget(q12Edit, 13, 1, 1, 2) grid.addWidget(QLabel('Nieuw wachtwoord *'), 14, 0) grid.addWidget(q13Edit, 14, 1, 1, 2) grid.addWidget(QLabel('Nieuw wachtwoord controle *'), 15, 0) grid.addWidget(q14Edit, 15, 1, 1, 2) grid.addWidget(QLabel('Telefoonnummer'), 16, 0) grid.addWidget(q15Edit, 16, 1) grid.addWidget(QLabel('Accountnummer'), 17, 0) grid.addWidget(q16Edit, 17, 1, 1, 2) grid.addWidget( QLabel('\u00A9 2017 all rights reserved [email protected]'), 18, 0, 1, 3, Qt.AlignCenter) self.setLayout(grid) self.setGeometry(500, 50, 350, 300) applyBtn = QPushButton('Wijzigen') applyBtn.clicked.connect(self.accept) grid.addWidget(applyBtn, 17, 2, 1, 1, Qt.AlignRight) applyBtn.setFont(QFont("Arial", 10)) applyBtn.setFixedWidth(100) applyBtn.setStyleSheet( "color: black; background-color: gainsboro") cancelBtn = QPushButton('Sluiten') cancelBtn.clicked.connect(lambda: windowSluit(self, m_email)) grid.addWidget(cancelBtn, 16, 2, 1, 1, Qt.AlignRight) cancelBtn.setFont(QFont("Arial", 10)) cancelBtn.setFixedWidth(100) cancelBtn.setStyleSheet( "color: black; background-color: gainsboro")
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.setWindowTitle("Wijzigen leverancier") self.setWindowIcon(QIcon('./images/logos/logo.jpg')) self.setFont(QFont('Arial', 10)) self.Bedrijfsnaam = QLabel() q3Edit = QLineEdit() q3Edit.setText(mbedrnaam) q3Edit.setFixedWidth(540) q3Edit.setFont(QFont("Arial", 10)) q3Edit.textChanged.connect(self.q3Changed) reg_ex = QRegExp("^[^0-9]{1,50}$") input_validator = QRegExpValidator(reg_ex, q3Edit) q3Edit.setValidator(input_validator) self.Rechtsvorm = QLabel() q5Edit = QLineEdit() q5Edit.setText(mrechtsvorm) q5Edit.setFixedWidth(100) q5Edit.setFont(QFont("Arial", 10)) q5Edit.textChanged.connect(self.q5Changed) reg_ex = QRegExp("^[^0-9]{1,30}$") input_validator = QRegExpValidator(reg_ex, q5Edit) q5Edit.setValidator(input_validator) self.BTWnummer = QLabel() q2Edit = QLineEdit() q2Edit.setText(str(mbtwnr)) q2Edit.setDisabled(True) q2Edit.setFixedWidth(170) q2Edit.setStyleSheet( "QLineEdit { font-size: 10pt; font-family: Arial; color: black }" ) q2Edit.textChanged.connect(self.q2Changed) reg_ex = QRegExp("^[A-Za-z]{2}[0-9]{9}[Bb]{1}[0-9]{2}$") input_validator = QRegExpValidator(reg_ex, q2Edit) q2Edit.setValidator(input_validator) self.KvKnummer = QLabel() q4Edit = QLineEdit() q4Edit.setText(str(mkvknr)) q4Edit.setFixedWidth(110) q4Edit.setDisabled(True) q4Edit.setStyleSheet( "QLineEdit { font-size: 10pt; font-family: Arial; color: black }" ) q4Edit.textChanged.connect(self.q4Changed) reg_ex = QRegExp("^[0-9]{8}$") input_validator = QRegExpValidator(reg_ex, q4Edit) q4Edit.setValidator(input_validator) self.Straat = QLabel() q1Edit = QLineEdit() q1Edit.setText(mstraat) q1Edit.setFixedWidth(500) q1Edit.setDisabled(True) q1Edit.setStyleSheet( "QLineEdit { font-size: 10pt; font-family: Arial; color: black }" ) q1Edit.textChanged.connect(self.q1Changed) self.Huisnummer = QLabel() q7Edit = QLineEdit() q7Edit.setText(str(mhuisnr)) q7Edit.setFixedWidth(60) q7Edit.setAlignment(Qt.AlignRight) q7Edit.setFont(QFont("Arial", 10)) q7Edit.textChanged.connect(self.q7Changed) reg_ex = QRegExp("^[0-9]{1,5}$") input_validator = QRegExpValidator(reg_ex, q7Edit) q7Edit.setValidator(input_validator) self.Toevoeging = QLabel() q8Edit = QLineEdit('') q8Edit.setFixedWidth(80) q8Edit.setFont(QFont("Arial", 10)) q8Edit.textChanged.connect(self.q8Changed) q8Edit.setText(mtoev) reg_ex = QRegExp("^[A-Za-z0-9-#]{0,10}") input_validator = QRegExpValidator(reg_ex, q8Edit) q8Edit.setValidator(input_validator) self.Postcode = QLabel() q6Edit = QLineEdit() q6Edit.setText(mpostcode) q6Edit.setFixedWidth(80) font = QFont("Arial", 10) font.setCapitalization(QFont.AllUppercase) q6Edit.setFont(font) q6Edit.textChanged.connect(self.q6Changed) reg_ex = QRegExp("^[0-9]{4}[A-Za-z]{2}$") input_validator = QRegExpValidator(reg_ex, q6Edit) q6Edit.setValidator(input_validator) self.Woonplaats = QLabel() q15Edit = QLineEdit() q15Edit.setText(mplaats) q15Edit.setFixedWidth(400) q15Edit.setDisabled(True) q15Edit.setStyleSheet( "QLineEdit { font-size: 10pt; font-family: Arial; color: black }" ) q15Edit.textChanged.connect(self.q15Changed) self.Telefoonnr = QLabel() q13Edit = QLineEdit('') q13Edit.setFixedWidth(120) q13Edit.setFont(QFont("Arial", 10)) q13Edit.textChanged.connect(self.q13Changed) q13Edit.setText(mtelnr) reg_ex = QRegExp("^[0]{1}[0-9]{9}$") input_validator = QRegExpValidator(reg_ex, q13Edit) q13Edit.setValidator(input_validator) self.Leveranciernummer = QLabel() q14Edit = QLineEdit() q14Edit.setText(str(mlevnr)) q14Edit.setAlignment(Qt.AlignRight) q14Edit.setFixedWidth(120) q14Edit.setDisabled(True) q14Edit.setStyleSheet( "QLineEdit { font-size: 10pt; font-family: Arial; color: black }" ) q14Edit.textChanged.connect(self.q14Changed) grid = QGridLayout() grid.setSpacing(20) lbl = QLabel() pixmap = QPixmap('./images/logos/verbinding.jpg') lbl.setPixmap(pixmap) grid.addWidget(lbl, 0, 0) logo = QLabel() pixmap = QPixmap('./images/logos/logo.jpg') logo.setPixmap(pixmap) grid.addWidget(logo, 0, 1, 1, 2, Qt.AlignRight) self.setFont(QFont('Arial', 10)) grid.addWidget(QLabel('Leverancier wijzigingen'), 0, 1) grid.addWidget(QLabel(' *'), 1, 0) grid.addWidget(QLabel('Verplichte velden'), 1, 1) grid.addWidget(QLabel('Bedrijfsnaam *'), 2, 0) grid.addWidget(q3Edit, 2, 1, 1, 3) grid.addWidget(QLabel('Rechtsvorm *'), 3, 0) grid.addWidget(q5Edit, 3, 1) grid.addWidget(QLabel('BTWnummer'), 3, 1, 1, 1, Qt.AlignRight) grid.addWidget(q2Edit, 3, 2) grid.addWidget(QLabel('KvKnummer'), 5, 0) grid.addWidget(q4Edit, 5, 1) grid.addWidget(QLabel('Straat'), 6, 0) grid.addWidget(q1Edit, 6, 1, 1, 2) grid.addWidget(QLabel('Huisnummer *'), 7, 0) grid.addWidget(q7Edit, 7, 1) grid.addWidget(QLabel('Toevoeging'), 7, 1, 1, 1, Qt.AlignRight) grid.addWidget(q8Edit, 7, 2) grid.addWidget(QLabel('Postcode Woonplaats *'), 8, 0) grid.addWidget(q6Edit, 8, 1) grid.addWidget(q15Edit, 8, 1, 1, 2, Qt.AlignRight) grid.addWidget(QLabel('Telefoonnummer *'), 9, 0) grid.addWidget(q13Edit, 9, 1) grid.addWidget(QLabel('Leveranciernummer'), 10, 0) grid.addWidget(q14Edit, 10, 1) grid.addWidget( QLabel('\u00A9 2017 all rights reserved [email protected]'), 11, 1, 1, 1) cancelBtn = QPushButton('Sluiten') cancelBtn.clicked.connect(lambda: winzlevSluit(self, m_email)) applyBtn = QPushButton('Wijzigen') applyBtn.clicked.connect(self.accept) grid.addWidget(applyBtn, 10, 2, 1, 1, Qt.AlignRight) applyBtn.setFont(QFont("Arial", 10)) applyBtn.setFixedWidth(100) applyBtn.setStyleSheet( "color: black; background-color: gainsboro") grid.addWidget(cancelBtn, 9, 2, 1, 1, Qt.AlignRight) cancelBtn.setFont(QFont("Arial", 10)) cancelBtn.setFixedWidth(100) cancelBtn.setStyleSheet( "color: black; background-color: gainsboro") self.setLayout(grid) self.setGeometry(500, 100, 150, 150)
fuente.setCapitalization(QFont.MixedCase) # Aplicar fuente al objeto QApplication aplicacion.setFont(fuente) # Pasar el foco al lineEdit self.lineEdit.setFocus() # ================================================================ if __name__ == '__main__': import sys # La clase QApplication administra el flujo de control de la aplicación # GUI y la configuración principal. aplicacion = QApplication(sys.argv) fuente = QFont() fuente.setPointSize(10) # Tamaño de la fuente fuente.setFamily("Bahnschrift Light") # Tipo de fuente fuente.setCapitalization(QFont.AllUppercase) # Texto en mayúsculas aplicacion.setFont(fuente) # Aplicar fuente al objeto QApplication ventana = ventanaPrincipal() ventana.show() sys.exit(aplicacion.exec_())
def load(self, path, is_first_call = True): if path == self._path: return with open(os.path.join(path, "theme.json"), encoding = "utf-8") as f: Logger.log("d", "Loading theme file: %s", os.path.join(path, "theme.json")) data = json.load(f) # Iteratively load inherited themes try: theme_id = data["metadata"]["inherits"] self.load(Resources.getPath(Resources.Themes, theme_id), is_first_call = False) except FileNotFoundError: Logger.log("e", "Could not find inherited theme %s", theme_id) except KeyError: pass # No metadata or no inherits keyword in the theme.json file if "colors" in data: for name, color in data["colors"].items(): c = QColor(color[0], color[1], color[2], color[3]) self._colors[name] = c fontsdir = os.path.join(path, "fonts") if os.path.isdir(fontsdir): for file in os.listdir(fontsdir): if "ttf" in file: QFontDatabase.addApplicationFont(os.path.join(fontsdir, file)) if "fonts" in data: system_font_size = QCoreApplication.instance().font().pointSize() for name, font in data["fonts"].items(): f = QFont() f.setFamily(font.get("family", QCoreApplication.instance().font().family())) if font.get("bold"): f.setBold(font.get("bold", False)) else: f.setWeight(font.get("weight", 50)) f.setLetterSpacing(QFont.AbsoluteSpacing, font.get("letterSpacing", 0)) f.setItalic(font.get("italic", False)) f.setPointSize(int(font.get("size", 1) * system_font_size)) f.setCapitalization(QFont.AllUppercase if font.get("capitalize", False) else QFont.MixedCase) self._fonts[name] = f if "sizes" in data: for name, size in data["sizes"].items(): s = QSizeF() s.setWidth(round(size[0] * self._em_width)) s.setHeight(round(size[1] * self._em_height)) self._sizes[name] = s iconsdir = os.path.join(path, "icons") if os.path.isdir(iconsdir): for icon in os.listdir(iconsdir): name = os.path.splitext(icon)[0] self._icons[name] = QUrl.fromLocalFile(os.path.join(iconsdir, icon)) imagesdir = os.path.join(path, "images") if os.path.isdir(imagesdir): for image in os.listdir(imagesdir): name = os.path.splitext(image)[0] self._images[name] = QUrl.fromLocalFile(os.path.join(imagesdir, image)) styles = os.path.join(path, "styles.qml") if os.path.isfile(styles): c = QQmlComponent(self._engine, styles) context = QQmlContext(self._engine, self._engine) context.setContextProperty("Theme", self) self._styles = c.create(context) if c.isError(): for error in c.errors(): Logger.log("e", error.toString()) Logger.log("d", "Loaded theme %s", path) self._path = path # only emit the theme loaded signal once after all the themes in the inheritance chain have been loaded if is_first_call: self.themeLoaded.emit()
class Ui_VentanaLogin(object): font: QFont def setupUi(self, VentanaLogin): VentanaLogin.setObjectName("VentanaLogin") VentanaLogin.resize(700, 187) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( VentanaLogin.sizePolicy().hasHeightForWidth()) VentanaLogin.setSizePolicy(sizePolicy) VentanaLogin.setMaximumSize(QtCore.QSize(700, 187)) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("..\icons\icons-página-principal-.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) VentanaLogin.setWindowIcon(icon) VentanaLogin.setToolTip("") VentanaLogin.setStatusTip("") VentanaLogin.setWhatsThis("") VentanaLogin.setAccessibleName("") VentanaLogin.setLayoutDirection(QtCore.Qt.LeftToRight) VentanaLogin.setStyleSheet("#VentanaLogin{\n" "" "background-color: rgb(230, 230, 230)\n" "}\n" "\n" "QLabel{\n" "font: 13pt \"Tahoma\";\n" "\n" "}\n" "\n" "#labelLogin{\n" "font-size: 30px;\n" "}\n" "\n" "\n" "\n" "QLineEdit, QPushButton{\n" "font: 13pt \"Tahoma\";\n" "border: 1px solid black;\n" "\n" "}\n" "\n" "\n" "QPushButton:hover{\n" "\n" "background-color: #0c80c4;\n" "}\n" "\n" "#btnImagen:hover{\n" "background-color: none;\n" "}\n" "#btnImagen{\n" "border-style:none;\n" "}") VentanaLogin.setWindowFilePath("") VentanaLogin.setInputMethodHints(QtCore.Qt.ImhNone) self.centralwidget = QtWidgets.QWidget(VentanaLogin) self.centralwidget.setObjectName("centralwidget") self.formLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.formLayoutWidget.setGeometry(QtCore.QRect(160, 80, 391, 82)) self.formLayoutWidget.setObjectName("formLayoutWidget") self.layoutFormulario = QtWidgets.QFormLayout(self.formLayoutWidget) self.layoutFormulario.setLabelAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter) self.layoutFormulario.setContentsMargins(0, 10, 0, 0) self.layoutFormulario.setHorizontalSpacing(10) self.layoutFormulario.setObjectName("layoutFormulario") self.txtUsuario = QtWidgets.QLineEdit(self.formLayoutWidget) self.txtUsuario.setInputMethodHints(QtCore.Qt.ImhNone) self.font = QFont() self.font.setCapitalization(QFont.AllUppercase) self.txtUsuario.setFont(self.font) self.txtUsuario.setInputMask("") self.txtUsuario.setText("") self.txtUsuario.setEchoMode(QtWidgets.QLineEdit.Normal) self.txtUsuario.setObjectName("txtUsuario") self.layoutFormulario.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.txtUsuario) self.labelContrasena = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) font.setBold(False) font.setItalic(False) font.setWeight(50) self.labelContrasena.setFont(font) self.labelContrasena.setObjectName("labelContrasena") self.layoutFormulario.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.labelContrasena) self.txtContrasena = QtWidgets.QLineEdit(self.formLayoutWidget) self.txtContrasena.setEchoMode(QtWidgets.QLineEdit.Password) self.txtContrasena.setObjectName("txtContrasena") self.layoutFormulario.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.txtContrasena) self.labelUsuario = QtWidgets.QLabel(self.formLayoutWidget) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) font.setBold(False) font.setItalic(False) font.setWeight(50) self.labelUsuario.setFont(font) self.labelUsuario.setObjectName("labelUsuario") self.layoutFormulario.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.labelUsuario) spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.layoutFormulario.setItem(1, QtWidgets.QFormLayout.FieldRole, spacerItem) self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.horizontalLayoutWidget.setGeometry(QtCore.QRect(560, 80, 121, 85)) self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout( self.horizontalLayoutWidget) self.verticalLayout.setContentsMargins(0, 9, 0, 10) self.verticalLayout.setSpacing(10) self.verticalLayout.setObjectName("verticalLayout") self.btnIniciarSesion = QtWidgets.QPushButton( self.horizontalLayoutWidget) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) font.setBold(False) font.setItalic(False) font.setWeight(50) self.btnIniciarSesion.setFont(font) self.btnIniciarSesion.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.btnIniciarSesion.setStyleSheet("") self.btnIniciarSesion.setObjectName("btnIniciarSesion") self.verticalLayout.addWidget(self.btnIniciarSesion) spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem1) self.btnCancelar = QtWidgets.QPushButton(self.horizontalLayoutWidget) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) font.setBold(False) font.setItalic(False) font.setWeight(50) self.btnCancelar.setFont(font) self.btnCancelar.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.btnCancelar.setStyleSheet("") self.btnCancelar.setAutoDefault(False) self.btnCancelar.setDefault(False) self.btnCancelar.setFlat(False) self.btnCancelar.setObjectName("btnCancelar") self.verticalLayout.addWidget(self.btnCancelar) self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(150, 20, 531, 50)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.layoutTitulo = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.layoutTitulo.setContentsMargins(0, 0, 0, 0) self.layoutTitulo.setSpacing(22) self.layoutTitulo.setObjectName("layoutTitulo") self.labelLogin = QtWidgets.QLabel(self.verticalLayoutWidget) self.labelLogin.setLayoutDirection(QtCore.Qt.LeftToRight) self.labelLogin.setAlignment(QtCore.Qt.AlignCenter) self.labelLogin.setObjectName("labelLogin") self.layoutTitulo.addWidget(self.labelLogin) self.btnImagen = QtWidgets.QPushButton(self.centralwidget) self.btnImagen.setGeometry(QtCore.QRect(4, 0, 143, 187)) self.btnImagen.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("..\icons\parking-idea.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnImagen.setIcon(icon1) self.btnImagen.setIconSize(QtCore.QSize(140, 180)) self.btnImagen.setObjectName("btnImagen") self.formLayoutWidget.raise_() self.horizontalLayoutWidget.raise_() self.verticalLayoutWidget.raise_() self.labelLogin.raise_() self.btnImagen.raise_() VentanaLogin.setCentralWidget(self.centralwidget) self.retranslateUi(VentanaLogin) QtCore.QMetaObject.connectSlotsByName(VentanaLogin) VentanaLogin.setTabOrder(self.txtUsuario, self.txtContrasena) VentanaLogin.setTabOrder(self.txtContrasena, self.btnIniciarSesion) VentanaLogin.setTabOrder(self.btnIniciarSesion, self.btnCancelar) def retranslateUi(self, VentanaLogin): _translate = QtCore.QCoreApplication.translate VentanaLogin.setWindowTitle( _translate("VentanaLogin", "Parking - Inicio de Sesión")) self.labelContrasena.setText(_translate("VentanaLogin", "Contraseña :")) self.labelUsuario.setText(_translate("VentanaLogin", "Usuario :")) self.btnIniciarSesion.setText(_translate("VentanaLogin", "Entrar")) self.btnCancelar.setText(_translate("VentanaLogin", "Salir")) self.labelLogin.setText( _translate("VentanaLogin", "PARQUEADERO EL NIÑO JAIR"))
def __init__(self): QDialog.__init__(self) grid = QGridLayout() grid.setSpacing(12) self.setWindowTitle("Wijzigen Werkorders Intern") self.setWindowIcon(QIcon('./images/logos/logo.jpg')) self.setFont(QFont('Arial', 10)) self.lbl = QLabel() self.pixmap = QPixmap('./images/logos/verbinding.jpg') self.lbl.setPixmap(self.pixmap) grid.addWidget(self.lbl, 0, 0) self.logo = QLabel() self.pixmap = QPixmap('./images/logos/logo.jpg') self.logo.setPixmap(self.pixmap) grid.addWidget(self.logo, 0, 1, 1, 2, Qt.AlignRight) grid.addWidget(QLabel('Wijzigen Orders Intern'), 0, 0, 1, 3, Qt.AlignCenter) self.Werkordernummer = QLabel() q1Edit = QLineEdit(str(rpord[0])) q1Edit.setFixedWidth(100) q1Edit.setAlignment(Qt.AlignRight) q1Edit.setStyleSheet( "QLineEdit { font-size: 10pt; font-family: Arial; color: black }" ) q1Edit.setDisabled(True) q1Edit.setFont(QFont("Arial", 10)) self.Omschrijving = QLabel() q2Edit = QLineEdit(str(rpord[1])) q2Edit.setFixedWidth(400) q2Edit.setFont(QFont("Arial", 10)) q2Edit.textChanged.connect(self.q2Changed) self.Voorgangstatus = QLabel() q3Edit = QLineEdit(str(rpord[3])) q3Edit.setFixedWidth(20) font = QFont("Arial", 10) font.setCapitalization(QFont.AllUppercase) q3Edit.setFont(font) if str(rpord[3]) < 'G': q3Edit.setDisabled(True) q3Edit.setStyleSheet( "QLineEdit { font-size: 10pt; font-family: Arial; color: black }" ) q3Edit.textChanged.connect(self.q3Changed) reg_ex = QRegExp('^[A-Ha-h]{1}$') input_validator = QRegExpValidator(reg_ex, q3Edit) q3Edit.setValidator(input_validator) self.Startdatum = QLabel() q4Edit = QLineEdit(str(rpord[6])) q4Edit.setFixedWidth(100) q4Edit.setFont(QFont("Arial", 10)) q4Edit.textChanged.connect(self.q4Changed) reg_ex = QRegExp( '^[2]{1}[0]{1}[0-9]{2}[-]{1}[0-1]{1}[0-9]{1}[-]{1}[0-3]{1}[0-9]{1}$' ) input_validator = QRegExpValidator(reg_ex, q4Edit) q4Edit.setValidator(input_validator) self.Afgemeld = QLabel() q5Edit = QLineEdit(str(rpord[7])) q5Edit.setFixedWidth(100) q5Edit.setFont(QFont("Arial", 10)) q5Edit.textChanged.connect(self.q5Changed) reg_ex = QRegExp( '^[2]{1}[0]{1}[0-9]{2}[-]{1}[0-1]{1}[0-9]{1}[-]{1}[0-3]{1}[0-9]{1}$' ) input_validator = QRegExpValidator(reg_ex, q5Edit) q5Edit.setValidator(input_validator) self.Gereed = QLabel() q6Edit = QLineEdit(str(round(float(rpord[19]), 2))) q6Edit.setFixedWidth(100) q6Edit.setFont(QFont("Arial", 10)) q6Edit.setAlignment(Qt.AlignRight) q6Edit.textChanged.connect(self.q6Changed) reg_ex = QRegExp("^[-+]?[0-9]*\.?[0-9]+$") input_validator = QRegExpValidator(reg_ex, q6Edit) q6Edit.setValidator(input_validator) self.Goedgekeurd = QLabel() q7Edit = QLineEdit(str(round(float(rpord[18]), 2))) q7Edit.setFixedWidth(100) q7Edit.setFont(QFont("Arial", 10)) q7Edit.setAlignment(Qt.AlignRight) q7Edit.textChanged.connect(self.q7Changed) reg_ex = QRegExp("^[-+]?[0-9]*\.?[0-9]+$") input_validator = QRegExpValidator(reg_ex, q7Edit) q7Edit.setValidator(input_validator) lbl1 = QLabel('Werkordernummer') grid.addWidget(lbl1, 1, 0) grid.addWidget(q1Edit, 1, 1) lbl2 = QLabel('Werkomschrijving') grid.addWidget(lbl2, 2, 0) grid.addWidget(q2Edit, 2, 1, 1, 2) lbl3 = QLabel('Voorgangstatus') grid.addWidget(lbl3, 3, 0) grid.addWidget(q3Edit, 3, 1) lbl4 = QLabel('Statusweek: ' + rpord[4]) grid.addWidget(lbl4, 3, 1, 1, 2, Qt.AlignRight) lbl5 = QLabel('Startdatum') grid.addWidget(lbl5, 4, 0) grid.addWidget(q4Edit, 4, 1) lbl6 = QLabel('Afgemeld') grid.addWidget(lbl6, 5, 0) grid.addWidget(q5Edit, 5, 1) lbl7 = QLabel('Hoeveelheid\nGereed') grid.addWidget(lbl7, 6, 0) grid.addWidget(q6Edit, 6, 1) lbl8 = QLabel(' Artikel: ' + str(rpord[16])) grid.addWidget(lbl8, 5, 1, 1, 2, Qt.AlignRight) lbl9 = QLabel(' Bestelhoeveelheid: ' + '{:12.2f}'.format(rpord[17])) grid.addWidget(lbl9, 6, 1, 1, 2, Qt.AlignRight) lbl10 = QLabel('Hoeveelheid\nGoedgekeurd') grid.addWidget(lbl10, 7, 0) grid.addWidget(q7Edit, 7, 1) wijzig = QPushButton('Wijzig') wijzig.clicked.connect(self.accept) grid.addWidget(wijzig, 9, 2, 1, 1, Qt.AlignRight) wijzig.setFont(QFont("Arial", 10)) wijzig.setFixedWidth(100) sluit = QPushButton('Sluiten') sluit.clicked.connect(self.close) grid.addWidget(sluit, 9, 1, 1, 2, Qt.AlignCenter) sluit.setFont(QFont("Arial", 10)) sluit.setFixedWidth(100) grid.addWidget( QLabel( '\u00A9 2017 all rights reserved [email protected]' ), 10, 0, 1, 3, Qt.AlignCenter) self.setLayout(grid) self.setGeometry(500, 300, 150, 150)
def load(self, path): if path == self._path: return self._path = path with open(os.path.join(self._path, "theme.json")) as f: Logger.log("d", "Loading theme file: %s", os.path.join(self._path, "theme.json")) data = json.load(f) self._initializeDefaults() if "colors" in data: for name, color in data["colors"].items(): c = QColor(color[0], color[1], color[2], color[3]) self._colors[name] = c fontsdir = os.path.join(self._path, "fonts") if os.path.isdir(fontsdir): for file in os.listdir(fontsdir): if "ttf" in file: QFontDatabase.addApplicationFont( os.path.join(fontsdir, file)) if "fonts" in data: for name, font in data["fonts"].items(): f = QFont() f.setFamily( font.get("family", QCoreApplication.instance().font().family())) f.setBold(font.get("bold", False)) f.setLetterSpacing(QFont.AbsoluteSpacing, font.get("letterSpacing", 0)) f.setItalic(font.get("italic", False)) f.setPixelSize(font.get("size", 1) * self._em_height) f.setCapitalization(QFont.AllUppercase if font.get( "capitalize", False) else QFont.MixedCase) self._fonts[name] = f if "sizes" in data: for name, size in data["sizes"].items(): s = QSizeF() s.setWidth(round(size[0] * self._em_width)) s.setHeight(round(size[1] * self._em_height)) self._sizes[name] = s iconsdir = os.path.join(self._path, "icons") if os.path.isdir(iconsdir): for icon in os.listdir(iconsdir): name = os.path.splitext(icon)[0] self._icons[name] = QUrl.fromLocalFile( os.path.join(iconsdir, icon)) imagesdir = os.path.join(self._path, "images") if os.path.isdir(imagesdir): for image in os.listdir(imagesdir): name = os.path.splitext(image)[0] self._images[name] = QUrl.fromLocalFile( os.path.join(imagesdir, image)) styles = os.path.join(self._path, "styles.qml") if os.path.isfile(styles): c = QQmlComponent(self._engine, styles) context = QQmlContext(self._engine, self._engine) context.setContextProperty("Theme", self) self._styles = c.create(context) if c.isError(): for error in c.errors(): Logger.log("e", error.toString()) Logger.log("d", "Loaded theme %s", self._path) self.themeLoaded.emit()
class Ui_Principal(object): font: QFont def setupUi(self, Principal): Principal.setObjectName("Principal") Principal.setWindowModality(QtCore.Qt.WindowModal) Principal.setEnabled(True) Principal.resize(1400, 697) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( Principal.sizePolicy().hasHeightForWidth()) Principal.setSizePolicy(sizePolicy) Principal.setMinimumSize(QtCore.QSize(1400, 650)) Principal.setSizeIncrement(QtCore.QSize(0, 0)) Principal.setFocusPolicy(QtCore.Qt.NoFocus) Principal.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) Principal.setAcceptDrops(False) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("..\icons\icons-página-principal-.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) Principal.setWindowIcon(icon) Principal.setStyleSheet("QLabel{\n" "font: 18pt \"Tahoma\";\n" "}\n" "\n" "QLineEdit,QComboBox{\n" "font: 18px \"Tahoma\";\n" "border:1px solid black;\n" "border-radius: 5px;\n" "\n" "}\n" "#labelTotalPagar{\n" "background-color: #0c80c4;\n" "}\n" "\n" "#labelPlaca, #labelTotalPagar{\n" "font-size: 60px;\n" "}\n" "\n" "#txtPlaca{\n" "font-size:60px;\n" "border:1px solid black;\n" "border-radius: 5px;\n" "\n" "}\n" "\n" "QPushButton{\n" "font: 13pt \"Tahoma\";\n" "border:1px solid black;\n" "border-radius: 5px;\n" "}\n" "\n" "#btnEntrada, #btnSalida{\n" "font: 25pt \"Tahoma\";\n" "}\n" "\n" "QPushButton:hover{\n" "background-color: #0c80c4;\n" "}\n" "\n" "#layoutGeneral{\n" "border:1px solid black;\n" "border-radius: 5px;\n" "}\n" "\n" "#layoutDescuento{\n" "border:1px solid black;\n" "border-radius: 5px\n" "}\n" "\n" "#layoutUsuario{\n" "border:1px solid black;\n" "border-radius: 5px;\n" "}\n" "\n" "#radioDescuento{\n" "font: 18pt \"Tahoma\";\n" "}\n" "") Principal.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) Principal.setDocumentMode(False) Principal.setTabShape(QtWidgets.QTabWidget.Rounded) Principal.setDockNestingEnabled(False) Principal.setUnifiedTitleAndToolBarOnMac(False) self.centralwidget = QtWidgets.QWidget(Principal) self.centralwidget.setObjectName("centralwidget") self.horizontalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.horizontalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 461, 81)) self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget") self.horizontalLayout = QtWidgets.QHBoxLayout( self.horizontalLayoutWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") self.labelPlaca = QtWidgets.QLabel(self.horizontalLayoutWidget) self.labelPlaca.setObjectName("labelPlaca") self.horizontalLayout.addWidget(self.labelPlaca) self.font = QFont() self.font.setCapitalization(QFont.AllUppercase) self.txtPlaca = QtWidgets.QLineEdit(self.horizontalLayoutWidget) self.txtPlaca.setObjectName("txtPlaca") self.txtPlaca.setMaxLength(7) self.txtPlaca.setFont(self.font) self.horizontalLayout.addWidget(self.txtPlaca) self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget.setGeometry(QtCore.QRect(510, 10, 821, 80)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.layoutTotalPagar = QtWidgets.QGridLayout(self.gridLayoutWidget) self.layoutTotalPagar.setContentsMargins(0, 0, 0, 0) self.layoutTotalPagar.setObjectName("layoutTotalPagar") self.labelTotalPagar = QtWidgets.QLabel(self.gridLayoutWidget) self.labelTotalPagar.setLayoutDirection(QtCore.Qt.LeftToRight) self.labelTotalPagar.setStyleSheet("border:1px solid black;\n" "border-radius: 5px;\n" "") self.labelTotalPagar.setAlignment(QtCore.Qt.AlignCenter) self.labelTotalPagar.setObjectName("labelTotalPagar") self.layoutTotalPagar.addWidget(self.labelTotalPagar, 0, 0, 1, 1) self.layoutGeneral = QtWidgets.QGroupBox(self.centralwidget) self.layoutGeneral.setGeometry(QtCore.QRect(10, 290, 461, 401)) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) font.setBold(False) font.setWeight(50) self.layoutGeneral.setFont(font) self.layoutGeneral.setStyleSheet("") self.layoutGeneral.setAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft) self.layoutGeneral.setObjectName("layoutGeneral") self.formLayout = QtWidgets.QFormLayout(self.layoutGeneral) self.formLayout.setFormAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.formLayout.setContentsMargins(5, 20, 5, 20) self.formLayout.setHorizontalSpacing(10) self.formLayout.setVerticalSpacing(15) self.formLayout.setObjectName("formLayout") self.label = QtWidgets.QLabel(self.layoutGeneral) self.label.setObjectName("label") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label) self.txtIdFactura = QtWidgets.QLineEdit(self.layoutGeneral) self.txtIdFactura.setEnabled(False) self.txtIdFactura.setObjectName("txtIdFactura") self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.txtIdFactura) self.label_2 = QtWidgets.QLabel(self.layoutGeneral) self.label_2.setObjectName("label_2") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_2) self.txtHoraEntrada = QtWidgets.QLineEdit(self.layoutGeneral) self.txtHoraEntrada.setEnabled(False) self.txtHoraEntrada.setObjectName("txtHoraEntrada") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.txtHoraEntrada) self.label_3 = QtWidgets.QLabel(self.layoutGeneral) self.label_3.setObjectName("label_3") self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_3) self.txtFechaEntrada = QtWidgets.QLineEdit(self.layoutGeneral) self.txtFechaEntrada.setEnabled(False) self.txtFechaEntrada.setObjectName("txtFechaEntrada") self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.txtFechaEntrada) self.label_4 = QtWidgets.QLabel(self.layoutGeneral) self.label_4.setObjectName("label_4") self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_4) self.txtHoraSalida = QtWidgets.QLineEdit(self.layoutGeneral) self.txtHoraSalida.setEnabled(False) self.txtHoraSalida.setObjectName("txtHoraSalida") self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.txtHoraSalida) self.label_5 = QtWidgets.QLabel(self.layoutGeneral) self.label_5.setObjectName("label_5") self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_5) self.txtFechaSalida = QtWidgets.QLineEdit(self.layoutGeneral) self.txtFechaSalida.setEnabled(False) self.txtFechaSalida.setObjectName("txtFechaSalida") self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.txtFechaSalida) self.label_6 = QtWidgets.QLabel(self.layoutGeneral) self.label_6.setObjectName("label_6") self.formLayout.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.label_6) self.txtTiempo = QtWidgets.QLineEdit(self.layoutGeneral) self.txtTiempo.setEnabled(False) self.txtTiempo.setObjectName("txtTiempo") self.formLayout.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.txtTiempo) self.label_7 = QtWidgets.QLabel(self.layoutGeneral) self.label_7.setObjectName("label_7") self.formLayout.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.label_7) self.txtValorCobro = QtWidgets.QLineEdit(self.layoutGeneral) self.txtValorCobro.setEnabled(False) self.txtValorCobro.setObjectName("txtValorCobro") self.formLayout.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.txtValorCobro) self.comboTipo = QtWidgets.QComboBox(self.layoutGeneral) self.comboTipo.setEditable(False) self.comboTipo.addItem("") self.comboTipo.addItem("") self.comboTipo.addItem("") self.comboTipo.setModelColumn(0) self.comboTipo.setObjectName("comboTipo") self.formLayout.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.comboTipo) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.formLayout.setItem(0, QtWidgets.QFormLayout.FieldRole, spacerItem) self.label_8 = QtWidgets.QLabel(self.layoutGeneral) self.label_8.setObjectName("label_8") self.formLayout.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.label_8) self.gridLayoutWidget_2 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_2.setGeometry(QtCore.QRect(510, 510, 821, 181)) self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2") self.layoutBotones = QtWidgets.QGridLayout(self.gridLayoutWidget_2) self.layoutBotones.setContentsMargins(0, 0, 0, 0) self.layoutBotones.setObjectName("layoutBotones") self.btnMensualidad = QtWidgets.QPushButton(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnMensualidad.sizePolicy().hasHeightForWidth()) self.btnMensualidad.setSizePolicy(sizePolicy) self.btnMensualidad.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("..\icons\icon-mensaualidad.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnMensualidad.setIcon(icon1) self.btnMensualidad.setIconSize(QtCore.QSize(50, 50)) self.btnMensualidad.setObjectName("btnMensualidad") self.layoutBotones.addWidget(self.btnMensualidad, 0, 3, 1, 1) self.btnPagar = QtWidgets.QPushButton(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnPagar.sizePolicy().hasHeightForWidth()) self.btnPagar.setSizePolicy(sizePolicy) self.btnPagar.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.btnPagar.setLayoutDirection(QtCore.Qt.LeftToRight) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap("..\icons\icon-pagar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnPagar.setIcon(icon2) self.btnPagar.setIconSize(QtCore.QSize(50, 50)) self.btnPagar.setObjectName("btnPagar") self.layoutBotones.addWidget(self.btnPagar, 1, 0, 1, 1) self.btnListarVehiculos = QtWidgets.QPushButton( self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnListarVehiculos.sizePolicy().hasHeightForWidth()) self.btnListarVehiculos.setSizePolicy(sizePolicy) self.btnListarVehiculos.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap("..\icons\icon-RA.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnListarVehiculos.setIcon(icon3) self.btnListarVehiculos.setIconSize(QtCore.QSize(50, 50)) self.btnListarVehiculos.setObjectName("btnListarVehiculos") self.layoutBotones.addWidget(self.btnListarVehiculos, 0, 1, 1, 1) self.btnInventario = QtWidgets.QPushButton(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnInventario.sizePolicy().hasHeightForWidth()) self.btnInventario.setSizePolicy(sizePolicy) self.btnInventario.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap("..\icons\icon-inventario.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnInventario.setIcon(icon4) self.btnInventario.setIconSize(QtCore.QSize(50, 50)) self.btnInventario.setObjectName("btnInventario") self.layoutBotones.addWidget(self.btnInventario, 0, 4, 1, 1) self.btnCuadre = QtWidgets.QPushButton(self.gridLayoutWidget_2) self.btnCuadre.setEnabled(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnCuadre.sizePolicy().hasHeightForWidth()) self.btnCuadre.setSizePolicy(sizePolicy) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) font.setBold(False) font.setItalic(False) font.setWeight(50) self.btnCuadre.setFont(font) self.btnCuadre.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) self.btnCuadre.setMouseTracking(False) self.btnCuadre.setFocusPolicy(QtCore.Qt.ClickFocus) self.btnCuadre.setContextMenuPolicy(QtCore.Qt.NoContextMenu) self.btnCuadre.setAcceptDrops(False) self.btnCuadre.setToolTip("") self.btnCuadre.setInputMethodHints(QtCore.Qt.ImhNone) self.btnCuadre.setText("Cuadre") icon5 = QtGui.QIcon() icon5.addPixmap(QtGui.QPixmap("..\icons\icon-cuadre.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnCuadre.setIcon(icon5) self.btnCuadre.setIconSize(QtCore.QSize(50, 50)) self.btnCuadre.setShortcut("") self.btnCuadre.setCheckable(False) self.btnCuadre.setAutoDefault(False) self.btnCuadre.setDefault(False) self.btnCuadre.setFlat(False) self.btnCuadre.setObjectName("btnCuadre") self.layoutBotones.addWidget(self.btnCuadre, 1, 1, 1, 1) self.btnLimpiar = QtWidgets.QPushButton(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnLimpiar.sizePolicy().hasHeightForWidth()) self.btnLimpiar.setSizePolicy(sizePolicy) self.btnLimpiar.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) icon6 = QtGui.QIcon() icon6.addPixmap(QtGui.QPixmap("..\icons\icons-limpiar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnLimpiar.setIcon(icon6) self.btnLimpiar.setIconSize(QtCore.QSize(50, 50)) self.btnLimpiar.setObjectName("btnLimpiar") self.layoutBotones.addWidget(self.btnLimpiar, 0, 0, 1, 1) self.btnCambiarPrecio = QtWidgets.QPushButton(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnCambiarPrecio.sizePolicy().hasHeightForWidth()) self.btnCambiarPrecio.setSizePolicy(sizePolicy) self.btnCambiarPrecio.setCursor( QtGui.QCursor(QtCore.Qt.PointingHandCursor)) icon7 = QtGui.QIcon() icon7.addPixmap(QtGui.QPixmap("..\icons\icon-editar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnCambiarPrecio.setIcon(icon7) self.btnCambiarPrecio.setIconSize(QtCore.QSize(50, 50)) self.btnCambiarPrecio.setObjectName("btnCambiarPrecio") self.layoutBotones.addWidget(self.btnCambiarPrecio, 1, 3, 1, 1) self.btnConsultar = QtWidgets.QPushButton(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnConsultar.sizePolicy().hasHeightForWidth()) self.btnConsultar.setSizePolicy(sizePolicy) self.btnConsultar.setCursor(QtGui.QCursor( QtCore.Qt.PointingHandCursor)) icon8 = QtGui.QIcon() icon8.addPixmap(QtGui.QPixmap("..\icons\icon-buscar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnConsultar.setIcon(icon8) self.btnConsultar.setIconSize(QtCore.QSize(50, 50)) self.btnConsultar.setObjectName("btnConsultar") self.layoutBotones.addWidget(self.btnConsultar, 1, 4, 1, 1) self.btnSalir = QtWidgets.QPushButton(self.gridLayoutWidget_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnSalir.sizePolicy().hasHeightForWidth()) self.btnSalir.setSizePolicy(sizePolicy) self.btnSalir.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor)) icon9 = QtGui.QIcon() icon9.addPixmap(QtGui.QPixmap("..\icons\salida.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnSalir.setIcon(icon9) self.btnSalir.setIconSize(QtCore.QSize(50, 50)) self.btnSalir.setObjectName("btnSalir") self.layoutBotones.addWidget(self.btnSalir, 0, 5, 2, 1) self.gridLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_3.setGeometry(QtCore.QRect(510, 120, 821, 151)) self.gridLayoutWidget_3.setObjectName("gridLayoutWidget_3") self.layoutUsuario = QtWidgets.QGridLayout(self.gridLayoutWidget_3) self.layoutUsuario.setContentsMargins(0, 0, 0, 0) self.layoutUsuario.setObjectName("layoutUsuario") self.labelFecha = QtWidgets.QLabel(self.gridLayoutWidget_3) self.labelFecha.setObjectName("labelFecha") self.layoutUsuario.addWidget(self.labelFecha, 1, 1, 1, 1) self.labelHora = QtWidgets.QLabel(self.gridLayoutWidget_3) self.labelHora.setEnabled(True) self.labelHora.setObjectName("labelHora") self.layoutUsuario.addWidget(self.labelHora, 0, 1, 1, 1) self.label_10 = QtWidgets.QLabel(self.gridLayoutWidget_3) self.label_10.setObjectName("label_10") self.layoutUsuario.addWidget(self.label_10, 1, 0, 1, 1) self.label_13 = QtWidgets.QLabel(self.gridLayoutWidget_3) self.label_13.setObjectName("label_13") self.layoutUsuario.addWidget(self.label_13, 0, 2, 1, 1) self.label_9 = QtWidgets.QLabel(self.gridLayoutWidget_3) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.label_9.sizePolicy().hasHeightForWidth()) self.label_9.setSizePolicy(sizePolicy) self.label_9.setObjectName("label_9") self.layoutUsuario.addWidget(self.label_9, 0, 0, 1, 1) self.labelCajero = QtWidgets.QLabel(self.gridLayoutWidget_3) self.labelCajero.setObjectName("labelCajero") self.layoutUsuario.addWidget(self.labelCajero, 0, 3, 1, 1) self.gridLayoutWidget_4 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_4.setGeometry(QtCore.QRect(10, 110, 461, 171)) self.gridLayoutWidget_4.setObjectName("gridLayoutWidget_4") self.gridLayout_3 = QtWidgets.QGridLayout(self.gridLayoutWidget_4) self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setObjectName("gridLayout_3") self.btnSalida = QtWidgets.QPushButton(self.gridLayoutWidget_4) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnSalida.sizePolicy().hasHeightForWidth()) self.btnSalida.setSizePolicy(sizePolicy) self.btnSalida.setIcon(icon9) self.btnSalida.setIconSize(QtCore.QSize(50, 50)) self.btnSalida.setObjectName("btnSalida") self.gridLayout_3.addWidget(self.btnSalida, 0, 1, 1, 1) self.btnEntrada = QtWidgets.QPushButton(self.gridLayoutWidget_4) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.btnEntrada.sizePolicy().hasHeightForWidth()) self.btnEntrada.setSizePolicy(sizePolicy) icon10 = QtGui.QIcon() icon10.addPixmap(QtGui.QPixmap("..\icons\icon-entrada.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnEntrada.setIcon(icon10) self.btnEntrada.setIconSize(QtCore.QSize(50, 50)) self.btnEntrada.setObjectName("btnEntrada") self.gridLayout_3.addWidget(self.btnEntrada, 0, 0, 1, 1) self.layoutDescuento = QtWidgets.QGroupBox(self.centralwidget) self.layoutDescuento.setGeometry(QtCore.QRect(510, 340, 491, 91)) font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) self.layoutDescuento.setFont(font) self.layoutDescuento.setObjectName("layoutDescuento") self.radioDescuento = QtWidgets.QRadioButton(self.layoutDescuento) self.radioDescuento.setGeometry(QtCore.QRect(20, 40, 221, 31)) self.radioDescuento.setObjectName("radioDescuento") Principal.setCentralWidget(self.centralwidget) self.retranslateUi(Principal) QtCore.QMetaObject.connectSlotsByName(Principal) def retranslateUi(self, Principal): _translate = QtCore.QCoreApplication.translate Principal.setWindowTitle(_translate("Principal", "Prinicipal")) self.labelPlaca.setText(_translate("Principal", "Placa:")) self.labelTotalPagar.setText(_translate("Principal", "0")) self.layoutGeneral.setTitle(_translate("Principal", "General")) self.label.setText(_translate("Principal", "Numero de Factura:")) self.label_2.setText(_translate("Principal", "Hora de llegada:")) self.label_3.setText(_translate("Principal", "Fecha de llegada:")) self.label_4.setText(_translate("Principal", "Hora de salida:")) self.label_5.setText(_translate("Principal", "Fecha de salida:")) self.label_6.setText(_translate("Principal", "Tiempo transcurrido:")) self.label_7.setText(_translate("Principal", "Valor cobro:")) self.comboTipo.setItemText(0, _translate("Principal", "Seleccionar...")) self.comboTipo.setItemText(1, _translate("Principal", "CARRO")) self.comboTipo.setItemText(2, _translate("Principal", "MOTO")) self.label_8.setText(_translate("Principal", "Tipo de tarifa:")) self.btnMensualidad.setText(_translate("Principal", "Mensualidades")) self.btnPagar.setText(_translate("Principal", "Pagar")) self.btnListarVehiculos.setText( _translate("Principal", "Reporte V. A.")) self.btnInventario.setText(_translate("Principal", "Inventario")) self.btnLimpiar.setText(_translate("Principal", "Limpiar")) self.btnCambiarPrecio.setText(_translate("Principal", "Cambiar Precio")) self.btnConsultar.setText(_translate("Principal", "Consultar")) self.btnSalir.setText(_translate("Principal", "Salir")) self.labelFecha.setText(_translate("Principal", "Aqui viene la fecha")) self.labelHora.setText(_translate("Principal", "Aqui viene la hora")) self.label_10.setText(_translate("Principal", "Fecha:")) self.label_13.setText(_translate("Principal", "Cajero:")) self.label_9.setText(_translate("Principal", "Hora:")) self.labelCajero.setText( _translate("Principal", "aqui viene el nombre del cajero")) self.btnSalida.setText(_translate("Principal", "SALIDA")) self.btnEntrada.setText(_translate("Principal", "ENTRADA")) self.layoutDescuento.setTitle(_translate("Principal", "Descuento")) self.radioDescuento.setText( _translate("Principal", "Aplicar descuento"))
class Ui_MainWindow(object): font: QFont def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1400, 728) MainWindow.setMaximumSize(QtCore.QSize(1400, 732)) MainWindow.setStyleSheet( "QLabel{\n" "font: 18pt \"Tahoma\";\n" "}\n" "\n" "QLineEdit,QComboBox, QDateEdit, QPushButton{\n" "font: 18px \"Tahoma\";\n" "border:1px solid black;\n" "border-radius: 5px;\n" "}\n" "\n" "#labelMenusalidad{\n" "font-size: 60px;\n" "}\n" "\n" "QPushButton:hover{\n" "background-color: #0c80c4;\n" "}\n" "\n" "#btnGuardar:hover{\n" "background-color: #2aff27;\n" "}\n" "\n" "#btnEliminar:hover{\n" "background-color: #ff0000;\n" "}\n" "\n" "QGroupBox{\n" "font: 13pt \"Tahoma\";\n" "border:1px solid black;\n" "border-radius: 5px\n" "}\n" "\n" "QTableWidget{\n" "font: 13pt \"Tahoma\";\n" "border:1px solid black;\n" "border-radius: 5px\n" "}\n" "") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget.setGeometry(QtCore.QRect(160, 10, 1181, 74)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.labelMenusalidad = QtWidgets.QLabel(self.gridLayoutWidget) self.labelMenusalidad.setAlignment(QtCore.Qt.AlignCenter) self.labelMenusalidad.setObjectName("labelMenusalidad") self.gridLayout.addWidget(self.labelMenusalidad, 0, 0, 1, 1) self.tableMensualidades = QtWidgets.QTableWidget(self.centralwidget) self.tableMensualidades.setGeometry(QtCore.QRect(160, 90, 1181, 241)) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.tableMensualidades.sizePolicy().hasHeightForWidth()) self.tableMensualidades.setSizePolicy(sizePolicy) self.tableMensualidades.setContextMenuPolicy( QtCore.Qt.CustomContextMenu) self.tableMensualidades.setSizeAdjustPolicy( QtWidgets.QAbstractScrollArea.AdjustToContents) self.tableMensualidades.setAutoScrollMargin(10) self.tableMensualidades.setEditTriggers( QtWidgets.QAbstractItemView.SelectedClicked) self.tableMensualidades.setProperty("showDropIndicator", False) self.tableMensualidades.setSelectionBehavior( QtWidgets.QAbstractItemView.SelectRows) self.tableMensualidades.setTextElideMode(QtCore.Qt.ElideRight) self.tableMensualidades.setVerticalScrollMode( QtWidgets.QAbstractItemView.ScrollPerItem) self.tableMensualidades.setCornerButtonEnabled(True) self.tableMensualidades.setObjectName("tableMensualidades") self.tableMensualidades.setColumnCount(8) self.tableMensualidades.setRowCount(0) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) item.setFont(font) self.tableMensualidades.setHorizontalHeaderItem(0, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) item.setFont(font) self.tableMensualidades.setHorizontalHeaderItem(1, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) item.setFont(font) self.tableMensualidades.setHorizontalHeaderItem(2, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) font.setStyleStrategy(QtGui.QFont.PreferDefault) item.setFont(font) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) item.setForeground(brush) self.tableMensualidades.setHorizontalHeaderItem(3, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) item.setFont(font) self.tableMensualidades.setHorizontalHeaderItem(4, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) item.setFont(font) self.tableMensualidades.setHorizontalHeaderItem(5, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) item.setFont(font) self.tableMensualidades.setHorizontalHeaderItem(6, item) item = QtWidgets.QTableWidgetItem() font = QtGui.QFont() font.setFamily("Tahoma") font.setPointSize(13) item.setFont(font) self.tableMensualidades.setHorizontalHeaderItem(7, item) self.tableMensualidades.horizontalHeader().setVisible(True) self.tableMensualidades.horizontalHeader().setCascadingSectionResizes( False) self.tableMensualidades.horizontalHeader().setDefaultSectionSize(146) self.tableMensualidades.horizontalHeader().setMinimumSectionSize(50) self.tableMensualidades.verticalHeader().setMinimumSectionSize(30) self.gridLayoutWidget_3 = QtWidgets.QWidget(self.centralwidget) self.gridLayoutWidget_3.setGeometry(QtCore.QRect(10, 100, 131, 211)) self.gridLayoutWidget_3.setObjectName("gridLayoutWidget_3") self.gridLayout_3 = QtWidgets.QGridLayout(self.gridLayoutWidget_3) self.gridLayout_3.setContentsMargins(0, 0, 0, 0) self.gridLayout_3.setObjectName("gridLayout_3") self.btnNuevo = QtWidgets.QPushButton(self.gridLayoutWidget_3) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("..\icons\icon-agregar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnNuevo.setIcon(icon) self.btnNuevo.setIconSize(QtCore.QSize(50, 50)) self.btnNuevo.setObjectName("btnNuevo") self.gridLayout_3.addWidget(self.btnNuevo, 0, 0, 1, 1) self.btnActualizar = QtWidgets.QPushButton(self.gridLayoutWidget_3) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap("..\icons\icon-modificar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnActualizar.setIcon(icon1) self.btnActualizar.setIconSize(QtCore.QSize(50, 50)) self.btnActualizar.setObjectName("btnActualizar") self.gridLayout_3.addWidget(self.btnActualizar, 1, 0, 1, 1) self.btnEliminar = QtWidgets.QPushButton(self.gridLayoutWidget_3) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap("..\icons\icon-eliminar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnEliminar.setIcon(icon2) self.btnEliminar.setIconSize(QtCore.QSize(50, 50)) self.btnEliminar.setObjectName("btnEliminar") self.gridLayout_3.addWidget(self.btnEliminar, 2, 0, 1, 1) self.grupoInformacion = QtWidgets.QGroupBox(self.centralwidget) self.grupoInformacion.setGeometry(QtCore.QRect(20, 350, 1321, 331)) self.grupoInformacion.setFlat(False) self.grupoInformacion.setCheckable(False) self.grupoInformacion.setObjectName("grupoInformacion") self.gridLayoutWidget_2 = QtWidgets.QWidget(self.grupoInformacion) self.gridLayoutWidget_2.setGeometry(QtCore.QRect(10, 30, 1301, 237)) self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2") self.gridLayout_2 = QtWidgets.QGridLayout(self.gridLayoutWidget_2) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setObjectName("gridLayout_2") self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget_2) self.label_3.setObjectName("label_3") self.gridLayout_2.addWidget(self.label_3, 0, 2, 1, 1) self.label_5 = QtWidgets.QLabel(self.gridLayoutWidget_2) self.label_5.setObjectName("label_5") self.gridLayout_2.addWidget(self.label_5, 1, 2, 1, 1) self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget_2) self.label_2.setObjectName("label_2") self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1) self.label_6 = QtWidgets.QLabel(self.gridLayoutWidget_2) self.label_6.setObjectName("label_6") self.gridLayout_2.addWidget(self.label_6, 2, 0, 1, 1) self.txtFechaEntrada = QtWidgets.QDateEdit(self.gridLayoutWidget_2) self.txtFechaEntrada.setAlignment(QtCore.Qt.AlignBottom | QtCore.Qt.AlignHCenter) self.txtFechaEntrada.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.txtFechaEntrada.setProperty("showGroupSeparator", False) self.txtFechaEntrada.setMinimumDate(QtCore.QDate(2017, 4, 1)) self.txtFechaEntrada.setCurrentSection( QtWidgets.QDateTimeEdit.DaySection) self.txtFechaEntrada.setCalendarPopup(True) self.txtFechaEntrada.setDate(QtCore.QDate(2017, 9, 6)) self.txtFechaEntrada.setObjectName("txtFechaEntrada") self.gridLayout_2.addWidget(self.txtFechaEntrada, 2, 1, 1, 1) self.txtFechaSalida = QtWidgets.QDateEdit(self.gridLayoutWidget_2) self.txtFechaSalida.setAlignment(QtCore.Qt.AlignCenter) self.txtFechaSalida.setAccelerated(False) self.txtFechaSalida.setMinimumDate(QtCore.QDate(2017, 4, 1)) self.txtFechaSalida.setCurrentSection( QtWidgets.QDateTimeEdit.MonthSection) self.txtFechaSalida.setCalendarPopup(True) self.txtFechaSalida.setCurrentSectionIndex(1) self.txtFechaSalida.setTimeSpec(QtCore.Qt.LocalTime) self.txtFechaSalida.setObjectName("txtFechaSalida") self.gridLayout_2.addWidget(self.txtFechaSalida, 2, 3, 1, 1) self.label_7 = QtWidgets.QLabel(self.gridLayoutWidget_2) self.label_7.setObjectName("label_7") self.gridLayout_2.addWidget(self.label_7, 2, 2, 1, 1) self.font = QFont() self.font.setCapitalization(QFont.AllUppercase) self.txtPropietario = QtWidgets.QLineEdit(self.gridLayoutWidget_2) self.txtPropietario.setMaxLength(50) self.txtPropietario.setObjectName("txtPropietario") self.txtPropietario.setFont(self.font) self.gridLayout_2.addWidget(self.txtPropietario, 1, 1, 1, 1) self.txtTelefono = QtWidgets.QLineEdit(self.gridLayoutWidget_2) self.txtTelefono.setMaxLength(15) self.txtTelefono.setObjectName("txtTelefono") self.txtTelefono.setFont(self.font) self.gridLayout_2.addWidget(self.txtTelefono, 1, 3, 1, 1) self.txtPlaca = QtWidgets.QLineEdit(self.gridLayoutWidget_2) self.txtPlaca.setMaxLength(7) self.txtPlaca.setObjectName("txtPlaca") self.txtPlaca.setFont(self.font) self.gridLayout_2.addWidget(self.txtPlaca, 0, 1, 1, 1) self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget_2) self.label_4.setObjectName("label_4") self.gridLayout_2.addWidget(self.label_4, 1, 0, 1, 1) self.comboTipo = QtWidgets.QComboBox(self.gridLayoutWidget_2) self.comboTipo.setObjectName("comboTipo") self.comboTipo.addItem("") self.comboTipo.addItem("") self.gridLayout_2.addWidget(self.comboTipo, 0, 3, 1, 1) self.btnGuardar = QtWidgets.QPushButton(self.grupoInformacion) self.btnGuardar.setGeometry(QtCore.QRect(510, 270, 151, 51)) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap("..\icons\icon-guardar.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnGuardar.setIcon(icon3) self.btnGuardar.setIconSize(QtCore.QSize(50, 50)) self.btnGuardar.setObjectName("btnGuardar") self.btnVolver = QtWidgets.QPushButton(self.centralwidget) self.btnVolver.setGeometry(QtCore.QRect(10, 12, 131, 71)) icon4 = QtGui.QIcon() icon4.addPixmap(QtGui.QPixmap("..\icons\icon-volver.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.btnVolver.setIcon(icon4) self.btnVolver.setIconSize(QtCore.QSize(50, 50)) self.btnVolver.setObjectName("btnVolver") MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) self.labelMenusalidad.setText(_translate("MainWindow", "MENSUALIDADES")) item = self.tableMensualidades.horizontalHeaderItem(0) item.setText(_translate("MainWindow", "Estado")) item = self.tableMensualidades.horizontalHeaderItem(1) item.setText(_translate("MainWindow", "Placa")) item = self.tableMensualidades.horizontalHeaderItem(2) item.setText(_translate("MainWindow", "Tipo")) item = self.tableMensualidades.horizontalHeaderItem(3) item.setText(_translate("MainWindow", "Propietario")) item = self.tableMensualidades.horizontalHeaderItem(4) item.setText(_translate("MainWindow", "Telefono")) item = self.tableMensualidades.horizontalHeaderItem(5) item.setText(_translate("MainWindow", "Valor")) item = self.tableMensualidades.horizontalHeaderItem(6) item.setText(_translate("MainWindow", "Fecha Entrada")) item = self.tableMensualidades.horizontalHeaderItem(7) item.setText(_translate("MainWindow", "Fecha Salida")) self.btnNuevo.setText(_translate("MainWindow", "Nuevo")) self.btnActualizar.setText(_translate("MainWindow", "Modificar")) self.btnEliminar.setText(_translate("MainWindow", "Eliminar")) self.grupoInformacion.setTitle(_translate("MainWindow", "Información")) self.label_3.setText(_translate("MainWindow", "Tipo :")) self.label_5.setText(_translate("MainWindow", "Telefono :")) self.label_2.setText(_translate("MainWindow", "Placa :")) self.label_6.setText(_translate("MainWindow", "Fecha Entrada :")) self.label_7.setText(_translate("MainWindow", "Fecha Salida :")) self.label_4.setText(_translate("MainWindow", "Propietario :")) self.comboTipo.setItemText(0, _translate("MainWindow", "CARRO_MENS")) self.comboTipo.setItemText(1, _translate("MainWindow", "MOTO_MENS")) self.btnGuardar.setText(_translate("MainWindow", "Guardar")) self.btnVolver.setText(_translate("MainWindow", "Volver"))
def read_css(css): if not HAS_TINYCSS2 or css is None: return try: with open(css, 'r') as f: sheet = tinycss2.parse_stylesheet(''.join(f.readlines())) except FileNotFoundError: return stylename = None node = { 'bgcolor': { 'normal': Qt.lightGray, 'selected': QColor() }, 'txtcolor': { 'normal': Qt.black, 'selected': QColor() }, 'border': { 'normal': { 'style': Qt.SolidLine, 'width': 1, 'color': 'black' }, 'selected': { 'style': Qt.SolidLine, 'width': 1, 'color': 'black' } }, 'font': { 'normal': { 'family': 'Arial', 'variant': QFont.MixedCase, 'size': 10, 'unit': 'pt', 'style': QFont.StyleNormal, 'weight': QFont.Normal }, 'selected': { 'family': 'Arial', 'variant': QFont.MixedCase, 'size': 10, 'unit': 'pt', 'style': QFont.StyleNormal, 'weight': QFont.Normal } } } edge = {'color': {'normal': Qt.darkGray, 'selected': Qt.red}} scene = {'color': Qt.white} for rule in sheet: if rule.type == 'comment' and stylename is None: try: stylename = rule.value.split('name: ')[1].strip() except IndexError: stylename = "" elif rule.type == 'qualified-rule': for name, state, prop, token in parse_rule(rule): if name == 'node': if token.type == 'ident': if prop == 'background-color': node['bgcolor'][state] = token.value elif prop == 'color': node['txtcolor'][state] = token.value elif prop == 'font-family': node['font'][state]['family'] = token.value elif prop == 'font-weight': weight = css_font_weight_to_qt(token.value) if weight is not None: node['font'][state]['weight'] = weight elif prop == 'font-style': style = CSS_FONT_STYLES_TO_QT.get(token.value) if style is not None: node['font'][state]['style'] = style elif prop == 'font-variant': variant = CSS_FONT_VARIANTS_TO_QT.get(token.value) node['font'][state]['variant'] = variant elif prop == 'font': style = CSS_FONT_STYLES_TO_QT.get(token.value) if style is not None: node['font'][state]['style'] = style else: variant = CSS_FONT_VARIANTS_TO_QT.get( token.value) if variant is not None: node['font'][state]['variant'] = variant else: weight = css_font_weight_to_qt(token.value) if weight is not None: node['font'][state]['weight'] = weight else: node['font'][state][ 'family'] = token.value elif prop == 'border-style': style = CSS_BORDER_STYLES_TO_QT.get(token.value) node['border'][state]['style'] = style elif prop == 'border-color': node['border'][state]['color'] = token.value elif prop == 'border': style = CSS_BORDER_STYLES_TO_QT.get(token.value) if style is not None: node['border'][state]['style'] = style else: node['border'][state]['color'] = token.value elif token.type == 'dimension': if prop in ('font', 'font-size'): node['font'][state]['size'] = token.value node['font'][state]['unit'] = token.unit elif prop in ('border', 'border-width'): node['border'][state]['width'] = token.value elif token.type == 'hash': if prop == 'background-color': node['bgcolor'][state] = token.serialize() elif prop == 'color': node['txtcolor'][state] = token.serialize() elif prop in ('border', 'border-color'): node['border'][state]['color'] = token.serialize() elif name == 'edge': if token.type == 'ident': if prop == 'background-color': edge['color'][state] = token.value elif token.type == 'hash': if prop == 'background-color': edge['color'][state] = token.serialize() elif name == 'scene': if token.type == 'ident': if prop == 'background-color': scene['color'] = token.value elif token.type == 'hash': if prop == 'background-color': scene['color'] = token.serialize() for state in ('normal', 'selected'): node['bgcolor'][state] = QBrush(QColor(node['bgcolor'][state])) node['txtcolor'][state] = QColor(node['txtcolor'][state]) node['border'][state] = QPen( QBrush(QColor(node['border'][state]['color'])), node['border'][state]['width'], node['border'][state]['style']) f = QFont(node['font'][state]['family']) if node['font'][state]['unit'] == 'px': f.setPixelSize(node['font'][state]['size']) else: f.setPointSize(node['font'][state]['size']) f.setCapitalization(node['font'][state]['variant']) f.setWeight(node['font'][state]['weight']) f.setStyle(node['font'][state]['style']) node['font'][state] = f edge['color'][state] = QPen(QColor(edge['color'][state])) scene['color'] = QColor(scene['color']) return stylename, node, edge, scene
class DPlayerUI(QWidget): def __init__(self): """Initializes core and ui""" super().__init__() self.playerCore = DPlayerCore() self.player = self.playerCore.player self.playlist = self.playerCore.playlist self.initUI() self.connectSignals() def initUI(self): """Initialize user interface - buttons, sliders, labels, playlist.""" self.grid = QGridLayout() self.initButtons() self.initVolumeSlider() self.initPositionSlider() self.initDurationLabel() self.initPlaylist() self.initSongLabel() self.setLayout(self.grid) self.setGeometry(0, 0, 700, 700) self.setWindowTitle('DPlayer') self.setWindowIcon(QIcon('icons/logo.png')) self.center() self.show() def connectSignals(self): """Connect player signals to functions.""" self.player.durationChanged.connect(self.durationChanged) self.player.positionChanged.connect(self.positionChanged) self.player.stateChanged.connect(self.stateChanged) self.player.currentMediaChanged.connect(self.songChanged) def initButtons(self): """Create, set and connect buttons.""" self.buttons = {} self.buttonNames = ['stop', 'previous', 'play', 'next', 'mute', 'addFiles', 'addFolder', 'shuffle', 'repeatPlaylist', 'repeatSong', 'Save playlist', 'Load playlist', 'Clear playlist', 'Find lyrics', 'Find info', 'Login', 'Logout', 'Love', 'Unlove'] shortcuts = ['q', 'w', 'e', 'r', 't', 'a', 's', 'd', 'f', 'g', 'z', 'x', 'c', 'v', 'b', 'o', 'p', 'k', 'l'] for name, cut in zip(self.buttonNames, shortcuts): button = QPushButton(self) button.setToolTip(name) button.setShortcut(QKeySequence(cut)) self.buttons[name] = button for name in self.buttonNames[:10]: self.buttons[name].setIcon(QIcon('icons/{}.png'.format(name))) self.buttons[name].setIconSize(QSize(20, 20)) for name, position in zip(self.buttonNames[:5], range(5)): self.grid.addWidget(self.buttons[name], 1, position) self.buttons['stop'].clicked.connect(self.stopClicked) self.buttons['previous'].clicked.connect(self.previousClicked) self.previousButtonClicked = False self.buttons['play'].clicked.connect(self.playClicked) self.buttons['play'].setFocus() self.buttons['next'].clicked.connect(self.nextClicked) self.buttons['mute'].clicked.connect(self.muteClicked) self.buttons['mute'].setIcon(QIcon('icons/volumeMiddle.png')) for name, position in zip(self.buttonNames[5:], range(5)): self.grid.addWidget(self.buttons[name], 3, position) self.buttons['addFiles'].clicked.connect(self.addFiles) self.buttons['addFolder'].clicked.connect(self.addFolder) self.buttons['shuffle'].clicked[bool].connect(self.playerCore.shuffle) self.buttons['shuffle'].setCheckable(True) self.buttons['repeatPlaylist'].clicked[bool].connect( self.playerCore.repeatPlaylist) self.buttons['repeatPlaylist'].setCheckable(True) self.buttons['repeatSong'].clicked[bool].connect( self.playerCore.repeatSong) self.buttons['repeatSong'].setCheckable(True) for name, position in zip(self.buttonNames[10:15], range(5)): self.buttons[name].setIcon(QIcon('icons/{}.png'.format(name))) self.buttons[name].setIconSize(QSize(120, 20)) self.grid.addWidget(self.buttons[name], 4, position) self.buttons['Save playlist'].clicked.connect(self.savePlaylist) self.buttons['Load playlist'].clicked.connect(self.loadPlaylist) self.buttons['Clear playlist'].clicked.connect(self.clearPlaylist) self.buttons['Find lyrics'].clicked.connect(self.findLyrics) self.buttons['Find info'].clicked.connect(self.findInfo) self.lastFMbuttons = QDialogButtonBox() self.lastFMbuttons.setOrientation(Qt.Vertical) for name, position in zip(self.buttonNames[15:], range(4)): self.buttons[name].setIcon(QIcon('icons/{}.png'.format(name))) self.buttons[name].setIconSize(QSize(120, 20)) self.lastFMbuttons.addButton(self.buttons[name], QDialogButtonBox.ActionRole) self.grid.addWidget(self.lastFMbuttons, 2, 4, Qt.AlignCenter) # self.userLabel = QLabel('Username:\n') # self.userLabel.setBuddy(self.buttons['Login']) # self.grid.addWidget( # self.userLabel, 2, 4, Qt.AlignTop | Qt.AlignHCenter) self.buttons['Login'].clicked.connect(self.login) self.buttons['Logout'].clicked.connect(self.logout) self.buttons['Love'].clicked.connect(self.love) self.buttons['Unlove'].clicked.connect(self.unlove) def previousClicked(self): """Play previous song.""" self.playerCore.songChanged = True self.previousButtonClicked = True self.playerCore.previous() self.stateChanged() def stopClicked(self): """Stop the player. Set icon to play button.""" self.playerCore.stop() self.buttons['play'].setIcon(QIcon('icons/play.png')) self.buttons['play'].setToolTip('play') self.songLabel.setText('') def playClicked(self): """Play / Pause the player. Set icon to play button.""" if self.player.state() in (QMediaPlayer.StoppedState, QMediaPlayer.PausedState): self.playerCore.play() if self.player.state() == QMediaPlayer.PlayingState: self.buttons['play'].setIcon(QIcon('icons/pause.png')) self.buttons['play'].setToolTip('pause') else: # QMediaPlayer.PlayingState self.playerCore.pause() self.buttons['play'].setIcon(QIcon('icons/play.png')) self.buttons['play'].setToolTip('play') self.songLabel.setText('{} - {}'.format( self.playlistTable.item(self.currentPlaying, 0).text(), self.playlistTable.item(self.currentPlaying, 1).text())) def nextClicked(self): """Play next song.""" self.playerCore.next() self.stateChanged() def muteClicked(self): """Mute / Unmute the player. Set volume slider position.""" if self.playerCore.isMuted(): self.playerCore.unmute() self.volumeChanged(self.currentVolume) else: self.playerCore.mute() self.volumeChanged(0) def addFiles(self): """Choose files (*.mp3) to add to the playlist.""" fileNames, _ = QFileDialog.getOpenFileNames( self, 'Add songs', filter='Music (*.mp3 *.ogg *.flac *wav)') self.playerCore.add(fileNames) self.addClicked(fileNames) def addFolder(self): """Choose folder to add to the playlist.""" directory = QFileDialog.getExistingDirectory(self, 'Add a folder') self.getFromDir(directory) def getFromDir(self, directory): """Extract files from directory and add them to the playlist.""" if not directory: return dirContent = os.listdir(directory) fileNames = [] for file in dirContent: path = '{}/{}'.format(directory, file) if os.path.isfile(path) and \ path[len(path) - 4:] in ['.mp3', '.ogg', 'flac', '.wav']: fileNames.append(path) elif os.path.isdir(path): self.getFromDir(path) self.playerCore.add(fileNames) self.addClicked(fileNames) def addClicked(self, fileNames): """Fill the playlist with fileNames' info.""" if fileNames is None: return self.playlistTable.setSortingEnabled(False) songsToAdd = len(fileNames) for name, row in zip(fileNames, range(songsToAdd)): currentRow = row + self.playlist.mediaCount() - songsToAdd self.playlistTable.insertRow(currentRow) artist = self.playerCore.getArtist(name)[0] title = self.playerCore.getTitle(name)[0] album = self.playerCore.getAlbum(name)[0] seconds = self.playerCore.getDuration(name) duration = QTime(0, seconds // 60, seconds % 60) duration = duration.toString('mm:ss') rowInfo = [artist, title, album, duration] for info, index in zip(rowInfo, range(4)): cell = QTableWidgetItem(info) self.playlistTable.setItem(currentRow, index, cell) font = QFont(info, weight=QFont.Normal) cell.setFont(font) cell.setTextAlignment(Qt.AlignCenter) self.playlistTable.setSortingEnabled(True) for index in range(4): self.playlistTable.resizeColumnToContents(index) def initVolumeSlider(self): """Initialize volume slider.""" self.volumeSlider = QSlider(Qt.Vertical, self) self.volumeSlider.setRange(0, 100) self.currentVolume = 70 self.volumeSlider.setValue(self.currentVolume) self.volumeSlider.setToolTip('volume: {}'.format(self.currentVolume)) self.volumeSlider.valueChanged[int].connect(self.volumeChanged) self.grid.addWidget(self.volumeSlider, 0, 4, Qt.AlignHCenter) self.playerCore.setVolume(self.currentVolume) def volumeChanged(self, value): """Set player's volume to value. Set icon for sound.""" self.playerCore.setVolume(value) if value == 0: self.buttons['mute'].setIcon(QIcon('icons/mute.png')) elif value <= 35: self.buttons['mute'].setIcon(QIcon('icons/volumeMin.png')) elif value <= 70: self.buttons['mute'].setIcon(QIcon('icons/volumeMiddle.png')) else: # value <= 100 self.buttons['mute'].setIcon(QIcon('icons/volumeMax.png')) self.volumeSlider.setValue(value) self.volumeSlider.setToolTip('volume: {}'.format(value)) if self.playerCore.isMuted(): self.buttons['mute'].setToolTip('unmute') else: self.currentVolume = value self.buttons['mute'].setToolTip('mute') def initPositionSlider(self): """Initialize position slider.""" self.positionSlider = QSlider(Qt.Horizontal, self) self.positionSlider.setValue(0) self.positionSlider.valueChanged[int].connect(self.position) self.positionSliderClicked = False self.grid.addWidget(self.positionSlider, 0, 0, 1, 3, Qt.AlignBottom) def initDurationLabel(self): """Initialize duration label.""" self.durationLabel = QLabel('00:00 / 00:00') self.grid.addWidget(self.durationLabel, 0, 3, Qt.AlignBottom) def durationChanged(self, value): """Set the maximum of position slider to value when song is changed.""" self.positionSlider.setMaximum(value) def songChanged(self, _): """Handle UI when song changes.""" if self.doubleClicked or self.playlist.mediaCount() == 0: self.doubleClicked = False return self.lastPlayed = self.currentPlaying self.currentPlaying = self.playlist.currentIndex() if self.currentPlaying >= 0: self.setStyle(self.currentPlaying, QFont.Bold) self.songLabel.setText('{} - {}'.format( self.playlistTable.item(self.currentPlaying, 0).text(), self.playlistTable.item(self.currentPlaying, 1).text())) self.playlistTable.scrollToItem( self.playlistTable.item(self.currentPlaying, 0)) if self.lastPlayed >= 0 and self.lastPlayed != self.currentPlaying: self.setStyle(self.lastPlayed, QFont.Normal) for index in range(4): self.playlistTable.resizeColumnToContents(index) self.previousButtonClicked = False def setStyle(self, row, style): """Set row's font to style.""" for idx in range(4): text = self.playlistTable.item(row, idx).text() font = QFont(text, weight=style) self.playlistTable.item(row, idx).setFont(font) def position(self, value): """Set the position of player at value.""" if not self.positionSliderClicked: self.positionSliderClicked = True self.player.setPosition(value) def positionChanged(self, value): """Update duration label according to value.""" if not self.positionSliderClicked: self.positionSliderClicked = True self.positionSlider.setValue(value) self.positionSliderClicked = False songIndex = self.playlist.currentIndex() if songIndex >= 0: duration = self.playlistTable.item( self.playlist.currentIndex(), 3).text() currentSeconds = value // 1000 currentTime = QTime(0, currentSeconds // 60, currentSeconds % 60) time = '{} / {}'.format( currentTime.toString('mm:ss'), duration) else: time = '00:00 / 00:00' self.durationLabel.setText(time) def stateChanged(self): """Check if stopped to update UI.""" if self.player.state() == QMediaPlayer.StoppedState: self.stopClicked() def initSongLabel(self): """Initialize song label.""" self.songLabel = QLabel() self.songLabel.setAlignment(Qt.AlignCenter) self.font = QFont() self.font.setBold(True) self.font.setItalic(True) self.font.setCapitalization(QFont.AllUppercase) self.font.setPixelSize(20) self.songLabel.setFont(self.font) self.grid.addWidget(self.songLabel, 0, 0, 1, 4, Qt.AlignVCenter) def initPlaylist(self): """Initialize song playlist.""" self.playlistTable = QTableWidget() self.playlistTable.setSelectionBehavior(QAbstractItemView.SelectRows) self.playlistTable.setSelectionMode( QAbstractItemView.ExtendedSelection) self.playlistTable.setSortingEnabled(True) self.playlistTable.setTabKeyNavigation(False) self.playlistTable.setEditTriggers(QAbstractItemView.NoEditTriggers) self.playlistTable.setAlternatingRowColors(True) self.playlistTable.setVerticalScrollMode( QAbstractItemView.ScrollPerPixel) self.playlistTable.setHorizontalScrollMode( QAbstractItemView.ScrollPerPixel) self.playlistTable.itemDoubleClicked.connect(self.doubleClicked) self.doubleClicked = False self.lastPlayed = -1 self.currentPlaying = -1 delete = QShortcut( QKeySequence.Delete, self.playlistTable, self.deleteSongs) delete.setContext(Qt.WidgetShortcut) self.playlistTable.setColumnCount(4) self.playlistTable.setHorizontalHeaderLabels( ['Artist', 'Title', 'Album', 'Duration']) # False - ascending order, True - descending self.descendingOrder = [False] * 4 self.playlistTable.horizontalHeader().sectionClicked.connect( self.toSort) self.windows = [] names = [] for index in range(self.playlist.mediaCount()): names.append(self.playlist.media(index).canonicalUrl().path()) self.addClicked(names) self.grid.addWidget(self.playlistTable, 2, 0, 1, 4) self.grid.setRowStretch(2, 1) def doubleClicked(self, item): """Play song at item's row.""" self.doubleClicked = True self.lastPlayed = self.playlist.currentIndex() if self.lastPlayed >= 0: self.setStyle(self.lastPlayed, QFont.Normal) self.currentPlaying = item.row() self.playerCore.songChanged = True self.playlist.setCurrentIndex(self.currentPlaying) self.setStyle(self.currentPlaying, QFont.Bold) self.stopClicked() self.playClicked() self.songLabel.setText('{} - {}'.format( self.playlistTable.item(self.currentPlaying, 0).text(), self.playlistTable.item(self.currentPlaying, 1).text())) for index in range(4): self.playlistTable.resizeColumnToContents(index) def toSort(self, column): """Sort music by column.""" if self.lastPlayed >= 0: self.setStyle(self.lastPlayed, QFont.Normal) self.playerCore.sort(column, self.descendingOrder[column]) self.descendingOrder[column] = bool(1 - self.descendingOrder[column]) for index in range(4): if index != column: self.descendingOrder[index] = False def deleteSongs(self): """Delete selected songs.""" selectedSongs = self.playlistTable.selectedIndexes() indexes = [index.row() for index in selectedSongs] toBeRemoved = sorted(indexes[::4], reverse=True) currentIndex = self.playlist.currentIndex() if currentIndex >= 0: self.setStyle(currentIndex, QFont.Normal) self.playerCore.remove(toBeRemoved) for index in toBeRemoved: self.playlistTable.removeRow(index) if self.playlistTable.rowCount() == 0: return currentIndex = self.playlist.currentIndex() if currentIndex >= 0: self.setStyle(self.playlist.currentIndex(), QFont.Bold) self.songLabel.setText('{} - {}'.format( self.playlistTable.item(self.currentPlaying, 0).text(), self.playlistTable.item(self.currentPlaying, 1).text())) for index in range(4): self.playlistTable.resizeColumnToContents(index) def savePlaylist(self): """Save playlist.""" url, _ = QFileDialog.getSaveFileUrl(self, 'Save playlist') self.playerCore.savePlaylist(url) def loadPlaylist(self): """Load playlist.""" url, _ = QFileDialog.getOpenFileUrl( self, 'Load playlist', filter='Playlists (*.m3u)') count = self.playlist.mediaCount() self.playerCore.loadPlaylist(url) names = [] for index in range(count, self.playlist.mediaCount()): names.append(self.playlist.media(index).canonicalUrl().path()) self.addClicked(names) def clearPlaylist(self): """Remove all music from playlist.""" self.playlistTable.setRowCount(0) self.playerCore.clearPlaylist() def closeEvent(self, event): """Saves current playlist and quits.""" self.playerCore.savePlaylist(QUrl( 'file://{}/lastListened.m3u'.format(os.getcwd()))) event.accept() def findLyrics(self): """Finds and shows lyrics for selected song(s).""" songs = self.playlistTable.selectedIndexes()[::4] if not songs: return for index in songs: name = '{} - {}'.format(self.playerCore.musicOrder[index.row()][1], self.playerCore.musicOrder[index.row()][2]) lyrics = 'Lyrics:\n\n{}'.format( self.playerCore.findLyrics(index.row())) self.windows.append(Window(name, lyrics)) for window in self.windows: if window.isClosed: self.windows.remove(window) def findInfo(self): """Opens window with info for selected album at the table.""" albums = self.playlistTable.selectedIndexes()[::4] if not albums: return for index in albums: info = self.playerCore.findInfo(index.row()) text = '\n'.join(info) self.windows.append(Window('Info', text)) def login(self): """Opens window for user to log in lastFM.""" self.loginWindow = LoginDialog(self.playerCore) def logout(self): """Logs out current user""" if self.playerCore.network is None: return self.logoutWindow = Window('Logout', 'GoodBye, {}!'.format( self.playerCore.username)) self.playerCore.logout() def love(self): """Loves selected songs in lastFM.""" if self.playerCore.network is None: self.errorWindow = Window('Error', 'You shoud login first.') return songs = self.playlistTable.selectedIndexes()[::4] if not songs: return loved = [] for index in songs: loved.append(self.playerCore.loveTrack(index.row())) if all(loved): self.successWindow = Window('Success', 'Songs loved!') else: self.errorWindow = Window( 'Error', 'Something went wrong! Try again later.') def unlove(self): """Unloves selected songs in lastFM.""" if self.playerCore.network is None: self.errorWindow = Window('Error', 'You shoud login first.') return songs = self.playlistTable.selectedIndexes()[::4] if not songs: return for index in songs: self.playerCore.unloveTrack(index.row()) def center(self): """Position player application at the center of the screen.""" # rectangle specifying the geometry of the widget rectangle = self.frameGeometry() # screen resolution -> center point centerPoint = QDesktopWidget().availableGeometry().center() # set the center of the rectangle to the center of the screen rectangle.moveCenter(centerPoint) # move the top-left point of the application window to the top-left # point of the rectangle self.move(rectangle.topLeft())
def __init__(self, parent, path=""): #super().__init__() super(TextEdit, self).__init__(parent) self.parent = parent self.path = path font = QFont("Monospace", 8) #QFont() #font.setFamily("Monospace") font.setStyleHint(QFont.Monospace) font.setStyle(QFont.StyleNormal) font.setStyleStrategy(QFont.PreferDefault) font.setWeight(QFont.ExtraLight) font.setCapitalization(QFont.MixedCase) font.setHintingPreference(QFont.PreferDefaultHinting) font.setLetterSpacing(QFont.PercentageSpacing, 100.0) font.setStretch(QFont.AnyStretch) font.setBold(False) font.setFixedPitch(True) font.setItalic(False) font.setKerning(True) font.setOverline(False) # sobrelinea #font.setPixelSize(8) #font.setPointSize(8) font.setPointSizeF(8) font.setStrikeOut(False) # tachado #font.setStyleName() font.setUnderline(False) #font.setWordSpacing(1) print(font.toString()) charFormat = QTextCharFormat() charFormat.setFont(font) #self.setTabStopWidth(4) self.setCursorWidth(5) self.setCurrentCharFormat(charFormat) #print(self.document().defaultTextOption()) #FIXME: Usaremos qss pal = QPalette() bgc = QColor(39, 40, 34) pal.setColor(QPalette.Base, bgc) textc = QColor(255, 255, 255) pal.setColor(QPalette.Text, textc) self.setPalette(pal) self.setLineWrapMode(QPlainTextEdit.NoWrap) #self.setTextBackgroundColor(QColor(0, 255, 255)) #self.setTextColor(QColor(0, 255, 255)) #self.setFontWeight(QFont.Normal) #cursor = self.textCursor() #cursor.movePosition(QTextCursor.End) #self.setDocumentTitle("Coso") #self.syntaxHighlighter = PythonHighlighter(self.document()) # Señales #self.blockCountChanged.connect(self.__newBlock) #self.cursorPositionChanged.connect() #self.selectionChanged.connect(self.__changedSelection) #self.textChanged.connect(self.__changedText) #self.updateRequest.connect((const QRect &rect, int dy) #self.modificationChanged.connect(self.__chanedModification) #self.copyAvailable.connect(self.__copyAvailable) #self.undoAvailable.connect(self.__undoAvailable) #self.redoAvailable.connect(self.__redoAvailable) if os.path.exists(self.path): file = open(self.path, 'r') data = file.read() texto = self.__limpiar_codigo(data) self.setPlainText(texto) self.document().setModified(data != texto) if data != texto: print("El texto fue corregido al abrir el archivo.") else: self.setPlainText( "#!/usr/bin/python3\n# -*- coding: utf-8 -*-\n\n") self.document().setModified(True) self.setFocus()
def load(self, path: str, is_first_call: bool = True) -> None: if path == self._path: return theme_full_path = os.path.join(path, "theme.json") Logger.log( "d", "Loading theme file: {theme_full_path}".format( theme_full_path=theme_full_path)) try: with open(theme_full_path, encoding="utf-8") as f: data = json.load(f) except EnvironmentError as e: Logger.error( "Unable to load theme file at {theme_full_path}: {err}".format( theme_full_path=theme_full_path, err=e)) return except UnicodeDecodeError: Logger.error( "Theme file at {theme_full_path} is corrupt (invalid UTF-8 bytes)." .format(theme_full_path=theme_full_path)) return except json.JSONDecodeError: Logger.error( "Theme file at {theme_full_path} is corrupt (invalid JSON syntax)." .format(theme_full_path=theme_full_path)) return # Iteratively load inherited themes try: theme_id = data["metadata"]["inherits"] self.load(Resources.getPath(Resources.Themes, theme_id), is_first_call=False) except FileNotFoundError: Logger.log("e", "Could not find inherited theme %s", theme_id) except KeyError: pass # No metadata or no inherits keyword in the theme.json file if "colors" in data: for name, value in data["colors"].items(): if not is_first_call and isinstance(value, str): # Keep parent theme string colors as strings and parse later self._colors[name] = value continue if isinstance(value, str) and is_first_call: # value is reference to base_colors color name try: color = data["base_colors"][value] except IndexError: Logger.log( "w", "Colour {value} could not be found in base_colors". format(value=value)) continue else: color = value try: c = QColor(color[0], color[1], color[2], color[3]) except IndexError: # Color doesn't have enough components. Logger.log( "w", "Colour {name} doesn't have enough components. Need to have 4, but had {num_components}." .format(name=name, num_components=len(color))) continue # Skip this one then. self._colors[name] = c if "base_colors" in data: for name, color in data["base_colors"].items(): try: c = QColor(color[0], color[1], color[2], color[3]) except IndexError: # Color doesn't have enough components. Logger.log( "w", "Colour {name} doesn't have enough components. Need to have 4, but had {num_components}." .format(name=name, num_components=len(color))) continue # Skip this one then. self._colors[name] = c if is_first_call and self._colors: #Convert all string value colors to their referenced color for name, color in self._colors.items(): if isinstance(color, str): try: c = self._colors[color] self._colors[name] = c except: Logger.log( "w", "Colour {name} {color} does".format(name=name, color=color)) fonts_dir = os.path.join(path, "fonts") if os.path.isdir(fonts_dir): for root, dirnames, filenames in os.walk(fonts_dir): for filename in filenames: if filename.lower().endswith(".ttf"): QFontDatabase.addApplicationFont( os.path.join(root, filename)) if "fonts" in data: system_font_size = QCoreApplication.instance().font().pointSize() for name, font in data["fonts"].items(): q_font = QFont() q_font.setFamily( font.get("family", QCoreApplication.instance().font().family())) if font.get("bold"): q_font.setBold(font.get("bold", False)) else: q_font.setWeight(font.get("weight", 50)) q_font.setLetterSpacing(QFont.AbsoluteSpacing, font.get("letterSpacing", 0)) q_font.setItalic(font.get("italic", False)) q_font.setPointSize(int( font.get("size", 1) * system_font_size)) q_font.setCapitalization(QFont.AllUppercase if font.get( "capitalize", False) else QFont.MixedCase) self._fonts[name] = q_font if "sizes" in data: for name, size in data["sizes"].items(): s = QSizeF() s.setWidth(round(size[0] * self._em_width)) s.setHeight(round(size[1] * self._em_height)) self._sizes[name] = s iconsdir = os.path.join(path, "icons") if os.path.isdir(iconsdir): try: for base_path, _, icons in os.walk(iconsdir): detail_level = base_path.split(os.sep)[-1] if detail_level not in self._icons: self._icons[detail_level] = {} for icon in icons: name = os.path.splitext(icon)[0] self._icons[detail_level][name] = QUrl.fromLocalFile( os.path.join(base_path, icon)) except EnvironmentError: # Exception when calling os.walk, e.g. no access rights. pass # Won't get any icons then. Images will show as black squares. deprecated_icons_file = os.path.join(iconsdir, "deprecated_icons.json") if os.path.isfile(deprecated_icons_file): try: with open(deprecated_icons_file, encoding="utf-8") as f: data = json.load(f) for icon in data: self._deprecated_icons[icon] = data[icon] except (UnicodeDecodeError, json.decoder.JSONDecodeError, EnvironmentError): Logger.logException( "w", "Could not parse deprecated icons list %s", deprecated_icons_file) imagesdir = os.path.join(path, "images") if os.path.isdir(imagesdir): for image in os.listdir(imagesdir): name = os.path.splitext(image)[0] self._images[name] = QUrl.fromLocalFile( os.path.join(imagesdir, image)) Logger.log("d", "Loaded theme %s", path) Logger.info(f"System's em size is {self._em_height}px.") self._path = path # only emit the theme loaded signal once after all the themes in the inheritance chain have been loaded if is_first_call: self.themeLoaded.emit()
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.setWindowTitle("Materialen afroepen") self.setWindowIcon(QIcon('./images/logos/logo.jpg')) self.setFont(QFont('Arial', 10)) self.Werkorder = QLabel() zkwerknEdit = QLineEdit(str(koppelnr)) zkwerknEdit.setFixedWidth(100) zkwerknEdit.setFont(QFont("Arial",10)) zkwerknEdit.setDisabled(True) self.Artikelnummer = QLabel() artEdit = QLineEdit(str(martnr)) artEdit.setFixedWidth(100) artEdit.setFont(QFont("Arial",10)) artEdit.setDisabled(True) self.Hoeveelheid = QLabel() hoevEdit = QLineEdit() hoevEdit.setFixedWidth(80) hoevEdit.setFont(QFont("Arial",10)) hoevEdit.textChanged.connect(self.hoevChanged) reg_ex = QRegExp("^[-]{0,1}[0-9]{0,10}[.]{0,1}[0-9]{0,4}$") input_validator = QRegExpValidator(reg_ex, hoevEdit) hoevEdit.setValidator(input_validator) self.Postcode = QLabel() pcEdit = QLineEdit() pcEdit.setFixedWidth(80) font = QFont("Arial",10) font.setCapitalization(QFont.AllUppercase) pcEdit.setFont(font) pcEdit.textChanged.connect(self.pcChanged) reg_ex = QRegExp("^[0-9]{4}[A-Za-z]{2}$") input_validator = QRegExpValidator(reg_ex, pcEdit) pcEdit.setValidator(input_validator) self.Huisnummer = QLabel() hnoEdit = QLineEdit() hnoEdit.setFixedWidth(60) hnoEdit.setFont(QFont("Arial",10)) hnoEdit.textChanged.connect(self.hnoChanged) reg_ex = QRegExp("^[0-9]{1,5}$") input_validator = QRegExpValidator(reg_ex, hnoEdit) hnoEdit.setValidator(input_validator) self.Toevoeging = QLabel() toevEdit = QLineEdit() toevEdit.setFixedWidth(50) toevEdit.setFont(QFont("Arial",10)) toevEdit.textChanged.connect(self.toevChanged) reg_ex = QRegExp("^.{0,20}$") input_validator = QRegExpValidator(reg_ex, toevEdit) toevEdit.setValidator(input_validator) self.Alternatief = QLabel() altEdit = QLineEdit() altEdit.setFixedWidth(280) altEdit.setFont(QFont("Arial",10)) altEdit.textChanged.connect(self.altChanged) reg_ex = QRegExp("^.{0,30}$") input_validator = QRegExpValidator(reg_ex, altEdit) altEdit.setValidator(input_validator) grid = QGridLayout() grid.setSpacing(20) lbl = QLabel() pixmap = QPixmap('./images/logos/verbinding.jpg') lbl.setPixmap(pixmap) grid.addWidget(lbl ,0, 0) lbl4 = QLabel('Afroepen materialen samenstellen') lbl4.setStyleSheet("font: 12pt Comic Sans MS") grid.addWidget(lbl4, 0, 1) logo = QLabel() pixmap = QPixmap('./images/logos/logo.jpg') logo.setPixmap(pixmap) grid.addWidget(logo , 0, 2, 1, 1, Qt.AlignRight) grid.addWidget(QLabel('\u00A9 2017 all rights reserved [email protected]'), 9, 0, 1, 3, Qt.AlignCenter) lbl1 = QLabel('Werknummer') lbl1.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl1, 1, 0) grid.addWidget(zkwerknEdit, 1, 1) lbl2 = QLabel('Artikelnummer') lbl2.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl2, 2, 0) grid.addWidget(artEdit, 2, 1) lbl3 = QLabel('Afroep') lbl3.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl3, 3, 0) grid.addWidget(hoevEdit, 3 ,1) cBox = QCheckBox('Meerwerk') cBox.stateChanged.connect(self.cBoxChanged) grid.addWidget(cBox, 3, 2) lbl8 = QLabel('Afleveradres') lbl8.setStyleSheet("font: 12pt Comic Sans MS") grid.addWidget(lbl8, 4, 1) lbl4 = QLabel('Postcode') lbl4.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl4, 5, 0) grid.addWidget(pcEdit, 5 , 1) lbl5 = QLabel('Huisnummer') lbl5.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl5, 6, 0) grid.addWidget(hnoEdit, 6 , 1) lbl6 = QLabel('Toevoeging') grid.addWidget(lbl6, 6, 0, 1, 2, Qt.AlignRight) grid.addWidget(toevEdit, 6, 2) lbl7 = QLabel('Alternatief adres') lbl7.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl7, 7, 0) grid.addWidget(altEdit, 7 , 1, 1, 3) self.setLayout(grid) self.setGeometry(500, 300, 150, 150) applyBtn = QPushButton('Muteren') applyBtn.setStyleSheet("color: black; background-color: gainsboro") applyBtn.clicked.connect(self.accept) grid.addWidget(applyBtn, 8, 2, 1 , 1, Qt.AlignRight) applyBtn.setFont(QFont("Arial",10)) applyBtn.setFixedWidth(100) sluitBtn = QPushButton('Sluiten') sluitBtn.setStyleSheet("color: black; background-color: gainsboro") sluitBtn.clicked.connect(self.close) grid.addWidget(sluitBtn, 8, 0, 1, 3, Qt.AlignCenter) sluitBtn.setFont(QFont("Arial",10)) sluitBtn.setFixedWidth(100) opvrBtn = QPushButton('Raaplijst') opvrBtn.setStyleSheet("color: black; background-color: gainsboro") opvrBtn.clicked.connect(lambda: raapLijst(koppelnr)) grid.addWidget(opvrBtn, 8, 1, 1, 1, Qt.AlignRight) opvrBtn.setFont(QFont("Arial",10)) opvrBtn.setFixedWidth(100)
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.setWindowTitle("Invoer account") self.setWindowIcon(QIcon('./images/logos/logo.jpg')) self.setFont(QFont('Arial', 10)) self.Aanhef = QLabel() q2Edit = QComboBox() q2Edit.setFixedWidth(80) q2Edit.setFont(QFont("Arial",10)) q2Edit.setStyleSheet("color: black; background-color: gainsboro") q2Edit.addItem(' ') q2Edit.addItem('Dhr. ') q2Edit.addItem('Mevr. ') q2Edit.activated[str].connect(self.q2Changed) self.Voornaam = QLabel() q3Edit = QLineEdit() q3Edit.setFixedWidth(200) q3Edit.setFont(QFont("Arial",10)) q3Edit.textChanged.connect(self.q3Changed) reg_ex = QRegExp("^.{1,30}$") input_validator = QRegExpValidator(reg_ex, q3Edit) q3Edit.setValidator(input_validator) self.Tussenvoegsel = QLabel() q4Edit = QLineEdit() q4Edit.setFixedWidth(80) q4Edit.setFont(QFont("Arial",10)) q4Edit.textChanged.connect(self.q4Changed) reg_ex = QRegExp("^.{1,10}$") input_validator = QRegExpValidator(reg_ex, q3Edit) q4Edit.setValidator(input_validator) self.Achternaam = QLabel() q5Edit = QLineEdit() q5Edit.setFixedWidth(540) q5Edit.setFont(QFont("Arial",10)) q5Edit.textChanged.connect(self.q5Changed) reg_ex = QRegExp("^.{1,50}$") input_validator = QRegExpValidator(reg_ex, q5Edit) q5Edit.setValidator(input_validator) self.Postcode = QLabel() q6Edit = QLineEdit() q6Edit.setFixedWidth(80) font = QFont("Arial",10) font.setCapitalization(QFont.AllUppercase) q6Edit.setFont(font) q6Edit.textChanged.connect(self.q6Changed) reg_ex = QRegExp("^[0-9]{4}[A-Za-z]{2}$") input_validator = QRegExpValidator(reg_ex, q6Edit) q6Edit.setValidator(input_validator) self.Huisnummer = QLabel() q7Edit = QLineEdit() q7Edit.setFixedWidth(60) q7Edit.setFont(QFont("Arial",10)) q7Edit.textChanged.connect(self.q7Changed) reg_ex = QRegExp("^[0-9]{1,5}$") input_validator = QRegExpValidator(reg_ex, q7Edit) q7Edit.setValidator(input_validator) self.Toevoeging = QLabel() q8Edit = QLineEdit() q8Edit.setFixedWidth(80) q8Edit.setFont(QFont("Arial",10)) q8Edit.textChanged.connect(self.q8Changed) reg_ex = QRegExp("^[A-Za-z0-9-]{0,8}") input_validator = QRegExpValidator(reg_ex, q8Edit) q8Edit.setValidator(input_validator) self.email = QLabel() q9Edit = QLineEdit() q9Edit.setFixedWidth(300) q9Edit.setFont(QFont("Arial",10)) q9Edit.textChanged.connect(self.q9Changed) reg_ex = QRegExp("^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$") input_validator = QRegExpValidator(reg_ex, q9Edit) q9Edit.setValidator(input_validator) self.Wachtwoord = QLabel() q10Edit = QLineEdit() q10Edit.setFixedWidth(300) q10Edit.setFont(QFont("Arial",10)) q10Edit.setEchoMode(QLineEdit.Password) q10Edit.textChanged.connect(self.q10Changed) self.ContrWachtwoord = QLabel() q11Edit = QLineEdit() q11Edit.setFixedWidth(300) q11Edit.setFont(QFont("Arial",10)) q11Edit.setEchoMode(QLineEdit.Password) q11Edit.textChanged.connect(self.q11Changed) self.Telefoonnr = QLabel() q12Edit = QLineEdit() q12Edit.setFixedWidth(100) q12Edit.setFont(QFont("Arial",10)) q12Edit.textChanged.connect(self.q12Changed) reg_ex = QRegExp("^[0]{1}[0-9]{9}$") input_validator = QRegExpValidator(reg_ex, q12Edit) q12Edit.setValidator(input_validator) self.Accountnummer = QLabel() q13Edit = QLineEdit(str(bepaalAccountnr())) q13Edit.setFixedWidth(100) q13Edit.setDisabled(True) q13Edit.setStyleSheet("QLineEdit { background-color: ; color: black }") q13Edit.setFont(QFont("Arial",10)) q13Edit.textChanged.connect(self.q13Changed) self.Geboortedatum = QLabel() q14Edit = QLineEdit() q14Edit.setFixedWidth(100) q14Edit.setFont(QFont("Arial",10)) q14Edit.textChanged.connect(self.q14Changed) reg_ex = QRegExp('^[1-2]{1}[09]{1}[0-9]{2}-[0-1]{1}[0-9]{1}-[0-3]{1}[0-9]{1}$') input_validator = QRegExpValidator(reg_ex, q14Edit) q14Edit.setValidator(input_validator) grid = QGridLayout() grid.setSpacing(20) lbl = QLabel() pixmap = QPixmap('./images/logos/verbinding.jpg') lbl.setPixmap(pixmap) grid.addWidget(lbl , 1, 0) logo = QLabel() pixmap = QPixmap('./images/logos/logo.jpg') logo.setPixmap(pixmap) grid.addWidget(logo , 1, 2, 1, 1, Qt.AlignRight) self.setFont(QFont('Arial', 10)) grid.addWidget(QLabel('Nieuw account invoeren'), 1, 1) grid.addWidget(QLabel(' *'), 2, 0) grid.addWidget(QLabel('Verplichte velden'), 2, 1) grid.addWidget(QLabel('Aanhef'), 3, 0) grid.addWidget(q2Edit, 3, 1) grid.addWidget(QLabel('Voornaam *'), 4, 0) grid.addWidget(q3Edit, 4, 1) grid.addWidget(QLabel('Tussenvoegel'), 5, 0) grid.addWidget(q4Edit, 5 , 1) grid.addWidget(QLabel('Achternaam *'), 6, 0) grid.addWidget(q5Edit, 6, 1, 1 , 2) grid.addWidget(QLabel('Geboortedatum *'), 7, 0) grid.addWidget(QLabel(' formaat: jjjj-mm-dd'), 7, 1, 1, 2 ) grid.addWidget(q14Edit, 7, 1) grid.addWidget(QLabel('Postcode *'), 8, 0) grid.addWidget(q6Edit, 8, 1) grid.addWidget(QLabel('Huisnummer *'), 9, 0) grid.addWidget(q7Edit, 9, 1) grid.addWidget(QLabel('Toevoeging'), 9, 1, 1, 1, Qt.AlignRight) grid.addWidget(q8Edit, 9, 2) grid.addWidget(QLabel('e-mail *'), 10, 0) grid.addWidget(q9Edit, 10, 1, 1 ,2) grid.addWidget(QLabel('Wachtwoord *'), 11, 0) grid.addWidget(q10Edit, 11, 1, 1 ,2) grid.addWidget(QLabel('Wachtwoord controle *'), 12, 0) grid.addWidget(q11Edit, 12, 1, 1, 2) grid.addWidget(QLabel('Telefoonnummer'), 13, 0) grid.addWidget(q12Edit, 13, 1) grid.addWidget(QLabel('Accountnummer'), 14, 0) grid.addWidget(q13Edit, 14, 1) grid.addWidget(QLabel('\u00A9 2017 all rights reserved [email protected]'), 16, 0, 1, 3, Qt.AlignCenter) applyBtn = QPushButton('Invoeren') applyBtn.clicked.connect(self.accept) grid.addWidget(applyBtn, 14, 2, 1, 1, Qt.AlignRight) applyBtn.setFont(QFont("Arial",10)) applyBtn.setFixedWidth(100) applyBtn.setStyleSheet("color: black; background-color: gainsboro") cancelBtn = QPushButton('Sluiten') cancelBtn.clicked.connect(lambda: windowSluit(self)) grid.addWidget(cancelBtn, 13, 2 , 1, 1, Qt.AlignRight) cancelBtn.setFont(QFont("Arial",10)) cancelBtn.setFixedWidth(100) cancelBtn.setStyleSheet("color: black; background-color: gainsboro") helpBtn = QPushButton('Info') helpBtn.clicked.connect(lambda: info()) grid.addWidget(helpBtn, 12, 2 , 1, 1, Qt.AlignRight) helpBtn.setFont(QFont("Arial",10)) helpBtn.setFixedWidth(100) helpBtn.setStyleSheet("color: black; background-color: gainsboro") self.setLayout(grid) self.setGeometry(400, 150, 350, 300)
def load(self, path: str, is_first_call: bool = True) -> None: if path == self._path: return theme_full_path = os.path.join(path, "theme.json") Logger.log( "d", "Loading theme file: {theme_full_path}".format( theme_full_path=theme_full_path)) try: with open(theme_full_path, encoding="utf-8") as f: data = json.load(f) except EnvironmentError as e: Logger.error( "Unable to load theme file at {theme_full_path}: {err}".format( theme_full_path=theme_full_path, err=e)) return except UnicodeDecodeError: Logger.error( "Theme file at {theme_full_path} is corrupt (invalid UTF-8 bytes)." .format(theme_full_path=theme_full_path)) return # Iteratively load inherited themes try: theme_id = data["metadata"]["inherits"] self.load(Resources.getPath(Resources.Themes, theme_id), is_first_call=False) except FileNotFoundError: Logger.log("e", "Could not find inherited theme %s", theme_id) except KeyError: pass # No metadata or no inherits keyword in the theme.json file if "colors" in data: for name, color in data["colors"].items(): try: c = QColor(color[0], color[1], color[2], color[3]) except IndexError: # Color doesn't have enough components. Logger.log( "w", "Colour {name} doesn't have enough components. Need to have 4, but had {num_components}." .format(name=name, num_components=len(color))) continue # Skip this one then. self._colors[name] = c fonts_dir = os.path.join(path, "fonts") if os.path.isdir(fonts_dir): for root, dirnames, filenames in os.walk(fonts_dir): for filename in filenames: if filename.lower().endswith(".ttf"): QFontDatabase.addApplicationFont( os.path.join(root, filename)) if "fonts" in data: system_font_size = QCoreApplication.instance().font().pointSize() for name, font in data["fonts"].items(): q_font = QFont() q_font.setFamily( font.get("family", QCoreApplication.instance().font().family())) if font.get("bold"): q_font.setBold(font.get("bold", False)) else: q_font.setWeight(font.get("weight", 50)) q_font.setLetterSpacing(QFont.AbsoluteSpacing, font.get("letterSpacing", 0)) q_font.setItalic(font.get("italic", False)) q_font.setPointSize(int( font.get("size", 1) * system_font_size)) q_font.setCapitalization(QFont.AllUppercase if font.get( "capitalize", False) else QFont.MixedCase) self._fonts[name] = q_font if "sizes" in data: for name, size in data["sizes"].items(): s = QSizeF() s.setWidth(round(size[0] * self._em_width)) s.setHeight(round(size[1] * self._em_height)) self._sizes[name] = s iconsdir = os.path.join(path, "icons") if os.path.isdir(iconsdir): for icon in os.listdir(iconsdir): name = os.path.splitext(icon)[0] self._icons[name] = QUrl.fromLocalFile( os.path.join(iconsdir, icon)) imagesdir = os.path.join(path, "images") if os.path.isdir(imagesdir): for image in os.listdir(imagesdir): name = os.path.splitext(image)[0] self._images[name] = QUrl.fromLocalFile( os.path.join(imagesdir, image)) styles = os.path.join(path, "styles.qml") if os.path.isfile(styles): c = QQmlComponent(self._engine, styles) context = QQmlContext(self._engine, self._engine) context.setContextProperty("Theme", self) self._styles = c.create(context) if c.isError(): for error in c.errors(): Logger.log("e", error.toString()) Logger.log("d", "Loaded theme %s", path) self._path = path # only emit the theme loaded signal once after all the themes in the inheritance chain have been loaded if is_first_call: self.themeLoaded.emit()
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.setWindowTitle("Cluster -> Artikelen bereik") self.setWindowIcon(QIcon('./images/logos/logo.jpg')) self.setFont(QFont('Arial', 10)) self.Clusternummer = QLabel() clEdit = QLineEdit() font = QFont("Arial", 10) font.setCapitalization(QFont.AllUppercase) clEdit.setFont(font) reg_ex = QRegExp('^[A-Ka-k]{1}[[A-Za-z]{1}[0-9]{5}') input_validator = QRegExpValidator(reg_ex, clEdit) clEdit.setValidator(input_validator) clEdit.textChanged.connect(self.clChanged) self.Keuze = QLabel() k0Edit = QComboBox() k0Edit.setFixedWidth(320) k0Edit.setFont(QFont("Arial", 10)) k0Edit.setStyleSheet("color: black; background-color: #F8F7EE") k0Edit.addItem(' Zoeken Artikelen') k0Edit.addItem('1. Alle Artikelen') k0Edit.addItem('2. Filter op artikelnummer') k0Edit.addItem('3. Filter op artikelomschrijving') k0Edit.activated[str].connect(self.k0Changed) self.Zoekterm = QLabel() zktermEdit = QLineEdit() zktermEdit.setFixedWidth(210) zktermEdit.setFont(QFont("Arial", 10)) reg_ex = QRegExp('^.{0,20}$') input_validator = QRegExpValidator(reg_ex, zktermEdit) zktermEdit.setValidator(input_validator) zktermEdit.textChanged.connect(self.zktermChanged) grid = QGridLayout() grid.setSpacing(20) lbl = QLabel() pixmap = QPixmap('./images/logos/verbinding.jpg') lbl.setPixmap(pixmap) grid.addWidget(lbl, 1, 0, 1, 2) lbl2 = QLabel('Clusternummer') lbl2.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl2, 2, 0) grid.addWidget(clEdit, 2, 1) grid.addWidget(k0Edit, 3, 0, 1, 2, Qt.AlignRight) lbl1 = QLabel('Zoekterm') lbl1.setAlignment(Qt.AlignRight | Qt.AlignVCenter) grid.addWidget(lbl1, 4, 0) grid.addWidget(zktermEdit, 4, 1) self.setLayout(grid) self.setGeometry(500, 300, 150, 150) grid.addWidget( QLabel('\u00A9 2017 all rights reserved [email protected]'), 6, 0, 1, 3) logo = QLabel() pixmap = QPixmap('./images/logos/logo.jpg') logo.setPixmap(pixmap) grid.addWidget(logo, 1, 1, 1, 1, Qt.AlignRight) applyBtn = QPushButton('Zoeken') applyBtn.clicked.connect(self.accept) grid.addWidget(applyBtn, 5, 1, 1, 1, Qt.AlignRight) applyBtn.setFont(QFont("Arial", 10)) applyBtn.setFixedWidth(100) applyBtn.setStyleSheet( "color: black; background-color: gainsboro") cancelBtn = QPushButton('Sluiten') cancelBtn.clicked.connect(lambda: windowSluit(self, m_email)) grid.addWidget(cancelBtn, 5, 0, 1, 2, Qt.AlignCenter) cancelBtn.setFont(QFont("Arial", 10)) cancelBtn.setFixedWidth(100) cancelBtn.setStyleSheet( "color: black; background-color: gainsboro")
def load(self, path): self._path = path with open(os.path.join(self._path, "theme.json")) as f: data = json.load(f) self._initializeDefaults() if "colors" in data: for name, color in data["colors"].items(): c = QColor(color[0], color[1], color[2], color[3]) self._colors[name] = c fontsdir = os.path.join(self._path, "fonts") if os.path.isdir(fontsdir): for file in os.listdir(fontsdir): if "ttf" in file: QFontDatabase.addApplicationFont(os.path.join(fontsdir, file)) if "fonts" in data: for name, font in data["fonts"].items(): f = QFont() if not sys.platform == "win32": # Excluding windows here as a workaround for bad font rendering f.setFamily(font.get("family", QCoreApplication.instance().font().family())) f.setStyleName(font.get("style", "Regular")) f.setBold(font.get("bold", False)) f.setItalic(font.get("italic", False)) f.setPixelSize(font.get("size", 1) * self._em_height) f.setCapitalization(QFont.AllUppercase if font.get("capitalize", False) else QFont.MixedCase) self._fonts[name] = f if "sizes" in data: for name, size in data["sizes"].items(): s = QSizeF() s.setWidth(size[0] * self._em_width) s.setHeight(size[1] * self._em_height) self._sizes[name] = s styles = os.path.join(self._path, "styles.qml") if os.path.isfile(styles): c = QQmlComponent(self._engine, styles) self._styles = c.create() if c.isError(): for error in c.errors(): Logger.log("e", error.toString()) iconsdir = os.path.join(self._path, "icons") if os.path.isdir(iconsdir): for icon in os.listdir(iconsdir): name = os.path.splitext(icon)[0] self._icons[name] = QUrl.fromLocalFile(os.path.join(iconsdir, icon)) imagesdir = os.path.join(self._path, "images") if os.path.isdir(imagesdir): for image in os.listdir(imagesdir): name = os.path.splitext(image)[0] self._images[name] = QUrl.fromLocalFile(os.path.join(imagesdir, image)) Logger.log("d", "Loaded theme %s", self._path) self.themeLoaded.emit()
def load(self, path: str, is_first_call: bool = True) -> None: if path == self._path: return with open(os.path.join(path, "theme.json"), encoding = "utf-8") as f: Logger.log("d", "Loading theme file: %s", os.path.join(path, "theme.json")) data = json.load(f) # Iteratively load inherited themes try: theme_id = data["metadata"]["inherits"] self.load(Resources.getPath(Resources.Themes, theme_id), is_first_call = False) except FileNotFoundError: Logger.log("e", "Could not find inherited theme %s", theme_id) except KeyError: pass # No metadata or no inherits keyword in the theme.json file if "colors" in data: for name, color in data["colors"].items(): c = QColor(color[0], color[1], color[2], color[3]) self._colors[name] = c fonts_dir = os.path.join(path, "fonts") if os.path.isdir(fonts_dir): for file in os.listdir(fonts_dir): if "ttf" in file: QFontDatabase.addApplicationFont(os.path.join(fonts_dir, file)) if "fonts" in data: system_font_size = QCoreApplication.instance().font().pointSize() for name, font in data["fonts"].items(): q_font = QFont() q_font.setFamily(font.get("family", QCoreApplication.instance().font().family())) if font.get("bold"): q_font.setBold(font.get("bold", False)) else: q_font.setWeight(font.get("weight", 50)) q_font.setLetterSpacing(QFont.AbsoluteSpacing, font.get("letterSpacing", 0)) q_font.setItalic(font.get("italic", False)) q_font.setPointSize(int(font.get("size", 1) * system_font_size)) q_font.setCapitalization(QFont.AllUppercase if font.get("capitalize", False) else QFont.MixedCase) self._fonts[name] = q_font if "sizes" in data: for name, size in data["sizes"].items(): s = QSizeF() s.setWidth(round(size[0] * self._em_width)) s.setHeight(round(size[1] * self._em_height)) self._sizes[name] = s iconsdir = os.path.join(path, "icons") if os.path.isdir(iconsdir): for icon in os.listdir(iconsdir): name = os.path.splitext(icon)[0] self._icons[name] = QUrl.fromLocalFile(os.path.join(iconsdir, icon)) imagesdir = os.path.join(path, "images") if os.path.isdir(imagesdir): for image in os.listdir(imagesdir): name = os.path.splitext(image)[0] self._images[name] = QUrl.fromLocalFile(os.path.join(imagesdir, image)) styles = os.path.join(path, "styles.qml") if os.path.isfile(styles): c = QQmlComponent(self._engine, styles) context = QQmlContext(self._engine, self._engine) context.setContextProperty("Theme", self) self._styles = c.create(context) if c.isError(): for error in c.errors(): Logger.log("e", error.toString()) Logger.log("d", "Loaded theme %s", path) self._path = path # only emit the theme loaded signal once after all the themes in the inheritance chain have been loaded if is_first_call: self.themeLoaded.emit()
def __init__(self, parent=None): super(Widget, self).__init__(parent) self.setWindowTitle("Invoer Bedrijf Verkoop") self.setWindowIcon(QIcon('./images/logos/logo.jpg')) self.setFont(QFont('Arial', 10)) self.Bedrijfsnaam = QLabel() q3Edit = QLineEdit() q3Edit.setFixedWidth(540) q3Edit.setFont(QFont("Arial", 10)) q3Edit.textChanged.connect(self.q3Changed) reg_ex = QRegExp("^.{1,50}$") input_validator = QRegExpValidator(reg_ex, q3Edit) q3Edit.setValidator(input_validator) self.Afdeling = QLabel() q14Edit = QLineEdit() q14Edit.setFixedWidth(540) q14Edit.setFont(QFont("Arial", 10)) q14Edit.textChanged.connect(self.q14Changed) reg_ex = QRegExp("^.{1,50}$") input_validator = QRegExpValidator(reg_ex, q14Edit) q14Edit.setValidator(input_validator) self.Rechtsvorm = QLabel() q5Edit = QLineEdit() q5Edit.setFixedWidth(200) q5Edit.setFont(QFont("Arial", 10)) q5Edit.textChanged.connect(self.q5Changed) reg_ex = QRegExp("^.{1,30}$") input_validator = QRegExpValidator(reg_ex, q5Edit) q5Edit.setValidator(input_validator) self.BTWnummer = QLabel() q2Edit = QLineEdit() q2Edit.setFixedWidth(170) q2Edit.setText("") q2Edit.setFont(QFont("Arial", 10)) q2Edit.textChanged.connect(self.q2Changed) reg_ex = QRegExp("^[NLnl]{2}[0-9]{9}[Bb]{1}[0-9]{2}$") input_validator = QRegExpValidator(reg_ex, q2Edit) q2Edit.setValidator(input_validator) self.KvKnummer = QLabel() q4Edit = QLineEdit() q4Edit.setFixedWidth(120) q4Edit.setFont(QFont("Arial", 10)) q4Edit.textChanged.connect(self.q4Changed) reg_ex = QRegExp("^[0-9]{8}$") input_validator = QRegExpValidator(reg_ex, q4Edit) q4Edit.setValidator(input_validator) self.Postcode = QLabel() q6Edit = QLineEdit() q6Edit.setFixedWidth(80) font = QFont("Arial", 10) font.setCapitalization(QFont.AllUppercase) q6Edit.setFont(font) q6Edit.textChanged.connect(self.q6Changed) reg_ex = QRegExp("^[0-9]{4}[A-Za-z]{2}$") input_validator = QRegExpValidator(reg_ex, q6Edit) q6Edit.setValidator(input_validator) self.Huisnummer = QLabel() q7Edit = QLineEdit() q7Edit.setFixedWidth(60) q7Edit.setFont(QFont("Arial", 10)) q7Edit.textChanged.connect(self.q7Changed) reg_ex = QRegExp("^[0-9]{1,5}$") input_validator = QRegExpValidator(reg_ex, q7Edit) q7Edit.setValidator(input_validator) self.Toevoeging = QLabel() q8Edit = QLineEdit() q8Edit.setFixedWidth(80) q8Edit.setFont(QFont("Arial", 10)) q8Edit.textChanged.connect(self.q8Changed) reg_ex = QRegExp("^[A-Za-z0-9-]{0,10}") input_validator = QRegExpValidator(reg_ex, q8Edit) q8Edit.setValidator(input_validator) self.Telefoonnr = QLabel() q12Edit = QLineEdit() q12Edit.setFixedWidth(120) q12Edit.setFont(QFont("Arial", 10)) q12Edit.textChanged.connect(self.q12Changed) reg_ex = QRegExp("^[0]{1}[0-9]{9}$") input_validator = QRegExpValidator(reg_ex, q12Edit) q12Edit.setValidator(input_validator) self.Bedrijfsnummer = QLabel() q13Edit = QLineEdit() q13Edit.setText(str(bepaalKoper())) q13Edit.setAlignment(Qt.AlignRight) q13Edit.setStyleSheet("color: black") q13Edit.setFixedWidth(110) q13Edit.setDisabled(True) q13Edit.setFont(QFont("Arial", 10)) q13Edit.textChanged.connect(self.q13Changed) grid = QGridLayout() grid.setSpacing(20) lbl = QLabel() pixmap = QPixmap('./images/logos/verbinding.jpg') lbl.setPixmap(pixmap) grid.addWidget(lbl, 0, 0) logo = QLabel() pixmap = QPixmap('./images/logos/logo.jpg') logo.setPixmap(pixmap) grid.addWidget(logo, 0, 2, 1, 2, Qt.AlignRight) self.setFont(QFont('Arial', 10)) grid.addWidget(QLabel('Nieuwe Bedrijf-Verkoop invoeren'), 0, 1, 1, 2, Qt.AlignCenter) grid.addWidget(QLabel(' *'), 1, 0) grid.addWidget(QLabel('Verplichte velden'), 1, 1) grid.addWidget(QLabel('Bedrijfsnaam *'), 2, 0) grid.addWidget(q3Edit, 2, 1, 1, 3) grid.addWidget(QLabel('Afdelingsnaam/Kamer/\nKontaktpersoon'), 3, 0) grid.addWidget(q14Edit, 3, 1, 1, 3) grid.addWidget(QLabel('Rechtsvorm *'), 4, 0) grid.addWidget(q5Edit, 4, 1) grid.addWidget(QLabel('BTWnummer *'), 4, 1, 1, 1, Qt.AlignRight) grid.addWidget(q2Edit, 4, 2) grid.addWidget(QLabel('KvKnummer *'), 5, 0) grid.addWidget(q4Edit, 5, 1) grid.addWidget(QLabel('Postcode *'), 5, 1, 1, 1, Qt.AlignRight) grid.addWidget(q6Edit, 5, 2) grid.addWidget(QLabel('Huisnummer *'), 6, 0) grid.addWidget(q7Edit, 6, 1) grid.addWidget(QLabel('Toevoeging'), 6, 1, 1, 1, Qt.AlignRight) grid.addWidget(q8Edit, 6, 2) grid.addWidget(QLabel('Telefoonnummer *'), 7, 0) grid.addWidget(q12Edit, 7, 1) grid.addWidget(QLabel('Bedrijf-Verkoopnummer'), 8, 0) grid.addWidget(q13Edit, 8, 1) grid.addWidget( QLabel('\u00A9 2017 all rights reserved [email protected]'), 9, 1) cancelBtn = QPushButton('Sluiten') cancelBtn.clicked.connect(lambda: windowSluit(self, m_email)) applyBtn = QPushButton('Invoeren') applyBtn.clicked.connect(self.accept) grid.addWidget(applyBtn, 8, 2, 1, 1, Qt.AlignRight) applyBtn.setFont(QFont("Arial", 10)) applyBtn.setFixedWidth(100) applyBtn.setStyleSheet( "color: black; background-color: gainsboro") grid.addWidget(cancelBtn, 7, 2, 1, 1, Qt.AlignRight) cancelBtn.setFont(QFont("Arial", 10)) cancelBtn.setFixedWidth(100) cancelBtn.setStyleSheet( "color: black; background-color: gainsboro") self.setLayout(grid) self.setGeometry(500, 100, 150, 150)
def init_gui(self): """ Inicia la interfaz de la ventana de combate """ self.setWindowTitle("El duelo de DCCarate ha comenzado!") # Fondo self.setPixmap(QPixmap(self.rutas['fondo'])) self.setScaledContents(True) self.layout_principal = QVBoxLayout(self) # ---- Definicion de la barra superior ---- contenedor_info = QVBoxLayout() # Contenedor de la info superior # Label nombre jugador self.label_nombre = QLabel() font = QFont() font.setPointSize(22) font.setCapitalization(True) font.setFamily("Fantasy") self.label_nombre.setFont(font) self.label_nombre.setStyleSheet("color: rgb(244, 223, 9)") # Label icono jugador self.label_icono = QLabel(self) # Barras de vida self.barra_vida_enemigo = QProgressBar() self.barra_vida_enemigo.setTextVisible(False) self.barra_vida_enemigo.setStyleSheet( 'QProgressBar{background-color: rgb(255, 0, 0);' 'border-style:solid;}') self.barra_vida_enemigo.setValue(100) self.barra_vida_jugador = QProgressBar() self.barra_vida_jugador.setTextVisible(False) self.barra_vida_jugador.setStyleSheet( 'QProgressBar{background-color: rgb(255, 0, 0);' 'border-style:solid;}') self.barra_vida_jugador.setValue(100) # Contenedor horizontal del icono y el nombre hbox_superior = QHBoxLayout() hbox_superior.addWidget(self.label_icono) hbox_superior.addWidget(self.label_nombre) contenedor_info.addLayout(hbox_superior) # Contenedor horizontal de las barras de vida hbox_vidas = QHBoxLayout() hbox_vidas.addWidget(self.barra_vida_jugador) hbox_vidas.addWidget(self.barra_vida_enemigo) contenedor_info.addLayout(hbox_vidas) self.layout_principal.addLayout(contenedor_info) self.layout_principal.addStretch() # ---- Definicion del area de combate ---- # Imagenes jugadores self.jugador = QLabel(self) self.jugador.setFixedSize(91.75 * 1.1, 187.5 * 1.1) self.gif_jugador = QMovie(self.rutas['jugador']) self.jugador.setMovie(self.gif_jugador) self.jugador.setScaledContents(True) self.gif_jugador.start() self.jugador.move(60, 270) self.enemigo = QLabel(self) self.enemigo.setFixedSize(91.75 * 1.1, 187.5 * 1.1) self.enemigo.setPixmap(QPixmap(self.rutas['enemigo'])) self.enemigo.setScaledContents(True) self.enemigo.move(540, 270) # ---- Definicion de los controles inferiores ---- # Contenedor horizontal de los controles contenedor_controles = QHBoxLayout() # Agregamos los botones al layout contenedor_controles.addWidget(self.boton_patada) contenedor_controles.addWidget(self.boton_frio) contenedor_controles.addWidget(self.boton_defender) # Definimos el estilo de los botones self.boton_patada.setStyleSheet(self.estilo_botones) self.boton_frio.setStyleSheet(self.estilo_botones) self.boton_defender.setStyleSheet(self.estilo_botones) # Apretamos los botones hacia la izquierda y agregamos el contenedor a la ventana principal contenedor_controles.addStretch() self.layout_principal.addLayout(contenedor_controles) # Llamamos al método que tienen que implementar self.conectar_botones() self.repaint()
def init_ui(self): font = QFont() font.setLetterSpacing(QFont.AbsoluteSpacing, 0.8) font.setPixelSize(11) font.setCapitalization(QFont.AllUppercase) self.setFont(font)
def __init__(self, name): super().__init__(name) font = QFont("Helvetica [Cronyx]", 12) font.setCapitalization(QFont.SmallCaps) self.setFont(font)